Added wind to datapoints.

pull/1419/head
David Peer 2022-02-10 22:17:18 +01:00
parent 1882f08838
commit 6bdf68d39b
5 changed files with 64 additions and 43 deletions

View File

@ -13,3 +13,4 @@
0.13: Improved battery visualization. 0.13: Improved battery visualization.
0.14: Added altitude as an option to display. 0.14: Added altitude as an option to display.
0.15: Using wpedom to count steps. 0.15: Using wpedom to count steps.
0.16: Improved stability. Wind can now be shown.

View File

@ -1,8 +1,9 @@
# LCARS clock # LCARS clock
A simple LCARS inspired clock. A simple LCARS inspired clock.
Note: To display the steps, the health app is required. If this app is not installed, the data will not be shown. Note: To display the steps, the wpedom app is required. To show weather data
To contribute you can open a PR at this [GitHub Repo]( https://github.com/peerdavid/BangleApps) such as temperature, humidity or window you BangleJS must be connected
with Gadgetbride and the weather app must be installed.
## Control ## Control
* Tap left / right to change between screens. * Tap left / right to change between screens.
@ -25,6 +26,7 @@ To contribute you can open a PR at this [GitHub Repo]( https://github.com/peerda
* HRM - Last measured HRM * HRM - Last measured HRM
* Temp - Weather temperature loaded via the weather module + gadgetbridge * Temp - Weather temperature loaded via the weather module + gadgetbridge
* Humidity - Humidity loaded via the weather module + gadgetbridge * Humidity - Humidity loaded via the weather module + gadgetbridge
* Wind - Wind loaded via the weather module + gadgetbridge
* Altitude - Shows the altitude in m. * Altitude - Shows the altitude in m.
* CoreT - Temperature of device * CoreT - Temperature of device
@ -35,9 +37,6 @@ Access different screens via tap on the left/ right side of the screen
![](screenshot_2.png) ![](screenshot_2.png)
# Ideas
- Tap top / bottom to disable steps (also icon) and start a timer
## Contributors ## Contributors
- [David Peer](https://github.com/peerdavid). - [David Peer](https://github.com/peerdavid).
- [Adam Schmalhofer](https://github.com/adamschmalhofer). - [Adam Schmalhofer](https://github.com/adamschmalhofer).

View File

@ -122,17 +122,17 @@ function printRow(text, value, y, c){
g.setFontAntonioMedium(); g.setFontAntonioMedium();
g.setFontAlign(-1,-1,0); g.setFontAlign(-1,-1,0);
g.setColor(c); g.setColor(c);
g.fillRect(79, y-2, 85 ,y+18); g.fillRect(77, y-2, 83 ,y+18);
g.setFontAlign(0,-1,0); g.setFontAlign(0,-1,0);
g.drawString(value, 110, y); g.drawString(value, 110, y);
g.setColor(c); g.setColor(c);
g.setFontAlign(-1,-1,0); g.setFontAlign(-1,-1,0);
g.fillRect(133, y-2, 165 ,y+18); g.fillRect(135, y-2, 165 ,y+18);
g.fillCircle(161, y+8, 10); g.fillCircle(163, y+8, 10);
g.setColor(cBlack); g.setColor(cBlack);
g.drawString(text, 135, y); g.drawString(text, 137, y);
} }
@ -174,6 +174,11 @@ function _drawData(key, y, c){
var weather = getWeather(); var weather = getWeather();
value = weather.hum; value = weather.hum;
} else if (key == "WIND"){
text = "WND";
var weather = getWeather();
value = weather.wind;
} else if (key == "ALTITUDE"){ } else if (key == "ALTITUDE"){
should_print= false; should_print= false;
text = "ALT"; text = "ALT";
@ -248,16 +253,16 @@ function drawState(){
hours % 4 == 1 ? iconMars : hours % 4 == 1 ? iconMars :
hours % 4 == 2 ? iconMoon : hours % 4 == 2 ? iconMoon :
iconEarth; iconEarth;
g.drawImage(iconImg, 24, 118); g.drawImage(iconImg, 23, 118);
g.setColor(cWhite); g.setColor(cWhite);
g.drawString("STATUS", 24+25, 108); g.drawString("STATUS", 23+25, 108);
} else { } else {
// Alarm within symbol // Alarm within symbol
g.setColor(cOrange); g.setColor(cOrange);
g.drawString("ALARM", 24+25, 108); g.drawString("ALARM", 23+25, 108);
g.setColor(cWhite); g.setColor(cWhite);
g.setFontAntonioLarge(); g.setFontAntonioLarge();
g.drawString(getAlarmMinutes(), 24+25, 108+35); g.drawString(getAlarmMinutes(), 23+25, 108+35);
} }
g.setFontAlign(-1, -1, 0); g.setFontAlign(-1, -1, 0);
@ -425,6 +430,8 @@ function drawPosition1(){
} }
function draw(){ function draw(){
try{
// First handle alarm to show this correctly afterwards // First handle alarm to show this correctly afterwards
handleAlarm(); handleAlarm();
@ -438,6 +445,10 @@ function draw(){
} else if (lcarsViewPos == 1) { } else if (lcarsViewPos == 1) {
drawPosition1(); drawPosition1();
} }
} catch (ex){
// In case of an exception, we simply queue
// and try it in one minute again...
}
// Queue draw in one minute // Queue draw in one minute
queueDraw(); queueDraw();
@ -463,16 +474,32 @@ function getSteps() {
function getWeather(){ function getWeather(){
var weather; var weatherJson;
try { try {
weather = require('weather').get(); weatherJson = storage.readJSON('weather.json');
} catch(ex) { } catch(ex) {
// Return default // Return default
} }
if (weather === undefined){ if(weatherJson){
weather = { var weather = weatherJson.weather;
// Temperature
const temp = locale.temp(weather.temp-273.15).match(/^(\D*\d*)(.*)$/);
weather.temp = temp[1] + " " + temp[2].toUpperCase();
// Humidity
weather.hum = weather.hum + "%";
// Wind
const wind = locale.speed(weather.wind).match(/^(\D*\d*)(.*)$/);
weather.wind = wind[1] + wind[2].toUpperCase();
return weather
}
return {
temp: "-", temp: "-",
hum: "-", hum: "-",
txt: "-", txt: "-",
@ -480,12 +507,6 @@ function getWeather(){
wdir: "-", wdir: "-",
wrose: "-" wrose: "-"
}; };
} else {
weather.temp = locale.temp(Math.round(weather.temp-273.15))
weather.hum = weather.hum + "%";
}
return weather;
} }

View File

@ -18,14 +18,14 @@
storage.write(SETTINGS_FILE, settings) storage.write(SETTINGS_FILE, settings)
} }
var data_options = ["Steps", "Battery", "VREF", "HRM", "Temp", "Humidity", "Altitude", "CoreT"]; var data_options = ["Steps", "Battery", "VREF", "HRM", "Temp", "Humidity", "Wind", "Altitude", "CoreT"];
E.showMenu({ E.showMenu({
'': { 'title': 'LCARS Clock' }, '': { 'title': 'LCARS Clock' },
'< Back': back, '< Back': back,
'Row 1': { 'Row 1': {
value: 0 | data_options.indexOf(settings.dataRow1), value: 0 | data_options.indexOf(settings.dataRow1),
min: 0, max: 7, min: 0, max: 8,
format: v => data_options[v], format: v => data_options[v],
onchange: v => { onchange: v => {
settings.dataRow1 = data_options[v]; settings.dataRow1 = data_options[v];
@ -34,7 +34,7 @@
}, },
'Row 2': { 'Row 2': {
value: 0 | data_options.indexOf(settings.dataRow2), value: 0 | data_options.indexOf(settings.dataRow2),
min: 0, max: 7, min: 0, max: 8,
format: v => data_options[v], format: v => data_options[v],
onchange: v => { onchange: v => {
settings.dataRow2 = data_options[v]; settings.dataRow2 = data_options[v];
@ -43,7 +43,7 @@
}, },
'Row 3': { 'Row 3': {
value: 0 | data_options.indexOf(settings.dataRow3), value: 0 | data_options.indexOf(settings.dataRow3),
min: 0, max: 7, min: 0, max: 8,
format: v => data_options[v], format: v => data_options[v],
onchange: v => { onchange: v => {
settings.dataRow3 = data_options[v]; settings.dataRow3 = data_options[v];

View File

@ -3,7 +3,7 @@
"name": "LCARS Clock", "name": "LCARS Clock",
"shortName":"LCARS", "shortName":"LCARS",
"icon": "lcars.png", "icon": "lcars.png",
"version":"0.15", "version":"0.16",
"readme": "README.md", "readme": "README.md",
"supports": ["BANGLEJS2"], "supports": ["BANGLEJS2"],
"description": "Library Computer Access Retrieval System (LCARS) clock.", "description": "Library Computer Access Retrieval System (LCARS) clock.",