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 a47129693a
commit 8f2116921c
4 changed files with 11 additions and 8 deletions

View File

@ -368,7 +368,8 @@
#define EFI_PRINT_ERRORS_AS_WARNINGS TRUE
#define EFI_PRINT_MESSAGES_TO_TERMINAL TRUE
#define EFI_ACTIVE_CONFIGURATION_IN_FLASH
#undef EFI_ACTIVE_CONFIGURATION_IN_FLASH
#define EFI_ACTIVE_CONFIGURATION_IN_FLASH TRUE
//#define PWM_PHASE_MAX_COUNT 122

View File

@ -31,6 +31,8 @@
#define EFI_PWM_TESTER FALSE
#define EFI_ACTIVE_CONFIGURATION_IN_FLASH FALSE
#define EFI_MC33816 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) {
// 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;

View File

@ -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);