diff --git a/README.md b/README.md index 242f5f0..66d2d32 100644 --- a/README.md +++ b/README.md @@ -317,7 +317,7 @@ tempLevel=0 # cooldownRatio=(cooldown_charge cooldown_pause) SECONDS,NULLABLE -# cooldownCustom=cooldown_custom=(FILE RAW_VALUE CHARGE_SECONDS PAUSE_SECONDS) NULLABLE +# cooldownCustom=cooldown_custom=(FILE THRESHOLD CHARGE_SECONDS PAUSE_SECONDS) NULLABLE # cooldownCurrent=cooldown_current=MILLIAMPS NULLABLE @@ -987,7 +987,7 @@ Most of the lines are either unnecessary (e.g., type: everyone knows that alread Here's what one should focus on: -BATT_HEALTH=92.00% # Estimated battery health, based on data provided by the kernel (not available on all systems) +HEALTH=Good # Battery health CAPACITY=50 # Battery level, 0-100 CURRENT_NOW=0 # Charging current (Amps) POWER_NOW=0 # (CURRENT_NOW * VOLTAGE_NOW) (Watts) diff --git a/install/accd.sh b/install/accd.sh index 4791e59..264d916 100644 --- a/install/accd.sh +++ b/install/accd.sh @@ -252,23 +252,26 @@ if ! $init; then fi # cooldown cycle - while [ -n "${cooldownRatio[0]-}${cooldownCustom[0]-}" ] \ + while [ -n "${cooldownCurrent-}${cooldownRatio[0]-}${cooldownCustom[0]-}" ] \ && _lt_pause_cap && is_charging do + $[ $(sed s/-// ${cooldownCustom[0]:-cooldownCustom} 2>/dev/null || echo 0) -ge ${cooldownCustom[1]:-1} ] \ + && cooldownCustom_=true \ + || cooldownCustom_=false if [ $(cat $temp) -ge $(( ${temperature[0]} * 10 )) ] \ || _ge_cooldown_cap \ - || [ $(sed s/-// ${cooldownCustom[0]:-cooldownCustom} 2>/dev/null || echo 0) -ge ${cooldownCustom[1]:-1} ] + || $cooldownCustom_ then cooldown=true if [ -n "${cooldownCurrent-}" ] && grep -q / $TMPDIR/ch-curr-ctrl-files 2>/dev/null; then # cooldown by limiting current maxChargingCurrent0=${maxChargingCurrent[0]-} set_ch_curr ${cooldownCurrent:-500} || : - sleep ${cooldownRatio[1]:-1} + sleep ${cooldownRatio[1]:-${loopDelay[1]}} [ ${cooldownRatio[0]:-0} -eq 0 ] || { set_ch_curr ${maxChargingCurrent0:--} || : count=0 - while [ $count -lt ${cooldownRatio[0]:-1} ]; do + while [ $count -lt ${cooldownRatio[0]:-${loopDelay[0]}} ]; do sleep ${loopDelay[0]} _lt_pause_cap && count=$(( count + ${loopDelay[0]} )) || break done @@ -277,19 +280,15 @@ if ! $init; then # regular cooldown cmd_batt set status $chgStatusCode disable_charging - [ $(sed s/-// ${cooldownCustom[0]:-cooldownCustom} 2>/dev/null || echo 0) -ge ${cooldownCustom[1]:-1} ] \ - && sleep ${cooldownCustom[3]:-1} \ - || sleep ${cooldownRatio[1]:-1} + $cooldownCustom_ && sleep ${cooldownCustom[3]:-${loopDelay[1]}} \ + || sleep ${cooldownRatio[1]:-${loopDelay[1]}} enable_charging $capacitySync || cmd_batt reset - [ ! $(sed s/-// ${cooldownCustom[0]:-cooldownCustom} 2>/dev/null || echo 0) -ge ${cooldownCustom[1]:-1} ] \ - || cooldownRatio[0]=${cooldownCustom[2]-} + ! $cooldownCustom_ || cooldownRatio[0]=${cooldownCustom[2]:-${loopDelay[0]}} count=0 - while ! not_charging && [ $count -lt ${cooldownRatio[0]:-1} ]; do + while [ $count -lt ${cooldownRatio[0]:-${loopDelay[0]}} ]; do sleep ${loopDelay[0]} - _lt_pause_cap \ - && count=$(( count + ${loopDelay[0]} )) \ - || break + _lt_pause_cap && count=$(( count + ${loopDelay[0]} )) || break done fi else diff --git a/install/default-config.txt b/install/default-config.txt index 7dc1922..9b0bd2e 100644 --- a/install/default-config.txt +++ b/install/default-config.txt @@ -78,7 +78,7 @@ tempLevel=0 # cooldownRatio=(cooldown_charge cooldown_pause) SECONDS,NULLABLE -# cooldownCustom=cooldown_custom=(FILE RAW_VALUE CHARGE_SECONDS PAUSE_SECONDS) NULLABLE +# cooldownCustom=cooldown_custom=(FILE THRESHOLD CHARGE_SECONDS PAUSE_SECONDS) NULLABLE # cooldownCurrent=cooldown_current=MILLIAMPS NULLABLE