mirror of https://github.com/espruino/BangleApps
Added option to show weather
parent
918be9e7bb
commit
ff8b799427
|
@ -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.
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||

|
||||

|
||||

|
||||

|
||||
|
||||
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).
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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"],
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 2.6 KiB |
|
@ -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();
|
||||
},
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue