Skip to content

Commit

Permalink
Merge pull request #3008 from xxDUxx/master
Browse files Browse the repository at this point in the history
ContourClock 0.31
  • Loading branch information
gfwilliams authored Sep 18, 2023
2 parents 08afc6a + 6e608e0 commit abc6b67
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
1 change: 1 addition & 0 deletions apps/contourclock/ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@
0.28: More config options for cleaner look, enabled fast loading
0.29: Fixed a bug that would leave old font files in storage.
0.30: Added options to show widgets and date on twist and tap. New fonts.
0.31: Bugfix, no more freeze.
21 changes: 14 additions & 7 deletions apps/contourclock/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,12 @@
extrasTimeout = undefined;
hideExtras();
}, 5000);
extrasShown = false;
};
let drawExtras = function() { //draw date, day of the week and widgets
let date = new Date();
g.reset();
g.clearRect(0, 138, g.getWidth() - 1, 176);
g.setFont("Teletext10x18Ascii").setFontAlign(0, 1);
if (settings.weekday) g.drawString(require("locale").dow(date).toUpperCase(), g.getWidth() / 2, g.getHeight() - 18);
if (settings.date) g.drawString(require('locale').date(date, 1), g.getWidth() / 2, g.getHeight());
Expand All @@ -45,21 +48,23 @@
};
let hideExtras = function() {
if (extrasTimeout) clearTimeout(extrasTimeout);
extrasTimeout = undefined; //NEW
g.reset();
g.clearRect(0, 138, g.getWidth() - 1, 176);
require("widget_utils").hide();
extrasShown = false;
extrasShown = false; ///NEW
};
let draw = function() {
if (drawTimeout) clearTimeout(drawTimeout); //NEW
drawTimeout = setTimeout(function() {
drawTimeout = undefined;
draw();
}, 60000 - (Date.now() % 60000));
let date = new Date();
g.reset();
if (extrasShown) drawExtras();
else hideExtras();
require('contourclock').drawClock(settings.fontIndex);
if (drawTimeout) clearTimeout(drawTimeout);
drawTimeout = setTimeout(function() {
drawTimeout = undefined;
draw();
}, 60000 - (Date.now() % 60000));
};
if (settings.hideWhenLocked) {
onLock = locked => {
Expand All @@ -83,6 +88,8 @@
Bangle.removeListener('twist', showExtras);
if (drawTimeout) clearTimeout(drawTimeout);
if (extrasTimeout) clearTimeout(extrasTimeout);
drawTimeout = undefined;
extrasTimeout = undefined;
if (settings.hideWhenLocked) require("widget_utils").show();
g.reset();
g.clear();
Expand All @@ -91,7 +98,7 @@
g.clear();
if (settings.widgets) {
Bangle.loadWidgets();
Bangle.drawWidgets();
setTimeout(Bangle.drawWidgets,0); //NEW
}
draw();
}
2 changes: 1 addition & 1 deletion apps/contourclock/metadata.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{ "id": "contourclock",
"name": "Contour Clock",
"shortName" : "Contour Clock",
"version":"0.30",
"version":"0.31",
"icon": "app.png",
"readme": "README.md",
"description": "A Minimalist clockface with large Digits.",
Expand Down

0 comments on commit abc6b67

Please sign in to comment.