From 6da29c337da1dc54ee09bf0cceaefd7a2fb83b88 Mon Sep 17 00:00:00 2001 From: rusEfi Date: Sun, 9 Oct 2016 19:03:51 -0400 Subject: [PATCH] auto-sync --- firmware/console/status_loop.cpp | 2 +- firmware/controllers/algo/error_handling.h | 2 +- firmware/controllers/algo/obd_error_codes.h | 2 +- firmware/controllers/error_handling.cpp | 10 +++++++--- firmware/controllers/trigger/spark_logic.cpp | 11 +++-------- firmware/rusefi.cpp | 2 +- 6 files changed, 14 insertions(+), 15 deletions(-) diff --git a/firmware/console/status_loop.cpp b/firmware/console/status_loop.cpp index b5690062a6..6a00725683 100644 --- a/firmware/console/status_loop.cpp +++ b/firmware/console/status_loop.cpp @@ -688,7 +688,7 @@ void updateTunerStudioState(TunerStudioOutputChannels *tsOutputChannels DECLARE_ efitimesec_t now = getTimeNowSeconds(); tsOutputChannels->timeSeconds = now; - tsOutputChannels->isWarnNow = isWarningNow(now); + tsOutputChannels->isWarnNow = isWarningNow(now, true); if (engineConfiguration->debugMode == DBG_TPS_ACCEL) { tsOutputChannels->debugIntField1 = engine->tpsAccelEnrichment.cb.getSize(); diff --git a/firmware/controllers/algo/error_handling.h b/firmware/controllers/algo/error_handling.h index 81ddd5d452..1181eacca0 100644 --- a/firmware/controllers/algo/error_handling.h +++ b/firmware/controllers/algo/error_handling.h @@ -28,7 +28,7 @@ void assertVtList(void); * */ int warning(obd_code_e code, const char *fmt, ...); -bool isWarningNow(efitimesec_t now); +bool isWarningNow(efitimesec_t now, bool forIndicator); /** * Something really bad had happened - firmware cannot function * diff --git a/firmware/controllers/algo/obd_error_codes.h b/firmware/controllers/algo/obd_error_codes.h index 9436704064..7c7f08bddc 100644 --- a/firmware/controllers/algo/obd_error_codes.h +++ b/firmware/controllers/algo/obd_error_codes.h @@ -1771,7 +1771,7 @@ typedef enum { CUSTOM_OBD_95 = 6095, CUSTOM_OBD_96 = 6096, CUSTOM_OBD_97 = 6097, - CUSTOM_OBD_98 = 6098, + CUSTOM_DWELL = 6098, CUSTOM_TS_OVERFLOW = 6099, diff --git a/firmware/controllers/error_handling.cpp b/firmware/controllers/error_handling.cpp index 5274a38a7b..796bd9e87f 100644 --- a/firmware/controllers/error_handling.cpp +++ b/firmware/controllers/error_handling.cpp @@ -62,8 +62,12 @@ static char warningBuffer[WARNING_BUFFER_SIZE]; static bool isWarningStreamInitialized = false; static MemoryStream warningStream; -bool isWarningNow(efitimesec_t now) { - return absI(now - engine->engineState.timeOfPreviousWarning) < engineConfiguration->warningPeriod; +/** + * @param forIndicator if we want to retrieving value for TS indicator, this case a minimal period is applued + */ +bool isWarningNow(efitimesec_t now, bool forIndicator) { + int period = forIndicator ? maxI(3, engineConfiguration->warningPeriod) : engineConfiguration->warningPeriod; + return absI(now - engine->engineState.timeOfPreviousWarning) < period; } /** @@ -80,7 +84,7 @@ int warning(obd_code_e code, const char *fmt, ...) { #endif efitimesec_t now = getTimeNowSeconds(); - if (isWarningNow(now) || !warningEnabled) + if (isWarningNow(now, false) || !warningEnabled) return true; // we just had another warning, let's not spam engine->engineState.timeOfPreviousWarning = now; diff --git a/firmware/controllers/trigger/spark_logic.cpp b/firmware/controllers/trigger/spark_logic.cpp index 44964b89cb..8925b969a9 100644 --- a/firmware/controllers/trigger/spark_logic.cpp +++ b/firmware/controllers/trigger/spark_logic.cpp @@ -45,9 +45,9 @@ void turnSparkPinHigh(NamedOutputPin *output) { static ALWAYS_INLINE void handleSparkEvent(bool limitedSpark, uint32_t trgEventIndex, IgnitionEvent *iEvent, int rpm DECLARE_ENGINE_PARAMETER_S) { - float dwellMs = ENGINE(engineState.sparkDwell); - if (cisnan(dwellMs) || dwellMs < 0) { - warning(CUSTOM_OBD_45, "invalid dwell: %f at %d", dwellMs, rpm); + const floatms_t dwellMs = ENGINE(engineState.sparkDwell); + if (cisnan(dwellMs) || dwellMs <= 0) { + warning(CUSTOM_DWELL, "invalid dwell: %f at %d", dwellMs, rpm); return; } @@ -62,11 +62,6 @@ static ALWAYS_INLINE void handleSparkEvent(bool limitedSpark, uint32_t trgEventI return; } - if (cisnan(dwellMs)) { - firmwareError("NaN in scheduleOutput", dwellMs); - return; - } - /** * We are alternating two event lists in order to avoid a potential issue around revolution boundary * when an event is scheduled within the next revolution. diff --git a/firmware/rusefi.cpp b/firmware/rusefi.cpp index bad29a428e..01edad7b6b 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 20161003; + return 20161009; }