style: Refactor battery cycle count choosing

master
Kiri 2024-04-10 17:30:47 +02:00
parent 43511992d9
commit 7f1e623f77
No known key found for this signature in database
GPG Key ID: F1BEE619CFF29825
1 changed files with 5 additions and 2 deletions

View File

@ -361,10 +361,13 @@ const std::tuple<uint8_t, float, std::string, float, uint16_t> waybar::modules::
if (fs::exists(bat / "cycle_count")) {
std::ifstream(bat / "cycle_count") >> cycle_count;
}
if (is_main_battery && (cycle_count > main_bat_cycle_count)) {
if (is_main_battery) {
largest_design_capacity = charge_full_design;
if (cycle_count > main_bat_cycle_count) {
main_bat_cycle_count = cycle_count;
}
}
if (!voltage_now_exists) {
if (power_now_exists && current_now_exists && current_now != 0) {