mirror of https://github.com/rusefi/wideband.git
avoid NaN in case of zero battery voltage
This commit is contained in:
parent
99335f90c1
commit
52f306b6f5
|
@ -178,7 +178,7 @@ void HeaterControllerBase::Update(const ISampler& sampler, HeaterAllow heaterAll
|
||||||
}
|
}
|
||||||
|
|
||||||
// duty = (V_eff / V_batt) ^ 2
|
// duty = (V_eff / V_batt) ^ 2
|
||||||
float voltageRatio = heaterVoltage / batteryVoltage;
|
float voltageRatio = (batteryVoltage < 1.0f) ? 0 : heaterVoltage / batteryVoltage;
|
||||||
float duty = voltageRatio * voltageRatio;
|
float duty = voltageRatio * voltageRatio;
|
||||||
|
|
||||||
#ifdef HEATER_MAX_DUTY
|
#ifdef HEATER_MAX_DUTY
|
||||||
|
|
Loading…
Reference in New Issue