change the logic to buzz at boot instead of before reboot

master
thyttan 2023-04-03 19:46:38 +02:00
parent d410c5acad
commit e34728849f
3 changed files with 4 additions and 9 deletions

View File

@ -1,6 +1,6 @@
# Long Press, Buzz! # Long Press, Buzz!
Buzz on long press (assumed and hardcoded to 1500ms) to indicate the watch will be reinitiated per your command. Buzz at boot after a long press to indicate the watch was reinitiated per your command.
## Usage ## Usage

View File

@ -1,6 +1 @@
let btnLoadTimeout = 1500; //Bangle.getOptions().btnLoadTimeout; // Hardcode value to minimize impact on load time at boot. Change to the commented out code to couple it to the actual system setting in the options object. if (BTN.read()) Bangle.buzz(80,0.40);
let buzzTimeout;
setWatch(function(e) { buzzTimeout = setTimeout(Bangle.buzz, btnLoadTimeout-100, 45, 0.35); }, BTN, {
repeat:true, edge:'rising' });
setWatch(function(e) { if (buzzTimeout) clearTimeout(buzzTimeout); }, BTN, {
repeat:true, edge:'falling' });

View File

@ -2,13 +2,13 @@
"name": "Long Press, Buzz!", "name": "Long Press, Buzz!",
"shortName":"LPB", "shortName":"LPB",
"version":"0.01", "version":"0.01",
"description": "Buzz on long press (assumed and hardcoded to 1500ms) to indicate the watch will be reinitiated per your command.", "description": "Buzz at boot after a long press to indicate the watch was reinitiated per your command.",
"icon": "app.png", "icon": "app.png",
"type": "bootloader", "type": "bootloader",
"tags": "system", "tags": "system",
"supports" : ["BANGLEJS2"], "supports" : ["BANGLEJS2"],
"readme": "README.md", "readme": "README.md",
"storage": [ "storage": [
{"name":"longpressbuzz.boot.js","url":"boot.js"} {"name":"longpressbuzz.0.boot.js","url":"boot.js"}
] ]
} }