From 48b8f08cb8ead14bd85497a2bad02d6f9ddc5b9d Mon Sep 17 00:00:00 2001 From: Matthew Kennedy Date: Wed, 7 Aug 2024 12:09:30 -0700 Subject: [PATCH] EFI_ACTIVE_CONFIGURATION_IN_FLASH --- firmware/config/stm32f4ems/efifeatures.h | 2 -- firmware/controllers/algo/engine_configuration.cpp | 13 ------------- firmware/controllers/algo/engine_configuration.h | 8 -------- firmware/hw_layer/debounce.cpp | 4 ---- simulator/simulator/efifeatures.h | 2 -- 5 files changed, 29 deletions(-) diff --git a/firmware/config/stm32f4ems/efifeatures.h b/firmware/config/stm32f4ems/efifeatures.h index 5040c8c10f..243b6ac985 100644 --- a/firmware/config/stm32f4ems/efifeatures.h +++ b/firmware/config/stm32f4ems/efifeatures.h @@ -33,8 +33,6 @@ #define EFI_TEXT_LOGGING TRUE -#define EFI_ACTIVE_CONFIGURATION_IN_FLASH FALSE - #ifndef EFI_MC33816 #define EFI_MC33816 TRUE #endif diff --git a/firmware/controllers/algo/engine_configuration.cpp b/firmware/controllers/algo/engine_configuration.cpp index c57a4813ef..b512ad45bd 100644 --- a/firmware/controllers/algo/engine_configuration.cpp +++ b/firmware/controllers/algo/engine_configuration.cpp @@ -111,22 +111,11 @@ * * todo: place this field next to 'engineConfiguration'? */ -#if EFI_ACTIVE_CONFIGURATION_IN_FLASH -#include "flash_int.h" -engine_configuration_s & activeConfiguration = reinterpret_cast(getFlashAddrFirstCopy())->persistentConfiguration.engineConfiguration; -// we cannot use this activeConfiguration until we call rememberCurrentConfiguration() -bool isActiveConfigurationVoid = true; -#else static engine_configuration_s activeConfigurationLocalStorage; engine_configuration_s & activeConfiguration = activeConfigurationLocalStorage; -#endif /* EFI_ACTIVE_CONFIGURATION_IN_FLASH */ void rememberCurrentConfiguration() { -#if ! EFI_ACTIVE_CONFIGURATION_IN_FLASH memcpy(&activeConfiguration, engineConfiguration, sizeof(engine_configuration_s)); -#else - isActiveConfigurationVoid = false; -#endif /* EFI_ACTIVE_CONFIGURATION_IN_FLASH */ } static void wipeString(char *string, int size) { @@ -599,10 +588,8 @@ static void setDefaultEngineConfiguration() { #endif void loadConfiguration() { -#if ! EFI_ACTIVE_CONFIGURATION_IN_FLASH // Clear the active configuration so that registered output pins (etc) detect the change on startup and init properly prepareVoidConfiguration(&activeConfiguration); -#endif /* EFI_ACTIVE_CONFIGURATION_IN_FLASH */ #if EFI_INTERNAL_FLASH if (IGNORE_FLASH_CONFIGURATION) { diff --git a/firmware/controllers/algo/engine_configuration.h b/firmware/controllers/algo/engine_configuration.h index 8372ce581f..a0cabeb0c6 100644 --- a/firmware/controllers/algo/engine_configuration.h +++ b/firmware/controllers/algo/engine_configuration.h @@ -85,16 +85,8 @@ extern persistent_config_s *config; */ extern engine_configuration_s & activeConfiguration; -#if ! EFI_ACTIVE_CONFIGURATION_IN_FLASH // We store a special changeable copy of configuration is RAM, so we can just compare them #define isConfigurationChanged(x) (engineConfiguration->x != activeConfiguration.x) -#else -// We cannot call prepareVoidConfiguration() for activeConfiguration if it's stored in flash, -// so we need to tell the firmware that it's "void" (i.e. zeroed, invalid) by setting a special flag variable, -// and then we consider 'x' as changed if it's just non-zero. -extern bool isActiveConfigurationVoid; -#define isConfigurationChanged(x) ((engineConfiguration->x != activeConfiguration.x) || (isActiveConfigurationVoid && (int)(engineConfiguration->x) != 0)) -#endif /* EFI_ACTIVE_CONFIGURATION_IN_FLASH */ #define isPinOrModeChanged(pin, mode) (isConfigurationChanged(pin) || isConfigurationChanged(mode)) diff --git a/firmware/hw_layer/debounce.cpp b/firmware/hw_layer/debounce.cpp index 9f5950950f..e76cf759a3 100644 --- a/firmware/hw_layer/debounce.cpp +++ b/firmware/hw_layer/debounce.cpp @@ -54,11 +54,7 @@ void ButtonDebounce::startConfigurationList () { void ButtonDebounce::stopConfiguration () { // If the configuration has changed -#if ! EFI_ACTIVE_CONFIGURATION_IN_FLASH if (*m_pin != active_pin || *m_mode != active_mode) { -#else - if (*m_pin != active_pin || *m_mode != active_mode || (isActiveConfigurationVoid && ((int)(*m_pin) != 0 || (int)(*m_mode) != 0))) { -#endif /* EFI_ACTIVE_CONFIGURATION_IN_FLASH */ #if EFI_PROD_CODE efiSetPadUnused(active_pin); #endif /* EFI_UNIT_TEST */ diff --git a/simulator/simulator/efifeatures.h b/simulator/simulator/efifeatures.h index 8e98a62687..a1dcdbf34b 100644 --- a/simulator/simulator/efifeatures.h +++ b/simulator/simulator/efifeatures.h @@ -34,8 +34,6 @@ #define SC_BUFFER_SIZE 4000 -#define EFI_ACTIVE_CONFIGURATION_IN_FLASH FALSE - #define EFI_BOOST_CONTROL TRUE #define EFI_CANBUS_SLAVE FALSE