termux / termux-api

Termux add-on app which exposes device functionality as API to command line programs.
https://f-droid.org/en/packages/com.termux.api/
2.11k stars 432 forks source link

Extra battery information #258

Open crabdancing opened 5 years ago

crabdancing commented 5 years ago

BatteryBotPro gives some of extra information including the voltage of the battery, and includes several hacks to get mA (which do not apparently work on all phones, but may still be useful on a number of them). It also includes access to predictions of how much time is left until the battery runs out or finishes recharging, etc. It would be useful to add these features to termux-battery-status for scripts to make use of.

For convenience, here is the mA code, and here is the general battery info code. And here is some battery prediction stuff.

deoxal commented 5 years ago

If those hacks don't work on all phones, then shouldn't they go in unstable-packages?

crabdancing commented 5 years ago

I think rigorous testing is in order, and anything that doesn't work on all phones should be very clearly labeled as experimental/unstable -- but I don't think the option itself should necessarily be absent stable repos. I mean, it's not like the core functionality of the software relies on those things, or that the user could realistically invoke those features without looking at a help page that would inevitably warn them that they're experimental/unstable.

For example, Debian is the most stable thing ever, and it has chromium in its repos, and inside chromium you have the option to turn on or otherwise access experimental features. It's easier than maintaining multiple codebases when the unreliable bits can be isolated from stable code. Anyway, those are my two cents. :P

Edit: also noteworthy that not ALL the features here that are absent in the existing implementation are unreliable. I believe the battery voltage thing is actually quite reliable, but I'd have to check to confirm that.

Edit 2: If you need my help with testing, I own a Nexus 5, Nexus 5x, and some other phones too that I can't remember off hand. I'm also willing to take them apart and probe things like battery voltage to confirm accuracy, if need be. I have some pretty high-grade multimeters that have trustworthy calibration, too. :)