I wrote a script, to set charge level to 40% after reaching 70%, and vice versa
ectool=<path-to-ectool>
charging=1
${ectool} fwchargelimit 70
while sleep 15 ; do
battperc=$(${ectool} chargestate show | grep batt_state_of_charge | awk '{print $3}' | tr -d '%')
if [ -z "${battperc}" ] ; then
battperc=0
fi
if (( charging == 1 && battperc >=70 )) ; then
${ectool} fwchargelimit 40
charging=0
elif (( battperc <= 40 )) ; then
${ectool} fwchargelimit 70
charging=1
fi
done
But running into another problem, if fwchargelimit is lower than current battery SoC, FW13 AMD will stop drawing current from PD, and force discharge the battery.
you can manipulate the “chargecurrentlimit” parameter. set this to 0 or 1 means 0mA or 1mA charging current to the battery when it reaches 70% but not reduced to 40%, when the battery discharged to 40% set “chargecurrentlimit” to 99999 to revert settings (charging speed capped by the battery not BIOS)
Yet another issue: my script is running, waiting for SoC to reach 70%, but somehow the charging limit is reset to 65%, which is the value in my cmos setup.