diff --git a/src/config.cpp b/src/config.cpp index afa3f27..85ad9ed 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -96,7 +96,6 @@ void CConfig::Load (void) m_bEncoderEnabled = m_Properties.GetNumber ("EncoderEnabled", 0) != 0; m_nEncoderPinClock = m_Properties.GetNumber ("EncoderPinClock", 10); m_nEncoderPinData = m_Properties.GetNumber ("EncoderPinData", 9); - m_nEncoderPinSwitch = m_Properties.GetNumber ("EncoderPinSwitch", 11); m_bMIDIDumpEnabled = m_Properties.GetNumber ("MIDIDumpEnabled", 0) != 0; m_bProfileEnabled = m_Properties.GetNumber ("ProfileEnabled", 0) != 0; @@ -257,11 +256,6 @@ unsigned CConfig::GetEncoderPinData (void) const return m_nEncoderPinData; } -unsigned CConfig::GetEncoderPinSwitch (void) const -{ - return m_nEncoderPinSwitch; -} - bool CConfig::GetMIDIDumpEnabled (void) const { return m_bMIDIDumpEnabled; diff --git a/src/config.h b/src/config.h index 6c11bf1..c9e72d2 100644 --- a/src/config.h +++ b/src/config.h @@ -108,7 +108,6 @@ public: bool GetEncoderEnabled (void) const; unsigned GetEncoderPinClock (void) const; unsigned GetEncoderPinData (void) const; - unsigned GetEncoderPinSwitch (void) const; // Debug bool GetMIDIDumpEnabled (void) const; @@ -153,7 +152,6 @@ private: bool m_bEncoderEnabled; unsigned m_nEncoderPinClock; unsigned m_nEncoderPinData; - unsigned m_nEncoderPinSwitch; bool m_bMIDIDumpEnabled; bool m_bProfileEnabled; diff --git a/src/minidexed.ini b/src/minidexed.ini index 9723a1a..82a7c91 100644 --- a/src/minidexed.ini +++ b/src/minidexed.ini @@ -44,7 +44,6 @@ ButtonActionHome=longpress EncoderEnabled=1 EncoderPinClock=10 EncoderPinData=9 -EncoderPinSwitch=11 # Debug MIDIDumpEnabled=0 diff --git a/src/userinterface.cpp b/src/userinterface.cpp index 5836dc2..cf7c1f2 100644 --- a/src/userinterface.cpp +++ b/src/userinterface.cpp @@ -36,7 +36,6 @@ CUserInterface::CUserInterface (CMiniDexed *pMiniDexed, CGPIOManager *pGPIOManag m_pLCDBuffered (0), m_pUIButtons (0), m_pRotaryEncoder (0), - m_bSwitchPressed (false), m_Menu (this, pMiniDexed) { } @@ -110,9 +109,12 @@ bool CUserInterface::Initialize (void) if (m_pConfig->GetEncoderEnabled ()) { + // NOTE: There is no way to disable the switch pin with this driver + // so I have set it to 0 which is a reserved pin used by pi hats. + // Even if this pin triggers it shouldn't cause any real issues. m_pRotaryEncoder = new CKY040 (m_pConfig->GetEncoderPinClock (), m_pConfig->GetEncoderPinData (), - m_pConfig->GetEncoderPinSwitch (), + 0, m_pGPIOManager); assert (m_pRotaryEncoder); @@ -215,43 +217,12 @@ void CUserInterface::EncoderEventHandler (CKY040::TEvent Event) { switch (Event) { - case CKY040::EventSwitchDown: - m_bSwitchPressed = true; - break; - - case CKY040::EventSwitchUp: - m_bSwitchPressed = false; - break; - case CKY040::EventClockwise: - m_Menu.EventHandler (m_bSwitchPressed ? CUIMenu::MenuEventPressAndStepUp - : CUIMenu::MenuEventStepUp); + m_Menu.EventHandler (CUIMenu::MenuEventStepUp); break; case CKY040::EventCounterclockwise: - m_Menu.EventHandler (m_bSwitchPressed ? CUIMenu::MenuEventPressAndStepDown - : CUIMenu::MenuEventStepDown); - break; - - case CKY040::EventSwitchClick: - m_Menu.EventHandler (CUIMenu::MenuEventBack); - break; - - case CKY040::EventSwitchDoubleClick: - m_Menu.EventHandler (CUIMenu::MenuEventSelect); - break; - - case CKY040::EventSwitchTripleClick: - m_Menu.EventHandler (CUIMenu::MenuEventHome); - break; - - case CKY040::EventSwitchHold: - if (m_pRotaryEncoder->GetHoldSeconds () >= 120) - { - delete m_pLCD; // reset LCD - - reboot (); - } + m_Menu.EventHandler (CUIMenu::MenuEventStepDown); break; default: diff --git a/src/userinterface.h b/src/userinterface.h index 202872a..4a31fa0 100644 --- a/src/userinterface.h +++ b/src/userinterface.h @@ -71,7 +71,6 @@ private: CUIButtons *m_pUIButtons; CKY040 *m_pRotaryEncoder; - bool m_bSwitchPressed; CUIMenu m_Menu; };