VR-25 / acc

Advanced Charging Controller
https://github.com/Magisk-Modules-Repo/acc
GNU General Public License v3.0
1.74k stars 109 forks source link

FR: continue respecting rc when rt has value w/ r-postifx #233

Closed laur89 closed 8 months ago

laur89 commented 9 months ago

This ticket is to contain the work/discussion stemming from a telegram discussion.

As-is: If both rc (resume_capacity) and rt (resume_temp) with the r postfix are defined, then configured rc value becomes essentially no-op by temporarily defining rc to pc-1. This means charging will continue regardless of the value we set for rc in config.

To-be: Change the logic so that original/set value of rc continues to be respected. This means when cooldown has not been triggered, then battery should be allowed to discharge until the original rc value. Am not familiar with the implementation, so can't tell whether the pc-1 should be set only when cooldown kicks in during charging, or the whole logic requires a rework.

Reasoning: All this is to allow the battery to be discharged to our set rc value in non-idle mode. As it stands currently, battery would kept charged to pc.

Example: With configuration such as

acc -s pc=80 rc=60 cc=101 rt=32r ct=34 mt=36 st=50 cdc=1000
- for the uninitiated, cc of 101 is there to effectively disable the cooldown_capacity which defaults to 50

and plugging the charger in at 70% (with mild ambient temperature so cooldown doesn't kick in), one would expect the battery to be depleted until 60%. But as it stands, it'll start charging immediately, and keep the level between 79-80%.

VR-25 commented 9 months ago

Without the trailing r, acc requires two conditions to resume charging:

  1. Battery capacity <= rc
  2. Battery temp <= rt

With the trailing r, acc resumes charging when battery temp <= rt, regardless of rc. Additionally, if charging has been paused by cooldown, it resumes regadless of rt and rc, when the cooldown conditions allow it.

The suggested change effectively kills the need for r:

...only in case a charging cycle has been stopped due to reaching a mt-condition (maybe also if paused by the cp-phase of a cch/cp cycle) rc is changed to pc-1 but then - as soon as charging was restarted (by reaching rt or the cch-phase of a cch/cp cycle) rc as defined applies again.

VR-25 commented 8 months ago

This change was implemented.