Skip to content

Commit 129ff21

Browse files
author
thyttan
committed
Merge branch 'msgtwistscroll' into app-loader
2 parents bb9b6fb + 189bfaa commit 129ff21

File tree

5 files changed

+66
-0
lines changed

5 files changed

+66
-0
lines changed

apps/msgtwscr/ChangeLog

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0.01: New App!

apps/msgtwscr/README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Message Twist to Scroll
2+
3+
Temporarily activate scroll on twist function when a new message triggers the message app. This way it's possible to scroll through a message in the message scroller hands free.
4+
5+
## Usage
6+
7+
This is a bootloader app and only needs to be installed to add the functionality to the watch.
8+
9+
## Notes
10+
11+
Tried with [a development version "Message UI" app](https://github.com/espruino/BangleApps/pull/3685) centered around the message scroller. Should work with the standard version as well.
12+
13+
## Requests
14+
15+
Mention @thyttan in an issue on the espruino/BangleApps repository.
16+
17+
## Creator
18+
19+
thyttan

apps/msgtwscr/app.png

1.43 KB
Loading

apps/msgtwscr/boot.js

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
// If doing regular loads, not Bangle.load, this is used:
3+
if (global.__FILE__=="messagegui.new.js") {
4+
onTwistEmitDrag();
5+
}
6+
7+
// If Fastload Utils is installed this is used:
8+
Bangle.on("message", (_, msg)=>{if (Bangle.CLOCK && msg.new) {
9+
setTimeout(()=>{
10+
if (global.__FILE__=="messagegui.new.js") {
11+
onTwistEmitDrag();
12+
}
13+
},700) // It feels like there's a more elegant solution than checking the filename after 700 milliseconds. But this at least seems to work w/o sometimes activating when it shouldn't.
14+
}});
15+
16+
// twistThreshold How much acceleration to register a twist of the watch strap? Can be negative for opposite direction. default = 800
17+
// twistMaxY Maximum acceleration in Y to trigger a twist (low Y means watch is facing the right way up). default = -800
18+
// twistTimeout How little time (in ms) must a twist take from low->high acceleration? default = 1000
19+
function onTwistEmitDrag() {
20+
Bangle.setOptions({twistThreshold:2500, twistMaxY:-800, twistTimeout:400});
21+
Bangle.on("twist", ()=>{
22+
Bangle.setLocked(false);
23+
Bangle.setLCDPower(true);
24+
let i = 25;
25+
const int = setInterval(() => {
26+
Bangle.emit("drag", {dy:-3})
27+
i--;
28+
if (i<1) clearInterval(int);
29+
}, 10);
30+
});
31+
32+
}
33+
}

apps/msgtwscr/metadata.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{ "id": "msgtwscr",
2+
"name": "Message Twist to Scroll",
3+
"version":"0.01",
4+
"description": "Temporarily activate scroll on twist function when a new message triggers the message app.",
5+
"icon": "app.png",
6+
"tags": "messages,tweak,scroll",
7+
"type": "bootloader",
8+
"supports" : ["BANGLEJS2"],
9+
"readme": "README.md",
10+
"storage": [
11+
{"name":"msgtwscr.boot.js","url":"boot.js"}
12+
]
13+
}

0 commit comments

Comments
 (0)