fix(dynamic numbers): precision flags
This commit is contained in:
+3
-4
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user