From 41ab90ad3616ab8b87413ba0ebd25213b839ddd0 Mon Sep 17 00:00:00 2001 From: Raphael Coeffic Date: Sun, 12 Jun 2022 11:58:57 +0200 Subject: [PATCH] fix(dynamic numbers): precision flags --- radio/src/thirdparty/libopenui/src/static.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/radio/src/thirdparty/libopenui/src/static.h b/radio/src/thirdparty/libopenui/src/static.h index f53f76f56..b408d18af 100644 --- a/radio/src/thirdparty/libopenui/src/static.h +++ b/radio/src/thirdparty/libopenui/src/static.h @@ -186,11 +186,10 @@ class DynamicNumber : public StaticText if (lvobj) { const char *p = prefix ? prefix : ""; const char *s = suffix ? suffix : ""; - if (textFlags & PREC1) { + if ((textFlags & PREC2) == PREC2) { + lv_label_set_text_fmt(lvobj, "%s%d.%02d%s", p, value / 100, value % 100, s); + } else if (textFlags & PREC1) { lv_label_set_text_fmt(lvobj, "%s%d.%01d%s", p, value / 10, value % 10, s); - } else if (textFlags & PREC2) { - lv_label_set_text_fmt(lvobj, "%s%d.%02d%s", p, value / 100, - value % 100, s); } else { lv_label_set_text_fmt(lvobj, "%s%d%s", p, value, s); }