Automatically reduce battery charging rate based on state of charge (aka charging limit) #67

Closed
opened 2023-01-22 23:57:29 +00:00 by restfuladi · 11 comments
restfuladi commented 2023-01-22 23:57:29 +00:00 (Migrated from github.com)

Please confirm

  • I have searched existing issues
  • This issue is not a duplicate of an existing one
  • I will fill this out to the best of my ability

Describe what you'd like to be able to do

I would like to be able to set a battery charge level at which PowerTools will reduce the charging rate to effectively create a cap.

Describe alternatives you've considered

I haven't found anything else that works on SteamOS.

Anything else?

No response

### Please confirm - [X] I have searched existing issues - [X] This issue is not a duplicate of an existing one - [X] I will fill this out to the best of my ability ### Describe what you'd like to be able to do I would like to be able to set a battery charge level at which PowerTools will reduce the charging rate to effectively create a cap. ### Describe alternatives you've considered I haven't found anything else that works on SteamOS. ### Anything else? _No response_
NGnius commented 2023-01-23 01:30:06 +00:00 (Migrated from github.com)

I have actually (briefly) considered adding this before, since there are some additions in v1.1 which would make this even more useful. The reason I haven't is because it's of limited usefulness since it only works while the Deck is awake. If someone comes up with a way to make it work while asleep, then I'd consider it.

I have actually (briefly) considered adding this before, since there are some additions in v1.1 which would make this even more useful. The reason I haven't is because it's of limited usefulness since it only works while the Deck is awake. If someone comes up with a way to make it work while asleep, then I'd consider it.
restfuladi commented 2023-01-23 14:52:17 +00:00 (Migrated from github.com)

For me the bigger issue is when I'm using it plugged in, I don't need it to keep the battery topped off and degrading it prematurely. When I'm not using it I can just unplug it.

For me the bigger issue is when I'm using it plugged in, I don't need it to keep the battery topped off and degrading it prematurely. When I'm not using it I can just unplug it.
milroneth commented 2023-02-11 19:59:04 +00:00 (Migrated from github.com)

The reason I haven't is because it's of limited usefulness since it only works while the Deck is awake. If someone comes up with a way to make it work while asleep, then I'd consider it.

I discovered a couple days ago that you had added charging mode control, good job with reverse engineering BatCtrl, thank you! Did some testing today and my conclusions are as follows (both/either with PowerTools or BatCtrl setting the mode, same behaviour):

The Charging mode resets to "Normal" automatically the moment you connect the charger, no matter if the Deck is awake or asleep. On the other hand, the system going to sleep does not affect it at all. Actually, even restarting or completely shutting the Deck down and powering it up again does not affect it, since the mode is sent and stored on the charging controller chip itself.

In other words, the only event that resets the mode to "Normal" is connecting a charger and that seems to be hardcoded and unavoidable.


That means that an option to automatically set it to idle mode at a custom percentage would be very beneficial for people that leave the Deck always docked for days as it would work as intended. Of course this would need a periodic check from PowerTools for the charge status and battery level. However, it seems that this is needed anyway even in the current implementation. If Force Charge Mode is toggled on, PowerTools should be able to re-apply the selected mode every time the charger gets connected to behave as expected, as it currently gets overridden by the chip.


Sure, none of the above helps if the user reattaches the charger with the Deck off/asleep, but there doesn't seem to be anything we can do about that and even then it should not matter in most cases. If I do attach a charger with the Deck in sleep mode, it's almost always because I indeed want to charge it and put it in a bag, otherwise I would had turned it on and used it so the mode change would kick in. This behaviour actually seems ideal to me, more than a hindrance, but that can be subjective of course.

> The reason I haven't is because it's of limited usefulness since it only works while the Deck is awake. If someone comes up with a way to make it work while asleep, then I'd consider it. I discovered a couple days ago that you had added charging mode control, good job with reverse engineering BatCtrl, thank you! Did some testing today and my conclusions are as follows (both/either with PowerTools or BatCtrl setting the mode, same behaviour): The Charging mode resets to "Normal" automatically the moment you connect the charger, no matter if the Deck is awake or asleep. On the other hand, the system going to sleep does not affect it at all. Actually, even restarting or completely shutting the Deck down and powering it up again does not affect it, since the mode is sent and stored on the charging controller chip itself. _In other words, the only event that resets the mode to "Normal" is connecting a charger and that seems to be hardcoded and unavoidable._ --- That means that an option to automatically set it to idle mode at a custom percentage would be very beneficial for people that leave the Deck always docked for days as it would work as intended. Of course this would need a periodic check from PowerTools for the charge status and battery level. However, it seems that this is needed anyway even in the current implementation. If Force Charge Mode is toggled on, PowerTools should be able to re-apply the selected mode every time the charger gets connected to behave as expected, as it currently gets overridden by the chip. --- Sure, none of the above helps if the user reattaches the charger with the Deck off/asleep, but there doesn't seem to be anything we can do about that and even then it should not matter in most cases. If I **do** attach a charger with the Deck in sleep mode, it's almost always because I indeed want to charge it and put it in a bag, otherwise I would had turned it on and used it so the mode change would kick in. This behaviour actually seems ideal to me, more than a hindrance, but that can be subjective of course.
NGnius commented 2023-02-12 01:09:46 +00:00 (Migrated from github.com)

