trigger and start button pins not displayed by "pins" command fix #2084

This commit is contained in:
rusefillc 2020-12-16 22:24:19 -05:00
parent f147aabcd7
commit 88bb2f4569
3 changed files with 9 additions and 7 deletions

View File

@ -31,6 +31,8 @@
#define EFI_PWM_TESTER FALSE #define EFI_PWM_TESTER FALSE
#define EFI_ACTIVE_CONFIGURATION_IN_FLASH FALSE
#define EFI_MC33816 TRUE #define EFI_MC33816 TRUE
#define EFI_HPFP TRUE #define EFI_HPFP TRUE

View File

@ -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) { 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. // 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, // 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. // they can be looped through and updated.
nextDebounce = s_firstDebounce; nextDebounce = s_firstDebounce;
@ -33,7 +33,7 @@ void ButtonDebounce::init (efitimems_t threshold, brain_pin_e &pin, pin_input_mo
m_pin = &pin; m_pin = &pin;
m_mode = &mode; m_mode = &mode;
startConfiguration(); startConfiguration();
initialized = true; isInstanceRegisteredInGlobalList = true;
} }
void ButtonDebounce::stopConfigurationList () { void ButtonDebounce::stopConfigurationList () {
@ -61,16 +61,16 @@ void ButtonDebounce::stopConfiguration () {
#endif /* EFI_ACTIVE_CONFIGURATION_IN_FLASH */ #endif /* EFI_ACTIVE_CONFIGURATION_IN_FLASH */
#if ! EFI_UNIT_TEST #if ! EFI_UNIT_TEST
efiSetPadUnused(active_pin); efiSetPadUnused(active_pin);
needsInit = true; needsPinInitialization = true;
#endif /* EFI_UNIT_TEST */ #endif /* EFI_UNIT_TEST */
} }
} }
void ButtonDebounce::startConfiguration () { void ButtonDebounce::startConfiguration () {
#if ! EFI_UNIT_TEST #if ! EFI_UNIT_TEST
if (needsInit) { if (needsPinInitialization) {
efiSetPadMode("Button", *m_pin, getInputMode(*m_mode)); efiSetPadMode("Button", *m_pin, getInputMode(*m_mode));
needsInit = false; needsPinInitialization = false;
} }
#endif #endif
active_pin = *m_pin; active_pin = *m_pin;

View File

@ -33,10 +33,10 @@ private:
pin_input_mode_e *m_mode; pin_input_mode_e *m_mode;
pin_input_mode_e active_mode = PI_DEFAULT; pin_input_mode_e active_mode = PI_DEFAULT;
bool storedValue = false; bool storedValue = false;
bool initialized = false; bool isInstanceRegisteredInGlobalList = false;
bool needsPinInitialization = true;
ButtonDebounce *nextDebounce = nullptr; ButtonDebounce *nextDebounce = nullptr;
static ButtonDebounce* s_firstDebounce; static ButtonDebounce* s_firstDebounce;
bool needsInit = false;
}; };
void initButtonDebounce(Logging *sharedLogger); void initButtonDebounce(Logging *sharedLogger);