-
-
Notifications
You must be signed in to change notification settings - Fork 39
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
[FR] Add batterylevel for PM and HR #443
Comments
That's not a bad idea at all. SmartSpin2k/src/BLE_Client.cpp Line 503 in e4e0ed2
Any new BLE characteristics/constants you read should be placed in: https://github.com/doudar/SmartSpin2k/blob/develop/lib/SS2K/include/Constants.h Since battery updates aren't time critical, I'd consider just reading that characteristic on a long timer of some sort. You could add that into the BLE communications loop on a long (like 1 minute or more) timer: SmartSpin2k/src/BLE_Common.cpp Line 20 in e4e0ed2
|
I added a new BatteryData Class and also added a bool hasBatteryLevel() and int getBatteryLevel() to every sensors .h & .cpp file. I also added the subscribtion to the postConnect(), but it seems that this void is only called when a BLEclient is connected. Is this done on purpose? |
In order to expose them to the http server, it would be easiest to add them to rtConfig. The post connection only needs to be run once on connection. The reason it's not in a direct callback is that some of the functions (specifically setting the connection parameters and the echelon setup) need to be done some ms after the initial connection is made. Also the regular NimBLE callbacks need to be as short as possible because they are isr and will cause a crash if they take very long. Can't wait to see your results! |
I made some progress. And before the } else if SmartSpin2k/src/BLE_Common.cpp Line 59 in e4e0ed2
I added: This way the batterylevels are stored in rtconfig and I can easily get them with rtConfig.hr_batt.getValue(). This approach seems to work, although I have not tested it with a long workout, but ble communications seems to be ok. |
Awesome! Is there any chance I can talk you into making a pull request for this? |
I could try? Which branches do I need to choose to create one? |
From Develop please
On Sat, Jan 28, 2023 at 2:10 PM Flo100 ***@***.***> wrote:
Awesome! Is there any chance I can talk you into making a pull request for
this?
I could try? Which branches do I need to choose to create one?
—
Reply to this email directly, view it on GitHub
<#443 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AEEO2KH57UXQIU3DYM5E32LWUV4JPANCNFSM6AAAAAAUGYSJZI>
.
You are receiving this because you commented.Message ID:
***@***.***>
--
*----------------------*
*Anthony Doud*
|
Merged into develop. Still need some .html monitoring at some point |
This would be a good addition to the Config App |
Is your feature request related to a problem? Please describe.
No problem, I would like to know the batterylevel from my Power Pedals and Heartrate sensor.
I don't really understand the way SmartSpin2k works with the sensordata to subscribe to different clients and services and could use some help.
I would like both the PMclient and HRclient to subscribe to service UUID 0x180F with characteristic UUID 0x2A19. Then after a notify callback store the batterylevel somewhere in the sensordata where I can 'get' it and show it for example on the status.html page. (And eventually on a custom display I use)
The text was updated successfully, but these errors were encountered: