Update app.js

pull/861/head
nujw 2021-10-20 15:11:01 +13:00 committed by GitHub
parent d1eba1e40f
commit e3975fc5c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 29 additions and 5 deletions

View File

@ -3,8 +3,9 @@ Speed and Altitude [speedalt2]
Mike Bennett mike[at]kereru.com
0.01 : Initial
0.06 : Add Posn screen
0.07 : Add swipe to change screens
*/
var v = '0.06';
var v = '0.07';
/*kalmanjs, Wouter Bulten, MIT, https://github.com/wouterbulten/kalmanjs */
var KalmanFilter = (function () {
@ -509,6 +510,21 @@ function onGPS(fix) {
}
function prevScrn() {
cfg.modeA = cfg.modeA-1;
if ( cfg.modeA < 0 ) cfg.modeA = 4;
savSettings();
onGPS(lf);
}
function nextScrn() {
cfg.modeA = cfg.modeA+1;
if ( cfg.modeA > 4 ) cfg.modeA = 0;
savSettings();
onGPS(lf);
}
function setButtons(){
// BTN1 - Max speed/alt or next waypoint
@ -541,10 +557,7 @@ function setButtons(){
// BTN3 - next screen
setWatch(function(e){
cfg.modeA = cfg.modeA+1;
if ( cfg.modeA > 4 ) cfg.modeA = 0;
savSettings();
onGPS(lf);
nextScrn();
}, BTN3, {repeat:true,edge:"falling"});
/*
@ -643,6 +656,17 @@ Bangle.on('lcdPower',function(on) {
else stopDraw();
});
//Bangle.on('swipe', dir => {
// if(STATE.settings_open) return;
// if(dir == 1) prev();
// else next();
//});
Bangle.on('swipe',function(dir) {
if(dir == 1) prevScrn();
else nextScrn();
});
var gpssetup;
try {
gpssetup = require("gpssetup");