From 4bd7f5bb3d48a7f26b6c6478512fe812e049ba68 Mon Sep 17 00:00:00 2001 From: OmegaRogue Date: Mon, 21 Sep 2020 22:25:33 +0200 Subject: [PATCH] DANE Watchface v0.09: Added Unix Time display --- apps.json | 2 +- apps/dane/ChangeLog | 3 ++- apps/dane/app.js | 16 ++++++++++++---- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/apps.json b/apps.json index 665a73d5b..3dcb0a8f7 100644 --- a/apps.json +++ b/apps.json @@ -1421,7 +1421,7 @@ "name": "Digital Assistant, not EDITH", "shortName": "DANE", "icon": "app.png", - "version": "0.08", + "version": "0.09", "description": "A Watchface inspired by Tony Stark's EDITH", "tags": "clock", "type": "clock", diff --git a/apps/dane/ChangeLog b/apps/dane/ChangeLog index 6c70a07dd..421123a1b 100644 --- a/apps/dane/ChangeLog +++ b/apps/dane/ChangeLog @@ -3,4 +3,5 @@ 0.05: bugfix 0.06: moved and resized icon 0.07: Added Description -0.08: Removed Image, Reduced RAM usage \ No newline at end of file +0.08: Removed Image, Reduced RAM usage +0.09: Added Unix Time \ No newline at end of file diff --git a/apps/dane/app.js b/apps/dane/app.js index a2aa85cf3..c3d51cd14 100644 --- a/apps/dane/app.js +++ b/apps/dane/app.js @@ -1,5 +1,6 @@ const font = "6x8"; const timeFontSize = 4; +const unixTimeFontSize = 2; const dateFontSize = 3; const smallFontSize = 2; const yOffset = 23; @@ -10,13 +11,13 @@ const cornerSize = 14; const cornerOffset = 3; const borderWidth = 1; const yposTime = 27+yOffset; -const yposDate = 65+yOffset; +const yposDate = 65+yOffset+12; const mainColor = "#26dafd"; const mainColorDark = "#029dbb"; // const mainColorLight = "#8bebfe"; -// const secondaryColor = "#df9527"; +const secondaryColor = "#df9527"; // const secondaryColorDark = "#8b5c15"; const secondaryColorLight = "#ecc180"; @@ -123,22 +124,29 @@ function drawTimeText(d) { g.setColor(mainColor); g.setFont(font, timeFontSize); g.drawString(`${hours}:${minutes}:${seconds}`, xyCenter, yposTime, true); + const unix = Math.round(d.getTime()); + + g.setFont(font, unixTimeFontSize); + g.setColor(secondaryColor); + g.drawString(`${unix}`, xyCenter, yposTime +22, true); g.setFont(font, smallFontSize); } function drawDateText(d) { + g.setColor(mainColor); g.setFont(font, dateFontSize); g.drawString(`${d.getDate()}.${d.getMonth()+1}.${d.getFullYear()}`, xyCenter, yposDate, true); } + function drawClock() { // main frame drawFrame(3,10+yOffset,width-3,height-3); // time frame - drawTopFrame(20,10+yOffset,220,46+yOffset); + drawTopFrame(20,10+yOffset,220,46+12+yOffset); // date frame - drawTopFrame(28,46+yOffset,212,46+yOffset+35); + drawTopFrame(28,46+12+yOffset,212,46+12+yOffset+35); updateClock();