Pedal rx shim (#1207)
* rx pedal over can * guard * guard * don't cast away qualifiers
This commit is contained in:
parent
41443520b8
commit
fefb5e3b1a
|
@ -26,6 +26,7 @@ static void printPacket(const CANRxFrame& rx, Logging* logger) {
|
||||||
}
|
}
|
||||||
|
|
||||||
volatile float aemXSeriesLambda = 0;
|
volatile float aemXSeriesLambda = 0;
|
||||||
|
volatile float canPedal = 0;
|
||||||
|
|
||||||
void processCanRxMessage(const CANRxFrame& frame, Logging* logger) {
|
void processCanRxMessage(const CANRxFrame& frame, Logging* logger) {
|
||||||
// TODO: if/when we support multiple lambda sensors, sensor N
|
// TODO: if/when we support multiple lambda sensors, sensor N
|
||||||
|
@ -34,6 +35,9 @@ void processCanRxMessage(const CANRxFrame& frame, Logging* logger) {
|
||||||
// AEM x-series lambda sensor reports in 0.0001 lambda per bit
|
// AEM x-series lambda sensor reports in 0.0001 lambda per bit
|
||||||
uint16_t lambdaInt = SWAP_UINT16(frame.data16[0]);
|
uint16_t lambdaInt = SWAP_UINT16(frame.data16[0]);
|
||||||
aemXSeriesLambda = 0.0001f * lambdaInt;
|
aemXSeriesLambda = 0.0001f * lambdaInt;
|
||||||
|
} else if (frame.EID == 0x202) {
|
||||||
|
int16_t pedalScaled = *reinterpret_cast<const uint16_t*>(&frame.data8[0]);
|
||||||
|
canPedal = pedalScaled * 0.01f;
|
||||||
} else {
|
} else {
|
||||||
printPacket(frame, logger);
|
printPacket(frame, logger);
|
||||||
obdOnCanPacketRx(frame);
|
obdOnCanPacketRx(frame);
|
||||||
|
|
|
@ -213,7 +213,14 @@ bool hasSecondThrottleBody(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
return engineConfiguration->tps2_1AdcChannel != EFI_ADC_NONE;
|
return engineConfiguration->tps2_1AdcChannel != EFI_ADC_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern float canPedal;
|
||||||
|
|
||||||
percent_t getPedalPosition(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
percent_t getPedalPosition(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
|
#if EFI_CANBUS_PEDAL
|
||||||
|
return canPedal;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
if (mockPedalPosition != MOCK_UNDEFINED) {
|
if (mockPedalPosition != MOCK_UNDEFINED) {
|
||||||
return mockPedalPosition;
|
return mockPedalPosition;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue