some small fiex

fix simple clock tags
add  drawWidgets()
add color to battery widget
pull/57/head
MaBecker 2019-12-04 00:34:18 +01:00
parent e6b0343b7c
commit 8aade6d9d6
5 changed files with 8 additions and 4 deletions

View File

@ -366,7 +366,7 @@
"name": "Simple Clock", "name": "Simple Clock",
"icon": "clock-simple.png", "icon": "clock-simple.png",
"description": "Simple Digital Clock", "description": "Simple Digital Clock",
"tags": "sclock", "tags": "clock",
"type":"clock", "type":"clock",
"allow_emulator":true, "allow_emulator":true,
"storage": [ "storage": [

View File

@ -74,6 +74,7 @@
} }
Bangle.on('lcdPower', function(on) { Bangle.on('lcdPower', function(on) {
if (on) { if (on) {
drawWidgets();
drawMixedClock(); drawMixedClock();
} }
}); });

View File

@ -1,5 +1,6 @@
(function(){ (function(){
var img_charge = E.toArrayBuffer(atob("DhgBHOBzgc4HOP////////////////////3/4HgB4AeAHgB4AeAHgB4AeAHg")); var img_charge = E.toArrayBuffer(atob("DhgBHOBzgc4HOP////////////////////3/4HgB4AeAHgB4AeAHgB4AeAHg"));
var CHARGING = 0x07E0;
var xpos = WIDGETPOS.tr-64; var xpos = WIDGETPOS.tr-64;
WIDGETPOS.tr-=68; WIDGETPOS.tr-=68;
@ -7,16 +8,16 @@ function draw() {
var s = 63; var s = 63;
var x = xpos, y = 0; var x = xpos, y = 0;
g.clearRect(x,y,x+s,y+23); g.clearRect(x,y,x+s,y+23);
g.setColor(1,1,1);
if (Bangle.isCharging()) { if (Bangle.isCharging()) {
g.drawImage(img_charge,x,y); g.setColor(CHARGING).drawImage(img_charge,x,y);
x+=16; x+=16;
s-=16; s-=16;
} }
g.setColor(1,1,1);
g.fillRect(x,y+2,x+s-4,y+21); g.fillRect(x,y+2,x+s-4,y+21);
g.clearRect(x+2,y+4,x+s-6,y+19); g.clearRect(x+2,y+4,x+s-6,y+19);
g.fillRect(x+s-3,y+10,x+s,y+14); g.fillRect(x+s-3,y+10,x+s,y+14);
g.fillRect(x+4,y+6,x+4+E.getBattery()*(s-12)/100,y+17); g.setColor(CHARGING).fillRect(x+4,y+6,x+4+E.getBattery()*(s-12)/100,y+17);
g.setColor(1,1,1); g.setColor(1,1,1);
} }
Bangle.on('charging',function(charging) { draw(); g.flip(); if(charging)Bangle.buzz(); }); Bangle.on('charging',function(charging) { draw(); g.flip(); if(charging)Bangle.buzz(); });

View File

@ -46,6 +46,7 @@
// handle switch display on by pressing BTN1 // handle switch display on by pressing BTN1
Bangle.on('lcdPower', function(on) { Bangle.on('lcdPower', function(on) {
if (on) { if (on) {
drawWidgets();
drawSimpleClock(); drawSimpleClock();
} }
}); });

View File

@ -120,6 +120,7 @@
Bangle.on('lcdPower', function(on) { Bangle.on('lcdPower', function(on) {
if (on) { if (on) {
drawWidgets();
drawWordClock(); drawWordClock();
} }
}); });