Oh that's a good catch, I forgot to check if that charge mode gets overridden by anything. I'll add a plugged-in event detector to the list for the next release cycle.

I should also mention that PowerTools detects when the Deck resumes from sleep, and sets the charge mode at that point, so just make sure that that doesn't affect your testing.

Unfortunately this still doesn't account for the original desire to be able to limit the battery charge. The biggest hole in the use case right now is still that I can't stop the battery from charging while the Deck is asleep. It's fine if the Deck has already stopped charging before it goes to sleep, but if it reaches the desired charge level while asleep there's no way of stopping it.

Oh that's a good catch, I forgot to check if that charge mode gets overridden by anything. I'll add a plugged-in event detector to the list for the next release cycle. I should also mention that PowerTools detects when the Deck resumes from sleep, and sets the charge mode at that point, so just make sure that that doesn't affect your testing. Unfortunately this still doesn't account for the original desire to be able to limit the battery charge. The biggest hole in the use case right now is still that I can't stop the battery from charging while the Deck is asleep. It's fine if the Deck has already stopped charging before it goes to sleep, but if it reaches the desired charge level while asleep there's no way of stopping it.
milroneth commented 2023-02-14 12:28:57 +00:00 (Migrated from github.com)

I should also mention that PowerTools detects when the Deck resumes from sleep, and sets the charge mode at that point, so just make sure that that doesn't affect your testing.

Yes, that does work, but I can confirm it did not affect my conclusions. The behaviour is consistent even when set through BatCtrl directly, with PowerTools not set to any charge mode.

Unfortunately this still doesn't account for the original desire to be able to limit the battery charge. The biggest hole in the use case right now is still that I can't stop the battery from charging while the Deck is asleep. It's fine if the Deck has already stopped charging before it goes to sleep, but if it reaches the desired charge level while asleep there's no way of stopping it.

That is true. However, in the hypothetical scenario were I have set a 60% idle limit, plug the Deck in with a 15% charge level and leave it off while I go do other things, come back to use it and find it at 100%, maybe it's already a bit bad for the battery, but I would still prefer it to drop to 60% as soon as I start using it and then stay there for the next maybe 3 or 5 days that it will stay constantly powered instead of it being stuck at 100% while it's also getting hot from use, as that's much worse.

