diff --git a/firmware/console/binary/tunerstudio_configuration.h b/firmware/console/binary/tunerstudio_configuration.h index e2de28d851..271062df84 100644 --- a/firmware/console/binary/tunerstudio_configuration.h +++ b/firmware/console/binary/tunerstudio_configuration.h @@ -133,7 +133,9 @@ typedef struct { float internalMcuTemperature; // 244 float vvtPosition; // 248 int engineMode; // 252 - int unused3[5]; + float debugFloatField6; // 256 + float debugFloatField7; // 260 + int unused3[3]; } TunerStudioOutputChannels; #endif /* TUNERSTUDIO_CONFIGURATION_H_ */ diff --git a/firmware/controllers/math/pid.cpp b/firmware/controllers/math/pid.cpp index cb2e35f6b1..ceb2706ac2 100644 --- a/firmware/controllers/math/pid.cpp +++ b/firmware/controllers/math/pid.cpp @@ -23,7 +23,7 @@ void Pid::init(pid_s *pid, float minResult, float maxResult) { this->minResult = minResult; this->maxResult = maxResult; - iTerm = 0; + dTerm = iTerm = 0; prevError = 0; } @@ -37,7 +37,7 @@ float Pid::getValue(float target, float input, float dTime) { float pTerm = pid->pFactor * error; iTerm += pid->iFactor * dTime * error; - float dTerm = pid->dFactor / dTime * (error - prevError); + dTerm = pid->dFactor / dTime * (error - prevError); prevError = error; @@ -90,11 +90,12 @@ float Pid::getOffset(void) { #if EFI_PROD_CODE || EFI_SIMULATOR void Pid::postState(TunerStudioOutputChannels *tsOutputChannels) { - tsOutputChannels->debugFloatField2 = getIntegration(); + tsOutputChannels->debugFloatField2 = iTerm; tsOutputChannels->debugFloatField3 = getPrevError(); tsOutputChannels->debugFloatField4 = getI(); tsOutputChannels->debugFloatField5 = getD(); tsOutputChannels->debugIntField1 = getP(); tsOutputChannels->debugIntField2 = getOffset(); + tsOutputChannels->debugFloatField6 = dTerm; } #endif diff --git a/firmware/controllers/math/pid.h b/firmware/controllers/math/pid.h index abd876abfb..8889b90aef 100644 --- a/firmware/controllers/math/pid.h +++ b/firmware/controllers/math/pid.h @@ -40,6 +40,7 @@ private: float maxResult; float iTerm; + float dTerm; // we are remembering this only for debugging purposes float prevError; }; diff --git a/firmware/rusefi.cpp b/firmware/rusefi.cpp index 4f416f33d2..9edf10a613 100644 --- a/firmware/rusefi.cpp +++ b/firmware/rusefi.cpp @@ -293,5 +293,5 @@ 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 - return 20160917; + return 20160920; } diff --git a/firmware/tunerstudio/rusefi.ini b/firmware/tunerstudio/rusefi.ini index 8d12a9e184..daf78b2fe6 100644 --- a/firmware/tunerstudio/rusefi.ini +++ b/firmware/tunerstudio/rusefi.ini @@ -42,7 +42,7 @@ enable2ndByteCanID = false ; see PAGE_0_SIZE in C source code ; CONFIG_DEFINITION_START -; this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Sat Sep 17 20:34:09 EDT 2016 +; this section was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Tue Sep 20 20:27:19 EDT 2016 pageSize = 16376 page = 1 @@ -875,6 +875,9 @@ fileVersion = { 20160702 } lastErrorCode = scalar,U32, 240, "error", 1, 0 internalMcuTemperature = scalar,F32, 244, "C", 1, 0 vvtPosition = scalar,F32, 248, "deg", 1, 0 + engineMode = scalar, U32, 252, "em", 1, 0.0; + debugFloatField6 = scalar, F32, 256, "val", 1, 0.0; + debugFloatField7 = scalar, F32, 260, "val", 1, 0.0; egoCorrection = { 100 } time = { timeNow } @@ -1281,6 +1284,12 @@ fileVersion = { 20160702 } ; Alternator_PID: D setting entry = debugFloatField5, "debug f5",float,"%.4f" +; Alternator_PID: dTerm + entry = debugFloatField6, "debug f6",float,"%.4f" + + entry = debugFloatField7, "debug f7",float,"%.4f" + + ; Alternator_PID: P setting entry = debugIntField1, "debug i1",int,"%d" @@ -1289,6 +1298,8 @@ fileVersion = { 20160702 } ; Alternator_PID: PID reset counter entry = debugIntField3, "debug i3",int,"%d" + + entry = engineMode, "mode",int,"%d" entry = warningCounter, "warn",int,"%d" entry = lastErrorCode, "error",int,"%d" entry = internalMcuTemperature, "int temp",float,"%.2f" diff --git a/firmware/tunerstudio/rusefi.input b/firmware/tunerstudio/rusefi.input index b633cc2681..5e61568090 100644 --- a/firmware/tunerstudio/rusefi.input +++ b/firmware/tunerstudio/rusefi.input @@ -848,6 +848,9 @@ fileVersion = { 20160702 } lastErrorCode = scalar,U32, 240, "error", 1, 0 internalMcuTemperature = scalar,F32, 244, "C", 1, 0 vvtPosition = scalar,F32, 248, "deg", 1, 0 + engineMode = scalar, U32, 252, "em", 1, 0.0; + debugFloatField6 = scalar, F32, 256, "val", 1, 0.0; + debugFloatField7 = scalar, F32, 260, "val", 1, 0.0; egoCorrection = { 100 } time = { timeNow } @@ -1254,6 +1257,12 @@ fileVersion = { 20160702 } ; Alternator_PID: D setting entry = debugFloatField5, "debug f5",float,"%.4f" +; Alternator_PID: dTerm + entry = debugFloatField6, "debug f6",float,"%.4f" + + entry = debugFloatField7, "debug f7",float,"%.4f" + + ; Alternator_PID: P setting entry = debugIntField1, "debug i1",int,"%d" @@ -1262,6 +1271,8 @@ fileVersion = { 20160702 } ; Alternator_PID: PID reset counter entry = debugIntField3, "debug i3",int,"%d" + + entry = engineMode, "mode",int,"%d" entry = warningCounter, "warn",int,"%d" entry = lastErrorCode, "error",int,"%d" entry = internalMcuTemperature, "int temp",float,"%.2f"