From 0df5d0ae3d5d510704de16a8e8d168b35042ebe2 Mon Sep 17 00:00:00 2001 From: Matthew Kennedy Date: Thu, 24 Dec 2020 04:30:56 -0800 Subject: [PATCH] actually use button name (#2126) Co-authored-by: Matthew Kennedy --- firmware/hw_layer/debounce.cpp | 9 +++++---- firmware/hw_layer/debounce.h | 4 ++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/firmware/hw_layer/debounce.cpp b/firmware/hw_layer/debounce.cpp index 2933cd2e8c..88c7459173 100644 --- a/firmware/hw_layer/debounce.cpp +++ b/firmware/hw_layer/debounce.cpp @@ -13,8 +13,9 @@ ButtonDebounce* ButtonDebounce::s_firstDebounce = nullptr; static Logging *logger; -ButtonDebounce::ButtonDebounce(const char *name) { - this->name = name; +ButtonDebounce::ButtonDebounce(const char *name) + : m_name(name) +{ } /** @@ -69,7 +70,7 @@ void ButtonDebounce::stopConfiguration () { void ButtonDebounce::startConfiguration () { #if EFI_PROD_CODE if (needsPinInitialization) { - efiSetPadMode("Button", *m_pin, getInputMode(*m_mode)); + efiSetPadMode(m_name, *m_pin, getInputMode(*m_mode)); needsPinInitialization = false; } #endif @@ -117,7 +118,7 @@ void ButtonDebounce::debug() { ButtonDebounce *listItem = s_firstDebounce; while (listItem != nullptr) { #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); #endif diff --git a/firmware/hw_layer/debounce.h b/firmware/hw_layer/debounce.h index 03e518fed0..516db8588f 100644 --- a/firmware/hw_layer/debounce.h +++ b/firmware/hw_layer/debounce.h @@ -15,7 +15,7 @@ class ButtonDebounce { 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 stopConfiguration(); void startConfiguration(); @@ -25,7 +25,7 @@ public: static void startConfigurationList(); static void debug(); private: - const char *name; + const char* const m_name; efitick_t m_threshold; efitick_t timeLast; brain_pin_e *m_pin;