If I try to manually do that right now I risk overshooting my target both going up and down (I mean, already tried it, already experienced this, there's no way I can remember to look at the battery level every 1 minute while playing). So a charge target that would switch to charge/discharge when below/above and set it to idle when reached would still be awesome, even with the sleep limitation. My Deck has been sitting in its dock on 51% charge set to idle for the past 2 days after my experiments, but that was just randomly hit after a bunch of overshoots as I said above. I'd love to be able to set it and forget it instead.

I don't know how most people use their Decks generally, but I bet there's a bunch of us that leave it docked most of the time and only eventually take it around, between the 2 IRL friends I have that also own one, 1 of them also uses it as I do. I had a very different usage pattern in the summer admittedly, but the whole fall and winter it's been mostly sitting in the dock.

> I should also mention that PowerTools detects when the Deck resumes from sleep, and sets the charge mode at that point, so just make sure that that doesn't affect your testing. Yes, that does work, but I can confirm it did not affect my conclusions. The behaviour is consistent even when set through BatCtrl directly, with PowerTools not set to any charge mode. > Unfortunately this still doesn't account for the original desire to be able to limit the battery charge. The biggest hole in the use case right now is still that I can't stop the battery from charging while the Deck is asleep. It's fine if the Deck has already stopped charging before it goes to sleep, but if it reaches the desired charge level while asleep there's no way of stopping it. That is true. However, in the hypothetical scenario were I have set a 60% idle limit, plug the Deck in with a 15% charge level and leave it off while I go do other things, come back to use it and find it at 100%, maybe it's already a bit bad for the battery, but I would still prefer it to drop to 60% as soon as I start using it and then stay there for the next maybe 3 or 5 days that it will stay constantly powered instead of it being stuck at 100% while it's also getting hot from use, as that's much worse. If I try to manually do that right now I risk overshooting my target both going up and down (I mean, already tried it, already experienced this, there's no way I can remember to look at the battery level every 1 minute while playing). So a charge target that would switch to charge/discharge when below/above and set it to idle when reached would still be awesome, even with the sleep limitation. My Deck has been sitting in its dock on 51% charge set to idle for the past 2 days after my experiments, but that was just randomly hit after a bunch of overshoots as I said above. I'd love to be able to set it and forget it instead. I don't know how most people use their Decks generally, but I bet there's a bunch of us that leave it docked most of the time and only eventually take it around, between the 2 IRL friends I have that also own one, 1 of them also uses it as I do. I had a very different usage pattern in the summer admittedly, but the whole fall and winter it's been mostly sitting in the dock.
WinkelCode commented 2023-02-16 17:28:22 +00:00 (Migrated from github.com)

It's fine if the Deck has already stopped charging before it goes to sleep, but if it reaches the desired charge level while asleep there's no way of stopping it.

Given the current situation of what charging behavior can be influenced, I think it would be "good enough" to offer an option to automatically stop charging when entering suspend mode if the current battery level is within -20% or so of the charge target. I feel like this would be good enough for my personal use.

Edit: That -20% limit should be ideally adjustable, and with options to enable it when suspending and/or shutting down.

Edit 2: The main goal of my proposal is to prevent a situation where the Deck charges back up to 100% because it was going back up to the charge target in the moment it was suspended/shut down. It also allows the user to not have to be exactly at the charge target, without having to worry about ending up with a dead battery, at the cost of possibly charging it back up to 100% if it is below the configured threshold.

> It's fine if the Deck has already stopped charging before it goes to sleep, but if it reaches the desired charge level while asleep there's no way of stopping it. Given the current situation of what charging behavior can be influenced, I think it would be "good enough" to offer an option to automatically stop charging when entering suspend mode if the current battery level is within -20% or so of the charge target. I feel like this would be good enough for my personal use. **Edit:** That -20% limit should be ideally adjustable, and with options to enable it when suspending and/or shutting down. **Edit 2:** The main goal of my proposal is to prevent a situation where the Deck charges back up to 100% because it was going back up to the charge target in the moment it was suspended/shut down. It also allows the user to not have to be exactly at the charge target, without having to worry about ending up with a dead battery, at the cost of possibly charging it back up to 100% if it is below the configured threshold.
restfuladi commented 2023-02-16 17:30:05 +00:00 (Migrated from github.com)

I would be happy with a % cap that automatically sets charging to idle when reached, even if it doesn't work when the Deck is sleeping.

I would be happy with a % cap that automatically sets charging to idle when reached, even if it doesn't work when the Deck is sleeping.
marcel151 commented 2023-03-14 20:23:05 +00:00 (Migrated from github.com)

I would be happy with a % cap that automatically sets charging to idle when reached, even if it doesn't work when the Deck is sleeping.

Would also love this feature! Maybe like "Al dente" on macOS: You can set limit where it stops charging and it automatically sails between for example 80 and 75%.

Right now I have to watch how it's charged and set it to idle when reached desired limit. A % cap would be nice. Even when it only works while being on.

> I would be happy with a % cap that automatically sets charging to idle when reached, even if it doesn't work when the Deck is sleeping. Would also love this feature! Maybe like "Al dente" on macOS: You can set limit where it stops charging and it automatically sails between for example 80 and 75%. Right now I have to watch how it's charged and set it to idle when reached desired limit. A % cap would be nice. Even when it only works while being on.
NGnius commented 2023-03-26 15:55:37 +01:00 (Migrated from github.com)

I've added this in commit f42efab. This has the same limitations as mentioned earlier: this only works while the Steam Deck is awake. This roughly mimics the current Steam Deck behaviour of allowing discharging down to 10% below (e.g. if you set the limit to 50%, it'll start charging again when it hits 40%).

I've added this in commit [f42efab](https://github.com/NGnius/PowerTools/commit/f42efab0b005a1d389d9089d6d2cd1f7bfa27050). This has the same limitations as mentioned earlier: this only works while the Steam Deck is awake. This roughly mimics the current Steam Deck behaviour of allowing discharging down to 10% below (e.g. if you set the limit to 50%, it'll start charging again when it hits 40%).
milroneth commented 2023-03-26 17:00:20 +01:00 (Migrated from github.com)

This is great news, thank you so much. I will test it and come back with feedback if anything comes up.

This is great news, thank you so much. I will test it and come back with feedback if anything comes up.
restfuladi commented 2023-03-27 17:42:22 +01:00 (Migrated from github.com)

Fantastic, thank you!

Fantastic, thank you!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: NG-SD-Plugins/PowerTools#67
No description provided.