feat: use new power1_input interface instead of average when it is available

This commit is contained in:
Ilya Zlobintsev
2023-11-15 21:58:21 +02:00
parent ca3292fd5b
commit 51e187ef2a
5 changed files with 11 additions and 4 deletions

View File

@@ -108,13 +108,18 @@ impl StatsFrame {
let PowerStats {
average: power_average,
current: power_current,
cap_current: power_cap_current,
..
} = stats.power;
let power_current = power_current
.filter(|value| *value != 0.0)
.or(power_average);
self.power_usage_label.set_markup(&format!(
"<b>{}/{}W</b>",
power_average.unwrap_or(0.0),
power_current.unwrap_or(0.0),
power_cap_current.unwrap_or(0.0)
));