Battery Buddy support thread

@direc85 I’ve just noticed that the Start button to manually start the service depends on the state of the “Start background service at startup” setting on the Settings page. If the setting to automatically start the service at boot is disabled, the “Start” button doesn’t work (even though it looks like an active button and is ‘clickable’ but it has no effect). So in order to manually start the service one has to temporarily enable that setting.

Another thing that I’ve been forgetting to report for a long time is a small glitch in Polish translation: on the main page both “State” and “Health” are translated in Polish as “Stan” (so there are two rows called “Stan”). I’d suggest to change it so that “State” is translated as “Status” and “Health” is either just “Stan” as it is now, or even better “Stan baterii”.

And while we’re at translation, “Maximum Charge Current” is not yet translated. Its Polish translation is: “Maksymalny prąd ładowania”. It would be also great if “Start background service at startup” could be changed (in order to avoid the “uruchom” word being repeated) from “Uruchom proces w tle podczas uruchomienia” to “Uruchom proces w tle podczas startu urządzenia”.

Thank you!

2 Likes

There’s now a new Battery Buddy release available, with a patch release too, to be exact. Battery Buddy 4.3.0 now supports PineTab Pro due to the work done by @nephros! 4.3.1 updates Polish translation as suggested by @wetab73. The source code repository is now up-to-date again (whoops).

I couldn’t replicate the behavior of the start button you described, so debugging that is quite hard… Does someone else have the problem? The start/stop buttons should be independent of the auto-start status, and if they are not, it’s a bug indeed.

1 Like

I’m not sure what I did, but I guess it took either closing and reopening the application after switching that setting off, or rebooting the device with that setting switched off and then opening the application. Either way, now it is persistent, i.e. the Start button only works if that setting is enabled. Also after updating to 4.3.0.

Thank you for updating the translation! Just one remark, can you please also change the “State” string (currently translated as “Stan”) to “Status”?

Updated to version 4.3.1-1 and in addition to the aforementioned problem with the Start button now also the Max charging current setting stopped working. Despite setting it to e.g. 500 mA, the charging current is still 1400 mA. It used to work OK in previous versions. Actually, I’m not sure if anything works but the GUI. What is the name of the background service so that I can check if it is running at all?

Edit: I downgraded to version 4.2.5-1 and now Max charging current setting works OK again. So there must be something wrong with it in the latest version(s). Sadly, the Start button still only works when the “Start background service at startup” setting is enabled.

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