From 5240c4b1d307c7e39394a59585cb02487f1b9da0 Mon Sep 17 00:00:00 2001 From: thyttan <6uuxstm66@mozmail.com⁩> Date: Wed, 28 Feb 2024 20:52:46 +0100 Subject: [PATCH] autoreset: bootloader app - universal timeout to clock face --- apps/autoreset/ChangeLog | 1 + apps/autoreset/README.md | 21 +++++++++++++++++++++ apps/autoreset/app.png | Bin 0 -> 1448 bytes apps/autoreset/boot.js | 20 ++++++++++++++++++++ apps/autoreset/metadata.json | 13 +++++++++++++ 5 files changed, 55 insertions(+) create mode 100644 apps/autoreset/ChangeLog create mode 100644 apps/autoreset/README.md create mode 100644 apps/autoreset/app.png create mode 100644 apps/autoreset/boot.js create mode 100644 apps/autoreset/metadata.json 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 0000000000000000000000000000000000000000..695c49931c8aabdcba329c0ff99ae7bf996f5157 GIT binary patch literal 1448 zcmV;Z1y}lsP)|yv{f=N=51Mo}pGwdcOEJd)b*Y zUe-S6Y{v)xu;5(QUhDtcd+l$3>)XJ&&UGf_2_PH5`v7_X`~+YFfK_e$c@{u7fcF4o z0Pw&W&~pGj0bl_@8r$yxJ^~Q-B#b``;A;R6g`wEkSh{xY8nw5#)8ynNZES3i)oP{v z{e4nk9>1K{h*Gq0Er3=CA(vaGVQvM4`4U%LP3=qLpQ1PF+4 zU3DdtWfK$>L=PT3AiZ_(-aYd7_ZJXfIBWh@v23)Qd1qxdo5{z=M?e%i6DpNxbL-YE zI&C#IH3@)a08cvt@C^@e`SRsMCrC?6BZI*}D=RCy09dV7%FWFc5T7~ngnh_yetv%b z&0la;{}5)yQSn3vT~ta(q7+l-Bk9Xt4GKnx5F2!LMzxXS?K2tzW`8^UU}Qh0c{fH24a)N^M}%w(lE zL~U)Y0C-ylpqD#yR;fjLLbSHF3V=2l0N#wy^z^jmiS&Xno6Q1XTn6Az?!39V>Cj}h z5T2f%O8(T>*XI;~#bOZvODCCk1F+}j=0CWFhQsDNIy#i? zB!}JJ-rj@XxhxYJ8Y%$#WB|CjrW`ObGD4@J+qZAqmRBewB;?>f4gfYc@S8FKS>k~5 z@^anHn@pyIkXv70Pa=#96%`fP0wl=*aLT&K2k=?py3J{rZ)j*xmJ5I8O$=*%d|ZK1 z&Ht=MNhy6Ss4rf;sQa>MXlPJ=697lFJL*1NN?~fvQaSkM&6~QLw|xp91F;F{995DNuqj@Kn6B{VoVs8kPR#o>}4T5f8L7Z4|eQHqL+qMn`} z>gwtezj4|lE#519dDP&%>$-B~ic&}Ah{f6I&d!d~mX?;3dxx{inwlC43k!Sfc%#v% zoP^^5#8dkE_3Pq0SL`&4L)gkm6FJiA)l@=bb4bqs_#D7LdVt`6W4v_Z0K5)h%9Q{@ z!2mu4@T&s`=K&Z2ye2kLHjUpc+l%v{H|+XK?GI!Vz!U)QsPTD1t?TcojX(dW7N*_; z@Vs4O_Ob?JFRK4@djV%iMF1Am7vP0Y+RV8iss8|gJHvm^7pf`%0000{ + 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"} + ] +}