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