@@ -131,25 +131,28 @@ void WatchFaceTrans::Refresh() {
131
131
uint8_t minute = dateTimeController.Minutes ();
132
132
uint8_t second = dateTimeController.Seconds ();
133
133
134
+ if (settingsController.GetClockType () == Controllers::Settings::ClockType::H12) {
135
+ if (hour == 0 ) {
136
+ ampmChar = " AM" ;
137
+ hour = 12 ;
138
+ } else if (hour == 12 ) {
139
+ ampmChar = " PM" ;
140
+ } else if (hour > 12 ) {
141
+ hour = hour - 12 ;
142
+ ampmChar = " PM" ;
143
+ }
144
+ }
145
+
134
146
lv_label_set_text_fmt (labelTime, " #000000 %02d:%02d:%02d#" , hour, minute, second);
135
147
136
148
currentDate = std::chrono::time_point_cast<std::chrono::days>(currentDateTime.Get ());
137
- if (currentDate.IsUpdated ()) {
149
+ if (currentDate.IsUpdated () || ampmChar. IsUpdated () ) {
138
150
uint16_t year = dateTimeController.Year ();
139
151
Controllers::DateTime::Months month = dateTimeController.Month ();
140
152
uint8_t day = dateTimeController.Day ();
141
153
Controllers::DateTime::Days dayOfWeek = dateTimeController.DayOfWeek ();
142
154
lv_label_set_text_fmt (labelDate, " #ffffff %02d-%02d-%04d#" , day, static_cast <uint8_t >(month), year);
143
155
if (settingsController.GetClockType () == Controllers::Settings::ClockType::H12) {
144
- char ampmChar[3 ] = " AM" ;
145
- if (hour == 0 ) {
146
- hour = 12 ;
147
- } else if (hour == 12 ) {
148
- ampmChar[0 ] = ' P' ;
149
- } else if (hour > 12 ) {
150
- hour = hour - 12 ;
151
- ampmChar[0 ] = ' P' ;
152
- }
153
156
lv_label_set_text_fmt (labelDay, " #ffffff %s %s#" , dateTimeController.DayOfWeekToStringLow (dayOfWeek), ampmChar);
154
157
} else {
155
158
lv_label_set_text_fmt (labelDay, " #ffffff %s#" , dateTimeController.DayOfWeekToStringLow (dayOfWeek));
0 commit comments