Skip to content

Commit 0e57f36

Browse files
committed
DateTimeController: Make DayOfWeekShortToStringLow static
This allows it to be used outside of the current datetime context and makes it consistent with the MonthShortToStringLow function.
1 parent 93d7da1 commit 0e57f36

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

src/components/datetime/DateTimeController.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,8 @@ const char* DateTime::MonthShortToStringLow(Months month) {
115115
return MonthsStringLow[static_cast<uint8_t>(month)];
116116
}
117117

118-
const char* DateTime::DayOfWeekShortToStringLow() const {
119-
return DaysStringShortLow[static_cast<uint8_t>(DayOfWeek())];
118+
const char* DateTime::DayOfWeekShortToStringLow(Days day) {
119+
return DaysStringShortLow[static_cast<uint8_t>(day)];
120120
}
121121

122122
void DateTime::Register(Pinetime::System::SystemTask* systemTask) {

src/components/datetime/DateTimeController.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ namespace Pinetime {
122122
const char* MonthShortToString() const;
123123
const char* DayOfWeekShortToString() const;
124124
static const char* MonthShortToStringLow(Months month);
125-
const char* DayOfWeekShortToStringLow() const;
125+
static const char* DayOfWeekShortToStringLow(Days day);
126126

127127
std::chrono::time_point<std::chrono::system_clock, std::chrono::nanoseconds> CurrentDateTime() const {
128128
return currentDateTime;

src/displayapp/screens/WatchFaceInfineat.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,8 @@ void WatchFaceInfineat::Refresh() {
426426
currentDate = std::chrono::time_point_cast<days>(currentDateTime.Get());
427427
if (currentDate.IsUpdated()) {
428428
uint8_t day = dateTimeController.Day();
429-
lv_label_set_text_fmt(labelDate, "%s %02d", dateTimeController.DayOfWeekShortToStringLow(), day);
429+
Controllers::DateTime::Days dayOfWeek = dateTimeController.DayOfWeek();
430+
lv_label_set_text_fmt(labelDate, "%s %02d", dateTimeController.DayOfWeekShortToStringLow(dayOfWeek), day);
430431
lv_obj_realign(labelDate);
431432
}
432433
}

0 commit comments

Comments
 (0)