From 541c445a2d1dc382fa4ccb1ba30313e44ef0b3d7 Mon Sep 17 00:00:00 2001 From: rusefi Date: Fri, 12 Apr 2019 22:07:03 -0400 Subject: [PATCH] defined(__DOXYGEN__) ? #748 --- .../actuators/alternator_controller.cpp | 10 +-- firmware/controllers/actuators/aux_pid.cpp | 6 +- .../actuators/electronic_throttle.cpp | 8 +- .../controllers/actuators/idle_thread.cpp | 18 ++-- .../controllers/actuators/lcd_controller.cpp | 6 +- .../actuators/malfunction_indicator.cpp | 2 +- .../actuators/malfunction_indicator.h | 2 +- firmware/controllers/actuators/pwm_tester.cpp | 2 +- firmware/controllers/actuators/tachometer.cpp | 2 +- .../controllers/algo/accel_enrichment.cpp | 10 +-- firmware/controllers/algo/advance_map.cpp | 6 +- firmware/controllers/algo/engine.cpp | 18 ++-- firmware/controllers/algo/engine.h | 4 +- firmware/controllers/algo/engine2.cpp | 8 +- .../controllers/algo/engine_configuration.cpp | 76 ++++++++--------- firmware/controllers/algo/event_registry.h | 4 +- firmware/controllers/algo/fuel_math.cpp | 10 +-- firmware/controllers/core/error_handling.cpp | 20 ++--- firmware/controllers/core/fsio_core.cpp | 4 +- firmware/controllers/core/fsio_impl.cpp | 22 ++--- firmware/controllers/engine_controller.cpp | 82 +++++++++---------- firmware/controllers/flash_main.cpp | 6 +- firmware/controllers/injector_central.cpp | 6 +- firmware/controllers/map_averaging.cpp | 24 +++--- firmware/controllers/map_averaging.h | 4 +- firmware/controllers/math/efitime.h | 2 +- firmware/controllers/math/engine_math.cpp | 14 ++-- firmware/controllers/math/speed_density.cpp | 2 +- firmware/controllers/obd2.cpp | 4 +- firmware/controllers/obd2.h | 2 +- .../controllers/scheduling/event_queue.cpp | 14 ++-- firmware/controllers/scheduling/scheduler.h | 2 +- .../scheduling/signal_executor.cpp | 2 +- .../scheduling/signal_executor_sleep.cpp | 8 +- .../scheduling/single_timer_executor.cpp | 6 +- firmware/controllers/sensors/ego.cpp | 6 +- firmware/controllers/sensors/map.cpp | 12 +-- firmware/controllers/sensors/thermistors.cpp | 12 +-- firmware/controllers/sensors/tps.cpp | 4 +- firmware/controllers/settings.cpp | 52 ++++++------ firmware/controllers/system/efi_gpio.cpp | 38 ++++----- firmware/controllers/system/efi_gpio.h | 6 +- firmware/controllers/trigger/aux_valves.cpp | 4 +- .../trigger/decoders/trigger_structure.cpp | 18 ++-- .../trigger/decoders/trigger_structure.h | 2 +- .../trigger/main_trigger_callback.cpp | 74 ++++++++--------- .../controllers/trigger/rpm_calculator.cpp | 14 ++-- firmware/controllers/trigger/spark_logic.cpp | 30 +++---- .../controllers/trigger/trigger_central.cpp | 58 ++++++------- .../controllers/trigger/trigger_decoder.cpp | 44 +++++----- .../controllers/trigger/trigger_decoder.h | 4 +- .../trigger/trigger_emulator_algo.cpp | 4 +- .../controllers/trigger/trigger_simulator.cpp | 4 +- 53 files changed, 401 insertions(+), 401 deletions(-) diff --git a/firmware/controllers/actuators/alternator_controller.cpp b/firmware/controllers/actuators/alternator_controller.cpp index 14df7bce4a..f7255480cd 100644 --- a/firmware/controllers/actuators/alternator_controller.cpp +++ b/firmware/controllers/actuators/alternator_controller.cpp @@ -8,7 +8,7 @@ */ #include "global.h" -#if EFI_ALTERNATOR_CONTROL || defined(__DOXYGEN__) +#if EFI_ALTERNATOR_CONTROL #include "engine.h" #include "rpm_calculator.h" #include "alternator_controller.h" @@ -32,7 +32,7 @@ static Pid altPid(altPidS); static percent_t currentAltDuty; -#if EFI_TUNER_STUDIO || defined(__DOXYGEN__) +#if EFI_TUNER_STUDIO extern TunerStudioOutputChannels tsOutputChannels; #endif /* EFI_TUNER_STUDIO */ @@ -51,7 +51,7 @@ private: UNUSED(nowNt); setPeriod(NOT_TOO_OFTEN(10 /* ms */, engineConfiguration->alternatorControl.periodMs)); -#if ! EFI_UNIT_TEST || defined(__DOXYGEN__) +#if ! EFI_UNIT_TEST if (shouldResetPid) { pidReset(); shouldResetPid = false; @@ -61,7 +61,7 @@ private: if (engineConfiguration->debugMode == DBG_ALTERNATOR_PID) { // this block could be executed even in on/off alternator control mode // but at least we would reflect latest state -#if EFI_TUNER_STUDIO || defined(__DOXYGEN__) +#if EFI_TUNER_STUDIO altPid.postState(&tsOutputChannels); #endif /* EFI_TUNER_STUDIO */ } @@ -85,7 +85,7 @@ private: enginePins.alternatorPin.setValue(newState); currentPlainOnOffState = newState; if (engineConfiguration->debugMode == DBG_ALTERNATOR_PID) { -#if EFI_TUNER_STUDIO || defined(__DOXYGEN__) +#if EFI_TUNER_STUDIO tsOutputChannels.debugIntField1 = newState; #endif /* EFI_TUNER_STUDIO */ } diff --git a/firmware/controllers/actuators/aux_pid.cpp b/firmware/controllers/actuators/aux_pid.cpp index 528f62cd8c..7dcf915478 100644 --- a/firmware/controllers/actuators/aux_pid.cpp +++ b/firmware/controllers/actuators/aux_pid.cpp @@ -11,7 +11,7 @@ #include "local_version_holder.h" #include "allsensors.h" -#if EFI_AUX_PID || defined(__DOXYGEN__) +#if EFI_AUX_PID #include "pwm_generator.h" #include "tunerstudio_configuration.h" #include "fsio_impl.h" @@ -27,7 +27,7 @@ extern fsio8_Map3D_f32t fsioTable1; // todo: this is to some extent a copy-paste of alternator_controller. maybe same loop // for all PIDs? -#if EFI_TUNER_STUDIO || defined(__DOXYGEN__) +#if EFI_TUNER_STUDIO extern TunerStudioOutputChannels tsOutputChannels; #endif /* EFI_TUNER_STUDIO */ @@ -92,7 +92,7 @@ private: if (engineConfiguration->debugMode == DBG_AUX_PID_1) { -#if EFI_TUNER_STUDIO || defined(__DOXYGEN__) +#if EFI_TUNER_STUDIO auxPid.postState(&tsOutputChannels); tsOutputChannels.debugIntField3 = (int)(10 * targetValue); #endif /* EFI_TUNER_STUDIO */ diff --git a/firmware/controllers/actuators/electronic_throttle.cpp b/firmware/controllers/actuators/electronic_throttle.cpp index 775d7e51db..6db80faf0d 100644 --- a/firmware/controllers/actuators/electronic_throttle.cpp +++ b/firmware/controllers/actuators/electronic_throttle.cpp @@ -66,7 +66,7 @@ #include "global.h" -#if EFI_ELECTRONIC_THROTTLE_BODY || defined(__DOXYGEN__) +#if EFI_ELECTRONIC_THROTTLE_BODY #include "electronic_throttle.h" #include "tps.h" @@ -83,7 +83,7 @@ #include "pwm_generator.h" #include "dc_motor.h" #include "pid_auto_tune.h" -#if EFI_TUNER_STUDIO || defined(__DOXYGEN__) +#if EFI_TUNER_STUDIO extern TunerStudioOutputChannels tsOutputChannels; #endif /* EFI_TUNER_STUDIO */ static bool shouldResetPid = false; @@ -160,12 +160,12 @@ private: // set debug_mode 17 if (engineConfiguration->debugMode == DBG_ELECTRONIC_THROTTLE_PID) { -#if EFI_TUNER_STUDIO || defined(__DOXYGEN__) +#if EFI_TUNER_STUDIO pid.postState(&tsOutputChannels); tsOutputChannels.debugIntField5 = feedForward; #endif /* EFI_TUNER_STUDIO */ } else if (engineConfiguration->debugMode == DBG_ELECTRONIC_THROTTLE_EXTRA) { -#if EFI_TUNER_STUDIO || defined(__DOXYGEN__) +#if EFI_TUNER_STUDIO // set debug_mode 29 tsOutputChannels.debugFloatField1 = valueOverride; #endif /* EFI_TUNER_STUDIO */ diff --git a/firmware/controllers/actuators/idle_thread.cpp b/firmware/controllers/actuators/idle_thread.cpp index db3b0b5b4f..2e1273c82f 100644 --- a/firmware/controllers/actuators/idle_thread.cpp +++ b/firmware/controllers/actuators/idle_thread.cpp @@ -26,7 +26,7 @@ #include "global.h" -#if EFI_IDLE_CONTROL || defined(__DOXYGEN__) +#if EFI_IDLE_CONTROL #include "engine_configuration.h" #include "rpm_calculator.h" #include "pwm_generator.h" @@ -38,7 +38,7 @@ #include "allsensors.h" static Logging *logger; -#if EFI_TUNER_STUDIO || defined(__DOXYGEN__) +#if EFI_TUNER_STUDIO extern TunerStudioOutputChannels tsOutputChannels; #endif /* EFI_TUNER_STUDIO */ EXTERN_ENGINE @@ -48,7 +48,7 @@ static bool shouldResetPid = false; // we might reset PID state when the state is changed, but only if needed (See autoIdle()) static bool mightResetPid = false; -#if EFI_IDLE_INCREMENTAL_PID_CIC || defined(__DOXYGEN__) +#if EFI_IDLE_INCREMENTAL_PID_CIC // Use new PID with CIC integrator static PidCic idlePid(&engineConfiguration->idleRpmPid); #else @@ -229,7 +229,7 @@ static percent_t automaticIdleController() { // the state of PID has been changed, so we might reset it now, but only when needed (see idlePidDeactivationTpsThreshold) mightResetPid = true; -#if EFI_IDLE_INCREMENTAL_PID_CIC || defined(__DOXYGEN__) +#if EFI_IDLE_INCREMENTAL_PID_CIC // Treat the 'newValue' as if it contains not an actual IAC position, but an incremental delta. // So we add this delta to the base IAC position, with a smooth taper for TPS transients. newValue = baseIdlePosition + interpolateClamped(0.0f, newValue, CONFIGB(idlePidDeactivationTpsThreshold), 0.0f, tpsPos); @@ -285,7 +285,7 @@ private: } -#if EFI_PROD_CODE || defined(__DOXYGEN__) +#if EFI_PROD_CODE // this value is not used yet if (CONFIGB(clutchDownPin) != GPIO_UNASSIGNED) { engine->clutchDownState = efiReadPin(CONFIGB(clutchDownPin)); @@ -306,7 +306,7 @@ private: undoIdleBlipIfNeeded(); float clt = engine->sensors.clt; -#if EFI_SHAFT_POSITION_INPUT || defined(__DOXYGEN__) +#if EFI_SHAFT_POSITION_INPUT bool isRunning = engine->rpmCalculator.isRunning(PASS_ENGINE_PARAMETER_SIGNATURE); #else bool isRunning = false; @@ -362,13 +362,13 @@ private: if (engineConfiguration->debugMode == DBG_IDLE_CONTROL) { if (engineConfiguration->idleMode == IM_AUTO) { -#if EFI_TUNER_STUDIO || defined(__DOXYGEN__) +#if EFI_TUNER_STUDIO // see also tsOutputChannels->idlePosition idlePid.postState(&tsOutputChannels, 1000000); tsOutputChannels.debugIntField4 = idleState; #endif /* EFI_TUNER_STUDIO */ } else { -#if EFI_TUNER_STUDIO || defined(__DOXYGEN__) +#if EFI_TUNER_STUDIO tsOutputChannels.debugFloatField1 = iacPosition; tsOutputChannels.debugIntField1 = iacMotor.getTargetPosition(); #endif /* EFI_TUNER_STUDIO */ @@ -508,7 +508,7 @@ void startIdleThread(Logging*sharedLogger) { } if (engineConfiguration->brakePedalPin != GPIO_UNASSIGNED) { -#if EFI_PROD_CODE || defined(__DOXYGEN__) +#if EFI_PROD_CODE efiSetPadMode("brake pedal switch", engineConfiguration->brakePedalPin, getInputMode(engineConfiguration->brakePedalPinMode)); #endif /* EFI_PROD_CODE */ diff --git a/firmware/controllers/actuators/lcd_controller.cpp b/firmware/controllers/actuators/lcd_controller.cpp index e28ff5357c..381d6b3506 100644 --- a/firmware/controllers/actuators/lcd_controller.cpp +++ b/firmware/controllers/actuators/lcd_controller.cpp @@ -18,7 +18,7 @@ #include "global.h" -#if EFI_HD44780_LCD || defined(__DOXYGEN__) +#if EFI_HD44780_LCD #include "lcd_controller.h" #include "lcd_HD44780.h" @@ -214,7 +214,7 @@ static void showLine(lcd_line_e line, int screenY) { int seconds = minI(9999, getTimeNowSeconds()); lcdPrintf("RPM %d %d ", GET_RPM(), seconds); } -#if EFI_FILE_LOGGING || defined(__DOXYGEN__) +#if EFI_FILE_LOGGING { char sdState; if (CONFIGB(isSdCardEnabled)) { @@ -267,7 +267,7 @@ static void showLine(lcd_line_e line, int screenY) { lcdPrintf("Knock %s %.2fv", buffer, engine->knockVolts); return; -#if EFI_ANALOG_SENSORS || defined(__DOXYGEN__) +#if EFI_ANALOG_SENSORS case LL_BARO: if (hasBaroSensor()) { lcdPrintf("Baro: %.2f", getBaroPressure()); diff --git a/firmware/controllers/actuators/malfunction_indicator.cpp b/firmware/controllers/actuators/malfunction_indicator.cpp index 742d46f410..eefa039747 100644 --- a/firmware/controllers/actuators/malfunction_indicator.cpp +++ b/firmware/controllers/actuators/malfunction_indicator.cpp @@ -27,7 +27,7 @@ #include "global.h" -#if EFI_MALFUNCTION_INDICATOR || defined(__DOXYGEN__) +#if EFI_MALFUNCTION_INDICATOR #include "io_pins.h" #include "malfunction_central.h" #include "malfunction_indicator.h" diff --git a/firmware/controllers/actuators/malfunction_indicator.h b/firmware/controllers/actuators/malfunction_indicator.h index acf8cfefd5..99691cb4ff 100644 --- a/firmware/controllers/actuators/malfunction_indicator.h +++ b/firmware/controllers/actuators/malfunction_indicator.h @@ -14,7 +14,7 @@ #include "global.h" #include "engine.h" -#if EFI_MALFUNCTION_INDICATOR || defined(__DOXYGEN__) +#if EFI_MALFUNCTION_INDICATOR bool isMilEnabled(); void initMalfunctionIndicator(void); diff --git a/firmware/controllers/actuators/pwm_tester.cpp b/firmware/controllers/actuators/pwm_tester.cpp index 4a262dc714..463ba917de 100644 --- a/firmware/controllers/actuators/pwm_tester.cpp +++ b/firmware/controllers/actuators/pwm_tester.cpp @@ -8,7 +8,7 @@ #include "global.h" -#if EFI_PWM_TESTER || defined(__DOXYGEN__) +#if EFI_PWM_TESTER #include "pwm_tester.h" #include "efi_wave.h" diff --git a/firmware/controllers/actuators/tachometer.cpp b/firmware/controllers/actuators/tachometer.cpp index eca7cce4b8..86f310e59c 100644 --- a/firmware/controllers/actuators/tachometer.cpp +++ b/firmware/controllers/actuators/tachometer.cpp @@ -46,7 +46,7 @@ void initTachometer(void) { enginePins.tachOut.initPin("analog tach output", CONFIGB(tachOutputPin), &CONFIGB(tachOutputPinMode)); -#if EFI_SHAFT_POSITION_INPUT || defined(__DOXYGEN__) +#if EFI_SHAFT_POSITION_INPUT addTriggerEventListener(tachSignalCallback, "tach", engine); #endif /* EFI_SHAFT_POSITION_INPUT */ } diff --git a/firmware/controllers/algo/accel_enrichment.cpp b/firmware/controllers/algo/accel_enrichment.cpp index 0208131eeb..3cf61ed849 100644 --- a/firmware/controllers/algo/accel_enrichment.cpp +++ b/firmware/controllers/algo/accel_enrichment.cpp @@ -28,7 +28,7 @@ #include "engine_state.h" #include "engine_math.h" #include "signal_executor.h" -#if EFI_TUNER_STUDIO || defined(__DOXYGEN__) +#if EFI_TUNER_STUDIO #include "tunerstudio_configuration.h" extern TunerStudioOutputChannels tsOutputChannels; #endif /* EFI_TUNER_STUDIO */ @@ -213,7 +213,7 @@ floatms_t AccelEnrichmemnt::getTpsEnrichment(DECLARE_ENGINE_PARAMETER_SIGNATURE) } if (engineConfiguration->debugMode == DBG_TPS_ACCEL) { -#if EFI_TUNER_STUDIO || defined(__DOXYGEN__) +#if EFI_TUNER_STUDIO tsOutputChannels.debugFloatField1 = tpsFrom; tsOutputChannels.debugFloatField2 = tpsTo; tsOutputChannels.debugFloatField3 = valueFromTable; @@ -250,7 +250,7 @@ float AccelEnrichmemnt::getEngineLoadEnrichment(DECLARE_ENGINE_PARAMETER_SIGNATU } if (engineConfiguration->debugMode == DBG_EL_ACCEL) { -#if EFI_TUNER_STUDIO || defined(__DOXYGEN__) +#if EFI_TUNER_STUDIO tsOutputChannels.debugIntField1 = distance; tsOutputChannels.debugFloatField1 = result; tsOutputChannels.debugFloatField2 = taper; @@ -319,7 +319,7 @@ AccelEnrichmemnt::AccelEnrichmemnt() { cb.setSize(4); } -#if ! EFI_UNIT_TEST || defined(__DOXYGEN__) +#if ! EFI_UNIT_TEST static void accelInfo() { if (logger == NULL) @@ -399,7 +399,7 @@ void initAccelEnrichment(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) logger = sharedLogger; tpsTpsMap.init(config->tpsTpsAccelTable, config->tpsTpsAccelFromRpmBins, config->tpsTpsAccelToRpmBins); -#if ! EFI_UNIT_TEST || defined(__DOXYGEN__) +#if ! EFI_UNIT_TEST addConsoleAction("accelinfo", accelInfo); diff --git a/firmware/controllers/algo/advance_map.cpp b/firmware/controllers/algo/advance_map.cpp index 286f8b1d7a..4bfca8ee25 100644 --- a/firmware/controllers/algo/advance_map.cpp +++ b/firmware/controllers/algo/advance_map.cpp @@ -31,7 +31,7 @@ EXTERN_ENGINE ; -#if EFI_TUNER_STUDIO || defined(__DOXYGEN__) +#if EFI_TUNER_STUDIO extern TunerStudioOutputChannels tsOutputChannels; #endif /* EFI_TUNER_STUDIO */ @@ -150,7 +150,7 @@ angle_t getAdvanceCorrections(int rpm DECLARE_ENGINE_PARAMETER_SUFFIX) { } if (engineConfiguration->debugMode == DBG_IGNITION_TIMING) { -#if EFI_TUNER_STUDIO || defined(__DOXYGEN__) +#if EFI_TUNER_STUDIO tsOutputChannels.debugFloatField1 = iatCorrection; tsOutputChannels.debugFloatField2 = engine->engineState.cltTimingCorrection; tsOutputChannels.debugFloatField3 = engine->fsioState.fsioTimingAdjustment; @@ -185,7 +185,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 EFI_ENGINE_CONTROL && EFI_SHAFT_POSITION_INPUT if (cisnan(engineLoad)) { return 0; // any error should already be reported } diff --git a/firmware/controllers/algo/engine.cpp b/firmware/controllers/algo/engine.cpp index 94d8772006..ec4fd6e2ef 100644 --- a/firmware/controllers/algo/engine.cpp +++ b/firmware/controllers/algo/engine.cpp @@ -25,7 +25,7 @@ #include "map_averaging.h" #include "fsio_impl.h" -#if EFI_PROD_CODE || defined(__DOXYGEN__) +#if EFI_PROD_CODE #include "injector_central.h" #else #define isRunningBenchTest() true @@ -41,7 +41,7 @@ extern int globalConfigurationVersion; EXTERN_ENGINE ; -#if EFI_TUNER_STUDIO || defined(__DOXYGEN__) +#if EFI_TUNER_STUDIO extern TunerStudioOutputChannels tsOutputChannels; #endif /* EFI_TUNER_STUDIO */ @@ -55,7 +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_ENGINE_CONTROL && EFI_SHAFT_POSITION_INPUT #if !EFI_UNIT_TEST // we have a confusing threading model so some synchronization would not hurt bool alreadyLocked = lockAnyContext(); @@ -93,7 +93,7 @@ void Engine::initializeTriggerShape(Logging *logger DECLARE_ENGINE_PARAMETER_SUF } static void cylinderCleanupControl(DECLARE_ENGINE_PARAMETER_SIGNATURE) { -#if EFI_ENGINE_CONTROL || defined(__DOXYGEN__) +#if EFI_ENGINE_CONTROL bool newValue; if (engineConfiguration->isCylinderCleanupEnabled) { newValue = !engine->rpmCalculator.isRunning(PASS_ENGINE_PARAMETER_SIGNATURE) && getTPS(PASS_ENGINE_PARAMETER_SIGNATURE) > CLEANUP_MODE_TPS; @@ -112,7 +112,7 @@ void Engine::periodicSlowCallback(DECLARE_ENGINE_PARAMETER_SIGNATURE) { updateSlowSensors(PASS_ENGINE_PARAMETER_SIGNATURE); checkShutdown(); -#if EFI_FSIO || defined(__DOXYGEN__) +#if EFI_FSIO runFsio(PASS_ENGINE_PARAMETER_SIGNATURE); #endif /* EFI_PROD_CODE && EFI_FSIO */ @@ -127,7 +127,7 @@ void Engine::periodicSlowCallback(DECLARE_ENGINE_PARAMETER_SIGNATURE) { * See also periodicFastCallback */ void Engine::updateSlowSensors(DECLARE_ENGINE_PARAMETER_SIGNATURE) { -#if EFI_ENGINE_CONTROL || defined(__DOXYGEN__) +#if EFI_ENGINE_CONTROL int rpm = GET_RPM(); isEngineChartEnabled = CONFIG(isEngineChartEnabled) && rpm < CONFIG(engineSnifferRpmThreshold); sensorChartMode = rpm < CONFIG(sensorSnifferRpmThreshold) ? CONFIGB(sensorChartMode) : SC_OFF; @@ -277,7 +277,7 @@ void Engine::watchdog() { } isSpinning = false; ignitionEvents.isReady = false; -#if EFI_PROD_CODE || EFI_SIMULATOR || defined(__DOXYGEN__) +#if EFI_PROD_CODE || EFI_SIMULATOR scheduleMsg(&engineLogger, "engine has STOPPED"); scheduleMsg(&engineLogger, "templog engine has STOPPED [%x][%x] [%x][%x] %d", (int)(nowNt >> 32), (int)nowNt, @@ -292,7 +292,7 @@ void Engine::watchdog() { } void Engine::checkShutdown() { -#if EFI_MAIN_RELAY_CONTROL || defined(__DOXYGEN__) +#if EFI_MAIN_RELAY_CONTROL int rpm = rpmCalculator.getRpm(); /** @@ -308,7 +308,7 @@ void Engine::checkShutdown() { } bool Engine::isInShutdownMode() { -#if EFI_MAIN_RELAY_CONTROL || defined(__DOXYGEN__) +#if EFI_MAIN_RELAY_CONTROL if (stopEngineRequestTimeNt == 0) // the shutdown procedure is not started return false; diff --git a/firmware/controllers/algo/engine.h b/firmware/controllers/algo/engine.h index 4e893ecfe9..9038d00b8d 100644 --- a/firmware/controllers/algo/engine.h +++ b/firmware/controllers/algo/engine.h @@ -259,7 +259,7 @@ public: angle_t injectionOffset = 0; -#if EFI_ENABLE_MOCK_ADC || defined(__DOXYGEN__) +#if EFI_ENABLE_MOCK_ADC MockAdcState mockAdcState; #endif /* EFI_ENABLE_MOCK_ADC */ }; @@ -362,7 +362,7 @@ public: TestExecutor executor; #endif -#if EFI_ENGINE_CONTROL || defined(__DOXYGEN__) +#if EFI_ENGINE_CONTROL FuelSchedule injectionEvents; #endif /* EFI_ENGINE_CONTROL */ diff --git a/firmware/controllers/algo/engine2.cpp b/firmware/controllers/algo/engine2.cpp index d002aad508..55be26aab1 100644 --- a/firmware/controllers/algo/engine2.cpp +++ b/firmware/controllers/algo/engine2.cpp @@ -32,7 +32,7 @@ EXTERN_ENGINE // this does not look exactly right extern LoggingWithStorage engineLogger; -#if EFI_TUNER_STUDIO || defined(__DOXYGEN__) +#if EFI_TUNER_STUDIO extern TunerStudioOutputChannels tsOutputChannels; #endif /* EFI_TUNER_STUDIO */ @@ -125,7 +125,7 @@ void EngineState::updateSlowSensors(DECLARE_ENGINE_PARAMETER_SIGNATURE) { } void EngineState::periodicFastCallback(DECLARE_ENGINE_PARAMETER_SIGNATURE) { -#if EFI_ENGINE_CONTROL || defined(__DOXYGEN__) +#if EFI_ENGINE_CONTROL if (!engine->slowCallBackWasInvoked) { warning(CUSTOM_ERR_6696, "Slow not invoked yet"); } @@ -156,7 +156,7 @@ void EngineState::periodicFastCallback(DECLARE_ENGINE_PARAMETER_SIGNATURE) { cltFuelCorrection = warmupAfrPid.getOutput(warmupTargetAfr, engine->sensors.currentAfr, 1); } if (engineConfiguration->debugMode == DBG_WARMUP_ENRICH) { -#if EFI_TUNER_STUDIO || defined(__DOXYGEN__) +#if EFI_TUNER_STUDIO tsOutputChannels.debugFloatField1 = warmupTargetAfr; warmupAfrPid.postState(&tsOutputChannels); #endif /* EFI_TUNER_STUDIO */ @@ -218,7 +218,7 @@ void EngineState::periodicFastCallback(DECLARE_ENGINE_PARAMETER_SIGNATURE) { } void EngineState::updateTChargeK(int rpm, float tps DECLARE_ENGINE_PARAMETER_SUFFIX) { -#if EFI_ENGINE_CONTROL || defined(__DOXYGEN__) +#if EFI_ENGINE_CONTROL float coolantC = ENGINE(sensors.clt); float intakeC = ENGINE(sensors.iat); float newTCharge = getTCharge(rpm, tps, coolantC, intakeC PASS_ENGINE_PARAMETER_SUFFIX); diff --git a/firmware/controllers/algo/engine_configuration.cpp b/firmware/controllers/algo/engine_configuration.cpp index 613216c692..63b963edea 100644 --- a/firmware/controllers/algo/engine_configuration.cpp +++ b/firmware/controllers/algo/engine_configuration.cpp @@ -30,7 +30,7 @@ #include "advance_map.h" #include "hip9011_lookup.h" -#if EFI_MEMS || defined(__DOXYGEN__) +#if EFI_MEMS #include "accelerometer.h" #endif @@ -83,32 +83,32 @@ #include "zil130.h" #include "honda_600.h" -#if EFI_IDLE_CONTROL || defined(__DOXYGEN__) +#if EFI_IDLE_CONTROL #include "idle_thread.h" #endif /* EFI_IDLE_CONTROL */ -#if EFI_ALTERNATOR_CONTROL || defined(__DOXYGEN__) +#if EFI_ALTERNATOR_CONTROL #include "alternator_controller.h" #endif -#if EFI_ELECTRONIC_THROTTLE_BODY || defined(__DOXYGEN__) +#if EFI_ELECTRONIC_THROTTLE_BODY #include "electronic_throttle.h" #endif -#if EFI_HIP_9011 || defined(__DOXYGEN__) +#if EFI_HIP_9011 #include "hip9011.h" #endif -#if EFI_PROD_CODE || defined(__DOXYGEN__) +#if EFI_PROD_CODE #include "hardware.h" #include "board.h" #endif /* EFI_PROD_CODE */ -#if EFI_EMULATE_POSITION_SENSORS || defined(__DOXYGEN__) +#if EFI_EMULATE_POSITION_SENSORS #include "trigger_emulator.h" #endif /* EFI_EMULATE_POSITION_SENSORS */ -#if EFI_TUNER_STUDIO || defined(__DOXYGEN__) +#if EFI_TUNER_STUDIO #include "tunerstudio.h" #endif @@ -174,29 +174,29 @@ void incrementGlobalConfigurationVersion(DECLARE_ENGINE_PARAMETER_SIGNATURE) { /** * All these callbacks could be implemented as listeners, but these days I am saving RAM */ -#if EFI_PROD_CODE || defined(__DOXYGEN__) +#if EFI_PROD_CODE applyNewHardwareSettings(); #endif /* EFI_PROD_CODE */ engine->preCalculate(PASS_ENGINE_PARAMETER_SIGNATURE); -#if EFI_ALTERNATOR_CONTROL || defined(__DOXYGEN__) +#if EFI_ALTERNATOR_CONTROL onConfigurationChangeAlternatorCallback(&activeConfiguration); #endif /* EFI_ALTERNATOR_CONTROL */ -#if EFI_ELECTRONIC_THROTTLE_BODY || defined(__DOXYGEN__) +#if EFI_ELECTRONIC_THROTTLE_BODY onConfigurationChangeElectronicThrottleCallback(&activeConfiguration); #endif /* EFI_ELECTRONIC_THROTTLE_BODY */ -#if EFI_IDLE_CONTROL || defined(__DOXYGEN__) +#if EFI_IDLE_CONTROL onConfigurationChangeIdleCallback(&activeConfiguration); #endif /* EFI_IDLE_CONTROL */ -#if EFI_SHAFT_POSITION_INPUT || defined(__DOXYGEN__) +#if EFI_SHAFT_POSITION_INPUT onConfigurationChangeTriggerCallback(&activeConfiguration PASS_ENGINE_PARAMETER_SUFFIX); #endif /* EFI_SHAFT_POSITION_INPUT */ -#if EFI_EMULATE_POSITION_SENSORS || defined(__DOXYGEN__) +#if EFI_EMULATE_POSITION_SENSORS onConfigurationChangeRpmEmulatorCallback(&activeConfiguration); #endif /* EFI_EMULATE_POSITION_SENSORS */ -#if EFI_FSIO || defined(__DOXYGEN__) +#if EFI_FSIO onConfigurationChangeFsioCallback(&activeConfiguration PASS_ENGINE_PARAMETER_SUFFIX); #endif /* EFI_FSIO */ rememberCurrentConfiguration(PASS_ENGINE_PARAMETER_SIGNATURE); @@ -342,14 +342,14 @@ void prepareVoidConfiguration(engine_configuration_s *engineConfiguration) { boardConfiguration->acRelayPin = GPIO_UNASSIGNED; boardConfiguration->acRelayPinMode = OM_DEFAULT; -#if EFI_ALTERNATOR_CONTROL || defined(__DOXYGEN__) +#if EFI_ALTERNATOR_CONTROL setDefaultAlternatorParameters(); #endif /* EFI_ALTERNATOR_CONTROL */ -#if EFI_ELECTRONIC_THROTTLE_BODY || defined(__DOXYGEN__) +#if EFI_ELECTRONIC_THROTTLE_BODY setDefaultEtbParameters(PASS_ENGINE_PARAMETER_SIGNATURE); setDefaultEtbBiasCurve(PASS_ENGINE_PARAMETER_SIGNATURE); #endif /* EFI_ELECTRONIC_THROTTLE_BODY */ -#if EFI_IDLE_CONTROL || defined(__DOXYGEN__) +#if EFI_IDLE_CONTROL setDefaultIdleParameters(); #endif /* EFI_IDLE_CONTROL */ boardConfiguration->wboHeaterPin = GPIO_UNASSIGNED; @@ -405,7 +405,7 @@ void setDefaultBasePins(DECLARE_ENGINE_PARAMETER_SIGNATURE) { engineConfiguration->fatalErrorPin = GPIOD_14; #endif /* EFI_FATAL_ERROR_PIN */ engineConfiguration->warninigLedPin = GPIOD_13; -#if EFI_PROD_CODE || defined(__DOXYGEN__) +#if EFI_PROD_CODE // call overrided board-specific serial configuration setup, if needed (for custom boards only) // needed also by bootloader code setPinConfigurationOverrides(); @@ -422,7 +422,7 @@ void setDefaultSerialParameters(DECLARE_ENGINE_PARAMETER_SIGNATURE) { boardConfiguration->tunerStudioSerialSpeed = TS_DEFAULT_SPEED; engineConfiguration->uartConsoleSerialSpeed = 115200; -#if EFI_PROD_CODE || defined(__DOXYGEN__) +#if EFI_PROD_CODE // call overrided board-specific serial configuration setup, if needed (for custom boards only) setSerialConfigurationOverrides(); #endif @@ -435,7 +435,7 @@ void setDefaultSdCardParameters(DECLARE_ENGINE_PARAMETER_SIGNATURE) { boardConfiguration->sdCardCsPin = GPIOD_4; boardConfiguration->isSdCardEnabled = true; -#if EFI_PROD_CODE || defined(__DOXYGEN__) +#if EFI_PROD_CODE // call overrided board-specific SD card configuration setup, if needed (for custom boards only) setSdCardConfigurationOverrides(); #endif @@ -648,7 +648,7 @@ int getTargetRpmForIdleCorrection(DECLARE_ENGINE_PARAMETER_SIGNATURE) { * anything else. */ void setDefaultConfiguration(DECLARE_ENGINE_PARAMETER_SIGNATURE) { -#if (! EFI_UNIT_TEST) || defined(__DOXYGEN__) +#if (! EFI_UNIT_TEST) memset(&persistentState.persistentConfiguration, 0, sizeof(persistentState.persistentConfiguration)); #endif prepareVoidConfiguration(engineConfiguration); @@ -769,7 +769,7 @@ void setDefaultConfiguration(DECLARE_ENGINE_PARAMETER_SIGNATURE) { engineConfiguration->auxTempSensor1.adcChannel = EFI_ADC_NONE; engineConfiguration->auxTempSensor2.adcChannel = EFI_ADC_NONE; -#if EFI_PROD_CODE || defined(__DOXYGEN__) +#if EFI_PROD_CODE engineConfiguration->warningPeriod = 10; #else engineConfiguration->warningPeriod = 0; @@ -953,7 +953,7 @@ void setDefaultConfiguration(DECLARE_ENGINE_PARAMETER_SIGNATURE) { -#if EFI_PROD_CODE || defined(__DOXYGEN__) +#if EFI_PROD_CODE engineConfiguration->engineChartSize = 300; #else // need more events for automated test @@ -1070,7 +1070,7 @@ void setDefaultConfiguration(DECLARE_ENGINE_PARAMETER_SIGNATURE) { boardConfiguration->spi1misoPin = GPIOB_4; boardConfiguration->spi1sckPin = GPIOB_3; // please note that this pin is also SWO/SWD - Single Wire debug Output -#if EFI_MEMS || defined(__DOXYGEN__) +#if EFI_MEMS // this would override some values from above configureAccelerometerPins(PASS_ENGINE_PARAMETER_SIGNATURE); #endif @@ -1084,7 +1084,7 @@ void setDefaultConfiguration(DECLARE_ENGINE_PARAMETER_SIGNATURE) { boardConfiguration->spi3sckPin = GPIOB_3; engineConfiguration->hip9011Gain = 1; -#if EFI_HIP_9011 || defined(__DOXYGEN__) +#if EFI_HIP_9011 setHip9011FrankensoPinout(); #endif /* EFI_HIP_9011 */ @@ -1105,12 +1105,12 @@ void setDefaultConfiguration(DECLARE_ENGINE_PARAMETER_SIGNATURE) { engineConfiguration->tpsAccelLength = 12; engineConfiguration->tpsAccelEnrichmentThreshold = 40; // TPS % change, per engine cycle -#if EFI_PROD_CODE || defined(__DOXYGEN__) +#if EFI_PROD_CODE // call overrided board-specific configuration setup, if needed (for custom boards only) setBoardConfigurationOverrides(); #endif -#if EFI_FSIO || defined(__DOXYGEN__) +#if EFI_FSIO /** * to test: * set_fsio_setting 1 5000 @@ -1133,7 +1133,7 @@ void resetConfigurationExt(Logging * logger, engine_type_e engineType DECLARE_EN * Let's apply global defaults first */ setDefaultConfiguration(PASS_ENGINE_PARAMETER_SIGNATURE); -#if EFI_SIMULATOR || defined(__DOXYGEN__) +#if EFI_SIMULATOR engineConfiguration->directSelfStimulation = true; #endif /* */ engineConfiguration->engineType = engineType; @@ -1151,7 +1151,7 @@ void resetConfigurationExt(Logging * logger, engine_type_e engineType DECLARE_EN case ACURA_RSX: setAcuraRSX(engineConfiguration); break; -#if EFI_SUPPORT_DODGE_NEON || defined(__DOXYGEN__) +#if EFI_SUPPORT_DODGE_NEON case DODGE_NEON_1995: setDodgeNeon1995EngineConfiguration(PASS_CONFIG_PARAMETER_SIGNATURE); break; @@ -1166,17 +1166,17 @@ void resetConfigurationExt(Logging * logger, engine_type_e engineType DECLARE_EN break; #endif /* EFI_SUPPORT_DODGE_NEON */ -#if EFI_SUPPORT_FORD_ASPIRE || defined(__DOXYGEN__) +#if EFI_SUPPORT_FORD_ASPIRE case FORD_ASPIRE_1996: setFordAspireEngineConfiguration(PASS_ENGINE_PARAMETER_SIGNATURE); break; #endif /* EFI_SUPPORT_FORD_ASPIRE */ -#if EFI_SUPPORT_FORD_FIESTA || defined(__DOXYGEN__) +#if EFI_SUPPORT_FORD_FIESTA case FORD_FIESTA: setFordFiestaDefaultEngineConfiguration(PASS_ENGINE_PARAMETER_SIGNATURE); break; #endif /* EFI_SUPPORT_FORD_FIESTA */ -#if EFI_SUPPORT_NISSAN_PRIMERA || defined(__DOXYGEN__) +#if EFI_SUPPORT_NISSAN_PRIMERA case NISSAN_PRIMERA: setNissanPrimeraEngineConfiguration(engineConfiguration); break; @@ -1223,7 +1223,7 @@ void resetConfigurationExt(Logging * logger, engine_type_e engineType DECLARE_EN case MITSU_4G93: setMitsubishiConfiguration(PASS_ENGINE_PARAMETER_SIGNATURE); break; -#if EFI_SUPPORT_1995_FORD_INLINE_6 || defined(__DOXYGEN__) +#if EFI_SUPPORT_1995_FORD_INLINE_6 case FORD_INLINE_6_1995: setFordInline6(PASS_ENGINE_PARAMETER_SIGNATURE); break; @@ -1370,23 +1370,23 @@ void validateConfiguration(DECLARE_ENGINE_PARAMETER_SIGNATURE) { } void applyNonPersistentConfiguration(Logging * logger DECLARE_ENGINE_PARAMETER_SUFFIX) { -#if EFI_PROD_CODE || defined(__DOXYGEN__) +#if EFI_PROD_CODE efiAssertVoid(CUSTOM_APPLY_STACK, getCurrentRemainingStack() > 256, "apply c"); scheduleMsg(logger, "applyNonPersistentConfiguration()"); #endif assertEngineReference(); -#if EFI_ENGINE_CONTROL || defined(__DOXYGEN__) +#if EFI_ENGINE_CONTROL ENGINE(initializeTriggerShape(logger PASS_ENGINE_PARAMETER_SUFFIX)); #endif -#if EFI_FSIO || defined(__DOXYGEN__) +#if EFI_FSIO applyFsioConfiguration(PASS_ENGINE_PARAMETER_SIGNATURE); #endif } -#if EFI_ENGINE_CONTROL || defined(__DOXYGEN__) +#if EFI_ENGINE_CONTROL void prepareShapes(DECLARE_ENGINE_PARAMETER_SIGNATURE) { prepareOutputSignals(PASS_ENGINE_PARAMETER_SIGNATURE); diff --git a/firmware/controllers/algo/event_registry.h b/firmware/controllers/algo/event_registry.h index 7e78d9bbcb..80713dac95 100644 --- a/firmware/controllers/algo/event_registry.h +++ b/firmware/controllers/algo/event_registry.h @@ -26,7 +26,7 @@ public: InjectorOutputPin *outputs[MAX_WIRES_COUNT]; bool isOverlapping; int ownIndex; -#if EFI_UNIT_TEST || defined(__DOXYGEN__) +#if EFI_UNIT_TEST Engine *engine; #endif event_trigger_position_s injectionStart; @@ -53,7 +53,7 @@ public: */ int cylinderIndex; char *name; -#if EFI_UNIT_TEST || defined(__DOXYGEN__) +#if EFI_UNIT_TEST Engine *engine; #endif IgnitionOutputPin *getOutputForLoggins(); diff --git a/firmware/controllers/algo/fuel_math.cpp b/firmware/controllers/algo/fuel_math.cpp index 8a22f50bc9..3737099444 100644 --- a/firmware/controllers/algo/fuel_math.cpp +++ b/firmware/controllers/algo/fuel_math.cpp @@ -47,7 +47,7 @@ extern fuel_Map3D_t ve2Map; extern afr_Map3D_t afrMap; extern baroCorr_Map3D_t baroCorrMap; -#if EFI_ENGINE_CONTROL || defined(__DOXYGEN__) +#if EFI_ENGINE_CONTROL /** * @return total duration of fuel injection per engine cycle, in milliseconds @@ -151,7 +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__) +#if EFI_ENGINE_CONTROL && EFI_SHAFT_POSITION_INPUT bool isCranking = ENGINE(rpmCalculator).isCranking(PASS_ENGINE_PARAMETER_SIGNATURE); injection_mode_e mode = isCranking ? engineConfiguration->crankingInjectionMode : @@ -169,7 +169,7 @@ floatms_t getInjectionDuration(int rpm DECLARE_ENGINE_PARAMETER_SUFFIX) { floatms_t baseFuel = getBaseFuel(rpm PASS_ENGINE_PARAMETER_SUFFIX); fuelPerCycle = getRunningFuel(baseFuel PASS_ENGINE_PARAMETER_SUFFIX); efiAssert(CUSTOM_ERR_ASSERT, !cisnan(fuelPerCycle), "NaN fuelPerCycle", 0); -#if EFI_PRINTF_FUEL_DETAILS || defined(__DOXYGEN__) +#if EFI_PRINTF_FUEL_DETAILS printf("baseFuel=%.2f fuelPerCycle=%.2f \t\n", baseFuel, fuelPerCycle); #endif /*EFI_PRINTF_FUEL_DETAILS */ @@ -298,7 +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 EFI_ENGINE_CONTROL && EFI_SHAFT_POSITION_INPUT if (cisnan(engineLoad)) { warning(CUSTOM_NAN_ENGINE_LOAD_2, "NaN engine load"); return 0; @@ -323,7 +323,7 @@ float getBaroCorrection(DECLARE_ENGINE_PARAMETER_SIGNATURE) { } } -#if EFI_ENGINE_CONTROL || defined(__DOXYGEN__) +#if EFI_ENGINE_CONTROL /** * @return Duration of fuel injection while craning */ diff --git a/firmware/controllers/core/error_handling.cpp b/firmware/controllers/core/error_handling.cpp index 2bfee7710b..9242038294 100644 --- a/firmware/controllers/core/error_handling.cpp +++ b/firmware/controllers/core/error_handling.cpp @@ -21,7 +21,7 @@ static MemoryStream firmwareErrorMessageStream; static char warningBuffer[WARNING_BUFFER_SIZE]; static bool isWarningStreamInitialized = false; -#if EFI_HD44780_LCD || defined(__DOXYGEN__) +#if EFI_HD44780_LCD #include "lcd_HD44780.h" #endif /* EFI_HD44780_LCD */ @@ -52,18 +52,18 @@ void chDbgPanic3(const char *msg, const char * file, int line) { return; dbg_panic_file = file; dbg_panic_line = line; -#if CH_DBG_SYSTEM_STATE_CHECK || defined(__DOXYGEN__) +#if CH_DBG_SYSTEM_STATE_CHECK ch.dbg.panic_msg = msg; #endif /* CH_DBG_SYSTEM_STATE_CHECK */ -#if EFI_PROD_CODE || defined(__DOXYGEN__) +#if EFI_PROD_CODE ON_FATAL_ERROR(); #else printf("chDbgPanic3 %s %s%d", msg, file, line); exit(-1); #endif -#if EFI_HD44780_LCD || defined(__DOXYGEN__) +#if EFI_HD44780_LCD lcdShowPanicMessage((char *) msg); #endif /* EFI_HD44780_LCD */ @@ -109,11 +109,11 @@ bool warning(obd_code_e code, const char *fmt, ...) { if (hasFirmwareErrorFlag) return true; -#if EFI_SIMULATOR || defined(__DOXYGEN__) +#if EFI_SIMULATOR printf("sim_warning %s\r\n", fmt); #endif /* EFI_SIMULATOR */ -#if EFI_SIMULATOR || EFI_PROD_CODE || defined(__DOXYGEN__) +#if EFI_SIMULATOR || EFI_PROD_CODE if (!isWarningStreamInitialized) { firmwareError(CUSTOM_ERR_ASSERT, "warn stream not initialized for %d", code); return false; @@ -148,7 +148,7 @@ char *getWarning(void) { } -#if EFI_CLOCK_LOCKS || defined(__DOXYGEN__) +#if EFI_CLOCK_LOCKS uint32_t lastLockTime; /** * Maximum time before requesting lock and releasing lock at the end of critical section @@ -183,7 +183,7 @@ void onUnlockHook(void) { void initErrorHandling(void) { -#if EFI_SIMULATOR || EFI_PROD_CODE || defined(__DOXYGEN__) +#if EFI_SIMULATOR || EFI_PROD_CODE msObjectInit(&warningStream, (uint8_t *) warningBuffer, WARNING_BUFFER_SIZE, 0); msObjectInit(&firmwareErrorMessageStream, errorMessageBuffer, sizeof(errorMessageBuffer), 0); #endif @@ -191,7 +191,7 @@ void initErrorHandling(void) { } void firmwareError(obd_code_e code, const char *fmt, ...) { -#if EFI_PROD_CODE || defined(__DOXYGEN__) +#if EFI_PROD_CODE if (hasFirmwareErrorFlag) return; engine->engineState.warnings.addWarningCode(code); @@ -230,7 +230,7 @@ void firmwareError(obd_code_e code, const char *fmt, ...) { va_end(ap); printf("\r\n"); -#if EFI_SIMULATOR || EFI_UNIT_TEST || defined(__DOXYGEN__) +#if EFI_SIMULATOR || EFI_UNIT_TEST exit(-1); #endif /* EFI_SIMULATOR */ #endif diff --git a/firmware/controllers/core/fsio_core.cpp b/firmware/controllers/core/fsio_core.cpp index e07a32607f..94da7d6856 100644 --- a/firmware/controllers/core/fsio_core.cpp +++ b/firmware/controllers/core/fsio_core.cpp @@ -15,7 +15,7 @@ #include "global.h" -#if EFI_FSIO || defined(__DOXYGEN__) +#if EFI_FSIO #include "fsio_core.h" #include "fsio_impl.h" @@ -138,7 +138,7 @@ void LECalculator::push(le_action_e action, float value) { * @return true in case of error, false otherwise */ bool LECalculator::processElement(LEElement *element DECLARE_ENGINE_PARAMETER_SUFFIX) { -#if EFI_PROD_CODE || defined(__DOXYGEN__) +#if EFI_PROD_CODE efiAssert(CUSTOM_ERR_ASSERT, getCurrentRemainingStack() > 64, "FSIO logic", false); #endif switch (element->action) { diff --git a/firmware/controllers/core/fsio_impl.cpp b/firmware/controllers/core/fsio_impl.cpp index 9d67253de1..1e6f7b6643 100644 --- a/firmware/controllers/core/fsio_impl.cpp +++ b/firmware/controllers/core/fsio_impl.cpp @@ -11,7 +11,7 @@ #include "global.h" -#if EFI_FSIO || defined(__DOXYGEN__) +#if EFI_FSIO #include "fsio_impl.h" #include "settings.h" @@ -97,7 +97,7 @@ static LEElement * fuelPumpLogic; static LEElement * radiatorFanLogic; static LEElement * alternatorLogic; -#if EFI_MAIN_RELAY_CONTROL || defined(__DOXYGEN__) +#if EFI_MAIN_RELAY_CONTROL static LEElement * mainRelayLogic; #endif /* EFI_MAIN_RELAY_CONTROL */ @@ -151,7 +151,7 @@ float getEngineValue(le_action_e action DECLARE_ENGINE_PARAMETER_SUFFIX) { } -#if EFI_PROD_CODE || defined(__DOXYGEN__) +#if EFI_PROD_CODE #include "pin_repository.h" #include "pwm_generator.h" @@ -266,7 +266,7 @@ void applyFsioConfiguration(DECLARE_ENGINE_PARAMETER_SIGNATURE) { } void onConfigurationChangeFsioCallback(engine_configuration_s *previousConfiguration DECLARE_ENGINE_PARAMETER_SUFFIX) { -#if EFI_FSIO || defined(__DOXYGEN__) +#if EFI_FSIO applyFsioConfiguration(PASS_ENGINE_PARAMETER_SIGNATURE); #endif } @@ -401,7 +401,7 @@ static void setPinState(const char * msg, OutputPin *pin, LEElement *element DEC } -#if EFI_PROD_CODE || defined(__DOXYGEN__) +#if EFI_PROD_CODE static void setFsioFrequency(int index, int frequency) { index--; if (index < 0 || index >= FSIO_COMMAND_COUNT) { @@ -446,13 +446,13 @@ void runFsio(DECLARE_ENGINE_PARAMETER_SIGNATURE) { handleFsio(index PASS_ENGINE_PARAMETER_SUFFIX); } -#if EFI_FUEL_PUMP || defined(__DOXYGEN__) +#if EFI_FUEL_PUMP if (CONFIGB(fuelPumpPin) != GPIO_UNASSIGNED) { setPinState("pump", &enginePins.fuelPumpRelay, fuelPumpLogic PASS_ENGINE_PARAMETER_SUFFIX); } #endif /* EFI_FUEL_PUMP */ -#if EFI_MAIN_RELAY_CONTROL || defined(__DOXYGEN__) +#if EFI_MAIN_RELAY_CONTROL if (CONFIGB(mainRelayPin) != GPIO_UNASSIGNED) setPinState("main_relay", &enginePins.mainRelay, mainRelayLogic PASS_ENGINE_PARAMETER_SUFFIX); #else /* EFI_MAIN_RELAY_CONTROL */ @@ -640,7 +640,7 @@ void initFsioImpl(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) { logger = sharedLogger; #endif -#if EFI_FUEL_PUMP || defined(__DOXYGEN__) +#if EFI_FUEL_PUMP fuelPumpLogic = sysPool.parseExpression(FUEL_PUMP_LOGIC); #endif /* EFI_FUEL_PUMP */ @@ -649,12 +649,12 @@ void initFsioImpl(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) { alternatorLogic = sysPool.parseExpression(ALTERNATOR_LOGIC); -#if EFI_MAIN_RELAY_CONTROL || defined(__DOXYGEN__) +#if EFI_MAIN_RELAY_CONTROL if (CONFIGB(mainRelayPin) != GPIO_UNASSIGNED) mainRelayLogic = sysPool.parseExpression(MAIN_RELAY_LOGIC); #endif /* EFI_MAIN_RELAY_CONTROL */ -#if EFI_PROD_CODE || defined(__DOXYGEN__) +#if EFI_PROD_CODE for (int i = 0; i < FSIO_COMMAND_COUNT; i++) { brain_pin_e brainPin = CONFIGB(fsioOutputPins)[i]; @@ -680,7 +680,7 @@ void initFsioImpl(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) { addConsoleActionSS("set_fsio_pid_output_pin", (VoidCharPtrCharPtr) setFsioPidOutputPin); addConsoleActionSS("set_fsio_output_pin", (VoidCharPtrCharPtr) setFsioOutputPin); -#if EFI_PROD_CODE || defined(__DOXYGEN__) +#if EFI_PROD_CODE addConsoleActionII("set_fsio_output_frequency", (VoidIntInt) setFsioFrequency); #endif addConsoleActionSS("set_fsio_digital_input_pin", (VoidCharPtrCharPtr) setFsioDigitalInputPin); diff --git a/firmware/controllers/engine_controller.cpp b/firmware/controllers/engine_controller.cpp index 2f47d400ad..d3c838d049 100644 --- a/firmware/controllers/engine_controller.cpp +++ b/firmware/controllers/engine_controller.cpp @@ -23,7 +23,7 @@ #include "global.h" #if !EFI_UNIT_TEST -#if EFI_SENSOR_CHART || defined(__DOXYGEN__) +#if EFI_SENSOR_CHART #include "sensor_chart.h" #endif #include "engine_configuration.h" @@ -37,13 +37,13 @@ #include "main_trigger_callback.h" #include "io_pins.h" #include "flash_main.h" -#if EFI_TUNER_STUDIO || defined(__DOXYGEN__) +#if EFI_TUNER_STUDIO #include "tunerstudio.h" #endif #include "injector_central.h" #include "rfiutil.h" #include "engine_math.h" -#if EFI_WAVE_ANALYZER || defined(__DOXYGEN__) +#if EFI_WAVE_ANALYZER #include "wave_analyzer.h" #endif #include "allsensors.h" @@ -61,11 +61,11 @@ #include "accelerometer.h" #include "counter64.h" -#if HAL_USE_ADC || defined(__DOXYGEN__) +#if HAL_USE_ADC #include "AdcConfiguration.h" #endif /* HAL_USE_ADC */ -#if EFI_PROD_CODE || defined(__DOXYGEN__) +#if EFI_PROD_CODE #include "pwm_generator.h" #include "adc_inputs.h" @@ -76,11 +76,11 @@ #include "tachometer.h" #endif /* EFI_PROD_CODE */ -#if EFI_CJ125 || defined(__DOXYGEN__) +#if EFI_CJ125 #include "cj125.h" #endif -#if defined(EFI_BOOTLOADER_INCLUDE_CODE) || defined(__DOXYGEN__) +#if defined(EFI_BOOTLOADER_INCLUDE_CODE) #include "bootloader/bootloader.h" #endif /* EFI_BOOTLOADER_INCLUDE_CODE */ @@ -98,7 +98,7 @@ static virtual_timer_t periodicFastTimer; // 50Hz static LoggingWithStorage logger("Engine Controller"); -#if (EFI_PROD_CODE || EFI_SIMULATOR) || defined(__DOXYGEN__) +#if EFI_PROD_CODE || EFI_SIMULATOR /** * todo: this should probably become 'static', i.e. private, and propagated around explicitly? @@ -109,7 +109,7 @@ Engine * engine = &___engine; static msg_t csThread(void) { chRegSetThreadName("status"); -#if EFI_SHAFT_POSITION_INPUT || defined(__DOXYGEN__) +#if EFI_SHAFT_POSITION_INPUT while (true) { int is_cranking = ENGINE(rpmCalculator).isCranking(PASS_ENGINE_PARAMETER_SIGNATURE); bool is_running = ENGINE(rpmCalculator).isRunning(PASS_ENGINE_PARAMETER_SIGNATURE); @@ -129,7 +129,7 @@ static msg_t csThread(void) { return -1; } -#if EFI_PROD_CODE || defined(__DOXYGEN__) +#if EFI_PROD_CODE static Overflow64Counter halTime; /** @@ -176,7 +176,7 @@ efitick_t getTimeNowNt(void) { localH = halTime.state.highBits; localLow = halTime.state.lowBits; localH2 = halTime.state.highBits; -#if EFI_PROD_CODE || defined(__DOXYGEN__) +#if EFI_PROD_CODE if (counter++ == 10000) chDbgPanic("lock-free frozen"); #endif /* EFI_PROD_CODE */ @@ -279,7 +279,7 @@ static void invokePerSecond(void) { } static void periodicSlowCallback(Engine *engine) { -#if (EFI_ENGINE_CONTROL && EFI_SHAFT_POSITION_INPUT) || defined(__DOXYGEN__) +#if EFI_ENGINE_CONTROL && EFI_SHAFT_POSITION_INPUT efiAssertVoid(CUSTOM_ERR_6661, getCurrentRemainingStack() > 64, "lowStckOnEv"); #if EFI_PROD_CODE /** @@ -306,7 +306,7 @@ static void periodicSlowCallback(Engine *engine) { } if (engine->rpmCalculator.isStopped(PASS_ENGINE_PARAMETER_SIGNATURE)) { -#if EFI_INTERNAL_FLASH || defined(__DOXYGEN__) +#if EFI_INTERNAL_FLASH writeToFlashIfPending(); #endif /* EFI_INTERNAL_FLASH */ resetAccel(); @@ -331,7 +331,7 @@ void initPeriodicEvents(DECLARE_ENGINE_PARAMETER_SIGNATURE) { } char * getPinNameByAdcChannel(const char *msg, adc_channel_e hwChannel, char *buffer) { -#if HAL_USE_ADC || defined(__DOXYGEN__) +#if HAL_USE_ADC if (hwChannel == EFI_ADC_NONE) { strcpy(buffer, "NONE"); } else { @@ -346,13 +346,13 @@ char * getPinNameByAdcChannel(const char *msg, adc_channel_e hwChannel, char *bu static char pinNameBuffer[16]; -#if HAL_USE_ADC || defined(__DOXYGEN__) +#if HAL_USE_ADC extern AdcDevice fastAdc; #endif static void printAnalogChannelInfoExt(const char *name, adc_channel_e hwChannel, float adcVoltage, float dividerCoeff) { -#if HAL_USE_ADC || defined(__DOXYGEN__) +#if HAL_USE_ADC if (hwChannel == EFI_ADC_NONE) { scheduleMsg(&logger, "ADC is not assigned for %s", name); return; @@ -369,7 +369,7 @@ static void printAnalogChannelInfoExt(const char *name, adc_channel_e hwChannel, } static void printAnalogChannelInfo(const char *name, adc_channel_e hwChannel) { -#if HAL_USE_ADC || defined(__DOXYGEN__) +#if HAL_USE_ADC printAnalogChannelInfoExt(name, hwChannel, getVoltage("print", hwChannel), engineConfiguration->analogInputDividerCoefficient); #endif } @@ -594,11 +594,11 @@ void setMockVBattVoltage(float voltage) { } static void initMockVoltage(void) { -#if EFI_SIMULATOR || defined(__DOXYGEN__) +#if EFI_SIMULATOR setMockCltVoltage(2); #endif /* EFI_SIMULATOR */ -#if EFI_SIMULATOR || defined(__DOXYGEN__) +#if EFI_SIMULATOR setMockIatVoltage(2); #endif /* EFI_SIMULATOR */ @@ -638,16 +638,16 @@ void commonInitEngineController(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_S initMockVoltage(); #endif /* EFI_ENABLE_MOCK_ADC */ -#if EFI_SENSOR_CHART || defined(__DOXYGEN__) +#if EFI_SENSOR_CHART initSensorChart(); #endif /* EFI_SENSOR_CHART */ -#if EFI_PROD_CODE || EFI_SIMULATOR || defined(__DOXYGEN__) +#if EFI_PROD_CODE || EFI_SIMULATOR // todo: this is a mess, remove code duplication with simulator initSettings(); #endif -#if EFI_TUNER_STUDIO || defined(__DOXYGEN__) +#if EFI_TUNER_STUDIO if (engineConfiguration->isTunerStudioEnabled) { startTunerStudioConnectivity(); } @@ -658,7 +658,7 @@ void commonInitEngineController(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_S } initSensors(sharedLogger PASS_ENGINE_PARAMETER_SIGNATURE); -#if EFI_FSIO || defined(__DOXYGEN__) +#if EFI_FSIO initFsioImpl(sharedLogger PASS_ENGINE_PARAMETER_SUFFIX); #endif @@ -675,19 +675,19 @@ void initEngineContoller(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) -#if EFI_PROD_CODE || defined(__DOXYGEN__) +#if EFI_PROD_CODE initPwmGenerator(); #endif initAlgo(sharedLogger); -#if EFI_WAVE_ANALYZER || defined(__DOXYGEN__) +#if EFI_WAVE_ANALYZER if (engineConfiguration->isWaveAnalyzerEnabled) { initWaveAnalyzer(sharedLogger); } #endif /* EFI_WAVE_ANALYZER */ -#if EFI_CJ125 || defined(__DOXYGEN__) +#if EFI_CJ125 /** * this uses SimplePwm which depends on scheduler, has to be initialized after scheduler */ @@ -695,7 +695,7 @@ void initEngineContoller(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) #endif /* EFI_CJ125 */ -#if EFI_SHAFT_POSITION_INPUT || defined(__DOXYGEN__) +#if EFI_SHAFT_POSITION_INPUT /** * there is an implicit dependency on the fact that 'tachometer' listener is the 1st listener - this case * other listeners can access current RPM value @@ -703,7 +703,7 @@ void initEngineContoller(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) initRpmCalculator(sharedLogger PASS_ENGINE_PARAMETER_SUFFIX); #endif /* EFI_SHAFT_POSITION_INPUT */ -#if (EFI_PROD_CODE && EFI_ENGINE_CONTROL) || defined(__DOXYGEN__) +#if EFI_PROD_CODE && EFI_ENGINE_CONTROL initInjectorCentral(sharedLogger); #endif /* EFI_PROD_CODE && EFI_ENGINE_CONTROL */ @@ -717,7 +717,7 @@ void initEngineContoller(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) chThdCreateStatic(csThreadStack, sizeof(csThreadStack), LOWPRIO, (tfunc_t)(void*) csThread, NULL); -#if (EFI_PROD_CODE && EFI_ENGINE_CONTROL) || defined(__DOXYGEN__) +#if EFI_PROD_CODE && EFI_ENGINE_CONTROL /** * This has to go after 'initInjectorCentral' and 'initInjectorCentral' in order to * properly detect un-assigned output pins @@ -725,29 +725,29 @@ void initEngineContoller(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) prepareShapes(PASS_ENGINE_PARAMETER_SIGNATURE); #endif /* EFI_PROD_CODE && EFI_ENGINE_CONTROL */ -#if EFI_PWM_TESTER || defined(__DOXYGEN__) +#if EFI_PWM_TESTER initPwmTester(); #endif /* EFI_PWM_TESTER */ initMalfunctionCentral(); -#if EFI_ALTERNATOR_CONTROL || defined(__DOXYGEN__) +#if EFI_ALTERNATOR_CONTROL initAlternatorCtrl(sharedLogger); #endif -#if EFI_AUX_PID || defined(__DOXYGEN__) +#if EFI_AUX_PID initAuxPid(sharedLogger); #endif -#if EFI_ELECTRONIC_THROTTLE_BODY || defined(__DOXYGEN__) +#if EFI_ELECTRONIC_THROTTLE_BODY initElectronicThrottle(); #endif /* EFI_ELECTRONIC_THROTTLE_BODY */ -#if EFI_MALFUNCTION_INDICATOR || defined(__DOXYGEN__) +#if EFI_MALFUNCTION_INDICATOR initMalfunctionIndicator(); #endif /* EFI_MALFUNCTION_INDICATOR */ -#if EFI_MAP_AVERAGING || defined(__DOXYGEN__) +#if EFI_MAP_AVERAGING if (engineConfiguration->isMapAveragingEnabled) { initMapAveraging(sharedLogger, engine); } @@ -755,7 +755,7 @@ void initEngineContoller(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) initEgoAveraging(PASS_ENGINE_PARAMETER_SIGNATURE); -#if (EFI_ENGINE_CONTROL && EFI_SHAFT_POSITION_INPUT) || defined(__DOXYGEN__) +#if EFI_ENGINE_CONTROL && EFI_SHAFT_POSITION_INPUT if (CONFIGB(isEngineControlEnabled)) { /** * This method initialized the main listener which actually runs injectors & ignition @@ -764,7 +764,7 @@ void initEngineContoller(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) } #endif /* EFI_ENGINE_CONTROL */ -#if EFI_IDLE_CONTROL || defined(__DOXYGEN__) +#if EFI_IDLE_CONTROL startIdleThread(sharedLogger); #endif /* EFI_IDLE_CONTROL */ @@ -772,15 +772,15 @@ void initEngineContoller(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) addConsoleAction("knockinfo", getKnockInfo); } -#if EFI_PROD_CODE || defined(__DOXYGEN__) +#if EFI_PROD_CODE addConsoleAction("reset_accel", resetAccel); #endif /* EFI_PROD_CODE */ -#if EFI_HD44780_LCD || defined(__DOXYGEN__) +#if EFI_HD44780_LCD initLcdController(); #endif /* EFI_HD44780_LCD */ -#if EFI_PROD_CODE || defined(__DOXYGEN__) +#if EFI_PROD_CODE initTachometer(); #endif /* EFI_PROD_CODE */ } @@ -805,7 +805,7 @@ int getRusEfiVersion(void) { return 123; // this is here to make the compiler happy about the unused array if (UNUSED_CCM_SIZE[0] * 0 != 0) return 3211; // this is here to make the compiler happy about the unused array -#if defined(EFI_BOOTLOADER_INCLUDE_CODE) || defined(__DOXYGEN__) +#if defined(EFI_BOOTLOADER_INCLUDE_CODE) // make bootloader code happy too if (initBootloader() != 0) return 123; diff --git a/firmware/controllers/flash_main.cpp b/firmware/controllers/flash_main.cpp index bf65f3eb84..a97766e122 100644 --- a/firmware/controllers/flash_main.cpp +++ b/firmware/controllers/flash_main.cpp @@ -8,7 +8,7 @@ */ #include "global.h" -#if EFI_INTERNAL_FLASH || defined(__DOXYGEN__) +#if EFI_INTERNAL_FLASH #include "flash_main.h" #include "eficonsole.h" #include "flash.h" @@ -17,7 +17,7 @@ // this message is part of console API, see FLASH_SUCCESS_MSG in java code #define FLASH_SUCCESS_MSG "FLASH_SUCESS" -#if EFI_TUNER_STUDIO || defined(__DOXYGEN__) +#if EFI_TUNER_STUDIO #include "tunerstudio.h" #endif @@ -188,7 +188,7 @@ void initFlash(Logging *sharedLogger) { * This would write NOW (you should not be doing this while connected to real engine) */ addConsoleAction("writeconfig", writeConfigCommand); -#if EFI_TUNER_STUDIO || defined(__DOXYGEN__) +#if EFI_TUNER_STUDIO /** * This would schedule write to flash once the engine is stopped */ diff --git a/firmware/controllers/injector_central.cpp b/firmware/controllers/injector_central.cpp index 81378f5475..73117958f1 100644 --- a/firmware/controllers/injector_central.cpp +++ b/firmware/controllers/injector_central.cpp @@ -23,7 +23,7 @@ // todo: rename this file #include "global.h" -#if EFI_ENGINE_CONTROL || defined(__DOXYGEN__) +#if EFI_ENGINE_CONTROL #if !EFI_UNIT_TEST #include "injector_central.h" @@ -237,7 +237,7 @@ static BenchController instance; void OutputPin::unregisterOutput(brain_pin_e oldPin, brain_pin_e newPin) { if (oldPin != GPIO_UNASSIGNED && oldPin != newPin) { scheduleMsg(logger, "unregistering %s", hwPortname(oldPin)); -#if EFI_GPIO_HARDWARE || defined(__DOXYGEN__) +#if EFI_GPIO_HARDWARE brain_pin_markUnused(oldPin); port = NULL; #endif /* EFI_GPIO_HARDWARE */ @@ -261,7 +261,7 @@ void executeTSCommand(uint16_t subsystem, uint16_t index) { milBench(); } else if (subsystem == 0x17) { // cmd_test_idle_valve -#if EFI_IDLE_CONTROL || defined(__DOXYGEN__) +#if EFI_IDLE_CONTROL startIdleBench(); #endif } else if (subsystem == 0x20 && index == 0x3456) { diff --git a/firmware/controllers/map_averaging.cpp b/firmware/controllers/map_averaging.cpp index fee34496b4..f25c6c4e87 100644 --- a/firmware/controllers/map_averaging.cpp +++ b/firmware/controllers/map_averaging.cpp @@ -25,7 +25,7 @@ #include "map.h" -#if EFI_MAP_AVERAGING || defined(__DOXYGEN__) +#if EFI_MAP_AVERAGING #include "map_averaging.h" #include "trigger_central.h" @@ -37,7 +37,7 @@ #include "engine.h" #include "engine_math.h" -#if EFI_SENSOR_CHART || defined(__DOXYGEN__) +#if EFI_SENSOR_CHART #include "sensor_chart.h" #endif /* EFI_SENSOR_CHART */ @@ -122,7 +122,7 @@ static void startAveraging(void *arg) { mapAveragingPin.setHigh(); } -#if HAL_USE_ADC || defined(__DOXYGEN__) +#if HAL_USE_ADC /** * This method is invoked from ADC callback. * @note This method is invoked OFTEN, this method is a potential bottle-next - the implementation should be @@ -137,7 +137,7 @@ void mapAveragingAdcCallback(adcsample_t adcValue) { measurementsPerRevolutionCounter++; efiAssertVoid(CUSTOM_ERR_6650, getCurrentRemainingStack() > 128, "lowstck#9a"); -#if (EFI_SENSOR_CHART && EFI_ANALOG_SENSORS) || defined(__DOXYGEN__) +#if EFI_SENSOR_CHART && EFI_ANALOG_SENSORS if (ENGINE(sensorChartMode) == SC_MAP) { if (measurementsPerRevolutionCounter % FAST_MAP_CHART_SKIP_FACTOR == 0) { @@ -179,7 +179,7 @@ static void endAveraging(void *arg) { bool wasLocked = lockAnyContext(); isAveraging = false; // with locking we would have a consistent state -#if HAL_USE_ADC || defined(__DOXYGEN__) +#if HAL_USE_ADC if (mapMeasurementsCounter > 0) { v_averagedMapValue = adcToVoltsDivided(mapAdcAccumulator / mapMeasurementsCounter); // todo: move out of locked context? @@ -215,7 +215,7 @@ static void applyMapMinBufferLength() { } void postMapState(TunerStudioOutputChannels *tsOutputChannels) { -#if EFI_TUNER_STUDIO || defined(__DOXYGEN__) +#if EFI_TUNER_STUDIO tsOutputChannels->debugFloatField1 = v_averagedMapValue; tsOutputChannels->debugFloatField2 = engine->engineState.mapAveragingDuration; tsOutputChannels->debugFloatField3 = currentPressure; @@ -255,7 +255,7 @@ void refreshMapAveragingPreCalc(DECLARE_ENGINE_PARAMETER_SIGNATURE) { */ static void mapAveragingTriggerCallback(trigger_event_e ckpEventType, uint32_t index DECLARE_ENGINE_PARAMETER_SUFFIX) { -#if EFI_ENGINE_CONTROL || defined(__DOXYGEN__) +#if EFI_ENGINE_CONTROL // this callback is invoked on interrupt thread UNUSED(ckpEventType); if (index != CONFIG(mapAveragingSchedulingAtIndex)) @@ -312,7 +312,7 @@ static void showMapStats(void) { scheduleMsg(logger, "per revolution %d", measurementsPerRevolution); } -#if EFI_PROD_CODE || defined(__DOXYGEN__) +#if EFI_PROD_CODE /** * Because of MAP window averaging, MAP is only available while engine is spinning @@ -323,7 +323,7 @@ float getMap(void) { return getRawMap(); } -#if EFI_ANALOG_SENSORS || defined(__DOXYGEN__) +#if EFI_ANALOG_SENSORS if (!isValidRpm(GET_RPM_VALUE) || currentPressure == NO_VALUE_YET) return validateMap(getRawMap()); // maybe return NaN in case of stopped engine? return validateMap(currentPressure); @@ -341,7 +341,7 @@ void initMapAveraging(Logging *sharedLogger, Engine *engine) { // endTimer[0].name = "map end0"; // endTimer[1].name = "map end1"; -#if EFI_SHAFT_POSITION_INPUT || defined(__DOXYGEN__) +#if EFI_SHAFT_POSITION_INPUT addTriggerEventListener(&mapAveragingTriggerCallback, "MAP averaging", engine); #endif /* EFI_SHAFT_POSITION_INPUT */ addConsoleAction("faststat", showMapStats); @@ -350,10 +350,10 @@ void initMapAveraging(Logging *sharedLogger, Engine *engine) { #else -#if EFI_PROD_CODE || defined(__DOXYGEN__) +#if EFI_PROD_CODE float getMap(void) { -#if EFI_ANALOG_SENSORS || defined(__DOXYGEN__) +#if EFI_ANALOG_SENSORS return getRawMap(); #else return NAN; diff --git a/firmware/controllers/map_averaging.h b/firmware/controllers/map_averaging.h index e8030bb3ad..08274f6296 100644 --- a/firmware/controllers/map_averaging.h +++ b/firmware/controllers/map_averaging.h @@ -10,9 +10,9 @@ #include "engine.h" -#if EFI_MAP_AVERAGING || defined(__DOXYGEN__) +#if EFI_MAP_AVERAGING -#if HAL_USE_ADC || defined(__DOXYGEN__) +#if HAL_USE_ADC void mapAveragingAdcCallback(adcsample_t newValue); #endif diff --git a/firmware/controllers/math/efitime.h b/firmware/controllers/math/efitime.h index 2d77269555..3e599f705f 100644 --- a/firmware/controllers/math/efitime.h +++ b/firmware/controllers/math/efitime.h @@ -59,7 +59,7 @@ efitimesec_t getTimeNowSeconds(void); } #endif /* __cplusplus */ -#if (EFI_PROD_CODE || EFI_SIMULATOR) +#if EFI_PROD_CODE || EFI_SIMULATOR #define GET_TIMESTAMP() port_rt_get_counter_value() #else #define GET_TIMESTAMP() 0 diff --git a/firmware/controllers/math/engine_math.cpp b/firmware/controllers/math/engine_math.cpp index c27ac6d160..cde515e4b4 100644 --- a/firmware/controllers/math/engine_math.cpp +++ b/firmware/controllers/math/engine_math.cpp @@ -92,7 +92,7 @@ void setSingleCoilDwell(engine_configuration_s *engineConfiguration) { engineConfiguration->sparkDwellValues[7] = 0; } -#if EFI_ENGINE_CONTROL || defined(__DOXYGEN__) +#if EFI_ENGINE_CONTROL FuelSchedule::FuelSchedule() { clear(); @@ -189,7 +189,7 @@ bool FuelSchedule::addFuelEventsForCylinder(int i DECLARE_ENGINE_PARAMETER_SUFF InjectionEvent *ev = &elements[i]; ev->ownIndex = i; -#if EFI_UNIT_TEST || defined(__DOXYGEN__) +#if EFI_UNIT_TEST ev->engine = engine; #endif fixAngle(angle, "addFuel#1", CUSTOM_ERR_6554); @@ -207,7 +207,7 @@ bool FuelSchedule::addFuelEventsForCylinder(int i DECLARE_ENGINE_PARAMETER_SUFF efiAssert(CUSTOM_ERR_ASSERT, !cisnan(angle), "findAngle#3", false); assertAngleRange(angle, "findAngle#a33", CUSTOM_ERR_6544); TRIGGER_SHAPE(findTriggerPosition(&ev->injectionStart, angle PASS_CONFIG_PARAM(engineConfiguration->globalTriggerAngleOffset))); -#if EFI_UNIT_TEST || defined(__DOXYGEN__) +#if EFI_UNIT_TEST printf("registerInjectionEvent angle=%.2f trgIndex=%d inj %d\r\n", angle, ev->injectionStart.eventIndex, injectorIndex); #endif return true; @@ -242,7 +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__) +#if EFI_ENGINE_CONTROL && EFI_SHAFT_POSITION_INPUT float dwellMs; if (ENGINE(rpmCalculator).isCranking(PASS_ENGINE_PARAMETER_SIGNATURE)) { dwellMs = getCrankingSparkDwell(PASS_ENGINE_PARAMETER_SIGNATURE); @@ -442,7 +442,7 @@ static int getIgnitionPinForIndex(int i DECLARE_ENGINE_PARAMETER_SUFFIX) { void prepareIgnitionPinIndices(ignition_mode_e ignitionMode DECLARE_ENGINE_PARAMETER_SUFFIX) { if (ignitionMode != engine->ignitionModeForPinIndices) { -#if EFI_ENGINE_CONTROL || defined(__DOXYGEN__) +#if EFI_ENGINE_CONTROL for (int i = 0; i < CONFIG(specs.cylindersCount); i++) { ENGINE(ignitionPin[i]) = getIgnitionPinForIndex(i PASS_ENGINE_PARAMETER_SUFFIX); } @@ -457,7 +457,7 @@ 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__) +#if EFI_SHAFT_POSITION_INPUT // 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; @@ -465,7 +465,7 @@ ignition_mode_e getCurrentIgnitionMode(DECLARE_ENGINE_PARAMETER_SIGNATURE) { return ignitionMode; } -#if EFI_ENGINE_CONTROL || defined(__DOXYGEN__) +#if EFI_ENGINE_CONTROL /** * This heavy method is only invoked in case of a configuration change or initialization. diff --git a/firmware/controllers/math/speed_density.cpp b/firmware/controllers/math/speed_density.cpp index e70e1b830e..8f76ca7046 100644 --- a/firmware/controllers/math/speed_density.cpp +++ b/firmware/controllers/math/speed_density.cpp @@ -135,7 +135,7 @@ floatms_t getSpeedDensityFuel(float map DECLARE_GLOBAL_SUFFIX) { warning(CUSTOM_ERR_6685, "NaN airMass"); return 0; } -#if EFI_PRINTF_FUEL_DETAILS || defined(__DOXYGEN__) +#if EFI_PRINTF_FUEL_DETAILS printf("map=%.2f adjustedMap=%.2f airMass=%.2f\t\n", map, adjustedMap, engine->engineState.airMass); #endif /*EFI_PRINTF_FUEL_DETAILS */ diff --git a/firmware/controllers/obd2.cpp b/firmware/controllers/obd2.cpp index c7180a332d..fbab4b9b80 100644 --- a/firmware/controllers/obd2.cpp +++ b/firmware/controllers/obd2.cpp @@ -23,7 +23,7 @@ #include "global.h" -#if EFI_CAN_SUPPORT || defined(__DOXYGEN__) +#if EFI_CAN_SUPPORT #include "engine.h" @@ -192,7 +192,7 @@ static void handleDtcRequest(int numCodes, int *dtcCode) { } } -#if HAL_USE_CAN || defined(__DOXYGEN__) +#if HAL_USE_CAN void obdOnCanPacketRx(CANRxFrame *rx) { if (rx->SID != OBD_TEST_REQUEST) { return; diff --git a/firmware/controllers/obd2.h b/firmware/controllers/obd2.h index 88e2ea5933..bafe66e662 100644 --- a/firmware/controllers/obd2.h +++ b/firmware/controllers/obd2.h @@ -37,7 +37,7 @@ #define PID_SUPPORTED_PIDS_REQUEST_41_60 0x40 #define PID_FUEL_RATE 0x5E -#if HAL_USE_CAN || defined(__DOXYGEN__) +#if HAL_USE_CAN void obdOnCanPacketRx(CANRxFrame *rx); #endif /* HAL_USE_CAN */ diff --git a/firmware/controllers/scheduling/event_queue.cpp b/firmware/controllers/scheduling/event_queue.cpp index da5975e8f0..1d98e25d7f 100644 --- a/firmware/controllers/scheduling/event_queue.cpp +++ b/firmware/controllers/scheduling/event_queue.cpp @@ -39,7 +39,7 @@ bool EventQueue::checkIfPending(scheduling_s *scheduling) { * @return true if inserted into the head of the list */ bool EventQueue::insertTask(scheduling_s *scheduling, efitime_t timeX, schfunc_t callback, void *param) { -#if EFI_UNIT_TEST || defined(__DOXYGEN__) +#if EFI_UNIT_TEST assertListIsSorted(); #endif /* EFI_UNIT_TEST */ efiAssert(CUSTOM_ERR_ASSERT, callback != NULL, "NULL callback", false); @@ -47,7 +47,7 @@ bool EventQueue::insertTask(scheduling_s *scheduling, efitime_t timeX, schfunc_t // please note that simulator does not use this code at all - simulator uses signal_executor_sleep if (scheduling->isScheduled) { -#if EFI_UNIT_TEST || defined(__DOXYGEN__) +#if EFI_UNIT_TEST printf("Already scheduled was %d\r\n", (int)scheduling->momentX); printf("Already scheduled now %d\r\n", (int)timeX); #endif /* EFI_UNIT_TEST */ @@ -62,7 +62,7 @@ bool EventQueue::insertTask(scheduling_s *scheduling, efitime_t timeX, schfunc_t if (head == NULL || timeX < head->momentX) { // here we insert into head of the linked list LL_PREPEND(head, scheduling); -#if EFI_UNIT_TEST || defined(__DOXYGEN__) +#if EFI_UNIT_TEST assertListIsSorted(); #endif /* EFI_UNIT_TEST */ return true; @@ -75,7 +75,7 @@ bool EventQueue::insertTask(scheduling_s *scheduling, efitime_t timeX, schfunc_t scheduling->next = insertPosition->next; insertPosition->next = scheduling; -#if EFI_UNIT_TEST || defined(__DOXYGEN__) +#if EFI_UNIT_TEST assertListIsSorted(); #endif /* EFI_UNIT_TEST */ return false; @@ -154,7 +154,7 @@ int EventQueue::executeAll(efitime_t now) { break; } } -#if EFI_UNIT_TEST || defined(__DOXYGEN__) +#if EFI_UNIT_TEST assertListIsSorted(); #endif @@ -169,7 +169,7 @@ int EventQueue::executeAll(efitime_t now) { current->isScheduled = false; uint32_t howFarOff = now - current->momentX; maxSchedulingPrecisionLoss = maxI(maxSchedulingPrecisionLoss, howFarOff); -#if EFI_UNIT_TEST || defined(__DOXYGEN__) +#if EFI_UNIT_TEST printf("QUEUE: execute current=%d param=%d\r\n", (long)current, (long)current->param); #endif current->callback(current->param); @@ -192,7 +192,7 @@ int EventQueue::size(void) { return result; } -#if EFI_UNIT_TEST || defined(__DOXYGEN__) +#if EFI_UNIT_TEST void EventQueue::assertListIsSorted() { scheduling_s *current = head; while (current != NULL && current->next != NULL) { diff --git a/firmware/controllers/scheduling/scheduler.h b/firmware/controllers/scheduling/scheduler.h index 89416b2d69..9b4148ce54 100644 --- a/firmware/controllers/scheduling/scheduler.h +++ b/firmware/controllers/scheduling/scheduler.h @@ -15,7 +15,7 @@ class scheduling_s { public: scheduling_s(); -#if EFI_SIGNAL_EXECUTOR_SLEEP || defined(__DOXYGEN__) +#if EFI_SIGNAL_EXECUTOR_SLEEP virtual_timer_t timer; #endif /* EFI_SIGNAL_EXECUTOR_SLEEP */ diff --git a/firmware/controllers/scheduling/signal_executor.cpp b/firmware/controllers/scheduling/signal_executor.cpp index cad76986cc..c613454508 100644 --- a/firmware/controllers/scheduling/signal_executor.cpp +++ b/firmware/controllers/scheduling/signal_executor.cpp @@ -34,7 +34,7 @@ EXTERN_ENGINE; -#if EFI_ENGINE_SNIFFER || defined(__DOXYGEN__) +#if EFI_ENGINE_SNIFFER #include "engine_sniffer.h" extern WaveChart waveChart; #endif /* EFI_ENGINE_SNIFFER */ diff --git a/firmware/controllers/scheduling/signal_executor_sleep.cpp b/firmware/controllers/scheduling/signal_executor_sleep.cpp index 35542b687c..7b1dce415e 100644 --- a/firmware/controllers/scheduling/signal_executor_sleep.cpp +++ b/firmware/controllers/scheduling/signal_executor_sleep.cpp @@ -27,19 +27,19 @@ #include "signal_executor.h" #include "main_trigger_callback.h" -#if EFI_SIMULATOR || defined(__DOXYGEN__) +#if EFI_SIMULATOR // this is about debugging #include "efi_gpio.h" #endif /* EFI_SIMULATOR */ -#if EFI_SIGNAL_EXECUTOR_SLEEP || defined(__DOXYGEN__) +#if EFI_SIGNAL_EXECUTOR_SLEEP void SleepExecutor::scheduleByTimestamp(scheduling_s *scheduling, efitimeus_t timeUs, schfunc_t callback, void *param) { scheduleForLater(scheduling, timeUs - getTimeNowUs(), callback, param); } static void timerCallback(scheduling_s *scheduling) { -#if EFI_PRINTF_FUEL_DETAILS || defined(__DOXYGEN__) +#if EFI_PRINTF_FUEL_DETAILS if (scheduling->callback == (schfunc_t)&seTurnPinLow) { printf("executing cb=seTurnPinLow p=%d sch=%d now=%d\r\n", (int)scheduling->param, (int)scheduling, (int)getTimeNowUs()); @@ -73,7 +73,7 @@ static void doScheduleForLater(scheduling_s *scheduling, int delayUs, schfunc_t chVTResetI(&scheduling->timer); } -#if EFI_SIMULATOR || defined(__DOXYGEN__) +#if EFI_SIMULATOR if (callback == (schfunc_t)&seTurnPinLow) { printf("setTime cb=seTurnPinLow p=%d\r\n", (int)param); } else { diff --git a/firmware/controllers/scheduling/single_timer_executor.cpp b/firmware/controllers/scheduling/single_timer_executor.cpp index c8b50d08b4..c898452816 100644 --- a/firmware/controllers/scheduling/single_timer_executor.cpp +++ b/firmware/controllers/scheduling/single_timer_executor.cpp @@ -21,7 +21,7 @@ #include "efitime.h" -#if EFI_SIGNAL_EXECUTOR_ONE_TIMER || defined(__DOXYGEN__) +#if EFI_SIGNAL_EXECUTOR_ONE_TIMER #include "microsecond_timer.h" #include "tunerstudio_configuration.h" #include "rfiutil.h" @@ -161,13 +161,13 @@ void initSingleTimerExecutorHardware(void) { initMicrosecondTimer(); } -#if EFI_TUNER_STUDIO || defined(__DOXYGEN__) +#if EFI_TUNER_STUDIO extern TunerStudioOutputChannels tsOutputChannels; #endif /* EFI_TUNER_STUDIO */ void executorStatistics() { if (engineConfiguration->debugMode == DBG_EXECUTOR) { -#if (EFI_TUNER_STUDIO && EFI_SIGNAL_EXECUTOR_ONE_TIMER) || defined(__DOXYGEN__) +#if EFI_TUNER_STUDIO && EFI_SIGNAL_EXECUTOR_ONE_TIMER tsOutputChannels.debugIntField1 = ___engine.executor.timerCallbackCounter; tsOutputChannels.debugIntField2 = ___engine.executor.doExecuteCounter; tsOutputChannels.debugIntField3 = ___engine.executor.scheduleCounter; diff --git a/firmware/controllers/sensors/ego.cpp b/firmware/controllers/sensors/ego.cpp index 2709426e18..f6f1ae4038 100644 --- a/firmware/controllers/sensors/ego.cpp +++ b/firmware/controllers/sensors/ego.cpp @@ -17,7 +17,7 @@ #include "analog_input.h" #include "cyclic_buffer.h" -#if EFI_CJ125 || defined(__DOXYGEN__) +#if EFI_CJ125 #include "cj125.h" #endif /* EFI_CJ125 */ @@ -95,7 +95,7 @@ void initEgoAveraging(DECLARE_ENGINE_PARAMETER_SIGNATURE) { #endif bool hasAfrSensor(DECLARE_ENGINE_PARAMETER_SIGNATURE) { -#if (EFI_CJ125 && HAL_USE_SPI) || defined(__DOXYGEN__) +#if EFI_CJ125 && HAL_USE_SPI if (CONFIGB(isCJ125Enabled)) { return cjHasAfrSensor(PASS_ENGINE_PARAMETER_SIGNATURE); } @@ -104,7 +104,7 @@ bool hasAfrSensor(DECLARE_ENGINE_PARAMETER_SIGNATURE) { } float getAfr(DECLARE_ENGINE_PARAMETER_SIGNATURE) { -#if (EFI_CJ125 && HAL_USE_SPI) || defined(__DOXYGEN__) +#if EFI_CJ125 && HAL_USE_SPI if (CONFIGB(isCJ125Enabled)) { return cjGetAfr(PASS_ENGINE_PARAMETER_SIGNATURE); } diff --git a/firmware/controllers/sensors/map.cpp b/firmware/controllers/sensors/map.cpp index 062b8ba93d..5cf44ce230 100644 --- a/firmware/controllers/sensors/map.cpp +++ b/firmware/controllers/sensors/map.cpp @@ -13,12 +13,12 @@ #include "map.h" #include "engine_controller.h" -#if EFI_PROD_CODE || defined(__DOXYGEN__) +#if EFI_PROD_CODE #include "digital_input_hw.h" #include "pin_repository.h" #endif -#if EFI_ANALOG_SENSORS || defined(__DOXYGEN__) +#if EFI_ANALOG_SENSORS EXTERN_ENGINE; @@ -129,7 +129,7 @@ float validateBaroMap(float mapKPa DECLARE_ENGINE_PARAMETER_SUFFIX) { * @returns kPa value */ float getMapByVoltage(float voltage DECLARE_ENGINE_PARAMETER_SUFFIX) { -#if EFI_ENABLE_MOCK_ADC || defined(__DOXYGEN__) +#if EFI_ENABLE_MOCK_ADC int mapChannel = engineConfiguration->map.sensor.hwChannel; if (engine->engineState.mockAdcState.hasMockAdc[mapChannel]) voltage = adcToVolts(engine->engineState.mockAdcState.getMockAdcValue(mapChannel) * engineConfiguration->analogInputDividerCoefficient); @@ -212,12 +212,12 @@ static void digitalMapWidthCallback(void) { prevWidthTimeNt = nowNt; } -#if EFI_PROD_CODE || defined(__DOXYGEN__) +#if EFI_PROD_CODE extern int mapMinBufferLength; static void printMAPInfo(void) { -#if EFI_ANALOG_SENSORS || defined(__DOXYGEN__) +#if EFI_ANALOG_SENSORS scheduleMsg(logger, "instant value=%.2fkPa", getRawMap()); @@ -263,7 +263,7 @@ void initMapDecoder(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) { applyConfiguration(PASS_ENGINE_PARAMETER_SIGNATURE); //engine->configurationListeners.registerCallback(applyConfiguration); -#if HAL_USE_ICU || defined(__DOXYGEN__) +#if HAL_USE_ICU if (engineConfiguration->hasFrequencyReportingMapSensor) { digital_input_s* digitalMapInput = addWaveAnalyzerDriver("map freq", CONFIGB(frequencyReportingMapInputPin)); startInputDriver("MAP", digitalMapInput, true); diff --git a/firmware/controllers/sensors/thermistors.cpp b/firmware/controllers/sensors/thermistors.cpp index 0886476317..4455145655 100644 --- a/firmware/controllers/sensors/thermistors.cpp +++ b/firmware/controllers/sensors/thermistors.cpp @@ -148,7 +148,7 @@ void ThermistorMath::prepareThermistorCurve(thermistor_conf_s *tc) { float T1 = tc->tempC_1 + KELV; float T2 = tc->tempC_2 + KELV; float T3 = tc->tempC_3 + KELV; -#if EXTREME_TERM_LOGGING || defined(__DOXYGEN__) +#if EXTREME_TERM_LOGGING scheduleMsg(logger, "T1=%.5f/T2=%.5f/T3=%.5f", T1, T2, T3); #endif @@ -162,7 +162,7 @@ void ThermistorMath::prepareThermistorCurve(thermistor_conf_s *tc) { } float L2 = logf(tc->resistance_2); float L3 = logf(tc->resistance_3); -#if EXTREME_TERM_LOGGING || defined(__DOXYGEN__) +#if EXTREME_TERM_LOGGING scheduleMsg(logger, "R1=%.5f/R2=%.5f/R3=%.5f", tc->resistance_1, tc->resistance_2, tc->resistance_3); scheduleMsg(logger, "L1=%.5f/L2=%.5f/L3=%.5f", L1, L2, L3); @@ -181,7 +181,7 @@ void ThermistorMath::prepareThermistorCurve(thermistor_conf_s *tc) { s_h_b = U2 - s_h_c * (L1 * L1 + L1 * L2 + L2 * L2); s_h_a = Y1 - (s_h_b + L1 * L1 * s_h_c) * L1; -#if EXTREME_TERM_LOGGING || defined(__DOXYGEN__) +#if EXTREME_TERM_LOGGING scheduleMsg(logger, "Y1=%.5f/Y2=%.5f/Y3=%.5f", Y1, Y2, Y3); scheduleMsg(logger, "U2=%.5f/U3=%.5f", U2, U3); scheduleMsg(logger, "s_h_c=%.5f/s_h_b=%.5f/s_h_a=%.5f", curve->s_h_c, curve->s_h_b, @@ -204,7 +204,7 @@ float getIntakeAirTemperature(DECLARE_ENGINE_PARAMETER_SIGNATURE) { engineConfiguration->useLinearIatSensor); if (!isValidIntakeAirTemperature(temperature)) { efiAssert(CUSTOM_ERR_ASSERT, engineConfiguration!=NULL, "NULL engineConfiguration", NAN); -#if EFI_PROD_CODE || EFI_UNIT_TEST || defined(__DOXYGEN__) +#if EFI_PROD_CODE || EFI_UNIT_TEST warning(OBD_Intake_Air_Temperature_Circuit_Malfunction, "unrealistic IAT %.2f", temperature); #endif /* EFI_PROD_CODE */ return LIMPING_MODE_IAT_TEMPERATURE; @@ -232,7 +232,7 @@ void set10K_4050K(ThermistorConf *thermistorConf) { setThermistorConfiguration(thermistorConf, -30, 108000, 25.0, 10000, 130.0, 225); } -#if EFI_PROD_CODE || defined(__DOXYGEN__) +#if EFI_PROD_CODE static void testCltByR(float resistance) { if (logger == NULL) { firmwareError(CUSTOM_ERR_THERM, "thermstr not initialized"); @@ -249,7 +249,7 @@ void initThermistors(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) { logger = sharedLogger; efiAssertVoid(CUSTOM_ERR_6578, engine!=NULL, "e NULL initThermistors"); -#if EFI_PROD_CODE || defined(__DOXYGEN__) +#if EFI_PROD_CODE addConsoleActionF("test_clt_by_r", testCltByR); #endif } diff --git a/firmware/controllers/sensors/tps.cpp b/firmware/controllers/sensors/tps.cpp index a3f6f45f20..e93b71a35c 100644 --- a/firmware/controllers/sensors/tps.cpp +++ b/firmware/controllers/sensors/tps.cpp @@ -79,13 +79,13 @@ percent_t getTpsValue(int adc DECLARE_ENGINE_PARAMETER_SUFFIX) { } float result = interpolateMsg("TPS", TPS_TS_CONVERSION * engineConfiguration->tpsMax, 100, TPS_TS_CONVERSION * engineConfiguration->tpsMin, 0, adc); if (result < engineConfiguration->tpsErrorDetectionTooLow) { -#if EFI_PROD_CODE || defined(__DOXYGEN__) +#if EFI_PROD_CODE // too much noise with simulator warning(OBD_Throttle_Position_Sensor_Circuit_Malfunction, "TPS too low: %.2f", result); #endif /* EFI_PROD_CODE */ } if (result > engineConfiguration->tpsErrorDetectionTooHigh) { -#if EFI_PROD_CODE || defined(__DOXYGEN__) +#if EFI_PROD_CODE // too much noise with simulator warning(OBD_Throttle_Position_Sensor_Range_Performance_Problem, "TPS too high: %.2f", result); #endif /* EFI_PROD_CODE */ diff --git a/firmware/controllers/settings.cpp b/firmware/controllers/settings.cpp index 839d8fd979..39fca155c1 100644 --- a/firmware/controllers/settings.cpp +++ b/firmware/controllers/settings.cpp @@ -28,7 +28,7 @@ #include "alternator_controller.h" #include "trigger_emulator.h" -#if EFI_PROD_CODE || defined(__DOXYGEN__) +#if EFI_PROD_CODE #include "vehicle_speed.h" #include "electronic_throttle.h" #include "rtc_helper.h" @@ -38,17 +38,17 @@ #include "hardware.h" #endif /* EFI_PROD_CODE */ -#if EFI_INTERNAL_FLASH || defined(__DOXYGEN__) +#if EFI_INTERNAL_FLASH #include "flash_main.h" #endif /* EFI_INTERNAL_FLASH */ -#if EFI_ENGINE_SNIFFER || defined(__DOXYGEN__) +#if EFI_ENGINE_SNIFFER #include "engine_sniffer.h" extern int waveChartUsedSize; extern WaveChart waveChart; #endif /* EFI_ENGINE_SNIFFER */ -#if !defined(SETTINGS_LOGGING_BUFFER_SIZE) || defined(__DOXYGEN__) +#if !defined(SETTINGS_LOGGING_BUFFER_SIZE) #define SETTINGS_LOGGING_BUFFER_SIZE 1000 #endif /* SETTINGS_LOGGING_BUFFER_SIZE */ @@ -319,7 +319,7 @@ void setEngineType(int value) { engineConfiguration->engineType = (engine_type_e) value; resetConfigurationExt(&logger, (engine_type_e) value PASS_ENGINE_PARAMETER_SUFFIX); -#if EFI_ENGINE_SNIFFER || defined(__DOXYGEN__) +#if EFI_ENGINE_SNIFFER if (engine->isTestMode) waveChart.reset(); #endif @@ -409,7 +409,7 @@ static void printThermistor(const char *msg, ThermistorConf *config, ThermistorM } static void printTPSInfo(void) { -#if (EFI_PROD_CODE && HAL_USE_ADC) || defined(__DOXYGEN__) +#if EFI_PROD_CODE && HAL_USE_ADC if (!hasTpsSensor()) { scheduleMsg(&logger, "NO TPS SENSOR"); return; @@ -424,7 +424,7 @@ static void printTPSInfo(void) { } static void printTemperatureInfo(void) { -#if EFI_ANALOG_SENSORS || defined(__DOXYGEN__) +#if EFI_ANALOG_SENSORS printThermistor("CLT", &engineConfiguration->clt, &engine->engineState.cltCurve, engineConfiguration->useLinearCltSensor); if (!isValidCoolantTemperature(getCoolantTemperature(PASS_ENGINE_PARAMETER_SIGNATURE))) { @@ -767,7 +767,7 @@ static void setTriggerSimulatorPin(const char *indexStr, const char *pinName) { incrementGlobalConfigurationVersion(PASS_ENGINE_PARAMETER_SIGNATURE); } -#if HAL_USE_ADC || defined(__DOXYGEN__) +#if HAL_USE_ADC static void setAnalogInputPin(const char *sensorStr, const char *pinName) { brain_pin_e pin = parseBrainPin(pinName); if (pin == GPIO_INVALID) { @@ -880,9 +880,9 @@ static void enableOrDisable(const char *param, bool isEnabled) { engineConfiguration->isEngineChartEnabled = isEnabled; } else if (strEqualCaseInsensitive(param, "step1limimter")) { boardConfiguration->enabledStep1Limiter = isEnabled; -#if EFI_PROD_CODE || defined(__DOXYGEN__) +#if EFI_PROD_CODE } else if (strEqualCaseInsensitive(param, "auto_idle")) { -#if EFI_IDLE_CONTROL || defined(__DOXYGEN__) +#if EFI_IDLE_CONTROL setIdleMode(isEnabled ? IM_MANUAL : IM_AUTO); #endif /* EFI_IDLE_CONTROL */ #endif /* EFI_PROD_CODE */ @@ -1007,7 +1007,7 @@ typedef struct { } plain_get_float_s; -#if ! EFI_UNIT_TEST || defined(__DOXYGEN__) +#if ! EFI_UNIT_TEST const plain_get_short_s getS_plain[] = { {"idle_pid_min", (uint16_t *)&engineConfiguration->idleRpmPid.minValue}, {"idle_pid_max", (uint16_t *)&engineConfiguration->idleRpmPid.maxValue}, @@ -1065,7 +1065,7 @@ const plain_get_float_s getF_plain[] = { static void getValue(const char *paramStr) { -#if ! EFI_UNIT_TEST || defined(__DOXYGEN__) +#if ! EFI_UNIT_TEST { const plain_get_integer_s *currentI = &getI_plain[0]; while (currentI < getI_plain + sizeof(getI_plain)/sizeof(getI_plain[0])) { @@ -1093,7 +1093,7 @@ static void getValue(const char *paramStr) { if (strEqualCaseInsensitive(paramStr, "isCJ125Enabled")) { scheduleMsg(&logger, "isCJ125Enabled=%d", boardConfiguration->isCJ125Enabled); -#if EFI_PROD_CODE || defined(__DOXYGEN__) +#if EFI_PROD_CODE } else if (strEqualCaseInsensitive(paramStr, "bor")) { showBor(); #endif /* EFI_PROD_CODE */ @@ -1111,7 +1111,7 @@ static void getValue(const char *paramStr) { scheduleMsg(&logger, "isHip9011Enabled=%d", boardConfiguration->isHip9011Enabled); } -#if EFI_RTC || defined(__DOXYGEN__) +#if EFI_RTC else if (strEqualCaseInsensitive(paramStr, "date")) { printDateTime(); } @@ -1140,7 +1140,7 @@ typedef struct { } command_f_s; const command_f_s commandsF[] = { -#if (EFI_ENGINE_CONTROL && EFI_ENABLE_MOCK_ADC) || defined(__DOXYGEN__) +#if EFI_ENGINE_CONTROL && EFI_ENABLE_MOCK_ADC {"mock_iat_voltage", setMockIatVoltage}, {"mock_pedal_position", setMockPedalPosition}, {"mock_maf_voltage", setMockMafVoltage}, @@ -1172,11 +1172,11 @@ const command_f_s commandsF[] = { {"engine_decel_threshold", setDecelThr}, {"engine_decel_multiplier", setDecelMult}, {"flat_injector_lag", setFlatInjectorLag}, -#if EFI_PROD_CODE || defined(__DOXYGEN__) -#if EFI_VEHICLE_SPEED || defined(__DOXYGEN__) +#if EFI_PROD_CODE +#if EFI_VEHICLE_SPEED {"mock_vehicle_speed", setMockVehicleSpeed}, #endif /* EFI_VEHICLE_SPEED */ -#if EFI_IDLE_CONTROL || defined(__DOXYGEN__) +#if EFI_IDLE_CONTROL {"idle_offset", setIdleOffset}, {"idle_p", setIdlePFactor}, {"idle_i", setIdleIFactor}, @@ -1231,12 +1231,12 @@ const command_i_s commandsI[] = {{"ignition_mode", setIgnitionMode}, {"idle_solenoid_freq", setIdleSolenoidFrequency}, {"tps_accel_len", setTpsAccelLen}, {"engine_load_accel_len", setEngineLoadAccelLen}, -#if EFI_PROD_CODE || defined(__DOXYGEN__) +#if EFI_PROD_CODE {"bor", setBor}, -#if EFI_CAN_SUPPORT || defined(__DOXYGEN__) +#if EFI_CAN_SUPPORT {"can_mode", setCanType}, #endif /* EFI_CAN_SUPPORT */ -#if EFI_IDLE_CONTROL || defined(__DOXYGEN__) +#if EFI_IDLE_CONTROL {"idle_position", setIdleValvePosition}, {"idle_rpm", setTargetIdleRpm}, {"idle_dt", setIdleDT}, @@ -1279,7 +1279,7 @@ static void setValue(const char *paramStr, const char *valueStr) { if (strEqualCaseInsensitive(paramStr, "vsscoeff")) { engineConfiguration->vehicleSpeedCoef = valueF; -#if EFI_ALTERNATOR_CONTROL || defined(__DOXYGEN__) +#if EFI_ALTERNATOR_CONTROL } else if (strEqualCaseInsensitive(paramStr, "alt_t")) { if (valueI > 10) { engineConfiguration->alternatorControl.periodMs = valueI; @@ -1308,7 +1308,7 @@ static void setValue(const char *paramStr, const char *valueStr) { engineConfiguration->tpsMax = valueI; } else if (strEqualCaseInsensitive(paramStr, "tps_min")) { engineConfiguration->tpsMin = valueI; -#if EFI_EMULATE_POSITION_SENSORS || defined(__DOXYGEN__) +#if EFI_EMULATE_POSITION_SENSORS } else if (strEqualCaseInsensitive(paramStr, "rpm")) { setTriggerEmulatorRPM(valueI); #endif /* EFI_EMULATE_POSITION_SENSORS */ @@ -1330,7 +1330,7 @@ static void setValue(const char *paramStr, const char *valueStr) { engineConfiguration->ignitionDwellForCrankingMs = valueF; } else if (strEqualCaseInsensitive(paramStr, "targetvbatt")) { engineConfiguration->targetVBatt = valueF; -#if EFI_RTC || defined(__DOXYGEN__) +#if EFI_RTC } else if (strEqualCaseInsensitive(paramStr, "date")) { // rusEfi console invokes this method with timestamp in local timezone setDateTime(valueStr); @@ -1385,7 +1385,7 @@ void initSettings(void) { addConsoleActionSS("set", setValue); addConsoleActionS("get", getValue); -#if EFI_PROD_CODE || defined(__DOXYGEN__) +#if EFI_PROD_CODE addConsoleActionS("showpin", showPinFunction); addConsoleActionSS("set_injection_pin", setInjectionPin); addConsoleActionSS("set_ignition_pin", setIgnitionPin); @@ -1402,7 +1402,7 @@ void initSettings(void) { addConsoleActionS("set_idle_pin", setIdlePin); addConsoleActionS("set_main_relay_pin", setMainRelayPin); -#if HAL_USE_ADC || defined(__DOXYGEN__) +#if HAL_USE_ADC addConsoleActionSS("set_analog_input_pin", setAnalogInputPin); #endif addConsoleActionSS("set_logic_input_pin", setLogicInputPin); diff --git a/firmware/controllers/system/efi_gpio.cpp b/firmware/controllers/system/efi_gpio.cpp index a4637d8c98..9152f5f90c 100644 --- a/firmware/controllers/system/efi_gpio.cpp +++ b/firmware/controllers/system/efi_gpio.cpp @@ -11,7 +11,7 @@ #include "efi_gpio.h" #include "drivers/gpio/gpio_ext.h" -#if EFI_GPIO_HARDWARE || defined(__DOXYGEN__) +#if EFI_GPIO_HARDWARE #include "pin_repository.h" #include "io_pins.h" #endif /* EFI_GPIO_HARDWARE */ @@ -22,7 +22,7 @@ EXTERN_ENGINE; -#if EFI_ENGINE_SNIFFER || defined(__DOXYGEN__) +#if EFI_ENGINE_SNIFFER #include "engine_sniffer.h" extern WaveChart waveChart; #endif /* EFI_ENGINE_SNIFFER */ @@ -98,7 +98,7 @@ void EnginePins::unregisterPins() { #if EFI_ELECTRONIC_THROTTLE_BODY unregisterEtbPins(); #endif /* EFI_ELECTRONIC_THROTTLE_BODY */ -#if EFI_PROD_CODE || defined(__DOXYGEN__) +#if EFI_PROD_CODE fuelPumpRelay.unregisterOutput(activeConfiguration.bc.fuelPumpPin, engineConfiguration->bc.fuelPumpPin); fanRelay.unregisterOutput(activeConfiguration.bc.fanPin, engineConfiguration->bc.fanPin); hipCs.unregisterOutput(activeConfiguration.bc.hip9011CsPin, engineConfiguration->bc.hip9011CsPin); @@ -143,7 +143,7 @@ void EnginePins::reset() { } void EnginePins::stopIgnitionPins(void) { -#if EFI_PROD_CODE || defined(__DOXYGEN__) +#if EFI_PROD_CODE for (int i = 0; i < IGNITION_PIN_COUNT; i++) { NamedOutputPin *output = &enginePins.coils[i]; output->unregisterOutput(activeConfiguration.bc.ignitionPins[i], @@ -153,7 +153,7 @@ void EnginePins::stopIgnitionPins(void) { } void EnginePins::stopInjectionPins(void) { -#if EFI_PROD_CODE || defined(__DOXYGEN__) +#if EFI_PROD_CODE for (int i = 0; i < INJECTION_PIN_COUNT; i++) { NamedOutputPin *output = &enginePins.injectors[i]; output->unregisterOutput(activeConfiguration.bc.injectionPins[i], @@ -163,7 +163,7 @@ void EnginePins::stopInjectionPins(void) { } void EnginePins::startAuxValves(void) { -#if EFI_PROD_CODE || defined(__DOXYGEN__) +#if EFI_PROD_CODE for (int i = 0; i < AUX_DIGITAL_VALVE_COUNT; i++) { NamedOutputPin *output = &enginePins.auxValve[i]; output->initPin(output->name, engineConfiguration->auxValves[i]); @@ -172,7 +172,7 @@ void EnginePins::startAuxValves(void) { } void EnginePins::startIgnitionPins(void) { -#if EFI_PROD_CODE || defined(__DOXYGEN__) +#if EFI_PROD_CODE for (int i = 0; i < engineConfiguration->specs.cylindersCount; i++) { NamedOutputPin *output = &enginePins.coils[i]; // todo: we need to check if mode has changed @@ -191,7 +191,7 @@ void EnginePins::startIgnitionPins(void) { } void EnginePins::startInjectionPins(void) { -#if EFI_PROD_CODE || defined(__DOXYGEN__) +#if EFI_PROD_CODE // todo: should we move this code closer to the injection logic? for (int i = 0; i < engineConfiguration->specs.cylindersCount; i++) { NamedOutputPin *output = &enginePins.injectors[i]; @@ -214,14 +214,14 @@ NamedOutputPin::NamedOutputPin(const char *name) : OutputPin() { } void NamedOutputPin::setHigh() { -#if EFI_DEFAILED_LOGGING || defined(__DOXYGEN__) +#if EFI_DEFAILED_LOGGING // signal->hi_time = hTimeNow(); #endif /* EFI_DEFAILED_LOGGING */ // turn the output level ACTIVE setValue(true); -#if EFI_ENGINE_SNIFFER || defined(__DOXYGEN__) +#if EFI_ENGINE_SNIFFER addEngineSnifferEvent(name, WC_UP); #endif /* EFI_ENGINE_SNIFFER */ @@ -231,13 +231,13 @@ void NamedOutputPin::setLow() { // turn off the output setValue(false); -#if EFI_DEFAILED_LOGGING || defined(__DOXYGEN__) +#if EFI_DEFAILED_LOGGING // systime_t after = getTimeNowUs(); // debugInt(&signal->logging, "a_time", after - signal->hi_time); // scheduleLogging(&signal->logging); #endif /* EFI_DEFAILED_LOGGING */ -#if EFI_ENGINE_SNIFFER || defined(__DOXYGEN__) +#if EFI_ENGINE_SNIFFER addEngineSnifferEvent(name, WC_DOWN); #endif /* EFI_ENGINE_SNIFFER */ } @@ -248,7 +248,7 @@ InjectorOutputPin::InjectorOutputPin() : NamedOutputPin() { } bool NamedOutputPin::stop() { -#if EFI_GPIO_HARDWARE || defined(__DOXYGEN__) +#if EFI_GPIO_HARDWARE if (isInitialized() && getLogicValue()) { setValue(false); scheduleMsg(&sharedLogger, "turning off %s", name); @@ -277,7 +277,7 @@ void IgnitionOutputPin::reset() { OutputPin::OutputPin() { modePtr = &DEFAULT_OUTPUT; -#if EFI_GPIO_HARDWARE || defined(__DOXYGEN__) +#if EFI_GPIO_HARDWARE port = NULL; pin = 0; #endif /* EFI_GPIO_HARDWARE */ @@ -285,7 +285,7 @@ OutputPin::OutputPin() { } bool OutputPin::isInitialized() { -#if EFI_GPIO_HARDWARE || defined(__DOXYGEN__) +#if EFI_GPIO_HARDWARE return port != NULL; #else /* EFI_GPIO_HARDWARE */ return true; @@ -337,7 +337,7 @@ void OutputPin::setDefaultPinState(const pin_output_mode_e *outputMode) { } void initOutputPins(void) { -#if EFI_GPIO_HARDWARE || defined(__DOXYGEN__) +#if EFI_GPIO_HARDWARE /** * want to make sure it's all zeros so that we can compare in initOutputPinExt() method */ @@ -345,7 +345,7 @@ void initOutputPins(void) { // todo: fix this? // memset(&outputs, 0, sizeof(outputs)); -#if HAL_USE_SPI || defined(__DOXYGEN__) +#if HAL_USE_SPI enginePins.sdCsPin.initPin("spi CS5", CONFIGB(sdCardCsPin)); #endif /* HAL_USE_SPI */ @@ -394,7 +394,7 @@ void OutputPin::initPin(const char *msg, brain_pin_e brainPin) { } void OutputPin::initPin(const char *msg, brain_pin_e brainPin, const pin_output_mode_e *outputMode) { -#if EFI_GPIO_HARDWARE || defined(__DOXYGEN__) +#if EFI_GPIO_HARDWARE if (brainPin == GPIO_UNASSIGNED) return; @@ -448,7 +448,7 @@ void OutputPin::initPin(const char *msg, brain_pin_e brainPin, const pin_output_ #endif /* EFI_GPIO_HARDWARE */ } -#if EFI_GPIO_HARDWARE || defined(__DOXYGEN__) +#if EFI_GPIO_HARDWARE void initPrimaryPins(void) { enginePins.errorLedPin.initPin("led: ERROR status", LED_ERROR_BRAIN_PIN); diff --git a/firmware/controllers/system/efi_gpio.h b/firmware/controllers/system/efi_gpio.h index c6c282fe0d..d9f38eddc6 100644 --- a/firmware/controllers/system/efi_gpio.h +++ b/firmware/controllers/system/efi_gpio.h @@ -15,7 +15,7 @@ void initPrimaryPins(void); void initOutputPins(void); -#if EFI_GPIO_HARDWARE || defined(__DOXYGEN__) +#if EFI_GPIO_HARDWARE void turnAllPinsOff(void); #else /* EFI_GPIO_HARDWARE */ #define turnAllPinsOff() {} @@ -48,7 +48,7 @@ public: bool getLogicValue(); -#if EFI_GPIO_HARDWARE || defined(__DOXYGEN__) +#if EFI_GPIO_HARDWARE ioportid_t port; uint8_t pin; #if (BOARD_EXT_GPIOCHIPS > 0) @@ -167,7 +167,7 @@ public: #define getElectricalValue(logicalValue, mode) \ (logicalValue ? getElectricalValue1(mode) : getElectricalValue0(mode)) -#if EFI_GPIO_HARDWARE || defined(__DOXYGEN__) +#if EFI_GPIO_HARDWARE EXTERNC ioportmask_t getHwPin(const char *msg, brain_pin_e brainPin); EXTERNC ioportid_t getHwPort(const char *msg, brain_pin_e brainPin); diff --git a/firmware/controllers/trigger/aux_valves.cpp b/firmware/controllers/trigger/aux_valves.cpp index 306cfff51c..fecd2a00a2 100644 --- a/firmware/controllers/trigger/aux_valves.cpp +++ b/firmware/controllers/trigger/aux_valves.cpp @@ -37,7 +37,7 @@ static void turnOff(NamedOutputPin *output) { static void auxValveTriggerCallback(trigger_event_e ckpSignalType, uint32_t index DECLARE_ENGINE_PARAMETER_SUFFIX) { UNUSED(ckpSignalType); -#if EFI_PROD_CODE || EFI_SIMULATOR || defined(__DOXYGEN__) +#if EFI_PROD_CODE || EFI_SIMULATOR if (index != SCHEDULING_TRIGGER_INDEX) { return; } @@ -81,7 +81,7 @@ static void auxValveTriggerCallback(trigger_event_e ckpSignalType, void initAuxValves(Logging *sharedLogger) { UNUSED(sharedLogger); -#if EFI_PROD_CODE || EFI_SIMULATOR || defined(__DOXYGEN__) +#if EFI_PROD_CODE || EFI_SIMULATOR if (engineConfiguration->auxValves[0] == GPIO_UNASSIGNED) { return; } diff --git a/firmware/controllers/trigger/decoders/trigger_structure.cpp b/firmware/controllers/trigger/decoders/trigger_structure.cpp index b9142f2107..5e0c8f83eb 100644 --- a/firmware/controllers/trigger/decoders/trigger_structure.cpp +++ b/firmware/controllers/trigger/decoders/trigger_structure.cpp @@ -36,7 +36,7 @@ #include "trigger_vw.h" #include "trigger_universal.h" -#if EFI_SENSOR_CHART || defined(__DOXYGEN__) +#if EFI_SENSOR_CHART #include "sensor_chart.h" #endif /* EFI_SENSOR_CHART */ @@ -89,7 +89,7 @@ void TriggerShape::initialize(operation_mode_e operationMode, bool needSecondTri previousAngle = 0; memset(riseOnlyIndexes, 0, sizeof(riseOnlyIndexes)); memset(isRiseEvent, 0, sizeof(isRiseEvent)); -#if EFI_UNIT_TEST || defined(__DOXYGEN__) +#if EFI_UNIT_TEST memset(&triggerSignals, 0, sizeof(triggerSignals)); #endif } @@ -158,7 +158,7 @@ operation_mode_e TriggerShape::getOperationMode() { return operationMode; } -#if EFI_UNIT_TEST || defined(__DOXYGEN__) +#if EFI_UNIT_TEST extern bool printTriggerDebug; #endif @@ -180,7 +180,7 @@ void TriggerShape::addEvent(angle_t angle, trigger_wheel_e const channelIndex, t efiAssertVoid(CUSTOM_ERR_6598, channelIndex!= T_SECONDARY || needSecondTriggerInput, "secondary needed or not?"); -#if EFI_UNIT_TEST || defined(__DOXYGEN__) +#if EFI_UNIT_TEST if (printTriggerDebug) { printf("addEvent2 %.2f i=%d r/f=%d\r\n", angle, channelIndex, stateParam); } @@ -193,7 +193,7 @@ void TriggerShape::addEvent(angle_t angle, trigger_wheel_e const channelIndex, t state = stateParam; } -#if EFI_UNIT_TEST || defined(__DOXYGEN__) +#if EFI_UNIT_TEST int signal = channelIndex * 1000 + stateParam; triggerSignals[privateTriggerDefinitionSize] = signal; #endif @@ -278,7 +278,7 @@ angle_t TriggerShape::getSwitchAngle(int index) const { void setToothedWheelConfiguration(TriggerShape *s, int total, int skipped, operation_mode_e operationMode) { -#if EFI_ENGINE_CONTROL || defined(__DOXYGEN__) +#if EFI_ENGINE_CONTROL s->useRiseEdge = true; @@ -300,7 +300,7 @@ void TriggerShape::setTriggerSynchronizationGap3(int gapIndex, float syncRatioFr this->syncRatioAvg = (int)efiRound((syncRatioFrom + syncRatioTo) * 0.5f, 1.0f); } -#if EFI_UNIT_TEST || defined(__DOXYGEN__) +#if EFI_UNIT_TEST if (printTriggerDebug) { printf("setTriggerSynchronizationGap3 %d %.2f %.2f\r\n", gapIndex, syncRatioFrom, syncRatioTo); } @@ -368,7 +368,7 @@ void TriggerShape::findTriggerPosition(event_trigger_position_s *position, } void TriggerShape::prepareShape() { -#if (EFI_ENGINE_CONTROL && EFI_SHAFT_POSITION_INPUT) || defined(__DOXYGEN__) +#if EFI_ENGINE_CONTROL && EFI_SHAFT_POSITION_INPUT int engineCycleInt = (int) getEngineCycle(operationMode); for (int angle = 0; angle < engineCycleInt; angle++) { int triggerShapeIndex = findAngleIndex(angle); @@ -403,7 +403,7 @@ void TriggerShape::setSecondTriggerSynchronizationGap(float syncRatio) { */ void TriggerShape::initializeTriggerShape(Logging *logger, operation_mode_e operationMode, bool useOnlyRisingEdgeForTrigger, const trigger_config_s *triggerConfig) { -#if EFI_PROD_CODE || defined(__DOXYGEN__) +#if EFI_PROD_CODE efiAssertVoid(CUSTOM_ERR_6641, getCurrentRemainingStack() > 256, "init t"); scheduleMsg(logger, "initializeTriggerShape(%s/%d)", getTrigger_type_e(triggerConfig->type), (int) triggerConfig->type); #endif diff --git a/firmware/controllers/trigger/decoders/trigger_structure.h b/firmware/controllers/trigger/decoders/trigger_structure.h index 0b841636ac..82ef23b9ab 100644 --- a/firmware/controllers/trigger/decoders/trigger_structure.h +++ b/firmware/controllers/trigger/decoders/trigger_structure.h @@ -175,7 +175,7 @@ public: */ uint32_t expectedEventCount[PWM_PHASE_MAX_WAVE_PER_PWM]; -#if EFI_UNIT_TEST || defined(__DOXYGEN__) +#if EFI_UNIT_TEST /** * These signals are used for trigger export only */ diff --git a/firmware/controllers/trigger/main_trigger_callback.cpp b/firmware/controllers/trigger/main_trigger_callback.cpp index a181f145c8..b0fe1084f3 100644 --- a/firmware/controllers/trigger/main_trigger_callback.cpp +++ b/firmware/controllers/trigger/main_trigger_callback.cpp @@ -22,11 +22,11 @@ */ #include "global.h" -#if EFI_PROD_CODE || defined(__DOXYGEN__) +#if EFI_PROD_CODE #include #endif -#if (EFI_ENGINE_CONTROL && EFI_SHAFT_POSITION_INPUT) || defined(__DOXYGEN__) +#if EFI_ENGINE_CONTROL && EFI_SHAFT_POSITION_INPUT #include "main_trigger_callback.h" #include "efi_gpio.h" @@ -45,7 +45,7 @@ #include "histogram.h" #include "engine_controller.h" #include "efi_gpio.h" -#if EFI_PROD_CODE || defined(__DOXYGEN__) +#if EFI_PROD_CODE #include "rfiutil.h" #endif /* EFI_HISTOGRAMS */ #include "local_version_holder.h" @@ -67,7 +67,7 @@ static Logging *logger; #if ! EFI_UNIT_TEST static pid_s *fuelPidS = &persistentState.persistentConfiguration.engineConfiguration.fuelClosedLoopPid; static Pid fuelPid(fuelPidS); -#if EFI_TUNER_STUDIO || defined(__DOXYGEN__) +#if EFI_TUNER_STUDIO extern TunerStudioOutputChannels tsOutputChannels; #endif /* EFI_TUNER_STUDIO */ #endif @@ -92,7 +92,7 @@ static void endSimultaniousInjectionOnlyTogglePins(Engine *engine) { } void endSimultaniousInjection(InjectionEvent *event) { -#if EFI_UNIT_TEST || defined(__DOXYGEN__) +#if EFI_UNIT_TEST Engine *engine = event->engine; EXPAND_Engine; #endif @@ -103,7 +103,7 @@ void endSimultaniousInjection(InjectionEvent *event) { static inline void tempTurnPinHigh(InjectorOutputPin *output) { output->overlappingCounter++; -#if FUEL_MATH_EXTREME_LOGGING || defined(__DOXYGEN__) +#if FUEL_MATH_EXTREME_LOGGING printf("seTurnPinHigh %s %d %d\r\n", output->name, output->overlappingCounter, (int)getTimeNowUs()); #endif /* FUEL_MATH_EXTREME_LOGGING */ @@ -112,11 +112,11 @@ static inline void tempTurnPinHigh(InjectorOutputPin *output) { // * #299 // * this is another kind of overlap which happens in case of a small duty cycle after a large duty cycle // */ -#if FUEL_MATH_EXTREME_LOGGING || defined(__DOXYGEN__) +#if FUEL_MATH_EXTREME_LOGGING printf("overlapping, no need to touch pin %s %d\r\n", output->name, (int)getTimeNowUs()); #endif /* FUEL_MATH_EXTREME_LOGGING */ } else { -#if FUEL_MATH_EXTREME_LOGGING || defined(__DOXYGEN__) +#if FUEL_MATH_EXTREME_LOGGING const char * w = output->currentLogicValue == true ? "err" : ""; // scheduleMsg(&sharedLogger, "^ %spin=%s eventIndex %d %d", w, output->name, // getRevolutionCounter(), getTimeNowUs()); @@ -137,7 +137,7 @@ void seTurnPinHigh(InjectionSignalPair *pair) { } static inline void tempTurnPinLow(InjectorOutputPin *output) { -#if FUEL_MATH_EXTREME_LOGGING || defined(__DOXYGEN__) +#if FUEL_MATH_EXTREME_LOGGING printf("seTurnPinLow %s %d %d\r\n", output->name, output->overlappingCounter, (int)getTimeNowUs()); #endif /* FUEL_MATH_EXTREME_LOGGING */ @@ -152,12 +152,12 @@ static inline void tempTurnPinLow(InjectorOutputPin *output) { * */ output->cancelNextTurningInjectorOff = false; -#if EFI_SIMULATOR || defined(__DOXYGEN__) +#if EFI_SIMULATOR printf("was cancelled %s %d\r\n", output->name, (int)getTimeNowUs()); #endif /* EFI_SIMULATOR */ } else { -#if FUEL_MATH_EXTREME_LOGGING || defined(__DOXYGEN__) +#if FUEL_MATH_EXTREME_LOGGING const char * w = output->currentLogicValue == false ? "err" : ""; // scheduleMsg(&sharedLogger, "- %spin=%s eventIndex %d %d", w, output->name, @@ -166,7 +166,7 @@ static inline void tempTurnPinLow(InjectorOutputPin *output) { output->overlappingCounter--; if (output->overlappingCounter > 0) { -#if FUEL_MATH_EXTREME_LOGGING || defined(__DOXYGEN__) +#if FUEL_MATH_EXTREME_LOGGING printf("was overlapping, no need to touch pin %s %d\r\n", output->name, (int)getTimeNowUs()); #endif /* FUEL_MATH_EXTREME_LOGGING */ } else { @@ -184,7 +184,7 @@ void seTurnPinLow(InjectionSignalPair *pair) { } } efiAssertVoid(CUSTOM_ERR_6626, pair->event != NULL, "pair event"); -#if EFI_UNIT_TEST || defined(__DOXYGEN__) +#if EFI_UNIT_TEST Engine *engine = pair->event->engine; EXPAND_Engine; #endif @@ -192,7 +192,7 @@ void seTurnPinLow(InjectionSignalPair *pair) { } static void sescheduleByTimestamp(scheduling_s *scheduling, efitimeus_t time, schfunc_t callback, InjectionSignalPair *pair DECLARE_ENGINE_PARAMETER_SUFFIX) { -#if FUEL_MATH_EXTREME_LOGGING || defined(__DOXYGEN__) +#if FUEL_MATH_EXTREME_LOGGING InjectorOutputPin *param = pair->outputs[0]; // scheduleMsg(&sharedLogger, "schX %s %x %d", prefix, scheduling, time); // scheduleMsg(&sharedLogger, "schX %s", param->name); @@ -213,7 +213,7 @@ static ALWAYS_INLINE void handleFuelInjectionEvent(int injEventIndex, InjectionE * x2 or /2? */ const floatms_t injectionDuration = ENGINE(wallFuel).adjust(event->outputs[0]->injectorIndex, ENGINE(injectionDuration) PASS_ENGINE_PARAMETER_SUFFIX); -#if EFI_PRINTF_FUEL_DETAILS || defined(__DOXYGEN__) +#if EFI_PRINTF_FUEL_DETAILS printf("fuel injectionDuration=%.2f adjusted=%.2f\t\n", ENGINE(injectionDuration), injectionDuration); #endif /*EFI_PRINTF_FUEL_DETAILS */ @@ -253,14 +253,14 @@ static ALWAYS_INLINE void handleFuelInjectionEvent(int injEventIndex, InjectionE floatus_t durationUs = MS2US(injectionDuration); -#if FUEL_MATH_EXTREME_LOGGING || defined(__DOXYGEN__) +#if FUEL_MATH_EXTREME_LOGGING // scheduleMsg(logger, "handleFuel totalPerCycle=%.2f", totalPerCycle); // scheduleMsg(logger, "handleFuel engineCycleDuration=%.2f", engineCycleDuration); #endif /* FUEL_MATH_EXTREME_LOGGING */ floatus_t injectionStartDelayUs = ENGINE(rpmCalculator.oneDegreeUs) * event->injectionStart.angleOffset; -#if EFI_DEFAILED_LOGGING || defined(__DOXYGEN__) +#if EFI_DEFAILED_LOGGING scheduleMsg(logger, "handleFuel pin=%s eventIndex %d duration=%.2fms %d", event->outputs[0]->name, injEventIndex, injectionDuration, @@ -287,7 +287,7 @@ static ALWAYS_INLINE void handleFuelInjectionEvent(int injEventIndex, InjectionE (schfunc_t) &endSimultaniousInjection, event); } else { -#if EFI_UNIT_TEST || defined(__DOXYGEN__) +#if EFI_UNIT_TEST printf("scheduling injection angle=%.2f/delay=%.2f injectionDuration=%.2f\r\n", event->injectionStart.angleOffset, injectionStartDelayUs, injectionDuration); #endif @@ -306,14 +306,14 @@ static ALWAYS_INLINE void handleFuelInjectionEvent(int injEventIndex, InjectionE efitimeus_t nowUs = getTimeNowUs(); InjectorOutputPin *output = event->outputs[0]; - #if EFI_PRINTF_FUEL_DETAILS || defined(__DOXYGEN__) + #if EFI_PRINTF_FUEL_DETAILS printf("fuelout %s duration %d total=%d\t\n", output->name, (int)durationUs, (int)MS2US(getCrankshaftRevolutionTimeMs(GET_RPM_VALUE))); #endif /*EFI_PRINTF_FUEL_DETAILS */ if (pair->isScheduled) { - #if EFI_UNIT_TEST || EFI_SIMULATOR || defined(__DOXYGEN__) + #if EFI_UNIT_TEST || EFI_SIMULATOR printf("still used1 %s %d\r\n", output->name, (int)getTimeNowUs()); #endif /* EFI_UNIT_TEST || EFI_SIMULATOR */ return; // this InjectionSignalPair is still needed for an extremely long injection scheduled previously @@ -330,7 +330,7 @@ static ALWAYS_INLINE void handleFuelInjectionEvent(int injEventIndex, InjectionE if (isSecondaryOverlapping) { output->cancelNextTurningInjectorOff = true; - #if EFI_UNIT_TEST || EFI_SIMULATOR || defined(__DOXYGEN__) + #if EFI_UNIT_TEST || EFI_SIMULATOR printf("please cancel %s %d %d\r\n", output->name, (int)getTimeNowUs(), output->overlappingCounter); #endif /* EFI_UNIT_TEST || EFI_SIMULATOR */ } else { @@ -355,7 +355,7 @@ static void fuelClosedLoopCorrection(DECLARE_ENGINE_PARAMETER_SIGNATURE) { engine->engineState.fuelPidCorrection = fuelPid.getOutput(ENGINE(engineState.targetAFR), ENGINE(sensors.currentAfr), 1); if (engineConfiguration->debugMode == DBG_FUEL_PID_CORRECTION) { -#if EFI_TUNER_STUDIO || defined(__DOXYGEN__) +#if EFI_TUNER_STUDIO tsOutputChannels.debugFloatField1 = engine->engineState.fuelPidCorrection; fuelPid.postState(&tsOutputChannels); #endif /* EFI_TUNER_STUDIO */ @@ -386,7 +386,7 @@ static ALWAYS_INLINE void handleFuel(const bool limitedFuel, uint32_t trgEventIn fs->addFuelEvents(PASS_ENGINE_PARAMETER_SIGNATURE); } -#if FUEL_MATH_EXTREME_LOGGING || defined(__DOXYGEN__) +#if FUEL_MATH_EXTREME_LOGGING scheduleMsg(logger, "handleFuel ind=%d %d", trgEventIndex, getRevolutionCounter()); #endif /* FUEL_MATH_EXTREME_LOGGING */ @@ -414,17 +414,17 @@ static ALWAYS_INLINE void handleFuel(const bool limitedFuel, uint32_t trgEventIn } } -#if EFI_HISTOGRAMS || defined(__DOXYGEN__) +#if EFI_HISTOGRAMS static histogram_s mainLoopHistogram; #endif /* EFI_HISTOGRAMS */ void showMainHistogram(void) { -#if EFI_HISTOGRAMS || defined(__DOXYGEN__) +#if EFI_HISTOGRAMS printHistogram(logger, &mainLoopHistogram); #endif /* EFI_HISTOGRAMS */ } -#if EFI_PROD_CODE || defined(__DOXYGEN__) +#if EFI_PROD_CODE /** * this field is used as an Expression in IAR debugger */ @@ -483,7 +483,7 @@ void mainTriggerCallback(trigger_event_e ckpSignalType, uint32_t trgEventIndex D warning(CUSTOM_SKIPPING_STROKE, "skipping stroke due to rpm=%d", rpm); } -#if (EFI_HISTOGRAMS && EFI_PROD_CODE) || defined(__DOXYGEN__) +#if EFI_HISTOGRAMS && EFI_PROD_CODE int beforeCallback = hal_lld_get_counter_value(); #endif @@ -523,7 +523,7 @@ void mainTriggerCallback(trigger_event_e ckpSignalType, uint32_t trgEventIndex D * For spark we schedule both start of coil charge and actual spark based on trigger angle */ handleSpark(limitedSpark, trgEventIndex, rpm PASS_ENGINE_PARAMETER_SUFFIX); -#if EFI_HISTOGRAMS || defined(__DOXYGEN__) +#if EFI_HISTOGRAMS int diff = hal_lld_get_counter_value() - beforeCallback; if (diff > 0) hsAdd(&mainLoopHistogram, diff); @@ -548,7 +548,7 @@ static bool isPrimeInjectionPulseSkipped(DECLARE_ENGINE_PARAMETER_SIGNATURE) { void startPrimeInjectionPulse(DECLARE_ENGINE_PARAMETER_SIGNATURE) { // First, we need a protection against 'fake' ignition switch on and off (i.e. no engine started), to avoid repeated prime pulses. // So we check and update the ignition switch counter in non-volatile backup-RAM -#if EFI_PROD_CODE || defined(__DOXYGEN__) +#if EFI_PROD_CODE uint32_t ignSwitchCounter = backupRamLoad(BACKUP_IGNITION_SWITCH_COUNTER); #else /* EFI_PROD_CODE */ uint32_t ignSwitchCounter = 0; @@ -564,7 +564,7 @@ void startPrimeInjectionPulse(DECLARE_ENGINE_PARAMETER_SIGNATURE) { // start prime injection if this is a 'fresh start' if (ignSwitchCounter == 0) { // fill-in the prime event struct -#if EFI_UNIT_TEST || defined(__DOXYGEN__) +#if EFI_UNIT_TEST primeInjEvent.engine = engine; #endif /* EFI_UNIT_TEST */ primeInjEvent.ownIndex = 0; @@ -582,14 +582,14 @@ void startPrimeInjectionPulse(DECLARE_ENGINE_PARAMETER_SIGNATURE) { engine->executor.scheduleForLater(sDown, turnOffDelayUs, (schfunc_t) &endSimultaniousInjectionOnlyTogglePins, engine); } } -#if EFI_PROD_CODE || defined(__DOXYGEN__) +#if EFI_PROD_CODE // we'll reset it later when the engine starts backupRamSave(BACKUP_IGNITION_SWITCH_COUNTER, ignSwitchCounter + 1); #endif /* EFI_PROD_CODE */ } void updatePrimeInjectionPulseState(DECLARE_ENGINE_PARAMETER_SIGNATURE) { -#if EFI_PROD_CODE || defined(__DOXYGEN__) +#if EFI_PROD_CODE static bool counterWasReset = false; if (counterWasReset) return; @@ -601,20 +601,20 @@ void updatePrimeInjectionPulseState(DECLARE_ENGINE_PARAMETER_SIGNATURE) { #endif /* EFI_PROD_CODE */ } -#if EFI_ENGINE_SNIFFER || defined(__DOXYGEN__) +#if EFI_ENGINE_SNIFFER #include "engine_sniffer.h" #endif static void showTriggerHistogram(void) { printAllCallbacksHistogram(); showMainHistogram(); -#if EFI_ENGINE_SNIFFER || defined(__DOXYGEN__) +#if EFI_ENGINE_SNIFFER showWaveChartHistogram(); #endif } static void showMainInfo(Engine *engine) { -#if EFI_PROD_CODE || defined(__DOXYGEN__) +#if EFI_PROD_CODE int rpm = GET_RPM(); float el = getEngineLoadT(PASS_ENGINE_PARAMETER_SIGNATURE); scheduleMsg(logger, "rpm %d engine_load %.2f", rpm, el); @@ -629,7 +629,7 @@ void initMainEventListener(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX initAuxValves(logger); -#if EFI_PROD_CODE || defined(__DOXYGEN__) +#if EFI_PROD_CODE addConsoleAction("performanceinfo", showTriggerHistogram); addConsoleActionP("maininfo", (VoidPtr) showMainInfo, engine); @@ -638,7 +638,7 @@ void initMainEventListener(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX printMsg(logger, "!!!!!!!!!!!!!!!!!!! injection disabled"); #endif -#if EFI_HISTOGRAMS || defined(__DOXYGEN__) +#if EFI_HISTOGRAMS initHistogram(&mainLoopHistogram, "main callback"); #endif /* EFI_HISTOGRAMS */ diff --git a/firmware/controllers/trigger/rpm_calculator.cpp b/firmware/controllers/trigger/rpm_calculator.cpp index e4de39027e..8c9fb906fb 100644 --- a/firmware/controllers/trigger/rpm_calculator.cpp +++ b/firmware/controllers/trigger/rpm_calculator.cpp @@ -22,7 +22,7 @@ #include "engine.h" #endif -#if EFI_SENSOR_CHART || defined(__DOXYGEN__) +#if EFI_SENSOR_CHART #include "sensor_chart.h" #endif @@ -73,7 +73,7 @@ int RpmCalculator::getRpm(DECLARE_ENGINE_PARAMETER_SIGNATURE) const { return rpmValue; } -#if EFI_SHAFT_POSITION_INPUT || defined(__DOXYGEN__) +#if EFI_SHAFT_POSITION_INPUT EXTERN_ENGINE ; @@ -159,7 +159,7 @@ void RpmCalculator::setRpmValue(int value DECLARE_ENGINE_PARAMETER_SUFFIX) { */ state = CRANKING; } -#if EFI_ENGINE_CONTROL || defined(__DOXYGEN__) +#if EFI_ENGINE_CONTROL // This presumably fixes injection mode change for cranking-to-running transition. // 'isSimultanious' flag should be updated for events if injection modes differ for cranking and running. if (state != oldState) { @@ -261,7 +261,7 @@ void rpmShaftPositionCallback(trigger_event_e ckpSignalType, } -#if EFI_SENSOR_CHART || defined(__DOXYGEN__) +#if EFI_SENSOR_CHART // this 'index==0' case is here so that it happens after cycle callback so // it goes into sniffer report into the first position if (ENGINE(sensorChartMode) == SC_TRIGGER) { @@ -291,7 +291,7 @@ static scheduling_s tdcScheduler[2]; static char rpmBuffer[_MAX_FILLER]; -#if (EFI_PROD_CODE || EFI_SIMULATOR) || defined(__DOXYGEN__) +#if EFI_PROD_CODE || EFI_SIMULATOR /** * This callback has nothing to do with actual engine control, it just sends a Top Dead Center mark to the dev console * digital sniffer. @@ -347,7 +347,7 @@ void initRpmCalculator(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) { if (hasFirmwareError()) { return; } -#if (EFI_PROD_CODE || EFI_SIMULATOR) || defined(__DOXYGEN__) +#if EFI_PROD_CODE || EFI_SIMULATOR addTriggerEventListener(tdcMarkCallback, "chart TDC mark", engine); #endif @@ -355,7 +355,7 @@ void initRpmCalculator(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) { addTriggerEventListener(rpmShaftPositionCallback, "rpm reporter", engine); } -#if (EFI_PROD_CODE || EFI_SIMULATOR) || defined(__DOXYGEN__) +#if EFI_PROD_CODE || EFI_SIMULATOR /** * Schedules a callback 'angle' degree of crankshaft from now. * The callback would be executed once after the duration of time which diff --git a/firmware/controllers/trigger/spark_logic.cpp b/firmware/controllers/trigger/spark_logic.cpp index cb4e62da27..df128dcf12 100644 --- a/firmware/controllers/trigger/spark_logic.cpp +++ b/firmware/controllers/trigger/spark_logic.cpp @@ -31,7 +31,7 @@ int isIgnitionTimingError(void) { } static void turnSparkPinLow2(IgnitionEvent *event, IgnitionOutputPin *output) { -#if SPARK_EXTREME_LOGGING || defined(__DOXYGEN__) +#if SPARK_EXTREME_LOGGING scheduleMsg(logger, "spark goes low %d %s %d current=%d cnt=%d id=%d", getRevolutionCounter(), output->name, (int)getTimeNowUs(), output->currentLogicValue, output->outOfOrder, event->sparkId); #endif /* FUEL_MATH_EXTREME_LOGGING */ @@ -51,7 +51,7 @@ static void turnSparkPinLow2(IgnitionEvent *event, IgnitionOutputPin *output) { } output->setLow(); -#if EFI_PROD_CODE || defined(__DOXYGEN__) +#if EFI_PROD_CODE if (CONFIG(dizzySparkOutputPin) != GPIO_UNASSIGNED) { enginePins.dizzyOutput.setLow(); } @@ -101,7 +101,7 @@ static void prepareCylinderIgnitionSchedule(angle_t dwellAngle, IgnitionEvent *e assertAngleRange(a, "findAngle#a6", CUSTOM_ERR_6550); TRIGGER_SHAPE(findTriggerPosition(&event->dwellPosition, a PASS_CONFIG_PARAM(engineConfiguration->globalTriggerAngleOffset))); -#if FUEL_MATH_EXTREME_LOGGING || defined(__DOXYGEN__) +#if FUEL_MATH_EXTREME_LOGGING printf("addIgnitionEvent %s ind=%d\n", output->name, event->dwellPosition.eventIndex); // scheduleMsg(logger, "addIgnitionEvent %s ind=%d", output->name, event->dwellPosition->eventIndex); #endif /* FUEL_MATH_EXTREME_LOGGING */ @@ -114,7 +114,7 @@ void turnSparkPinLow(IgnitionEvent *event) { turnSparkPinLow2(event, output); } } -#if EFI_UNIT_TEST || defined(__DOXYGEN__) +#if EFI_UNIT_TEST Engine *engine = event->engine; EXPAND_Engine; #endif @@ -130,7 +130,7 @@ void turnSparkPinLow(IgnitionEvent *event) { static void turnSparkPinHigh2(IgnitionEvent *event, IgnitionOutputPin *output) { -#if ! EFI_UNIT_TEST || defined(__DOXYGEN__) +#if ! EFI_UNIT_TEST if (GET_RPM_VALUE > 2 * engineConfiguration->cranking.rpm) { const char *outputName = output->name; if (prevSparkName == outputName && getCurrentIgnitionMode(PASS_ENGINE_PARAMETER_SIGNATURE) != IM_ONE_COIL) { @@ -141,7 +141,7 @@ static void turnSparkPinHigh2(IgnitionEvent *event, IgnitionOutputPin *output) { #endif /* EFI_UNIT_TEST */ -#if SPARK_EXTREME_LOGGING || defined(__DOXYGEN__) +#if SPARK_EXTREME_LOGGING scheduleMsg(logger, "spark goes high %d %s %d current=%d cnt=%d id=%d", getRevolutionCounter(), output->name, (int)getTimeNowUs(), output->currentLogicValue, output->outOfOrder, event->sparkId); #endif /* FUEL_MATH_EXTREME_LOGGING */ @@ -155,7 +155,7 @@ static void turnSparkPinHigh2(IgnitionEvent *event, IgnitionOutputPin *output) { } output->setHigh(); -#if EFI_PROD_CODE || defined(__DOXYGEN__) +#if EFI_PROD_CODE if (CONFIG(dizzySparkOutputPin) != GPIO_UNASSIGNED) { enginePins.dizzyOutput.setHigh(); } @@ -191,7 +191,7 @@ static ALWAYS_INLINE void handleSparkEvent(bool limitedSpark, uint32_t trgEventI int isIgnitionError = chargeDelayUs < 0; ignitionErrorDetection.add(isIgnitionError); if (isIgnitionError) { -#if EFI_PROD_CODE || defined(__DOXYGEN__) +#if EFI_PROD_CODE scheduleMsg(logger, "Negative spark delay=%.2f", chargeDelayUs); #endif /* EFI_PROD_CODE */ chargeDelayUs = 0; @@ -212,7 +212,7 @@ static ALWAYS_INLINE void handleSparkEvent(bool limitedSpark, uint32_t trgEventI * The start of charge is always within the current trigger event range, so just plain time-based scheduling */ if (!limitedSpark) { -#if SPARK_EXTREME_LOGGING || defined(__DOXYGEN__) +#if SPARK_EXTREME_LOGGING scheduleMsg(logger, "scheduling sparkUp ind=%d %d %s now=%d %d later id=%d", trgEventIndex, getRevolutionCounter(), iEvent->getOutputForLoggins()->name, (int)getTimeNowUs(), (int)chargeDelayUs, iEvent->sparkId); #endif /* FUEL_MATH_EXTREME_LOGGING */ @@ -234,7 +234,7 @@ static ALWAYS_INLINE void handleSparkEvent(bool limitedSpark, uint32_t trgEventI assertAngleRange(advance, "findAngle#a5", CUSTOM_ERR_6549); TRIGGER_SHAPE(findTriggerPosition(&iEvent->sparkPosition, advance PASS_CONFIG_PARAM(engineConfiguration->globalTriggerAngleOffset))); -#if EFI_UNIT_TEST || defined(__DOXYGEN__) +#if EFI_UNIT_TEST printf("spark dwell@ %d/%d spark@ %d/%d id=%d\r\n", iEvent->dwellPosition.eventIndex, (int)iEvent->dwellPosition.angleOffset, iEvent->sparkPosition.eventIndex, (int)iEvent->sparkPosition.angleOffset, iEvent->sparkId); @@ -259,13 +259,13 @@ static ALWAYS_INLINE void handleSparkEvent(bool limitedSpark, uint32_t trgEventI */ float timeTillIgnitionUs = ENGINE(rpmCalculator.oneDegreeUs) * iEvent->sparkPosition.angleOffset; -#if SPARK_EXTREME_LOGGING || defined(__DOXYGEN__) +#if SPARK_EXTREME_LOGGING scheduleMsg(logger, "scheduling sparkDown ind=%d %d %s now=%d %d later id=%d", trgEventIndex, getRevolutionCounter(), iEvent->getOutputForLoggins()->name, (int)getTimeNowUs(), (int)timeTillIgnitionUs, iEvent->sparkId); #endif /* FUEL_MATH_EXTREME_LOGGING */ engine->executor.scheduleForLater(sDown, (int) timeTillIgnitionUs, (schfunc_t) &turnSparkPinLow, iEvent); } else { -#if SPARK_EXTREME_LOGGING || defined(__DOXYGEN__) +#if SPARK_EXTREME_LOGGING scheduleMsg(logger, "to queue sparkDown ind=%d %d %s %d for %d", trgEventIndex, getRevolutionCounter(), iEvent->getOutputForLoggins()->name, (int)getTimeNowUs(), iEvent->sparkPosition.eventIndex); #endif /* FUEL_MATH_EXTREME_LOGGING */ /** @@ -273,7 +273,7 @@ static ALWAYS_INLINE void handleSparkEvent(bool limitedSpark, uint32_t trgEventI */ bool isPending = assertNotInList(ENGINE(iHead), iEvent); if (isPending) { -#if SPARK_EXTREME_LOGGING || defined(__DOXYGEN__) +#if SPARK_EXTREME_LOGGING scheduleMsg(logger, "not adding to queue sparkDown ind=%d %d %s %d", trgEventIndex, getRevolutionCounter(), iEvent->getOutputForLoggins()->name, (int)getTimeNowUs()); #endif /* FUEL_MATH_EXTREME_LOGGING */ return; @@ -295,7 +295,7 @@ static void initializeIgnitionActions(IgnitionEventList *list DECLARE_ENGINE_PAR for (int cylinderIndex = 0; cylinderIndex < CONFIG(specs.cylindersCount); cylinderIndex++) { list->elements[cylinderIndex].cylinderIndex = cylinderIndex; -#if EFI_UNIT_TEST || defined(__DOXYGEN__) +#if EFI_UNIT_TEST list->elements[cylinderIndex].engine = engine; #endif /* EFI_UNIT_TEST */ prepareCylinderIgnitionSchedule(dwellAngle, &list->elements[cylinderIndex] PASS_ENGINE_PARAMETER_SUFFIX); @@ -361,7 +361,7 @@ void handleSpark(bool limitedSpark, uint32_t trgEventIndex, int rpm scheduling_s * sDown = ¤t->signalTimerDown; -#if SPARK_EXTREME_LOGGING || defined(__DOXYGEN__) +#if SPARK_EXTREME_LOGGING scheduleMsg(logger, "time to sparkDown ind=%d %d %s %d", trgEventIndex, getRevolutionCounter(), current->getOutputForLoggins()->name, (int)getTimeNowUs()); #endif /* FUEL_MATH_EXTREME_LOGGING */ diff --git a/firmware/controllers/trigger/trigger_central.cpp b/firmware/controllers/trigger/trigger_central.cpp index ab0884c2f1..31ebfdc291 100644 --- a/firmware/controllers/trigger/trigger_central.cpp +++ b/firmware/controllers/trigger/trigger_central.cpp @@ -43,27 +43,27 @@ int TriggerCentral::getHwEventCounter(int index) { return hwEventCounters[index]; } -#if EFI_SHAFT_POSITION_INPUT || defined(__DOXYGEN__) +#if EFI_SHAFT_POSITION_INPUT -#if EFI_PROD_CODE || defined(__DOXYGEN__) +#if EFI_PROD_CODE #include "rfiutil.h" #include "pin_repository.h" #endif /* EFI_PROD_CODE */ -#if EFI_TUNER_STUDIO || defined(__DOXYGEN__) +#if EFI_TUNER_STUDIO #include "tunerstudio.h" extern TunerStudioOutputChannels tsOutputChannels; #endif /* EFI_TUNER_STUDIO */ -#if EFI_ENGINE_SNIFFER || defined(__DOXYGEN__) +#if EFI_ENGINE_SNIFFER #include "engine_sniffer.h" WaveChart waveChart; #endif /* EFI_ENGINE_SNIFFER */ EXTERN_ENGINE; -#if EFI_HISTOGRAMS || defined(__DOXYGEN__) +#if EFI_HISTOGRAMS static histogram_s triggerCallbackHistogram; #endif /* EFI_HISTOGRAMS */ @@ -85,7 +85,7 @@ void addTriggerEventListener(ShaftPositionListener listener, const char *name, E engine->triggerCentral.addEventListener(listener, name, engine); } -#if (EFI_PROD_CODE || EFI_SIMULATOR) || defined(__DOXYGEN__) +#if EFI_PROD_CODE || EFI_SIMULATOR int triggerReentraint = 0; int maxTriggerReentraint = 0; @@ -130,7 +130,7 @@ void hwHandleVvtCamSignal(trigger_value_e front) { scheduleMsg(logger, "looks good: vvt ratio %.2f", ratio); } if (engineConfiguration->debugMode == DBG_VVT) { -#if EFI_TUNER_STUDIO || defined(__DOXYGEN__) +#if EFI_TUNER_STUDIO tsOutputChannels.debugIntField1++; #endif /* EFI_TUNER_STUDIO */ } @@ -157,7 +157,7 @@ void hwHandleVvtCamSignal(trigger_value_e front) { */ tc->triggerState.incrementTotalEventCounter(); if (engineConfiguration->debugMode == DBG_VVT) { -#if EFI_TUNER_STUDIO || defined(__DOXYGEN__) +#if EFI_TUNER_STUDIO tsOutputChannels.debugIntField1++; #endif /* EFI_TUNER_STUDIO */ } @@ -168,7 +168,7 @@ void hwHandleVvtCamSignal(trigger_value_e front) { // see above comment tc->triggerState.incrementTotalEventCounter(); if (engineConfiguration->debugMode == DBG_VVT) { -#if EFI_TUNER_STUDIO || defined(__DOXYGEN__) +#if EFI_TUNER_STUDIO tsOutputChannels.debugIntField1++; #endif /* EFI_TUNER_STUDIO */ } @@ -369,7 +369,7 @@ void TriggerCentral::handleShaftSignal(trigger_event_e signal DECLARE_ENGINE_PAR } if (triggerState.isValidIndex(PASS_ENGINE_PARAMETER_SIGNATURE)) { -#if TRIGGER_EXTREME_LOGGING || defined(__DOXYGEN__) +#if TRIGGER_EXTREME_LOGGING scheduleMsg(logger, "trigger %d %d %d", triggerIndexForListeners, getRevolutionCounter(), (int)getTimeNowUs()); #endif /* FUEL_MATH_EXTREME_LOGGING */ @@ -382,7 +382,7 @@ void TriggerCentral::handleShaftSignal(trigger_event_e signal DECLARE_ENGINE_PAR } } -#if EFI_HISTOGRAMS || defined(__DOXYGEN__) +#if EFI_HISTOGRAMS int afterCallback = hal_lld_get_counter_value(); int diff = afterCallback - beforeCallback; // this counter is only 32 bits so it overflows every minute, let's ignore the value in case of the overflow for simplicity @@ -393,7 +393,7 @@ void TriggerCentral::handleShaftSignal(trigger_event_e signal DECLARE_ENGINE_PAR } void printAllCallbacksHistogram(void) { -#if EFI_HISTOGRAMS || defined(__DOXYGEN__) +#if EFI_HISTOGRAMS printHistogram(logger, &triggerCallbackHistogram); #endif } @@ -402,7 +402,7 @@ EXTERN_ENGINE ; static void triggerShapeInfo(void) { -#if (EFI_PROD_CODE || EFI_SIMULATOR) || defined(__DOXYGEN__) +#if EFI_PROD_CODE || EFI_SIMULATOR TriggerShape *s = &engine->triggerCentral.triggerShape; scheduleMsg(logger, "useRise=%s", boolToString(TRIGGER_SHAPE(useRiseEdge))); scheduleMsg(logger, "gap from %.2f to %.2f", TRIGGER_SHAPE(syncronizationRatioFrom[0]), TRIGGER_SHAPE(syncronizationRatioTo[0])); @@ -413,7 +413,7 @@ static void triggerShapeInfo(void) { #endif } -#if EFI_UNIT_TEST || defined(__DOXYGEN__) +#if EFI_UNIT_TEST #include #define TRIGGERS_FILE_NAME "triggers.txt" @@ -475,7 +475,7 @@ void printAllTriggers() { #endif -#if EFI_PROD_CODE || defined(__DOXYGEN__) +#if EFI_PROD_CODE extern PwmConfig triggerSignal; #endif /* #if EFI_PROD_CODE */ @@ -488,7 +488,7 @@ extern uint32_t maxEventCallbackDuration; extern int perSecondIrqDuration; extern int perSecondIrqCounter; -#if (EFI_PROD_CODE) || defined(__DOXYGEN__) +#if EFI_PROD_CODE extern uint32_t maxPrecisionCallbackDuration; #endif /* EFI_PROD_CODE */ @@ -499,23 +499,23 @@ extern int vvtEventRiseCounter; extern int vvtEventFallCounter; void resetMaxValues() { -#if (EFI_PROD_CODE || EFI_SIMULATOR) || defined(__DOXYGEN__) +#if EFI_PROD_CODE || EFI_SIMULATOR maxEventCallbackDuration = triggerMaxDuration = 0; #endif /* EFI_PROD_CODE || EFI_SIMULATOR */ maxSchedulingPrecisionLoss = 0; -#if EFI_CLOCK_LOCKS || defined(__DOXYGEN__) +#if EFI_CLOCK_LOCKS maxLockedDuration = 0; #endif /* EFI_CLOCK_LOCKS */ -#if (EFI_PROD_CODE) || defined(__DOXYGEN__) +#if EFI_PROD_CODE maxPrecisionCallbackDuration = 0; #endif /* EFI_PROD_CODE */ } void triggerInfo(void) { -#if (EFI_PROD_CODE || EFI_SIMULATOR) || defined(__DOXYGEN__) +#if EFI_PROD_CODE || EFI_SIMULATOR TriggerShape *ts = &engine->triggerCentral.triggerShape; @@ -556,7 +556,7 @@ void triggerInfo(void) { #endif /* EFI_PROD_CODE || EFI_SIMULATOR */ -#if EFI_PROD_CODE || defined(__DOXYGEN__) +#if EFI_PROD_CODE if (engineConfiguration->camInput != GPIO_UNASSIGNED) { scheduleMsg(logger, "VVT input: %s mode %s", hwPortname(engineConfiguration->camInput), getVvt_mode_e(engineConfiguration->vvtMode)); @@ -572,7 +572,7 @@ void triggerInfo(void) { if (ts->needSecondTriggerInput) { scheduleMsg(logger, "secondary trigger input: %s", hwPortname(CONFIGB(triggerInputPins)[1])); -#if EFI_EMULATE_POSITION_SENSORS || defined(__DOXYGEN__) +#if EFI_EMULATE_POSITION_SENSORS scheduleMsg(logger, "secondary trigger simulator: %s %s phase=%d", hwPortname(CONFIGB(triggerSimulatorPins)[1]), getPin_output_mode_e(CONFIGB(triggerSimulatorPinModes)[1]), triggerSignal.safe.phaseIndex); @@ -603,7 +603,7 @@ void triggerInfo(void) { engine->m.rpmCbTime, engine->m.mainTriggerCallbackTime); -#if EFI_CLOCK_LOCKS || defined(__DOXYGEN__) +#if EFI_CLOCK_LOCKS scheduleMsg(logger, "maxLockedDuration=%d / maxTriggerReentraint=%d", maxLockedDuration, maxTriggerReentraint); scheduleMsg(logger, "perSecondIrqDuration=%d ticks / perSecondIrqCounter=%d", perSecondIrqDuration, perSecondIrqCounter); @@ -613,7 +613,7 @@ void triggerInfo(void) { scheduleMsg(logger, "maxEventCallbackDuration=%d", maxEventCallbackDuration); -#if EFI_HIP_9011 || defined(__DOXYGEN__) +#if EFI_HIP_9011 scheduleMsg(logger, "hipLastExecutionCount=%d", hipLastExecutionCount); #endif /* EFI_HIP_9011 */ scheduleMsg(logger, "hwSetTimerDuration=%d", hwSetTimerDuration); @@ -626,7 +626,7 @@ void triggerInfo(void) { } static void resetRunningTriggerCounters() { -#if !EFI_UNIT_TEST || defined(__DOXYGEN__) +#if !EFI_UNIT_TEST engine->triggerCentral.resetCounters(); triggerInfo(); #endif @@ -655,7 +655,7 @@ void onConfigurationChangeTriggerCallback(engine_configuration_s *previousConfig if (changed) { assertEngineReference(); - #if EFI_ENGINE_CONTROL || defined(__DOXYGEN__) + #if EFI_ENGINE_CONTROL ENGINE(initializeTriggerShape(logger PASS_ENGINE_PARAMETER_SUFFIX)); engine->triggerCentral.resetAccumSignalData(); #endif @@ -685,17 +685,17 @@ void initTriggerCentral(Logging *sharedLogger) { logger = sharedLogger; strcpy((char*) shaft_signal_msg_index, "x_"); -#if EFI_ENGINE_SNIFFER || defined(__DOXYGEN__) +#if EFI_ENGINE_SNIFFER initWaveChart(&waveChart); #endif /* EFI_ENGINE_SNIFFER */ -#if EFI_PROD_CODE || EFI_SIMULATOR || defined(__DOXYGEN__) +#if EFI_PROD_CODE || EFI_SIMULATOR addConsoleAction("triggerinfo", triggerInfo); addConsoleAction("trigger_shape_info", triggerShapeInfo); addConsoleAction("reset_trigger", resetRunningTriggerCounters); #endif -#if EFI_HISTOGRAMS || defined(__DOXYGEN__) +#if EFI_HISTOGRAMS initHistogram(&triggerCallbackHistogram, "all callbacks"); #endif /* EFI_HISTOGRAMS */ } diff --git a/firmware/controllers/trigger/trigger_decoder.cpp b/firmware/controllers/trigger/trigger_decoder.cpp index b600b90c04..f08260d80f 100644 --- a/firmware/controllers/trigger/trigger_decoder.cpp +++ b/firmware/controllers/trigger/trigger_decoder.cpp @@ -30,7 +30,7 @@ #include "trigger_simulator.h" #include "rfiutil.h" -#if EFI_SENSOR_CHART || defined(__DOXYGEN__) +#if EFI_SENSOR_CHART #include "sensor_chart.h" #endif @@ -76,7 +76,7 @@ TriggerStateWithRunningStatistics::TriggerStateWithRunningStatistics() : { } -#if EFI_SHAFT_POSITION_INPUT || defined(__DOXYGEN__) +#if EFI_SHAFT_POSITION_INPUT EXTERN_ENGINE ; @@ -87,12 +87,12 @@ EXTERN_ENGINE // only TriggerStateWithRunningStatistics would have the field? static cyclic_buffer errorDetection; -#if ! EFI_PROD_CODE || defined(__DOXYGEN__) +#if ! EFI_PROD_CODE bool printTriggerDebug = false; float actualSynchGap; #endif /* ! EFI_PROD_CODE */ -#if EFI_TUNER_STUDIO || defined(__DOXYGEN__) +#if EFI_TUNER_STUDIO extern TunerStudioOutputChannels tsOutputChannels; #endif /* EFI_TUNER_STUDIO */ @@ -106,7 +106,7 @@ bool isTriggerDecoderError(void) { } void calculateTriggerSynchPoint(TriggerShape *shape, TriggerState *state DECLARE_ENGINE_PARAMETER_SUFFIX) { -#if EFI_PROD_CODE || defined(__DOXYGEN__) +#if EFI_PROD_CODE efiAssertVoid(CUSTOM_ERR_6642, getCurrentRemainingStack() > 256, "calc s"); #endif trigger_config_s const*triggerConfig = &engineConfiguration->trigger; @@ -237,7 +237,7 @@ void TriggerStateWithRunningStatistics::runtimeStatistics(efitime_t nowNt DECLAR int prevIndex; instantRpm = calculateInstantRpm(&prevIndex, nowNt PASS_ENGINE_PARAMETER_SUFFIX); -#if EFI_SENSOR_CHART || defined(__DOXYGEN__) +#if EFI_SENSOR_CHART angle_t currentAngle = TRIGGER_SHAPE(eventAngles[currentCycle.current_index]); if (CONFIGB(sensorChartMode) == SC_DETAILED_RPM) { scAddData(currentAngle, instantRpm); @@ -258,7 +258,7 @@ static trigger_value_e eventType[6] = { TV_FALL, TV_RISE, TV_FALL, TV_RISE, TV_F #define getCurrentGapDuration(nowNt) \ (isFirstEvent ? 0 : (nowNt) - toothed_previous_time) -#if EFI_UNIT_TEST || defined(__DOXYGEN__) +#if EFI_UNIT_TEST #define PRINT_INC_INDEX if (printTriggerDebug) {\ printf("nextTriggerEvent index=%d\r\n", currentCycle.current_index); \ } @@ -326,7 +326,7 @@ bool TriggerState::validateEventCounters(DECLARE_ENGINE_PARAMETER_SIGNATURE) con void TriggerState::handleTriggerError(DECLARE_ENGINE_PARAMETER_SIGNATURE) { if (engineConfiguration->debugMode == DBG_TRIGGER_SYNC) { -#if EFI_TUNER_STUDIO || defined(__DOXYGEN__) +#if EFI_TUNER_STUDIO tsOutputChannels.debugIntField1 = currentCycle.eventCount[0]; tsOutputChannels.debugIntField2 = currentCycle.eventCount[1]; tsOutputChannels.debugIntField3 = currentCycle.eventCount[2]; @@ -345,7 +345,7 @@ void TriggerState::handleTriggerError(DECLARE_ENGINE_PARAMETER_SIGNATURE) { totalTriggerErrorCounter++; if (CONFIG(isPrintTriggerSynchDetails) || someSortOfTriggerError) { -#if EFI_PROD_CODE || defined(__DOXYGEN__) +#if EFI_PROD_CODE scheduleMsg(logger, "error: synchronizationPoint @ index %d expected %d/%d/%d got %d/%d/%d", currentCycle.current_index, TRIGGER_SHAPE(expectedEventCount[0]), TRIGGER_SHAPE(expectedEventCount[1]), TRIGGER_SHAPE(expectedEventCount[2]), @@ -369,7 +369,7 @@ void TriggerState::onShaftSynchronization(efitime_t nowNt, trigger_wheel_e trigg incrementTotalEventCounter(); totalEventCountBase += getTriggerSize(); -#if EFI_UNIT_TEST || defined(__DOXYGEN__) +#if EFI_UNIT_TEST if (printTriggerDebug) { printf("index=%d %d\r\n", currentCycle.current_index, @@ -418,7 +418,7 @@ void TriggerState::decodeTriggerEvent(trigger_event_e const signal, efitime_t no bool isPrimary = triggerWheel == T_PRIMARY; if (isLessImportant(type)) { -#if EFI_UNIT_TEST || defined(__DOXYGEN__) +#if EFI_UNIT_TEST if (printTriggerDebug) { printf("%s isLessImportant %s now=%lld index=%d\r\n", getTrigger_type_e(engineConfiguration->trigger.type), @@ -435,7 +435,7 @@ void TriggerState::decodeTriggerEvent(trigger_event_e const signal, efitime_t no ; } else { -#if EFI_UNIT_TEST || defined(__DOXYGEN__) +#if EFI_UNIT_TEST if (printTriggerDebug) { printf("%s event %s %d\r\n", getTrigger_type_e(engineConfiguration->trigger.type), @@ -447,7 +447,7 @@ void TriggerState::decodeTriggerEvent(trigger_event_e const signal, efitime_t no isFirstEvent = false; // todo: skip a number of signal from the beginning -#if EFI_PROD_CODE || defined(__DOXYGEN__) +#if EFI_PROD_CODE // scheduleMsg(&logger, "from %.2f to %.2f %d %d", triggerConfig->syncRatioFrom, triggerConfig->syncRatioTo, toothDurations[0], shaftPositionState->toothDurations[1]); // scheduleMsg(&logger, "ratio %.2f", 1.0 * toothDurations[0]/ shaftPositionState->toothDurations[1]); #else @@ -464,7 +464,7 @@ void TriggerState::decodeTriggerEvent(trigger_event_e const signal, efitime_t no if (CONFIG(debugMode) == DBG_TRIGGER_SYNC) { float currentGap = 1.0 * toothDurations[0] / toothDurations[1]; -#if EFI_TUNER_STUDIO || defined(__DOXYGEN__) +#if EFI_TUNER_STUDIO tsOutputChannels.debugFloatField1 = currentGap; tsOutputChannels.debugFloatField2 = currentCycle.current_index; #endif /* EFI_TUNER_STUDIO */ @@ -484,13 +484,13 @@ void TriggerState::decodeTriggerEvent(trigger_event_e const signal, efitime_t no isSynchronizationPoint = isSync; -#if EFI_PROD_CODE || defined(__DOXYGEN__) +#if EFI_PROD_CODE if (CONFIG(isPrintTriggerSynchDetails) || (someSortOfTriggerError && !CONFIG(silentTriggerError))) { #else if (printTriggerDebug) { #endif /* EFI_PROD_CODE */ -#if EFI_PROD_CODE || defined(__DOXYGEN__) +#if EFI_PROD_CODE for (int i = 0;i= endOfCycleIndex); -#if EFI_UNIT_TEST || defined(__DOXYGEN__) +#if EFI_UNIT_TEST if (printTriggerDebug) { printf("isSynchronizationPoint=%d index=%d size=%d\r\n", isSynchronizationPoint, @@ -552,7 +552,7 @@ void TriggerState::decodeTriggerEvent(trigger_event_e const signal, efitime_t no } -#if EFI_UNIT_TEST || defined(__DOXYGEN__) +#if EFI_UNIT_TEST if (printTriggerDebug) { printf("%s isSynchronizationPoint=%d index=%d %s\r\n", getTrigger_type_e(engineConfiguration->trigger.type), @@ -633,7 +633,7 @@ static void onFindIndexCallback(TriggerState *state) { uint32_t findTriggerZeroEventIndex(TriggerState *state, TriggerShape * shape, trigger_config_s const*triggerConfig DECLARE_ENGINE_PARAMETER_SUFFIX) { UNUSED(triggerConfig); -#if EFI_PROD_CODE || defined(__DOXYGEN__) +#if EFI_PROD_CODE efiAssert(CUSTOM_ERR_ASSERT, getCurrentRemainingStack() > 128, "findPos", -1); #endif errorDetection.clear(); @@ -657,7 +657,7 @@ uint32_t findTriggerZeroEventIndex(TriggerState *state, TriggerShape * shape, } efiAssert(CUSTOM_ERR_ASSERT, state->getTotalRevolutionCounter() == 1, "findZero_revCounter", EFI_ERROR_CODE); -#if EFI_UNIT_TEST || defined(__DOXYGEN__) +#if EFI_UNIT_TEST if (printTriggerDebug) { printf("findTriggerZeroEventIndex: syncIndex located %d!\r\n", syncIndex); } @@ -691,7 +691,7 @@ void TriggerState::runtimeStatistics(efitime_t nowNt DECLARE_ENGINE_PARAMETER_SU } void initTriggerDecoder(void) { -#if EFI_GPIO_HARDWARE || defined(__DOXYGEN__) +#if EFI_GPIO_HARDWARE enginePins.triggerDecoderErrorPin.initPin("trg_err", CONFIGB(triggerErrorPin), &CONFIGB(triggerErrorPinMode)); #endif /* EFI_GPIO_HARDWARE */ diff --git a/firmware/controllers/trigger/trigger_decoder.h b/firmware/controllers/trigger/trigger_decoder.h index 485fca4395..9c5677cf77 100644 --- a/firmware/controllers/trigger/trigger_decoder.h +++ b/firmware/controllers/trigger/trigger_decoder.h @@ -100,7 +100,7 @@ public: void resetTriggerState(); -#if (EFI_ENGINE_CONTROL && EFI_SHAFT_POSITION_INPUT) || defined(__DOXYGEN__) +#if EFI_ENGINE_CONTROL && EFI_SHAFT_POSITION_INPUT virtual void runtimeStatistics(efitime_t nowNt DECLARE_ENGINE_PARAMETER_SUFFIX); #endif @@ -149,7 +149,7 @@ 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__) +#if EFI_ENGINE_CONTROL && EFI_SHAFT_POSITION_INPUT virtual void runtimeStatistics(efitime_t nowNt DECLARE_ENGINE_PARAMETER_SUFFIX); #endif /** diff --git a/firmware/controllers/trigger/trigger_emulator_algo.cpp b/firmware/controllers/trigger/trigger_emulator_algo.cpp index 15fd3a8915..5e35f77748 100644 --- a/firmware/controllers/trigger/trigger_emulator_algo.cpp +++ b/firmware/controllers/trigger/trigger_emulator_algo.cpp @@ -27,7 +27,7 @@ bool needEvent(const int currentIndex, const int size, MultiWave *multiWave, int return previousValue != currentValue; } -#if EFI_EMULATE_POSITION_SENSORS || defined(__DOXYGEN__) +#if EFI_EMULATE_POSITION_SENSORS #include "engine.h" #include "trigger_emulator_algo.h" @@ -140,7 +140,7 @@ static void emulatorApplyPinState(int stateIndex, PwmConfig *state) /* pwm_gen_c if (!isEmulating) { return; } -#if EFI_PROD_CODE || defined(__DOXYGEN__) +#if EFI_PROD_CODE applyPinState(stateIndex, state); #endif /* EFI_PROD_CODE */ if (engineConfiguration->directSelfStimulation) { diff --git a/firmware/controllers/trigger/trigger_simulator.cpp b/firmware/controllers/trigger/trigger_simulator.cpp index 5fdf88ca68..bb1206d13f 100644 --- a/firmware/controllers/trigger/trigger_simulator.cpp +++ b/firmware/controllers/trigger/trigger_simulator.cpp @@ -25,7 +25,7 @@ bool isUsefulSignal(trigger_event_e signal, engine_configuration_s *engineConfig return !engineConfiguration->useOnlyRisingEdgeForTrigger || isRisingEdge[(int) signal]; } -#if EFI_UNIT_TEST || defined(__DOXYGEN__) +#if EFI_UNIT_TEST extern bool printTriggerDebug; #endif /* ! EFI_UNIT_TEST */ @@ -51,7 +51,7 @@ void TriggerStimulatorHelper::feedSimulatedEvent(TriggerState *state, TriggerSha pin_state_t thirdWheelState = multiWave->getChannelState(2, prevIndex); pin_state_t new3rdWheelState = multiWave->getChannelState(2, stateIndex); -#if EFI_UNIT_TEST || defined(__DOXYGEN__) +#if EFI_UNIT_TEST if (printTriggerDebug) { printf("feedSimulatedEvent: %d>%d primary %d>%d secondary %d>%d\r\n", prevIndex, stateIndex, primaryWheelState, newPrimaryWheelState, secondaryWheelState, newSecondaryWheelState );