migrating to SensorType::Rpm API

This commit is contained in:
Andrey 2022-01-20 23:43:18 -05:00
parent 26c2d76f6c
commit 4ebb3c94d3
2 changed files with 6 additions and 6 deletions

View File

@ -106,7 +106,7 @@ void LaunchControlBase::update() {
return;
}
int rpm = GET_RPM();
int rpm = Sensor::getOrZero(SensorType::Rpm);
combinedConditions = isLaunchConditionMet(rpm);
//and still recalculate in case user changed the values
@ -131,7 +131,7 @@ void LaunchControlBase::update() {
}
bool LaunchControlBase::isLaunchRpmRetardCondition() const {
return isLaunchCondition && (retardThresholdRpm < GET_RPM());
return isLaunchCondition && (retardThresholdRpm < Sensor::getOrZero(SensorType::Rpm));
}
bool LaunchControlBase::isLaunchSparkRpmRetardCondition() const {

View File

@ -108,11 +108,11 @@ TEST(LaunchControl, CombinedCondition) {
Sensor::setMockValue(SensorType::DriverThrottleIntent, 20.0f);
Sensor::setMockValue(SensorType::VehicleSpeed, 10.0);
engine->rpmCalculator.mockRpm = 1200;
Sensor::setMockValue(SensorType::Rpm, 1200);
EXPECT_FALSE(dut.isLaunchConditionMet(1200));
engine->rpmCalculator.mockRpm = 3200;
Sensor::setMockValue(SensorType::Rpm, 3200);
EXPECT_TRUE(dut.isLaunchConditionMet(3200));
Sensor::setMockValue(SensorType::VehicleSpeed, 40.0);
@ -156,7 +156,7 @@ TEST(LaunchControl, CompleteRun) {
Sensor::setMockValue(SensorType::DriverThrottleIntent, 20.0f);
Sensor::setMockValue(SensorType::VehicleSpeed, 10.0);
engine->rpmCalculator.mockRpm = 1200;
Sensor::setMockValue(SensorType::Rpm, 1200);
engine->launchController.update();
@ -166,7 +166,7 @@ TEST(LaunchControl, CompleteRun) {
EXPECT_FALSE(engine->launchController.isLaunchFuelRpmRetardCondition());
engine->rpmCalculator.mockRpm = 3510;
Sensor::setMockValue(SensorType::Rpm, 3510);
//update condition check
engine->launchController.update();