1
0
Fork 0

Added altitude

master
David Peer 2022-09-04 11:49:26 +02:00
parent 4485e58218
commit 77a498950c
1 changed files with 27 additions and 0 deletions

View File

@ -13,6 +13,11 @@ const TIMER_AGENDA_IDX = "bwclk_agenda";
const W = g.getWidth(); const W = g.getWidth();
const H = g.getHeight(); const H = g.getHeight();
/************
* Global data
*/
var pressureData;
/************ /************
* Settings * Settings
*/ */
@ -182,6 +187,14 @@ function imgAgenda() {
} }
} }
function imgMountain() {
return {
width : 24, height : 24, bpp : 1,
transparent : 1,
buffer : atob("//////////////////////3///n///D//uZ//E8//A+/+Z+f8//P5//n7//3z//zn//5AAAAAAAA////////////////////")
}
}
/************ /************
* 2D MENU with entries of: * 2D MENU with entries of:
* [name, icon, opt[customDownFun], opt[customUpFun], opt[customCenterFun]] * [name, icon, opt[customDownFun], opt[customUpFun], opt[customCenterFun]]
@ -196,6 +209,7 @@ var menu = [
function(){ return [ E.getBattery() + "%", Bangle.isCharging() ? imgCharging() : imgBattery() ] }, function(){ return [ E.getBattery() + "%", Bangle.isCharging() ? imgCharging() : imgBattery() ] },
function(){ return [ getSteps(), imgSteps() ] }, function(){ return [ getSteps(), imgSteps() ] },
function(){ return [ Math.round(Bangle.getHealthStatus("last").bpm) + " bpm", imgBpm()] }, function(){ return [ Math.round(Bangle.getHealthStatus("last").bpm) + " bpm", imgBpm()] },
function(){ return [ getAltitude(), imgMountain() ]},
] ]
] ]
@ -366,6 +380,14 @@ function getSteps() {
} }
function getAltitude(){
if(pressureData && pressureData.altitude){
return Math.round(pressureData.altitude) + "m";
}
return "???";
}
function getWeather(){ function getWeather(){
var weatherJson; var weatherJson;
@ -469,6 +491,11 @@ function draw() {
drawTime(); drawTime();
drawLock(); drawLock();
drawWidgets(); drawWidgets();
// Now lets measure some data..
Bangle.getPressure().then(data=>{
pressureData = data
});
} }