1
0
Fork 0

Merge pull request #2978 from peerdavid/master

[edgeclk] Option to show weather
master
Gordon Williams 2023-08-29 12:10:16 +01:00 committed by GitHub
commit ed8d73b534
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 55 additions and 4 deletions

View File

@ -1,2 +1,3 @@
0.01: Initial release. 0.01: Initial release.
0.02: Fix reset of progress bars on midnight. Fix display of 100k+ steps. 0.02: Fix reset of progress bars on midnight. Fix display of 100k+ steps.
0.03: Added option to display weather.

View File

@ -3,6 +3,7 @@
![Screenshot](screenshot.png) ![Screenshot](screenshot.png)
![Screenshot](screenshot2.png) ![Screenshot](screenshot2.png)
![Screenshot](screenshot3.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. 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. 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. - Switch between 24h and 12h clock.
- Hide or display seconds.* - Hide or display seconds.*
- Show AM/PM in place of the seconds. - Show AM/PM in place of the seconds.
- Show weather temperature and icon in place of the seconds.
- Set the daily step goal. - Set the daily step goal.
- En- or disable the individual progress bars. - En- or disable the individual progress bars.
- Set if your week should start with Monday or Sunday (for week progress bar). - 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. *) 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. The clock implements Fast Loading for faster switching to and fro.
## Contributors
- [tinxx](https://github.com/tinxx)
- [peerdavid](https://github.com/peerdavid)

View File

@ -8,6 +8,7 @@
twentyFourH: true, twentyFourH: true,
showAmPm: false, showAmPm: false,
showSeconds: true, showSeconds: true,
showWeather: false,
stepGoal: 10000, stepGoal: 10000,
stepBar: true, stepBar: true,
weekBar: true, weekBar: true,
@ -15,7 +16,6 @@
dayBar: true, dayBar: true,
}, require('Storage').readJSON('edgeclk.settings.json', true) || {}); }, require('Storage').readJSON('edgeclk.settings.json', true) || {});
/* Runtime Variables /* Runtime Variables
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -51,6 +51,33 @@
} else { } else {
drawSteps(stepsOnlyCount); 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) { const drawDate = function (date) {
@ -135,7 +162,8 @@
g.setFontAlign(-1, 1); // left bottom g.setFontAlign(-1, 1); // left bottom
const steps = Bangle.getHealthStatus('day').steps; 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); iconSize[0] + 6, g.getHeight() - 1, true);
if (onlyCount === true) { if (onlyCount === true) {
@ -229,12 +257,14 @@
// However, to save power while on battery only step count will get updated. // However, to save power while on battery only step count will get updated.
// This will update icon and progress bar as well: // This will update icon and progress bar as well:
if (!charging) drawSteps(); if (!charging) drawSteps();
drawWeather();
}; };
const onHealth = function () { const onHealth = function () {
if (!lcdPower || charging) return; if (!lcdPower || charging) return;
// This will update progress bar and icon: // This will update progress bar and icon:
drawSteps(); drawSteps();
drawWeather();
}; };
const onLock = function (locked) { const onLock = function (locked) {

View File

@ -2,11 +2,11 @@
"id": "edgeclk", "id": "edgeclk",
"name": "Edge Clock", "name": "Edge Clock",
"shortName": "Edge Clock", "shortName": "Edge Clock",
"version": "0.02", "version": "0.03",
"description": "Crisp clock with perfect readability.", "description": "Crisp clock with perfect readability.",
"readme": "README.md", "readme": "README.md",
"icon": "app.png", "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", "type": "clock",
"tags": "clock", "tags": "clock",
"supports": ["BANGLEJS2"], "supports": ["BANGLEJS2"],

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

@ -8,6 +8,7 @@
twentyFourH: true, twentyFourH: true,
showAmPm: false, showAmPm: false,
showSeconds: true, showSeconds: true,
showWeather: false,
stepGoal: 10000, stepGoal: 10000,
stepBar: true, stepBar: true,
weekBar: true, weekBar: true,
@ -57,6 +58,7 @@
settings.showAmPm = !settings.showAmPm; settings.showAmPm = !settings.showAmPm;
// TODO can this be visually changed? // TODO can this be visually changed?
if (settings.showAmPm && settings.showSeconds) settings.showSeconds = false; if (settings.showAmPm && settings.showSeconds) settings.showSeconds = false;
if (settings.showAmPm && settings.showWeather) settings.showWeather = false;
save(); save();
}, },
}, },
@ -66,6 +68,17 @@
settings.showSeconds = !settings.showSeconds; settings.showSeconds = !settings.showSeconds;
// TODO can this be visually changed? // TODO can this be visually changed?
if (settings.showSeconds && settings.showAmPm) settings.showAmPm = false; 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(); save();
}, },
}, },