@@ -196,6 +196,14 @@ namespace Pinetime {
196
196
if (status != settings.notificationStatus ) {
197
197
settingsChanged = true ;
198
198
}
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
+ }
199
207
settings.notificationStatus = status;
200
208
};
201
209
@@ -215,16 +223,32 @@ namespace Pinetime {
215
223
};
216
224
217
225
void SetAlwaysOnDisplay (bool state) {
218
- if (state != settings.alwaysOnDisplay ) {
226
+ if (state != settings.alwaysOnDisplay . state ) {
219
227
settingsChanged = true ;
220
228
}
221
- settings.alwaysOnDisplay = state;
229
+ settings.alwaysOnDisplay . state = state;
222
230
};
223
231
224
232
bool GetAlwaysOnDisplay () const {
225
- return settings.alwaysOnDisplay ;
233
+ return settings.alwaysOnDisplay . state ;
226
234
};
227
235
236
+ void SetAlwaysOnDisplaySetting (bool state) {
237
+ if (state != settings.alwaysOnDisplay .enabled ) {
238
+ settingsChanged = true ;
239
+ }
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
+ }
246
+ }
247
+
248
+ bool GetAlwaysOnDisplaySetting () const {
249
+ return settings.alwaysOnDisplay .enabled ;
250
+ }
251
+
228
252
void SetShakeThreshold (uint16_t thresh) {
229
253
if (settings.shakeWakeThreshold != thresh) {
230
254
settings.shakeWakeThreshold = thresh;
@@ -299,12 +323,19 @@ namespace Pinetime {
299
323
300
324
static constexpr uint32_t settingsVersion = 0x0008 ;
301
325
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
+
302
333
struct SettingsData {
303
334
uint32_t version = settingsVersion;
304
335
uint32_t stepsGoal = 10000 ;
305
336
uint32_t screenTimeOut = 15000 ;
306
337
307
- bool alwaysOnDisplay = false ;
338
+ alwaysOnDisplayData alwaysOnDisplay;
308
339
309
340
ClockType clockType = ClockType::H24;
310
341
WeatherFormat weatherFormat = WeatherFormat::Metric;
0 commit comments