-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2221 from siatwe/master
Enton clock based on Anton clock
- Loading branch information
Showing
8 changed files
with
106 additions
and
2,917 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
0.1: New App! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
Enton - Enhanced Anton Clock | ||
|
||
This clock face is based on the 'Anton Clock'. | ||
|
||
Things I changed: | ||
|
||
- The main font for the time is now Audiowide | ||
- Removed the written out day name and replaced it with steps and bpm | ||
- Changed the date string to a (for me) more readable string |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
Graphics.prototype.setFontAudiowide = function() { | ||
// Actual height 33 (36 - 4) | ||
var widths = atob("CiAsESQjJSQkHyQkDA=="); | ||
var font = atob("AAAAAAAAAAAAAAAAAAAAAPAAAAAAAfgAAAAAAfgAAAAAAfgAAAAAAfgAAAAAAPAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAADgAAAAAAHgAAAAAAfgAAAAAA/gAAAAAD/gAAAAAH/gAAAAAf/AAAAAB/8AAAAAD/4AAAAAP/gAAAAAf/AAAAAB/8AAAAAD/4AAAAAP/gAAAAAf+AAAAAB/8AAAAAH/wAAAAAP/gAAAAA/+AAAAAB/8AAAAA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AAAD/4AAAAAD/wAAAAAD/AAAAAAD8AAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/gAAAAAH/4AAAAAP/8AAAH+f/+AAAf////AAA/////gAB/////gAB///A/gAD//+AfgAD//+AfgAD+D+AfgAD8B+AfgAD8B+AfgAD8B+AfgAD8B+AfgAD8B+AfgAD8B+AfgAD8B+AfgAD8B+AfgAD8B+AfgAD8B+AfgAD+D+AfgAD//+AfgAD//+AfgAB///A/gAB/////gAA/////AAAP////AAAD+f/+AAAAAP/8AAAAAH/4AAAAAA+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAH/AAAAAAf/wAAAAA//4AAAAB//8AAAAB//8AfgAD//+AfgAD/D+AfgAD8B+AfgAD8B+AfgAD8B+AfgAD8B+AfgAD8B+AfgAD8B+AfgAD8B+AfgAD8B+AfgAD8B+AfgAD8B+AfgAD8B+AfgAD8B+AfgAD8B+AfgAD8B+AfgAD+B+A/gAD+B+A/gAD/B+B/gAB/////AAB/////AAA////+AAAf///8AAAP///4AAAH///wAAAB///AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAeAAPAAAA/AAfgAAA/AAfgAAA/AAfgAAA/AAfgAAAeAAPAAAAAAAAAAAAAAAAAAAAAAAAAA"); | ||
var scale = 1; // size multiplier for this font | ||
g.setFontCustom(font, 46, widths, 48+(scale<<8)+(1<<16)); | ||
}; | ||
|
||
function getSteps() { | ||
var steps = 0; | ||
try{ | ||
if (WIDGETS.wpedom !== undefined) { | ||
steps = WIDGETS.wpedom.getSteps(); | ||
} else if (WIDGETS.activepedom !== undefined) { | ||
steps = WIDGETS.activepedom.getSteps(); | ||
} else { | ||
steps = Bangle.getHealthStatus("day").steps; | ||
} | ||
} catch(ex) { | ||
// In case we failed, we can only show 0 steps. | ||
return "?"; | ||
} | ||
|
||
return Math.round(steps); | ||
} | ||
|
||
{ // must be inside our own scope here so that when we are unloaded everything disappears | ||
// we also define functions using 'let fn = function() {..}' for the same reason. function decls are global | ||
let drawTimeout; | ||
|
||
|
||
// Actually draw the watch face | ||
let draw = function() { | ||
var x = g.getWidth() / 2; | ||
var y = g.getHeight() / 2; | ||
g.reset().clearRect(Bangle.appRect); // clear whole background (w/o widgets) | ||
var date = new Date(); | ||
var timeStr = require("locale").time(date, 1); // Hour and minute | ||
g.setFontAlign(0, 0).setFont("Audiowide").drawString(timeStr, x, y); | ||
var dateStr = require("locale").date(date, 1).toUpperCase(); | ||
g.setFontAlign(0, 0).setFont("6x8", 2).drawString(dateStr, x, y+28); | ||
g.setFontAlign(0, 0).setFont("6x8", 2); | ||
g.drawString(getSteps(), 50, y+70); | ||
g.drawString(Math.round(Bangle.getHealthStatus("last").bpm), g.getWidth() -37, y + 70); | ||
|
||
// queue next draw | ||
if (drawTimeout) clearTimeout(drawTimeout); | ||
drawTimeout = setTimeout(function() { | ||
drawTimeout = undefined; | ||
draw(); | ||
}, 60000 - (Date.now() % 60000)); | ||
}; | ||
|
||
// Show launcher when middle button pressed | ||
Bangle.setUI({ | ||
mode : "clock", | ||
remove : function() { | ||
// Called to unload all of the clock app | ||
if (drawTimeout) clearTimeout(drawTimeout); | ||
drawTimeout = undefined; | ||
delete Graphics.prototype.setFontAnton; | ||
}}); | ||
// Load widgets | ||
Bangle.loadWidgets(); | ||
draw(); | ||
setTimeout(Bangle.drawWidgets,0); | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"id": "entonclk", | ||
"name": "Enton Clock", | ||
"version": "0.1", | ||
"description": "A simple clock using the Audiowide font. ", | ||
"icon": "app.png", | ||
"screenshots": [{"url":"screenshot.png"}], | ||
"type": "clock", | ||
"tags": "clock", | ||
"supports": ["BANGLEJS2"], | ||
"allow_emulator": true, | ||
"readme":"README.md", | ||
"storage": [ | ||
{"name":"entonclk.app.js","url":"app.js"}, | ||
{"name":"entonclk.img","url":"app-icon.js","evaluate":true} | ||
] | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.