0.03: Fix time output on new firmwares when no GPS time set (fix #104)
parent
f7024407de
commit
f3efada354
|
|
@ -212,7 +212,7 @@
|
||||||
{ "id": "gpstime",
|
{ "id": "gpstime",
|
||||||
"name": "GPS Time",
|
"name": "GPS Time",
|
||||||
"icon": "gpstime.png",
|
"icon": "gpstime.png",
|
||||||
"version":"0.02",
|
"version":"0.03",
|
||||||
"description": "Update the Bangle.js's clock based on the time from the GPS receiver",
|
"description": "Update the Bangle.js's clock based on the time from the GPS receiver",
|
||||||
"tags": "tool,gps",
|
"tags": "tool,gps",
|
||||||
"storage": [
|
"storage": [
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
0.03: Fix time output on new firmwares when no GPS time set (fix #104)
|
||||||
|
|
@ -5,11 +5,11 @@ Bangle.setLCDTimeout(0);
|
||||||
|
|
||||||
g.clear();
|
g.clear();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var fix;
|
var fix;
|
||||||
|
Bangle.setGPSPower(1);
|
||||||
Bangle.on('GPS',function(f) {
|
Bangle.on('GPS',function(f) {
|
||||||
fix = f;
|
fix = f;
|
||||||
|
g.reset(1);
|
||||||
g.setFont("6x8",2);
|
g.setFont("6x8",2);
|
||||||
g.setFontAlign(0,0);
|
g.setFontAlign(0,0);
|
||||||
g.clearRect(90,30,239,90);
|
g.clearRect(90,30,239,90);
|
||||||
|
|
@ -24,7 +24,10 @@ Bangle.on('GPS',function(f) {
|
||||||
g.drawString(fix.satellites+" satellites",170,80);
|
g.drawString(fix.satellites+" satellites",170,80);
|
||||||
|
|
||||||
g.clearRect(0,100,239,239);
|
g.clearRect(0,100,239,239);
|
||||||
var t = fix.time.toString().split(" ");/*
|
var t = ["","","","---",""];
|
||||||
|
if (fix.time!==undefined)
|
||||||
|
t = fix.time.toString().split(" ");
|
||||||
|
/*
|
||||||
[
|
[
|
||||||
"Sun",
|
"Sun",
|
||||||
"Nov",
|
"Nov",
|
||||||
|
|
@ -42,23 +45,24 @@ Bangle.on('GPS',function(f) {
|
||||||
g.drawString(t[3],120,160); // year
|
g.drawString(t[3],120,160); // year
|
||||||
g.setFont("6x8",3);
|
g.setFont("6x8",3);
|
||||||
g.drawString(t[4],120,185); // time
|
g.drawString(t[4],120,185); // time
|
||||||
// timezone
|
if (fix.time) {
|
||||||
var tz = (new Date()).getTimezoneOffset()/60;
|
// timezone
|
||||||
if (tz==0) tz="UTC";
|
var tz = (new Date()).getTimezoneOffset()/60;
|
||||||
else if (tz>0) tz="UTC+"+tz;
|
if (tz==0) tz="UTC";
|
||||||
else tz="UTC"+tz;
|
else if (tz>0) tz="UTC+"+tz;
|
||||||
g.setFont("6x8",2);
|
else tz="UTC"+tz;
|
||||||
g.drawString(tz,120,210); // gmt
|
g.setFont("6x8",2);
|
||||||
g.setFontAlign(0,0,3);
|
g.drawString(tz,120,210); // gmt
|
||||||
g.drawString("Set",230,120);
|
g.setFontAlign(0,0,3);
|
||||||
g.setFontAlign(0,0);
|
g.drawString("Set",230,120);
|
||||||
|
g.setFontAlign(0,0);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
setInterval(function() {
|
setInterval(function() {
|
||||||
g.drawImage(img,48,48,{scale:1.5,rotate:Math.sin(getTime()*2)/2});
|
g.drawImage(img,48,48,{scale:1.5,rotate:Math.sin(getTime()*2)/2});
|
||||||
},100);
|
},100);
|
||||||
setWatch(function() {
|
setWatch(function() {
|
||||||
setTime(fix.time.getTime()/1000);
|
if (fix.time!==undefined)
|
||||||
|
setTime(fix.time.getTime()/1000);
|
||||||
}, BTN2, {repeat:true});
|
}, BTN2, {repeat:true});
|
||||||
|
|
||||||
Bangle.setGPSPower(1)
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue