Refactoring, Improved Description
parent
01dc955206
commit
2d82d8dbfe
|
|
@ -1421,8 +1421,8 @@
|
||||||
"name": "Digital Assistant, not EDITH",
|
"name": "Digital Assistant, not EDITH",
|
||||||
"shortName": "DANE",
|
"shortName": "DANE",
|
||||||
"icon": "app.png",
|
"icon": "app.png",
|
||||||
"version": "0.10",
|
"version": "0.11",
|
||||||
"description": "A Watchface inspired by Tony Stark's EDITH",
|
"description": "A Watchface inspired by Tony Stark's EDITH and based on https://arwes.dev/",
|
||||||
"tags": "clock",
|
"tags": "clock",
|
||||||
"type": "clock",
|
"type": "clock",
|
||||||
"allow_emulator": true,
|
"allow_emulator": true,
|
||||||
|
|
|
||||||
|
|
@ -6,3 +6,4 @@
|
||||||
0.08: Removed Image, Reduced RAM usage
|
0.08: Removed Image, Reduced RAM usage
|
||||||
0.09: Added Unix Time
|
0.09: Added Unix Time
|
||||||
0.10: Added Counter, Added Battery Display
|
0.10: Added Counter, Added Battery Display
|
||||||
|
0.11: Code Refactoring, Improved Description
|
||||||
|
|
@ -31,6 +31,7 @@ const alert = "#ff0000";
|
||||||
// const alertLight = "#0f0606";
|
// const alertLight = "#0f0606";
|
||||||
|
|
||||||
let count = 100;
|
let count = 100;
|
||||||
|
let oldCount = count;
|
||||||
|
|
||||||
|
|
||||||
// function getImg() {
|
// function getImg() {
|
||||||
|
|
@ -46,8 +47,6 @@ let count = 100;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function drawTopLeftCorner(x, y) {
|
function drawTopLeftCorner(x, y) {
|
||||||
g.setColor(mainColor);
|
g.setColor(mainColor);
|
||||||
const x1 = x - cornerOffset;
|
const x1 = x - cornerOffset;
|
||||||
|
|
@ -56,6 +55,7 @@ function drawTopLeftCorner(x,y) {
|
||||||
g.setColor("#000000");
|
g.setColor("#000000");
|
||||||
g.fillRect(x, y, x + cornerSize - cornerOffset, y + cornerSize - cornerOffset);
|
g.fillRect(x, y, x + cornerSize - cornerOffset, y + cornerSize - cornerOffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
function drawTopRightCorner(x, y) {
|
function drawTopRightCorner(x, y) {
|
||||||
g.setColor(mainColor);
|
g.setColor(mainColor);
|
||||||
const x1 = x + cornerOffset;
|
const x1 = x + cornerOffset;
|
||||||
|
|
@ -64,6 +64,7 @@ function drawTopRightCorner(x,y) {
|
||||||
g.setColor("#000000");
|
g.setColor("#000000");
|
||||||
g.fillRect(x, y, x - cornerSize - cornerOffset, y + cornerSize - cornerOffset);
|
g.fillRect(x, y, x - cornerSize - cornerOffset, y + cornerSize - cornerOffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
function drawBottomLeftCorner(x, y) {
|
function drawBottomLeftCorner(x, y) {
|
||||||
g.setColor(mainColor);
|
g.setColor(mainColor);
|
||||||
const x1 = x - cornerOffset;
|
const x1 = x - cornerOffset;
|
||||||
|
|
@ -72,6 +73,7 @@ function drawBottomLeftCorner(x,y) {
|
||||||
g.setColor("#000000");
|
g.setColor("#000000");
|
||||||
g.fillRect(x, y, x + cornerSize - cornerOffset, y - cornerSize + cornerOffset);
|
g.fillRect(x, y, x + cornerSize - cornerOffset, y - cornerSize + cornerOffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
function drawBottomRightCorner(x, y) {
|
function drawBottomRightCorner(x, y) {
|
||||||
g.setColor(mainColor);
|
g.setColor(mainColor);
|
||||||
const x1 = x + cornerOffset;
|
const x1 = x + cornerOffset;
|
||||||
|
|
@ -91,6 +93,7 @@ function drawFrame(x1,y1,x2,y2) {
|
||||||
g.setColor("#000000");
|
g.setColor("#000000");
|
||||||
g.fillRect(x1 + borderWidth, y1 + borderWidth, x2 - borderWidth, y2 - borderWidth);
|
g.fillRect(x1 + borderWidth, y1 + borderWidth, x2 - borderWidth, y2 - borderWidth);
|
||||||
}
|
}
|
||||||
|
|
||||||
function drawTopFrame(x1, y1, x2, y2) {
|
function drawTopFrame(x1, y1, x2, y2) {
|
||||||
|
|
||||||
drawBottomLeftCorner(x1, y2);
|
drawBottomLeftCorner(x1, y2);
|
||||||
|
|
@ -107,6 +110,7 @@ function drawFrameNoCorners(x1,y1,x2,y2) {
|
||||||
g.setColor("#000000");
|
g.setColor("#000000");
|
||||||
g.fillRect(x1 + borderWidth, y1 + borderWidth, x2 - borderWidth, y2 - borderWidth);
|
g.fillRect(x1 + borderWidth, y1 + borderWidth, x2 - borderWidth, y2 - borderWidth);
|
||||||
}
|
}
|
||||||
|
|
||||||
// function drawBottomFrame(x1,y1,x2,y2) {
|
// function drawBottomFrame(x1,y1,x2,y2) {
|
||||||
// drawTopLeftCorner(x1,y1);
|
// drawTopLeftCorner(x1,y1);
|
||||||
// drawTopRightCorner(x2,y1);
|
// drawTopRightCorner(x2,y1);
|
||||||
|
|
@ -121,8 +125,6 @@ function drawFrameNoCorners(x1,y1,x2,y2) {
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function drawTimeText(d) {
|
function drawTimeText(d) {
|
||||||
const da = d.toString().split(" ");
|
const da = d.toString().split(" ");
|
||||||
// var dutc = getUTCTime(d);
|
// var dutc = getUTCTime(d);
|
||||||
|
|
@ -141,6 +143,7 @@ function drawTimeText(d) {
|
||||||
g.drawString(`${unix}`, xyCenter, yposTime + 22, true);
|
g.drawString(`${unix}`, xyCenter, yposTime + 22, true);
|
||||||
g.setFont(font, smallFontSize);
|
g.setFont(font, smallFontSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
function drawDateText(d) {
|
function drawDateText(d) {
|
||||||
g.setColor(mainColor);
|
g.setColor(mainColor);
|
||||||
g.setFont(font, dateFontSize);
|
g.setFont(font, dateFontSize);
|
||||||
|
|
@ -148,7 +151,7 @@ function drawDateText(d) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function drawCounterText() {
|
function drawCounterText() {
|
||||||
if(count>999) count = 999;
|
if (count > 255) count = 255;
|
||||||
if (count < 0) count = 0;
|
if (count < 0) count = 0;
|
||||||
g.setColor("#000000");
|
g.setColor("#000000");
|
||||||
g.fillRect(37, 58 + yOffset + 36, 203, 58 + 80 + yOffset + 34);
|
g.fillRect(37, 58 + yOffset + 36, 203, 58 + 80 + yOffset + 34);
|
||||||
|
|
@ -170,12 +173,12 @@ function levelColor(l) {
|
||||||
|
|
||||||
function drawBattery() {
|
function drawBattery() {
|
||||||
const l = E.getBattery(), c = levelColor(l);
|
const l = E.getBattery(), c = levelColor(l);
|
||||||
|
count = l;
|
||||||
const xl = 45 + l * (194 - 46) / 100;
|
const xl = 45 + l * (194 - 46) / 100;
|
||||||
g.setColor(c).fillRect(46, 58 + 80 + yOffset + 37, xl, height - 5);
|
g.setColor(c).fillRect(46, 58 + 80 + yOffset + 37, xl, height - 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function drawClock() {
|
function drawClock() {
|
||||||
// main frame
|
// main frame
|
||||||
drawFrame(3, 10 + yOffset, width - 3, height - 3);
|
drawFrame(3, 10 + yOffset, width - 3, height - 3);
|
||||||
|
|
@ -196,6 +199,7 @@ function drawClock() {
|
||||||
// const img = makeImg();
|
// const img = makeImg();
|
||||||
// g.drawImage(img,width/2-(img.width/2),height/2);
|
// g.drawImage(img,width/2-(img.width/2),height/2);
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateClock() {
|
function updateClock() {
|
||||||
g.setFontAlign(0, 0);
|
g.setFontAlign(0, 0);
|
||||||
const date = new Date();
|
const date = new Date();
|
||||||
|
|
@ -211,7 +215,6 @@ Bangle.on('lcdPower', function(on) {
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
g.clear();
|
g.clear();
|
||||||
|
|
||||||
Bangle.loadWidgets();
|
Bangle.loadWidgets();
|
||||||
|
|
@ -220,17 +223,18 @@ Bangle.drawWidgets();
|
||||||
drawClock();
|
drawClock();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
setWatch(Bangle.showLauncher, BTN2, {repeat: false, edge: "falling"});
|
setWatch(Bangle.showLauncher, BTN2, {repeat: false, edge: "falling"});
|
||||||
|
|
||||||
setWatch(function() {
|
// setWatch(function () {
|
||||||
count+=1;
|
// count++;
|
||||||
drawCounterText();
|
// drawCounterText();
|
||||||
}, BTN1, {repeat:true,edge:"falling"});
|
// }, BTN1, {repeat: true, edge: "falling"});
|
||||||
setWatch(function() {
|
// setWatch(function () {
|
||||||
count--;
|
// count--;
|
||||||
drawCounterText();
|
// drawCounterText();
|
||||||
}, BTN3, {repeat:true,edge:"falling"});
|
// }, BTN3, {repeat: true, edge: "falling"});
|
||||||
|
|
||||||
// refesh every 100 milliseconds
|
// refesh every 100 milliseconds
|
||||||
setInterval(updateClock, 500);
|
setInterval(updateClock, 500);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue