Battery Buddy support thread

It looks like versions 4.3.x are broken indeed for some reason… I had the charge control set in the operating system too, that’s why I didn’t notice it at first. I’ll have a closer look, thanks for the reporting.

The bug was caused by a single missing comma, so it was an easy fix, but hard to spot…

Version 4.3.2-1 has now been released with the fix!

2 Likes

Thank you! The max charging current limit now works OK again.

As for the Start button, please note that it is unable to start the service while the “Start background service at startup” setting is disabled because disabling that setting makes the service unloaded/masked and it can’t be started without loading / unmasking it first.

So it takes changing the onClicked part of the Start button from

onClicked: batteryService.startService()

to something like

onClicked: { batteryService.enableService(); batteryService.startService() }

so that the service first gets unmasked/loaded and only then it is able to start. Or else, systemctl-user status harbour-batterybuddy.service returns: Loaded: masked and Active: failed and that’s why the Start button can’t start it.

The above is obviously just a rough example and it needs some further polish - the batteryService.startService() should be executed only after getting "loaded" state from batteryService.serviceMasked first, or else it happens too early, before the service gets loaded and it takes tapping the Start button twice…

It will also take some changes to handle the state of the service upon reboot, because if the Start button enables and starts the service this way, the service will get automatically restarted upon reboot, even if the “Start background service at startup” setting is disabled (it’ll get automatically re-enabled, too, because it gets its state from checking the state of batteryService.serviceMasked and shows the enabled state if it is “loaded”… kind of closed circle).

Sorry to be such a PITA regarding this, but it is 100% reproducible on both my 10 III and XA2U, so it should be reproducible for you, too… And, as I tried (maybe not very clearly) to describe above, it actually cannot work because disabling the “Start background service at startup” option MASKS the service, so it cannot be started until it gets unmasked (which can be done only by re-enabling the “Start background service at startup” option). The Start button does not attempt to unmask the service first, it just tries to start it, which obviously fails if the service was put into the masked state by disabling the “Start background service at startup” option.

Can you please re-check it, by simply tapping “Stop”, then disabling the “Start background service at startup” option, and then tapping “Start”? The service (which is in masked state) will fail to start. The state of the service in each of those steps can be verified using systemctl-user status harbour-batterybuddy.service

Maybe switching off the “Start background service at startup” option should just disable the service rather than mask it? A disabled service won’t be started at boot anyway, but it could be started using the Start button. Whereas a masked service needs to be unmasked before it can be started.

I like to report that the “Maximum Charge Current” works on the XZ2 Compact Tama-Port. But the String isn´t translated to German. (I can do that if you provide a Link to translation Network).

But charging shows an negative Current (like -522mA) and discharging a postitive(e.g. 522mA).

And the i have some Questions about the Section “Intervall bei hoher/niedriger Ladung” (Intervall at high/low Charging), are these Time-Values for the “Battery is charged/empty” Notification?

Maybe this Section can be ordered a bit more because its a litte bit confusing for me.

And maybe you can add to the Time Values a “Never” option.


Another Idea ist to Add Battery Wear Leveling (aka. Useable Capacity) from sys/class/power_supply/battery/capacity

Maybe under Temperature on main-page, something like:
Wear Level: 16%

Hi
if i want get battery buddy on a port, what would i need to do ?
is there a cookbook what to look for, what to test before ?
i have installed bb on gs290 but it does not do anything.
Thanks !

1 Like

Yes! I experienced the same behaviour on a Sony XA2 with SFOS 4.5.0.18 and Battery Buddy 4.3.2-1.

1 Like

Thank you for confirming it because I was starting to feel really strange seeing how no one else has this. Especially that it just can’t work because the Start button simply can’t start a masked service without unmasking it first…

  1. figure out which files exist in /sys/class/power-supply, and what they do.

  2. Clone BB, and add the control file paths at the appropriate sections in the code. Note there are two implementations, one for the daemon, and one for the app/ui.

  3. Compile, test, tune.

  4. Submit PR.

I recently did some work for the Pinetab, maybe the changes can serve as an example:

Parts 1 (and 3) can be very easy or a bit finnicky, depending on kernel driver featurefullness and messy-sity.

OTOH unless there’somerhing weird, 2 is usually all you have to do to make BB do its thing.

1 Like

Thanks for raising that! There is indeed no “guide” on how to approach adding support to a new device. Pretty much what @nephros said, poke around the proc files, and when you find the correct file, add it to the list :slight_smile:

I’ll try to write a short guide-ish for reference at some point.

@wetab73 I don’t have it on my test devices, but I’ll have a deeper look at this. I don’t have time this week, though.

@fingus Great, I’ll add the device to the Openrepos page! About the translation, there’s no translation service set up. You can get the .ts file in the repo, fix it, and paste the fixes here on the forum - if you don’t want to fork, translate and make a pull request. You don’t need SFDK for that, a text editor will do, or you could install Qt Linguist separately and use that :slight_smile:

Sounds good, i will follow your instructions.

@direc85

I have a suggestion/addon for your App you maybe like:
Normally i set the Charge-Current to Minimum (in my case 500mA), because in the most Situations i’m able to leave the Smartphone in the Charger for hours (At Work, Home or on long Car-Drives). So it can charge nearly with no heating up the Battery/Device in a Battery-Unhealthy way.

But then there are sometimes Situations i need the Battery to be fully fast charged in a small time, when planning to spontaneous leaving the House within (1-2 hours) for a Bike trip or visiting Places where no Charger is around (open-air bath).

Maybe you can put two buttons on the App-Cover bottom for limited charge (edited in the App under Maximum Charge Current) and Fast-Charge with full power. A Leaf-Icon for Eco-Charging and a Flash-Icon for Fast-Charging for example.

This is just my Idea, take it or leave it if you like. Maybe this is usefull for other Persons too.

7 Likes

Ahoy @direc85 ,

I was searching the forum if there is any way like n900 to have battery charged up to a limit and then the phone takes all power from usb cable, without any battery drain. I found the following thread and your reply:

Did you have a look if this functionality can be added in battery buddy?

Cheers

I would like to place a feature request. I guess it’s probably not that hard to implement.
Would this thread be the right place, or should I create an issue at Mircrosoft’s :nauseated_face: GitHub?

Let’s describe my request here, if it makes life easier, I’'ll create an issue:

One of my most used features in Battery Buddy is to limit Maximum Charge Current, ether from minimal (500mA) or to max (3500 on X10iii).
Reaching this function is a bit cumbersome, for such a frequently used one. Wouldn’t it be nice to have a toggle on the preview of the app on the home screen?
Also, it would be nice if it is easier reachable within the app, either a toggle on the main view or if you move it upwards in the settings view.

Thanks for your app, your effort and your patience. :heart_eyes:

@jollajo
So then we are two who want to see such a usefull function.

2 Likes

Another idea comes to mind: when connecting it to a USB connector, a notification prompt could pop up asking ‘Slow Charging’ or ‘Fast Charging’. If nothing is selected within some seconds, it would use the preset value. This feature should be configurable for those who don’t want it.

3 Likes