diff --git a/firmware/controllers/algo/dynoview.cpp b/firmware/controllers/algo/dynoview.cpp index 390fd34ce5..a77c6821b2 100644 --- a/firmware/controllers/algo/dynoview.cpp +++ b/firmware/controllers/algo/dynoview.cpp @@ -95,8 +95,8 @@ void DynoView::updateHP() { engineForce = engineConfiguration->vehicleWeight * acceleration; enginePower = engineForce * (vss / 3.6); engineHP = enginePower / 746; - if (isValidRpm(GET_RPM())) { - engineTorque = ((engineHP * 5252) / GET_RPM()); + if (Sensor::getOrZero(SensorType::Rpm) > 0) { + engineTorque = ((engineHP * 5252) / Sensor::getOrZero(SensorType::Rpm)); } } else { //we should calculate static power diff --git a/unit_tests/tests/test_dynoview.cpp b/unit_tests/tests/test_dynoview.cpp index 9737c7aab2..7337a3f478 100644 --- a/unit_tests/tests/test_dynoview.cpp +++ b/unit_tests/tests/test_dynoview.cpp @@ -66,7 +66,7 @@ TEST(DynoView, VSS_fast) { // Test Speed threshold engineConfiguration->vehicleWeight = 900; //kg - engine->rpmCalculator.mockRpm = 2200; + Sensor::setMockValue(SensorType::Rpm, 2200); eth.moveTimeForwardMs(50); Sensor::setMockValue(SensorType::VehicleSpeed, 50.0); @@ -89,7 +89,7 @@ TEST(DynoView, VSS_Torque) { // Test Speed threshold engineConfiguration->vehicleWeight = 900; //kg - engine->rpmCalculator.mockRpm = 2200; + Sensor::setMockValue(SensorType::Rpm, 2200); eth.moveTimeForwardMs(50); Sensor::setMockValue(SensorType::VehicleSpeed, 80.0);