Skip to content
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

Fix some HRM logic in the health app #2691

Merged
merged 5 commits into from Apr 24, 2023
Merged

Conversation

KTibow
Copy link
Contributor

@KTibow KTibow commented Apr 13, 2023

I haven't tested this yet, but it should work fine. I noticed some odd formatting and (possibly unintended) logic in the HRM section of the health app, and this PR fixes it.

@gfwilliams
Copy link
Member

gfwilliams commented Apr 13, 2023

Because this is a core app it 100% needs some good testing before it goes in. I've lost count of the amount of times someone's managed to break everyone's device because something wasn't tested :)

What was the 'unintended code'? What bug are you trying to fix?

edit: sorry! I'm slow today - I didn't realise that was code you'd added until just now :)

@KTibow
Copy link
Contributor Author

KTibow commented Apr 13, 2023

As it is, given you don't have it running all the time, if:

  • the hrm reading has non-zero confidence at the time of running: it won't turn on the HRM sensor
  • the hrm reading has 80+ confidence, but not more than the stored reading: it'll turn off the HRM sensor early. So the stored reading will be used instead, because the stored reading has more confidence.

This PR fixes that. I'll go ahead and try to test it in the IDE.

@KTibow
Copy link
Contributor Author

KTibow commented Apr 13, 2023

Just tested it. I don't see any errors, and with some added logging, things seem to be working as they should.

@KTibow
Copy link
Contributor Author

KTibow commented Apr 13, 2023

Contemplating whether I should raise the confidence threshold to a 90 - while there are some 40BPM measurements with 80-90% confidence, there are also some with 100%.

@gfwilliams
Copy link
Member

Thanks - yes, I reckon raising it to 90% is probably a good idea - thanks for checking this out!

Once it's 90 I'll merge?

@KTibow
Copy link
Contributor Author

KTibow commented Apr 17, 2023

Looks like I should update boot.min.js too, what minifier are you using? Is https://skalman.github.io/UglifyJS-online/ okay?

@gfwilliams
Copy link
Member

Ahh, yes - sorry.

It's best to clone https://github.com/espruino/EspruinoDocs and use bin/minify.js which uses Closure with some special settings. That's what I use.

@gfwilliams
Copy link
Member

How are you feeling about this now? Still seems to work well, and it's producing better HRM results?

@KTibow
Copy link
Contributor Author

KTibow commented Apr 24, 2023

It doesn't really produce better HRM results - it does fix a bug that might cause the wrong ones to be recorded though, so it's worth merging.

@gfwilliams
Copy link
Member

Ok, thanks!

@gfwilliams gfwilliams merged commit 2f68620 into espruino:master Apr 24, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants