actually use button name (#2126)

Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
This commit is contained in:
Matthew Kennedy 2020-12-24 04:30:56 -08:00 committed by GitHub
parent 3614cd3161
commit 0df5d0ae3d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 6 deletions

View File

@ -13,8 +13,9 @@
ButtonDebounce* ButtonDebounce::s_firstDebounce = nullptr; ButtonDebounce* ButtonDebounce::s_firstDebounce = nullptr;
static Logging *logger; static Logging *logger;
ButtonDebounce::ButtonDebounce(const char *name) { ButtonDebounce::ButtonDebounce(const char *name)
this->name = name; : m_name(name)
{
} }
/** /**
@ -69,7 +70,7 @@ void ButtonDebounce::stopConfiguration () {
void ButtonDebounce::startConfiguration () { void ButtonDebounce::startConfiguration () {
#if EFI_PROD_CODE #if EFI_PROD_CODE
if (needsPinInitialization) { if (needsPinInitialization) {
efiSetPadMode("Button", *m_pin, getInputMode(*m_mode)); efiSetPadMode(m_name, *m_pin, getInputMode(*m_mode));
needsPinInitialization = false; needsPinInitialization = false;
} }
#endif #endif
@ -117,7 +118,7 @@ void ButtonDebounce::debug() {
ButtonDebounce *listItem = s_firstDebounce; ButtonDebounce *listItem = s_firstDebounce;
while (listItem != nullptr) { while (listItem != nullptr) {
#if EFI_PROD_CODE || EFI_UNIT_TEST #if EFI_PROD_CODE || EFI_UNIT_TEST
scheduleMsg(logger, "%s timeLast %d", listItem->name, listItem->timeLast); scheduleMsg(logger, "%s timeLast %d", listItem->m_name, listItem->timeLast);
scheduleMsg(logger, "physical state %d value %d", efiReadPin(listItem->active_pin), listItem->storedValue); scheduleMsg(logger, "physical state %d value %d", efiReadPin(listItem->active_pin), listItem->storedValue);
#endif #endif

View File

@ -15,7 +15,7 @@
class ButtonDebounce { class ButtonDebounce {
public: public:
ButtonDebounce(const char *name); explicit ButtonDebounce(const char* name);
void init(efitimems_t threshold, brain_pin_e &pin, pin_input_mode_e &mode); void init(efitimems_t threshold, brain_pin_e &pin, pin_input_mode_e &mode);
void stopConfiguration(); void stopConfiguration();
void startConfiguration(); void startConfiguration();
@ -25,7 +25,7 @@ public:
static void startConfigurationList(); static void startConfigurationList();
static void debug(); static void debug();
private: private:
const char *name; const char* const m_name;
efitick_t m_threshold; efitick_t m_threshold;
efitick_t timeLast; efitick_t timeLast;
brain_pin_e *m_pin; brain_pin_e *m_pin;