commit
a897cbb38d
|
|
@ -27,3 +27,4 @@
|
||||||
0.13: Load step goal from Bangle health app as fallback
|
0.13: Load step goal from Bangle health app as fallback
|
||||||
Memory optimizations
|
Memory optimizations
|
||||||
0.14: Support to show big weather info
|
0.14: Support to show big weather info
|
||||||
|
0.15: Use Bangle.setUI({remove:...}) to allow loading the launcher without a full reset on 2v16
|
||||||
|
|
|
||||||
|
|
@ -23,12 +23,15 @@ if (settings.stepGoal == undefined) {
|
||||||
let d = storage.readJSON("health.json", true) || {};
|
let d = storage.readJSON("health.json", true) || {};
|
||||||
settings.stepGoal = d != undefined && d.settings != undefined ? d.settings.stepGoal : undefined;
|
settings.stepGoal = d != undefined && d.settings != undefined ? d.settings.stepGoal : undefined;
|
||||||
|
|
||||||
if (settings.stepGoal == undefined) {
|
if (settings.stepGoal == undefined) {
|
||||||
d = storage.readJSON("wpedom.json", true) || {};
|
d = storage.readJSON("wpedom.json", true) || {};
|
||||||
settings.stepGoal = d != undefined && d.settings != undefined ? d.settings.goal : 10000;
|
settings.stepGoal = d != undefined && d.settings != undefined ? d.settings.goal : 10000;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let timerHrm;
|
||||||
|
let drawTimeout;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Read location from myLocation app
|
* Read location from myLocation app
|
||||||
*/
|
*/
|
||||||
|
|
@ -156,6 +159,8 @@ function draw() {
|
||||||
drawCircle(2);
|
drawCircle(2);
|
||||||
drawCircle(3);
|
drawCircle(3);
|
||||||
if (circleCount >= 4) drawCircle(4);
|
if (circleCount >= 4) drawCircle(4);
|
||||||
|
|
||||||
|
queueDraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
function drawCircle(index) {
|
function drawCircle(index) {
|
||||||
|
|
@ -506,7 +511,7 @@ function drawTemperature(w) {
|
||||||
|
|
||||||
if (temperature)
|
if (temperature)
|
||||||
writeCircleText(w, locale.temp(temperature));
|
writeCircleText(w, locale.temp(temperature));
|
||||||
|
|
||||||
g.drawImage(getImage(atob("EBCBAAAAAYADwAJAAkADwAPAA8ADwAfgB+AH4AfgA8ABgAAA"), getCircleIconColor("temperature", color, percent)), w - iconOffset, h3 + radiusOuter - iconOffset);
|
g.drawImage(getImage(atob("EBCBAAAAAYADwAJAAkADwAPAA8ADwAfgB+AH4AfgA8ABgAAA"), getCircleIconColor("temperature", color, percent)), w - iconOffset, h3 + radiusOuter - iconOffset);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
@ -822,7 +827,7 @@ function getPressureValue(type) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Bangle.on('lock', function(isLocked) {
|
function onLock(isLocked) {
|
||||||
if (!isLocked) {
|
if (!isLocked) {
|
||||||
draw();
|
draw();
|
||||||
if (isCircleEnabled("hr")) {
|
if (isCircleEnabled("hr")) {
|
||||||
|
|
@ -831,11 +836,10 @@ Bangle.on('lock', function(isLocked) {
|
||||||
} else {
|
} else {
|
||||||
Bangle.setHRMPower(0, "circleclock");
|
Bangle.setHRMPower(0, "circleclock");
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
Bangle.on('lock', onLock);
|
||||||
|
|
||||||
|
function onHRM(hrm) {
|
||||||
let timerHrm;
|
|
||||||
Bangle.on('HRM', function(hrm) {
|
|
||||||
if (isCircleEnabled("hr")) {
|
if (isCircleEnabled("hr")) {
|
||||||
if (hrm.confidence >= (settings.confidence)) {
|
if (hrm.confidence >= (settings.confidence)) {
|
||||||
hrtValue = hrm.bpm;
|
hrtValue = hrm.bpm;
|
||||||
|
|
@ -852,23 +856,48 @@ Bangle.on('HRM', function(hrm) {
|
||||||
}, settings.hrmValidity * 1000);
|
}, settings.hrmValidity * 1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
Bangle.on('HRM', onHRM);
|
||||||
|
|
||||||
Bangle.on('charging', function(charging) {
|
function onCharging(charging) {
|
||||||
if (isCircleEnabled("battery")) drawBattery();
|
if (isCircleEnabled("battery")) drawBattery();
|
||||||
});
|
}
|
||||||
|
Bangle.on('charging', onCharging);
|
||||||
|
|
||||||
|
|
||||||
if (isCircleEnabled("hr")) {
|
if (isCircleEnabled("hr")) {
|
||||||
enableHRMSensor();
|
enableHRMSensor();
|
||||||
}
|
}
|
||||||
|
|
||||||
Bangle.setUI("clock");
|
Bangle.setUI({
|
||||||
|
mode : "clock",
|
||||||
|
remove : function() {
|
||||||
|
// Called to unload all of the clock app
|
||||||
|
Bangle.removeListener('charging', onCharging);
|
||||||
|
Bangle.removeListener('lock', onLock);
|
||||||
|
Bangle.removeListener('HRM', onHRM);
|
||||||
|
|
||||||
|
Bangle.setHRMPower(0, "circleclock");
|
||||||
|
|
||||||
|
if (timerHrm) clearTimeout(timerHrm);
|
||||||
|
timerHrm = undefined;
|
||||||
|
if (drawTimeout) clearTimeout(drawTimeout);
|
||||||
|
drawTimeout = undefined;
|
||||||
|
|
||||||
|
delete Graphics.prototype.setFontRobotoRegular50NumericOnly;
|
||||||
|
delete Graphics.prototype.setFontRobotoRegular21;
|
||||||
|
}});
|
||||||
|
|
||||||
Bangle.loadWidgets();
|
Bangle.loadWidgets();
|
||||||
|
|
||||||
// schedule a draw for the next minute
|
// schedule a draw for the next second or minute
|
||||||
setTimeout(function() {
|
function queueDraw() {
|
||||||
// draw in interval
|
let queueMillis = settings.updateInterval * 1000;
|
||||||
setInterval(draw, settings.updateInterval * 1000);
|
if (drawTimeout) clearTimeout(drawTimeout);
|
||||||
}, 60000 - (Date.now() % 60000));
|
drawTimeout = setTimeout(function() {
|
||||||
|
drawTimeout = undefined;
|
||||||
|
draw();
|
||||||
|
}, queueMillis - (Date.now() % queueMillis));
|
||||||
|
}
|
||||||
|
|
||||||
draw();
|
draw();
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
{ "id": "circlesclock",
|
{ "id": "circlesclock",
|
||||||
"name": "Circles clock",
|
"name": "Circles clock",
|
||||||
"shortName":"Circles clock",
|
"shortName":"Circles clock",
|
||||||
"version":"0.14",
|
"version":"0.15",
|
||||||
"description": "A clock with three or four circles for different data at the bottom in a probably familiar style",
|
"description": "A clock with three or four circles for different data at the bottom in a probably familiar style",
|
||||||
"icon": "app.png",
|
"icon": "app.png",
|
||||||
"screenshots": [{"url":"screenshot-dark.png"}, {"url":"screenshot-light.png"}, {"url":"screenshot-dark-4.png"}, {"url":"screenshot-light-4.png"}],
|
"screenshots": [{"url":"screenshot-dark.png"}, {"url":"screenshot-light.png"}, {"url":"screenshot-dark-4.png"}, {"url":"screenshot-light-4.png"}],
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue