From f6869e812cfc41d6ffeeef1a5b1f62587b867920 Mon Sep 17 00:00:00 2001 From: rusefi Date: Thu, 25 Apr 2019 00:18:37 -0400 Subject: [PATCH] electrical noise during tuning ETB causes full tune reset #775 --- firmware/controllers/flash_main.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/firmware/controllers/flash_main.cpp b/firmware/controllers/flash_main.cpp index 00e63132cb..69ab8026e7 100644 --- a/firmware/controllers/flash_main.cpp +++ b/firmware/controllers/flash_main.cpp @@ -89,6 +89,7 @@ void writeToFlashNow(void) { scheduleMsg(logger, "Flashing with CRC=%d", crcResult); efitimems_t nowMs = currentTimeMillis(); int result = flashWrite(FLASH_ADDR, (const char *) &persistentState, PERSISTENT_SIZE); + flashErase(FLASH_ADDR_SECOND_COPY, PERSISTENT_SIZE); flashWrite(FLASH_ADDR_SECOND_COPY, (const char *) &persistentState, PERSISTENT_SIZE); scheduleMsg(logger, "Flash programmed in %dms", currentTimeMillis() - nowMs); bool isSuccess = result == FLASH_RETURN_SUCCESS;