vBatt -> SensorType::vBatt fix #2260
This commit is contained in:
parent
d650271077
commit
16b8fb64ca
|
@ -288,8 +288,6 @@ void Engine::updateSlowSensors(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
fuelLevelVoltage);
|
fuelLevelVoltage);
|
||||||
}
|
}
|
||||||
|
|
||||||
sensors.vBatt = Sensor::get(SensorType::BatteryVoltage).value_or(VBAT_FALLBACK_VALUE);
|
|
||||||
|
|
||||||
#if (BOARD_TLE8888_COUNT > 0)
|
#if (BOARD_TLE8888_COUNT > 0)
|
||||||
// nasty value injection into C driver which would not be able to access Engine class
|
// nasty value injection into C driver which would not be able to access Engine class
|
||||||
vBattForTle8888 = Sensor::get(SensorType::BatteryVoltage).value_or(VBAT_FALLBACK_VALUE);
|
vBattForTle8888 = Sensor::get(SensorType::BatteryVoltage).value_or(VBAT_FALLBACK_VALUE);
|
||||||
|
|
|
@ -36,9 +36,6 @@ public:
|
||||||
|
|
||||||
Accelerometer accelerometer;
|
Accelerometer accelerometer;
|
||||||
|
|
||||||
// todo: remove this variable, replace with Sensor::get(SensorType::BatteryVoltage).value_or(VBAT_FALLBACK_VALUE)
|
|
||||||
// todo: https://github.com/rusefi/rusefi/issues/2260
|
|
||||||
float vBatt = 0;
|
|
||||||
/**
|
/**
|
||||||
* that's fuel in tank - just a gauge
|
* that's fuel in tank - just a gauge
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -78,7 +78,7 @@ float InjectorModel::getInjectorMassFlowRate() const {
|
||||||
|
|
||||||
float InjectorModel::getDeadtime() const {
|
float InjectorModel::getDeadtime() const {
|
||||||
return interpolate2d(
|
return interpolate2d(
|
||||||
ENGINE(sensors.vBatt),
|
Sensor::get(SensorType::BatteryVoltage).value_or(VBAT_FALLBACK_VALUE),
|
||||||
engineConfiguration->injector.battLagCorrBins,
|
engineConfiguration->injector.battLagCorrBins,
|
||||||
engineConfiguration->injector.battLagCorr
|
engineConfiguration->injector.battLagCorr
|
||||||
);
|
);
|
||||||
|
|
|
@ -20,7 +20,7 @@ CJ125::CJ125() : wboHeaterControl("wbo"),
|
||||||
void CJ125::SetHeater(float value DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
void CJ125::SetHeater(float value DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||||
// limit duty cycle for sensor safety
|
// limit duty cycle for sensor safety
|
||||||
// todo: would be much nicer to have continuous function (vBatt)
|
// todo: would be much nicer to have continuous function (vBatt)
|
||||||
float maxDuty = (engine->sensors.vBatt > CJ125_HEATER_LIMITING_VOLTAGE) ? CJ125_HEATER_LIMITING_RATE : 1.0f;
|
float maxDuty = (Sensor::get(SensorType::BatteryVoltage).value_or(VBAT_FALLBACK_VALUE) > CJ125_HEATER_LIMITING_VOLTAGE) ? CJ125_HEATER_LIMITING_RATE : 1.0f;
|
||||||
heaterDuty = (value < CJ125_HEATER_MIN_DUTY) ? 0.0f : minF(maxF(value, 0.0f), maxDuty);
|
heaterDuty = (value < CJ125_HEATER_MIN_DUTY) ? 0.0f : minF(maxF(value, 0.0f), maxDuty);
|
||||||
#ifdef CJ125_DEBUG
|
#ifdef CJ125_DEBUG
|
||||||
scheduleMsg(logger, "cjSetHeater: %.2f", heaterDuty);
|
scheduleMsg(logger, "cjSetHeater: %.2f", heaterDuty);
|
||||||
|
|
|
@ -49,10 +49,10 @@ TEST(InjectorModel, Deadtime) {
|
||||||
InjectorModel dut;
|
InjectorModel dut;
|
||||||
INJECT_ENGINE_REFERENCE(&dut);
|
INJECT_ENGINE_REFERENCE(&dut);
|
||||||
|
|
||||||
engine->sensors.vBatt = 3;
|
Sensor::setMockValue(SensorType::BatteryVoltage, 3);
|
||||||
EXPECT_EQ(dut.getDeadtime(), 6);
|
EXPECT_EQ(dut.getDeadtime(), 6);
|
||||||
|
|
||||||
engine->sensors.vBatt = 7;
|
Sensor::setMockValue(SensorType::BatteryVoltage, 7);
|
||||||
EXPECT_EQ(dut.getDeadtime(), 14);
|
EXPECT_EQ(dut.getDeadtime(), 14);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue