Proper fix for the race condition

pull/1944/head
deirdreobyrne 2022-06-10 05:14:22 +01:00
parent f4721afc97
commit 53cbb2bb32
3 changed files with 5 additions and 5 deletions

View File

@ -2,3 +2,4 @@
0.02: setTimeout bug fix; no leading zero on date; lightmode; 12 hour format; cleanup
0.03: Internationalisation; bug fix - battery icon responds promptly to charging state
0.04: bug fix
0.05: proper fix for the race condition in queueDraw()

View File

@ -12,13 +12,12 @@ Graphics.prototype.setFontOpenSans = function(scale) {
var drawTimeout;
// schedule a draw for the next minute
function queueDraw() {
function queueDraw(millis_now) {
if (drawTimeout) clearTimeout(drawTimeout);
drawTimeout = setTimeout(function () {
drawTimeout = undefined;
draw();
}, 60300 - (Date.now() % 60000)); // We aim for 300ms into the next minute to ensure we make it!
}, 60000 - (millis_now % 60000));
}
function draw() {
@ -70,7 +69,7 @@ function draw() {
// widget redraw
Bangle.drawWidgets();
queueDraw();
queueDraw(date.getTime());
}
Bangle.on('lcdPower', on => {

View File

@ -1,7 +1,7 @@
{ "id": "bigdclock",
"name": "Big digit clock containing just the essentials",
"shortName":"Big digit clk",
"version":"0.04",
"version":"0.05",
"description": "A clock containing just the essentials, made as easy to read as possible for those of us that need glasses. It contains the time, the day-of-week, the day-of-month, and the current battery state-of-charge.",
"icon": "bigdclock.png",
"type": "clock",