only:mre_f4
This commit is contained in:
parent
ca850a8437
commit
c08e4c3af5
|
@ -49,6 +49,15 @@ bool isPedalError() {
|
|||
|
||||
extern SentTps sentTps;
|
||||
|
||||
float decodeTpsSentValue(float sentValue) {
|
||||
switch (engineConfiguration->sentEtbType) {
|
||||
case SentEtbType::GM_TYPE_1:
|
||||
return interpolateMsg("tps", /*x1*/0xE48, /*y1*/0, /*x2*/0x1A0, /*y2*/POSITION_FULLY_OPEN, /*x*/sentValue);
|
||||
default:
|
||||
return interpolateMsg("tps", /*x1*/engineConfiguration->customSentTpsMin, /*y1*/0, /*x2*/engineConfiguration->customSentTpsMax, /*y2*/POSITION_FULLY_OPEN, /*x*/sentValue);
|
||||
}
|
||||
}
|
||||
|
||||
void sentTpsDecode() {
|
||||
#if EFI_SENT_SUPPORT
|
||||
if (!isDigitalTps1()) {
|
||||
|
@ -56,16 +65,8 @@ void sentTpsDecode() {
|
|||
}
|
||||
// todo: move away from weird float API
|
||||
float sentValue = getSentValue(0);
|
||||
float tpsValue;
|
||||
switch (engineConfiguration->sentEtbType) {
|
||||
case SentEtbType::GM_TYPE_1:
|
||||
tpsValue = interpolateClamped(/*x1*/0xE48, /*y1*/0, /*x2*/0x1A0, /*y2*/POSITION_FULLY_OPEN, /*x*/sentValue);
|
||||
break;
|
||||
default:
|
||||
tpsValue = interpolateClamped(/*x1*/engineConfiguration->customSentTpsMin, /*y1*/0, /*x2*/engineConfiguration->customSentTpsMax, /*y2*/POSITION_FULLY_OPEN, /*x*/sentValue);
|
||||
break;
|
||||
}
|
||||
float tpsValue = decodeTpsSentValue(sentValue);
|
||||
|
||||
sentTps.setValidValue(tpsValue, getTimeNowNt());
|
||||
#endif // EFI_SENT_SUPPORT
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,6 +37,7 @@ void grabPedalIsUp();
|
|||
void grabPedalIsWideOpen();
|
||||
|
||||
void sentTpsDecode();
|
||||
float decodeTpsSentValue(float sentValue);
|
||||
bool isDigitalTps1();
|
||||
|
||||
bool isTps1Error();
|
||||
|
|
|
@ -152,3 +152,16 @@ TEST(etb, sentTpsIntegrated) {
|
|||
initTps();
|
||||
doInitElectronicThrottle();
|
||||
}
|
||||
|
||||
TEST(etb, sentTpsIntegratedDecode) {
|
||||
EngineTestHelper eth(TEST_ENGINE); // we have a destructor so cannot move EngineTestHelper into utility method
|
||||
|
||||
engineConfiguration->sentEtbType = SentEtbType::GM_TYPE_1;
|
||||
|
||||
ASSERT_NEAR(20.246, decodeTpsSentValue(3000), EPS2D);
|
||||
|
||||
engineConfiguration->sentEtbType = SentEtbType::CUSTOM;
|
||||
engineConfiguration->customSentTpsMin = 5000;
|
||||
engineConfiguration->customSentTpsMax = 1000;
|
||||
ASSERT_NEAR(75, decodeTpsSentValue(2000), EPS2D);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue