clkinfogps updated screenshots, added image, fixed reset if no fix code
Before Width: | Height: | Size: 1018 B After Width: | Height: | Size: 789 B |
|
@ -48,17 +48,6 @@
|
||||||
debug("gps on queued");
|
debug("gps on queued");
|
||||||
};
|
};
|
||||||
|
|
||||||
var queueGPSoff = function() {
|
|
||||||
// turn off after 5 minutes, sooner if we get a fix
|
|
||||||
clearTimer();
|
|
||||||
timeout = setTimeout(function() {
|
|
||||||
timeout = undefined;
|
|
||||||
Bangle.setGPSPower(0,"clkinfo");
|
|
||||||
resetLastFix();
|
|
||||||
}, 300000);
|
|
||||||
debug("gps off queued");
|
|
||||||
};
|
|
||||||
|
|
||||||
var onGPS = function(fix) {
|
var onGPS = function(fix) {
|
||||||
//console.log(fix);
|
//console.log(fix);
|
||||||
last_fix.time = fix.time;
|
last_fix.time = fix.time;
|
||||||
|
@ -78,11 +67,18 @@
|
||||||
if (Math.round(getTime()) - fixTs > 240) {
|
if (Math.round(getTime()) - fixTs > 240) {
|
||||||
resetLastFix();
|
resetLastFix();
|
||||||
fixTs = Math.round(getTime());
|
fixTs = Math.round(getTime());
|
||||||
|
// cancel the timeout and power off the gps, tap required to restart
|
||||||
|
clearTimer();
|
||||||
|
Bangle.setGPSPower(0,"clkinfo");
|
||||||
}
|
}
|
||||||
|
|
||||||
info.items[0].emit("redraw");
|
info.items[0].emit("redraw");
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var img = function() {
|
||||||
|
return atob("GBgBAAAAAAAAABgAAb2ABzzgB37gD37wHn54AAAADEwIPn58Pn58Pv58Pn58FmA4AAAAHn54D37wD37gBzzAAb2AABgAAAAAAAAA");
|
||||||
|
};
|
||||||
|
|
||||||
var gpsText = function() {
|
var gpsText = function() {
|
||||||
if (last_fix === undefined)
|
if (last_fix === undefined)
|
||||||
return '';
|
return '';
|
||||||
|
@ -100,6 +96,7 @@
|
||||||
{
|
{
|
||||||
name: "gridref",
|
name: "gridref",
|
||||||
get: function () { return ({
|
get: function () { return ({
|
||||||
|
img: img(),
|
||||||
text: gpsText()
|
text: gpsText()
|
||||||
}); },
|
}); },
|
||||||
run : function() {
|
run : function() {
|
||||||
|
@ -107,8 +104,6 @@
|
||||||
// if the timer is already runnuing reset it, we can get multiple run calls by tapping
|
// if the timer is already runnuing reset it, we can get multiple run calls by tapping
|
||||||
clearTimer();
|
clearTimer();
|
||||||
Bangle.setGPSPower(1,"clkinfo");
|
Bangle.setGPSPower(1,"clkinfo");
|
||||||
// turn GPS off after 5 mins if we dont get a fix, sooner if we get a fix
|
|
||||||
queueGPSoff();
|
|
||||||
},
|
},
|
||||||
show: function () {
|
show: function () {
|
||||||
console.log("show");
|
console.log("show");
|
||||||
|
|
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 3.2 KiB |
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 3.2 KiB |
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 3.1 KiB |
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 3.0 KiB |