Add inactivity counter reset to LVGL device drivers

This commit is contained in:
Raphael Coeffic
2022-06-13 22:43:45 +02:00
committed by Raphael Coeffic
parent 1b9cce9882
commit 3ae39a3050
6 changed files with 103 additions and 134 deletions
+9 -17
View File
@@ -564,23 +564,15 @@ void checkBacklight()
}
}
#if defined(HARDWARE_TOUCH)
if (MainWindow::instance()->touchEventOccured()) {
inactivity.counter = 0;
if (g_eeGeneral.backlightMode & e_backlight_mode_keys) {
resetBacklightTimeout();
}
}
#endif
if (requiredBacklightBright == BACKLIGHT_FORCED_ON) {
currentBacklightBright = g_eeGeneral.backlightBright;
BACKLIGHT_ENABLE();
}
else {
} else {
bool backlightOn = ((g_eeGeneral.backlightMode == e_backlight_mode_on) ||
(g_eeGeneral.backlightMode != e_backlight_mode_off && lightOffCounter) ||
(g_eeGeneral.backlightMode == e_backlight_mode_off && isFunctionActive(FUNCTION_BACKLIGHT)));
(g_eeGeneral.backlightMode != e_backlight_mode_off &&
lightOffCounter) ||
(g_eeGeneral.backlightMode == e_backlight_mode_off &&
isFunctionActive(FUNCTION_BACKLIGHT)));
if (flashCounter) {
backlightOn = !backlightOn;
@@ -589,12 +581,11 @@ void checkBacklight()
currentBacklightBright = requiredBacklightBright;
#if defined(COLORLCD)
// force backlight on for color lcd radios
if(currentBacklightBright > BACKLIGHT_LEVEL_MAX - BACKLIGHT_LEVEL_MIN)
if (currentBacklightBright > BACKLIGHT_LEVEL_MAX - BACKLIGHT_LEVEL_MIN)
currentBacklightBright = BACKLIGHT_LEVEL_MAX - BACKLIGHT_LEVEL_MIN;
#endif
BACKLIGHT_ENABLE();
}
else {
} else {
BACKLIGHT_DISABLE();
}
}
@@ -605,7 +596,8 @@ void resetBacklightTimeout()
{
uint16_t autoOff = g_eeGeneral.lightAutoOff;
#if defined(COLORLCD)
autoOff = std::max<uint16_t>(1, autoOff); // prevent the timeout from being 0 seconds on color lcd radios
// prevent the timeout from being 0 seconds on color lcd radios
autoOff = std::max<uint16_t>(1, autoOff);
#endif
lightOffCounter = (autoOff*250) << 1;
}