Add inactivity counter reset to LVGL device drivers
This commit is contained in:
committed by
Raphael Coeffic
parent
1b9cce9882
commit
3ae39a3050
@@ -36,6 +36,14 @@ static lv_indev_drv_t rotaryDriver;
|
|||||||
static lv_indev_t* rotaryDevice = nullptr;
|
static lv_indev_t* rotaryDevice = nullptr;
|
||||||
static lv_indev_t* keyboardDevice = nullptr;
|
static lv_indev_t* keyboardDevice = nullptr;
|
||||||
|
|
||||||
|
static void reset_inactivity()
|
||||||
|
{
|
||||||
|
inactivity.counter = 0;
|
||||||
|
if (g_eeGeneral.backlightMode & e_backlight_mode_keys) {
|
||||||
|
resetBacklightTimeout();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static lv_obj_t* get_focus_obj(lv_indev_t* indev)
|
static lv_obj_t* get_focus_obj(lv_indev_t* indev)
|
||||||
{
|
{
|
||||||
lv_group_t * g = indev->group;
|
lv_group_t * g = indev->group;
|
||||||
@@ -179,6 +187,9 @@ extern "C" void touchDriverRead(lv_indev_drv_t *drv, lv_indev_data_t *data)
|
|||||||
copy_ts_to_indev_data(st, data);
|
copy_ts_to_indev_data(st, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Reset inactivity counters
|
||||||
|
if (st.event != TE_NONE) { reset_inactivity(); }
|
||||||
|
|
||||||
backup_touch_data(data);
|
backup_touch_data(data);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -194,6 +205,9 @@ static void rotaryDriverRead(lv_indev_drv_t *drv, lv_indev_data_t *data)
|
|||||||
|
|
||||||
data->enc_diff = (int16_t)diff;
|
data->enc_diff = (int16_t)diff;
|
||||||
data->state = LV_INDEV_STATE_RELEASED;
|
data->state = LV_INDEV_STATE_RELEASED;
|
||||||
|
|
||||||
|
// Reset inactivity counters
|
||||||
|
if (diff != 0) { reset_inactivity(); }
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -89,32 +89,6 @@ void ColorEditorContent::setRGB()
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if defined(HARDWARE_TOUCH)
|
#if defined(HARDWARE_TOUCH)
|
||||||
bool ColorEditorContent::onTouchSlide(coord_t x, coord_t y, coord_t startX, coord_t startY, coord_t slideX, coord_t slideY)
|
|
||||||
{
|
|
||||||
if (touchState.event == TE_SLIDE_END) {
|
|
||||||
sliding = false;
|
|
||||||
colorPicking = false;
|
|
||||||
invalidate();
|
|
||||||
} else if (sliding) {
|
|
||||||
x -= SCREEN_LEFT_MARGIN;
|
|
||||||
x = max(x, 0);
|
|
||||||
x = min(x, MAX_HUE);
|
|
||||||
if (hue != x) {
|
|
||||||
hue = x;
|
|
||||||
setRGB();
|
|
||||||
}
|
|
||||||
} else if (colorPicking) {
|
|
||||||
s = min((x - SCREEN_LEFT_MARGIN) / 2, MAX_SATURATION);
|
|
||||||
s = max(s, 0);
|
|
||||||
v = min(MAX_BRIGHTNESS - ((y - GRID_TOP_MARGIN)), MAX_BRIGHTNESS);
|
|
||||||
v = max(v, 0);
|
|
||||||
|
|
||||||
setRGB();
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ColorEditorContent::onTouchEnd(coord_t x, coord_t y)
|
bool ColorEditorContent::onTouchEnd(coord_t x, coord_t y)
|
||||||
{
|
{
|
||||||
sliding = false;
|
sliding = false;
|
||||||
@@ -125,15 +99,17 @@ bool ColorEditorContent::onTouchEnd(coord_t x, coord_t y)
|
|||||||
|
|
||||||
bool ColorEditorContent::onTouchStart(coord_t x, coord_t y)
|
bool ColorEditorContent::onTouchStart(coord_t x, coord_t y)
|
||||||
{
|
{
|
||||||
if (! sliding && (y > HUE_BAR_TOP_MARGIN && y < HUE_BAR_TOP_MARGIN + HUE_BAR_HEIGHT))
|
if (!sliding &&
|
||||||
{
|
(y > HUE_BAR_TOP_MARGIN && y < HUE_BAR_TOP_MARGIN + HUE_BAR_HEIGHT)) {
|
||||||
hue = x - SCREEN_LEFT_MARGIN;
|
hue = x - SCREEN_LEFT_MARGIN;
|
||||||
hue = max(hue, 0);
|
hue = max(hue, 0);
|
||||||
hue = min(hue, MAX_HUE);
|
hue = min(hue, MAX_HUE);
|
||||||
sliding = true;
|
sliding = true;
|
||||||
|
|
||||||
invalidate();
|
invalidate();
|
||||||
} else if (x >= SCREEN_LEFT_MARGIN && x <= SCREEN_LEFT_MARGIN + (MAX_SATURATION * 2) && y >= GRID_TOP_MARGIN && y <= GRID_TOP_MARGIN + MAX_BRIGHTNESS) {
|
} else if (x >= SCREEN_LEFT_MARGIN &&
|
||||||
|
x <= SCREEN_LEFT_MARGIN + (MAX_SATURATION * 2) &&
|
||||||
|
y >= GRID_TOP_MARGIN && y <= GRID_TOP_MARGIN + MAX_BRIGHTNESS) {
|
||||||
colorPicking = true;
|
colorPicking = true;
|
||||||
v = min(MAX_BRIGHTNESS - (y - GRID_TOP_MARGIN), MAX_BRIGHTNESS);
|
v = min(MAX_BRIGHTNESS - (y - GRID_TOP_MARGIN), MAX_BRIGHTNESS);
|
||||||
s = min((x - SCREEN_LEFT_MARGIN) / 2, MAX_SATURATION);
|
s = min((x - SCREEN_LEFT_MARGIN) / 2, MAX_SATURATION);
|
||||||
@@ -144,9 +120,9 @@ bool ColorEditorContent::onTouchStart(coord_t x, coord_t y)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(HARDWARE_KEYS)
|
|
||||||
void ColorEditorContent::onEvent(event_t event)
|
void ColorEditorContent::onEvent(event_t event)
|
||||||
{
|
{
|
||||||
|
#if defined(HARDWARE_KEYS)
|
||||||
int oldSliderVal = hue;
|
int oldSliderVal = hue;
|
||||||
if (event == EVT_ROTARY_LEFT) {
|
if (event == EVT_ROTARY_LEFT) {
|
||||||
hue -= 2;
|
hue -= 2;
|
||||||
@@ -162,9 +138,8 @@ void ColorEditorContent::onEvent(event_t event)
|
|||||||
if (hue != oldSliderVal) {
|
if (hue != oldSliderVal) {
|
||||||
invalidate();
|
invalidate();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
void ColorEditorContent::drawHueBar(BitmapBuffer *dc)
|
void ColorEditorContent::drawHueBar(BitmapBuffer *dc)
|
||||||
{
|
{
|
||||||
@@ -173,12 +148,16 @@ void ColorEditorContent::drawHueBar(BitmapBuffer *dc)
|
|||||||
auto r = GET_RED(rgb);
|
auto r = GET_RED(rgb);
|
||||||
auto g = GET_GREEN(rgb);
|
auto g = GET_GREEN(rgb);
|
||||||
auto b = GET_BLUE(rgb);
|
auto b = GET_BLUE(rgb);
|
||||||
dc->drawSolidVerticalLine(i + SCREEN_LEFT_MARGIN, HUE_BAR_TOP_MARGIN, HUE_BAR_HEIGHT, COLOR2FLAGS(RGB(r, g, b)));
|
dc->drawSolidVerticalLine(i + SCREEN_LEFT_MARGIN, HUE_BAR_TOP_MARGIN,
|
||||||
|
HUE_BAR_HEIGHT, COLOR2FLAGS(RGB(r, g, b)));
|
||||||
}
|
}
|
||||||
|
|
||||||
dc->drawFilledCircle(hue + SCREEN_LEFT_MARGIN, HUE_BAR_TOP_MARGIN + (HUE_BAR_HEIGHT / 2), 5, COLOR2FLAGS(WHITE));
|
dc->drawFilledCircle(hue + SCREEN_LEFT_MARGIN,
|
||||||
|
HUE_BAR_TOP_MARGIN + (HUE_BAR_HEIGHT / 2), 5,
|
||||||
|
COLOR2FLAGS(WHITE));
|
||||||
if (sliding) {
|
if (sliding) {
|
||||||
dc->drawText(hue + (SCREEN_LEFT_MARGIN / 2), 25, std::to_string(hue).c_str(), FONT(XXS) | COLOR2FLAGS(WHITE));
|
dc->drawText(hue + (SCREEN_LEFT_MARGIN / 2), 25,
|
||||||
|
std::to_string(hue).c_str(), FONT(XXS) | COLOR2FLAGS(WHITE));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -187,20 +166,26 @@ void ColorEditorContent::drawGrid(BitmapBuffer *dc)
|
|||||||
for (int s = 0; s <= MAX_SATURATION; s++) {
|
for (int s = 0; s <= MAX_SATURATION; s++) {
|
||||||
for (int v = MAX_BRIGHTNESS; v >= 0; v--) {
|
for (int v = MAX_BRIGHTNESS; v >= 0; v--) {
|
||||||
uint32_t rgbVal = HSVtoRGB(hue, s, v);
|
uint32_t rgbVal = HSVtoRGB(hue, s, v);
|
||||||
dc->drawPixel((s * 2) + SCREEN_LEFT_MARGIN , ((MAX_BRIGHTNESS - v)) + GRID_TOP_MARGIN, rgbVal);
|
dc->drawPixel((s * 2) + SCREEN_LEFT_MARGIN,
|
||||||
dc->drawPixel((s * 2) + SCREEN_LEFT_MARGIN + 1, ((MAX_BRIGHTNESS - v)) + GRID_TOP_MARGIN, rgbVal);
|
((MAX_BRIGHTNESS - v)) + GRID_TOP_MARGIN, rgbVal);
|
||||||
|
dc->drawPixel((s * 2) + SCREEN_LEFT_MARGIN + 1,
|
||||||
|
((MAX_BRIGHTNESS - v)) + GRID_TOP_MARGIN, rgbVal);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dc->drawFilledCircle((this->s * 2) + SCREEN_LEFT_MARGIN, (MAX_BRIGHTNESS - this->v) + GRID_TOP_MARGIN, 3, COLOR2FLAGS(WHITE));
|
dc->drawFilledCircle((this->s * 2) + SCREEN_LEFT_MARGIN,
|
||||||
|
(MAX_BRIGHTNESS - this->v) + GRID_TOP_MARGIN, 3,
|
||||||
|
COLOR2FLAGS(WHITE));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ColorEditorContent::drawColorBox(BitmapBuffer *dc)
|
void ColorEditorContent::drawColorBox(BitmapBuffer *dc)
|
||||||
{
|
{
|
||||||
int32_t rgb = RGB(r,g,b);
|
int32_t rgb = RGB(r, g, b);
|
||||||
|
|
||||||
dc->drawSolidFilledRect(COLOR_BOX_LEFT, COLOR_BOX_TOP, COLOR_BOX_WIDTH, COLOR_BOX_HEIGHT, COLOR2FLAGS(rgb));
|
dc->drawSolidFilledRect(COLOR_BOX_LEFT, COLOR_BOX_TOP, COLOR_BOX_WIDTH,
|
||||||
dc->drawSolidRect(COLOR_BOX_LEFT, COLOR_BOX_TOP, COLOR_BOX_WIDTH, COLOR_BOX_HEIGHT, 1, COLOR2FLAGS(BLACK));
|
COLOR_BOX_HEIGHT, COLOR2FLAGS(rgb));
|
||||||
|
dc->drawSolidRect(COLOR_BOX_LEFT, COLOR_BOX_TOP, COLOR_BOX_WIDTH,
|
||||||
|
COLOR_BOX_HEIGHT, 1, COLOR2FLAGS(BLACK));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ColorEditorContent::paint(BitmapBuffer *dc)
|
void ColorEditorContent::paint(BitmapBuffer *dc)
|
||||||
@@ -212,18 +197,17 @@ void ColorEditorContent::paint(BitmapBuffer *dc)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
///// ColorEditorPopup
|
///// ColorEditorPopup
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
ColorEditorPopup::ColorEditorPopup(Window *window, std::function<uint32_t ()> getValue, std::function<void (uint32_t value)> setValue) :
|
ColorEditorPopup::ColorEditorPopup(
|
||||||
ModalWindow(window, true),
|
Window *window, std::function<uint32_t()> getValue,
|
||||||
_getValue(getValue),
|
std::function<void(uint32_t value)> setValue) :
|
||||||
_setValue(setValue)
|
ModalWindow(window, true), _getValue(getValue), _setValue(setValue)
|
||||||
{
|
{
|
||||||
color = _getValue();
|
color = _getValue();
|
||||||
content = new ColorEditorContent(this, contentRect, color, [=] (uint32_t rgb) {
|
content = new ColorEditorContent(this, contentRect, color, [=](uint32_t rgb) {
|
||||||
if (_setValue != nullptr)
|
if (_setValue != nullptr) _setValue(rgb);
|
||||||
_setValue(rgb);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
bringToTop();
|
bringToTop();
|
||||||
@@ -232,17 +216,9 @@ ColorEditorPopup::ColorEditorPopup(Window *window, std::function<uint32_t ()> ge
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if defined(HARDWARE_TOUCH)
|
#if defined(HARDWARE_TOUCH)
|
||||||
bool ColorEditorPopup::onTouchStart(coord_t x, coord_t y)
|
|
||||||
{
|
|
||||||
TRACE("ColorEditorPopup::onTouchStart");
|
|
||||||
// content->onTouchStart(x - content->rect.x + content->scrollPositionX, y - content->rect.y + content->scrollPositionY);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ColorEditorPopup::onTouchEnd(coord_t x, coord_t y)
|
bool ColorEditorPopup::onTouchEnd(coord_t x, coord_t y)
|
||||||
{
|
{
|
||||||
TRACE("ColorEditorPopup::onTouchEnd");
|
TRACE("ColorEditorPopup::onTouchEnd");
|
||||||
// content->onTouchEnd(x - content->rect.x + content->scrollPositionX, y - content->rect.y + content->scrollPositionY);
|
|
||||||
if (!Window::onTouchEnd(x, y) && closeWhenClickOutside) {
|
if (!Window::onTouchEnd(x, y) && closeWhenClickOutside) {
|
||||||
onKeyPress();
|
onKeyPress();
|
||||||
deleteLater();
|
deleteLater();
|
||||||
@@ -253,11 +229,7 @@ bool ColorEditorPopup::onTouchEnd(coord_t x, coord_t y)
|
|||||||
|
|
||||||
void ColorEditorPopup::deleteLater(bool detach, bool trash)
|
void ColorEditorPopup::deleteLater(bool detach, bool trash)
|
||||||
{
|
{
|
||||||
if (_deleted)
|
if (_deleted) return;
|
||||||
return;
|
|
||||||
|
|
||||||
Layer::pop(this);
|
Layer::pop(this);
|
||||||
Window::deleteLater(detach, trash);
|
Window::deleteLater(detach, trash);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -31,68 +31,59 @@
|
|||||||
class ColorEditorContent : public ModalWindowContent
|
class ColorEditorContent : public ModalWindowContent
|
||||||
{
|
{
|
||||||
friend class ColorEditorPopup;
|
friend class ColorEditorPopup;
|
||||||
public:
|
|
||||||
ColorEditorContent(ModalWindow *window, const rect_t rect, uint32_t color, std::function<void (uint32_t rgb)> setValue = nullptr);
|
public:
|
||||||
|
ColorEditorContent(ModalWindow *window, const rect_t rect, uint32_t color,
|
||||||
|
std::function<void(uint32_t rgb)> setValue = nullptr);
|
||||||
|
|
||||||
#if defined(DEBUG_WINDOWS)
|
#if defined(DEBUG_WINDOWS)
|
||||||
std::string getName() const override
|
std::string getName() const override { return "ColorEditorContent"; }
|
||||||
{
|
|
||||||
return "ColorEditorContent";
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(HARDWARE_TOUCH)
|
#if defined(HARDWARE_TOUCH)
|
||||||
bool onTouchSlide(coord_t x, coord_t y, coord_t startX, coord_t startY, coord_t slideX, coord_t slideY) override;
|
bool onTouchEnd(coord_t x, coord_t y) override;
|
||||||
bool onTouchEnd(coord_t x, coord_t y) override;
|
bool onTouchStart(coord_t x, coord_t y) override;
|
||||||
bool onTouchStart(coord_t x, coord_t y) override;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(HARDWARE_KEYS)
|
void onEvent(event_t event) override;
|
||||||
void onEvent(event_t event) override;
|
void paint(BitmapBuffer *dc) override;
|
||||||
#endif
|
|
||||||
|
|
||||||
void paint(BitmapBuffer *dc) override;
|
protected:
|
||||||
|
bool sliding = false;
|
||||||
|
bool colorPicking = false;
|
||||||
|
int r, g, b;
|
||||||
|
int hue = 0, s, v;
|
||||||
|
NumberEdit *rEdit;
|
||||||
|
NumberEdit *gEdit;
|
||||||
|
NumberEdit *bEdit;
|
||||||
|
|
||||||
protected:
|
void drawHueBar(BitmapBuffer *dc);
|
||||||
bool sliding = false;
|
void drawGrid(BitmapBuffer *dc);
|
||||||
bool colorPicking = false;
|
void drawColorBox(BitmapBuffer *dc);
|
||||||
int r, g, b;
|
void setRGB();
|
||||||
int hue = 0, s, v;
|
std::function<void(uint32_t rgb)> setValue;
|
||||||
NumberEdit *rEdit;
|
|
||||||
NumberEdit *gEdit;
|
|
||||||
NumberEdit *bEdit;
|
|
||||||
|
|
||||||
void drawHueBar(BitmapBuffer *dc);
|
|
||||||
void drawGrid(BitmapBuffer *dc);
|
|
||||||
void drawColorBox(BitmapBuffer *dc);
|
|
||||||
void setRGB();
|
|
||||||
std::function<void (uint32_t rgb)> setValue;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// a color editor popup
|
// a color editor popup
|
||||||
class ColorEditorPopup : public ModalWindow
|
class ColorEditorPopup : public ModalWindow
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ColorEditorPopup(Window *window, std::function<uint32_t ()> getValue, std::function<void (uint32_t value)> setValue = nullptr);
|
ColorEditorPopup(Window *window, std::function<uint32_t()> getValue,
|
||||||
|
std::function<void(uint32_t value)> setValue = nullptr);
|
||||||
|
|
||||||
void deleteLater(bool detach = true, bool trash = true) override;
|
void deleteLater(bool detach = true, bool trash = true) override;
|
||||||
|
|
||||||
#if defined(DEBUG_WINDOWS)
|
#if defined(DEBUG_WINDOWS)
|
||||||
std::string getName() const override
|
std::string getName() const override { return "ColorEditorPopup"; }
|
||||||
{
|
|
||||||
return "ColorEditorPopup";
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(HARDWARE_TOUCH)
|
#if defined(HARDWARE_TOUCH)
|
||||||
bool onTouchStart(coord_t x, coord_t y) override;
|
bool onTouchEnd(coord_t x, coord_t y) override;
|
||||||
bool onTouchEnd(coord_t x, coord_t y) override;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
uint32_t color;
|
uint32_t color;
|
||||||
ColorEditorContent *content;
|
ColorEditorContent *content;
|
||||||
std::function<uint32_t ()> _getValue;
|
std::function<uint32_t()> _getValue;
|
||||||
std::function<void (uint32_t value)> _setValue;
|
std::function<void(uint32_t value)> _setValue;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -154,10 +154,10 @@ void FullScreenDialog::runForever()
|
|||||||
{
|
{
|
||||||
running = true;
|
running = true;
|
||||||
|
|
||||||
MainWindow* mainWin = MainWindow::instance();
|
// MainWindow* mainWin = MainWindow::instance();
|
||||||
#if defined(HARDWARE_TOUCH)
|
// #if defined(HARDWARE_TOUCH)
|
||||||
mainWin->setTouchEnabled(true);
|
// mainWin->setTouchEnabled(true);
|
||||||
#endif
|
// #endif
|
||||||
|
|
||||||
// reset input devices to avoid
|
// reset input devices to avoid
|
||||||
// RELEASED/CLICKED to be called in a loop
|
// RELEASED/CLICKED to be called in a loop
|
||||||
@@ -188,10 +188,10 @@ void FullScreenDialog::runForeverNoPwrCheck()
|
|||||||
{
|
{
|
||||||
running = true;
|
running = true;
|
||||||
|
|
||||||
MainWindow* mainWin = MainWindow::instance();
|
// MainWindow* mainWin = MainWindow::instance();
|
||||||
#if defined(HARDWARE_TOUCH)
|
// #if defined(HARDWARE_TOUCH)
|
||||||
mainWin->setTouchEnabled(true);
|
// mainWin->setTouchEnabled(true);
|
||||||
#endif
|
// #endif
|
||||||
while (running) {
|
while (running) {
|
||||||
resetBacklightTimeout();
|
resetBacklightTimeout();
|
||||||
run_ui_manually();
|
run_ui_manually();
|
||||||
|
|||||||
+9
-17
@@ -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) {
|
if (requiredBacklightBright == BACKLIGHT_FORCED_ON) {
|
||||||
currentBacklightBright = g_eeGeneral.backlightBright;
|
currentBacklightBright = g_eeGeneral.backlightBright;
|
||||||
BACKLIGHT_ENABLE();
|
BACKLIGHT_ENABLE();
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
bool backlightOn = ((g_eeGeneral.backlightMode == e_backlight_mode_on) ||
|
bool backlightOn = ((g_eeGeneral.backlightMode == e_backlight_mode_on) ||
|
||||||
(g_eeGeneral.backlightMode != e_backlight_mode_off && lightOffCounter) ||
|
(g_eeGeneral.backlightMode != e_backlight_mode_off &&
|
||||||
(g_eeGeneral.backlightMode == e_backlight_mode_off && isFunctionActive(FUNCTION_BACKLIGHT)));
|
lightOffCounter) ||
|
||||||
|
(g_eeGeneral.backlightMode == e_backlight_mode_off &&
|
||||||
|
isFunctionActive(FUNCTION_BACKLIGHT)));
|
||||||
|
|
||||||
if (flashCounter) {
|
if (flashCounter) {
|
||||||
backlightOn = !backlightOn;
|
backlightOn = !backlightOn;
|
||||||
@@ -589,12 +581,11 @@ void checkBacklight()
|
|||||||
currentBacklightBright = requiredBacklightBright;
|
currentBacklightBright = requiredBacklightBright;
|
||||||
#if defined(COLORLCD)
|
#if defined(COLORLCD)
|
||||||
// force backlight on for color lcd radios
|
// 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;
|
currentBacklightBright = BACKLIGHT_LEVEL_MAX - BACKLIGHT_LEVEL_MIN;
|
||||||
#endif
|
#endif
|
||||||
BACKLIGHT_ENABLE();
|
BACKLIGHT_ENABLE();
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
BACKLIGHT_DISABLE();
|
BACKLIGHT_DISABLE();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -605,7 +596,8 @@ void resetBacklightTimeout()
|
|||||||
{
|
{
|
||||||
uint16_t autoOff = g_eeGeneral.lightAutoOff;
|
uint16_t autoOff = g_eeGeneral.lightAutoOff;
|
||||||
#if defined(COLORLCD)
|
#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
|
#endif
|
||||||
lightOffCounter = (autoOff*250) << 1;
|
lightOffCounter = (autoOff*250) << 1;
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+1
-1
Submodule radio/src/thirdparty/libopenui updated: 1e83627d94...2a699f960b
Reference in New Issue
Block a user