@@ -13,9 +13,7 @@ global.sleeplog = {
1313 minConsec : 18E5 , // [ms] minimal time to count for consecutive sleep
1414 deepTh : 150 , // threshold for deep sleep
1515 lightTh : 300 , // threshold for light sleep
16- wearTemp : 19.5 ,
17- hrmDeepTh : 60 ,
18- hrmLightTh : 74
16+ wearTemp : 19.5 , // temperature threshold to count as worn
1917 } , require ( "Storage" ) . readJSON ( "sleeplog.json" , true ) || { } )
2018} ;
2119
@@ -162,28 +160,10 @@ if (global.sleeplog.conf.enabled) {
162160
163161 // add preliminary status depending on charging and movement thresholds
164162 // 1 = not worn, 2 = awake, 3 = light sleep, 4 = deep sleep
165- if ( data . hrm ) {
166-
167- if ( ! Bangle . isCharging ( ) ) {
168- if ( data . heartRate <= global . sleeplog . conf . hrDeepTh ) {
169- status = 4 ; // deep sleep
170- } else if ( data . heartRate <= global . sleeplog . conf . hrLightTh ) {
171- status = 3 ; // light sleep
172- } else {
173- status = 2 ; // awake
174- }
175- } else {
176- status = 1 ; // not worn
177- }
178-
179-
180- } else {
181- data . status = Bangle . isCharging ( ) ? 1 :
182- data . movement <= global . sleeplog . conf . deepTh ? 4 :
183- data . movement <= global . sleeplog . conf . lightTh ? 3 : 2 ;
184- }
185-
186-
163+ data . status = Bangle . isCharging ( ) ? 1 :
164+ data . movement <= global . sleeplog . conf . deepTh ? 4 :
165+ data . movement <= global . sleeplog . conf . lightTh ? 3 : 2 ;
166+
187167 // check if changing to deep sleep from non sleeping
188168 if ( data . status === 4 && global . sleeplog . status <= 2 ) {
189169 global . sleeplog . checkIsWearing ( ( isWearing , data ) => {
0 commit comments