doztime: Bangle 1 - fix scoping of vars `time` and `wait`

master
thyttan 2025-01-04 00:06:35 +01:00
parent 1ccde9ccc0
commit c7eabbee8c
3 changed files with 8 additions and 5 deletions

View File

@ -7,3 +7,4 @@
now supports Adjust Clock widget, if installed now supports Adjust Clock widget, if installed
0.06: Minor code improvements 0.06: Minor code improvements
0.07: Bangle2: Shift the position of one line on the screen 0.07: Bangle2: Shift the position of one line on the screen
0.08: Bangle1: fix scoping of variables `time` and `wait`

View File

@ -159,20 +159,22 @@ function drawTime()
let date = ""; let date = "";
let timeDef; let timeDef;
let x = 0; let x = 0;
let time;
let wait;
dt.setDate(dt.getDate()); dt.setDate(dt.getDate());
if(addTimeDigit){ if(addTimeDigit){
x = x =
10368*dt.getHours()+172.8*dt.getMinutes()+2.88*dt.getSeconds()+0.00288*dt.getMilliseconds(); 10368*dt.getHours()+172.8*dt.getMinutes()+2.88*dt.getSeconds()+0.00288*dt.getMilliseconds();
let msg = "00000"+Math.floor(x).toString(12); let msg = "00000"+Math.floor(x).toString(12);
let time = msg.substr(-5,3)+"."+msg.substr(-2); //TODO: should `time` and `wait` have been defined outside the if block? time = msg.substr(-5,3)+"."+msg.substr(-2);
let wait = 347*(1-(x%1)); wait = 347*(1-(x%1));
timeDef = time6; timeDef = time6;
} else { } else {
x = x =
864*dt.getHours()+14.4*dt.getMinutes()+0.24*dt.getSeconds()+0.00024*dt.getMilliseconds(); 864*dt.getHours()+14.4*dt.getMinutes()+0.24*dt.getSeconds()+0.00024*dt.getMilliseconds();
let msg = "0000"+Math.floor(x).toString(12); let msg = "0000"+Math.floor(x).toString(12);
let time = msg.substr(-4,3)+"."+msg.substr(-1); time = msg.substr(-4,3)+"."+msg.substr(-1);
let wait = 4167*(1-(x%1)); wait = 4167*(1-(x%1));
timeDef = time5; timeDef = time5;
} }
if(lastX > x){ res = getDate(dt); } // calculate date once at start-up and once when turning over to a new day if(lastX > x){ res = getDate(dt); } // calculate date once at start-up and once when turning over to a new day

View File

@ -2,7 +2,7 @@
"id": "doztime", "id": "doztime",
"name": "Dozenal Digital Time", "name": "Dozenal Digital Time",
"shortName": "Dozenal Digital", "shortName": "Dozenal Digital",
"version": "0.07", "version": "0.08",
"description": "A dozenal Holocene calendar and dozenal diurnal digital clock", "description": "A dozenal Holocene calendar and dozenal diurnal digital clock",
"icon": "app.png", "icon": "app.png",
"type": "clock", "type": "clock",