Enable sleep modus only if alarm is not enabled.

master
David Peer 2022-01-27 19:30:25 +01:00
parent 828a08cb31
commit d2791b0bac
1 changed files with 11 additions and 10 deletions

View File

@ -90,17 +90,18 @@ Graphics.prototype.setNormalFont = function(scale) {
function getSteps() { function getSteps() {
var steps = 0; try{
let health; if (WIDGETS.wpedom !== undefined) {
try { return WIDGETS.wpedom.getSteps();
health = require("health"); } else if (WIDGETS.activepedom !== undefined) {
return WIDGETS.activepedom.getSteps();
}
} catch(ex) { } catch(ex) {
return steps; // In case we failed, we can only show 0 steps.
} }
health.readDay(new Date(), h=>steps+=h.steps); return 0;
return steps; }
}
function drawBackground() { function drawBackground() {
@ -238,7 +239,7 @@ function handleState(fastUpdate){
*/ */
var minutes = state.currentDate.getMinutes(); var minutes = state.currentDate.getMinutes();
var hours = state.currentDate.getHours(); var hours = state.currentDate.getHours();
if(fastUpdate && hours == 00 && minutes == 01){ if(!isAlarmEnabled() && fastUpdate && hours == 00 && minutes == 01){
state.sleep = true; state.sleep = true;
return; return;
} }
@ -318,8 +319,8 @@ function draw(fastUpdate){
drawDate(); drawDate();
drawLock(); drawLock();
drawState(); drawState();
drawData();
drawTime(); drawTime();
drawData();
// Queue draw in one minute // Queue draw in one minute
queueDraw(); queueDraw();