diff --git a/firmware/config/engines/dodge_neon.cpp b/firmware/config/engines/dodge_neon.cpp index 93995aebdc..482ca50640 100644 --- a/firmware/config/engines/dodge_neon.cpp +++ b/firmware/config/engines/dodge_neon.cpp @@ -340,14 +340,12 @@ void setDodgeNeonNGCEngineConfiguration(engine_configuration_s *engineConfigurat */ engineConfiguration->cltAdcChannel = EFI_ADC_12; - boardConfiguration->fsio_setting[0] = 0.55; - setFsioExt(engineConfiguration, 0, GPIOE_10, "0 fsio_setting", 400); engineConfiguration->analogChartMode = AC_MAP; boardConfiguration->isFastAdcEnabled = true; engineConfiguration->map.sensor.sensorType = MT_DODGE_NEON_2003; -#if EFI_PROD_CODE +#if EFI_HIP_9011 || defined(__DOXYGEN__) setHip9011FrankensoPinout(); #endif engineConfiguration->cylinderBore = 87.5; @@ -361,7 +359,10 @@ void setDodgeNeonNGCEngineConfiguration(engine_configuration_s *engineConfigurat * set_fsio_setting 0 0.11 */ engineConfiguration->bc.fsio_setting[0] = 0.2; +#if EFI_HIP_9011 || defined(__DOXYGEN__) + boardConfiguration->fsio_setting[0] = 0.55; setFsioExt(engineConfiguration, 0, GPIOE_5, "0 fsio_setting", 400); +#endif boardConfiguration->logicAnalyzerPins[0] = GPIO_UNASSIGNED; engineConfiguration->vehicleSpeedSensorInputPin = GPIOA_8; diff --git a/firmware/config/engines/mitsubishi.cpp b/firmware/config/engines/mitsubishi.cpp index a6a5ffc608..a34f778f92 100644 --- a/firmware/config/engines/mitsubishi.cpp +++ b/firmware/config/engines/mitsubishi.cpp @@ -84,7 +84,9 @@ void setMitsubishiConfiguration(engine_configuration_s *engineConfiguration, boa engineConfiguration->HD44780height = 4; initEgoSensor(&engineConfiguration->afrSensor, ES_Innovate_MTX_L); +#if EFI_FSIO || defined(__DOXYGEN__) setFsio(engineConfiguration, 0, GPIOD_11, "rpm 5500 >"); +#endif } diff --git a/firmware/console/status_loop.cpp b/firmware/console/status_loop.cpp index 611f8b9e7a..110de37fe4 100644 --- a/firmware/console/status_loop.cpp +++ b/firmware/console/status_loop.cpp @@ -147,11 +147,18 @@ void printSensors(Logging *log, bool fileFormat, Engine *engine) { float sec = ((float) nowMs) / 1000; reportSensorF(log, fileFormat, "time", "", sec, 3); +#if EFI_SHAFT_POSITION_INPUT || defined(__DOXYGEN__) reportSensorI(log, fileFormat, "rpm", "RPM", getRpmE(engine)); + + reportSensorF(log, fileFormat, "TRG_0_DUTY", "%", getTriggerDutyCycle(0), 2); + reportSensorF(log, fileFormat, "TRG_1_DUTY", "%", getTriggerDutyCycle(1), 2); +#endif + reportSensorF(log, fileFormat, "maf", "V", getMaf(), 2); engine_configuration_s *engineConfiguration = engine->engineConfiguration; +#if EFI_ANALOG_SENSORS || defined(__DOXYGEN__) if (engineConfiguration->hasMapSensor) { reportSensorF(log, fileFormat, "MAP", "kPa", getMap(), 2); reportSensorF(log, fileFormat, "map_r", "V", getRawMap(), 2); @@ -162,7 +169,9 @@ void printSensors(Logging *log, bool fileFormat, Engine *engine) { if (engineConfiguration->hasAfrSensor) { reportSensorF(log, fileFormat, "afr", "AFR", getAfr(), 2); } -#if EFI_PROD_CODE || defined(__DOXYGEN__) +#endif + +#if EFI_VEHICLE_SPEED || defined(__DOXYGEN__) if (engineConfiguration->hasVehicleSpeedSensor) { reportSensorF(log, fileFormat, "vss", "kph", getVehicleSpeed(), 2); } @@ -170,8 +179,6 @@ void printSensors(Logging *log, bool fileFormat, Engine *engine) { reportSensorF(log, fileFormat, "vref", "V", getVRef(engineConfiguration), 2); reportSensorF(log, fileFormat, "vbatt", "V", getVBatt(engineConfiguration), 2); - reportSensorF(log, fileFormat, "TRG_0_DUTY", "%", getTriggerDutyCycle(0), 2); - reportSensorF(log, fileFormat, "TRG_1_DUTY", "%", getTriggerDutyCycle(1), 2); reportSensorF(log, fileFormat, "TP", "%", getTPS(PASS_ENGINE_PARAMETER_F), 2); @@ -334,14 +341,18 @@ void updateDevConsoleState(Engine *engine) { systime_t nowSeconds = getTimeNowSeconds(); printInfo(engine, nowSeconds); +#if EFI_ENGINE_CONTROL || defined(__DOXYGEN__) int currentCkpEventCounter = getCrankEventCounter(); if (prevCkpEventCounter == currentCkpEventCounter && timeOfPreviousReport == nowSeconds) { return; } - timeOfPreviousReport = nowSeconds; prevCkpEventCounter = currentCkpEventCounter; +#else + chThdSleepMilliseconds(200); +#endif + printState(engine); @@ -370,6 +381,7 @@ static void showFuelInfo2(float rpm, float engineLoad, Engine *engine) { scheduleMsg(&logger2, "algo=%s/pump=%s", getEngine_load_mode_e(engineConfiguration->algorithm), boolToString(enginePins.fuelPumpRelay.getLogicValue())); +#if EFI_ENGINE_CONTROL scheduleMsg(&logger2, "cranking fuel: %f", getCrankingFuel(engine)); if (engine->rpmCalculator.isRunning()) { @@ -385,11 +397,14 @@ static void showFuelInfo2(float rpm, float engineLoad, Engine *engine) { float value = getRunningFuel(baseFuelMs, (int) rpm PASS_ENGINE_PARAMETER); scheduleMsg(&logger2, "injection pulse width: %f", value); } +#endif } +#if EFI_ENGINE_CONTROL static void showFuelInfo(Engine *engine) { showFuelInfo2((float) getRpmE(engine), getEngineLoadT(PASS_ENGINE_PARAMETER), engine); } +#endif #endif /* EFI_PROD_CODE */ @@ -587,8 +602,10 @@ void initStatusLoop(Engine *engine) { #if EFI_PROD_CODE initLogging(&logger2, "main event handler"); +#if EFI_ENGINE_CONTROL addConsoleActionFFP("fuelinfo2", (VoidFloatFloatVoidPtr) showFuelInfo2, engine); addConsoleActionP("fuelinfo", (VoidPtr) showFuelInfo, engine); +#endif subscription[(int) RO_TRG1_DUTY] = true; subscription[(int) RO_TRG2_DUTY] = true; diff --git a/firmware/controllers/algo/engine.cpp b/firmware/controllers/algo/engine.cpp index b9c5354070..c56a458f71 100644 --- a/firmware/controllers/algo/engine.cpp +++ b/firmware/controllers/algo/engine.cpp @@ -77,6 +77,7 @@ bool Engine::stopPins() { } void Engine::watchdog() { +#if EFI_ENGINE_CONTROL if (isRunningPwmTest) return; if (!isSpinning) { @@ -85,7 +86,7 @@ void Engine::watchdog() { } return; } - uint64_t nowNt = getTimeNowNt(); + efitick_t nowNt = getTimeNowNt(); /** * Lowest possible cranking is about 240 RPM, that's 4 revolutions per second. * 0.25 second is 250000 uS @@ -103,6 +104,7 @@ void Engine::watchdog() { #endif stopPins(); +#endif } StartupFuelPumping::StartupFuelPumping() { diff --git a/firmware/controllers/algo/engine_configuration.cpp b/firmware/controllers/algo/engine_configuration.cpp index 69d041975f..11f6754ba2 100644 --- a/firmware/controllers/algo/engine_configuration.cpp +++ b/firmware/controllers/algo/engine_configuration.cpp @@ -656,7 +656,9 @@ void applyNonPersistentConfiguration(Logging * logger, Engine *engine) { #if EFI_PROD_CODE scheduleMsg(logger, "applyNonPersistentConfiguration()"); #endif +#if EFI_ENGINE_CONTROL initializeTriggerShape(logger, engineConfiguration, engine); +#endif if (engine->triggerShape.getSize() == 0) { firmwareError("triggerShape size is zero"); return; diff --git a/firmware/controllers/algo/fuel_math.cpp b/firmware/controllers/algo/fuel_math.cpp index 7412a035be..09493edfa5 100644 --- a/firmware/controllers/algo/fuel_math.cpp +++ b/firmware/controllers/algo/fuel_math.cpp @@ -151,6 +151,7 @@ float getBaseTableFuel(engine_configuration_s *engineConfiguration, int rpm, flo engineConfiguration->fuelRpmBins); } +#if EFI_ENGINE_CONTROL /** * @return Duration of fuel injection while craning, in milliseconds */ @@ -159,6 +160,7 @@ float getCrankingFuel(Engine *engine) { engine->rpmCalculator.getRevolutionCounterSinceStart() ); } +#endif float getCrankingFuel3(engine_configuration_s *engineConfiguration, float coolantTemperature, uint32_t revolutionCounterSinceStart) { diff --git a/firmware/controllers/engine_controller.cpp b/firmware/controllers/engine_controller.cpp index 78640ea1a9..2a01028784 100644 --- a/firmware/controllers/engine_controller.cpp +++ b/firmware/controllers/engine_controller.cpp @@ -174,6 +174,7 @@ int getTimeNowSeconds(void) { } static void cylinderCleanupControl(Engine *engine) { +#if EFI_ENGINE_CONTROL || defined(__DOXYGEN__) bool newValue; if (engineConfiguration->isCylinderCleanupEnabled) { newValue = isCrankingE(engine) && getTPS(PASS_ENGINE_PARAMETER_F) > CLEANUP_MODE_TPS; @@ -184,6 +185,7 @@ static void cylinderCleanupControl(Engine *engine) { engine->isCylinderCleanupMode = newValue; scheduleMsg(&logger, "isCylinderCleanupMode %s", boolToString(newValue)); } +#endif } static void onEvenyGeneralMilliseconds(Engine *engine) { @@ -196,13 +198,17 @@ static void onEvenyGeneralMilliseconds(Engine *engine) { unlockAnyContext(); } +#if EFI_ENGINE_CONTROL || defined(__DOXYGEN__) if (!engine->rpmCalculator.isRunning()) writeToFlashIfPending(); +#endif engine->watchdog(); engine->updateSlowSensors(); +#if EFI_FSIO || defined(__DOXYGEN__) runFsio(); +#endif updateErrorCodes(); @@ -355,17 +361,16 @@ void initEngineContoller(Logging *sharedLogger, Engine *engine) { #if EFI_ENGINE_CONTROL || defined(__DOXYGEN__) initInjectorCentral(engine); initIgnitionCentral(); -#endif - -#if EFI_PWM_TESTER - initPwmTester(); -#endif - /** * This has to go after 'initInjectorCentral' and 'initInjectorCentral' in order to * properly detect un-assigned output pins */ prepareShapes(engine); +#endif + +#if EFI_PWM_TESTER + initPwmTester(); +#endif initMalfunctionCentral(); @@ -407,7 +412,11 @@ void initEngineContoller(Logging *sharedLogger, Engine *engine) { addConsoleActionI("get_float", getFloat); addConsoleActionI("get_int", getInt); +#if EFI_FSIO || defined(__DOXYGEN__) initFsioImpl(sharedLogger, engine); +#endif +#if EFI_HD44780_LCD || defined(__DOXYGEN__) initLcdController(); +#endif } diff --git a/firmware/controllers/lcd_controller.cpp b/firmware/controllers/lcd_controller.cpp index f2efbe0e87..9da7a47290 100644 --- a/firmware/controllers/lcd_controller.cpp +++ b/firmware/controllers/lcd_controller.cpp @@ -23,6 +23,8 @@ #include "settings.h" #include "injector_central.h" +#if EFI_HD44780_LCD || defined(__DOXYGEN__) + EXTERN_ENGINE ; @@ -329,3 +331,5 @@ void updateHD44780lcd(Engine *engine) { // lcd_HD44780_print_string(dateBuffer); //#endif /* EFI_PROD_CODE */ } + +#endif diff --git a/firmware/controllers/trigger/trigger_structure.cpp b/firmware/controllers/trigger/trigger_structure.cpp index 3e53827f88..3faff5969d 100644 --- a/firmware/controllers/trigger/trigger_structure.cpp +++ b/firmware/controllers/trigger/trigger_structure.cpp @@ -277,8 +277,10 @@ void setToothedWheelConfiguration(TriggerShape *s, int total, int skipped, // todo: move to into configuration definition s->needSecondTriggerInput = false; s->useRiseEdge = true; +#if EFI_ENGINE_CONTROL initializeSkippedToothTriggerShapeExt(s, s->totalToothCount, s->skippedToothCount, getOperationMode(engineConfiguration)); +#endif } void setTriggerSynchronizationGap2(TriggerShape *s, float syncGapFrom, float syncRatioTo) { diff --git a/firmware/hw_layer/hardware.cpp b/firmware/hw_layer/hardware.cpp index a7db7e8e30..ef416eb5d3 100644 --- a/firmware/hw_layer/hardware.cpp +++ b/firmware/hw_layer/hardware.cpp @@ -159,9 +159,11 @@ void adc_callback_fast(ADCDriver *adcp, adcsample_t *buffer, size_t n) { #if EFI_MAP_AVERAGING mapAveragingCallback(fastAdc.samples[fastMapSampleIndex]); #endif /* EFI_MAP_AVERAGING */ +#if EFI_HIP_9011 || defined(__DOXYGEN__) if (boardConfiguration->isHip9011Enabled) { hipAdcCallback(fastAdc.samples[hipSampleIndex]); } +#endif } } @@ -196,12 +198,14 @@ void initHardware(Logging *l, Engine *engine) { initHistogramsModule(); #endif /* EFI_HISTOGRAMS */ +#if EFI_SHAFT_POSITION_INPUT || defined(__DOXYGEN__) /** * This is so early because we want to init logger * which would be used while finding trigger synch index * while config read */ initTriggerDecoderLogger(sharedLogger); +#endif /** * We need the LED_ERROR pin even before we read configuration @@ -239,7 +243,9 @@ void initHardware(Logging *l, Engine *engine) { return; } +#if EFI_SHAFT_POSITION_INPUT || defined(__DOXYGEN__) initTriggerDecoder(); +#endif mySetPadMode2("board test", boardConfiguration->boardTestModeJumperPin, PAL_MODE_INPUT_PULLUP); @@ -271,10 +277,11 @@ void initHardware(Logging *l, Engine *engine) { // init_adc_mcp3208(&adcState, &SPID2); // requestAdcValue(&adcState, 0); + +#if EFI_SHAFT_POSITION_INPUT || defined(__DOXYGEN__) // todo: figure out better startup logic initTriggerCentral(sharedLogger, engine); -#if EFI_SHAFT_POSITION_INPUT || defined(__DOXYGEN__) initShaftPositionInputCapture(); #endif /* EFI_SHAFT_POSITION_INPUT */ @@ -327,7 +334,9 @@ void initHardware(Logging *l, Engine *engine) { // } // } +#if EFI_VEHICLE_SPEED || defined(__DOXYGEN__) initVehicleSpeed(sharedLogger); +#endif initJoystick(sharedLogger); diff --git a/firmware/hw_layer/joystick.cpp b/firmware/hw_layer/joystick.cpp index 6999d7cd84..b2bc786ee4 100644 --- a/firmware/hw_layer/joystick.cpp +++ b/firmware/hw_layer/joystick.cpp @@ -51,7 +51,9 @@ static void extCallback(EXTDriver *extp, expchannel_t channel) { joyD++; button = JB_BUTTON_D; } +#if EFI_HD44780_LCD || defined(__DOXYGEN__) onJoystick(button); +#endif } static void joystickInfo(void) { diff --git a/firmware/rusefi.cpp b/firmware/rusefi.cpp index 1cf31570e8..b2ae7ff8ae 100644 --- a/firmware/rusefi.cpp +++ b/firmware/rusefi.cpp @@ -139,7 +139,9 @@ void runRusEfi(void) { // that's dirty, this assignment should be nicer or in a better spot engine->engineConfiguration = engineConfiguration; +#if EFI_ENGINE_CONTROL || defined(__DOXYGEN__) engine->engineConfiguration2 = engineConfiguration2; +#endif initErrorHandling();