Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Dense Clock app #3719

Merged
merged 4 commits into from
Jan 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions apps/denseclock/ChangeLog
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
0.01: Begin rewrite from old code.
0.02: Changed visuals: uA > mA, info order, battery state indication
1 change: 1 addition & 0 deletions apps/denseclock/app-icon.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

157 changes: 157 additions & 0 deletions apps/denseclock/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
// FONTS

/*
Share Tech Mono: https://fonts.google.com/specimen/Share+Tech+Mono
Converted with: https://www.espruino.com/Font+Converter
*/

Graphics.prototype.setFontShareTechMonoBig = function(scale) {
// Actual height 56 (55 - 0)
this.setFontCustom(
atob('AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB+AAAAAAAAB+AAAAAAAAB+AAAAAAAAB+AAAAAAAAB+AAAAAAAAB+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAHwAAAAAAAA/wAAAAAAAD/wAAAAAAAf/wAAAAAAB//gAAAAAAP/8AAAA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AAB+AAHwB+AAA//////8AAA//////8AAAf/////4AAAP/////wAAAH/////gAAAB////+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB+AAB+AAAAB+AAB+AAAAB+AAB+AAAAB+AAB+AAAAB+AAB+AAAAB+AAB+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'),
46,
32,
60+(scale<<8)+(1<<16)
);
return this;
};

Graphics.prototype.setFontShareTechMono = function(scale) {
// Actual height 38 (37 - 0)
this.setFontCustom(
atob('AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHgAAAAAeAAAAAB4AAAAAHgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAAAAAfAAAAAP8AAAAD/gAAAB/4AAAAf+AAAAP/AAAAH/gAAAB/4AAAA/8AAAAP/AAAAH/gAAAD/wAAAA/8AAAAP+AAAAA/gAAAADwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB//4AAA///8AAP///8AA////wAHwAfvgAeAH4eABwA/A4AHAHwDgAcB+AOAB4PgB4AHj8AHgAf///+AA////wAB///+AAD///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAOAA8AAA4ADwAADgAeAAAOAB4AAA4AH////gAf///+AB////4AH////gAAAAAOAAAAAA4AAAAADg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AAAAAAAAAA//AAAAH/+AAAA//8A4AH4HwDgAeAHgOABwAeA4AHAB4DgAcAHgOABwAeB4AHgB4HgAf///+AA////wAB///+AAB///gAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB4AHgAAHgAeAAAeAB4AAB4AHgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA='),
46,
22,
40+(scale<<8)+(1<<16)
);
return this;
};

