diff --git a/apps/edgeclk/ChangeLog b/apps/edgeclk/ChangeLog index da75dfbae..b96d7207d 100644 --- a/apps/edgeclk/ChangeLog +++ b/apps/edgeclk/ChangeLog @@ -1,2 +1,3 @@ 0.01: Initial release. 0.02: Fix reset of progress bars on midnight. Fix display of 100k+ steps. +0.03: Added option to display weather. diff --git a/apps/edgeclk/README.md b/apps/edgeclk/README.md index 535a5e9df..cf2d0dd76 100644 --- a/apps/edgeclk/README.md +++ b/apps/edgeclk/README.md @@ -3,6 +3,7 @@ ![Screenshot](screenshot.png) ![Screenshot](screenshot2.png) ![Screenshot](screenshot3.png) +![Screenshot](screenshot4.png) Tinxx presents you a clock with as many straight edges as possible to allow for a crisp look and perfect readability. It comes with a custom font to display weekday, date, time, and steps. Also displays battery percentage while charging. @@ -15,6 +16,7 @@ The appearance is highly configurable. In the settings menu you can: - Switch between 24h and 12h clock. - Hide or display seconds.* - Show AM/PM in place of the seconds. +- Show weather temperature and icon in place of the seconds. - Set the daily step goal. - En- or disable the individual progress bars. - Set if your week should start with Monday or Sunday (for week progress bar). diff --git a/apps/edgeclk/app.js b/apps/edgeclk/app.js index 9f28e2588..5bfa77b09 100644 --- a/apps/edgeclk/app.js +++ b/apps/edgeclk/app.js @@ -7,7 +7,8 @@ monthFirst: true, twentyFourH: true, showAmPm: false, - showSeconds: true, + showSeconds: false, + showWeather: true, stepGoal: 10000, stepBar: true, weekBar: true, @@ -15,7 +16,6 @@ dayBar: true, }, require('Storage').readJSON('edgeclk.settings.json', true) || {}); - /* Runtime Variables ------------------------------------------------------------------------------*/ @@ -51,6 +51,30 @@ } else { drawSteps(stepsOnlyCount); } + + drawWeather(); + }; + + const drawWeather = function () { + if (!settings.showWeather){ + return; + } + + g.setFontCustom(font, 48, 10, 512 + 12); // double size (1<<9) + g.setFontAlign(1, 1); // right bottom + + try{ + const weather = require('weather'); + const w = weather.get(); + let temp = parseInt(w.temp-273.15); + temp = temp < 0 ? '\\' + String(temp*-1) : String(temp); + + g.drawString(temp, g.getWidth()-40, g.getHeight() - 1, true); + + weather.drawIcon(w, g.getWidth()-20, g.getHeight()-15, 15); + } catch(e) { + g.drawString("ERR", g.getWidth()-3, g.getHeight() - 1, true); + } }; const drawDate = function (date) { @@ -135,7 +159,8 @@ g.setFontAlign(-1, 1); // left bottom const steps = Bangle.getHealthStatus('day').steps; - g.drawString((steps < 100000 ? steps.toString() : ((steps / 1000).toFixed(0) + 'K')).padEnd(5, '_'), + const toKSteps = settings.showWeather ? 1000 : 100000; + g.drawString((steps < toKSteps ? steps.toString() : ((steps / 1000).toFixed(0) + 'K')).padEnd(5, '_'), iconSize[0] + 6, g.getHeight() - 1, true); if (onlyCount === true) { @@ -229,12 +254,14 @@ // However, to save power while on battery only step count will get updated. // This will update icon and progress bar as well: if (!charging) drawSteps(); + drawWeather(); }; const onHealth = function () { if (!lcdPower || charging) return; // This will update progress bar and icon: drawSteps(); + drawWeather(); }; const onLock = function (locked) { diff --git a/apps/edgeclk/metadata.json b/apps/edgeclk/metadata.json index 3f72be77a..0d53cd008 100644 --- a/apps/edgeclk/metadata.json +++ b/apps/edgeclk/metadata.json @@ -2,11 +2,11 @@ "id": "edgeclk", "name": "Edge Clock", "shortName": "Edge Clock", - "version": "0.02", + "version": "0.03", "description": "Crisp clock with perfect readability.", "readme": "README.md", "icon": "app.png", - "screenshots": [{"url":"screenshot.png"}, {"url":"screenshot2.png"}, {"url":"screenshot3.png"}], + "screenshots": [{"url":"screenshot.png"}, {"url":"screenshot2.png"}, {"url":"screenshot3.png"}, {"url":"screenshot4.png"}], "type": "clock", "tags": "clock", "supports": ["BANGLEJS2"], diff --git a/apps/edgeclk/screenshot4.png b/apps/edgeclk/screenshot4.png new file mode 100644 index 000000000..66ec85c89 Binary files /dev/null and b/apps/edgeclk/screenshot4.png differ diff --git a/apps/edgeclk/settings.js b/apps/edgeclk/settings.js index 205dc5170..d7eff58d5 100644 --- a/apps/edgeclk/settings.js +++ b/apps/edgeclk/settings.js @@ -11,6 +11,7 @@ stepGoal: 10000, stepBar: true, weekBar: true, + showWeather: false, mondayFirst: true, dayBar: true, }; @@ -57,6 +58,7 @@ settings.showAmPm = !settings.showAmPm; // TODO can this be visually changed? if (settings.showAmPm && settings.showSeconds) settings.showSeconds = false; + if (settings.showAmPm && settings.showWeather) settings.showWeather = false; save(); }, }, @@ -66,6 +68,17 @@ settings.showSeconds = !settings.showSeconds; // TODO can this be visually changed? if (settings.showSeconds && settings.showAmPm) settings.showAmPm = false; + if (settings.showSeconds && settings.showWeather) settings.showWeather = false; + save(); + }, + }, + 'Show Weather': { + value: settings.showWeather, + onchange: () => { + settings.showWeather = !settings.showWeather; + // TODO can this be visually changed? + if (settings.showWeather && settings.showAmPm) settings.showAmPm = false; + if (settings.showWeather && settings.showSeconds) settings.showSeconds = false; save(); }, },