mirror of https://github.com/espruino/BangleApps
Merge branch 'master' of github.com:espruino/BangleApps
commit
69a4c7ce74
|
@ -167,7 +167,7 @@
|
||||||
{ "id": "impwclock",
|
{ "id": "impwclock",
|
||||||
"name": "Imprecise Word Clock",
|
"name": "Imprecise Word Clock",
|
||||||
"icon": "clock-impword.png",
|
"icon": "clock-impword.png",
|
||||||
"version":"0.01",
|
"version":"0.02",
|
||||||
"description": "Imprecise word clock for vacations, weekends, and those who never need accurate time.",
|
"description": "Imprecise word clock for vacations, weekends, and those who never need accurate time.",
|
||||||
"tags": "clock",
|
"tags": "clock",
|
||||||
"type":"clock",
|
"type":"clock",
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
0.01: New App!
|
||||||
|
0.02: Stopped watchface from flashing every interval
|
|
@ -46,6 +46,8 @@ const passivColor = 0x3186 /*grey*/ ;
|
||||||
const activeColorNight = 0xF800 /*red*/ ;
|
const activeColorNight = 0xF800 /*red*/ ;
|
||||||
const activeColorDay = 0xFFFF /* white */;
|
const activeColorDay = 0xFFFF /* white */;
|
||||||
|
|
||||||
|
var hidxPrev;
|
||||||
|
|
||||||
function drawWordClock() {
|
function drawWordClock() {
|
||||||
|
|
||||||
|
|
||||||
|
@ -65,19 +67,6 @@ function drawWordClock() {
|
||||||
g.setColor(passivColor);
|
g.setColor(passivColor);
|
||||||
g.setFontAlign(0, -1, 0);
|
g.setFontAlign(0, -1, 0);
|
||||||
|
|
||||||
// draw allWords
|
|
||||||
var c;
|
|
||||||
var y = ys;
|
|
||||||
var x = xs;
|
|
||||||
allWords.forEach((line) => {
|
|
||||||
x = xs;
|
|
||||||
for (c in line) {
|
|
||||||
g.drawString(line[c], x, y);
|
|
||||||
x += dx;
|
|
||||||
}
|
|
||||||
y += dy;
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
// Switch case isn't good for this in Js apparently so...
|
// Switch case isn't good for this in Js apparently so...
|
||||||
if(h < 3){
|
if(h < 3){
|
||||||
|
@ -125,6 +114,21 @@ function drawWordClock() {
|
||||||
hidx = 10;
|
hidx = 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// check whether we need to redraw the watchface
|
||||||
|
if (hidx !== hidxPrev) {
|
||||||
|
// draw allWords
|
||||||
|
var c;
|
||||||
|
var y = ys;
|
||||||
|
var x = xs;
|
||||||
|
allWords.forEach((line) => {
|
||||||
|
x = xs;
|
||||||
|
for (c in line) {
|
||||||
|
g.drawString(line[c], x, y);
|
||||||
|
x += dx;
|
||||||
|
}
|
||||||
|
y += dy;
|
||||||
|
});
|
||||||
|
|
||||||
// write hour in active color
|
// write hour in active color
|
||||||
g.setColor(activeColor);
|
g.setColor(activeColor);
|
||||||
timeOfDay[hidx][0].split('').forEach((c, pos) => {
|
timeOfDay[hidx][0].split('').forEach((c, pos) => {
|
||||||
|
@ -132,16 +136,17 @@ function drawWordClock() {
|
||||||
y = ys + (timeOfDay[hidx][pos + 1] % 10) * dy;
|
y = ys + (timeOfDay[hidx][pos + 1] % 10) * dy;
|
||||||
g.drawString(c, x, y);
|
g.drawString(c, x, y);
|
||||||
});
|
});
|
||||||
|
hidxPrev = hidx;
|
||||||
|
}
|
||||||
|
|
||||||
// Display digital time while button 1 is pressed
|
// Display digital time while button 1 is pressed
|
||||||
|
g.clearRect(0, 215, 240, 240);
|
||||||
if (BTN1.read()){
|
if (BTN1.read()){
|
||||||
g.setColor(activeColor);
|
g.setColor(activeColor);
|
||||||
g.clearRect(0, 215, 240, 240);
|
|
||||||
g.drawString(time, 120, 215);
|
g.drawString(time, 120, 215);
|
||||||
} else { g.clearRect(0, 215, 240, 240); }
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Bangle.on('lcdPower', function(on) {
|
Bangle.on('lcdPower', function(on) {
|
||||||
if (on) drawWordClock();
|
if (on) drawWordClock();
|
||||||
|
|
Loading…
Reference in New Issue