Skip to content

Commit cc1d4fe

Browse files
committed
aod: simplify AOD disablement based on notification status
1 parent 2b1f194 commit cc1d4fe

File tree

1 file changed

+5
-32
lines changed

1 file changed

+5
-32
lines changed

src/components/settings/Settings.h

+5-32
Original file line numberDiff line numberDiff line change
@@ -196,14 +196,6 @@ namespace Pinetime {
196196
if (status != settings.notificationStatus) {
197197
settingsChanged = true;
198198
}
199-
// Disable always on screen while sleep mode is enabled
200-
if (settings.alwaysOnDisplay.enabled) {
201-
if (status == Notification::Sleep) {
202-
settings.alwaysOnDisplay.state = false;
203-
} else {
204-
settings.alwaysOnDisplay.state = true;
205-
}
206-
}
207199
settings.notificationStatus = status;
208200
};
209201

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

225-
void SetAlwaysOnDisplay(bool state) {
226-
if (state != settings.alwaysOnDisplay.state) {
227-
settingsChanged = true;
228-
}
229-
settings.alwaysOnDisplay.state = state;
230-
};
231-
232217
bool GetAlwaysOnDisplay() const {
233-
return settings.alwaysOnDisplay.state;
218+
return settings.alwaysOnDisplay && GetNotificationStatus() != Notification::Sleep;
234219
};
235220

236221
void SetAlwaysOnDisplaySetting(bool state) {
237-
if (state != settings.alwaysOnDisplay.enabled) {
222+
if (state != settings.alwaysOnDisplay) {
238223
settingsChanged = true;
239224
}
240-
settings.alwaysOnDisplay.enabled = state;
241-
242-
// Don't enable always on if we are currently in notification sleep
243-
if (GetNotificationStatus() != Notification::Sleep) {
244-
SetAlwaysOnDisplay(state);
245-
}
225+
settings.alwaysOnDisplay = state;
246226
}
247227

248228
bool GetAlwaysOnDisplaySetting() const {
249-
return settings.alwaysOnDisplay.enabled;
229+
return settings.alwaysOnDisplay;
250230
}
251231

252232
void SetShakeThreshold(uint16_t thresh) {
@@ -323,19 +303,12 @@ namespace Pinetime {
323303

324304
static constexpr uint32_t settingsVersion = 0x0008;
325305

326-
// To enable disabling it during notification sleep, differentiate between
327-
// the setting being on, and the setting being set by the user
328-
struct alwaysOnDisplayData {
329-
bool enabled = false;
330-
bool state = false;
331-
};
332-
333306
struct SettingsData {
334307
uint32_t version = settingsVersion;
335308
uint32_t stepsGoal = 10000;
336309
uint32_t screenTimeOut = 15000;
337310

338-
alwaysOnDisplayData alwaysOnDisplay;
311+
bool alwaysOnDisplay = false;
339312

340313
ClockType clockType = ClockType::H24;
341314
WeatherFormat weatherFormat = WeatherFormat::Metric;

0 commit comments

Comments
 (0)