Removed encoder button support

pull/274/head
Stephen Brown 3 years ago
parent 4179d07688
commit c050e04db1
  1. 6
      src/config.cpp
  2. 2
      src/config.h
  3. 1
      src/minidexed.ini
  4. 41
      src/userinterface.cpp
  5. 1
      src/userinterface.h

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

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

@ -44,7 +44,6 @@ ButtonActionHome=longpress
EncoderEnabled=1
EncoderPinClock=10
EncoderPinData=9
EncoderPinSwitch=11
# Debug
MIDIDumpEnabled=0

@ -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:

@ -71,7 +71,6 @@ private:
CUIButtons *m_pUIButtons;
CKY040 *m_pRotaryEncoder;
bool m_bSwitchPressed;
CUIMenu m_Menu;
};

Loading…
Cancel
Save