sleepphasealarm

Fix: Do not wake when falling asleep
master
Erik Andresen 2022-11-01 06:56:09 +01:00
parent 368a8802e1
commit 42069a6e4e
7 changed files with 9 additions and 7 deletions

View File

@ -13,7 +13,7 @@
E.showMenu({ E.showMenu({
"" : { "title" : "GPS auto time" }, "" : { "title" : "GPS auto time" },
"< Back" : () => back(), "< Back" : () => back(),
'Show Widgets': { 'Show Widget': {
value: !!settings.show, value: !!settings.show,
onchange: v => { onchange: v => {
settings.show = v; settings.show = v;

View File

@ -9,7 +9,7 @@
delete settings; delete settings;
Bangle.on('GPS',function(fix) { Bangle.on('GPS',function(fix) {
if (fix.fix) { if (fix.fix && fix.time) {
var curTime = fix.time.getTime()/1000; var curTime = fix.time.getTime()/1000;
setTime(curTime); setTime(curTime);
lastTimeSet = curTime; lastTimeSet = curTime;

View File

@ -10,4 +10,4 @@
0.09: Vibrate with configured pattern 0.09: Vibrate with configured pattern
Add setting to defer start of algorithm Add setting to defer start of algorithm
Add setting to disable scheduler alarm Add setting to disable scheduler alarm
0.10: Fix: Do not wake when falling asleep

View File

@ -9,6 +9,8 @@ The display shows:
- Time difference between current time and alarm time (ETA). - Time difference between current time and alarm time (ETA).
- Current state of the ESS algorithm, "Sleep" or "Awake", useful for debugging. State can also be "Deferred", see the "Run before alarm"-option. - Current state of the ESS algorithm, "Sleep" or "Awake", useful for debugging. State can also be "Deferred", see the "Run before alarm"-option.
Replacing the watch strap with a more comfortable one (e.g. made of nylon) is recommended.
## Settings ## Settings
* **Keep alarm enabled** * **Keep alarm enabled**
@ -16,7 +18,7 @@ The display shows:
- No: No action at configured alarm time from scheduler. - No: No action at configured alarm time from scheduler.
* **Run before alarm** * **Run before alarm**
- disabled: (default) The ESS algorithm starts immediately when the application starts. - disabled: (default) The ESS algorithm starts immediately when the application starts.
- 1..23: The ESS algorithm starts the configured time before the alarm. E.g. when set to 1h for an alarm at 7:00 the ESS algorithm will start at 6:00. This improves battery life. - 1..23: The ESS algorithm starts the configured time before the alarm. E.g. when set to 1h for an alarm at 7:00 the ESS algorithm will start at 6:00. This increases battery life.
## Logging ## Logging

View File

@ -168,7 +168,7 @@ if (nextAlarmDate !== undefined) {
// The alarm widget should handle this one // The alarm widget should handle this one
addLog(now, "alarm"); addLog(now, "alarm");
setTimeout(load, 1000); setTimeout(load, 1000);
} else if (measure && now >= minAlarm && swest_last === false) { } else if (measure && now >= minAlarm && swest === false) {
addLog(now, "alarm"); addLog(now, "alarm");
buzz(); buzz();
measure = false; measure = false;

View File

@ -30,7 +30,7 @@ function getData() {
// remove window // remove window
Util.hideModal(); Util.hideModal();
logs = logs.filter(log => log != null); logs = logs.filter(log => log != null && log.filter(entry => entry.type === "alarm").length > 0);
logs.sort(function(a, b) {return new Date(b?.filter(entry => entry.type === "alarm")[0]?.time) - new Date(a?.filter(entry => entry.type === "alarm")[0]?.time)}); // sort by alarm date desc logs.sort(function(a, b) {return new Date(b?.filter(entry => entry.type === "alarm")[0]?.time) - new Date(a?.filter(entry => entry.type === "alarm")[0]?.time)}); // sort by alarm date desc
logs.forEach((log, i) => { logs.forEach((log, i) => {
const timeStr = log.filter(entry => entry.type === "alarm")[0]?.time; const timeStr = log.filter(entry => entry.type === "alarm")[0]?.time;

View File

@ -2,7 +2,7 @@
"id": "sleepphasealarm", "id": "sleepphasealarm",
"name": "SleepPhaseAlarm", "name": "SleepPhaseAlarm",
"shortName": "SleepPhaseAlarm", "shortName": "SleepPhaseAlarm",
"version": "0.09", "version": "0.10",
"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.", "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", "icon": "app.png",
"tags": "alarm", "tags": "alarm",