From 04f3f151b0fe80c17bb25cf4ea669fd0757b2cc1 Mon Sep 17 00:00:00 2001 From: philmoz Date: Wed, 14 May 2025 08:40:20 +1000 Subject: [PATCH] fix(color): outputs widget may not update correctly (#6253) --- radio/src/gui/colorlcd/widgets/outputs.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/radio/src/gui/colorlcd/widgets/outputs.cpp b/radio/src/gui/colorlcd/widgets/outputs.cpp index 6e44ca302..5b70236f2 100644 --- a/radio/src/gui/colorlcd/widgets/outputs.cpp +++ b/radio/src/gui/colorlcd/widgets/outputs.cpp @@ -101,10 +101,10 @@ class ChannelValue : public Window const int lim = (g_model.extendedLimits ? (1024 * LIMIT_EXT_PERCENT / 100) : 1024); uint16_t w = width() - PAD_TINY; - uint16_t fillW = divRoundClosest(w * limit(0, abs(value), lim), lim * 2); + int16_t scaledValue = divRoundClosest(w * limit(-lim, value, lim), lim * 2); - if (fillW != lastValue) { - lastValue = fillW; + if (scaledValue != lastValue) { + lastValue = scaledValue; std::string s; if (g_eeGeneral.ppmunit == PPM_US) @@ -116,6 +116,7 @@ class ChannelValue : public Window lv_label_set_text(valueLabel, s.c_str()); + uint16_t fillW = abs(scaledValue); uint16_t x = value > 0 ? w / 2 : w / 2 - fillW + 1; lv_obj_set_pos(bar, x, 0);