summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathan Scott <nathans@redhat.com>2020-11-18 09:19:42 +1100
committerNathan Scott <nathans@redhat.com>2020-11-18 10:17:33 +1100
commit0eb3c7589d6cce7c1e6d78d0abd019362a69061f (patch)
treef363e9d384b71b4d33850aba0b1d7e2e8ba11cd4
parentea9622b8c9444d92007f24fc54597f83c498f11d (diff)
Merge individual Battery.[ch] files into Platform.[ch]
Small changes from review - keep headers sorted and keep local variable declarations at the top of source files.
-rw-r--r--BatteryMeter.c2
-rw-r--r--linux/Platform.c11
2 files changed, 6 insertions, 7 deletions
diff --git a/BatteryMeter.c b/BatteryMeter.c
index cd8439c4..bf2b6122 100644
--- a/BatteryMeter.c
+++ b/BatteryMeter.c
@@ -11,9 +11,9 @@ This meter written by Ian P. Hands (iphands@gmail.com, ihands@redhat.com).
#include <math.h>
-#include "Platform.h"
#include "CRT.h"
#include "Object.h"
+#include "Platform.h"
#include "XUtils.h"
diff --git a/linux/Platform.c b/linux/Platform.c
index f5baa24c..7c58d3a8 100644
--- a/linux/Platform.c
+++ b/linux/Platform.c
@@ -102,6 +102,11 @@ const SignalItem Platform_signals[] = {
const unsigned int Platform_numberOfSignals = ARRAYSIZE(Platform_signals);
+static enum { BAT_PROC, BAT_SYS, BAT_ERR } Platform_Battery_method = BAT_PROC;
+static time_t Platform_Battery_cacheTime;
+static double Platform_Battery_cacheLevel = NAN;
+static ACPresence Platform_Battery_cacheIsOnAC;
+
static Htop_Reaction Platform_actionSetIOPriority(State* st) {
Panel* panel = st->panel;
@@ -832,12 +837,6 @@ static void Platform_Battery_getSysData(double* level, ACPresence* isOnAC) {
*level = totalFull > 0 ? ((double) totalRemain * 100.0) / (double) totalFull : NAN;
}
-static enum { BAT_PROC, BAT_SYS, BAT_ERR } Platform_Battery_method = BAT_PROC;
-
-static time_t Platform_Battery_cacheTime;
-static double Platform_Battery_cacheLevel = NAN;
-static ACPresence Platform_Battery_cacheIsOnAC;
-
void Platform_getBattery(double* level, ACPresence* isOnAC) {
time_t now = time(NULL);
// update battery reading is slow. Update it each 10 seconds only.

© 2014-2024 Faster IT GmbH | imprint | privacy policy