From 1c81d2dce5395d7fbdee418487e02c05c40d876c Mon Sep 17 00:00:00 2001
From: thyttan <6uuxstm66@mozmail.comā©>
Date: Fri, 7 Apr 2023 16:38:53 +0200
Subject: [PATCH] fastreset: add new app 'Fast Reset'
add app 'Fast Reset' (boot code)
use the more descriptive `Bangle.showClock` instead of `load(".bootcde")`
fix scope of buzzTimeout id variable
compact the code a little bit
change metadata and readme to reflect a shortened timeout
---
apps/fastreset/ChangeLog | 1 +
apps/fastreset/README.md | 32 ++++++++++++++++++++++++++++++++
apps/fastreset/app.png | Bin 0 -> 343 bytes
apps/fastreset/boot.js | 5 +++++
apps/fastreset/metadata.json | 14 ++++++++++++++
5 files changed, 52 insertions(+)
create mode 100644 apps/fastreset/ChangeLog
create mode 100644 apps/fastreset/README.md
create mode 100644 apps/fastreset/app.png
create mode 100644 apps/fastreset/boot.js
create mode 100644 apps/fastreset/metadata.json
diff --git a/apps/fastreset/ChangeLog b/apps/fastreset/ChangeLog
new file mode 100644
index 0000000000..5560f00bce
--- /dev/null
+++ b/apps/fastreset/ChangeLog
@@ -0,0 +1 @@
+0.01: New App!
diff --git a/apps/fastreset/README.md b/apps/fastreset/README.md
new file mode 100644
index 0000000000..381d80cf53
--- /dev/null
+++ b/apps/fastreset/README.md
@@ -0,0 +1,32 @@
+# Fast Reset
+
+Reset the watch by holding the hardware button for half a second. If 'Fastload Utils' is installed this will typically be done with fastloading. A buzz acts as indicator.
+
+Fast Reset was developed with the app history feature of 'Fastload Utils' in mind. If many apps are in the history stack, the user may want a fast way to exit directly to the clock face without using the firmwares reset function.
+
+## Usage
+
+Just install and it will run as boot code.
+
+## Features
+
+If 'Fastload Utils' is installed fastloading will be used when possible. Otherwise a standard `load(.bootcde)` is used.
+
+If the hardware button is held for longer the standard reset functionality of the firmware is executed as well (total 1.5 seconds). And eventually the watchdog will be kicked.
+
+## Controls
+
+Hold the hardware button for half a second to feel the buzz, loading the clock face.
+
+## Requests
+
+Mention @[thyttan](https://github.com/thyttan) in an issue to the official [BangleApps repository](https://github.com/espruino/BangleApps/issues) for feature requests and bug reports.
+
+## Acknowledgements
+
+Rewind icon by Icons8
+
+## Creator
+
+[thyttan](https://github.com/thyttan)
+
diff --git a/apps/fastreset/app.png b/apps/fastreset/app.png
new file mode 100644
index 0000000000000000000000000000000000000000..79e0f310e0041932b6ef26aa355388c3d998a723
GIT binary patch
literal 343
zcmV-d0jU0oP)mI+m04%~n%Fmdc#HP8Xp5%=iOw`yPnoMT*9{ud?zZD9GMunRwyv;jTfkWjox
z|0hWS4PXJ>Qxq@4Pvl=f7ucjMT!f#BxPS^U3y(IF;(7T-L<8!;DnsGCd}E>kQ;Xtx
z_{MnGK)vj*Q0YHnFOE@feq>&Z65b4RUX0U87m^e1{5LjF;PXm&0mhE~+%EMkpqA0K
p_6K1Tug&+fh6o{q5JCtF;|bI}-_aXy+^zrs002ovPDHLkV1i&Ei#Y%Q
literal 0
HcmV?d00001
diff --git a/apps/fastreset/boot.js b/apps/fastreset/boot.js
new file mode 100644
index 0000000000..681a5ddb75
--- /dev/null
+++ b/apps/fastreset/boot.js
@@ -0,0 +1,5 @@
+{let buzzTimeout;
+setWatch((e)=>{
+ if (e.state) buzzTimeout = setTimeout(()=>{Bangle.buzz(80,0.40);Bangle.showClock();}, 500);
+ if (!e.state && buzzTimeout) clearTimeout(buzzTimeout);},
+BTN,{repeat:true, edge:'both' });}
diff --git a/apps/fastreset/metadata.json b/apps/fastreset/metadata.json
new file mode 100644
index 0000000000..098e0eeb10
--- /dev/null
+++ b/apps/fastreset/metadata.json
@@ -0,0 +1,14 @@
+{ "id": "fastreset",
+ "name": "Fast Reset",
+ "shortName":"Fast Reset",
+ "version":"0.01",
+ "description": "Reset the watch by holding the hardware button for half a second. If 'Fastload Utils' is installed this will typically be done with fastloading. A buzz acts as indicator.",
+ "icon": "app.png",
+ "type": "bootloader",
+ "tags": "system",
+ "supports" : ["BANGLEJS2"],
+ "readme": "README.md",
+ "storage": [
+ {"name":"fastreset.boot.js","url":"boot.js"}
+ ]
+}