Clean up battery.{h,cpp} header includes

pull/595/head
jackun 3 years ago
parent 866fd8bc24
commit c79e01830d
No known key found for this signature in database
GPG Key ID: 119DB3F1D05A9ED3

@ -1,9 +1,9 @@
#include <stdio.h>
#include "battery.h"
#include <filesystem.h>
#include <spdlog/spdlog.h>
#include <filesystem.h>
#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)) {

@ -1,10 +1,5 @@
#pragma once
#include "overlay.h"
#include "overlay_params.h"
#include <logging.h>
#include <vector>
#include <unordered_map>
#include <filesystem.h>
#include <string>
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;

Loading…
Cancel
Save