diff --git a/firmware/console/status_loop.cpp b/firmware/console/status_loop.cpp index 67f71fd284..0d7f07a58d 100644 --- a/firmware/console/status_loop.cpp +++ b/firmware/console/status_loop.cpp @@ -169,8 +169,8 @@ void printState(Engine *engine, int currentCkpEventCounter) { // debugFloat(&logger, "table_spark", getAdvance(rpm, getMaf()), 2); - float engineLoad = getEngineLoadT(engine); - float baseFuel = getBaseFuel(engine, rpm); + float engineLoad = getEngineLoadT(PASS_ENGINE_PARAMETER); + float baseFuel = getBaseFuel(rpm PASS_ENGINE_PARAMETER); debugFloat(&logger, "fuel_base", baseFuel, 2); // debugFloat(&logger, "fuel_iat", getIatCorrection(getIntakeAirTemperature()), 2); // debugFloat(&logger, "fuel_clt", getCltCorrection(getCoolantTemperature()), 2); @@ -333,7 +333,7 @@ static void showFuelInfo2(float rpm, float engineLoad, Engine *engine) { } static void showFuelInfo(Engine *engine) { - showFuelInfo2((float) getRpmE(engine), getEngineLoadT(engine), engine); + showFuelInfo2((float) getRpmE(engine), getEngineLoadT(PASS_ENGINE_PARAMETER), engine); } #endif /* EFI_PROD_CODE */ @@ -420,7 +420,7 @@ void updateTunerStudioState(Engine *engine, TunerStudioOutputChannels *tsOutputC float coolant = getCoolantTemperature(engine); float intake = getIntakeAirTemperature(engine); - float engineLoad = getEngineLoadT(engine); + float engineLoad = getEngineLoadT(PASS_ENGINE_PARAMETER); float baseFuelMs = getBaseTableFuel(engineConfiguration, (int) rpm, engineLoad); tsOutputChannels->rpm = rpm; diff --git a/firmware/controllers/algo/accel_enrichment.cpp b/firmware/controllers/algo/accel_enrichment.cpp index 6b50cb9092..f47548073c 100644 --- a/firmware/controllers/algo/accel_enrichment.cpp +++ b/firmware/controllers/algo/accel_enrichment.cpp @@ -51,7 +51,7 @@ float getAccelEnrichment(void) { static msg_t DiffEnrichmentThread(int param) { chRegSetThreadName("Diff Enrichment"); while (TRUE) { - instance.updateDiffEnrichment(engineConfiguration, getEngineLoad()); + instance.updateDiffEnrichment(engineConfiguration, getEngineLoadT(PASS_ENGINE_PARAMETER)); chThdSleepMilliseconds(100); } #if defined __GNUC__ diff --git a/firmware/controllers/algo/fuel_math.cpp b/firmware/controllers/algo/fuel_math.cpp index 2d915e0597..c04b3c6eb2 100644 --- a/firmware/controllers/algo/fuel_math.cpp +++ b/firmware/controllers/algo/fuel_math.cpp @@ -43,11 +43,11 @@ EXTERN_ENGINE; -float getBaseFuel(Engine *engine, int rpm) { +float getBaseFuel(int rpm DECLARE_ENGINE_PARAMETER_S) { if (engine->engineConfiguration->algorithm == LM_SPEED_DENSITY) { return getSpeedDensityFuel(engine, rpm); } else { - float engineLoad = getEngineLoadT(engine); + float engineLoad = getEngineLoadT(PASS_ENGINE_PARAMETER_F); return getBaseTableFuel(engine->engineConfiguration, rpm, engineLoad); } } @@ -78,7 +78,7 @@ float getFuelMs(int rpm DECLARE_ENGINE_PARAMETER_S) { if (isCrankingR(rpm)) { theoreticalInjectionLength = getCrankingFuel(engine) / getNumberOfInjections(engineConfiguration, engineConfiguration->crankingInjectionMode); } else { - float baseFuel = getBaseFuel(engine, rpm); + float baseFuel = getBaseFuel(rpm PASS_ENGINE_PARAMETER); float fuelPerCycle = getRunningFuel(baseFuel, rpm PASS_ENGINE_PARAMETER); theoreticalInjectionLength = fuelPerCycle / getNumberOfInjections(engineConfiguration, engine->engineConfiguration->injectionMode); } diff --git a/firmware/controllers/algo/fuel_math.h b/firmware/controllers/algo/fuel_math.h index 8522bfe185..31e128087b 100644 --- a/firmware/controllers/algo/fuel_math.h +++ b/firmware/controllers/algo/fuel_math.h @@ -12,7 +12,7 @@ void prepareFuelMap(engine_configuration_s *engineConfiguration); -float getBaseFuel(Engine *engine, int rpm); +float getBaseFuel(int rpm DECLARE_ENGINE_PARAMETER_S); float getBaseTableFuel(engine_configuration_s *engineConfiguration, int rpm, float engineLoad); float getIatCorrection(float iat DECLARE_ENGINE_PARAMETER_S); float getInjectorLag(float vBatt DECLARE_ENGINE_PARAMETER_S); diff --git a/firmware/controllers/algo/main_trigger_callback.h b/firmware/controllers/algo/main_trigger_callback.h index 4de23348a7..eafd915f5f 100644 --- a/firmware/controllers/algo/main_trigger_callback.h +++ b/firmware/controllers/algo/main_trigger_callback.h @@ -29,7 +29,7 @@ public: }; void initMainEventListener(Engine *engine, engine_configuration2_s *engineConfiguration2); -void mainTriggerCallback(trigger_event_e ckpSignalType, uint32_t eventIndex, Engine *engine); +void mainTriggerCallback(trigger_event_e ckpSignalType, uint32_t eventIndex DECLARE_ENGINE_PARAMETER_S); #endif int isIgnitionTimingError(void); diff --git a/firmware/controllers/map_averaging.cpp b/firmware/controllers/map_averaging.cpp index dfd771c244..5b40d16246 100644 --- a/firmware/controllers/map_averaging.cpp +++ b/firmware/controllers/map_averaging.cpp @@ -126,7 +126,7 @@ static void endAveraging(void *arg) { /** * Shaft Position callback used to schedule start and end of MAP averaging */ -static void shaftPositionCallback(trigger_event_e ckpEventType, uint32_t index, Engine *arg) { +static void shaftPositionCallback(trigger_event_e ckpEventType, uint32_t index DECLARE_ENGINE_PARAMETER_S) { // this callback is invoked on interrupt thread if (index != 0) diff --git a/firmware/controllers/map_multiplier_thread.cpp b/firmware/controllers/map_multiplier_thread.cpp index da67805c60..57c9ca745c 100644 --- a/firmware/controllers/map_multiplier_thread.cpp +++ b/firmware/controllers/map_multiplier_thread.cpp @@ -65,7 +65,7 @@ static void maThread(int param) { // ideally this should be atomic, but hopefully it's good enough int rpm = getRpm(); - float load = getEngineLoad(); + float load = getEngineLoadT(PASS_ENGINE_PARAMETER); float afr = getAfr(); addAfr(rpm, load, afr); diff --git a/firmware/controllers/math/engine_math.cpp b/firmware/controllers/math/engine_math.cpp index d96daf59ed..39ab5550b6 100644 --- a/firmware/controllers/math/engine_math.cpp +++ b/firmware/controllers/math/engine_math.cpp @@ -66,9 +66,8 @@ float fixAngle(float angle DECLARE_ENGINE_PARAMETER_S) { * @brief Returns engine load according to selected engine_load_mode * */ -float getEngineLoadT(Engine *engine) { +float getEngineLoadT(DECLARE_ENGINE_PARAMETER_F) { efiAssert(engine!=NULL, "engine 2NULL", NAN); - engine_configuration_s *engineConfiguration = engine->engineConfiguration; efiAssert(engineConfiguration!=NULL, "engineConfiguration 2NULL", NAN); switch (engineConfiguration->algorithm) { case LM_MAF: diff --git a/firmware/controllers/math/engine_math.h b/firmware/controllers/math/engine_math.h index 6269572cfc..aa77b5dab3 100644 --- a/firmware/controllers/math/engine_math.h +++ b/firmware/controllers/math/engine_math.h @@ -50,8 +50,8 @@ float getCrankshaftRevolutionTimeMs(int rpm); #define isCrankingR(rpm) ((rpm) > 0 && (rpm) < engineConfiguration->crankingSettings.crankingRpm) -float getEngineLoadT(Engine *engine); -#define getEngineLoad() getEngineLoadT(engine) +float getEngineLoadT(DECLARE_ENGINE_PARAMETER_F); + float getSparkDwellMsT(int rpm DECLARE_ENGINE_PARAMETER_S); diff --git a/firmware/controllers/trigger/main_trigger_callback.cpp b/firmware/controllers/trigger/main_trigger_callback.cpp index 027d8385f5..cf64e1f8cb 100644 --- a/firmware/controllers/trigger/main_trigger_callback.cpp +++ b/firmware/controllers/trigger/main_trigger_callback.cpp @@ -288,7 +288,7 @@ void showMainHistogram(void) { * This is the main trigger event handler. * Both injection and ignition are controlled from this method. */ -void mainTriggerCallback(trigger_event_e ckpSignalType, uint32_t eventIndex, Engine *engine) { +void mainTriggerCallback(trigger_event_e ckpSignalType, uint32_t eventIndex DECLARE_ENGINE_PARAMETER_S) { if (hasFirmwareError()) { /** * In case on a major error we should not process any more events. @@ -301,9 +301,6 @@ void mainTriggerCallback(trigger_event_e ckpSignalType, uint32_t eventIndex, Eng efiAssertVoid(eventIndex < 2 * engine->triggerShape.shaftPositionEventCount, "event index"); efiAssertVoid(getRemainingStack(chThdSelf()) > 128, "lowstck#2"); - // todo: remove these local variables soon? - engine_configuration_s *engineConfiguration = engine->engineConfiguration; - int rpm = getRpmE(engine); if (rpm == 0) { // this happens while we just start cranking @@ -348,7 +345,8 @@ void mainTriggerCallback(trigger_event_e ckpSignalType, uint32_t eventIndex, Eng firmwareError("invalid dwell: %f at %d", dwellMs, rpm); return; } - float advance = getAdvance(rpm, getEngineLoadT(engine) PASS_ENGINE_PARAMETER); + float el = getEngineLoadT(PASS_ENGINE_PARAMETER_F); + float advance = getAdvance(rpm, el PASS_ENGINE_PARAMETER); if (cisnan(advance)) { // error should already be reported @@ -402,8 +400,8 @@ void MainTriggerCallback::init(Engine *engine, engine_configuration2_s *engineCo static void showMainInfo(Engine *engine) { int rpm = engine->rpmCalculator.rpm(); - float el = getEngineLoadT(mainTriggerCallbackInstance.engine); #if EFI_PROD_CODE + float el = getEngineLoadT(PASS_ENGINE_PARAMETER); scheduleMsg(&logger, "rpm %d engine_load %f", rpm, el); scheduleMsg(&logger, "fuel %fms timing %f", getFuelMs(rpm PASS_ENGINE_PARAMETER), getAdvance(rpm, el PASS_ENGINE_PARAMETER)); diff --git a/firmware/controllers/trigger/rpm_calculator.cpp b/firmware/controllers/trigger/rpm_calculator.cpp index f3e0f559a6..a2c864db0b 100644 --- a/firmware/controllers/trigger/rpm_calculator.cpp +++ b/firmware/controllers/trigger/rpm_calculator.cpp @@ -127,7 +127,7 @@ bool isCranking(void) { * updated here. * This callback is invoked on interrupt thread. */ -void rpmShaftPositionCallback(trigger_event_e ckpSignalType, uint32_t index, Engine *engine) { +void rpmShaftPositionCallback(trigger_event_e ckpSignalType, uint32_t index DECLARE_ENGINE_PARAMETER_S) { RpmCalculator *rpmState = &engine->rpmCalculator; uint64_t nowNt = getTimeNowNt(); #if EFI_PROD_CODE @@ -186,7 +186,7 @@ static void onTdcCallback(void) { /** * This trigger callback schedules the actual physical TDC callback in relation to trigger synchronization point. */ -static void tdcMarkCallback(trigger_event_e ckpSignalType, uint32_t index0, Engine *engine) { +static void tdcMarkCallback(trigger_event_e ckpSignalType, uint32_t index0 DECLARE_ENGINE_PARAMETER_S) { (void) ckpSignalType; bool isTriggerSynchronizationPoint = index0 == 0; if (isTriggerSynchronizationPoint) { diff --git a/firmware/controllers/trigger/rpm_calculator.h b/firmware/controllers/trigger/rpm_calculator.h index 24bc8dd8de..a5caa2e90d 100644 --- a/firmware/controllers/trigger/rpm_calculator.h +++ b/firmware/controllers/trigger/rpm_calculator.h @@ -10,6 +10,7 @@ #define RPM_REPORTER_H_ #include +#include "engine_configuration.h" #define WC_DOWN "d" #define WC_UP "u" @@ -62,7 +63,7 @@ private: #define getRpmE(engine) (engine)->rpmCalculator.rpm() bool isCrankingE(Engine *engine); -void rpmShaftPositionCallback(trigger_event_e ckpSignalType, uint32_t index, Engine *engine); +void rpmShaftPositionCallback(trigger_event_e ckpSignalType, uint32_t index DECLARE_ENGINE_PARAMETER_S); /** * @brief Initialize RPM calculator */ diff --git a/firmware/controllers/trigger/trigger_central.cpp b/firmware/controllers/trigger/trigger_central.cpp index 343150611a..b508ea6e17 100644 --- a/firmware/controllers/trigger/trigger_central.cpp +++ b/firmware/controllers/trigger/trigger_central.cpp @@ -70,7 +70,7 @@ void hwHandleShaftSignal(trigger_event_e signal) { maxTriggerReentraint = triggerReentraint; triggerReentraint++; efiAssertVoid(getRemainingStack(chThdSelf()) > 128, "lowstck#8"); - triggerCentral.handleShaftSignal(engine, signal); + triggerCentral.handleShaftSignal(signal, engine, engine->engineConfiguration); triggerReentraint--; } #endif /* EFI_PROD_CODE */ @@ -109,7 +109,7 @@ static ALWAYS_INLINE void reportEventToWaveChart(trigger_event_e ckpSignalType, } } -void TriggerCentral::handleShaftSignal(Engine *engine, trigger_event_e signal) { +void TriggerCentral::handleShaftSignal(trigger_event_e signal, Engine *engine, engine_configuration_s *engineConfiguration) { efiAssertVoid(engine!=NULL, "configuration"); nowNt = getTimeNowNt(); @@ -140,7 +140,7 @@ void TriggerCentral::handleShaftSignal(Engine *engine, trigger_event_e signal) { /** * This invocation changes the state of triggerState */ - triggerState.decodeTriggerEvent(triggerShape, &engine->engineConfiguration->triggerConfig, signal, nowNt); + triggerState.decodeTriggerEvent(triggerShape, &engineConfiguration->triggerConfig, signal, nowNt); if (!triggerState.shaft_is_synchronized) { // we should not propagate event if we do not know where we are @@ -169,7 +169,11 @@ void TriggerCentral::handleShaftSignal(Engine *engine, trigger_event_e signal) { /** * Here we invoke all the listeners - the main engine control logic is inside these listeners */ - invokeIntIntVoidCallbacks(&triggerListeneres, signal, triggerIndexForListeners); + for (int i = 0; i < triggerListeneres.currentListenersCount; i++) { + ShaftPositionListener listener = (ShaftPositionListener)triggerListeneres.callbacks[i]; + (listener)(signal, triggerIndexForListeners PASS_ENGINE_PARAMETER); + } + } #if EFI_HISTOGRAMS && EFI_PROD_CODE int afterCallback = hal_lld_get_counter_value(); diff --git a/firmware/controllers/trigger/trigger_central.h b/firmware/controllers/trigger/trigger_central.h index f4b2da06dc..00e0179b35 100644 --- a/firmware/controllers/trigger/trigger_central.h +++ b/firmware/controllers/trigger/trigger_central.h @@ -13,7 +13,7 @@ #include "trigger_decoder.h" class Engine; -typedef void (*ShaftPositionListener)(trigger_event_e signal, uint32_t index, Engine *engine); +typedef void (*ShaftPositionListener)(trigger_event_e signal, uint32_t index DECLARE_ENGINE_PARAMETER_S); #ifdef __cplusplus #include "ec2.h" @@ -25,7 +25,7 @@ class TriggerCentral { public: TriggerCentral(); void addEventListener(ShaftPositionListener handler, const char *name, Engine *engine); - void handleShaftSignal(Engine *engine, trigger_event_e signal); + void handleShaftSignal(trigger_event_e signal, Engine *engine, engine_configuration_s *engineConfiguration); int getHwEventCounter(int index); TriggerState triggerState; uint64_t nowNt; diff --git a/firmware/emulation/wave_analyzer.cpp b/firmware/emulation/wave_analyzer.cpp index 3c27e401d9..08ec14ab23 100644 --- a/firmware/emulation/wave_analyzer.cpp +++ b/firmware/emulation/wave_analyzer.cpp @@ -136,9 +136,8 @@ static void initWave(const char *name, int index) { } #endif -static void waTriggerEventListener(trigger_event_e ckpSignalType, uint32_t index, Engine *arg) { +static void waTriggerEventListener(trigger_event_e ckpSignalType, uint32_t index DECLARE_ENGINE_PARAMETER_S) { (void)ckpSignalType; - (void)arg; if (index != 0) { return; } diff --git a/firmware/global.h b/firmware/global.h index d760a643d7..9ad4262a3d 100644 --- a/firmware/global.h +++ b/firmware/global.h @@ -75,6 +75,7 @@ typedef Thread thread_t; #define DECLARE_ENGINE_PARAMETER_F void #define DECLARE_ENGINE_PARAMETER_S +#define PASS_ENGINE_PARAMETER_F #define PASS_ENGINE_PARAMETER #endif /* GLOBAL_H_ */ diff --git a/unit_tests/engine_test_helper.cpp b/unit_tests/engine_test_helper.cpp index 96d1b9139c..26ee673d0e 100644 --- a/unit_tests/engine_test_helper.cpp +++ b/unit_tests/engine_test_helper.cpp @@ -33,9 +33,9 @@ EngineTestHelper::EngineTestHelper(engine_type_e engineType) { void EngineTestHelper::fireTriggerEvents() { for (int i = 0; i < 24; i++) { timeNow += 5000; // 5ms - triggerCentral.handleShaftSignal(&engine, SHAFT_PRIMARY_UP); + triggerCentral.handleShaftSignal(SHAFT_PRIMARY_UP, &engine, engine.engineConfiguration); timeNow += 5000; - triggerCentral.handleShaftSignal(&engine, SHAFT_PRIMARY_DOWN); + triggerCentral.handleShaftSignal(SHAFT_PRIMARY_DOWN, &engine, engine.engineConfiguration); } } @@ -43,6 +43,6 @@ void EngineTestHelper::initTriggerShapeAndRpmCalculator() { initializeTriggerShape(NULL, ec, &engine); incrementGlobalConfigurationVersion(); - triggerCentral.addEventListener((ShaftPositionListener) &rpmShaftPositionCallback, "rpm reporter", &engine); + triggerCentral.addEventListener(rpmShaftPositionCallback, "rpm reporter", &engine); } diff --git a/unit_tests/global.h b/unit_tests/global.h index 0b237b10b3..6432d71232 100644 --- a/unit_tests/global.h +++ b/unit_tests/global.h @@ -42,6 +42,7 @@ class Engine; #define DECLARE_ENGINE_PARAMETER_F Engine *engine, engine_configuration_s *engineConfiguration #define DECLARE_ENGINE_PARAMETER_S , Engine *engine, engine_configuration_s *engineConfiguration +#define PASS_ENGINE_PARAMETER_F engine, engineConfiguration #define PASS_ENGINE_PARAMETER , engine, engineConfiguration #endif /* GLOBAL_H_ */ diff --git a/unit_tests/test_fuel_map.cpp b/unit_tests/test_fuel_map.cpp index ef7d1f2ac1..8d159ae3a8 100644 --- a/unit_tests/test_fuel_map.cpp +++ b/unit_tests/test_fuel_map.cpp @@ -58,7 +58,7 @@ void testFuelMap(void) { // because all the correction tables are zero printf("*************************************************** getRunningFuel 1\r\n"); - float baseFuel = getBaseTableFuel(eth.engine.engineConfiguration, 5, getEngineLoadT(ð.engine)); + float baseFuel = getBaseTableFuel(eth.engine.engineConfiguration, 5, getEngineLoadT(PASS_ENGINE_PARAMETER_F)); assertEqualsM("base fuel", 5.0, getRunningFuel(baseFuel, 5 PASS_ENGINE_PARAMETER)); printf("*************************************************** setting IAT table\r\n"); @@ -87,7 +87,7 @@ void testFuelMap(void) { // 1005 * 2 for IAT correction printf("*************************************************** getRunningFuel 2\r\n"); - baseFuel = getBaseTableFuel(eth.engine.engineConfiguration, 5, getEngineLoadT(ð.engine)); + baseFuel = getBaseTableFuel(eth.engine.engineConfiguration, 5, getEngineLoadT(PASS_ENGINE_PARAMETER_F)); assertEqualsM("v1", 30150, getRunningFuel(baseFuel, 5 PASS_ENGINE_PARAMETER)); testMafValue = 0; diff --git a/unit_tests/test_trigger_decoder.cpp b/unit_tests/test_trigger_decoder.cpp index fc06b1cada..683fcd0c16 100644 --- a/unit_tests/test_trigger_decoder.cpp +++ b/unit_tests/test_trigger_decoder.cpp @@ -404,13 +404,13 @@ static void testRpmCalculator(void) { static MainTriggerCallback triggerCallbackInstance; triggerCallbackInstance.init(ð.engine, ec2); - eth.triggerCentral.addEventListener((ShaftPositionListener)&mainTriggerCallback, "main loop", ð.engine); + eth.triggerCentral.addEventListener(mainTriggerCallback, "main loop", ð.engine); // engine.rpmCalculator = ð.rpmState; prepareTimingMap(); timeNow += 5000; // 5ms - eth.triggerCentral.handleShaftSignal(ð.engine, SHAFT_PRIMARY_UP); + eth.triggerCentral.handleShaftSignal(SHAFT_PRIMARY_UP, ð.engine, eth.ec); assertEqualsM("index #2", 0, eth.triggerCentral.triggerState.getCurrentIndex()); assertEqualsM("queue size", 6, schedulingQueue.size()); assertEqualsM("ev 1", 246444, schedulingQueue.getForUnitText(0)->momentX); @@ -418,11 +418,11 @@ static void testRpmCalculator(void) { schedulingQueue.clear(); timeNow += 5000; - eth.triggerCentral.handleShaftSignal(ð.engine, SHAFT_PRIMARY_DOWN); + eth.triggerCentral.handleShaftSignal(SHAFT_PRIMARY_DOWN, ð.engine, eth.ec); timeNow += 5000; // 5ms - eth.triggerCentral.handleShaftSignal(ð.engine, SHAFT_PRIMARY_UP); + eth.triggerCentral.handleShaftSignal(SHAFT_PRIMARY_UP, ð.engine, eth.ec); timeNow += 5000; - eth.triggerCentral.handleShaftSignal(ð.engine, SHAFT_PRIMARY_DOWN); + eth.triggerCentral.handleShaftSignal(SHAFT_PRIMARY_DOWN, ð.engine, eth.ec); assertEqualsM("index #3", 3, eth.triggerCentral.triggerState.getCurrentIndex()); assertEqualsM("queue size 3", 6, schedulingQueue.size()); assertEqualsM("ev 3", 259777, schedulingQueue.getForUnitText(0)->momentX); @@ -432,24 +432,24 @@ static void testRpmCalculator(void) { schedulingQueue.clear(); timeNow += 5000; - eth.triggerCentral.handleShaftSignal(ð.engine, SHAFT_PRIMARY_DOWN); + eth.triggerCentral.handleShaftSignal(SHAFT_PRIMARY_DOWN, ð.engine, eth.ec); timeNow += 5000; // 5ms - eth.triggerCentral.handleShaftSignal(ð.engine, SHAFT_PRIMARY_UP); + eth.triggerCentral.handleShaftSignal(SHAFT_PRIMARY_UP, ð.engine, eth.ec); timeNow += 5000; // 5ms - eth.triggerCentral.handleShaftSignal(ð.engine, SHAFT_PRIMARY_UP); + eth.triggerCentral.handleShaftSignal(SHAFT_PRIMARY_UP, ð.engine, eth.ec); assertEqualsM("index #4", 6, eth.triggerCentral.triggerState.getCurrentIndex()); assertEqualsM("queue size 4", 6, schedulingQueue.size()); assertEqualsM("4/0", 273111, schedulingQueue.getForUnitText(0)->momentX); schedulingQueue.clear(); timeNow += 5000; - eth.triggerCentral.handleShaftSignal(ð.engine, SHAFT_PRIMARY_DOWN); + eth.triggerCentral.handleShaftSignal(SHAFT_PRIMARY_DOWN, ð.engine, eth.ec); assertEqualsM("queue size 5", 0, schedulingQueue.size()); // assertEqualsM("5/1", 284500, schedulingQueue.getForUnitText(0)->momentUs); schedulingQueue.clear(); timeNow += 5000; // 5ms - eth.triggerCentral.handleShaftSignal(ð.engine, SHAFT_PRIMARY_UP); + eth.triggerCentral.handleShaftSignal(SHAFT_PRIMARY_UP, ð.engine, eth.ec); assertEqualsM("queue size 6", 6, schedulingQueue.size()); assertEqualsM("6/0", 286444, schedulingQueue.getForUnitText(0)->momentX); assertEqualsM("6/1", 285944, schedulingQueue.getForUnitText(1)->momentX); @@ -457,12 +457,12 @@ static void testRpmCalculator(void) { schedulingQueue.clear(); timeNow += 5000; - eth.triggerCentral.handleShaftSignal(ð.engine, SHAFT_PRIMARY_DOWN); + eth.triggerCentral.handleShaftSignal(SHAFT_PRIMARY_DOWN, ð.engine, eth.ec); assertEqualsM("queue size 7", 0, schedulingQueue.size()); schedulingQueue.clear(); timeNow += 5000; // 5ms - eth.triggerCentral.handleShaftSignal(ð.engine, SHAFT_PRIMARY_UP); + eth.triggerCentral.handleShaftSignal(SHAFT_PRIMARY_UP, ð.engine, eth.ec); assertEqualsM("queue size 8", 6, schedulingQueue.size()); assertEqualsM("8/0", 299777, schedulingQueue.getForUnitText(0)->momentX); assertEqualsM("8/1", 299277, schedulingQueue.getForUnitText(1)->momentX); @@ -471,12 +471,12 @@ static void testRpmCalculator(void) { schedulingQueue.clear(); timeNow += 5000; - eth.triggerCentral.handleShaftSignal(ð.engine, SHAFT_PRIMARY_DOWN); + eth.triggerCentral.handleShaftSignal(SHAFT_PRIMARY_DOWN, ð.engine, eth.ec); assertEqualsM("queue size 9", 0, schedulingQueue.size()); schedulingQueue.clear(); timeNow += 5000; // 5ms - eth.triggerCentral.handleShaftSignal(ð.engine, SHAFT_PRIMARY_UP); + eth.triggerCentral.handleShaftSignal(SHAFT_PRIMARY_UP, ð.engine, eth.ec); assertEqualsM("queue size 10", 0, schedulingQueue.size()); schedulingQueue.clear(); }