vBatt -> SensorType::vBatt #2260

This commit is contained in:
rusefillc 2021-03-11 22:52:34 -05:00
parent c7d8997a3a
commit d650271077
3 changed files with 6 additions and 6 deletions

View File

@ -292,7 +292,7 @@ void Engine::updateSlowSensors(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
#if (BOARD_TLE8888_COUNT > 0)
// nasty value injection into C driver which would not be able to access Engine class
vBattForTle8888 = sensors.vBatt;
vBattForTle8888 = Sensor::get(SensorType::BatteryVoltage).value_or(VBAT_FALLBACK_VALUE);
#endif /* BOARD_TLE8888_COUNT */
#if EFI_MC33816
@ -556,7 +556,7 @@ void Engine::checkShutdown(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
// if the ignition key is turned on again,
// we cancel the shutdown mode, but only if all shutdown procedures are complete
const float vBattThresholdOn = 8.0f;
if ((sensors.vBatt > vBattThresholdOn) && !isInShutdownMode(PASS_ENGINE_PARAMETER_SIGNATURE)) {
if ((Sensor::get(SensorType::BatteryVoltage).value_or(VBAT_FALLBACK_VALUE) > vBattThresholdOn) && !isInShutdownMode(PASS_ENGINE_PARAMETER_SIGNATURE)) {
ignitionOnTimeNt = getTimeNowNt();
stopEngineRequestTimeNt = 0;
scheduleMsg(&engineLogger, "Ignition voltage detected! Cancel the engine shutdown!");
@ -578,7 +578,7 @@ bool Engine::isInShutdownMode(DECLARE_ENGINE_PARAMETER_SIGNATURE) const {
if (stopEngineRequestTimeNt == 0 && ignitionOnTimeNt > 0) {
const float vBattThresholdOff = 5.0f;
// start the shutdown process if the ignition voltage dropped low
if (sensors.vBatt <= vBattThresholdOff) {
if (Sensor::get(SensorType::BatteryVoltage).value_or(VBAT_FALLBACK_VALUE) <= vBattThresholdOff) {
scheduleStopEngine();
}
}

View File

@ -138,7 +138,7 @@ void canMazdaRX8(void) {
msg[4] = 0x01; //Oil Pressure (not really a gauge)
msg[5] = 0x00; //check engine light
msg[6] = 0x00; //Coolant, oil and battery
if ((GET_RPM()>0) && (engine->sensors.vBatt<13)) {
if ((GET_RPM()>0) && (Sensor::get(SensorType::BatteryVoltage).value_or(VBAT_FALLBACK_VALUE)<13)) {
msg.setBit(6, 6); // battery light
}
if (!clt.Valid || clt.Value > 105) {

View File

@ -474,7 +474,7 @@ static void mcRestart() {
driven.setValue(0); // ensure driven is off
if (engine->sensors.vBatt < LOW_VBATT) {
if (Sensor::get(SensorType::BatteryVoltage).value_or(VBAT_FALLBACK_VALUE) < LOW_VBATT) {
scheduleMsg(logger, "GDI not Restarting until we see VBatt");
return;
}
@ -570,7 +570,7 @@ void initMc33816IfNeeded() {
if (!haveMc33816) {
return;
}
if (engine->sensors.vBatt < LOW_VBATT) {
if (Sensor::get(SensorType::BatteryVoltage).value_or(VBAT_FALLBACK_VALUE) < LOW_VBATT) {
isInitializaed = false;
} else {
if (!isInitializaed) {