mirror of https://github.com/rusefi/rusefi-1.git
migrating to SensorType::Rpm API
This commit is contained in:
parent
3b6ecb432b
commit
df5cb34fb8
|
@ -298,7 +298,7 @@ expected<percent_t> EtbController::getSetpointEtb() const {
|
|||
// and let the engine idle.
|
||||
float sanitizedPedal = clampF(0, pedalPosition.value_or(0), 100);
|
||||
|
||||
float rpm = GET_RPM();
|
||||
float rpm = Sensor::getOrZero(SensorType::Rpm);
|
||||
float targetFromTable = m_pedalMap->getValue(rpm, sanitizedPedal);
|
||||
engine->engineState.targetFromTable = targetFromTable;
|
||||
|
||||
|
@ -557,7 +557,7 @@ void EtbController::update() {
|
|||
m_pid.iTermMax = engineConfiguration->etb_iTermMax;
|
||||
|
||||
// Update local state about autotune
|
||||
m_isAutotune = GET_RPM() == 0
|
||||
m_isAutotune = Sensor::getOrZero(SensorType::Rpm) == 0
|
||||
&& engine->etbAutoTune
|
||||
&& m_function == ETB_Throttle1;
|
||||
|
||||
|
@ -583,7 +583,7 @@ struct EtbImpl final : public EtbController {
|
|||
#if EFI_TUNER_STUDIO
|
||||
if (m_isAutocal) {
|
||||
// Don't allow if engine is running!
|
||||
if (GET_RPM() > 0) {
|
||||
if (Sensor::getOrZero(SensorType::Rpm) > 0) {
|
||||
m_isAutocal = false;
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -403,23 +403,23 @@ TEST(etb, setpointRevLimit) {
|
|||
etb.init(ETB_Throttle1, nullptr, nullptr, &pedalMap, true);
|
||||
|
||||
// Below threshold, should return unadjusted throttle
|
||||
engine->rpmCalculator.mockRpm = 1000;
|
||||
Sensor::setMockValue(SensorType::Rpm, 1000);
|
||||
EXPECT_EQ(80, etb.getSetpoint().value_or(-1));
|
||||
|
||||
// At threshold, should return unadjusted throttle
|
||||
engine->rpmCalculator.mockRpm = 5000;
|
||||
Sensor::setMockValue(SensorType::Rpm, 5000);
|
||||
EXPECT_EQ(80, etb.getSetpoint().value_or(-1));
|
||||
|
||||
// Middle of range, should return half of unadjusted
|
||||
engine->rpmCalculator.mockRpm = 5375;
|
||||
Sensor::setMockValue(SensorType::Rpm, 5375);
|
||||
EXPECT_EQ(40, etb.getSetpoint().value_or(-1));
|
||||
|
||||
// At limit+range, should return 0
|
||||
engine->rpmCalculator.mockRpm = 5750;
|
||||
Sensor::setMockValue(SensorType::Rpm, 5750);
|
||||
EXPECT_EQ(1, etb.getSetpoint().value_or(-1));
|
||||
|
||||
// Above limit+range, should return 0
|
||||
engine->rpmCalculator.mockRpm = 6000;
|
||||
Sensor::setMockValue(SensorType::Rpm, 6000);
|
||||
EXPECT_EQ(1, etb.getSetpoint().value_or(-1));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue