Skip to content

Commit

Permalink
Native SENT TPS input #5079
Browse files Browse the repository at this point in the history
only:mre_f4
  • Loading branch information
rusefillc committed Mar 1, 2023
1 parent 6bce0e3 commit 1a8af17
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 1 deletion.
2 changes: 2 additions & 0 deletions firmware/config/boards/f407-discovery/board.mk
Expand Up @@ -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
Expand Down
10 changes: 10 additions & 0 deletions firmware/controllers/sensors/tps.cpp
Expand Up @@ -2,6 +2,7 @@
* @author Andrey Belomutskiy, (c) 2012-2020
*/
#include "pch.h"
#include "sent.h"

void grabTPSIsClosed() {
#if EFI_PROD_CODE
Expand Down Expand Up @@ -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
}
1 change: 1 addition & 0 deletions firmware/controllers/sensors/tps.h
Expand Up @@ -30,6 +30,7 @@ void grabPedalIsUp();
void grabPedalIsWideOpen();

void sentTpsDecode();
bool isDigitalTps1();

bool isTps1Error();
bool isTps2Error();
Expand Down
2 changes: 1 addition & 1 deletion firmware/init/sensor/init_tps.cpp
Expand Up @@ -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);
Expand Down

0 comments on commit 1a8af17

Please sign in to comment.