mirror of https://github.com/espruino/BangleApps
Update boot.min.js
parent
16efd43ce9
commit
3816c9ba21
|
@ -1,4 +1,6 @@
|
|||
(function(){var a=0|(require("Storage").readJSON("health.json",1)||{}).hrm;if(1==a||2==a){function f(){Bangle.setHRMPower(1,"health");setTimeout(()=>Bangle.setHRMPower(0,"health"),6E4*a);if(1==a)for(var b=1;2>=b;b++)setTimeout(()=>{Bangle.setHRMPower(1,"health");setTimeout(()=>{Bangle.setHRMPower(0,"health")},2E5*b+6E4)},2E5*b)}Bangle.on("health",f);Bangle.on("HRM",b=>{80<b.confidence&&Bangle.setHRMPower(0,"health")});Bangle.getHealthStatus().bpmConfidence||f()}else Bangle.setHRMPower(0!=
|
||||
a,"health")})();Bangle.on("health",a=>{function f(c){return String.fromCharCode(c.steps>>8,c.steps&255,c.bpm,Math.min(c.movement/8,255))}var b=new Date(Date.now()-59E4),e=function(c){return 145*(c.getDate()-1)+6*c.getHours()+(0|6*c.getMinutes()/60)}(b);b=function(c){return"health-"+c.getFullYear()+"-"+(c.getMonth()+1)+".raw"}(b);var g=require("Storage").read(b);if(g){var d=g.substr(8+4*e,4);if("\u00ff\u00ff\u00ff\u00ff"!=d){print("HEALTH ERR: Already written!");return}}else require("Storage").write(b,
|
||||
"HEALTH1\x00",0,17988);var h=8+4*e;require("Storage").write(b,f(a),h,17988);if(143==e%145)if(e=h+4,"\u00ff\u00ff\u00ff\u00ff"!=g.substr(e,4))print("HEALTH ERR: Daily summary already written!");else{a={steps:0,bpm:0,movement:0,movCnt:0,bpmCnt:0};for(var k=0;144>k;k++)d=g.substr(h,4),"\u00ff\u00ff\u00ff\u00ff"!=d&&(a.steps+=(d.charCodeAt(0)<<8)+d.charCodeAt(1),a.movement+=d.charCodeAt(2),a.movCnt++,d=d.charCodeAt(2),a.bpm+=d,d&&a.bpmCnt++),h-=4;a.bpmCnt&&(a.bpm/=a.bpmCnt);a.movCnt&&(a.movement/=a.movCnt);
|
||||
require("Storage").write(b,f(a),e,17988)}})
|
||||
function m(){var a=require("Storage").readJSON("health.json",1)||{},e=Bangle.getHealthStatus("day").steps;if(a.stepGoalNotification&&0<a.stepGoal&&e>=a.stepGoal&&(e=(new Date(Date.now())).toISOString().split("T")[0],!a.stepGoalNotificationDate||a.stepGoalNotificationDate<e)){Bangle.buzz(200,.5);if("BANGLEJS2"==process.env.BOARD){var b=atob("MDCBAAAAAAAAAAAAAAAAAAA/+D/4AAB//H/8AAB//H/8AAB//v/4AAA8H/B4AAA+H/D4AAAeD+DwAAAfD+HwAAAPB8HgAAAPh8PgAAAHg8PAAAAHw8PAAAADw+eAAAAD4eeAAAAB4f+AAAAB8P8AAAAA//8AAAAA//4AAAAA//8AAAAB//+AAAAD+B/AAAAH4AfgAAAPgAHwAAAPAADwAAAfAAD4AAAeAAB4AAA+AAB8AAA8AAA8AAA8AAA8AAA8AAA8AAA8AAA8AAA8AAA8AAA8AAA8AAA+AAB4AAAeAAB4AAAfAAD4AAAPAADwAAAPgAHwAAAH4AfgAAAD+B/AAAAB//+AAAAA//8AAAAAP/wAAAAAD+AAAAAAAAAAAAAAAAAAAA=="),
|
||||
c=Graphics.createArrayBuffer(g.getWidth(),g.getHeight(),1,{msb:!0});c.drawImage(b,10,10);c.setFont("Vector:18").setFontAlign(0,0,0);c.drawString(a.stepGoal+" steps",g.getWidth()/2+24,34);c.drawString("Step goal reached!",g.getWidth()/2,g.getHeight()/2);Bangle.setLCDOverlay(c,0,0);setWatch(function(){Bangle.setLCDOverlay()},BTN)}else E.showPrompt("You reached your daily goal of "+a.stepGoal+" steps!",{title:"Step goal reached!",buttons:{Ok:1}}).then(function(h){load()});a.stepGoalNotificationDate=
|
||||
e;require("Storage").writeJSON("health.json",a)}}(function(){var a=0|(require("Storage").readJSON("health.json",1)||{}).hrm;if(1==a||2==a){var e=function(){Bangle.setHRMPower(1,"health");setTimeout(function(){return Bangle.setHRMPower(0,"health")},6E4*a);if(1==a)for(var b=1;2>=b;b++)setTimeout(function(){Bangle.setHRMPower(1,"health");setTimeout(function(){Bangle.setHRMPower(0,"health")},2E5*b+6E4)},2E5*b)};Bangle.on("health",e);Bangle.on("HRM",function(b){80<b.confidence&&Bangle.setHRMPower(0,"health")});
|
||||
Bangle.getHealthStatus().bpmConfidence||e()}else Bangle.setHRMPower(0!=a,"health")})();Bangle.on("health",function(a){function e(d){return String.fromCharCode(d.steps>>8,d.steps&255,d.bpm,Math.min(d.movement/8,255))}var b=new Date(Date.now()-59E4);a&&0<a.steps&&m();var c=function(d){return 145*(d.getDate()-1)+6*d.getHours()+(0|6*d.getMinutes()/60)}(b);b=function(d){return"health-"+d.getFullYear()+"-"+(d.getMonth()+1)+".raw"}(b);var h=require("Storage").read(b);if(h){var f=h.substr(8+4*c,4);if("\u00ff\u00ff\u00ff\u00ff"!=
|
||||
f){print("HEALTH ERR: Already written!");return}}else require("Storage").write(b,"HEALTH1\x00",0,17988);var k=8+4*c;require("Storage").write(b,e(a),k,17988);if(143==c%145)if(c=k+4,"\u00ff\u00ff\u00ff\u00ff"!=h.substr(c,4))print("HEALTH ERR: Daily summary already written!");else{a={steps:0,bpm:0,movement:0,movCnt:0,bpmCnt:0};for(var l=0;144>l;l++)f=h.substr(k,4),"\u00ff\u00ff\u00ff\u00ff"!=f&&(a.steps+=(f.charCodeAt(0)<<8)+f.charCodeAt(1),a.movement+=f.charCodeAt(2),a.movCnt++,f=f.charCodeAt(2),a.bpm+=
|
||||
f,f&&a.bpmCnt++),k-=4;a.bpmCnt&&(a.bpm/=a.bpmCnt);a.movCnt&&(a.movement/=a.movCnt);require("Storage").write(b,e(a),c,17988)}})
|
Loading…
Reference in New Issue