Graphics.prototype.setFontShareTechMonoSmall = function(scale) {
// Actual height 23 (22 - 0)
this.setFontCustom(
atob('AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP/zgP/zgP/zgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAPAAAPwAAPwAAAAAAPwAAPwAAPAAAAAAAAAAAAAAAAAAAAAAAAwYAP//gP//gP//gAwYAP//gP//gP//gAwYAAAAAAAAAAAAAAAAAB4AAD+BgH/Bg+HB8+DB8+DB8GD/gGB/AAAcAAAAAAAAAABAAH7AAP7AAMLAAMbAAP7AAHzfAAG/gAGxgAGxgAG/gAGfAAGAAAAAAAAAADz/AH//gP+DgMOBgMMBgMMBgMP/gAP/gAMAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAPwAAPwAAPgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD//wP//8/AA+4AAGgAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAC4AAG/AB+P//8D//wAAAAAAAAAAAAAAAAAAAAAAAADAAADuAAB+AAP4AAfwAAP8AAB+AADsAADAAAAAAAAAAAAAAAAAAAADgAADgAADgAAf8AAf8AAf8AADgAADgAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAeAAD+AAD4AAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAADgAAD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AA/gAADgAAAAAAAAAAAAP//gP//gMGBgMGBgMGBgMGBgP/DgH//gD5/AAAAAAAAAAAAAAAAAB/8AH//AP//gOABgMABgMABgMABgMABgMABgAAAAAAAAAAAAAAAAP//gP//gMABgMABgMABgMABgOADgH//gH//AAAAAAAAAAAAAAAAAP//gP//gP//gMGBgMGBgMGBgMGBgMGBgMABgAAAAAAAAAAAAAAAAP//gP//gP//gMHAAMHAAMHAAMHAAMHAAMAAAAAAAAAAAAAAAAAAAD/+AH//AP//gMABgMDBgMDBgMD/gMD/gAD/gAAAAAAAAAAAAAAAAP//gP//gAHAAAHAAAHAAAHAAAHAAP//gP//gAAAAAAAAAAAAAAAAAAAAMABgMABgP//gP//gP//gMABgMABgAAAAAAAAAAAAAAAAAAAAAAAAAABgMABgMABgMABgMAHgP//AP/+AAAAAAAAAAAAAAAAAAAAAP//gP//gAPAAAfgAB/4ADw+APAfgOAHgIABgAAAAAAAAAAAAAAAAAAAAP//gP//gAABgAABgAABgAABgAABgAAAAAAAAAAAAAAAAP//gP//gPgAAP+AAB/gAAHwAB/gAP8AAPgAAP//gP//gAAAAAAAAAAAAP//gP//gPwAAP/AAA/8AAD/gAAPgP//gP//gAAAAAAAAAAAAA/8AH//AH//gOADgMABgMABgMABgOADgH//gH//AA/4AAAAAAAAAAAAAP//gP//gMDgAMDgAMDgAMDgAP/AAH/AAD+AAAAAAAAAAAAAAA/8AH//AH//gOADgMABgMABgMABgOADgH//gH//wA/4wAAAAAAAAH//gP//gP//gMDAAMDAAMDgAOD8AP//AH+PgB4DgAAAgAAAAAAAAAAAAD4AAH+BgP+BgOGBgMHBgMHBgMH/gMD/AAA+AAAAAAAAAAAAAMAAAMAAAMAAAMAAAP//gP//gP//gMAAAMAAAMAAAMAAAAAAAAAAAAAAAP//AP//gAADgAABgAABgAABgAADgP//gP//AAAAAAAAAAAAAMAAAP4AAP/wAA//AAB/gAAHgAD/gB/+AP/AAPwAAIAAAAAAAAAAAP/gAP//gAP/gAAfgAH+A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0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0H"),
24+(scale<<8)+(1<<16)
);
return this;
};

{

// VARS

let FONT_NAME = "ShareTechMono";
let BIG_FONT_HEIGHT = 60;
//let NORMAL_FONT_HEIGHT = 40;
let SMALL_FONT_HEIGHT = 24;

let timeDrawTimeout;
let infoDrawTimeout;
let lockState = Bangle.isLocked();
let pressure;



// LISTENERS

Bangle.on('lock', function(isLocked) {
lockState = isLocked;
timeDraw();
infoDraw();
});



// DRAW FUNCTIONS

let timeDraw = function() {
g.reset();
g.clearRect(Bangle.appRect.x, Bangle.appRect.y, Bangle.appRect.x2, Bangle.appRect.y + BIG_FONT_HEIGHT);

var date = new Date();
var timeArray = [date.getHours().toString().padStart(2, "0"),
date.getMinutes().toString().padStart(2, "0")];
if (!lockState) timeArray.push(date.getSeconds().toString().padStart(2, "0"));
var timeString = timeArray.join(":");
g.setFontAlign(0, 0).setColor(g.theme.fg).setFont(FONT_NAME + (lockState ? "Big" : ""));
g.drawString(timeString, Bangle.appRect.x2/2, Bangle.appRect.y + BIG_FONT_HEIGHT/2);

if (timeDrawTimeout) clearTimeout(timeDrawTimeout);
timeDrawTimeout = setTimeout(function() {
timeDrawTimeout = undefined;
timeDraw();
}, (lockState ? 10000 - (Date.now() % 10000) : 1000 - (Date.now() % 1000))); // if locked, every clock's 10s, otherwise every 1s
};

let infoDraw = function() {
g.reset();

var date = new Date();
var dateString = [date.getFullYear().toString().padStart(4,"0"),
(date.getMonth()+1).toString().padStart(2,"0"),
date.getDate().toString().padStart(2,"0")].join("-");

var tzOffset = -(date.getTimezoneOffset())/60;
var tzOffsetString = (tzOffset >= 0 ? "+" + tzOffset : tzOffset);

var batteryString = (Bangle.isCharging() ? "+" : "") + E.getBattery() + "%";

var pressureString = (pressure ? pressure + "hPa" : "(hPa)");

var powerString = (E.getPowerUsage().total / 1000) + "mA";

var stepsString = Bangle.getHealthStatus("day").steps + "ST";

var bluetoothStatus = NRF.getSecurityStatus();
var bluetoothString = (bluetoothStatus.connected ? bluetoothStatus.connected_addr.split(" ")[0].substr(-5) : "N/C");

var infoMatrix = [
[dateString + tzOffsetString ],
[batteryString, pressureString],
[powerString ],
[stepsString, bluetoothString ]
];

g.clearRect(Bangle.appRect.x, Bangle.appRect.y + BIG_FONT_HEIGHT, Bangle.appRect.x2, Bangle.appRect.y2);
g.setFontAlign(0, -1).setColor(g.theme.fg2).setFont(FONT_NAME+"Small");

infoMatrix.forEach((lineArray, lineNumber) => {
g.drawString(lineArray.join(" "), Bangle.appRect.x2/2, Bangle.appRect.y + BIG_FONT_HEIGHT + SMALL_FONT_HEIGHT*lineNumber);
});

Bangle.getPressure().then(baroValue => { pressure=Math.round(baroValue.pressure); });

if (infoDrawTimeout) clearTimeout(infoDrawTimeout);
infoDrawTimeout = setTimeout(function() {
infoDrawTimeout = undefined;
infoDraw();
}, (lockState ? 60000 : 10000)); // if locked, a minute from now, otherwise in 10s
};



// DRAW CALLS

g.clear();

Bangle.setUI({
mode: "clock",
remove: function() {
if (timeDrawTimeout) clearTimeout(timeDrawTimeout);
timeDrawTimeout = undefined;
if (infoDrawTimeout) clearTimeout(infoDrawTimeout);
infoDrawTimeout = undefined;

delete Graphics.prototype.setFontShareTechMono;
delete Graphics.prototype.setFontShareTechMonoBig;
delete Graphics.prototype.setFontShareTechMonoSmall;
}});

Bangle.loadWidgets();
Bangle.drawWidgets();

timeDraw();
infoDraw();
}
Binary file added apps/denseclock/app.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions apps/denseclock/metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{ "id": "denseclock",
"name": "Dense Clock",
"shortName":"Dense Clock",
"version":"0.02",
"description": "A clockface dense with text-only information. Switches between showing seconds and minutes when unlocked/locked, in the interest of saving power.",
"icon": "app.png",
"type": "clock",
"tags": "clock",
"supports" : ["BANGLEJS2"],
"storage": [
{"name":"denseclock.app.js","url":"app.js"},
{"name":"denseclock.img","url":"app-icon.js","evaluate":true}
],
"screenshots": [
{"url":"screenshot_locked.png"},
{"url":"screenshot_unlocked.png"}
]
}
Binary file added apps/denseclock/screenshot_locked.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added apps/denseclock/screenshot_unlocked.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading