[] skyspy: Implement time adjustment (untested).
parent
4bf47626ff
commit
ff46f86b2d
|
|
@ -77,6 +77,8 @@ var h = 176-wi, w = 176;
|
||||||
|
|
||||||
var fix;
|
var fix;
|
||||||
|
|
||||||
|
var adj_time = 0;
|
||||||
|
|
||||||
function radA(p) { return p*(Math.PI*2); }
|
function radA(p) { return p*(Math.PI*2); }
|
||||||
function radD(d) { return d*(h/2); }
|
function radD(d) { return d*(h/2); }
|
||||||
function radX(p, d) {
|
function radX(p, d) {
|
||||||
|
|
@ -112,6 +114,11 @@ function updateGps() {
|
||||||
if (cancel_gps)
|
if (cancel_gps)
|
||||||
return;
|
return;
|
||||||
fix = libgps.getGPSFix();
|
fix = libgps.getGPSFix();
|
||||||
|
if (adj_time) {
|
||||||
|
print("Adjusting time");
|
||||||
|
setTime(fix.time.getTime()/1000);
|
||||||
|
adj_time = 0;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Bangle.getPressure().then((x) => {
|
Bangle.getPressure().then((x) => {
|
||||||
|
|
@ -293,21 +300,39 @@ function drawBusy() {
|
||||||
.fillRect(0, wi, 176, 176)
|
.fillRect(0, wi, 176, 176)
|
||||||
.setColor(0,0,0)
|
.setColor(0,0,0)
|
||||||
.drawString(".oO busy", 0, 30);
|
.drawString(".oO busy", 0, 30);
|
||||||
|
}
|
||||||
|
|
||||||
|
function nextScreen() {
|
||||||
|
display = display + 1;
|
||||||
|
if (display == 3)
|
||||||
|
display = 0;
|
||||||
|
drawBusy();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function onSwipe(dir) {
|
function onSwipe(dir) {
|
||||||
display = display + 1;
|
nextScreen();
|
||||||
if (display == 3)
|
|
||||||
display = 0;
|
|
||||||
drawBusy();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function touchHandler(d) {
|
||||||
|
let x = Math.floor(d.x);
|
||||||
|
let y = Math.floor(d.y);
|
||||||
|
|
||||||
|
if ((x<h/2) && (y<w/2))
|
||||||
|
adj_time = 1;
|
||||||
|
|
||||||
|
if ((x>h/2) && (y>w/2))
|
||||||
|
nextScreen();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Bangle.on("drag", touchHandler);
|
||||||
Bangle.setUI({
|
Bangle.setUI({
|
||||||
mode : "custom",
|
mode : "custom",
|
||||||
swipe : onSwipe,
|
swipe : onSwipe,
|
||||||
clock : 0
|
clock : 0
|
||||||
});
|
});
|
||||||
|
|
||||||
Bangle.loadWidgets();
|
Bangle.loadWidgets();
|
||||||
Bangle.drawWidgets();
|
Bangle.drawWidgets();
|
||||||
drawBusy();
|
drawBusy();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue