diff --git a/firmware/config/boards/hellen/cypress/config/controllers/algo/auto_generated_enums.cpp b/firmware/config/boards/hellen/cypress/config/controllers/algo/auto_generated_enums.cpp index 8d1af110da..7fc06f919b 100644 --- a/firmware/config/boards/hellen/cypress/config/controllers/algo/auto_generated_enums.cpp +++ b/firmware/config/boards/hellen/cypress/config/controllers/algo/auto_generated_enums.cpp @@ -675,8 +675,8 @@ const char *getDebug_mode_e(debug_mode_e value){ switch(value) { case DBG_16: return "DBG_16"; -case DBG_2: - return "DBG_2"; +case DBG_GPWWM: + return "DBG_GPWWM"; case DBG_34: return "DBG_34"; case DBG_43: diff --git a/firmware/config/boards/kinetis/config/controllers/algo/auto_generated_enums.cpp b/firmware/config/boards/kinetis/config/controllers/algo/auto_generated_enums.cpp index 49e716a93b..aa045ee7ff 100644 --- a/firmware/config/boards/kinetis/config/controllers/algo/auto_generated_enums.cpp +++ b/firmware/config/boards/kinetis/config/controllers/algo/auto_generated_enums.cpp @@ -471,8 +471,8 @@ const char *getDebug_mode_e(debug_mode_e value){ switch(value) { case DBG_16: return "DBG_16"; -case DBG_2: - return "DBG_2"; +case DBG_GPWWM: + return "DBG_GPWWM"; case DBG_34: return "DBG_34"; case DBG_43: diff --git a/firmware/controllers/actuators/gppwm/gppwm.cpp b/firmware/controllers/actuators/gppwm/gppwm.cpp index 8ed3b5a9cd..782cc52fbb 100644 --- a/firmware/controllers/actuators/gppwm/gppwm.cpp +++ b/firmware/controllers/actuators/gppwm/gppwm.cpp @@ -50,7 +50,17 @@ void initGpPwm(DECLARE_ENGINE_PARAMETER_SIGNATURE) { } void updateGppwm() { + // There are only 8 debug float fields, this will overflow if more channels + static_assert(efi::size(channels) <= 8); + for (size_t i = 0; i < efi::size(channels); i++) { - channels[i].update(); + float result = channels[i].update(); + +#ifdef EFI_TUNER_STUDIO + if (CONFIG(debugMode) == DBG_GPPWM) { + float* debugFloats = &tsOutputChannels.debugFloatField1; + debugFloats[i] = result; + } +#endif } } diff --git a/firmware/controllers/actuators/gppwm/gppwm_channel.cpp b/firmware/controllers/actuators/gppwm/gppwm_channel.cpp index b9de30124b..d9cc91650f 100644 --- a/firmware/controllers/actuators/gppwm/gppwm_channel.cpp +++ b/firmware/controllers/actuators/gppwm/gppwm_channel.cpp @@ -86,12 +86,13 @@ percent_t GppwmChannel::getOutput() const { return result; } -void GppwmChannel::update() { +float GppwmChannel::update() { // Without a config, nothing to do. if (!m_config) { - return; + return 0; } float output = getOutput(); setOutput(output); + return output; } diff --git a/firmware/controllers/actuators/gppwm/gppwm_channel.h b/firmware/controllers/actuators/gppwm/gppwm_channel.h index 9499afb909..3354d95cc8 100644 --- a/firmware/controllers/actuators/gppwm/gppwm_channel.h +++ b/firmware/controllers/actuators/gppwm/gppwm_channel.h @@ -11,7 +11,7 @@ public: DECLARE_ENGINE_PTR; void init(bool usePwm, SimplePwm* pwm, OutputPin* outputPin, const ValueProvider3D* table, const gppwm_channel* config); - void update(); + float update(); percent_t getOutput() const; void setOutput(float result); diff --git a/firmware/controllers/algo/auto_generated_enums.cpp b/firmware/controllers/algo/auto_generated_enums.cpp index 4a6e9e24c9..cf0f8b3c66 100644 --- a/firmware/controllers/algo/auto_generated_enums.cpp +++ b/firmware/controllers/algo/auto_generated_enums.cpp @@ -611,8 +611,8 @@ const char *getDebug_mode_e(debug_mode_e value){ switch(value) { case DBG_16: return "DBG_16"; -case DBG_2: - return "DBG_2"; +case DBG_GPPWM: + return "DBG_GPPWM"; case DBG_34: return "DBG_34"; case DBG_43: diff --git a/firmware/controllers/algo/rusefi_enums.h b/firmware/controllers/algo/rusefi_enums.h index 427a9aae41..dfe1b643e8 100644 --- a/firmware/controllers/algo/rusefi_enums.h +++ b/firmware/controllers/algo/rusefi_enums.h @@ -697,7 +697,7 @@ typedef brain_pin_e output_pin_e; typedef enum { DBG_ALTERNATOR_PID = 0, DBG_TPS_ACCEL = 1, - DBG_2 = 2, + DBG_GPPWM = 2, DBG_IDLE_CONTROL = 3, DBG_EL_ACCEL = 4, DBG_TRIGGER_COUNTERS = 5, diff --git a/firmware/integration/rusefi_config.txt b/firmware/integration/rusefi_config.txt index a092f8fcbf..2bcd8870f8 100644 --- a/firmware/integration/rusefi_config.txt +++ b/firmware/integration/rusefi_config.txt @@ -268,7 +268,7 @@ float baseFuel;+Base duration of the fuel injection during cranking, this is mod int16_t rpm;+This sets the RPM limit below which the ECU will use cranking fuel and ignition logic, typically this is around 350-450rpm. \nset cranking_rpm X;"RPM", 1, 0, 0, 3000, 0 end_struct -#define debug_mode_e_enum "Alternator PID", "TPS acceleration enrichment", "INVALID", "Idle Control", "Engine Load accl enrich", "Trigger Counters", "FSIO_ADC", "AUX_PID_1", "VVT input", "Cranking", "Timing", "Closed-loop fuel corr PID", "VSS", "SD card", "sr5", "Knock", "mode16", "Electronic Throttle", "Executor", "Bench Test / TS commands", "Aux Valves", "Analog inputs #1", "INSTANT_RPM", "FSIO_EXPRESSION_1_7", "Status", "CJ125", "CAN", "MAP", "Metrics", "ETB#2", "Ion Sense", "TLE8888", "Analog inputs #2", "Dwell Metric", "INVALID", "ETB Logic", "Boost Control", "Start/Stop", "Launch", "ETB Autotune", "FSIO_COMPOSITE_LOG", "FSIO_EXPRESSION_8_14", "FSIO_SPECIAL", "Mode43", "Mode44" +#define debug_mode_e_enum "Alternator PID", "TPS acceleration enrichment", "GPPWM", "Idle Control", "Engine Load accl enrich", "Trigger Counters", "FSIO_ADC", "AUX_PID_1", "VVT input", "Cranking", "Timing", "Closed-loop fuel corr PID", "VSS", "SD card", "sr5", "Knock", "mode16", "Electronic Throttle", "Executor", "Bench Test / TS commands", "Aux Valves", "Analog inputs #1", "INSTANT_RPM", "FSIO_EXPRESSION_1_7", "Status", "CJ125", "CAN", "MAP", "Metrics", "ETB#2", "Ion Sense", "TLE8888", "Analog inputs #2", "Dwell Metric", "INVALID", "ETB Logic", "Boost Control", "Start/Stop", "Launch", "ETB Autotune", "FSIO_COMPOSITE_LOG", "FSIO_EXPRESSION_8_14", "FSIO_SPECIAL", "Mode43", "Mode44" custom debug_mode_e 4 bits, U32, @OFFSET@, [0:5], @@debug_mode_e_enum@@ #define vvt_mode_e_enum "Inactive", "Single Tooth Second Half", "2GZ", "Miata NB2", "Single Tooth First Half", "Bosch Quick Start", "4/1", "mode7" diff --git a/firmware/tunerstudio/rusefi.input b/firmware/tunerstudio/rusefi.input index 2e9952ad7f..c54add81e4 100644 --- a/firmware/tunerstudio/rusefi.input +++ b/firmware/tunerstudio/rusefi.input @@ -397,12 +397,12 @@ enable2ndByteCanID = false ; wall of debug mode :) ; https://rusefi.com/wiki/index.php?title=Manual:Debug_fields ; 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 -; Alternator TPS Acceleration Warmup-Pid Idle Engine Load Acc Trigger Counters VVT Cranking Ignition Timing ETB PID FSIO_1_7 CJ125 CAN TLE8888 Analog inputs 2 Boost Start Launcher ETB Autotune FSIO_8_14 FSIO_SPECIAL -; DBG_ALTERNATOR_PID DBG_TPS_ACCEL DBG_2 DBG_IDLE_CONTROL - debugFieldF1List = bits, U08, [0:7], "Controller Output", "From TPS", "", "Controller Output", "Idle output", "Channel 1 Rise Counter", "", "", "VVT Event Position","", "Ign IAT Corr", "", "", "", "", "", "", "ETB Controller Output", "", "", "df1", "df1", "22df1", "fsio 1", "24:df1", "CJ125: output", "", "", "", "", "", "", "TPS1 Pri/Sec Diff", "", "", "", "Boost Open Loop Duty", "S unused" "", "Osc Amplitude", "", "fsio 8", "idle offset","" - debugFieldF2List = bits, U08, [0:7], "I-Term", "To TPS", "", "I-Term", "Idle df2", "Channel 2 Rise Counter", "", "", "VVT Ratio", "", "Ign CLT Corr", "", "", "", "", "", "", "ETB I-Term", "", "", "df2", "df2", "22df2", "fsio 2", "24:df2", "CJ125: i-term", "", "", "", "", "", "", "TPS2 Pri/Sec Diff", "", "", "", "Boost Closed Loop Duty","S unused" "", "Duty Amplitude", "", "fsio 9", "idle min", "" - debugFieldF3List = bits, U08, [0:7], "Previous Error", "Current TPS<>TPS", "", "prev error", "Idle df3", "ICU sum", "", "", "", "", "Ign FSIO Adj", "", "", "", "", "", "", "ETB err", "", "", "df3", "df3", "22df3", "fsio 3", "24:df3", "CJ125: err", "", "", "", "", "", "", "TPS1/2 Diff", "", "", "", "", "S unused" "", "Tu", "", "fsio 10", "", "" - debugFieldF4List = bits, U08, [0:7], "I Gain", "Extra Fuel", "", "I Gain", "Idle df4", "VVT rise", "", "", "", "", "Ign PID Adj", "", "", "", "", "", "", "ETB I setting", "", "", "df4", "df4", "22df4", "fsio 4", "24:df4", "CJ125: UA", "", "", "", "", "", "", "Acc Pedal Pri/Sec Diff","", "", "", "", "S unused" "", "Ku", "", "fsio 11", "", "" +; Alternator TPS Acceleration GPPWM Idle Engine Load Acc Trigger Counters VVT Cranking Ignition Timing ETB PID FSIO_1_7 CJ125 CAN TLE8888 Analog inputs 2 Boost Start Launcher ETB Autotune FSIO_8_14 FSIO_SPECIAL +; DBG_ALTERNATOR_PID DBG_TPS_ACCEL DBG_GPPWM DBG_IDLE_CONTROL + debugFieldF1List = bits, U08, [0:7], "Controller Output", "From TPS", "GPPWM 1", "Controller Output", "Idle output", "Channel 1 Rise Counter", "", "", "VVT Event Position","", "Ign IAT Corr", "", "", "", "", "", "", "ETB Controller Output", "", "", "df1", "df1", "22df1", "fsio 1", "24:df1", "CJ125: output", "", "", "", "", "", "", "TPS1 Pri/Sec Diff", "", "", "", "Boost Open Loop Duty", "S unused" "", "Osc Amplitude", "", "fsio 8", "idle offset","" + debugFieldF2List = bits, U08, [0:7], "I-Term", "To TPS", "GPPWM 2", "I-Term", "Idle df2", "Channel 2 Rise Counter", "", "", "VVT Ratio", "", "Ign CLT Corr", "", "", "", "", "", "", "ETB I-Term", "", "", "df2", "df2", "22df2", "fsio 2", "24:df2", "CJ125: i-term", "", "", "", "", "", "", "TPS2 Pri/Sec Diff", "", "", "", "Boost Closed Loop Duty","S unused" "", "Duty Amplitude", "", "fsio 9", "idle min", "" + debugFieldF3List = bits, U08, [0:7], "Previous Error", "Current TPS<>TPS", "GPPWM 3", "prev error", "Idle df3", "ICU sum", "", "", "", "", "Ign FSIO Adj", "", "", "", "", "", "", "ETB err", "", "", "df3", "df3", "22df3", "fsio 3", "24:df3", "CJ125: err", "", "", "", "", "", "", "TPS1/2 Diff", "", "", "", "", "S unused" "", "Tu", "", "fsio 10", "", "" + debugFieldF4List = bits, U08, [0:7], "I Gain", "Extra Fuel", "GPPWM 4", "I Gain", "Idle df4", "VVT rise", "", "", "", "", "Ign PID Adj", "", "", "", "", "", "", "ETB I setting", "", "", "df4", "df4", "22df4", "fsio 4", "24:df4", "CJ125: UA", "", "", "", "", "", "", "Acc Pedal Pri/Sec Diff","", "", "", "", "S unused" "", "Ku", "", "fsio 11", "", "" debugFieldF5List = bits, U08, [0:7], "D Gain", "df5", "df5", "D Gain", "Idle df5", "VVT fall", "df5", "", "", "", "", "", "", "", "", "", "", "ETB D setting", "df5", "df5", "df5", "df5", "22df5", "fsio 5", "24:df5", "CJ125: UR", "", "", "", "", "", "", "", "", "", "", "", "S unused" "", "Kp", "", "fsio 12", "", "" debugFieldF6List = bits, U08, [0:7], "D Term", "", "", "D Term", "Idle df6", "Current Gap", "", "", "", "", "", "", "", "", "", "", "", "ETB df6", "", "", "df6", "df6", "22df6", "fsio 6", "24:df6", "cj: f7", "", "", "", "", "", "", "", "", "", "", "", "S unused" "", "Ki", "", "fsio 13", "", "" debugFieldF7List = bits, U08, [0:7], "Max-Value", "", "", "Max-Value", "Idle df7", "", "", "", "", "", "", "", "", "", "", "", "", "ETB df7", "", "", "df7", "df7", "22df7", "fsio 7", "24:df7", "cj: f7", "", "", "", "", "", "", "", "", "", "", "", "S unused" "", "Kd", "", "fsio 14", "", ""