-
Notifications
You must be signed in to change notification settings - Fork 501
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
Badger 2040 badger_os get_battery_level, strange behaviour #334
Comments
When I looked at the code for badger_os here: https://github.com/pimoroni/pimoroni-pico/blob/main/micropython/examples/badger2040/badger_os.py It apparantly does exactly the same thing, and the battery.py example with (MAX_BATTERY_VOLTAGE = 3.2 and |
With the new improved 'sleep' behaviour the launcher doesn't stay awake for long enough to get a true voltage reading for the battery icon - this was mentioned in the release notes for 1.18.5:
You could save the I wonder if it's worth ditching the battery icon from the launcher and adding |
As far as I can see, it's working when I add the first call. I suppose it might never really update to show the true battery level. |
Much like the users above, I am having trouble with accurate battery readings. I have to ask what the point is of having a battery meter if it doesn't work properly? I would like to be notified that I am losing power before it actually happens. This is basic functionality IMO. |
The addition of a throw-away call to badger_os.get_battery_level() in the laucher.py is a simple fix. |
Badger 2040 and Badger 2040 W now live here: https://github.com/pimoroni/badger2040/ Closing this issue to keep Badger 2040 to its new home. I've made a note to look into this, but please feel free to re-open over at https://github.com/pimoroni/badger2040/issues with a link back here for posterity if it warrants more investigation. |
I stumbled upon this here, since I am wondering, where the battery icon is gone in [v0.0.4](https://github.com/pimoroni/badger2040/releases/tag/v0.0.4 and even ) So some issue is already documentet for the 2040W here but here it says, it's not yet implemented in the badger2040. Did I get that right or is it just me, having no towel and being still dizzy from the improbility drive? Thanks for any fish, err, hint! The Hitchhiker |
In the badger 2040 example launcher.py I noticed that the battery level was only shown correctly when the USB cable was also connected. This defeats the purpose of monitoring how much battery power is left.
The ADC and VREF pins don't seem to be getting initialised correctly for badger_os, so the call to:
doesn't return anything useful when running only on batteries. Which is pretty useless.
The badger 2040 example battery.py works correctly running only on battery power. That example 'initialises' the ADC and VREF pins. I copied the following to the top of launcher.py and now it's all working as I'd expect with or without a connected battery which itself is either switched on or off:
I completely nuked my badger and started again. I completely replaced the default main.py with the launcher.py code and I got the battery level working just with this additional code which is also in badger_os.py (see my commment below):
Sorry for all the edits:
I nuked it all again and did another experiment, if you just add a simple dummy call to badger_os.get_battery_level() right at the 'top' of launcher.py after import badger_os, just ignore the returned value, who cares. It all then works on just battery power (no extra import of ADC and setting vbat_adc is needed). There's something fishy with some kind of initialisation somewhere, but I don't know what's really happening.
I think there is a least one other issue about badger battery level monitoring and which values are correct for various types of batteries. The comments in the code should be corrected and improved to clarify the min/max range for all types of batteries.
The text was updated successfully, but these errors were encountered: