Errors on any battery stopped display of all battery information
This commit is contained in:
parent
273f572a87
commit
67831ac97c
|
@ -91,6 +91,9 @@ func (b *BatteryWidget) update() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for i, battery := range batteries {
|
for i, battery := range batteries {
|
||||||
|
if battery.Full == 0.0 {
|
||||||
|
continue
|
||||||
|
}
|
||||||
id := makeID(i)
|
id := makeID(i)
|
||||||
perc := battery.Current / battery.Full
|
perc := battery.Current / battery.Full
|
||||||
percentFull := math.Abs(perc) * 100.0
|
percentFull := math.Abs(perc) * 100.0
|
||||||
|
|
|
@ -49,7 +49,6 @@ func (b *BatteryGauge) update() {
|
||||||
log.Printf("error setting up batteries: %v", err)
|
log.Printf("error setting up batteries: %v", err)
|
||||||
errLogged = true
|
errLogged = true
|
||||||
}
|
}
|
||||||
return
|
|
||||||
}
|
}
|
||||||
if len(bats) < 1 {
|
if len(bats) < 1 {
|
||||||
b.Label = fmt.Sprintf("N/A")
|
b.Label = fmt.Sprintf("N/A")
|
||||||
|
@ -60,6 +59,9 @@ func (b *BatteryGauge) update() {
|
||||||
charging := "%d%% ⚡%s"
|
charging := "%d%% ⚡%s"
|
||||||
rate := 0.0
|
rate := 0.0
|
||||||
for _, bat := range bats {
|
for _, bat := range bats {
|
||||||
|
if bat.Full == 0.0 {
|
||||||
|
continue
|
||||||
|
}
|
||||||
mx += bat.Full
|
mx += bat.Full
|
||||||
cu += bat.Current
|
cu += bat.Current
|
||||||
if rate < bat.ChargeRate {
|
if rate < bat.ChargeRate {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user