Defined up downbuttons' hold constants.

This commit is contained in:
Author glitchrain
2024-12-15 03:37:11 -08:00
committed by s.aydarov
parent 11b4909f39
commit 2bbfeb8940
3 changed files with 11 additions and 3 deletions

View File

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

View File

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

View File

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