diff --git a/firmware/config/boards/f407-discovery/board.mk b/firmware/config/boards/f407-discovery/board.mk index 6ddbf50492..50932be442 100644 --- a/firmware/config/boards/f407-discovery/board.mk +++ b/firmware/config/boards/f407-discovery/board.mk @@ -22,6 +22,8 @@ DDEFS += -DFLEXIBLE_CRITICAL_LED=1 DDEFS += -DHW_FRANKENSO=1 DDEFS += $(DEFAULT_ENGINE_TYPE) +DDEFS += -DEFI_SENT_SUPPORT=TRUE + # TS_SECONDARY_UxART_PORT DDEFS += -DSTM32_SERIAL_USE_USART3=TRUE DDEFS += -DTS_SECONDARY_UxART_PORT=SD3 diff --git a/firmware/controllers/sensors/tps.cpp b/firmware/controllers/sensors/tps.cpp index 0c92485d81..804bed2021 100644 --- a/firmware/controllers/sensors/tps.cpp +++ b/firmware/controllers/sensors/tps.cpp @@ -2,6 +2,7 @@ * @author Andrey Belomutskiy, (c) 2012-2020 */ #include "pch.h" +#include "sent.h" void grabTPSIsClosed() { #if EFI_PROD_CODE @@ -46,5 +47,14 @@ bool isPedalError() { return !Sensor::get(SensorType::AcceleratorPedal).Valid && Sensor::hasSensor(SensorType::AcceleratorPedalPrimary); } +extern SentTps sentTps; + void sentTpsDecode() { +#if EFI_SENT_SUPPORT + if (!isDigitalTps1()) { + return; + } + float value = getSentValue(0); + sentTps.setValidValue(value, getTimeNowNt()); +#endif // EFI_SENT_SUPPORT } \ No newline at end of file diff --git a/firmware/controllers/sensors/tps.h b/firmware/controllers/sensors/tps.h index da9f589d74..0f41989e4c 100644 --- a/firmware/controllers/sensors/tps.h +++ b/firmware/controllers/sensors/tps.h @@ -30,6 +30,7 @@ void grabPedalIsUp(); void grabPedalIsWideOpen(); void sentTpsDecode(); +bool isDigitalTps1(); bool isTps1Error(); bool isTps2Error(); diff --git a/firmware/init/sensor/init_tps.cpp b/firmware/init/sensor/init_tps.cpp index f412bd5a4b..db6b585302 100644 --- a/firmware/init/sensor/init_tps.cpp +++ b/firmware/init/sensor/init_tps.cpp @@ -165,7 +165,7 @@ static FuncSensPair tps2s(TPS_TS_CONVERSION, SensorType::Tps2Secondary); static RedundantPair analogTps1(tps1p, tps1s, SensorType::Tps1); static RedundantPair tps2(tps2p, tps2s, SensorType::Tps2); -static SentTps sentTps; +SentTps sentTps; // Used only in case of weird Ford-style ETB TPS static RedundantFordTps fordTps1(SensorType::Tps1, SensorType::Tps1Primary, SensorType::Tps1Secondary);