diff --git a/Defines.h b/Defines.h index c22d90c..a09125e 100644 --- a/Defines.h +++ b/Defines.h @@ -25,4 +25,8 @@ #define BTN_DOWN_SHORT_CLICKED -1 #define BTN_DOWN_UP_NO_SHORT_CLICKED 0 +#define BTN_UP_HOLDED 1 +#define BTN_DOWN_HOLDED -1 +#define BTN_DOWN_UP_NOT_HOLDED 0 + #endif \ No newline at end of file diff --git a/EyeTrainerMain.h b/EyeTrainerMain.h index 2196672..72b1d3b 100644 --- a/EyeTrainerMain.h +++ b/EyeTrainerMain.h @@ -120,7 +120,7 @@ private: Settings::getInstance().setSwitchTime(Settings::getInstance().SwitchTime + upDownButtons * 50); UpdateModeDisplay(); } - if(upDownButtonsHold != 0) + if(upDownButtonsHold != BTN_DOWN_UP_NOT_HOLDED) { m_DisplayHelper.setDrawTitle(false); Settings::getInstance().setSwitchTime(Settings::getInstance().SwitchTime + upDownButtonsHold * 50); @@ -139,7 +139,7 @@ private: UpdateModeDisplay(); } - if(upDownButtonsHold != 0) + if(upDownButtonsHold != BTN_DOWN_UP_NOT_HOLDED) { m_LEDRunner.setAllHigh(); m_DisplayHelper.setDrawTitle(false); diff --git a/InputHelper.h b/InputHelper.h index fc1e328..95ec63e 100644 --- a/InputHelper.h +++ b/InputHelper.h @@ -57,7 +57,11 @@ public: { bool upButtonHold = m_UpButton.IsHolded(); bool downButtonHold = m_DownButton.IsHolded(); - return (upButtonHold - downButtonHold); + if(upButtonHold) + return BTN_UP_HOLDED; + else if(downButtonHold) + return BTN_DOWN_HOLDED; + return BTN_DOWN_UP_NOT_HOLDED; } private: