Skip to content

Commit 1a4e3e8

Browse files
authored
Merge pull request #4 from thyttan/sleeplogbugfix
sleeplog: adhere to original author code style
2 parents 6a99c13 + 6df53eb commit 1a4e3e8

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

apps/sleeplog/boot.js

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -161,17 +161,13 @@ if (global.sleeplog.conf.enabled) {
161161
// add preliminary status depending on charging and movement thresholds
162162
// 1 = not worn, 2 = awake, 3 = light sleep, 4 = deep sleep
163163
if(data.bpm){
164-
if (!Bangle.isCharging()) {
165-
if (data.bpm <= global.sleeplog.conf.hrmDeepTh) data.status = 4;
166-
else if (data.bpm <= global.sleeplog.conf.hrmLightTh) data.status = 3;
167-
else data.status = 2;
168-
} else data.status = 1;
169-
} else {
170-
if (!Bangle.isCharging()) {
171-
if (data.movement <= global.sleeplog.conf.deepTh) data.status = 4;
172-
else if (data.movement <= global.sleeplog.conf.lightTh) data.status = 3;
173-
else data.status = 2;
174-
} else data.status = 1;
164+
data.status = Bangle.isCharging() ? 1 :
165+
data.bpm <= global.sleeplog.conf.hrmDeepTh ? 4 :
166+
data.bpm <= global.sleeplog.conf.hrmLightTh ? 3 : 2;
167+
}else{
168+
data.status = Bangle.isCharging() ? 1 :
169+
data.movement <= global.sleeplog.conf.deepTh ? 4 :
170+
data.movement <= global.sleeplog.conf.lightTh ? 3 : 2;
175171
}
176172

177173
// check if changing to deep sleep from non sleeping

0 commit comments

Comments
 (0)