enginePins.o2heater technical debt or confusion #5727

This commit is contained in:
rusefillc 2023-11-15 16:44:33 -05:00
parent 7608699a2d
commit c6b2a014c3
3 changed files with 10 additions and 2 deletions

View File

@ -154,7 +154,8 @@ void Engine::periodicSlowCallback() {
updateVrThresholdPwm();
enginePins.o2heater.setValue(engineConfiguration->forceO2Heating || engine->rpmCalculator.isRunning());
getEngineState()->heaterControlEnabled = engineConfiguration->forceO2Heating || engine->rpmCalculator.isRunning();
enginePins.o2heater.setValue(getEngineState()->heaterControlEnabled);
enginePins.starterRelayDisable.setValue(Sensor::getOrZero(SensorType::Rpm) < engineConfiguration->cranking.rpm);
updateGppwm();

View File

@ -142,7 +142,7 @@ void sendWidebandInfo() {
m[0] = vbatt;
// Offset 1 bit 0 = heater enable
m[1] = enginePins.o2heater.getLogicValue() ? 0x01 : 0x00;
m[1] = engine->engineState.heaterControlEnabled ? 0x01 : 0x00;
}
#endif // EFI_WIDEBAND_FIRMWARE_UPDATE && HAL_USE_CAN

View File

@ -114,6 +114,13 @@ void AemXSeriesWideband::decodeRusefiDiag(const CANRxFrame& frame) {
// no conversion, just ohms
esr = data->Esr;
// todo: suggest values 1 and 2 into the official WB source fault enum?
#define HACK_CRANKING_VALUE 2
if (!engine->engineState.heaterControlEnabled) {
faultCode = HACK_CRANKING_VALUE;
return;
}
faultCode = static_cast<uint8_t>(data->Status);
if (data->Status != wbo::Fault::None) {