Skip to content

Commit d610023

Browse files
authored
Merge pull request #3977 from paul-arg/widalarmeta
widalarmeta: New font VGA8 for a more compact display
2 parents ca9e1e9 + 9b49ee7 commit d610023

File tree

5 files changed

+16
-10
lines changed

5 files changed

+16
-10
lines changed

apps/widalarmeta/ChangeLog

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,4 @@
1515
0.11: Bugfix: handle changes in alarms (e.g. done without a load, such as via fastload)
1616
0.12: Redraw when screen turns on or watch is unlocked
1717
0.13: Add option to only show when on clock
18+
0.14: New font VGA8 for a more compact display

apps/widalarmeta/metadata.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
"id": "widalarmeta",
33
"name": "Alarm & Timer ETA",
44
"shortName": "Alarm ETA",
5-
"version": "0.13",
5+
"version": "0.14",
66
"description": "A widget that displays the time to the next Alarm or Timer in hours and minutes, maximum 24h (configurable).",
77
"icon": "widget.png",
88
"type": "widget",
99
"tags": "widget",
1010
"supports": ["BANGLEJS","BANGLEJS2"],
1111
"provides_widgets" : ["alarm"],
12-
"screenshots" : [ { "url":"screenshot.png" } ],
12+
"screenshots" : [ { "url":"screenshot.png" }, { "url":"screenshot2.png" } ],
1313
"storage": [
1414
{"name":"widalarmeta.wid.js","url":"widget.js"},
1515
{"name":"widalarmeta.settings.js","url":"settings.js"}

apps/widalarmeta/screenshot2.png

6.18 KB
Loading

apps/widalarmeta/settings.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@
5353
},
5454
/*LANG*/'Font': {
5555
value: settings.font,
56-
min: 0, max: 2,
57-
format: v => [/*LANG*/"Segment", /*LANG*/"Teletext", /*LANG*/"6x8"][v === undefined ? 1 : v],
56+
min: 0, max: 3,
57+
format: v => [/*LANG*/"Segment", /*LANG*/"Teletext", /*LANG*/"6x8", /*LANG*/"VGA8",][v === undefined ? 1 : v],
5858
onchange: v => {
5959
settings.font = v;
6060
writeSettings();

apps/widalarmeta/widget.js

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,19 @@
77
drawBell: false,
88
padHours: true,
99
showSeconds: 0, // 0=never, 1=only when display is unlocked, 2=for less than a minute
10-
font: 1, // 0=segment style font, 1=teletext font, 2=6x8:1x2
10+
font: 1, // 0=segment style font, 1=teletext font, 2=6x8:1x2, 3=VGA8
1111
whenToShow: 0, // 0=always, 1=on clock only
1212
}, require("Storage").readJSON("widalarmeta.json",1) || {});
1313

1414
if (config.font == 0) {
1515
require("Font5x9Numeric7Seg").add(Graphics);
1616
} else if (config.font == 1) {
1717
require("FontTeletext5x9Ascii").add(Graphics);
18-
}
18+
} else if (config.font == 2) {
19+
require("Font6x8").add(Graphics);
20+
} else if (config.font == 3) {
21+
require("FontVGA8").add(Graphics);
22+
}
1923
}
2024
loadSettings();
2125

@@ -80,17 +84,18 @@
8084
} else {
8185
text += hours;
8286
}
83-
text += ":" + minutes.padStart(2, '0');
87+
text += (config.font == 3 ? "\n" : ":") + minutes.padStart(2, '0');
8488
if (drawSeconds) {
85-
text += ":" + seconds.padStart(2, '0');
89+
text += (config.font == 3 ? "\n" : ":") + seconds.padStart(2, '0');
8690
}
8791
if (config.font == 0) {
8892
g.setFont("5x9Numeric7Seg:1x2");
8993
} else if (config.font == 1) {
9094
g.setFont("Teletext5x9Ascii:1x2");
91-
} else {
92-
// Default to this if no other font is set.
95+
} else if (config.font == 2) {
9396
g.setFont("6x8:1x2");
97+
} else if (config.font == 3) {
98+
g.setFont("VGA8");
9499
}
95100
g.drawString(text, this.x+1, this.y+12);
96101

0 commit comments

Comments
 (0)