diff --git a/firmware/console/status_loop.cpp b/firmware/console/status_loop.cpp index e5c30058ee..fe21ba58b4 100644 --- a/firmware/console/status_loop.cpp +++ b/firmware/console/status_loop.cpp @@ -841,7 +841,7 @@ void updateTunerStudioState(TunerStudioOutputChannels *tsOutputChannels DECLARE_ { float instantRpm = engine->triggerCentral.triggerState.instantRpm; tsOutputChannels->debugFloatField1 = instantRpm; - tsOutputChannels->debugFloatField2 = instantRpm / GET_RPM_VALUE; + tsOutputChannels->debugFloatField2 = instantRpm / GET_RPM(); } break; case DBG_ION: diff --git a/firmware/controllers/actuators/alternator_controller.cpp b/firmware/controllers/actuators/alternator_controller.cpp index 213c4d5790..54acc7dfc2 100644 --- a/firmware/controllers/actuators/alternator_controller.cpp +++ b/firmware/controllers/actuators/alternator_controller.cpp @@ -72,7 +72,7 @@ class AlternatorController : public PeriodicTimerController { } // todo: migrate this to FSIO - bool alternatorShouldBeEnabledAtCurrentRpm = GET_RPM_VALUE > engineConfiguration->cranking.rpm; + bool alternatorShouldBeEnabledAtCurrentRpm = GET_RPM() > engineConfiguration->cranking.rpm; engine->isAlternatorControlEnabled = CONFIG(isAlternatorControlEnabled) && alternatorShouldBeEnabledAtCurrentRpm; if (!engine->isAlternatorControlEnabled) { diff --git a/firmware/controllers/actuators/aux_pid.cpp b/firmware/controllers/actuators/aux_pid.cpp index be8d4b896d..c68c4cb6bd 100644 --- a/firmware/controllers/actuators/aux_pid.cpp +++ b/firmware/controllers/actuators/aux_pid.cpp @@ -70,7 +70,7 @@ public: } - float rpm = GET_RPM_VALUE; + float rpm = GET_RPM(); // todo: make this configurable? bool enabledAtCurrentRpm = rpm > engineConfiguration->cranking.rpm; diff --git a/firmware/controllers/actuators/idle_thread.cpp b/firmware/controllers/actuators/idle_thread.cpp index befaa71763..96c57bf296 100644 --- a/firmware/controllers/actuators/idle_thread.cpp +++ b/firmware/controllers/actuators/idle_thread.cpp @@ -658,7 +658,7 @@ static void applyIdleSolenoidPinState(int stateIndex, PwmConfig *state) /* pwm_g OutputPin *output = state->outputPins[0]; int value = state->multiChannelStateSequence.getChannelState(/*channelIndex*/0, stateIndex); if (!value /* always allow turning solenoid off */ || - (GET_RPM_VALUE != 0 || timeToStopIdleTest != 0) /* do not run solenoid unless engine is spinning or bench testing in progress */ + (GET_RPM() != 0 || timeToStopIdleTest != 0) /* do not run solenoid unless engine is spinning or bench testing in progress */ ) { output->setValue(value); } diff --git a/firmware/controllers/algo/engine.cpp b/firmware/controllers/algo/engine.cpp index 6027ca407c..ecf67e7861 100644 --- a/firmware/controllers/algo/engine.cpp +++ b/firmware/controllers/algo/engine.cpp @@ -347,7 +347,7 @@ void Engine::OnTriggerInvalidIndex(int currentIndex) { Engine *engine = this; EXPAND_Engine; // let's not show a warning if we are just starting to spin - if (GET_RPM_VALUE != 0) { + if (GET_RPM() != 0) { warning(CUSTOM_SYNC_ERROR, "sync error: index #%d above total size %d", currentIndex, triggerCentral.triggerShape.getSize()); triggerCentral.triggerState.setTriggerErrorState(); } diff --git a/firmware/controllers/algo/launch_control.cpp b/firmware/controllers/algo/launch_control.cpp index 8baf99329e..abc2da7a21 100644 --- a/firmware/controllers/algo/launch_control.cpp +++ b/firmware/controllers/algo/launch_control.cpp @@ -66,7 +66,7 @@ class LaunchControl: public PeriodicTimerController { return; } - int rpm = GET_RPM_VALUE; + int rpm = GET_RPM(); int speed = getVehicleSpeed(); auto tps = Sensor::get(SensorType::DriverThrottleIntent); int tpstreshold = engineConfiguration->launchTpsTreshold; @@ -139,13 +139,13 @@ void setDefaultLaunchParameters(DECLARE_CONFIG_PARAMETER_SIGNATURE) { } void applyLaunchControlLimiting(bool *limitedSpark, bool *limitedFuel DECLARE_ENGINE_PARAMETER_SUFFIX) { - int rpm = GET_RPM_VALUE; + int rpm = GET_RPM(); int retardThresholdRpm = CONFIG(launchRpm) + (CONFIG(enableLaunchRetard) ? CONFIG(launchAdvanceRpmRange) : 0) + CONFIG(hardCutRpmRange); - if (retardThresholdRpm > GET_RPM_VALUE) { + if (retardThresholdRpm > GET_RPM()) { *limitedSpark = engine->isLaunchCondition && engineConfiguration->launchSparkCutEnable; *limitedFuel = engine->isLaunchCondition && engineConfiguration->launchFuelCutEnable; engine->rpmHardCut = true; diff --git a/firmware/controllers/engine_cycle/aux_valves.cpp b/firmware/controllers/engine_cycle/aux_valves.cpp index ec08e2664b..69300fa106 100644 --- a/firmware/controllers/engine_cycle/aux_valves.cpp +++ b/firmware/controllers/engine_cycle/aux_valves.cpp @@ -64,7 +64,7 @@ static void auxValveTriggerCallback(trigger_event_e ckpSignalType, if (index != engine->auxSchedulingIndex) { return; } - int rpm = GET_RPM_VALUE; + int rpm = GET_RPM(); if (!isValidRpm(rpm)) { return; } diff --git a/firmware/controllers/engine_cycle/main_trigger_callback.cpp b/firmware/controllers/engine_cycle/main_trigger_callback.cpp index 65033f10f6..8d89f251b9 100644 --- a/firmware/controllers/engine_cycle/main_trigger_callback.cpp +++ b/firmware/controllers/engine_cycle/main_trigger_callback.cpp @@ -268,7 +268,7 @@ void InjectionEvent::onTriggerTooth(size_t trgEventIndex, int rpm, efitick_t now if (printFuelDebug) { InjectorOutputPin *output = outputs[0]; printf("handleFuelInjectionEvent fuelout %s injection_duration %dus engineCycleDuration=%.1fms\t\n", output->name, (int)durationUs, - (int)MS2US(getCrankshaftRevolutionTimeMs(GET_RPM_VALUE)) / 1000.0); + (int)MS2US(getCrankshaftRevolutionTimeMs(GET_RPM())) / 1000.0); } #endif /*EFI_PRINTF_FUEL_DETAILS */ @@ -403,7 +403,7 @@ static void mainTriggerCallback(trigger_event_e ckpSignalType, uint32_t trgEvent return; } - int rpm = GET_RPM_VALUE; + int rpm = GET_RPM(); if (rpm == 0) { // this happens while we just start cranking // todo: check for 'trigger->is_synchnonized?' diff --git a/firmware/controllers/engine_cycle/map_averaging.cpp b/firmware/controllers/engine_cycle/map_averaging.cpp index 3fd7dab110..af7a19c5de 100644 --- a/firmware/controllers/engine_cycle/map_averaging.cpp +++ b/firmware/controllers/engine_cycle/map_averaging.cpp @@ -235,7 +235,7 @@ void postMapState(TunerStudioOutputChannels *tsOutputChannels) { #endif /* EFI_TUNER_STUDIO */ void refreshMapAveragingPreCalc(DECLARE_ENGINE_PARAMETER_SIGNATURE) { - int rpm = GET_RPM_VALUE; + int rpm = GET_RPM(); if (isValidRpm(rpm)) { MAP_sensor_config_s * c = &engineConfiguration->map; angle_t start = interpolate2d("mapa", rpm, c->samplingAngleBins, c->samplingAngle); @@ -278,7 +278,7 @@ static void mapAveragingTriggerCallback(trigger_event_e ckpEventType, if (index != (uint32_t)CONFIG(mapAveragingSchedulingAtIndex)) return; - int rpm = GET_RPM_VALUE; + int rpm = GET_RPM(); if (!isValidRpm(rpm)) { return; } @@ -338,7 +338,7 @@ float getMap(void) { } #if EFI_ANALOG_SENSORS - if (!isValidRpm(GET_RPM_VALUE) || currentPressure == NO_VALUE_YET) + if (!isValidRpm(GET_RPM()) || currentPressure == NO_VALUE_YET) return validateMap(getRawMap()); // maybe return NaN in case of stopped engine? return validateMap(currentPressure); #else diff --git a/firmware/controllers/engine_cycle/spark_logic.cpp b/firmware/controllers/engine_cycle/spark_logic.cpp index 2b2ce8b45c..a4998e0267 100644 --- a/firmware/controllers/engine_cycle/spark_logic.cpp +++ b/firmware/controllers/engine_cycle/spark_logic.cpp @@ -222,7 +222,7 @@ static void startDwellByTurningSparkPinHigh(IgnitionEvent *event, IgnitionOutput // todo: no reason for this to be disabled in unit_test mode?! #if ! EFI_UNIT_TEST - if (GET_RPM_VALUE > 2 * engineConfiguration->cranking.rpm) { + if (GET_RPM() > 2 * engineConfiguration->cranking.rpm) { const char *outputName = output->getName(); if (prevSparkName == outputName && getCurrentIgnitionMode(PASS_ENGINE_PARAMETER_SIGNATURE) != IM_ONE_COIL) { warning(CUSTOM_OBD_SKIPPED_SPARK, "looks like skipped spark event %d %s", getRevolutionCounter(), outputName); diff --git a/firmware/controllers/math/engine_math.cpp b/firmware/controllers/math/engine_math.cpp index a2fbc8e7cc..d51a02deb2 100644 --- a/firmware/controllers/math/engine_math.cpp +++ b/firmware/controllers/math/engine_math.cpp @@ -102,7 +102,7 @@ static floatms_t getCrankingSparkDwell(DECLARE_ENGINE_PARAMETER_SIGNATURE) { } else { // technically this could be implemented via interpolate2d float angle = engineConfiguration->crankingChargeAngle; - return getOneDegreeTimeMs(GET_RPM_VALUE) * angle; + return getOneDegreeTimeMs(GET_RPM()) * angle; } } diff --git a/firmware/hw_layer/sensors/hip9011.cpp b/firmware/hw_layer/sensors/hip9011.cpp index acc9013530..4d82f282e1 100644 --- a/firmware/hw_layer/sensors/hip9011.cpp +++ b/firmware/hw_layer/sensors/hip9011.cpp @@ -252,7 +252,7 @@ static void intHoldCallback(trigger_event_e ckpEventType, uint32_t index, efitic ScopePerf perf(PE::Hip9011IntHoldCallback); - int rpm = GET_RPM_VALUE; + int rpm = GET_RPM(); if (!isValidRpm(rpm)) return; @@ -309,7 +309,7 @@ void hipAdcCallback(adcsample_t adcValue) { hipValueMax = maxF(engine->knockVolts, hipValueMax); engine->knockLogic(engine->knockVolts); - instance.handleValue(GET_RPM_VALUE DEFINE_PARAM_SUFFIX(PASS_HIP_PARAMS)); + instance.handleValue(GET_RPM() DEFINE_PARAM_SUFFIX(PASS_HIP_PARAMS)); } } diff --git a/unit_tests/tests/trigger/test_trigger_decoder.cpp b/unit_tests/tests/trigger/test_trigger_decoder.cpp index 2bf5ad7b0d..4229c72596 100644 --- a/unit_tests/tests/trigger/test_trigger_decoder.cpp +++ b/unit_tests/tests/trigger/test_trigger_decoder.cpp @@ -353,7 +353,7 @@ TEST(misc, testRpmCalculator) { assertEqualsM("injection angle", 31.365, ie0->injectionStart.angleOffsetFromTriggerEvent); eth.firePrimaryTriggerRise(); - ASSERT_EQ(1500, eth.engine.rpmCalculator.rpmValue); + ASSERT_EQ(1500, eth.engine.rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_SIGNATURE)); assertEqualsM("dwell", 4.5, engine->engineState.dwellAngle); assertEqualsM("fuel #2", 4.5450, engine->injectionDuration); @@ -407,7 +407,7 @@ TEST(misc, testRpmCalculator) { assertEqualsM("dwell", 4.5, eth.engine.engineState.dwellAngle); assertEqualsM("fuel #3", 4.5450, eth.engine.injectionDuration); - ASSERT_EQ(1500, eth.engine.rpmCalculator.rpmValue); + ASSERT_EQ(1500, eth.engine.rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_SIGNATURE)); eth.assertInjectorUpEvent("ev 0/2", 0, -4849, 2); @@ -1283,7 +1283,7 @@ TEST(big, testMissedSpark299) { printf("*************************************************** testMissedSpark299 start\r\n"); - ASSERT_EQ(3000, eth.engine.rpmCalculator.rpmValue); + ASSERT_EQ(3000, eth.engine.rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_SIGNATURE)); setWholeTimingTable(3); eth.engine.periodicFastCallback(PASS_ENGINE_PARAMETER_SIGNATURE);