patch - call `Bangle.setUI` when exiting settings

pull/1367/head
Joseph Moroney 2022-01-29 08:37:46 +10:00
parent d9cd94226e
commit ddbaf97b7d
3 changed files with 17 additions and 13 deletions

View File

@ -1,3 +1,4 @@
1.00 Added sonic clock app 1.00 [MAJOR] Added sonic clock app
1.01 Fixed text alignment issue; Increased acceleration required to activate twist; 1.01 [PATCH] Fixed text alignment issue; Increased acceleration required to activate twist;
1.10 Added settings menu to control twist threshold and LCD Activity 1.10 [MINOR] Added settings menu to control twist threshold and LCD Activity
1.11 [PATCH] Call `Bangle.setUI` when exiting settings menu, settings tap moved to top

View File

@ -12,7 +12,7 @@ A classic sonic clock featuring run, stop and wait animations.
## Configuration ## Configuration
To access the settings menu, you can **double tap** on the **right** side of the watch. The following options are configurable: To access the settings menu, you can **double tap** on the **top** side of the watch. The following options are configurable:
- `Active Mode` - catering for 'active' behaviour where the `twist` method can be fired undesirably. When `on` this will prevent the LCD from turning on when a `twist` event is fired. - `Active Mode` - catering for 'active' behaviour where the `twist` method can be fired undesirably. When `on` this will prevent the LCD from turning on when a `twist` event is fired.
- `Twist Thresh` - customise the acceleration needed to activate the twist method (see the [`Bangle.setOptions`](https://www.espruino.com/Reference#:~:text=twisted%3F%20default%20%3D%20true-,twistThreshold,-How%20much%20acceleration) method for more info). - `Twist Thresh` - customise the acceleration needed to activate the twist method (see the [`Bangle.setOptions`](https://www.espruino.com/Reference#:~:text=twisted%3F%20default%20%3D%20true-,twistThreshold,-How%20much%20acceleration) method for more info).

View File

@ -264,18 +264,20 @@ const settings = require("Storage").readJSON("sonicclk-settings") || {
let isSettings = false; let isSettings = false;
const settingsMenu = { const settingsMenu = {
"": { "title": "Settings" }, "": { title: "Settings" },
"Active Mode": { "Active Mode": {
value: settings.activeMode, value: settings.activeMode,
format: v => v ? "On" : "Off", format: (v) => (v ? "On" : "Off"),
onchange: v => settings.activeMode = v, onchange: (v) => (settings.activeMode = v),
}, },
"Twist Thresh": { "Twist Thresh": {
value: settings.twistThreshold, value: settings.twistThreshold,
min: 800, max: 4000, step: 200, min: 800,
onchange: v => settings.twistThreshold = v, max: 4000,
step: 200,
onchange: (v) => (settings.twistThreshold = v),
}, },
"Exit" : () => { Exit: () => {
isSettings = false; isSettings = false;
require("Storage").writeJSON("sonicclk-settings", settings); require("Storage").writeJSON("sonicclk-settings", settings);
@ -286,9 +288,10 @@ const settingsMenu = {
}); });
E.showMenu(); E.showMenu();
Bangle.setUI("clock");
draw("reset"); draw("reset");
start(); start();
} },
}; };
g.setTheme({ bg: "#0099ff", fg: "#fff", dark: true }).clear(); g.setTheme({ bg: "#0099ff", fg: "#fff", dark: true }).clear();
@ -313,7 +316,7 @@ Bangle.on("twist", () => {
}); });
Bangle.on("tap", (d) => { Bangle.on("tap", (d) => {
if (d.double && d.dir === "right") { if (d.double && d.dir === "top") {
fullReset(); fullReset();
isSettings = true; isSettings = true;
Bangle.setLocked(false); Bangle.setLocked(false);