-
Notifications
You must be signed in to change notification settings - Fork 209
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
Device status - Battery % #501
Comments
The MAC command is supported in v3.0.99; but there's no API yet for feeding battery %. Generally if you look in the LoRaWAN 1.0.3 spec, grab a name and search for it (using VS Code, at least), you'll find. The name in LoRaWAN 1.0.3 is There is a routine |
I would also be interested in a way / API to override os_getBattLevel(), since i am already set with my own gettBattLevel(). |
@terrillmoore But why does the override work with other functions used in lmic.c, like |
@cyberman54 Because If we did that with There are non-portable ways of letting you override the hal functions using GNU weak definitions. But that won't work with other compilers. (Also, the STM32 BSP does exactly this with many of its functions, and it's kind of ugly in practice.) Some possible portable approaches:
Number 2 seems the best to me at the moment. Apps often check the battery level anyway, occasionally, in order to know whether to flash lights, etc. But I don't have a strong opinion. |
Yes, option 2 sounds most reasonable for this. |
I needed support for the battery level and implemented option 2, also added a define so devices on external power can just set that special value without a need to call a function. Tested it on 2 different devices, one on external power and one on batteries. Will send a pull request. |
@nielskoot i will by happe to test it as soon as the PR is ready. |
Good for loops, but what do you think about a callback? It does sound a bit more complicated from a simple app perspective, but I think it is more natural to make one call to register a callback, then feeding battery level values into LMIC constantly. |
On the second thought you can even combine the whole story in one, where callback gets priority:
|
@altishchenko that is good way to support callback too. I can include it, however don't use the user events myself. Anyone who could test this? |
I use it myself in our code. My variant is completely event driven, published PR #560 here. |
Are Device Status requests supported? Looking for support for the back-end server to request the node status, in particular the battery %. So far haven't been able to identify if that is support and if so how to feed it the battery %. It would be great to get that function as base of this code base.
The text was updated successfully, but these errors were encountered: