Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Always on display #1869

Merged
merged 15 commits into from
Aug 5, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
aod: simplify AOD disablement based on notification status
  • Loading branch information
mark9064 committed Jul 21, 2024
commit cc1d4fe4ccd90b91b8a3865cd81857f1dcbfbb52
37 changes: 5 additions & 32 deletions src/components/settings/Settings.h
Original file line number Diff line number Diff line change
@@ -196,14 +196,6 @@ 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;
};

@@ -222,31 +214,19 @@ namespace Pinetime {
return settings.screenTimeOut;
};

void SetAlwaysOnDisplay(bool state) {
if (state != settings.alwaysOnDisplay.state) {
settingsChanged = true;
}
settings.alwaysOnDisplay.state = state;
};

bool GetAlwaysOnDisplay() const {
return settings.alwaysOnDisplay.state;
return settings.alwaysOnDisplay && GetNotificationStatus() != Notification::Sleep;
};

void SetAlwaysOnDisplaySetting(bool state) {
if (state != settings.alwaysOnDisplay.enabled) {
if (state != settings.alwaysOnDisplay) {
settingsChanged = true;
}
settings.alwaysOnDisplay.enabled = state;

// Don't enable always on if we are currently in notification sleep
if (GetNotificationStatus() != Notification::Sleep) {
SetAlwaysOnDisplay(state);
}
settings.alwaysOnDisplay = state;
}

bool GetAlwaysOnDisplaySetting() const {
return settings.alwaysOnDisplay.enabled;
return settings.alwaysOnDisplay;
}

void SetShakeThreshold(uint16_t thresh) {
@@ -323,19 +303,12 @@ 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;

alwaysOnDisplayData alwaysOnDisplay;
bool alwaysOnDisplay = false;

ClockType clockType = ClockType::H24;
WeatherFormat weatherFormat = WeatherFormat::Metric;
Loading