Merge pull request #1316 from peerdavid/master
[LCARS clock] Added altitude as option to display.master
commit
3cd15ab7e4
|
|
@ -4555,7 +4555,7 @@
|
||||||
"name": "LCARS Clock",
|
"name": "LCARS Clock",
|
||||||
"shortName":"LCARS",
|
"shortName":"LCARS",
|
||||||
"icon": "lcars.png",
|
"icon": "lcars.png",
|
||||||
"version":"0.13",
|
"version":"0.14",
|
||||||
"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.",
|
||||||
|
|
|
||||||
|
|
@ -9,5 +9,6 @@
|
||||||
0.09: Tab anywhere to open the launcher.
|
0.09: Tab anywhere to open the launcher.
|
||||||
0.10: Removed swipes to be compatible with the Pattern Launcher. Stability improvements.
|
0.10: Removed swipes to be compatible with the Pattern Launcher. Stability improvements.
|
||||||
0.11: Show the gadgetbridge weather temperature (settings).
|
0.11: Show the gadgetbridge weather temperature (settings).
|
||||||
0.12: Added humidity to data.
|
0.12: Added humidity as an option to display.
|
||||||
0.13: Improved battery visualization.
|
0.13: Improved battery visualization.
|
||||||
|
0.14: Added altitude as an option to display.
|
||||||
|
|
@ -13,10 +13,10 @@ To contribute you can open a PR at this [GitHub Repo]( https://github.com/peerda
|
||||||
* Full screen mode - widgets are still loaded but not shown.
|
* Full screen mode - widgets are still loaded but not shown.
|
||||||
* Tab on left/right to switch between different screens.
|
* Tab on left/right to switch between different screens.
|
||||||
* Cusomizable data that is shown on screen 1 (steps, weather etc.)
|
* Cusomizable data that is shown on screen 1 (steps, weather etc.)
|
||||||
* Shows random images of real planets.
|
* Shows random and real images of planets.
|
||||||
* Tap on top/bottom of screen 1 to activate an alarm.
|
* Tap on top/bottom of screen 1 to activate an alarm.
|
||||||
* The lower orange line indicates the battery level.
|
* The lower orange line indicates the battery level.
|
||||||
* Display graphs for steps + hrm on the second screen.
|
* Display graphs (day or month) for steps + hrm on the second screen.
|
||||||
|
|
||||||
## Data that can be configured
|
## Data that can be configured
|
||||||
* Steps - Steps loaded via the health module
|
* Steps - Steps loaded via the health module
|
||||||
|
|
@ -25,16 +25,17 @@ 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
|
||||||
|
* Altitude - Shows the altitude in m.
|
||||||
* CoreT - Temperature of device
|
* CoreT - Temperature of device
|
||||||
|
|
||||||
## Multiple screens support
|
## Multiple screens support
|
||||||
Access different screens via swipe left/ right
|
Access different screens via tap on the left/ right side of the screen
|
||||||
|
|
||||||

|

|
||||||

|

|
||||||
|
|
||||||
|
|
||||||
## Contributors
|
## Contributors
|
||||||
- Initial creation and improvements: [David Peer](https://github.com/peerdavid).
|
- [David Peer](https://github.com/peerdavid).
|
||||||
- Improvements: [Adam Schmalhofer](https://github.com/adamschmalhofer).
|
- [Adam Schmalhofer](https://github.com/adamschmalhofer).
|
||||||
- Improvements: [Jon Warrington](https://github.com/BartokW).
|
- [Jon Warrington](https://github.com/BartokW).
|
||||||
|
|
|
||||||
|
|
@ -26,10 +26,8 @@ let cGrey = "#424242";
|
||||||
* Global lcars variables
|
* Global lcars variables
|
||||||
*/
|
*/
|
||||||
let lcarsViewPos = 0;
|
let lcarsViewPos = 0;
|
||||||
let drag;
|
// let hrmValue = 0;
|
||||||
let hrmValue = 0;
|
|
||||||
var plotMonth = false;
|
var plotMonth = false;
|
||||||
var disableInfoUpdate = true; // When gadgetbridge connects, step infos cannot be loaded
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Requirements and globals
|
* Requirements and globals
|
||||||
|
|
@ -115,12 +113,43 @@ function queueDraw() {
|
||||||
}, 60000 - (Date.now() % 60000));
|
}, 60000 - (Date.now() % 60000));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
function printData(key, y, c){
|
* This function plots a data row in LCARS style.
|
||||||
|
* Note: It can be called async and therefore, the text alignment and
|
||||||
|
* font is set each time the function is called.
|
||||||
|
*/
|
||||||
|
function printRow(text, value, y, c){
|
||||||
|
g.setFontAntonioMedium();
|
||||||
g.setFontAlign(-1,-1,0);
|
g.setFontAlign(-1,-1,0);
|
||||||
|
g.setColor(c);
|
||||||
|
g.fillRect(79, y-2, 85 ,y+18);
|
||||||
|
|
||||||
|
g.setFontAlign(0,-1,0);
|
||||||
|
g.drawString(value, 110, y);
|
||||||
|
|
||||||
|
g.setColor(c);
|
||||||
|
g.setFontAlign(-1,-1,0);
|
||||||
|
g.fillRect(133, y-2, 165 ,y+18);
|
||||||
|
g.fillCircle(161, y+8, 10);
|
||||||
|
g.setColor(cBlack);
|
||||||
|
g.drawString(text, 135, y);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function drawData(key, y, c){
|
||||||
|
try{
|
||||||
|
_drawData(key, y, c);
|
||||||
|
} catch(ex){
|
||||||
|
// Show last error - next try hopefully works.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function _drawData(key, y, c){
|
||||||
key = key.toUpperCase()
|
key = key.toUpperCase()
|
||||||
var text = key;
|
var text = key;
|
||||||
var value = "ERR";
|
var value = "ERR";
|
||||||
|
var should_print= true;
|
||||||
|
|
||||||
if(key == "STEPS"){
|
if(key == "STEPS"){
|
||||||
text = "STEP";
|
text = "STEP";
|
||||||
|
|
@ -134,7 +163,7 @@ function printData(key, y, c){
|
||||||
value = E.getAnalogVRef().toFixed(2) + "V";
|
value = E.getAnalogVRef().toFixed(2) + "V";
|
||||||
|
|
||||||
} else if(key == "HRM"){
|
} else if(key == "HRM"){
|
||||||
value = hrmValue;
|
value = Math.round(Bangle.getHealthStatus("day").bpm);
|
||||||
|
|
||||||
} else if (key == "TEMP"){
|
} else if (key == "TEMP"){
|
||||||
var weather = getWeather();
|
var weather = getWeather();
|
||||||
|
|
@ -143,24 +172,29 @@ function printData(key, y, c){
|
||||||
} else if (key == "HUMIDITY"){
|
} else if (key == "HUMIDITY"){
|
||||||
text = "HUM";
|
text = "HUM";
|
||||||
var weather = getWeather();
|
var weather = getWeather();
|
||||||
value = weather.hum + "%";
|
value = weather.hum;
|
||||||
|
|
||||||
|
} else if (key == "ALTITUDE"){
|
||||||
|
should_print= false;
|
||||||
|
text = "ALT";
|
||||||
|
|
||||||
|
// Immediately print something - avoid that its empty
|
||||||
|
printRow(text, "", y, c);
|
||||||
|
Bangle.getPressure().then(function(data){
|
||||||
|
if(data && data.altitude){
|
||||||
|
value = Math.round(data.altitude);
|
||||||
|
printRow(text, value, y, c);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
} else if(key == "CORET"){
|
} else if(key == "CORET"){
|
||||||
value = locale.temp(parseInt(E.getTemperature()));
|
value = locale.temp(parseInt(E.getTemperature()));
|
||||||
}
|
}
|
||||||
|
|
||||||
g.setColor(c);
|
// Print for all datapoints that are not async
|
||||||
g.fillRect(79, y-2, 85 ,y+18);
|
if(should_print){
|
||||||
|
printRow(text, value, y, c);
|
||||||
g.setFontAlign(0,-1,0);
|
}
|
||||||
g.drawString(value, 110, y);
|
|
||||||
|
|
||||||
g.setColor(c);
|
|
||||||
g.setFontAlign(-1,-1,0);
|
|
||||||
g.fillRect(133, y-2, 165 ,y+18);
|
|
||||||
g.fillCircle(161, y+8, 10);
|
|
||||||
g.setColor(cBlack);
|
|
||||||
g.drawString(text, 135, y);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function drawHorizontalBgLine(color, x1, x2, y, h){
|
function drawHorizontalBgLine(color, x1, x2, y, h){
|
||||||
|
|
@ -273,9 +307,9 @@ function drawPosition0(){
|
||||||
// Draw data
|
// Draw data
|
||||||
g.setFontAlign(-1, -1, 0);
|
g.setFontAlign(-1, -1, 0);
|
||||||
g.setColor(cWhite);
|
g.setColor(cWhite);
|
||||||
printData(settings.dataRow1, 97, cOrange);
|
drawData(settings.dataRow1, 97, cOrange);
|
||||||
printData(settings.dataRow2, 122, cPurple);
|
drawData(settings.dataRow2, 122, cPurple);
|
||||||
printData(settings.dataRow3, 147, cBlue);
|
drawData(settings.dataRow3, 147, cBlue);
|
||||||
|
|
||||||
// Draw state
|
// Draw state
|
||||||
drawState();
|
drawState();
|
||||||
|
|
@ -446,7 +480,8 @@ function getWeather(){
|
||||||
wrose: "-"
|
wrose: "-"
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
weather.temp = locale.temp(parseInt(weather.temp-273.15))
|
weather.temp = locale.temp(Math.round(weather.temp-273.15))
|
||||||
|
weather.hum = weather.hum + "%";
|
||||||
}
|
}
|
||||||
|
|
||||||
return weather;
|
return weather;
|
||||||
|
|
@ -519,10 +554,6 @@ Bangle.on('charging',function(charging) {
|
||||||
drawState();
|
drawState();
|
||||||
});
|
});
|
||||||
|
|
||||||
Bangle.on('HRM', function (hrm) {
|
|
||||||
hrmValue = hrm.bpm;
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
function increaseAlarm(){
|
function increaseAlarm(){
|
||||||
if(isAlarmEnabled()){
|
if(isAlarmEnabled()){
|
||||||
|
|
|
||||||
|
|
@ -18,14 +18,14 @@
|
||||||
storage.write(SETTINGS_FILE, settings)
|
storage.write(SETTINGS_FILE, settings)
|
||||||
}
|
}
|
||||||
|
|
||||||
var data_options = ["Steps", "Battery", "VREF", "HRM", "Temp", "Humidity", "CoreT"];
|
var data_options = ["Steps", "Battery", "VREF", "HRM", "Temp", "Humidity", "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: 6,
|
min: 0, max: 7,
|
||||||
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: 6,
|
min: 0, max: 7,
|
||||||
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: 6,
|
min: 0, max: 7,
|
||||||
format: v => data_options[v],
|
format: v => data_options[v],
|
||||||
onchange: v => {
|
onchange: v => {
|
||||||
settings.dataRow3 = data_options[v];
|
settings.dataRow3 = data_options[v];
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue