From fcd3ae650a244750448b203ea0468751eb530673 Mon Sep 17 00:00:00 2001 From: xenDE Date: Thu, 3 Oct 2019 18:46:46 +0200 Subject: [PATCH] =?UTF-8?q?eine=20configurierbare=20wartezeit=20hinzugef?= =?UTF-8?q?=C3=BCgt,=20bevor=20die=20werte=20aktualisiert=20werden?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit to protect the display lifetime --- .../scripts/pwnagotchi/plugins/default/memtemp.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/sdcard/rootfs/root/pwnagotchi/scripts/pwnagotchi/plugins/default/memtemp.py b/sdcard/rootfs/root/pwnagotchi/scripts/pwnagotchi/plugins/default/memtemp.py index 5ebc38c4..85a4552a 100644 --- a/sdcard/rootfs/root/pwnagotchi/scripts/pwnagotchi/plugins/default/memtemp.py +++ b/sdcard/rootfs/root/pwnagotchi/scripts/pwnagotchi/plugins/default/memtemp.py @@ -7,7 +7,7 @@ __version__ = '1.0.0' __name__ = 'memtemp' __license__ = 'GPL3' __description__ = 'A plugin that will add a memory and temperature indicator' -__enabled__ = False +__enabled__ = True import struct @@ -15,8 +15,16 @@ from pwnagotchi.ui.components import LabeledValue from pwnagotchi.ui.view import BLACK import pwnagotchi.ui.fonts as fonts +import time + class MEMTEMP: + + # set the minimum seconds before refresh the values + refresh_wait = 30 + + refresh_ts_last = time.time() - refresh_wait + def __init__(self): # only import when the module is loaded and enabled import os @@ -52,4 +60,7 @@ def on_ui_setup(ui): def on_ui_update(ui): - ui.set('memtemp', "%s %s" % (memtemp.get_mem_info(), memtemp.get_temp())) + if time.time() > memtemp.refresh_ts_last + memtemp.refresh_wait: + ui.set('memtemp', "%s %s" % (memtemp.get_mem_info(), memtemp.get_temp())) + memtemp.refresh_ts_last = time.time() +