fsmeraldi / bleakheart

An asynchronous BLE Heart Monitor library with support for additional data from Polar monitors (ECG, accelerometers, etc)
Mozilla Public License 2.0
18 stars 11 forks source link

RR interval duplication in printing. #2

Closed HufflyCodes closed 8 months ago

HufflyCodes commented 8 months ago

Great work on this bit of software, I have only been going through this off and on for a couple days now, and I have never submitted an issue before. But I was looking over your examples to adapt your software and add some features of my own but I came across one small error when using your Heart rate callback example.

when processing your RR intervals on line 165 in bleakheart.py it is currently:

rr = int.from_bytes(data[offset:offset+2], 'little', signed=False)

Where it never gets the next value in the array. A simple fix would be:

rr = int.from_bytes(data[i:i+2], 'little', signed=False)

fsmeraldi commented 8 months ago

Well spotted, thank you very much! I'll fix it and update the release. Glad you find the software useful.

fsmeraldi commented 8 months ago

Fixed in version 0.1.1 - you are officially the first contributor! Thanks again. I recommend you also update bleak to version 0.21.1 if you have not done it yet - it reduces the delay in starting ECG notifications and seems to improve MacOS compatibility.

HufflyCodes commented 8 months ago

Interesting you mention that I have noticed that on Windows 10 it does take about 30 seconds for ECG data to roll in similar to the other post. I don't think it's an issue in BleakHeart however; I am pretty sure it's something with how windows deals with BT from what I have been reading. I plan on shifting this to an RPi eventually so I don't foresee any issues there, that and the unix timestamp helps deal with any potential initial delays.

fsmeraldi commented 7 months ago

I had exactly the same issue on Linux with the previous version of Bleak, and the upgrade solved it. I have not tried regressing to the older version, so it is in fact possible that some other library got upgraded in the meanwhile, I cannot say.