diff --git a/firmware/config/stm32f4ems/efifeatures.h b/firmware/config/stm32f4ems/efifeatures.h index 4e6a0b1cc9..fc272bf89e 100644 --- a/firmware/config/stm32f4ems/efifeatures.h +++ b/firmware/config/stm32f4ems/efifeatures.h @@ -31,6 +31,8 @@ #define EFI_PWM_TESTER FALSE +#define EFI_ACTIVE_CONFIGURATION_IN_FLASH FALSE + #define EFI_MC33816 TRUE #define EFI_HPFP TRUE diff --git a/firmware/hw_layer/debounce.cpp b/firmware/hw_layer/debounce.cpp index dd943e6720..40ebd19a03 100644 --- a/firmware/hw_layer/debounce.cpp +++ b/firmware/hw_layer/debounce.cpp @@ -22,7 +22,7 @@ We need to have a separate init function because we do not have the pin or mode */ void ButtonDebounce::init (efitimems_t threshold, brain_pin_e &pin, pin_input_mode_e &mode) { // we need to keep track of whether we have already been initialized due to the way unit tests run. - if (!initialized) { + if (!isInstanceRegisteredInGlobalList) { // Link us to the list that is used to track ButtonDebounce instances, so that when the configuration changes, // they can be looped through and updated. nextDebounce = s_firstDebounce; @@ -33,7 +33,7 @@ void ButtonDebounce::init (efitimems_t threshold, brain_pin_e &pin, pin_input_mo m_pin = &pin; m_mode = &mode; startConfiguration(); - initialized = true; + isInstanceRegisteredInGlobalList = true; } void ButtonDebounce::stopConfigurationList () { @@ -61,16 +61,16 @@ void ButtonDebounce::stopConfiguration () { #endif /* EFI_ACTIVE_CONFIGURATION_IN_FLASH */ #if ! EFI_UNIT_TEST efiSetPadUnused(active_pin); - needsInit = true; + needsPinInitialization = true; #endif /* EFI_UNIT_TEST */ } } void ButtonDebounce::startConfiguration () { #if ! EFI_UNIT_TEST - if (needsInit) { + if (needsPinInitialization) { efiSetPadMode("Button", *m_pin, getInputMode(*m_mode)); - needsInit = false; + needsPinInitialization = false; } #endif active_pin = *m_pin; diff --git a/firmware/hw_layer/debounce.h b/firmware/hw_layer/debounce.h index 466d09857f..03e518fed0 100644 --- a/firmware/hw_layer/debounce.h +++ b/firmware/hw_layer/debounce.h @@ -33,10 +33,10 @@ private: pin_input_mode_e *m_mode; pin_input_mode_e active_mode = PI_DEFAULT; bool storedValue = false; - bool initialized = false; + bool isInstanceRegisteredInGlobalList = false; + bool needsPinInitialization = true; ButtonDebounce *nextDebounce = nullptr; static ButtonDebounce* s_firstDebounce; - bool needsInit = false; }; void initButtonDebounce(Logging *sharedLogger);