From 1da59b50b4775670ba834ff1816d8d3e9d697e34 Mon Sep 17 00:00:00 2001
From: bensmith83 <bensmith83@gmail.com>
Date: Fri, 8 Nov 2019 19:50:33 -0500
Subject: [PATCH] Add Fahrenheit and Kelvin temperature scales to memtemp.py

---
 pwnagotchi/plugins/default/memtemp.py | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/pwnagotchi/plugins/default/memtemp.py b/pwnagotchi/plugins/default/memtemp.py
index 9ac2571..af4f271 100644
--- a/pwnagotchi/plugins/default/memtemp.py
+++ b/pwnagotchi/plugins/default/memtemp.py
@@ -58,10 +58,16 @@ class MemTemp(plugins.Plugin):
                                                    label_font=fonts.Small, text_font=fonts.Small))
 
     def on_ui_update(self, ui):
+        if self.options['scale'] == "fahrenheit":
+            temp = (pwnagotchi.temperature() * 9 / 5) + 32
+        elif self.options['scale'] == "celsius":
+            temp = pwnagotchi.temperature()
+        elif self.options['scale'] == "kelvin":
+            temp = pwnagotchi.temperature() + 273.15
         if self.options['orientation'] == "horizontal":
             ui.set('memtemp',
-                   " mem cpu temp\n %s%% %s%%  %sc" % (self.mem_usage(), self.cpu_load(), pwnagotchi.temperature()))
+                   " mem cpu temp\n %s%% %s%%  %sc" % (self.mem_usage(), self.cpu_load(), temp))
 
         elif self.options['orientation'] == "vertical":
             ui.set('memtemp',
-                   " mem:%s%%\n cpu:%s%%\ntemp:%sc" % (self.mem_usage(), self.cpu_load(), pwnagotchi.temperature()))
+                   " mem:%s%%\n cpu:%s%%\ntemp:%sc" % (self.mem_usage(), self.cpu_load(), temp))