2022-04-18 14:28:34 +00:00
|
|
|
function run(){
|
2022-04-29 09:40:50 +00:00
|
|
|
if (Bangle.isCharging()) return;
|
2022-04-18 14:28:34 +00:00
|
|
|
var now = new Date();
|
|
|
|
var h = now.getHours();
|
|
|
|
if(h >= activityreminder.startHour && h < activityreminder.endHour){
|
|
|
|
var health = Bangle.getHealthStatus("day");
|
|
|
|
stepsArray.unshift(health.steps);
|
|
|
|
stepsArray = stepsArray.slice(0, activityreminder.maxInnactivityMin);
|
|
|
|
require("activityreminder").saveStepsArray(stepsArray);
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
if(stepsArray != []){
|
|
|
|
stepsArray = [];
|
|
|
|
require("activityreminder").saveStepsArray(stepsArray);
|
2022-04-05 14:27:16 +00:00
|
|
|
}
|
2022-04-18 14:28:34 +00:00
|
|
|
}
|
|
|
|
if(stepsArray.length >= activityreminder.maxInnactivityMin){
|
|
|
|
if (stepsArray[0] - stepsArray[stepsArray.length-1] < activityreminder.minSteps){
|
|
|
|
load('activityreminder.app.js');
|
2022-04-05 14:27:16 +00:00
|
|
|
}
|
2022-04-18 14:28:34 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-04-07 16:16:51 +00:00
|
|
|
|
2022-04-18 14:28:34 +00:00
|
|
|
activityreminder = require("activityreminder").loadSettings();
|
|
|
|
if(activityreminder.enabled) {
|
|
|
|
stepsArray = require("activityreminder").loadStepsArray();
|
2022-04-18 15:30:57 +00:00
|
|
|
setInterval(run, 60000);
|
2022-04-05 14:27:16 +00:00
|
|
|
}
|
|
|
|
|