From da4fb3a19fa2256f1454337bcd249b304603bcf8 Mon Sep 17 00:00:00 2001 From: rusefi Date: Thu, 31 Jan 2019 17:55:23 -0500 Subject: [PATCH] better conditional compilation --- firmware/console/status_loop.cpp | 6 +- firmware/controllers/algo/advance_map.cpp | 4 + firmware/controllers/algo/engine.cpp | 4 +- firmware/controllers/algo/fuel_math.cpp | 8 ++ firmware/controllers/engine_controller.cpp | 4 +- firmware/controllers/injector_central.cpp | 2 + firmware/controllers/math/engine_math.cpp | 6 ++ firmware/controllers/settings.cpp | 5 +- .../trigger/main_trigger_callback.cpp | 2 +- .../controllers/trigger/rpm_calculator.cpp | 74 ++++++++-------- .../controllers/trigger/trigger_central.cpp | 44 +++++----- .../controllers/trigger/trigger_decoder.cpp | 87 +++++++++---------- .../controllers/trigger/trigger_decoder.h | 4 + firmware/rusefi.cpp | 2 + 14 files changed, 144 insertions(+), 108 deletions(-) diff --git a/firmware/console/status_loop.cpp b/firmware/console/status_loop.cpp index c0dcc74205..6d15c36203 100644 --- a/firmware/console/status_loop.cpp +++ b/firmware/console/status_loop.cpp @@ -471,7 +471,7 @@ void updateDevConsoleState(void) { systime_t nowSeconds = getTimeNowSeconds(); -#if EFI_ENGINE_CONTROL || defined(__DOXYGEN__) +#if (EFI_ENGINE_CONTROL && EFI_SHAFT_POSITION_INPUT) || defined(__DOXYGEN__) int currentCkpEventCounter = getCrankEventCounter(); if (prevCkpEventCounter == currentCkpEventCounter && timeOfPreviousReport == nowSeconds) { return; @@ -595,8 +595,12 @@ static void setBlinkingPeriod(int value) { #if EFI_PROD_CODE || defined(__DOXYGEN__) static bool isTriggerErrorNow() { +#if (EFI_ENGINE_CONTROL && EFI_SHAFT_POSITION_INPUT) || defined(__DOXYGEN__) bool justHadError = (getTimeNowNt() - engine->triggerCentral.triggerState.lastDecodingErrorTime) < US2NT(2 * 1000 * 3 * blinkingPeriod); return justHadError || isTriggerDecoderError(); +#else + return false; +#endif /* EFI_ENGINE_CONTROL && EFI_SHAFT_POSITION_INPUT */ } extern bool consoleByteArrived; diff --git a/firmware/controllers/algo/advance_map.cpp b/firmware/controllers/algo/advance_map.cpp index caadcb2d40..a10ac68564 100644 --- a/firmware/controllers/algo/advance_map.cpp +++ b/firmware/controllers/algo/advance_map.cpp @@ -145,6 +145,7 @@ static angle_t getCrankingAdvance(int rpm, float engineLoad DECLARE_ENGINE_PARAM angle_t getAdvance(int rpm, float engineLoad DECLARE_ENGINE_PARAMETER_SUFFIX) { +#if (EFI_ENGINE_CONTROL && EFI_SHAFT_POSITION_INPUT) || defined(__DOXYGEN__) if (cisnan(engineLoad)) { return 0; // any error should already be reported } @@ -177,6 +178,9 @@ angle_t getAdvance(int rpm, float engineLoad DECLARE_ENGINE_PARAMETER_SUFFIX) { efiAssert(CUSTOM_ERR_ASSERT, !cisnan(angle), "_AngleN5", 0); fixAngle(angle, "getAdvance", CUSTOM_ERR_ADCANCE_CALC_ANGLE); return angle; +#else + return 0; +#endif } void setDefaultIatTimingCorrection(DECLARE_ENGINE_PARAMETER_SIGNATURE) { diff --git a/firmware/controllers/algo/engine.cpp b/firmware/controllers/algo/engine.cpp index ef7593f26f..2f3f2fb5e2 100644 --- a/firmware/controllers/algo/engine.cpp +++ b/firmware/controllers/algo/engine.cpp @@ -55,6 +55,7 @@ FsioState::FsioState() { } void Engine::initializeTriggerShape(Logging *logger DECLARE_ENGINE_PARAMETER_SUFFIX) { +#if (EFI_ENGINE_CONTROL && EFI_SHAFT_POSITION_INPUT) || defined(__DOXYGEN__) #if !EFI_UNIT_TEST // we have a confusing threading model so some synchronization would not hurt bool alreadyLocked = lockAnyContext(); @@ -83,11 +84,12 @@ void Engine::initializeTriggerShape(Logging *logger DECLARE_ENGINE_PARAMETER_SUF if (!alreadyLocked) { unlockAnyContext(); } -#endif +#endif /* EFI_UNIT_TEST */ if (!TRIGGER_SHAPE(shapeDefinitionError)) { prepareOutputSignals(PASS_ENGINE_PARAMETER_SIGNATURE); } +#endif /* EFI_ENGINE_CONTROL && EFI_SHAFT_POSITION_INPUT */ } static void cylinderCleanupControl(DECLARE_ENGINE_PARAMETER_SIGNATURE) { diff --git a/firmware/controllers/algo/fuel_math.cpp b/firmware/controllers/algo/fuel_math.cpp index 003b6d8507..8a22f50bc9 100644 --- a/firmware/controllers/algo/fuel_math.cpp +++ b/firmware/controllers/algo/fuel_math.cpp @@ -151,6 +151,7 @@ percent_t getInjectorDutyCycle(int rpm DECLARE_ENGINE_PARAMETER_SUFFIX) { * in case of single point injection mode the amount of fuel into all cylinders, otherwise the amount for one cylinder */ floatms_t getInjectionDuration(int rpm DECLARE_ENGINE_PARAMETER_SUFFIX) { +#if (EFI_ENGINE_CONTROL && EFI_SHAFT_POSITION_INPUT) || defined(__DOXYGEN__) bool isCranking = ENGINE(rpmCalculator).isCranking(PASS_ENGINE_PARAMETER_SIGNATURE); injection_mode_e mode = isCranking ? engineConfiguration->crankingInjectionMode : @@ -190,6 +191,9 @@ floatms_t getInjectionDuration(int rpm DECLARE_ENGINE_PARAMETER_SUFFIX) { return 0; // we can end up here during configuration reset } return theoreticalInjectionLength * engineConfiguration->globalFuelCorrection + injectorLag; +#else + return 0; +#endif } floatms_t getRunningFuel(floatms_t baseFuel DECLARE_ENGINE_PARAMETER_SUFFIX) { @@ -294,6 +298,7 @@ float getFuelCutOffCorrection(efitick_t nowNt, int rpm DECLARE_ENGINE_PARAMETER_ * @return Fuel injection duration injection as specified in the fuel map, in milliseconds */ floatms_t getBaseTableFuel(int rpm, float engineLoad) { +#if (EFI_ENGINE_CONTROL && EFI_SHAFT_POSITION_INPUT) || defined(__DOXYGEN__) if (cisnan(engineLoad)) { warning(CUSTOM_NAN_ENGINE_LOAD_2, "NaN engine load"); return 0; @@ -305,6 +310,9 @@ floatms_t getBaseTableFuel(int rpm, float engineLoad) { warning(CUSTOM_ERR_FUEL_TABLE_NOT_READY, "baseFuel table not ready"); } return result; +#else + return 0; +#endif } float getBaroCorrection(DECLARE_ENGINE_PARAMETER_SIGNATURE) { diff --git a/firmware/controllers/engine_controller.cpp b/firmware/controllers/engine_controller.cpp index 8699f2ff19..3ca9bbf0a5 100644 --- a/firmware/controllers/engine_controller.cpp +++ b/firmware/controllers/engine_controller.cpp @@ -277,7 +277,7 @@ static void invokePerSecond(void) { } static void periodicSlowCallback(Engine *engine) { -#if EFI_ENGINE_CONTROL || defined(__DOXYGEN__) +#if (EFI_ENGINE_CONTROL && EFI_SHAFT_POSITION_INPUT) || defined(__DOXYGEN__) efiAssertVoid(CUSTOM_ERR_6661, getRemainingStack(chThdGetSelfX()) > 64, "lowStckOnEv"); #if EFI_PROD_CODE /** @@ -723,7 +723,7 @@ void initEngineContoller(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) initEgoAveraging(PASS_ENGINE_PARAMETER_SIGNATURE); -#if EFI_ENGINE_CONTROL || defined(__DOXYGEN__) +#if (EFI_ENGINE_CONTROL && EFI_SHAFT_POSITION_INPUT) || defined(__DOXYGEN__) if (CONFIGB(isEngineControlEnabled)) { /** * This method initialized the main listener which actually runs injectors & ignition diff --git a/firmware/controllers/injector_central.cpp b/firmware/controllers/injector_central.cpp index 21b09d672b..537e8ec052 100644 --- a/firmware/controllers/injector_central.cpp +++ b/firmware/controllers/injector_central.cpp @@ -261,7 +261,9 @@ void runBenchTest(uint16_t subsystem, uint16_t index) { milBench(); } else if (subsystem == 0x17) { // cmd_test_idle_valve +#if EFI_IDLE_CONTROL || defined(__DOXYGEN__) startIdleBench(); +#endif } else if (subsystem == 0x20 && index == 0x3456) { // call to pit setCallFromPitStop(30000); diff --git a/firmware/controllers/math/engine_math.cpp b/firmware/controllers/math/engine_math.cpp index c450110f78..f494d9e733 100644 --- a/firmware/controllers/math/engine_math.cpp +++ b/firmware/controllers/math/engine_math.cpp @@ -242,6 +242,7 @@ static floatms_t getCrankingSparkDwell(DECLARE_ENGINE_PARAMETER_SIGNATURE) { * @return Spark dwell time, in milliseconds. 0 if tables are not ready. */ floatms_t getSparkDwell(int rpm DECLARE_ENGINE_PARAMETER_SUFFIX) { +#if (EFI_ENGINE_CONTROL && EFI_SHAFT_POSITION_INPUT) || defined(__DOXYGEN__) float dwellMs; if (ENGINE(rpmCalculator).isCranking(PASS_ENGINE_PARAMETER_SIGNATURE)) { dwellMs = getCrankingSparkDwell(PASS_ENGINE_PARAMETER_SIGNATURE); @@ -257,6 +258,9 @@ floatms_t getSparkDwell(int rpm DECLARE_ENGINE_PARAMETER_SUFFIX) { return 0; } return dwellMs; +#else + return 0; +#endif } @@ -453,9 +457,11 @@ void prepareIgnitionPinIndices(ignition_mode_e ignitionMode DECLARE_ENGINE_PARAM */ ignition_mode_e getCurrentIgnitionMode(DECLARE_ENGINE_PARAMETER_SIGNATURE) { ignition_mode_e ignitionMode = CONFIG(ignitionMode); +#if EFI_SHAFT_POSITION_INPUT || defined(__DOXYGEN__) // In spin-up cranking mode we don't have full phase sync. info yet, so wasted spark mode is better if (ignitionMode == IM_INDIVIDUAL_COILS && ENGINE(rpmCalculator.isSpinningUp(PASS_ENGINE_PARAMETER_SIGNATURE))) ignitionMode = IM_WASTED_SPARK; +#endif /* EFI_SHAFT_POSITION_INPUT */ return ignitionMode; } diff --git a/firmware/controllers/settings.cpp b/firmware/controllers/settings.cpp index 7fd4116016..4a8d17d4c7 100644 --- a/firmware/controllers/settings.cpp +++ b/firmware/controllers/settings.cpp @@ -1128,7 +1128,9 @@ typedef struct { VoidFloat callback; } command_f_s; -const command_f_s commandsF[] = {{"mock_iat_voltage", setMockIatVoltage}, +const command_f_s commandsF[] = { +#if (EFI_ENGINE_CONTROL && EFI_SHAFT_POSITION_INPUT) || defined(__DOXYGEN__) + {"mock_iat_voltage", setMockIatVoltage}, {"mock_pedal_position", setMockPedalPosition}, {"mock_maf_voltage", setMockMafVoltage}, {"mock_afr_voltage", setMockAfrVoltage}, @@ -1136,6 +1138,7 @@ const command_f_s commandsF[] = {{"mock_iat_voltage", setMockIatVoltage}, {"mock_map_voltage", setMockMapVoltage}, {"mock_vbatt_voltage", setMockVBattVoltage}, {"mock_clt_voltage", setMockCltVoltage}, +#endif {"fsio_curve_1_value", setFsioCurve1Value}, {"fsio_curve_2_value", setFsioCurve2Value}, {"ignition_offset", setIgnitionOffset}, diff --git a/firmware/controllers/trigger/main_trigger_callback.cpp b/firmware/controllers/trigger/main_trigger_callback.cpp index de87f011c1..ad3c20a524 100644 --- a/firmware/controllers/trigger/main_trigger_callback.cpp +++ b/firmware/controllers/trigger/main_trigger_callback.cpp @@ -33,7 +33,7 @@ #endif -#if EFI_ENGINE_CONTROL || defined(__DOXYGEN__) +#if (EFI_ENGINE_CONTROL && EFI_SHAFT_POSITION_INPUT) || defined(__DOXYGEN__) #include "main_trigger_callback.h" #include "efiGpio.h" diff --git a/firmware/controllers/trigger/rpm_calculator.cpp b/firmware/controllers/trigger/rpm_calculator.cpp index 70e17f733c..b902a8c6c4 100644 --- a/firmware/controllers/trigger/rpm_calculator.cpp +++ b/firmware/controllers/trigger/rpm_calculator.cpp @@ -13,8 +13,6 @@ #include "engine.h" #include "rpm_calculator.h" -#if EFI_SHAFT_POSITION_INPUT || defined(__DOXYGEN__) - #include "trigger_central.h" #include "engine_configuration.h" #include "engine_math.h" @@ -40,6 +38,43 @@ extern WaveChart waveChart; #define NO_RPM_EVENTS_TIMEOUT_SECS 2 #endif /* NO_RPM_EVENTS_TIMEOUT_SECS */ +float RpmCalculator::getRpmAcceleration() { + return 1.0 * previousRpmValue / rpmValue; +} + +bool RpmCalculator::isStopped(DECLARE_ENGINE_PARAMETER_SIGNATURE) const { + // Spinning-up with zero RPM means that the engine is not ready yet, and is treated as 'stopped'. + return state == STOPPED || (state == SPINNING_UP && rpmValue == 0); +} + +bool RpmCalculator::isCranking(DECLARE_ENGINE_PARAMETER_SIGNATURE) const { + // Spinning-up with non-zero RPM is suitable for all engine math, as good as cranking + return state == CRANKING || (state == SPINNING_UP && rpmValue > 0); +} + +bool RpmCalculator::isSpinningUp(DECLARE_ENGINE_PARAMETER_SIGNATURE) const { + return state == SPINNING_UP; +} + +uint32_t RpmCalculator::getRevolutionCounterSinceStart(void) { + return revolutionCounterSinceStart; +} + +/** + * @return -1 in case of isNoisySignal(), current RPM otherwise + */ +// todo: migrate to float return result or add a float version? this would have with calculations +int RpmCalculator::getRpm(DECLARE_ENGINE_PARAMETER_SIGNATURE) const { +#if !EFI_PROD_CODE + if (mockRpm != MOCK_UNDEFINED) { + return mockRpm; + } +#endif /* EFI_PROD_CODE */ + return rpmValue; +} + +#if EFI_SHAFT_POSITION_INPUT || defined(__DOXYGEN__) + EXTERN_ENGINE ; @@ -61,20 +96,6 @@ RpmCalculator::RpmCalculator() { revolutionCounterSinceBootForUnitTest = 0; } -bool RpmCalculator::isStopped(DECLARE_ENGINE_PARAMETER_SIGNATURE) const { - // Spinning-up with zero RPM means that the engine is not ready yet, and is treated as 'stopped'. - return state == STOPPED || (state == SPINNING_UP && rpmValue == 0); -} - -bool RpmCalculator::isSpinningUp(DECLARE_ENGINE_PARAMETER_SIGNATURE) const { - return state == SPINNING_UP; -} - -bool RpmCalculator::isCranking(DECLARE_ENGINE_PARAMETER_SIGNATURE) const { - // Spinning-up with non-zero RPM is suitable for all engine math, as good as cranking - return state == CRANKING || (state == SPINNING_UP && rpmValue > 0); -} - /** * @return true if there was a full shaft revolution within the last second */ @@ -163,14 +184,6 @@ uint32_t RpmCalculator::getRevolutionCounter(void) { return revolutionCounterSinceBoot; } -uint32_t RpmCalculator::getRevolutionCounterSinceStart(void) { - return revolutionCounterSinceStart; -} - -float RpmCalculator::getRpmAcceleration() { - return 1.0 * previousRpmValue / rpmValue; -} - void RpmCalculator::setStopped(DECLARE_ENGINE_PARAMETER_SIGNATURE) { revolutionCounterSinceStart = 0; if (rpmValue != 0) { @@ -204,19 +217,6 @@ void RpmCalculator::setSpinningUp(efitime_t nowNt DECLARE_ENGINE_PARAMETER_SUFFI prepareIgnitionPinIndices(getCurrentIgnitionMode(PASS_ENGINE_PARAMETER_SIGNATURE) PASS_ENGINE_PARAMETER_SUFFIX); } -/** - * @return -1 in case of isNoisySignal(), current RPM otherwise - */ -// todo: migrate to float return result or add a float version? this would have with calculations -int RpmCalculator::getRpm(DECLARE_ENGINE_PARAMETER_SIGNATURE) const { -#if !EFI_PROD_CODE - if (mockRpm != MOCK_UNDEFINED) { - return mockRpm; - } -#endif /* EFI_PROD_CODE */ - return rpmValue; -} - /** * @brief Shaft position callback used by RPM calculation logic. * diff --git a/firmware/controllers/trigger/trigger_central.cpp b/firmware/controllers/trigger/trigger_central.cpp index 72ece4c9d0..3cfca07e04 100644 --- a/firmware/controllers/trigger/trigger_central.cpp +++ b/firmware/controllers/trigger/trigger_central.cpp @@ -8,8 +8,6 @@ #include "global.h" -#if EFI_SHAFT_POSITION_INPUT || defined(__DOXYGEN__) - #include "trigger_central.h" #include "trigger_decoder.h" #include "main_trigger_callback.h" @@ -25,6 +23,29 @@ #include "trigger_simulator.h" #include "rpm_calculator.h" + +TriggerCentral::TriggerCentral() : hwEventCounters() { + // we need this initial to have not_running at first invocation + previousShaftEventTimeNt = (efitimems_t) -10 * US2NT(US_PER_SECOND_LL); + + clearCallbacks(&triggerListeneres); + triggerState.resetTriggerState(); + resetAccumSignalData(); +} + +void TriggerCentral::resetAccumSignalData() { + memset(lastSignalTimes, 0xff, sizeof(lastSignalTimes)); // = -1 + memset(accumSignalPeriods, 0, sizeof(accumSignalPeriods)); + memset(accumSignalPrevPeriods, 0, sizeof(accumSignalPrevPeriods)); +} + +int TriggerCentral::getHwEventCounter(int index) { + return hwEventCounters[index]; +} + +#if EFI_SHAFT_POSITION_INPUT || defined(__DOXYGEN__) + + #if EFI_PROD_CODE || defined(__DOXYGEN__) #include "rfiutil.h" #include "pin_repository.h" @@ -204,29 +225,10 @@ void hwHandleShaftSignal(trigger_event_e signal) { } #endif /* EFI_PROD_CODE */ -TriggerCentral::TriggerCentral() : hwEventCounters() { - // we need this initial to have not_running at first invocation - previousShaftEventTimeNt = (efitimems_t) -10 * US2NT(US_PER_SECOND_LL); - - clearCallbacks(&triggerListeneres); - triggerState.resetTriggerState(); - resetAccumSignalData(); -} - -int TriggerCentral::getHwEventCounter(int index) { - return hwEventCounters[index]; -} - void TriggerCentral::resetCounters() { memset(hwEventCounters, 0, sizeof(hwEventCounters)); } -void TriggerCentral::resetAccumSignalData() { - memset(lastSignalTimes, 0xff, sizeof(lastSignalTimes)); // = -1 - memset(accumSignalPeriods, 0, sizeof(accumSignalPeriods)); - memset(accumSignalPrevPeriods, 0, sizeof(accumSignalPrevPeriods)); -} - static char shaft_signal_msg_index[15]; static bool isUpEvent[6] = { false, true, false, true, false, true }; diff --git a/firmware/controllers/trigger/trigger_decoder.cpp b/firmware/controllers/trigger/trigger_decoder.cpp index f153ca3a8d..de4f6309b6 100644 --- a/firmware/controllers/trigger/trigger_decoder.cpp +++ b/firmware/controllers/trigger/trigger_decoder.cpp @@ -20,8 +20,6 @@ #include "global.h" -#if EFI_SHAFT_POSITION_INPUT || defined(__DOXYGEN__) - #include "obd_error_codes.h" #include "trigger_decoder.h" #include "cyclic_buffer.h" @@ -36,6 +34,49 @@ #include "sensor_chart.h" #endif +TriggerState::TriggerState() { + resetTriggerState(); +} + +void TriggerState::resetTriggerState() { + triggerCycleCallback = NULL; + shaft_is_synchronized = false; + toothed_previous_time = 0; + + memset(toothDurations, 0, sizeof(toothDurations)); + + totalRevolutionCounter = 0; + totalTriggerErrorCounter = 0; + orderingErrorCounter = 0; + lastDecodingErrorTime = US2NT(-10000000LL); + someSortOfTriggerError = false; + + memset(toothDurations, 0, sizeof(toothDurations)); + curSignal = SHAFT_PRIMARY_FALLING; + prevSignal = SHAFT_PRIMARY_FALLING; + startOfCycleNt = 0; + + resetCurrentCycleState(); + memset(expectedTotalTime, 0, sizeof(expectedTotalTime)); + + totalEventCountBase = 0; + isFirstEvent = true; +} + +void TriggerState::resetCurrentCycleState() { + memset(currentCycle.eventCount, 0, sizeof(currentCycle.eventCount)); + memset(currentCycle.timeOfPreviousEventNt, 0, sizeof(currentCycle.timeOfPreviousEventNt)); + memset(currentCycle.totalTimeNt, 0, sizeof(currentCycle.totalTimeNt)); + currentCycle.current_index = 0; +} + +TriggerStateWithRunningStatistics::TriggerStateWithRunningStatistics() : + //https://en.cppreference.com/w/cpp/language/zero_initialization + timeOfLastEvent(), instantRpmValue() + { +} + +#if EFI_SHAFT_POSITION_INPUT || defined(__DOXYGEN__) EXTERN_ENGINE ; @@ -124,12 +165,6 @@ int TriggerState::getTotalRevolutionCounter() const { return totalRevolutionCounter; } -TriggerStateWithRunningStatistics::TriggerStateWithRunningStatistics() : - //https://en.cppreference.com/w/cpp/language/zero_initialization - timeOfLastEvent(), instantRpmValue() - { -} - void TriggerStateWithRunningStatistics::movePreSynchTimestamps(DECLARE_ENGINE_PARAMETER_SIGNATURE) { // here we take timestamps of events which happened prior to synchronization and place them // at appropriate locations @@ -254,35 +289,6 @@ static trigger_value_e eventType[6] = { TV_FALL, TV_RISE, TV_FALL, TV_RISE, TV_F #define isLessImportant(type) (needToSkipFall(type) || needToSkipRise(type) || (!considerEventForGap()) ) -TriggerState::TriggerState() { - resetTriggerState(); -} - -void TriggerState::resetTriggerState() { - triggerCycleCallback = NULL; - shaft_is_synchronized = false; - toothed_previous_time = 0; - - memset(toothDurations, 0, sizeof(toothDurations)); - - totalRevolutionCounter = 0; - totalTriggerErrorCounter = 0; - orderingErrorCounter = 0; - lastDecodingErrorTime = US2NT(-10000000LL); - someSortOfTriggerError = false; - - memset(toothDurations, 0, sizeof(toothDurations)); - curSignal = SHAFT_PRIMARY_FALLING; - prevSignal = SHAFT_PRIMARY_FALLING; - startOfCycleNt = 0; - - resetCurrentCycleState(); - memset(expectedTotalTime, 0, sizeof(expectedTotalTime)); - - totalEventCountBase = 0; - isFirstEvent = true; -} - int TriggerState::getCurrentIndex() const { return currentCycle.current_index; } @@ -295,13 +301,6 @@ bool TriggerState::isEvenRevolution() const { return totalRevolutionCounter & 1; } -void TriggerState::resetCurrentCycleState() { - memset(currentCycle.eventCount, 0, sizeof(currentCycle.eventCount)); - memset(currentCycle.timeOfPreviousEventNt, 0, sizeof(currentCycle.timeOfPreviousEventNt)); - memset(currentCycle.totalTimeNt, 0, sizeof(currentCycle.totalTimeNt)); - currentCycle.current_index = 0; -} - void TriggerState::onSynchronizationLost(DECLARE_ENGINE_PARAMETER_SIGNATURE) { shaft_is_synchronized = false; // Needed for early instant-RPM detection diff --git a/firmware/controllers/trigger/trigger_decoder.h b/firmware/controllers/trigger/trigger_decoder.h index 8cba10ecca..485fca4395 100644 --- a/firmware/controllers/trigger/trigger_decoder.h +++ b/firmware/controllers/trigger/trigger_decoder.h @@ -100,7 +100,9 @@ public: void resetTriggerState(); +#if (EFI_ENGINE_CONTROL && EFI_SHAFT_POSITION_INPUT) || defined(__DOXYGEN__) virtual void runtimeStatistics(efitime_t nowNt DECLARE_ENGINE_PARAMETER_SUFFIX); +#endif /** * this is start of real trigger cycle @@ -147,7 +149,9 @@ public: float prevInstantRpmValue = 0; void movePreSynchTimestamps(DECLARE_ENGINE_PARAMETER_SIGNATURE); float calculateInstantRpm(int *prevIndex, efitime_t nowNt DECLARE_ENGINE_PARAMETER_SUFFIX); +#if (EFI_ENGINE_CONTROL && EFI_SHAFT_POSITION_INPUT) || defined(__DOXYGEN__) virtual void runtimeStatistics(efitime_t nowNt DECLARE_ENGINE_PARAMETER_SUFFIX); +#endif /** * Update timeOfLastEvent[] on every trigger event - even without synchronization * Needed for early spin-up RPM detection. diff --git a/firmware/rusefi.cpp b/firmware/rusefi.cpp index c87960dc73..f866d48920 100644 --- a/firmware/rusefi.cpp +++ b/firmware/rusefi.cpp @@ -187,11 +187,13 @@ void runRusEfi(void) { */ initPinRepository(); +#if EFI_INTERNAL_FLASH || defined(__DOXYGEN__) /** * First thing is reading configuration from flash memory. * In order to have complete flexibility configuration has to go before anything else. */ readConfiguration(&sharedLogger); +#endif /* EFI_INTERNAL_FLASH */ // TODO: need to fix this place!!! should be a version of PASS_ENGINE_PARAMETER_SIGNATURE somehow prepareVoidConfiguration(&activeConfiguration);