diff --git a/apps/edgeclk/ChangeLog b/apps/edgeclk/ChangeLog index da75dfbae1..b96d7207dc 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 535a5e9df1..90f6443fcf 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). @@ -22,3 +24,8 @@ The appearance is highly configurable. In the settings menu you can: *) Hiding seconds should further reduce power consumption as the draw interval is prolonged as well. The clock implements Fast Loading for faster switching to and fro. + +## Contributors + - [tinxx](https://github.com/tinxx) + - [peerdavid](https://github.com/peerdavid) + \ No newline at end of file diff --git a/apps/edgeclk/app.js b/apps/edgeclk/app.js index 9f28e25883..f9d5f803bd 100644 --- a/apps/edgeclk/app.js +++ b/apps/edgeclk/app.js @@ -8,6 +8,7 @@ twentyFourH: true, showAmPm: false, showSeconds: true, + showWeather: false, stepGoal: 10000, stepBar: true, weekBar: true, @@ -15,7 +16,6 @@ dayBar: true, }, require('Storage').readJSON('edgeclk.settings.json', true) || {}); - /* Runtime Variables ------------------------------------------------------------------------------*/ @@ -51,6 +51,33 @@ } 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); + + // clear icon area in case weather condition changed + g.clearRect(g.getWidth()-40, g.getHeight()-30, g.getWidth(), g.getHeight()); + weather.drawIcon(w, g.getWidth()-20, g.getHeight()-15, 14); + + } catch(e) { + g.drawString("???", g.getWidth()-3, g.getHeight() - 1, true); + } }; const drawDate = function (date) { @@ -135,7 +162,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 +257,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 3f72be77a2..0d53cd008c 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 0000000000..66ec85c898 Binary files /dev/null and b/apps/edgeclk/screenshot4.png differ diff --git a/apps/edgeclk/settings.js b/apps/edgeclk/settings.js index 205dc51706..6f38e774c7 100644 --- a/apps/edgeclk/settings.js +++ b/apps/edgeclk/settings.js @@ -8,6 +8,7 @@ twentyFourH: true, showAmPm: false, showSeconds: true, + showWeather: false, stepGoal: 10000, stepBar: true, weekBar: 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(); }, },