diff --git a/apps/widalarmeta/ChangeLog b/apps/widalarmeta/ChangeLog index e014721f6..1ef003586 100644 --- a/apps/widalarmeta/ChangeLog +++ b/apps/widalarmeta/ChangeLog @@ -11,3 +11,4 @@ 0.07: Fix when no alarms are present 0.08: Selectable font. Allow to disable hour padding. 0.09: Match draw() API e.g. to allow wid_edit to alter this widget +0.10: Change 4x5 font to 6x8, teletext is now default font diff --git a/apps/widalarmeta/metadata.json b/apps/widalarmeta/metadata.json index 66882c16f..b23c2039c 100644 --- a/apps/widalarmeta/metadata.json +++ b/apps/widalarmeta/metadata.json @@ -2,7 +2,7 @@ "id": "widalarmeta", "name": "Alarm & Timer ETA", "shortName": "Alarm ETA", - "version": "0.09", + "version": "0.10", "description": "A widget that displays the time to the next Alarm or Timer in hours and minutes, maximum 24h (configurable).", "icon": "widget.png", "type": "widget", diff --git a/apps/widalarmeta/settings.js b/apps/widalarmeta/settings.js index b9fa062b3..1aacd0173 100644 --- a/apps/widalarmeta/settings.js +++ b/apps/widalarmeta/settings.js @@ -6,11 +6,12 @@ drawBell: false, padHours: true, showSeconds: 0, // 0=never, 1=only when display is unlocked, 2=for less than a minute - font: 0, // 0=segment style font, 1=teletest font, 2=4x5 + font: 1, // 0=segment style font, 1=teletext font, 2=6x8:1x2 }, require("Storage").readJSON(CONFIGFILE,1) || {}); function writeSettings() { require('Storage').writeJSON(CONFIGFILE, settings); + WIDGETS["widalarmeta"].reload(); } // Show the menu @@ -52,7 +53,7 @@ /*LANG*/'Font': { value: settings.font, min: 0, max: 2, - format: v => [/*LANG*/"Segment", /*LANG*/"Teletext", /*LANG*/"4x5"][v || 0], + format: v => [/*LANG*/"Segment", /*LANG*/"Teletext", /*LANG*/"6x8"][v || 0], onchange: v => { settings.font = v; writeSettings(); diff --git a/apps/widalarmeta/widget.js b/apps/widalarmeta/widget.js index d24b185d9..e2fd1c4c5 100644 --- a/apps/widalarmeta/widget.js +++ b/apps/widalarmeta/widget.js @@ -1,14 +1,19 @@ (() => { require("Font5x9Numeric7Seg").add(Graphics); require("FontTeletext5x9Ascii").add(Graphics); - require("Font4x5").add(Graphics); - const config = Object.assign({ - maxhours: 24, - drawBell: false, - padHours: true, - showSeconds: 0, // 0=never, 1=only when display is unlocked, 2=for less than a minute - font: 0, // 0=segment style font, 1=teletest font, 2=4x5 - }, require("Storage").readJSON("widalarmeta.json",1) || {}); + + let config; + + function loadSettings() { + config = Object.assign({ + maxhours: 24, + drawBell: false, + padHours: true, + showSeconds: 0, // 0=never, 1=only when display is unlocked, 2=for less than a minute + font: 1, // 0=segment style font, 1=teletext font, 2=6x8:1x2 + }, require("Storage").readJSON("widalarmeta.json",1) || {}); + } + loadSettings(); function getNextAlarm(date) { const alarms = (require("Storage").readJSON("sched.json",1) || []).filter(alarm => alarm.on && alarm.hidden !== true); @@ -66,7 +71,7 @@ if (config.font == 1) { g.setFont("Teletext5x9Ascii:1x2"); } else if (config.font == 2) { - g.setFont("4x5"); + g.setFont("6x8:1x2"); } else { // Default to this if no other font is set. g.setFont("5x9Numeric7Seg:1x2"); @@ -112,7 +117,12 @@ WIDGETS["widalarmeta"]={ area:"tl", width: 0, // hide by default = assume no timer - draw:draw + draw:draw, + reload: () => { + loadSettings(); + g.clear(); + Bangle.drawWidgets(); + }, }; } })();