diff --git a/firmware/console/binary/tunerstudio_configuration.h b/firmware/console/binary/tunerstudio_configuration.h index 17e7e532b4..746071f50f 100644 --- a/firmware/console/binary/tunerstudio_configuration.h +++ b/firmware/console/binary/tunerstudio_configuration.h @@ -146,8 +146,10 @@ typedef struct { int timeSeconds; // 224 float engineLoadDelta; // 228 float speedToRpmRatio; // 232 - int warningCounter; // 236 - int lastErrorCode; // 240 + int16_t warningCounter; // 236 + int16_t unused_238; + int16_t lastErrorCode; // 240 + int16_t unused_242; /** * Microcontroller own internal temperature, C */ @@ -169,7 +171,8 @@ typedef struct { float injectionOffset; // 288 int16_t debugIntField4; // 292 int16_t debugIntField5; // 294 - int unused3[15]; + int16_t recentErrorCodes[8]; // 298 + int unused3[11]; /* see also [OutputChannels] in rusefi.input */ } TunerStudioOutputChannels; diff --git a/firmware/console/status_loop.cpp b/firmware/console/status_loop.cpp index 93a231c752..49b0320ce2 100644 --- a/firmware/console/status_loop.cpp +++ b/firmware/console/status_loop.cpp @@ -911,6 +911,9 @@ void updateTunerStudioState(TunerStudioOutputChannels *tsOutputChannels DECLARE_ tsOutputChannels->warningCounter = engine->engineState.warnings.warningCounter; tsOutputChannels->lastErrorCode = engine->engineState.warnings.lastErrorCode; + for (int i = 0; i < 8;i++) { + tsOutputChannels->recentErrorCodes[i] = engine->engineState.warnings.recentWarnings.get(i); + } tsOutputChannels->knockNowIndicator = engine->knockCount > 0; tsOutputChannels->knockEverIndicator = engine->knockEver; diff --git a/firmware/tunerstudio/rusefi.input b/firmware/tunerstudio/rusefi.input index 209bcb9e68..a05fd2130a 100644 --- a/firmware/tunerstudio/rusefi.input +++ b/firmware/tunerstudio/rusefi.input @@ -245,8 +245,10 @@ fileVersion = { 20171101 } debugIntField3 = scalar, U32, 220, "val", 1, 0.0; engineLoadDelta = scalar,F32, 228, "value", 1, 0 speedToRpmRatio = scalar,F32, 232, "value", 1, 0 - warningCounter = scalar,U32, 236, "count", 1, 0 - lastErrorCode = scalar,U32, 240, "error", 1, 0 + warningCounter = scalar,U16, 236, "count", 1, 0 + + lastErrorCode = scalar,U16, 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; @@ -262,6 +264,14 @@ fileVersion = { 20171101 } injectionOffset = scalar, F32, 288, "deg", 1, 0; debugIntField4 = scalar, S16, 292, "val", 1, 0.0; debugIntField5 = scalar, S16, 294, "val", 1, 0.0; + recentErrorCode0 = scalar,U16, 298, "error", 1, 0 + recentErrorCode1 = scalar,U16, 300, "error", 1, 0 + recentErrorCode2 = scalar,U16, 302, "error", 1, 0 + recentErrorCode3 = scalar,U16, 304, "error", 1, 0 + recentErrorCode4 = scalar,U16, 306, "error", 1, 0 + recentErrorCode5 = scalar,U16, 308, "error", 1, 0 + recentErrorCode6 = scalar,U16, 310, "error", 1, 0 + recentErrorCode7 = scalar,U16, 312, "error", 1, 0 ; @@ -729,7 +739,15 @@ fileVersion = { 20171101 } speedToRpmRatioGauge = speedToRpmRatio, "speed2rpm", "", 0, 100, 0, 0, 100, 100, 4, 4 warningCounterGauge = warningCounter, "warn", "", 0, 100, 0, 0, 100, 100, 0, 0 - lastErrorCodeGauge = lastErrorCode, "error", "", 0, 8000, 0, 0, 8000, 8000, 0, 0 + lastErrorCodeGauge = lastErrorCode, "error", "", 0, 18000, 0, 0, 18000, 18000, 0, 0 + recentErrorCode0Gauge = recentErrorCode0, "error", "", 0, 18000, 0, 0, 18000, 18000, 0, 0 + recentErrorCode1Gauge = recentErrorCode1, "error", "", 0, 18000, 0, 0, 18000, 18000, 0, 0 + recentErrorCode2Gauge = recentErrorCode2, "error", "", 0, 18000, 0, 0, 18000, 18000, 0, 0 + recentErrorCode3Gauge = recentErrorCode3, "error", "", 0, 18000, 0, 0, 18000, 18000, 0, 0 + recentErrorCode4Gauge = recentErrorCode4, "error", "", 0, 18000, 0, 0, 18000, 18000, 0, 0 + recentErrorCode5Gauge = recentErrorCode5, "error", "", 0, 18000, 0, 0, 18000, 18000, 0, 0 + recentErrorCode6Gauge = recentErrorCode6, "error", "", 0, 18000, 0, 0, 18000, 18000, 0, 0 + recentErrorCode7Gauge = recentErrorCode7, "error", "", 0, 18000, 0, 0, 18000, 18000, 0, 0 gaugeCategory = Debug debugFloatField1Gauge = debugFloatField1, @@GAUGE_NAME_DEBUG_F1@@, "%", 0, 100, 0, 0, 100, 100, 4, 4 @@ -981,6 +999,14 @@ gaugeCategory = Fuel Data entry = engineMode, "Engine Mode",int,"%d" entry = warningCounter, @@GAUGE_NAME_WARNING_COUNTER@@,int,"%d" entry = lastErrorCode, @@GAUGE_NAME_WARNING_LAST@@,int,"%d" + entry = recentErrorCode0, "error 0",int,"%d" + entry = recentErrorCode1, "error 1",int,"%d" + entry = recentErrorCode2, "error 2",int,"%d" + entry = recentErrorCode3, "error 3",int,"%d" + entry = recentErrorCode4, "error 4",int,"%d" + entry = recentErrorCode5, "error 5",int,"%d" + entry = recentErrorCode6, "error 6",int,"%d" + entry = recentErrorCode7, "error 7",int,"%d" entry = internalMcuTemperature, @@GAUGE_NAME_CPU_TEMP@@,float,"%.2f" entry = tCharge, "tCharge",float,"%.3f" diff --git a/firmware/util/cyclic_buffer.h b/firmware/util/cyclic_buffer.h index 4c15dbc05b..cca2069a45 100644 --- a/firmware/util/cyclic_buffer.h +++ b/firmware/util/cyclic_buffer.h @@ -71,6 +71,7 @@ cyclic_buffer::cyclic_buffer(int size) { template void cyclic_buffer::baseC(int size) { currentIndex = 0; + memset(elements, 0, sizeof(elements)); setSize(size); }