new: added clean shutdown button to the web ui (closes #161)

This commit is contained in:
Simone Margaritelli
2019-10-07 19:42:29 +02:00
parent 0577972867
commit 4f694ddb83
4 changed files with 58 additions and 4 deletions

View File

@ -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")