From b13243466b985052d8b206136852eb9a105b21ae Mon Sep 17 00:00:00 2001 From: Jeroen Oudshoorn Date: Sun, 29 Dec 2024 17:02:55 +0100 Subject: [PATCH] Removed calculation for Fahrenheit, just set celsius to False. Signed-off-by: Jeroen Oudshoorn --- pwnagotchi/plugins/default/memtemp.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/pwnagotchi/plugins/default/memtemp.py b/pwnagotchi/plugins/default/memtemp.py index 985ead20..f6b1cdff 100644 --- a/pwnagotchi/plugins/default/memtemp.py +++ b/pwnagotchi/plugins/default/memtemp.py @@ -49,6 +49,8 @@ class MemTemp(plugins.Plugin): LINE_SPACING = 10 LABEL_SPACING = 0 FIELD_WIDTH = 4 + def __init__(self): + self.options = dict() def on_loaded(self): self._last_cpu_load = self._cpu_stat() @@ -62,7 +64,7 @@ class MemTemp(plugins.Plugin): def _cpu_stat(self): """ - Returns the splitted first line of the /proc/stat file + Returns the split first line of the /proc/stat file """ with open('/proc/stat', 'rt') as fp: return list(map(int,fp.readline().split()[1:])) @@ -84,15 +86,15 @@ class MemTemp(plugins.Plugin): def cpu_temp(self): if self.options['scale'] == "fahrenheit": - temp = (pwnagotchi.temperature() * 9 / 5) + 32 - symbol = "f" + temp = (pwnagotchi.temperature(celsius=False)) + symbol = "F" elif self.options['scale'] == "kelvin": temp = pwnagotchi.temperature() + 273.15 - symbol = "k" + symbol = "K" else: # default to celsius temp = pwnagotchi.temperature() - symbol = "c" + symbol = "C" return f"{temp}{symbol}" def cpu_freq(self):