From c0bb907aa320dfdcd1e2c09f41908271e836c07e Mon Sep 17 00:00:00 2001 From: rusefi Date: Sat, 4 Jul 2020 21:32:12 -0400 Subject: [PATCH] idle_min through FSIO not working as intended #1553 FSIO debug outputs progress --- .../controllers/algo/auto_generated_enums.cpp | 18 ++++++++---- firmware/console/binary/tunerstudio.cpp | 2 +- firmware/console/status_loop.cpp | 18 ++++++++++-- .../controllers/algo/auto_generated_enums.cpp | 18 ++++++++---- firmware/controllers/algo/rusefi_enums.h | 8 ++++-- firmware/tunerstudio/rusefi.input | 28 +++++++++---------- firmware/util/math/pid.cpp | 2 +- 7 files changed, 63 insertions(+), 31 deletions(-) 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 41e7259f0b..c1716c340d 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 @@ -1,7 +1,7 @@ #include "global.h" #include "rusefi_enums.h" #include "rusefi_hw_enums.h" -// was generated automatically by rusEfi tool from rusefi_hw_enums.h // was generated automatically by rusEfi tool from rusefi_enums.h // by enum2string.jar tool on Sun Jun 14 18:18:14 EDT 2020 +// was generated automatically by rusEfi tool from rusefi_hw_enums.h // was generated automatically by rusEfi tool from rusefi_enums.h // by enum2string.jar tool on Sat Jul 04 21:11:33 EDT 2020 // see also gen_config_and_enums.bat @@ -460,8 +460,10 @@ case DBG_2: return "DBG_2"; case DBG_34: return "DBG_34"; -case DBG_40: - return "DBG_40"; +case DBG_43: + return "DBG_43"; +case DBG_44: + return "DBG_44"; case DBG_ALTERNATOR_PID: return "DBG_ALTERNATOR_PID"; case DBG_ANALOG_INPUTS: @@ -480,6 +482,8 @@ case DBG_CAN: return "DBG_CAN"; case DBG_CJ125: return "DBG_CJ125"; +case DBG_COMPOSITE_LOG: + return "DBG_COMPOSITE_LOG"; case DBG_CRANKING_DETAILS: return "DBG_CRANKING_DETAILS"; case DBG_DWELL_METRIC: @@ -498,8 +502,12 @@ case DBG_EXECUTOR: return "DBG_EXECUTOR"; case DBG_FSIO_ADC: return "DBG_FSIO_ADC"; -case DBG_FSIO_EXPRESSION: - return "DBG_FSIO_EXPRESSION"; +case DBG_FSIO_EXPRESSION_1_7: + return "DBG_FSIO_EXPRESSION_1_7"; +case DBG_FSIO_EXPRESSION_8_14: + return "DBG_FSIO_EXPRESSION_8_14"; +case DBG_FSIO_SPECIAL: + return "DBG_FSIO_SPECIAL"; case DBG_FUEL_PID_CORRECTION: return "DBG_FUEL_PID_CORRECTION"; case DBG_IDLE_CONTROL: diff --git a/firmware/console/binary/tunerstudio.cpp b/firmware/console/binary/tunerstudio.cpp index 9ff2e5f9c0..96291d3320 100644 --- a/firmware/console/binary/tunerstudio.cpp +++ b/firmware/console/binary/tunerstudio.cpp @@ -858,7 +858,7 @@ int tunerStudioHandleCrcCommand(ts_channel_s *tsChannel, char *data, int incomin int currentEnd = getCompositeRecordCount(); // set debug_mode 40 - if (engineConfiguration->debugMode == DBG_40) { + if (engineConfiguration->debugMode == DBG_COMPOSITE_LOG) { tsOutputChannels.debugIntField1 = currentEnd; tsOutputChannels.debugIntField2 = transmitted; diff --git a/firmware/console/status_loop.cpp b/firmware/console/status_loop.cpp index 16b539ce2a..6f4184723e 100644 --- a/firmware/console/status_loop.cpp +++ b/firmware/console/status_loop.cpp @@ -756,8 +756,8 @@ void updateTunerStudioState(TunerStudioOutputChannels *tsOutputChannels DECLARE_ tsOutputChannels->debugFloatField1 = getVoltage("fsio", engineConfiguration->fsioAdc[0] PASS_ENGINE_PARAMETER_SUFFIX); } break; - case DBG_FSIO_EXPRESSION: -#if EFI_PROD_CODE && EFI_FSIO + case DBG_FSIO_EXPRESSION_1_7: +#if EFI_FSIO tsOutputChannels->debugFloatField1 = getFsioOutputValue(0 PASS_ENGINE_PARAMETER_SUFFIX); tsOutputChannels->debugFloatField2 = getFsioOutputValue(1 PASS_ENGINE_PARAMETER_SUFFIX); tsOutputChannels->debugFloatField3 = getFsioOutputValue(2 PASS_ENGINE_PARAMETER_SUFFIX); @@ -765,8 +765,20 @@ void updateTunerStudioState(TunerStudioOutputChannels *tsOutputChannels DECLARE_ tsOutputChannels->debugFloatField5 = getFsioOutputValue(4 PASS_ENGINE_PARAMETER_SUFFIX); tsOutputChannels->debugFloatField6 = getFsioOutputValue(5 PASS_ENGINE_PARAMETER_SUFFIX); tsOutputChannels->debugFloatField7 = getFsioOutputValue(6 PASS_ENGINE_PARAMETER_SUFFIX); -#endif /* EFI_FSIO */ break; + case DBG_FSIO_EXPRESSION_8_14: + tsOutputChannels->debugFloatField1 = getFsioOutputValue(7 PASS_ENGINE_PARAMETER_SUFFIX); + tsOutputChannels->debugFloatField2 = getFsioOutputValue(8 PASS_ENGINE_PARAMETER_SUFFIX); + tsOutputChannels->debugFloatField3 = getFsioOutputValue(9 PASS_ENGINE_PARAMETER_SUFFIX); + tsOutputChannels->debugFloatField4 = getFsioOutputValue(10 PASS_ENGINE_PARAMETER_SUFFIX); + tsOutputChannels->debugFloatField5 = getFsioOutputValue(11 PASS_ENGINE_PARAMETER_SUFFIX); + tsOutputChannels->debugFloatField6 = getFsioOutputValue(12 PASS_ENGINE_PARAMETER_SUFFIX); + tsOutputChannels->debugFloatField7 = getFsioOutputValue(13 PASS_ENGINE_PARAMETER_SUFFIX); + break; + case DBG_FSIO_SPECIAL: + tsOutputChannels->debugFloatField1 = ENGINE(fsioState.fsioIdleOffset); + tsOutputChannels->debugFloatField2 = ENGINE(fsioState.fsioIdleMinValue); +#endif /* EFI_FSIO */ case DBG_VEHICLE_SPEED_SENSOR: tsOutputChannels->debugIntField1 = engine->engineState.vssEventCounter; break; diff --git a/firmware/controllers/algo/auto_generated_enums.cpp b/firmware/controllers/algo/auto_generated_enums.cpp index d3c34e8dd9..0b31355cb7 100644 --- a/firmware/controllers/algo/auto_generated_enums.cpp +++ b/firmware/controllers/algo/auto_generated_enums.cpp @@ -1,7 +1,7 @@ #include "global.h" #include "rusefi_enums.h" #include "rusefi_hw_enums.h" -// was generated automatically by rusEfi tool from rusefi_hw_enums.h // was generated automatically by rusEfi tool from rusefi_enums.h // by enum2string.jar tool on Sun Jun 14 17:00:25 EDT 2020 +// was generated automatically by rusEfi tool from rusefi_hw_enums.h // was generated automatically by rusEfi tool from rusefi_enums.h // by enum2string.jar tool on Sat Jul 04 21:11:32 EDT 2020 // see also gen_config_and_enums.bat @@ -598,8 +598,10 @@ case DBG_2: return "DBG_2"; case DBG_34: return "DBG_34"; -case DBG_40: - return "DBG_40"; +case DBG_43: + return "DBG_43"; +case DBG_44: + return "DBG_44"; case DBG_ALTERNATOR_PID: return "DBG_ALTERNATOR_PID"; case DBG_ANALOG_INPUTS: @@ -618,6 +620,8 @@ case DBG_CAN: return "DBG_CAN"; case DBG_CJ125: return "DBG_CJ125"; +case DBG_COMPOSITE_LOG: + return "DBG_COMPOSITE_LOG"; case DBG_CRANKING_DETAILS: return "DBG_CRANKING_DETAILS"; case DBG_DWELL_METRIC: @@ -636,8 +640,12 @@ case DBG_EXECUTOR: return "DBG_EXECUTOR"; case DBG_FSIO_ADC: return "DBG_FSIO_ADC"; -case DBG_FSIO_EXPRESSION: - return "DBG_FSIO_EXPRESSION"; +case DBG_FSIO_EXPRESSION_1_7: + return "DBG_FSIO_EXPRESSION_1_7"; +case DBG_FSIO_EXPRESSION_8_14: + return "DBG_FSIO_EXPRESSION_8_14"; +case DBG_FSIO_SPECIAL: + return "DBG_FSIO_SPECIAL"; case DBG_FUEL_PID_CORRECTION: return "DBG_FUEL_PID_CORRECTION"; case DBG_IDLE_CONTROL: diff --git a/firmware/controllers/algo/rusefi_enums.h b/firmware/controllers/algo/rusefi_enums.h index 41b992e248..ed4f81e8d2 100644 --- a/firmware/controllers/algo/rusefi_enums.h +++ b/firmware/controllers/algo/rusefi_enums.h @@ -719,7 +719,7 @@ typedef enum { DBG_ANALOG_INPUTS = 21, DBG_INSTANT_RPM = 22, - DBG_FSIO_EXPRESSION = 23, + DBG_FSIO_EXPRESSION_1_7 = 23, DBG_STATUS = 24, DBG_CJ125 = 25, DBG_CAN = 26, @@ -739,7 +739,11 @@ typedef enum { DBG_START_STOP = 37, DBG_LAUNCH = 38, DBG_ETB_AUTOTUNE = 39, - DBG_40 = 40, + DBG_COMPOSITE_LOG = 40, + DBG_FSIO_EXPRESSION_8_14 = 41, + DBG_FSIO_SPECIAL = 42, + DBG_43 = 43, + DBG_44 = 44, Force_4_bytes_size_debug_mode_e = ENUM_32_BITS, } debug_mode_e; diff --git a/firmware/tunerstudio/rusefi.input b/firmware/tunerstudio/rusefi.input index 81c55fb6c6..4d2d5916b3 100644 --- a/firmware/tunerstudio/rusefi.input +++ b/firmware/tunerstudio/rusefi.input @@ -397,21 +397,21 @@ 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 -; Alternator TPS Acceleration Warmup-Pid Idle Engine Load Acc Trigger Counters VVT Cranking Ignition Timing ETB PID CJ125 CAN TLE8888 Analog inputs 2 Boost Start Launcher ETB Autotune - 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", "", "23:df1", "CJ125: output", "", "", "", "", "", "", "TPS1 Pri/Sec Diff", "", "", "", "Boost Open Loop Duty", "S unused" "", "Osc Amplitude" - 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", "", "23:df2", "CJ125: i-term", "", "", "", "", "", "", "TPS2 Pri/Sec Diff", "", "", "", "Boost Closed Loop Duty","S unused" "", "Duty Amplitude" - debugFieldF3List = bits, U08, [0:7], "Previous Error", "Current TPS<>TPS", "", "", "Idle df3", "ICU sum", "", "", "", "", "Ign FSIO Adj", "", "", "", "", "", "", "ETB err", "", "", "df3", "df3", "22df3", "", "23:df3", "CJ125: err", "", "", "", "", "", "", "", "", "", "", "", "S unused" "", "Tu" - debugFieldF4List = bits, U08, [0:7], "I Gain", "Extra Fuel", "", "", "Idle df4", "VVT rise", "", "", "", "", "Ign PID Adj", "", "", "", "", "", "", "ETB I setting", "", "", "df4", "df4", "22df4", "", "23:df4", "CJ125: UA", "", "", "", "", "", "", "", "", "", "", "", "S unused" "", "Ku" - debugFieldF5List = bits, U08, [0:7], "D Gain", "df5", "df5", "df5", "Idle df5", "VVT fall", "df5", "", "", "", "", "", "", "", "", "", "", "ETB D setting", "df5", "df5", "df5", "df5", "22df5", "", "23:df5", "CJ125: UR", "", "", "", "", "", "", "", "", "", "", "", "S unused" "", "Kp" - debugFieldF6List = bits, U08, [0:7], "D Term", "", "", "", "Idle df6", "Current Gap", "", "", "", "", "", "", "", "", "", "", "", "ETB df6", "", "", "df6", "df6", "22df6", "", "23:df6", "cj: f7", "", "", "", "", "", "", "", "", "", "", "", "S unused" "", "Ki" - debugFieldF7List = bits, U08, [0:7], "Max-Value", "", "", "", "Idle df7", "", "", "", "", "", "", "", "", "", "", "", "", "ETB df7", "", "", "df7", "df7", "22df7", "", "23:df7", "cj: f7", "", "", "", "", "", "", "", "", "", "", "", "S unused" "", "Kd" +; 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 + 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", "", "", "Idle df3", "ICU sum", "", "", "", "", "Ign FSIO Adj", "", "", "", "", "", "", "ETB err", "", "", "df3", "df3", "22df3", "fsio 3", "24:df3", "CJ125: err", "", "", "", "", "", "", "", "", "", "", "", "S unused" "", "Tu", "", "fsio 10", "", "" + debugFieldF4List = bits, U08, [0:7], "I Gain", "Extra Fuel", "", "", "Idle df4", "VVT rise", "", "", "", "", "Ign PID Adj", "", "", "", "", "", "", "ETB I setting", "", "", "df4", "df4", "22df4", "fsio 4", "24:df4", "CJ125: UA", "", "", "", "", "", "", "", "", "", "", "", "S unused" "", "Ku", "", "fsio 11", "", "" + debugFieldF5List = bits, U08, [0:7], "D Gain", "df5", "df5", "df5", "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", "", "", "", "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", "", "", "", "Idle df7", "", "", "", "", "", "", "", "", "", "", "", "", "ETB df7", "", "", "df7", "df7", "22df7", "fsio 7", "24:df7", "cj: f7", "", "", "", "", "", "", "", "", "", "", "", "S unused" "", "Kd", "", "fsio 14", "", "" - debugFieldI1List = bits, U08, [0:7], "P-Gain", "", "", "", "Idle di1", "Channel 1 Fall Counter", "", "", "VVT Sync Counter", "", "Multispark Count", "", "", "", "", "", "", "ETB P-Gain", "", "", "di1", "di1", "22di1", "", "23:di1", "CJ125: state", "read count","", "", "", "", "SPI Counter", "", "", "", "", "", "Start Count" "", "" - debugFieldI2List = bits, U08, [0:7], "Offset", "", "", "", "Idle di2", "Channel 2 Fall Counter", "", "", "", "", "", "", "", "", "", "", "", "ETB di2", "", "", "di2", "di2", "22di2", "", "23:di2", "", "write count","", "", "", "", "Latest Transmit","", "", "", "", "", "S unused" "", "" - debugFieldI3List = bits, U08, [0:7], "", "", "", "", "Idle di3", "Cycle Index", "", "", "", "", "", "", "", "", "", "", "", "ETB di3", "", "", "di3", "di3", "22di3", "", "23:di3", "", "write err", "", "", "", "", "Latest Received","", "", "", "", "", "S unused" "", "" - debugFieldI4List = bits, U08, [0:7], "", "", "", "", "Idle di4", "Cycle Cnt 1", "", "", "", "", "", "", "", "", "", "", "", "ETB di4", "", "", "di4", "di4", "22di4", "", "23:di4", "", "", "", "", "", "", "Init Count", "", "", "", "", "", "S unused" "", "" - debugFieldI5List = bits, U08, [0:7], "", "", "", "", "Idle di5", "Cycle Cnt 2", "", "", "", "", "", "", "", "", "", "di5", "di5", "ETB di5", "di5", "di5", "di5", "di5", "22di5", "di5", "di5", "di5", "di5", "di5", "di5", "di5", "di5", "di5", "", "di5", "di5", "di5", "di5", "S di5" "", "" + debugFieldI1List = bits, U08, [0:7], "P-Gain", "", "", "", "Idle di1", "Channel 1 Fall Counter", "", "", "VVT Sync Counter", "", "Multispark Count", "", "", "", "", "", "", "ETB P-Gain", "", "", "di1", "di1", "22di1", "", "24:di1", "CJ125: state", "read count","", "", "", "", "SPI Counter", "", "", "", "", "", "Start Count" "", "", "", "", "", "" + debugFieldI2List = bits, U08, [0:7], "Offset", "", "", "", "Idle di2", "Channel 2 Fall Counter", "", "", "", "", "", "", "", "", "", "", "", "ETB di2", "", "", "di2", "di2", "22di2", "", "24:di2", "", "write count","", "", "", "", "Latest Transmit","", "", "", "", "", "S unused" "", "", "", "", "", "" + debugFieldI3List = bits, U08, [0:7], "", "", "", "", "Idle di3", "Cycle Index", "", "", "", "", "", "", "", "", "", "", "", "ETB di3", "", "", "di3", "di3", "22di3", "", "24:di3", "", "write err", "", "", "", "", "Latest Received","", "", "", "", "", "S unused" "", "", "", "", "", "" + debugFieldI4List = bits, U08, [0:7], "", "", "", "", "Idle di4", "Cycle Cnt 1", "", "", "", "", "", "", "", "", "", "", "", "ETB di4", "", "", "di4", "di4", "22di4", "", "24:di4", "", "", "", "", "", "", "Init Count", "", "", "", "", "", "S unused" "", "", "", "", "", "" + debugFieldI5List = bits, U08, [0:7], "", "", "", "", "Idle di5", "Cycle Cnt 2", "", "", "", "", "", "", "", "", "", "di5", "di5", "ETB di5", "di5", "di5", "di5", "di5", "22di5", "di5", "di5", "di5", "di5", "di5", "di5", "di5", "di5", "di5", "", "di5", "di5", "di5", "di5", "S di5" "", "", "", "", "", "" [ConstantsExtensions] ; defaultValue is used to provide TunerStudio with a value to use in the case of diff --git a/firmware/util/math/pid.cpp b/firmware/util/math/pid.cpp index 937c5afa67..034c5db0b4 100644 --- a/firmware/util/math/pid.cpp +++ b/firmware/util/math/pid.cpp @@ -273,7 +273,7 @@ float PidIndustrial::getOutput(float target, float input, float dTime) { dTerm = dTerm * ad + (error - previousError) * bd; // calculate output and apply the limits - float output = pTerm + iTerm + dTerm + parameters->offset; + float output = pTerm + iTerm + dTerm + getOffset(); float limitedOutput = limitOutput(output); // apply the integrator anti-windup