aod: disable while in notification sleep

This commit is contained in:
John Crawford
2023-10-03 18:50:36 -06:00
committed by JF
parent 85a2181b64
commit e884b053d3
2 changed files with 38 additions and 7 deletions

View File

@@ -196,6 +196,14 @@ namespace Pinetime {
if (status != settings.notificationStatus) {
settingsChanged = true;
}
// Disable always on screen while sleep mode is enabled
if (settings.alwaysOnDisplay.enabled) {
if (status == Notification::Sleep) {
settings.alwaysOnDisplay.state = false;
} else {
settings.alwaysOnDisplay.state = true;
}
}
settings.notificationStatus = status;
};
@@ -215,16 +223,32 @@ namespace Pinetime {
};
void SetAlwaysOnDisplay(bool state) {
if (state != settings.alwaysOnDisplay) {
if (state != settings.alwaysOnDisplay.state) {
settingsChanged = true;
}
settings.alwaysOnDisplay = state;
settings.alwaysOnDisplay.state = state;
};
bool GetAlwaysOnDisplay() const {
return settings.alwaysOnDisplay;
return settings.alwaysOnDisplay.state;
};
void SetAlwaysOnDisplaySetting(bool state) {
if (state != settings.alwaysOnDisplay.enabled) {
settingsChanged = true;
}
settings.alwaysOnDisplay.enabled = state;
// Don't enable always on if we are currently in notification sleep
if (GetNotificationStatus() != Notification::Sleep) {
SetAlwaysOnDisplay(state);
}
}
bool GetAlwaysOnDisplaySetting() const {
return settings.alwaysOnDisplay.enabled;
}
void SetShakeThreshold(uint16_t thresh) {
if (settings.shakeWakeThreshold != thresh) {
settings.shakeWakeThreshold = thresh;
@@ -299,12 +323,19 @@ namespace Pinetime {
static constexpr uint32_t settingsVersion = 0x0008;
// To enable disabling it during notification sleep, differentiate between
// the setting being on, and the setting being set by the user
struct alwaysOnDisplayData {
bool enabled = false;
bool state = false;
};
struct SettingsData {
uint32_t version = settingsVersion;
uint32_t stepsGoal = 10000;
uint32_t screenTimeOut = 15000;
bool alwaysOnDisplay = false;
alwaysOnDisplayData alwaysOnDisplay;
ClockType clockType = ClockType::H24;
WeatherFormat weatherFormat = WeatherFormat::Metric;