diff --git a/firmware/console/status_loop.cpp b/firmware/console/status_loop.cpp index 053a1ff848..482b15a27c 100644 --- a/firmware/console/status_loop.cpp +++ b/firmware/console/status_loop.cpp @@ -725,10 +725,6 @@ void updateTunerStudioState(TunerStudioOutputChannels *tsOutputChannels DECLARE_ #endif /* EFI_ANALOG_SENSORS */ tsOutputChannels->engineLoad = engineLoad; - if (engineConfiguration->debugMode == DBG_TRIGGER_INPUT) { - tsOutputChannels->debugFloatField4 = engine->rpmCalculator.getRpmAcceleration(); - } - tsOutputChannels->triggerErrorsCounter = engine->triggerCentral.triggerState.totalTriggerErrorCounter; tsOutputChannels->baroCorrection = engine->engineState.baroCorrection; tsOutputChannels->pedalPosition = hasPedalPositionSensor(PASS_ENGINE_PARAMETER_SIGNATURE) ? getPedalPosition(PASS_ENGINE_PARAMETER_SIGNATURE) : 0; @@ -755,19 +751,22 @@ void updateTunerStudioState(TunerStudioOutputChannels *tsOutputChannels DECLARE_ tsOutputChannels->isWarnNow = isWarningNow(now, true); tsOutputChannels->isCltBroken = engine->isCltBroken; - if (engineConfiguration->debugMode == DBG_TPS_ACCEL) { + switch (engineConfiguration->debugMode) { + case DBG_TPS_ACCEL: tsOutputChannels->debugIntField1 = engine->tpsAccelEnrichment.cb.getSize(); - } else if (engineConfiguration->debugMode == DBG_SR5_PROTOCOL) { - int _10_6 = 100000; + break; + case DBG_SR5_PROTOCOL: { + const int _10_6 = 100000; tsOutputChannels->debugIntField1 = tsState.textCommandCounter * _10_6 + tsState.totalCounter; tsOutputChannels->debugIntField2 = tsState.outputChannelsCommandCounter * _10_6 + tsState.writeValueCommandCounter; tsOutputChannels->debugIntField3 = tsState.readPageCommandsCounter * _10_6 + tsState.burnCommandCounter; - } else if (engineConfiguration->debugMode == DBG__AUX_VALVES) { + break; + } + case DBG_AUX_VALVES: tsOutputChannels->debugFloatField1 = engine->engineState.auxValveStart; tsOutputChannels->debugFloatField2 = engine->engineState.auxValveEnd; - } - - if (engineConfiguration->debugMode == DBG_TRIGGER_INPUT) { + break; + case DBG_TRIGGER_INPUT: tsOutputChannels->debugIntField1 = engine->triggerCentral.getHwEventCounter((int)SHAFT_PRIMARY_FALLING); tsOutputChannels->debugIntField2 = engine->triggerCentral.getHwEventCounter((int)SHAFT_SECONDARY_FALLING); tsOutputChannels->debugIntField3 = engine->triggerCentral.getHwEventCounter((int)SHAFT_3RD_FALLING); @@ -775,28 +774,42 @@ void updateTunerStudioState(TunerStudioOutputChannels *tsOutputChannels DECLARE_ tsOutputChannels->debugFloatField1 = engine->triggerCentral.getHwEventCounter((int)SHAFT_PRIMARY_RISING); tsOutputChannels->debugFloatField2 = engine->triggerCentral.getHwEventCounter((int)SHAFT_SECONDARY_RISING); tsOutputChannels->debugFloatField3 = engine->triggerCentral.getHwEventCounter((int)SHAFT_3RD_RISING); - - } else if (engineConfiguration->debugMode == DBG_FSIO_ADC) { + tsOutputChannels->debugFloatField4 = engine->rpmCalculator.getRpmAcceleration(); + break; + case DBG_FSIO_ADC: // todo: implement a proper loop if (engineConfiguration->fsioAdc[0] != EFI_ADC_NONE) { strcpy(buf, "adcX"); tsOutputChannels->debugFloatField1 = getVoltage("fsio", engineConfiguration->fsioAdc[0]); } - } else if (engineConfiguration->debugMode == DBG_VEHICLE_SPEED_SENSOR) { + break; + case DBG_VEHICLE_SPEED_SENSOR: tsOutputChannels->debugIntField1 = engine->engineState.vssEventCounter; - } else if (engineConfiguration->debugMode == DBG_SD_CARD) { + break; + case DBG_SD_CARD: tsOutputChannels->debugIntField1 = engine->engineState.totalLoggedBytes; - } else if (engineConfiguration->debugMode == DBG_CRANKING_DETAILS) { + break; + case DBG_CRANKING_DETAILS: tsOutputChannels->debugIntField1 = engine->rpmCalculator.getRevolutionCounterSinceStart(); - } - + break; #if EFI_HIP_9011 || defined(__DOXYGEN__) - if (engineConfiguration->debugMode == DBG_KNOCK) { + case DBG_KNOCK: tsOutputChannels->debugIntField1 = correctResponsesCount; tsOutputChannels->debugIntField2 = invalidResponsesCount; - } + break; #endif /* EFI_HIP_9011 */ - + case DBG_ADC: + tsOutputChannels->debugFloatField1 = (engineConfiguration->vbattAdcChannel != EFI_ADC_NONE) ? getVoltageDivided("vbatt", engineConfiguration->vbattAdcChannel) : 0.0f; + tsOutputChannels->debugFloatField2 = (engineConfiguration->tpsAdcChannel != EFI_ADC_NONE) ? getVoltageDivided("tps", engineConfiguration->tpsAdcChannel) : 0.0f; + tsOutputChannels->debugFloatField3 = (engineConfiguration->mafAdcChannel != EFI_ADC_NONE) ? getVoltageDivided("maf", engineConfiguration->mafAdcChannel) : 0.0f; + tsOutputChannels->debugFloatField4 = (engineConfiguration->map.sensor.hwChannel != EFI_ADC_NONE) ? getVoltageDivided("map", engineConfiguration->map.sensor.hwChannel) : 0.0f; + tsOutputChannels->debugFloatField5 = (engineConfiguration->clt.adcChannel != EFI_ADC_NONE) ? getVoltageDivided("clt", engineConfiguration->clt.adcChannel) : 0.0f; + tsOutputChannels->debugFloatField6 = (engineConfiguration->iat.adcChannel != EFI_ADC_NONE) ? getVoltageDivided("iat", engineConfiguration->iat.adcChannel) : 0.0f; + tsOutputChannels->debugFloatField7 = (engineConfiguration->afr.hwChannel != EFI_ADC_NONE) ? getVoltageDivided("ego", engineConfiguration->afr.hwChannel) : 0.0f; + break; + default: + ; + } tsOutputChannels->wallFuelAmount = ENGINE(wallFuel).getWallFuel(0); tsOutputChannels->wallFuelCorrection = ENGINE(wallFuelCorrection); diff --git a/firmware/controllers/algo/rusefi_enums.h b/firmware/controllers/algo/rusefi_enums.h index 9ed66acf1e..18dfdbf5a9 100644 --- a/firmware/controllers/algo/rusefi_enums.h +++ b/firmware/controllers/algo/rusefi_enums.h @@ -723,9 +723,11 @@ typedef enum { DBG_ELECTRONIC_THROTTLE = 17, DBG_EXECUTOR = 18, DBG_BENCH_TEST = 19, - DBG__AUX_VALVES = 20, - DBG__21 = 21, + DBG_AUX_VALVES = 20, + DBG_ADC = 21, + DBG__22 = 22, + DBG__23 = 23, Force_4b_debug_mode_e = ENUM_32_BITS, } debug_mode_e; diff --git a/firmware/integration/rusefi_config.txt b/firmware/integration/rusefi_config.txt index 3efbe1af68..44ee2a5a50 100644 --- a/firmware/integration/rusefi_config.txt +++ b/firmware/integration/rusefi_config.txt @@ -142,7 +142,7 @@ float baseFuel;+Fuel squirt duration while cranking\nA number of curves adjust t int16_t rpm;+Cranking mode threshold. Special cranking logic controls fuel and spark while RPM is below this threshold\nset cranking_rpm X;"RPM", 1, 0, 0, 3000, 0 end_struct -#define debug_mode_e_enum "Alternator_PID", "TPS accel enrich", "Warmup PID", "IDLE", "EL accl enrich", "Trigger Counters", "FSIO_ADC", "AUX_PID_1", "VVT PID", "Cranking", "Timing", "Closed-loop fuel corr", "VSS", "SD card", "sr5", "Knock", "Trigger Sync", "Electronic Throttle", "Executor", "mode19", "mode20", "mode21", "mode22", "mode23", "mode24", "mode25" +#define debug_mode_e_enum "Alternator_PID", "TPS accel enrich", "Warmup PID", "IDLE", "EL accl enrich", "Trigger Counters", "FSIO_ADC", "AUX_PID_1", "VVT PID", "Cranking", "Timing", "Closed-loop fuel corr", "VSS", "SD card", "sr5", "Knock", "Trigger Sync", "Electronic Throttle", "Executor", "Bench Test", "Aux Valves", "ADC", "mode22", "mode23", "mode24", "mode25" custom debug_mode_e 4 bits, U32, @OFFSET@, [0:4], @@debug_mode_e_enum@@ #define vvt_mode_e_enum "First half", "Second half", "2GZ", "Miata NB2", "mode4", "mode5", "mode6", "mode7"