Added step count from wpedom widget

pull/643/head
hughbarney 2021-01-25 12:55:26 +00:00
parent 7104eaec24
commit e3777d6ca9
1 changed files with 10 additions and 4 deletions

View File

@ -40,6 +40,7 @@ function drawTimeDate() {
//We will create custom "Widgets" for our face.
function drawSteps() {
var steps = "-";
//Reset to defaults.
g.reset();
// draw the date (2x size 7 segment)
@ -48,7 +49,10 @@ function drawSteps() {
g.setFontAlign(-1,0); // align right bottom
g.drawString("STEPS", 145, 40, true /*clear background*/);
g.setColor('#bdc3c7');
g.drawString("-", 145, 65, true /*clear background*/);
if (WIDGETS.wpedom !== undefined) {
steps = WIDGETS.wpedom.getSteps();
}
g.drawString(steps, 145, 65, true /*clear background*/);
}
function drawBPM(on) {
@ -114,6 +118,7 @@ Bangle.on('lcdPower',on=>{
//Screen on
drawBPM(HRMstate);
drawTimeDate();
drawSteps();
drawBattery();
} else {
//Screen off
@ -124,6 +129,7 @@ Bangle.on('lcdPower',on=>{
// Show launcher when middle button pressed
setWatch(Bangle.showLauncher, BTN2, { repeat: false, edge: "falling" });
// this can be annoying as you loose the watch face, middle button is enough
Bangle.on('touch', function(button) {
if(button == 1 || button == 2){
Bangle.showLauncher();
@ -133,14 +139,14 @@ Bangle.on('touch', function(button) {
//HRM Controller.
setWatch(function(){
if(!HRMstate){
console.log("Toggled HRM");
//console.log("Toggled HRM");
//Turn on.
Bangle.buzz();
Bangle.setHRMPower(1);
currentHRM = "CALC";
HRMstate = true;
} else if(HRMstate){
console.log("Toggled HRM");
//console.log("Toggled HRM");
//Turn off.
Bangle.buzz();
Bangle.setHRMPower(0);
@ -153,7 +159,7 @@ setWatch(function(){
Bangle.on('HRM', function(hrm) {
if(hrm.confidence > 90){
/*Do more research to determine effect algorithm for heartrate average.*/
console.log(hrm.bpm);
//console.log(hrm.bpm);
currentHRM = hrm.bpm;
drawBPM(HRMstate);
}