1
0
Fork 0

date format is now a build-time choice, not tied to 12/24h setting

This commit is contained in:
Julian Foad 2024-05-10 20:06:16 +01:00
parent 7d74749b45
commit c78e210f3c
3 changed files with 8 additions and 2 deletions

View file

@ -10,6 +10,7 @@ namespace Pinetime {
class Settings {
public:
enum class ClockType : uint8_t { H24, H12 };
enum class DateType : uint8_t { Ddmy, Dmdy };
enum class WeatherFormat : uint8_t { Metric, Imperial };
enum class Notification : uint8_t { On, Off, Sleep };
enum class ChimesOption : uint8_t { None, Hours, HalfHours };
@ -181,6 +182,11 @@ namespace Pinetime {
return settings.clockType;
};
DateType GetDateType() const {
// a build-time choice (no run-time setting)
return DateType::Ddmy;
};
void SetWeatherFormat(WeatherFormat weatherFormat) {
if (weatherFormat != settings.weatherFormat) {
settingsChanged = true;

View file

@ -252,7 +252,7 @@ void WatchFaceCasioStyleG7710::Refresh() {
Controllers::DateTime::Months month = dateTimeController.Month();
uint8_t day = dateTimeController.Day();
int dayOfYear = dateTimeController.DayOfYear();
if (settingsController.GetClockType() == Controllers::Settings::ClockType::H24) {
if (settingsController.GetDateType() == Controllers::Settings::DateType::Ddmy) {
// 24h mode: ddmmyyyy, first DOW=Monday;
lv_label_set_text_fmt(label_date, "%3d-%2d", day, month);
weekNumberFormat = "%V"; // Replaced by the week number of the year (Monday as the first day of the week) as a decimal number

View file

@ -138,7 +138,7 @@ void WatchFaceDigital::Refresh() {
uint16_t year = dateTimeController.Year();
uint8_t day = dateTimeController.Day();
Controllers::DateTime::Days dayOfWeek = dateTimeController.DayOfWeek();
if (settingsController.GetClockType() == Controllers::Settings::ClockType::H24) {
if (settingsController.GetDateType() == Controllers::Settings::DateType::Ddmy) {
lv_label_set_text_fmt(label_date,
"%s %d %s %d",
dateTimeController.DayOfWeekShortToStringLow(dayOfWeek),