diff --git a/src/battery.cpp b/src/battery.cpp index 65fe93dd..c86c644c 100644 --- a/src/battery.cpp +++ b/src/battery.cpp @@ -1,9 +1,9 @@ -#include -#include "battery.h" -#include #include +#include +#include "battery.h" namespace fs = ghc::filesystem; +using namespace std; void BatteryStats::numBattery() { int batteryCount = 0; @@ -22,19 +22,18 @@ void BatteryStats::numBattery() { batt_check = true; } - void BatteryStats::update() { if (!batt_check) { numBattery(); if (batt_count == 0) { - SPDLOG_ERROR("No battery found"); + SPDLOG_INFO("No battery found"); } } if (batt_count > 0) { - current_watt = getPower(); - current_percent = getPercent(); - } + current_watt = getPower(); + current_percent = getPercent(); + } } float BatteryStats::getPercent() @@ -59,7 +58,6 @@ float BatteryStats::getPercent() if(std::getline(input2, line)) { charge_f += (stof(line) / 1000000); } - } else if (fs::exists(energy_now)) { @@ -72,7 +70,6 @@ float BatteryStats::getPercent() if(std::getline(input2, line)) { charge_f += (stof(line) / 1000000); } - } else { @@ -107,7 +104,7 @@ float BatteryStats::getPower() { } if (state[i] == "Charging" || state[i] == "Unknown") { - return 0; + return 0; } if (fs::exists(current_power)) { diff --git a/src/battery.h b/src/battery.h index dcf24fd4..d087dcff 100644 --- a/src/battery.h +++ b/src/battery.h @@ -1,10 +1,5 @@ #pragma once -#include "overlay.h" -#include "overlay_params.h" -#include -#include -#include -#include +#include class BatteryStats{ public: @@ -12,11 +7,11 @@ class BatteryStats{ void update(); float getPower(); float getPercent(); - string battPath[2]; + std::string battPath[2]; float current_watt = 0; float current_percent = 0; - string current_status=""; - string state [2]; + std::string current_status; + std::string state [2]; int batt_count=0; bool batt_check = false;