@@ -19,66 +19,66 @@ if ! $init; then
19
19
20
20
21
21
_ge_cooldown_cap () {
22
- if t ${capacity[1]} -gt 3000; then
23
- t $( volt_now) -ge ${capacity[1]}
22
+ if [ ${capacity[1]} -gt 3000 ] ; then
23
+ [ $( volt_now) -ge ${capacity[1]} ]
24
24
else
25
- t $( cat $battCapacity ) -ge ${capacity[1]}
25
+ [ $( cat $battCapacity ) -ge ${capacity[1]} ]
26
26
fi
27
27
}
28
28
29
29
30
30
_ge_pause_cap () {
31
- if t ${capacity[3]} -gt 3000; then
32
- t $( volt_now) -ge ${capacity[3]}
31
+ if [ ${capacity[3]} -gt 3000 ] ; then
32
+ [ $( volt_now) -ge ${capacity[3]} ]
33
33
else
34
- t $( cat $battCapacity ) -ge ${capacity[3]}
34
+ [ $( cat $battCapacity ) -ge ${capacity[3]} ]
35
35
fi
36
36
}
37
37
38
38
39
39
_le_pause_cap () {
40
- if t ${capacity[3]} -gt 3000; then
41
- t $( volt_now) -le ${capacity[3]}
40
+ if [ ${capacity[3]} -gt 3000 ] ; then
41
+ [ $( volt_now) -le ${capacity[3]} ]
42
42
else
43
- t $( cat $battCapacity ) -le ${capacity[3]}
43
+ [ $( cat $battCapacity ) -le ${capacity[3]} ]
44
44
fi
45
45
}
46
46
47
47
48
48
_lt_pause_cap () {
49
- if t ${capacity[3]} -gt 3000; then
50
- t $( volt_now) -lt ${capacity[3]}
49
+ if [ ${capacity[3]} -gt 3000 ] ; then
50
+ [ $( volt_now) -lt ${capacity[3]} ]
51
51
else
52
- t $( cat $battCapacity ) -lt ${capacity[3]}
52
+ [ $( cat $battCapacity ) -lt ${capacity[3]} ]
53
53
fi
54
54
}
55
55
56
56
57
57
_gt_resume_cap () {
58
- if t ${capacity[2]} -gt 3000; then
59
- t $( volt_now) -gt ${capacity[2]}
58
+ if [ ${capacity[2]} -gt 3000 ] ; then
59
+ [ $( volt_now) -gt ${capacity[2]} ]
60
60
else
61
- t $( cat $battCapacity ) -gt ${capacity[2]}
61
+ [ $( cat $battCapacity ) -gt ${capacity[2]} ]
62
62
fi
63
63
}
64
64
65
65
66
66
_le_resume_cap () {
67
67
if $mtReached && _lt_pause_cap; then
68
68
return 0
69
- elif t ${capacity[2]} -gt 3000; then
70
- t $( volt_now) -le ${capacity[2]}
69
+ elif [ ${capacity[2]} -gt 3000 ] ; then
70
+ [ $( volt_now) -le ${capacity[2]} ]
71
71
else
72
- t $( cat $battCapacity ) -le ${capacity[2]}
72
+ [ $( cat $battCapacity ) -le ${capacity[2]} ]
73
73
fi
74
74
}
75
75
76
76
77
77
_le_shutdown_cap () {
78
- if t ${capacity[0]} -gt 3000; then
79
- t $( volt_now) -le ${capacity[0]}
78
+ if [ ${capacity[0]} -gt 3000 ] ; then
79
+ [ $( volt_now) -le ${capacity[0]} ]
80
80
else
81
- t $( cat $battCapacity ) -le ${capacity[0]}
81
+ [ $( cat $battCapacity ) -le ${capacity[0]} ]
82
82
fi
83
83
}
84
84
@@ -112,7 +112,7 @@ if ! $init; then
112
112
apply_on_plug default
113
113
tempLevel=0
114
114
enable_charging
115
- if tt " $exitCode " " [127]" ; then
115
+ if [[ " $exitCode " = [127] ]] ; then
116
116
. $execDir /logf.sh
117
117
logf --export
118
118
notif " ⚠️ Daemon stopped with exit code $exitCode ! Run \" acc -l tail\" to see the last 10 lines of the log file."
@@ -137,15 +137,15 @@ if ! $init; then
137
137
else
138
138
isCharging=true
139
139
# [auto mode] change the charging switch if charging has not been enabled by acc (if behavior repeats 3 times)
140
- if $chDisabledByAcc && [ -n " ${chargingSwitch[0]-} " ] && ! tt " ${chargingSwitch[*]} " " *-- " \
140
+ if $chDisabledByAcc && [ -n " ${chargingSwitch[0]-} " ] && [[ " ${chargingSwitch[*]} " != * \ -- ]] \
141
141
&& sleep ${loopDelay[1]} && { ! not_charging || { isCharging=false; false ; }; }
142
142
then
143
143
if [ $unsolicitedResumes -ge 3 ]; then
144
144
if grep -q " ^${chargingSwitch[*]} $" $TMPDIR /ch-switches; then
145
145
sed -i " \|^${chargingSwitch[*]} $|d" $TMPDIR /ch-switches
146
146
echo " ${chargingSwitch[*]} " >> $TMPDIR /ch-switches
147
147
fi
148
- $TMPDIR /acca --set charging_switch=
148
+ $TMPDIR /acca $config --set charging_switch=
149
149
chargingSwitch=()
150
150
unsolicitedResumes=0
151
151
else
@@ -185,10 +185,10 @@ if ! $init; then
185
185
if [ -f $TMPDIR /.ch-curr-read ]; then
186
186
# set charging current control files, as needed
187
187
if [ -n " ${maxChargingCurrent[0]-} " ] \
188
- && { [ -z " ${maxChargingCurrent[1]-} " ] || tt " ${maxChargingCurrent[1]-} " " -* " ; } \
188
+ && { [ -z " ${maxChargingCurrent[1]-} " ] || [[ " ${maxChargingCurrent[1]-} " = - * ]] ; } \
189
189
&& grep -q / $TMPDIR /ch-curr-ctrl-files 2> /dev/null
190
190
then
191
- $TMPDIR /acca --set max_charging_current=${maxChargingCurrent[0]}
191
+ $TMPDIR /acca $config --set max_charging_current=${maxChargingCurrent[0]}
192
192
fi
193
193
else
194
194
# parse charging current ctrl files
@@ -197,10 +197,10 @@ if ! $init; then
197
197
198
198
# set charging voltage control files, as needed
199
199
if [ -n " ${maxChargingVoltage[0]-} " ] \
200
- && { [ -z " ${maxChargingVoltage[1]-} " ] || tt " ${maxChargingVoltage [1]-} " " -* " ; } \
200
+ && { [ -z " ${maxChargingVoltage[1]-} " ] || [[ " ${maxChargingCurrent [1]-} " = - * ]] ; } \
201
201
&& grep -q / $TMPDIR /ch-volt-ctrl-files 2> /dev/null
202
202
then
203
- $TMPDIR /acca --set max_charging_voltage=${maxChargingVoltage[0]}
203
+ $TMPDIR /acca $config --set max_charging_voltage=${maxChargingVoltage[0]}
204
204
fi
205
205
206
206
$cooldown || {
@@ -369,12 +369,12 @@ if ! $init; then
369
369
if [ ${capacity[0]} -ge 1 ]; then
370
370
# warnings
371
371
! $shutdownWarnings || {
372
- if t ${capacity[0]} -gt 3000; then
373
- ! t $( grep -o ' ^..' $voltNow ) -eq $(( ${capacity[0]% ??} + 1 )) \
372
+ if [ ${capacity[0]} -gt 3000 ] ; then
373
+ ! [ $( grep -o ' ^..' $voltNow ) -eq $(( ${capacity[0]% ??} + 1 )) ] \
374
374
|| ! notif " ⚠️ WARNING: ~100mV to auto shutdown, plug the charger!" \
375
375
|| sleep ${loopDelay[1]}
376
376
else
377
- ! t $( cat $battCapacity ) -eq $(( ${capacity[0]} + 5 )) \
377
+ ! [ $( cat $battCapacity ) -eq $(( ${capacity[0]} + 5 )) ] \
378
378
|| ! notif " ⚠️ WARNING: 5% to auto shutdown, plug the charger!" \
379
379
|| sleep ${loopDelay[1]}
380
380
fi
@@ -419,7 +419,7 @@ if ! $init; then
419
419
local curr=
420
420
. $config
421
421
while [ -z " ${dischargePolarity-} " ] && [ $currFile != $TMPDIR /.dummy-curr ] && $battStatusWorkaround ; do
422
- cmd=" $TMPDIR /acca --set discharge_polarity="
422
+ cmd=" $TMPDIR /acca $config --set discharge_polarity="
423
423
curr=$( cat $currFile )
424
424
if online; then
425
425
if [ $( cat $battStatus ) = Charging ] && [ ${curr# -} -gt $idleThreshold ]; then
0 commit comments