Update app.js

Added button interaction. 1 press for refresh data, double press for launcher.
master
inhof009 2023-08-09 08:34:06 -04:00 committed by GitHub
parent 1309e0a457
commit 7ae0e8093b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 22 additions and 0 deletions

View File

@ -63,5 +63,27 @@ function displayData(dataStreams) {
seconds.toString().padStart(2,"0");
E.showMessage(string,timeString);
}
function handleButton() {
switch(nPress) {
case 1:
fetchStartup();
break;
case 2:
Bangle.showLauncher();
break;
default:
Bangle.buzz(50);
}
nPress=0;
}
fetchStartup();
nPress = 0;
tPress = 0;
setWatch(() => {
nPress++;
clearTimeout(tPress);
tPress = setTimeout(() => {handleButton();}, 500);
}, (process.env.HWVERSION==2) ? BTN1 : BTN2, {repeat: true, edge: "rising"});