diff --git a/pwnagotchi/__init__.py b/pwnagotchi/__init__.py index ff434946..c343bb31 100644 --- a/pwnagotchi/__init__.py +++ b/pwnagotchi/__init__.py @@ -1,4 +1,8 @@ import subprocess +import os +import logging +import time +import pwnagotchi.ui.view as view version = '1.0.0a' @@ -46,3 +50,13 @@ def temperature(celsius=True): temp = int(fp.read().strip()) c = int(temp / 1000) return c if celsius else ((c * (9 / 5)) + 32) + + +def shutdown(): + logging.warning("shutting down ...") + if view.ROOT: + view.ROOT.on_shutdown() + # give it some time to refresh the ui + time.sleep(5) + os.system("sync") + os.system("halt") diff --git a/pwnagotchi/ui/display.py b/pwnagotchi/ui/display.py index 76e9a24d..ffefa18c 100644 --- a/pwnagotchi/ui/display.py +++ b/pwnagotchi/ui/display.py @@ -15,11 +15,29 @@ class VideoHandler(BaseHTTPRequestHandler): _lock = Lock() _index = """
-