From 74db2585d714f9328aa9e4b3f20a996a9bdc82eb Mon Sep 17 00:00:00 2001 From: Alessandro Cocco Date: Sun, 1 May 2022 22:42:28 +0200 Subject: [PATCH] [Settings] Add new option for selecting the first day of the week --- apps/setting/README.md | 2 +- apps/setting/settings.js | 35 +++++++++++++++++++++++------------ 2 files changed, 24 insertions(+), 13 deletions(-) diff --git a/apps/setting/README.md b/apps/setting/README.md index 42e3939fb..77bf70845 100644 --- a/apps/setting/README.md +++ b/apps/setting/README.md @@ -7,7 +7,7 @@ This is Bangle.js's settings menu * **Beep** most Bangle.js do not have a speaker inside, but they can use the vibration motor to beep in different pitches. You can change the behaviour here to use a Piezo speaker if one is connected * **Vibration** enable/disable the vibration motor * **Quiet Mode** prevent notifications/alarms from vibrating/beeping/turning the screen on - see below -* **Locale** set time zone/whether the clock is 12/24 hour (for supported clocks) +* **Locale** set time zone, the time format (12/24h, for supported clocks) and the first day of the week * **Select Clock** if you have more than one clock face, select the default one * **Set Time** Configure the current time - Note that this can be done much more easily by choosing 'Set Time' from the App Loader * **LCD** Configure settings about the screen. How long it stays on, how bright it is, and when it turns on - see below. diff --git a/apps/setting/settings.js b/apps/setting/settings.js index afc7e23c8..a2a3dfbf0 100644 --- a/apps/setting/settings.js +++ b/apps/setting/settings.js @@ -37,18 +37,19 @@ function internalToG(u) { function resetSettings() { settings = { - ble: true, // Bluetooth enabled by default - blerepl: true, // Is REPL on Bluetooth - can Espruino IDE be used? - log: false, // Do log messages appear on screen? - quiet: 0, // quiet mode: 0: off, 1: priority only, 2: total silence - timeout: 10, // Default LCD timeout in seconds - vibrate: true, // Vibration enabled by default. App must support - beep: BANGLEJS2?true:"vib", // Beep enabled by default. App must support - timezone: 0, // Set the timezone for the device - HID: false, // BLE HID mode, off by default - clock: null, // a string for the default clock's name - "12hour" : false, // 12 or 24 hour clock? - brightness: 1, // LCD brightness from 0 to 1 + ble: true, // Bluetooth enabled by default + blerepl: true, // Is REPL on Bluetooth - can Espruino IDE be used? + log: false, // Do log messages appear on screen? + quiet: 0, // quiet mode: 0: off, 1: priority only, 2: total silence + timeout: 10, // Default LCD timeout in seconds + vibrate: true, // Vibration enabled by default. App must support + beep: BANGLEJS2 ? true : "vib", // Beep enabled by default. App must support + timezone: 0, // Set the timezone for the device + HID: false, // BLE HID mode, off by default + clock: null, // a string for the default clock's name + "12hour" : false, // 12 or 24 hour clock? + firstDayOfWeek: 0, // 0 -> Sunday (default), 1 -> Monday + brightness: 1, // LCD brightness from 0 to 1 // welcomed : undefined/true (whether welcome app should show) options: { wakeOnBTN1: true, @@ -493,6 +494,16 @@ function showLocaleMenu() { settings["12hour"] = v; updateSettings(); } + }, + /*LANG*/'Start Week On': { + value: settings["firstDayOfWeek"] || 0, + min: 0, // Sunday + max: 1, // Monday + format: v => require("date_utils").dow(v, 1), + onchange: v => { + settings["firstDayOfWeek"] = v; + updateSettings(); + }, } }; return E.showMenu(localemenu);