From 3816c9ba211407e72e742305c6cffd27a857b9d5 Mon Sep 17 00:00:00 2001 From: Marco H Date: Thu, 5 Jan 2023 11:56:20 +0100 Subject: [PATCH] Update boot.min.js --- apps/health/boot.min.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/apps/health/boot.min.js b/apps/health/boot.min.js index 00313a1f5..1215baf1f 100644 --- a/apps/health/boot.min.js +++ b/apps/health/boot.min.js @@ -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{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)}}) \ No newline at end of file +function m(){var a=require("Storage").readJSON("health.json",1)||{},e=Bangle.getHealthStatus("day").steps;if(a.stepGoalNotification&&0=a.stepGoal&&(e=(new Date(Date.now())).toISOString().split("T")[0],!a.stepGoalNotificationDate||a.stepGoalNotificationDate=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>8,d.steps&255,d.bpm,Math.min(d.movement/8,255))}var b=new Date(Date.now()-59E4);a&&0l;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)}}) \ No newline at end of file