settings: Add settings item for weather format

This commit is contained in:
FintasticMan
2023-07-15 02:23:10 +02:00
committed by JF
parent c04813b6d3
commit d889f3e444
8 changed files with 114 additions and 4 deletions

View File

@@ -10,6 +10,7 @@ namespace Pinetime {
class Settings {
public:
enum class ClockType : uint8_t { H24, H12 };
enum class WeatherFormat : uint8_t { Metric, Imperial };
enum class Notification : uint8_t { On, Off, Sleep };
enum class ChimesOption : uint8_t { None, Hours, HalfHours };
enum class WakeUpMode : uint8_t { SingleTap = 0, DoubleTap = 1, RaiseWrist = 2, Shake = 3, LowerWrist = 4 };
@@ -180,6 +181,17 @@ namespace Pinetime {
return settings.clockType;
};
void SetWeatherFormat(WeatherFormat weatherFormat) {
if (weatherFormat != settings.weatherFormat) {
settingsChanged = true;
}
settings.weatherFormat = weatherFormat;
};
WeatherFormat GetWeatherFormat() const {
return settings.weatherFormat;
};
void SetNotificationStatus(Notification status) {
if (status != settings.notificationStatus) {
settingsChanged = true;
@@ -274,7 +286,7 @@ namespace Pinetime {
private:
Pinetime::Controllers::FS& fs;
static constexpr uint32_t settingsVersion = 0x0006;
static constexpr uint32_t settingsVersion = 0x0007;
struct SettingsData {
uint32_t version = settingsVersion;
@@ -282,6 +294,7 @@ namespace Pinetime {
uint32_t screenTimeOut = 15000;
ClockType clockType = ClockType::H24;
WeatherFormat weatherFormat = WeatherFormat::Metric;
Notification notificationStatus = Notification::On;
Pinetime::Applications::WatchFace watchFace = Pinetime::Applications::WatchFace::Digital;