forked from espruino/BangleApps
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Temporarily activate scroll on twist function when a new message triggers the message app.
- Loading branch information
thyttan
committed
Jan 11, 2025
1 parent
1aa9b7a
commit c32e33d
Showing
5 changed files
with
64 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
0.01: New App! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Message Scroll on Twist | ||
|
||
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. | ||
|
||
## Usage | ||
|
||
This is a bootloader app and only needs to be installed to add the functionality to the watch. | ||
|
||
## Notes | ||
|
||
Tried with a development version "Message UI" app centered around the message scroller. Should work with the standard version as well. | ||
|
||
## Requests | ||
|
||
Mention @thyttan in an issue on the espruino/BangleApps repository. | ||
|
||
## Creator | ||
|
||
thyttan |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
{ | ||
// If doing regular loads, not Bangle.load, this is used: | ||
if (global.__FILE__=="messagegui.new.js") { | ||
onTwistEmitDrag(); | ||
} | ||
|
||
// If Fastload Utils is installed this is used: | ||
Bangle.on("message", (_, msg)=>{if (Bangle.CLOCK && msg.new) { | ||
setTimeout(()=>{ | ||
if (global.__FILE__=="messagegui.new.js") { | ||
onTwistEmitDrag(); | ||
} | ||
},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. | ||
}}); | ||
|
||
// twistThreshold How much acceleration to register a twist of the watch strap? Can be negative for opposite direction. default = 800 | ||
// twistMaxY Maximum acceleration in Y to trigger a twist (low Y means watch is facing the right way up). default = -800 | ||
// twistTimeout How little time (in ms) must a twist take from low->high acceleration? default = 1000 | ||
function onTwistEmitDrag() { | ||
Bangle.setOptions({twistThreshold:2500, twistMaxY:-800, twistTimeout:400}); | ||
Bangle.on("twist", ()=>{ | ||
let i = 25; | ||
const int = setInterval(() => { | ||
Bangle.emit("drag", {dy:-3}) | ||
i--; | ||
if (i<1) clearInterval(int); | ||
}, 10); | ||
}); | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ "id": "msgtwscr", | ||
"name": "Message Scroll on Twist", | ||
"version":"0.01", | ||
"description": "Temporarily activate scroll on twist function when a new message triggers the message app.", | ||
"icon": "app.png", | ||
"tags": "messages,tweak, scroll", | ||
"type": "bootloader", | ||
"supports" : ["BANGLEJS2"], | ||
"readme": "README.md", | ||
"storage": [ | ||
{"name":"msgtwscr.boot.js","url":"boot.js"} | ||
] | ||
} |