diff --git a/apps/autoreset/ChangeLog b/apps/autoreset/ChangeLog new file mode 100644 index 000000000..5560f00bc --- /dev/null +++ b/apps/autoreset/ChangeLog @@ -0,0 +1 @@ +0.01: New App! diff --git a/apps/autoreset/README.md b/apps/autoreset/README.md new file mode 100644 index 000000000..965b2e291 --- /dev/null +++ b/apps/autoreset/README.md @@ -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 diff --git a/apps/autoreset/app.png b/apps/autoreset/app.png new file mode 100644 index 000000000..695c49931 Binary files /dev/null and b/apps/autoreset/app.png differ diff --git a/apps/autoreset/boot.js b/apps/autoreset/boot.js new file mode 100644 index 000000000..3302eca08 --- /dev/null +++ b/apps/autoreset/boot.js @@ -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(); +} diff --git a/apps/autoreset/metadata.json b/apps/autoreset/metadata.json new file mode 100644 index 000000000..ca35b4d7a --- /dev/null +++ b/apps/autoreset/metadata.json @@ -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"} + ] +}