-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[SleepLog] Fix thresholds not changing functionality #4010
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Updated version number and improved description for clarity.
Looks alright to me - is it tested now? |
I have uploaded version 0.22 to my watch and tested it overnight, and it still shows 0h of sleep, even though I can see in the log that my heart rate was below the light sleep threshold. This PR was definitely a step in the right direction, but it still does not seem to work correctly for me. |
@RKBoss6 Does it work for you? |
It was working perfectly fine for me yesterday, but today I checked and it also shows 0 hrs 0 min, and has a blank period... I'm wondering what's happening now, as before it was comparing it to undefined, and was returning all the sleep states, but now it's not working. @ondras12345 You may want to try reinstalling the app with the older version (0.21) as that was working for me. See if that works for you. That version game me accurate sleep, so you may have done something wrong. As for this one, we'll have to look into what's happening. In the meantime, should we make a PR reversing the changes of this one so as to not affect others? |
I did have that installed, and it was showing 0h. That's what lead me to discovering the bad comparison in the first place.
In case it wasn't clear, what I meant to write here is that 0.21 is the first version of the app that I tried. (I only bought the watch recently.) That version already has HRM features. I never tried 0.20 or other old versions that only used the accelerometer. |
I think I managed to revert commits so you can try version 0.20 - which should be the last one before HRM detection went in. Here: https://thyttan.github.io/BangleApps/?c=&q=sleeplog Please report back if that works better. |
Thanks thyttan. I will try it overnight, but probably tomorrow. Tonight, I would like to test a custom patch on top of 0.22. BangleApps/apps/sleeplog/boot.js Lines 165 to 170 in f04b1d4
uses data.heartRate , but I cannot see where that value is supposed to come from. The health event provides a field called bpm , so I will try using that instead and see if that helps. Perhaps both sides of the comparison were undefined in 0.21.
Edit: I tried printing out the entire If the app used movement data only, that could possibly explain the behavior I am seeing. The default thresholds for movement seem way too low for me, and I didn't bother setting them, because I wanted to use the heart rate. |
Yes, I found that out as well! It seems I was hooked into the wrong data. try out this one from my app loader. Also, I noticed that the movement data was being compared to the wrong thresholds... Give this a shot |
OK - please report back again 👍🙏 |
I tested that out for a while, and it seems as though it's using accelerometer data again, even though it should have changed to use BPM. It is varied, and often unreliable and unpredictable. Will work on figuring out what's happening here, just wanted to give a status update. |
I don't think 0.23 is using the accelerometer for me. It correctly detects deep sleep, which it previously wouldn't do due to the default accelerometer threshold being too low. I will try further reducing it to confirm. One more difference from previous tests: ever since reinstalling 0.23, I have kept debug mode off, just in case that affects things. I will try turning it back on now. |
Let me also try fine-tuning it, perhaps it's just not properly tuned for me... |
0.23 is definitely using HRM for me, and it seems to be working correctly. Regardless of whether debug mode is on or off. |
Just created a PR! |
As spotted by @ondras12345, the threshold variable name was different, and wouldn't compare. This fixes that issue.