autoreset: bootloader app - universal timeout to clock face

pull/3222/head
thyttan 2024-02-28 20:52:46 +01:00
parent d35ee5a142
commit 5240c4b1d3
5 changed files with 55 additions and 0 deletions

1
apps/autoreset/ChangeLog Normal file
View File

@ -0,0 +1 @@
0.01: New App!

21
apps/autoreset/README.md Normal file
View File

@ -0,0 +1,21 @@
# Auto Reset
Sets a timeout to load the clock face. The timeout is stopped and started again upon user input.
## Usage
Install with app loader and Auto Reset will run in background. If you don't interact with the watch it will time out to the clock face after 10 minutes.
## TODO
- Add settings page
- set how many minutes the timeout should count down.
- whitelist/blacklist for apps.
## Requests
Mention @thyttan in an issue on the espruino/BangleApps repo for bug reports and feature requests.
## Creator
thyttan

BIN
apps/autoreset/app.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

20
apps/autoreset/boot.js Normal file
View File

@ -0,0 +1,20 @@
{
let timeoutAutoreset;
let resetTimeoutAutoreset = (force)=>{
if (timeoutAutoreset) clearTimeout(timeoutAutoreset);
setTimeout(()=>{ // Short outer timeout to make sure we have time to leave clock face before checking `Bangle.CLOCK!=1`.
if (Bangle.CLOCK!=1) { // Only add timeout if not already on clock face.
timeoutAutoreset = setTimeout(()=>{
if (Bangle.CLOCK!=1) Bangle.showClock();
}, 10*60*1000);
}
},200);
};
Bangle.on('touch', resetTimeoutAutoreset);
Bangle.on('swipe', resetTimeoutAutoreset);
Bangle.on('message', resetTimeoutAutoreset);
setWatch(resetTimeoutAutoreset, BTN, {repeat:true, edge:'rising'});
if (Bangle.CLOCK!=1) resetTimeoutAutoreset();
}

View File

@ -0,0 +1,13 @@
{ "id": "autoreset",
"name": "Auto Reset",
"version":"0.01",
"description": "Sets a timeout to load the clock face. The timeout is stopped and started again upon user input.",
"icon": "app.png",
"type": "bootloader",
"tags": "system",
"supports" : ["BANGLEJS2"],
"readme": "README.md",
"storage": [
{"name":"autoreset.boot.js","url":"boot.js"}
]
}