mirror of https://github.com/espruino/BangleApps
Merge pull request #3706 from thyttan/doztime
doztime: Bangle 1 - fix scoping of vars `time` and `wait`pull/3680/head
commit
08aeebc0b8
|
@ -7,3 +7,4 @@
|
|||
now supports Adjust Clock widget, if installed
|
||||
0.06: Minor code improvements
|
||||
0.07: Bangle2: Shift the position of one line on the screen
|
||||
0.08: Bangle1: fix scoping of variables `time` and `wait`
|
||||
|
|
|
@ -28,6 +28,7 @@ let addTimeDigit = false;
|
|||
let dateFormat = false;
|
||||
let lastX = 999999999;
|
||||
let res = {};
|
||||
let calenDef;
|
||||
//var last_time_log = 0;
|
||||
|
||||
var drawtime_timeout;
|
||||
|
@ -60,7 +61,7 @@ g.flip = function()
|
|||
|
||||
setWatch(function(){ modeTime(); }, BTN1, {repeat:true} );
|
||||
setWatch(function(){ Bangle.showLauncher(); }, BTN2, { repeat: false, edge: "falling" });
|
||||
setWatch(function(){ modeWeather(); }, BTN3, {repeat:true});
|
||||
//setWatch(function(){ modeWeather(); }, BTN3, {repeat:true}); // TODO: `modeWeather` is not yet implemented.
|
||||
setWatch(function(){ toggleTimeDigits(); }, BTN4, {repeat:true});
|
||||
setWatch(function(){ toggleDateFormat(); }, BTN5, {repeat:true});
|
||||
|
||||
|
@ -122,7 +123,7 @@ function formatDate(res,dateFormat){
|
|||
}
|
||||
|
||||
function writeDozTime(text,def){
|
||||
let pts = def.pts;
|
||||
//let pts = def.pts;
|
||||
let x=def.pt0[0];
|
||||
let y=def.pt0[1];
|
||||
g_t.clear();
|
||||
|
@ -138,7 +139,7 @@ function writeDozTime(text,def){
|
|||
function writeDozDate(text,def,colour){
|
||||
|
||||
dateColour = colour;
|
||||
let pts = def.pts;
|
||||
//let pts = def.pts;
|
||||
let x=def.pt0[0];
|
||||
let y=def.pt0[1];
|
||||
g_d.clear();
|
||||
|
@ -159,20 +160,22 @@ function drawTime()
|
|||
let date = "";
|
||||
let timeDef;
|
||||
let x = 0;
|
||||
let time;
|
||||
let wait;
|
||||
dt.setDate(dt.getDate());
|
||||
if(addTimeDigit){
|
||||
x =
|
||||
10368*dt.getHours()+172.8*dt.getMinutes()+2.88*dt.getSeconds()+0.00288*dt.getMilliseconds();
|
||||
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?
|
||||
let wait = 347*(1-(x%1));
|
||||
time = msg.substr(-5,3)+"."+msg.substr(-2);
|
||||
wait = 347*(1-(x%1));
|
||||
timeDef = time6;
|
||||
} else {
|
||||
x =
|
||||
864*dt.getHours()+14.4*dt.getMinutes()+0.24*dt.getSeconds()+0.00024*dt.getMilliseconds();
|
||||
let msg = "0000"+Math.floor(x).toString(12);
|
||||
let time = msg.substr(-4,3)+"."+msg.substr(-1);
|
||||
let wait = 4167*(1-(x%1));
|
||||
time = msg.substr(-4,3)+"."+msg.substr(-1);
|
||||
wait = 4167*(1-(x%1));
|
||||
timeDef = time5;
|
||||
}
|
||||
if(lastX > x){ res = getDate(dt); } // calculate date once at start-up and once when turning over to a new day
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"id": "doztime",
|
||||
"name": "Dozenal Digital Time",
|
||||
"shortName": "Dozenal Digital",
|
||||
"version": "0.07",
|
||||
"version": "0.08",
|
||||
"description": "A dozenal Holocene calendar and dozenal diurnal digital clock",
|
||||
"icon": "app.png",
|
||||
"type": "clock",
|
||||
|
|
Loading…
Reference in New Issue