@@ -78,6 +78,7 @@ void StatusIcons::Update() {
78
78
79
79
if (timer.IsRunning ()) {
80
80
uint8_t activeIconCounter = 0 ;
81
+ uint8_t maxIcons = 0 ;
81
82
lv_obj_t * child = lv_obj_get_child (container, NULL );
82
83
83
84
while (child != NULL ) {
@@ -100,17 +101,21 @@ void StatusIcons::Update() {
100
101
activeIconCounter--;
101
102
}
102
103
103
- // more than 2 icons (plus the batteryIcon) make the timerContainer collide
104
- // with other text, so replace it with a timer icon
105
- if (activeIconCounter > 2 ) {
104
+ std::chrono::seconds secondsRemaining = std::chrono::duration_cast<std::chrono::seconds>(timer.GetTimeRemaining ());
105
+ uint8_t timerMinutes = (secondsRemaining.count () % 3600 ) / 60 ;
106
+ uint8_t timerSeconds = secondsRemaining.count () % 60 ;
107
+ if (timerMinutes > 0 ) {
108
+ maxIcons = 2 ;
109
+ lv_label_set_text_fmt (timeRemaining, " %02d:%02d" , timerMinutes, timerSeconds);
110
+ } else {
111
+ maxIcons = 3 ;
112
+ lv_label_set_text_fmt (timeRemaining, " :%02d" , timerSeconds);
113
+ }
114
+
115
+ if (activeIconCounter > maxIcons) {
106
116
lv_obj_set_hidden (timerContainer, true );
107
117
lv_obj_set_hidden (soloTimerIcon, false );
108
118
} else {
109
- auto secondsRemaining = std::chrono::duration_cast<std::chrono::seconds>(timer.GetTimeRemaining ());
110
- uint8_t minutes = secondsRemaining.count () / 60 ;
111
- uint8_t seconds = secondsRemaining.count () % 60 ;
112
- lv_label_set_text_fmt (timeRemaining, " %02d:%02d" , minutes, seconds);
113
-
114
119
lv_obj_set_hidden (soloTimerIcon, true );
115
120
lv_obj_set_hidden (timerContainer, false );
116
121
}
0 commit comments