Renamed EncoderPinSwitch to ButtonPinShortcut

pull/274/head
Stephen Brown 3 years ago
parent b2167d8f81
commit ef92fd9398
  1. 12
      src/config.cpp
  2. 4
      src/config.h
  3. 3
      src/minidexed.ini
  4. 6
      src/userinterface.cpp

@ -86,6 +86,7 @@ void CConfig::Load (void)
m_nButtonPinBack = m_Properties.GetNumber ("ButtonPinBack", 11);
m_nButtonPinSelect = m_Properties.GetNumber ("ButtonPinSelect", 11);
m_nButtonPinHome = m_Properties.GetNumber ("ButtonPinHome", 11);
m_nButtonPinShortcut = m_Properties.GetNumber ("ButtonPinShortcut", 11);
m_ButtonActionPrev = m_Properties.GetString ("ButtonActionPrev", "");
m_ButtonActionNext = m_Properties.GetString ("ButtonActionNext", "");
@ -96,7 +97,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;
@ -217,6 +217,11 @@ unsigned CConfig::GetButtonPinHome (void) const
return m_nButtonPinHome;
}
unsigned CConfig::GetButtonPinShortcut (void) const
{
return m_nButtonPinShortcut;
}
const char *CConfig::GetButtonActionPrev (void) const
{
return m_ButtonActionPrev.c_str();
@ -257,11 +262,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;

@ -95,6 +95,7 @@ public:
unsigned GetButtonPinBack (void) const;
unsigned GetButtonPinSelect (void) const;
unsigned GetButtonPinHome (void) const;
unsigned GetButtonPinShortcut (void) const;
// Action type for buttons: "click", "doubleclick", "longpress", ""
const char *GetButtonActionPrev (void) const;
@ -108,7 +109,6 @@ public:
bool GetEncoderEnabled (void) const;
unsigned GetEncoderPinClock (void) const;
unsigned GetEncoderPinData (void) const;
unsigned GetEncoderPinSwitch (void) const;
// Debug
bool GetMIDIDumpEnabled (void) const;
@ -143,6 +143,7 @@ private:
unsigned m_nButtonPinBack;
unsigned m_nButtonPinSelect;
unsigned m_nButtonPinHome;
unsigned m_nButtonPinShortcut;
std::string m_ButtonActionPrev;
std::string m_ButtonActionNext;
@ -153,7 +154,6 @@ private:
bool m_bEncoderEnabled;
unsigned m_nEncoderPinClock;
unsigned m_nEncoderPinData;
unsigned m_nEncoderPinSwitch;
bool m_bMIDIDumpEnabled;
bool m_bProfileEnabled;

@ -39,12 +39,13 @@ ButtonPinSelect=11
ButtonActionSelect=click
ButtonPinHome=11
ButtonActionHome=longpress
ButtonPinShortcut=11
# (Shortcut doesn't have an action)
# KY-040 Rotary Encoder
EncoderEnabled=1
EncoderPinClock=10
EncoderPinData=9
EncoderPinSwitch=11
# Debug
MIDIDumpEnabled=0

@ -112,7 +112,7 @@ bool CUserInterface::Initialize (void)
{
m_pRotaryEncoder = new CKY040 (m_pConfig->GetEncoderPinClock (),
m_pConfig->GetEncoderPinData (),
m_pConfig->GetEncoderPinSwitch (),
m_pConfig->GetButtonPinShortcut (),
m_pGPIOManager);
assert (m_pRotaryEncoder);
@ -227,7 +227,7 @@ void CUserInterface::EncoderEventHandler (CKY040::TEvent Event)
if (m_bSwitchPressed) {
// We must reset the encoder switch button to prevent events from being
// triggered after the encoder is rotated
m_pUIButtons->ResetButton(m_pConfig->GetEncoderPinSwitch());
m_pUIButtons->ResetButton(m_pConfig->GetButtonPinShortcut());
m_Menu.EventHandler(CUIMenu::MenuEventPressAndStepUp);
}
@ -238,7 +238,7 @@ void CUserInterface::EncoderEventHandler (CKY040::TEvent Event)
case CKY040::EventCounterclockwise:
if (m_bSwitchPressed) {
m_pUIButtons->ResetButton(m_pConfig->GetEncoderPinSwitch());
m_pUIButtons->ResetButton(m_pConfig->GetButtonPinShortcut());
m_Menu.EventHandler(CUIMenu::MenuEventPressAndStepDown);
}
else {

Loading…
Cancel
Save