Added step count from wpedom widget
parent
7104eaec24
commit
e3777d6ca9
|
|
@ -40,6 +40,7 @@ function drawTimeDate() {
|
||||||
//We will create custom "Widgets" for our face.
|
//We will create custom "Widgets" for our face.
|
||||||
|
|
||||||
function drawSteps() {
|
function drawSteps() {
|
||||||
|
var steps = "-";
|
||||||
//Reset to defaults.
|
//Reset to defaults.
|
||||||
g.reset();
|
g.reset();
|
||||||
// draw the date (2x size 7 segment)
|
// draw the date (2x size 7 segment)
|
||||||
|
|
@ -48,7 +49,10 @@ function drawSteps() {
|
||||||
g.setFontAlign(-1,0); // align right bottom
|
g.setFontAlign(-1,0); // align right bottom
|
||||||
g.drawString("STEPS", 145, 40, true /*clear background*/);
|
g.drawString("STEPS", 145, 40, true /*clear background*/);
|
||||||
g.setColor('#bdc3c7');
|
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) {
|
function drawBPM(on) {
|
||||||
|
|
@ -114,6 +118,7 @@ Bangle.on('lcdPower',on=>{
|
||||||
//Screen on
|
//Screen on
|
||||||
drawBPM(HRMstate);
|
drawBPM(HRMstate);
|
||||||
drawTimeDate();
|
drawTimeDate();
|
||||||
|
drawSteps();
|
||||||
drawBattery();
|
drawBattery();
|
||||||
} else {
|
} else {
|
||||||
//Screen off
|
//Screen off
|
||||||
|
|
@ -124,6 +129,7 @@ Bangle.on('lcdPower',on=>{
|
||||||
// Show launcher when middle button pressed
|
// Show launcher when middle button pressed
|
||||||
setWatch(Bangle.showLauncher, BTN2, { repeat: false, edge: "falling" });
|
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) {
|
Bangle.on('touch', function(button) {
|
||||||
if(button == 1 || button == 2){
|
if(button == 1 || button == 2){
|
||||||
Bangle.showLauncher();
|
Bangle.showLauncher();
|
||||||
|
|
@ -133,14 +139,14 @@ Bangle.on('touch', function(button) {
|
||||||
//HRM Controller.
|
//HRM Controller.
|
||||||
setWatch(function(){
|
setWatch(function(){
|
||||||
if(!HRMstate){
|
if(!HRMstate){
|
||||||
console.log("Toggled HRM");
|
//console.log("Toggled HRM");
|
||||||
//Turn on.
|
//Turn on.
|
||||||
Bangle.buzz();
|
Bangle.buzz();
|
||||||
Bangle.setHRMPower(1);
|
Bangle.setHRMPower(1);
|
||||||
currentHRM = "CALC";
|
currentHRM = "CALC";
|
||||||
HRMstate = true;
|
HRMstate = true;
|
||||||
} else if(HRMstate){
|
} else if(HRMstate){
|
||||||
console.log("Toggled HRM");
|
//console.log("Toggled HRM");
|
||||||
//Turn off.
|
//Turn off.
|
||||||
Bangle.buzz();
|
Bangle.buzz();
|
||||||
Bangle.setHRMPower(0);
|
Bangle.setHRMPower(0);
|
||||||
|
|
@ -153,7 +159,7 @@ setWatch(function(){
|
||||||
Bangle.on('HRM', function(hrm) {
|
Bangle.on('HRM', function(hrm) {
|
||||||
if(hrm.confidence > 90){
|
if(hrm.confidence > 90){
|
||||||
/*Do more research to determine effect algorithm for heartrate average.*/
|
/*Do more research to determine effect algorithm for heartrate average.*/
|
||||||
console.log(hrm.bpm);
|
//console.log(hrm.bpm);
|
||||||
currentHRM = hrm.bpm;
|
currentHRM = hrm.bpm;
|
||||||
drawBPM(HRMstate);
|
drawBPM(HRMstate);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue