diff --git a/apps/sleepphasealarm/ChangeLog b/apps/sleepphasealarm/ChangeLog index 795c62fa2..4815e5e75 100644 --- a/apps/sleepphasealarm/ChangeLog +++ b/apps/sleepphasealarm/ChangeLog @@ -13,3 +13,4 @@ 0.10: Fix: Do not wake when falling asleep 0.11: Minor tweaks 0.12: Support javascript command to execute as defined in scheduler 'js' configuration +0.13: Fix dated events alarm on wrong date diff --git a/apps/sleepphasealarm/app.js b/apps/sleepphasealarm/app.js index ba8bff9b2..0aef07760 100644 --- a/apps/sleepphasealarm/app.js +++ b/apps/sleepphasealarm/app.js @@ -10,7 +10,7 @@ const config = Object.assign({ disableAlarm: false, } }, require("Storage").readJSON(CONFIGFILE,1) || {}); -const active = alarms.filter(a=>a.on); +const active = alarms.filter(alarm => require("sched").getTimeToAlarm(alarm)); const schedSettings = require("sched").getSettings(); let buzzCount = schedSettings.buzzCount; let logs = []; diff --git a/apps/sleepphasealarm/metadata.json b/apps/sleepphasealarm/metadata.json index ced99062f..5382160c0 100644 --- a/apps/sleepphasealarm/metadata.json +++ b/apps/sleepphasealarm/metadata.json @@ -2,7 +2,7 @@ "id": "sleepphasealarm", "name": "SleepPhaseAlarm", "shortName": "SleepPhaseAlarm", - "version": "0.12", + "version": "0.13", "description": "Uses the accelerometer to estimate sleep and wake states with the principle of Estimation of Stationary Sleep-segments (ESS, see https://ubicomp.eti.uni-siegen.de/home/datasets/ichi14/index.html.en). This app will read the next alarm from the alarm application and will wake you up to 30 minutes early at the best guessed time when you are almost already awake.", "icon": "app.png", "tags": "alarm", @@ -14,6 +14,6 @@ {"name":"sleepphasealarm.settings.js","url":"settings.js"}, {"name":"sleepphasealarm.img","url":"app-icon.js","evaluate":true} ], - "data": [{"name":"sleepphasealarm.json","storageFile":true}], + "data": [{"name":"sleepphasealarm.json"}], "interface": "interface.html" } diff --git a/apps/widalarmeta/ChangeLog b/apps/widalarmeta/ChangeLog index 37b619f7f..19a19c006 100644 --- a/apps/widalarmeta/ChangeLog +++ b/apps/widalarmeta/ChangeLog @@ -2,3 +2,4 @@ 0.02: Change font to 5x9 7 segment-style Add settings page Add option to show seconds +0.03: Fix Bell not appearing on alarms > 24h and redrawing interval diff --git a/apps/widalarmeta/metadata.json b/apps/widalarmeta/metadata.json index 79387c1c5..89e35c090 100644 --- a/apps/widalarmeta/metadata.json +++ b/apps/widalarmeta/metadata.json @@ -2,7 +2,7 @@ "id": "widalarmeta", "name": "Alarm & Timer ETA", "shortName": "Alarm ETA", - "version": "0.02", + "version": "0.03", "description": "A widget that displays the time to the next Alarm or Timer in hours and minutes, maximum 24h (configurable).", "icon": "widget.png", "type": "widget", diff --git a/apps/widalarmeta/widget.js b/apps/widalarmeta/widget.js index ff3390d89..8a7933358 100644 --- a/apps/widalarmeta/widget.js +++ b/apps/widalarmeta/widget.js @@ -9,7 +9,7 @@ function draw() { const times = alarms.map(alarm => require("sched").getTimeToAlarm(alarm)).filter(a => a !== undefined); - const next = Math.min.apply(null, times); + const next = times.length > 0 ? Math.min.apply(null, times) : 0; let calcWidth = 0; let drawSeconds = false; @@ -34,7 +34,7 @@ if (drawSeconds) { calcWidth += 3*5; } - } else if (times.length > 0 && config.drawBell) { + } else if (config.drawBell && alarms.some(alarm=>alarm.on&&(alarm.hidden!==true))) { // next alarm too far in future, draw only widalarm bell g.reset().drawImage(atob("GBgBAAAAAAAAABgADhhwDDwwGP8YGf+YMf+MM//MM//MA//AA//AA//AA//AA//AA//AB//gD//wD//wAAAAADwAABgAAAAAAAAA"),this.x,this.y); calcWidth = 24; @@ -52,8 +52,13 @@ if (timeout === 0) { timeout += period; } - setTimeout(()=>{ - WIDGETS["widalarmeta"].draw(WIDGETS["widalarmeta"]); + + if (this.timeoutId !== undefined) { + clearTimeout(this.timeoutId); + } + this.timeoutId = setTimeout(()=>{ + this.timeoutId = undefined; + this.draw(); }, timeout); } /* draw */