diff --git a/firmware/controllers/algo/advance_map.cpp b/firmware/controllers/algo/advance_map.cpp index 499dd6f44e..aa8b131358 100644 --- a/firmware/controllers/algo/advance_map.cpp +++ b/firmware/controllers/algo/advance_map.cpp @@ -74,7 +74,12 @@ static angle_t getRunningAdvance(int rpm, float engineLoad DECLARE_ENGINE_PARAME return engineConfiguration->step1timing; } - float iatCorrection = iatAdvanceCorrectionMap.getValue((float) rpm, engine->engineState.iat); + float iatCorrection; + if (cisnan(engine->engineState.iat)) { + iatCorrection = 0; + } else { + iatCorrection = iatAdvanceCorrectionMap.getValue((float) rpm, engine->engineState.iat); + } float result = advanceMap.getValue((float) rpm, engineLoad) + iatCorrection // todo: uncomment once we get useable knock - engine->knockCount diff --git a/firmware/controllers/trigger/trigger_decoder.cpp b/firmware/controllers/trigger/trigger_decoder.cpp index 54970f9c50..54e69d8d0b 100644 --- a/firmware/controllers/trigger/trigger_decoder.cpp +++ b/firmware/controllers/trigger/trigger_decoder.cpp @@ -51,6 +51,7 @@ EXTERN_ENGINE ; static cyclic_buffer errorDetection; +static bool isInitializingTrigger = false; // #286 miata NA config - sync error on startup #if ! EFI_PROD_CODE || defined(__DOXYGEN__) bool printTriggerDebug = false; @@ -296,7 +297,7 @@ void TriggerState::decodeTriggerEvent(trigger_event_e const signal, efitime_t no toothed_previous_duration = currentDuration; toothed_previous_time = nowNt; } - if (!isValidIndex(PASS_ENGINE_PARAMETER_F)) { + if (!isValidIndex(PASS_ENGINE_PARAMETER_F) && !isInitializingTrigger) { warning(OBD_PCM_Processor_Fault, "sync error: index #%d above total size %d", currentCycle.current_index, TRIGGER_SHAPE(size)); lastDecodingErrorTime = getTimeNowNt(); someSortOfTriggerError = true; @@ -558,6 +559,7 @@ uint32_t findTriggerZeroEventIndex(TriggerState *state, TriggerShape * shape, #if EFI_PROD_CODE || defined(__DOXYGEN__) efiAssert(getRemainingStack(chThdSelf()) > 128, "findPos", -1); #endif + isInitializingTrigger = true; errorDetection.clear(); efiAssert(state != NULL, "NULL state", -1); @@ -568,6 +570,7 @@ uint32_t findTriggerZeroEventIndex(TriggerState *state, TriggerShape * shape, uint32_t index = helper.doFindTrigger(shape, triggerConfig, state PASS_ENGINE_PARAMETER); if (index == EFI_ERROR_CODE) { + isInitializingTrigger = false; return index; } efiAssert(state->getTotalRevolutionCounter() == 1, "totalRevolutionCounter", EFI_ERROR_CODE); @@ -582,6 +585,7 @@ uint32_t findTriggerZeroEventIndex(TriggerState *state, TriggerShape * shape, helper.assertSyncPositionAndSetDutyCycle(index, state, shape, triggerConfig PASS_ENGINE_PARAMETER); + isInitializingTrigger = false; return index % shape->getSize(); } diff --git a/firmware/rusefi.cpp b/firmware/rusefi.cpp index c0fda3e519..d8a3ffa8f1 100644 --- a/firmware/rusefi.cpp +++ b/firmware/rusefi.cpp @@ -298,5 +298,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 20160515; + return 20160517; }