mirror of https://github.com/espruino/BangleApps
Merge pull request #1720 from peerdavid/master
[LCARS] Bugfixes and other improvementspull/1721/head
commit
7f657a31d0
|
@ -19,3 +19,4 @@
|
|||
0.19: Alarms can not go bigger than 100.
|
||||
0.20: Use alarm for alarm functionality instead of own implementation.
|
||||
0.21: Add custom theming.
|
||||
0.22: Fix alarm and add build in function for step counting.
|
|
@ -1,8 +1,7 @@
|
|||
# LCARS clock
|
||||
|
||||
A simple LCARS inspired clock.
|
||||
Note: To display the steps, the wpedom app is required. To show weather data
|
||||
such as temperature, humidity or window you BangleJS must be connected
|
||||
To show weather data such as temperature, humidity or window you BangleJS must be connected
|
||||
with Gadgetbride and the weather app must be installed. To use the timer
|
||||
the "sched" app must be installed on your device.
|
||||
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
const TIMER_IDX = "lcars";
|
||||
const SETTINGS_FILE = "lcars.setting.json";
|
||||
const locale = require('locale');
|
||||
const storage = require('Storage')
|
||||
let settings = {
|
||||
alarm: -1,
|
||||
dataRow1: "Steps",
|
||||
dataRow2: "Temp",
|
||||
dataRow2: "HRM",
|
||||
dataRow3: "Battery",
|
||||
speed: "kph",
|
||||
fullscreen: false,
|
||||
|
@ -237,7 +238,7 @@ function _drawData(key, y, c){
|
|||
value = E.getAnalogVRef().toFixed(2) + "V";
|
||||
|
||||
} else if(key == "HRM"){
|
||||
value = Math.round(Bangle.getHealthStatus("day").bpm);
|
||||
value = Math.round(Bangle.getHealthStatus("last").bpm);
|
||||
|
||||
} else if (key == "TEMP"){
|
||||
var weather = getWeather();
|
||||
|
@ -290,6 +291,9 @@ function drawInfo(){
|
|||
return;
|
||||
}
|
||||
|
||||
// Draw Infor is called from different sources so
|
||||
// we have to ensure that the alignment is always the same.
|
||||
g.setFontAlign(-1, -1, 0);
|
||||
g.setFontAntonioMedium();
|
||||
g.setColor(color2);
|
||||
g.clearRect(120, 10, g.getWidth(), 75);
|
||||
|
@ -556,17 +560,20 @@ function draw(){
|
|||
* Step counter via widget
|
||||
*/
|
||||
function getSteps() {
|
||||
var steps = 0;
|
||||
try{
|
||||
if (WIDGETS.wpedom !== undefined) {
|
||||
return WIDGETS.wpedom.getSteps();
|
||||
steps = WIDGETS.wpedom.getSteps();
|
||||
} else if (WIDGETS.activepedom !== undefined) {
|
||||
return WIDGETS.activepedom.getSteps();
|
||||
steps = WIDGETS.activepedom.getSteps();
|
||||
} else {
|
||||
steps = Bangle.getHealthStatus("day").steps;
|
||||
}
|
||||
} catch(ex) {
|
||||
// In case we failed, we can only show 0 steps.
|
||||
}
|
||||
|
||||
return 0;
|
||||
return steps;
|
||||
}
|
||||
|
||||
|
||||
|
@ -575,21 +582,6 @@ function getWeather(){
|
|||
|
||||
try {
|
||||
weatherJson = storage.readJSON('weather.json');
|
||||
} catch(ex) {
|
||||
// Return default
|
||||
}
|
||||
|
||||
if(weatherJson === undefined){
|
||||
return {
|
||||
temp: "-",
|
||||
hum: "-",
|
||||
txt: "-",
|
||||
wind: "-",
|
||||
wdir: "-",
|
||||
wrose: "-"
|
||||
};
|
||||
}
|
||||
|
||||
var weather = weatherJson.weather;
|
||||
|
||||
// Temperature
|
||||
|
@ -604,8 +596,20 @@ function getWeather(){
|
|||
weather.wind = Math.round(wind[1] * speedFactor);
|
||||
|
||||
return weather
|
||||
|
||||
} catch(ex) {
|
||||
// Return default
|
||||
}
|
||||
|
||||
return {
|
||||
temp: " ? ",
|
||||
hum: " ? ",
|
||||
txt: " ? ",
|
||||
wind: " ? ",
|
||||
wdir: " ? ",
|
||||
wrose: " ? "
|
||||
};
|
||||
}
|
||||
|
||||
/*
|
||||
* Handle alarm
|
||||
|
|
|
@ -5,9 +5,9 @@
|
|||
const storage = require('Storage')
|
||||
let settings = {
|
||||
alarm: -1,
|
||||
dataRow1: "Battery",
|
||||
dataRow2: "Steps",
|
||||
dataRow3: "Temp",
|
||||
dataRow1: "Steps",
|
||||
dataRow2: "HRM",
|
||||
dataRow3: "Battery",
|
||||
speed: "kph",
|
||||
fullscreen: false,
|
||||
themeColor1BG: "#FF9900",
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
"name": "LCARS Clock",
|
||||
"shortName":"LCARS",
|
||||
"icon": "lcars.png",
|
||||
"version":"0.21",
|
||||
"version":"0.22",
|
||||
"readme": "README.md",
|
||||
"supports": ["BANGLEJS2"],
|
||||
"description": "Library Computer Access Retrieval System (LCARS) clock.",
|
||||
|
|
Loading…
Reference in New Issue