Always clear idle if it was set
parent
68743be7ad
commit
6d1d6397ed
|
|
@ -758,15 +758,26 @@ BUTTON.prototype.draw = function() {
|
||||||
g.drawRect(this.x, this.y, (this.x + this.w), (this.y + this.h));
|
g.drawRect(this.x, this.y, (this.x + this.w), (this.y + this.h));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function redrawWholeFace() {
|
||||||
|
// Reset the prevRings to force all rings to update
|
||||||
|
prevRing = Array(3).fill().map(() => ({ start: null, end: null, max: null }));
|
||||||
|
g.clear();
|
||||||
|
draw(false);
|
||||||
|
}
|
||||||
|
|
||||||
function dismissPrompt() {
|
function dismissPrompt() {
|
||||||
idle = false;
|
idle = false;
|
||||||
warned = false;
|
warned = false;
|
||||||
lastStep = getTime();
|
lastStep = getTime();
|
||||||
Bangle.buzz(100);
|
Bangle.buzz(100);
|
||||||
// Reset the prevRings to force all rings to update
|
redrawWholeFace();
|
||||||
prevRing = Array(3).fill().map(() => ({ start: null, end: null, max: null }));
|
}
|
||||||
g.clear();
|
|
||||||
draw(false);
|
function resetIdle() {
|
||||||
|
if (idle == false) return;
|
||||||
|
// redraw if we had been idle
|
||||||
|
dismissPrompt();
|
||||||
|
idle = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
var dismissBtn = new BUTTON("big",0, 3*h/4 ,w, h/4, "#0ff", dismissPrompt, "Dismiss");
|
var dismissBtn = new BUTTON("big",0, 3*h/4 ,w, h/4, "#0ff", dismissPrompt, "Dismiss");
|
||||||
|
|
@ -787,11 +798,7 @@ Bangle.on('touch', function(button, xy) {
|
||||||
// if we get a step then we are not idle
|
// if we get a step then we are not idle
|
||||||
Bangle.on('step', s => {
|
Bangle.on('step', s => {
|
||||||
lastStep = getTime();
|
lastStep = getTime();
|
||||||
// redraw if we had been idle
|
resetIdle();
|
||||||
if (idle == true) {
|
|
||||||
dismissPrompt();
|
|
||||||
}
|
|
||||||
idle = false;
|
|
||||||
warned = 0;
|
warned = 0;
|
||||||
if (drawingSteps) return;
|
if (drawingSteps) return;
|
||||||
var steps = getSteps();
|
var steps = getSteps();
|
||||||
|
|
@ -806,7 +813,7 @@ Bangle.on('step', s => {
|
||||||
function checkIdle() {
|
function checkIdle() {
|
||||||
log_debug("checkIdle()");
|
log_debug("checkIdle()");
|
||||||
if (!settings.idle_check) {
|
if (!settings.idle_check) {
|
||||||
idle = false;
|
resetIdle();
|
||||||
warned = false;
|
warned = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -825,7 +832,7 @@ function checkIdle() {
|
||||||
}
|
}
|
||||||
idle = true;
|
idle = true;
|
||||||
} else {
|
} else {
|
||||||
idle = false;
|
resetIdle();
|
||||||
warned = 0;
|
warned = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -936,10 +943,9 @@ var infoMode = infoList[settings.idxInfo];
|
||||||
updateSunRiseSunSet(new Date(), location.lat, location.lon, true);
|
updateSunRiseSunSet(new Date(), location.lat, location.lon, true);
|
||||||
nextUpdateMs = getDelayMs(1000, settings.rings, Date.now())[0];
|
nextUpdateMs = getDelayMs(1000, settings.rings, Date.now())[0];
|
||||||
|
|
||||||
g.clear();
|
|
||||||
Bangle.loadWidgets();
|
Bangle.loadWidgets();
|
||||||
/*
|
/*
|
||||||
* we are not drawing the widgets as we are taking over the whole screen
|
* we are not drawing the widgets as we are taking over the whole screen
|
||||||
*/
|
*/
|
||||||
widget_utils.hide();
|
widget_utils.hide();
|
||||||
draw(false);
|
redrawWholeFace()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue