Merge pull request #1743 from alessandrococco/sched-update-settings

[Scheduler] Add "Default Repeat" to settings
pull/1746/head
Gordon Williams 2022-04-25 12:00:50 +01:00 committed by GitHub
commit 545d84d575
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 17 additions and 4 deletions

View File

@ -4,4 +4,6 @@
0.04: Fix `getTimeToAlarm` to check for next dow if alarm.t lower currentTime.
0.05: Export new functions (`newDefaultAlarm/Timer`), add Settings page
0.06: Refactor some methods to library
0.07: Correct `decodeTime(t)` to return a more likely expected time
0.07: Update settings
Correct `decodeTime(t)` to return a more likely expected time

View File

@ -16,6 +16,7 @@ Global Settings
- `Unlock at Buzz` - If `Yes` the alarm/timer will unlock the watch
- `Default Auto Snooze` - Default _Auto Snooze_ value for newly created alarms (_Alarms_ only)
- `Default Snooze` - Default _Snooze_ value for newly created alarms/timers
- `Default Repeat` - Default _Repeat_ value for newly created alarms (_Alarms_ only)
- `Buzz Count` - The number of buzzes before the watch goes silent
- `Buzz Interval` - The interval between one buzz and the next
- `Default Alarm/Timer Pattern` - Default vibration pattern for newly created alarms/timers
@ -38,7 +39,7 @@ Alarms are stored in an array in `sched.json`, and take the form:
// WED = 8
// THU = 16
// FRI = 32
// SAT = 64
// SAT = 64
date : "2022-04-04", // OPTIONAL date for the alarm, in YYYY-MM-DD format
// eg (new Date()).toISOString().substr(0,10)

View File

@ -59,8 +59,8 @@ exports.newDefaultAlarm = function () {
let alarm = {
t: 12 * 3600000, // Default to 12:00
on: true,
rp: false, // repeat not the default
as: settings.defaultAutoSnooze || false,
rp: settings.defaultRepeat,
as: settings.defaultAutoSnooze,
dow: 0b1111111,
last: 0,
vibrate: settings.defaultAlarmPattern,
@ -95,6 +95,7 @@ exports.getSettings = function () {
unlockAtBuzz: false,
defaultSnoozeMillis: 600000, // 10 minutes
defaultAutoSnooze: false,
defaultRepeat: false,
buzzCount: 10,
buzzIntervalMillis: 3000, // 3 seconds
defaultAlarmPattern: "..",

View File

@ -36,6 +36,15 @@
}
},
/*LANG*/"Default Repeat": {
value: settings.defaultRepeat,
format: v => v ? /*LANG*/"Yes" : /*LANG*/"No",
onchange: v => {
settings.defaultRepeat = v;
require("sched").setSettings(settings);
}
},
/*LANG*/"Buzz Count": {
value: settings.buzzCount,
min: 5,