Merge pull request #316 from spees/master
Minor fixes to the UI to prevent overlap
This commit is contained in:
commit
e992834b37
pwnagotchi
@ -74,6 +74,8 @@ main:
|
|||||||
netmask: 24
|
netmask: 24
|
||||||
interval: 1 # check every x minutes for device
|
interval: 1 # check every x minutes for device
|
||||||
share_internet: false
|
share_internet: false
|
||||||
|
memtemp: # Display memory usage and cpu temperature on screen
|
||||||
|
enabled: false
|
||||||
# monitor interface to use
|
# monitor interface to use
|
||||||
iface: mon0
|
iface: mon0
|
||||||
# command to run to bring the mon interface up in case it's not up already
|
# command to run to bring the mon interface up in case it's not up already
|
||||||
|
@ -491,5 +491,5 @@ def on_ui_update(ui):
|
|||||||
|
|
||||||
|
|
||||||
def on_ui_setup(ui):
|
def on_ui_setup(ui):
|
||||||
ui.add_element('bluetooth', LabeledValue(color=BLACK, label='BT', value='-', position=(ui.width() / 2 - 30, 0),
|
ui.add_element('bluetooth', LabeledValue(color=BLACK, label='BT', value='-', position=(ui.width() / 2 - 15, 0),
|
||||||
label_font=fonts.Bold, text_font=fonts.Medium))
|
label_font=fonts.Bold, text_font=fonts.Medium))
|
||||||
|
@ -2,8 +2,19 @@
|
|||||||
#
|
#
|
||||||
# totalmem usedmem freemem cputemp
|
# totalmem usedmem freemem cputemp
|
||||||
#
|
#
|
||||||
|
###############################################################
|
||||||
|
#
|
||||||
|
# Updated 18-10-2019 by spees <speeskonijn@gmail.com>
|
||||||
|
# - Changed the place where the data was displayed on screen
|
||||||
|
# - Made the data a bit more compact and easier to read
|
||||||
|
# - removed the label so we wont waste screen space
|
||||||
|
# - Updated version to 1.0.1
|
||||||
|
#
|
||||||
|
###############################################################
|
||||||
|
|
||||||
|
|
||||||
__author__ = 'https://github.com/xenDE'
|
__author__ = 'https://github.com/xenDE'
|
||||||
__version__ = '1.0.0'
|
__version__ = '1.0.1'
|
||||||
__name__ = 'memtemp'
|
__name__ = 'memtemp'
|
||||||
__license__ = 'GPL3'
|
__license__ = 'GPL3'
|
||||||
__description__ = 'A plugin that will add a memory and temperature indicator'
|
__description__ = 'A plugin that will add a memory and temperature indicator'
|
||||||
@ -21,9 +32,9 @@ class MEMTEMP:
|
|||||||
|
|
||||||
# set the minimum seconds before refresh the values
|
# set the minimum seconds before refresh the values
|
||||||
refresh_wait = 30
|
refresh_wait = 30
|
||||||
|
|
||||||
refresh_ts_last = time.time() - refresh_wait
|
refresh_ts_last = time.time() - refresh_wait
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
# only import when the module is loaded and enabled
|
# only import when the module is loaded and enabled
|
||||||
import os
|
import os
|
||||||
@ -31,9 +42,9 @@ class MEMTEMP:
|
|||||||
def get_temp(self):
|
def get_temp(self):
|
||||||
try:
|
try:
|
||||||
temp = os.popen('/opt/vc/bin/vcgencmd measure_temp').readlines()[0].split('=')[1].replace("\n", '').replace("'","")
|
temp = os.popen('/opt/vc/bin/vcgencmd measure_temp').readlines()[0].split('=')[1].replace("\n", '').replace("'","")
|
||||||
return 'cpu:' + temp
|
return 't:' + temp
|
||||||
except:
|
except:
|
||||||
return 'cpu:0.0C'
|
return 't:-'
|
||||||
# cpu:37.4C
|
# cpu:37.4C
|
||||||
|
|
||||||
def get_mem_info(self):
|
def get_mem_info(self):
|
||||||
@ -42,9 +53,9 @@ class MEMTEMP:
|
|||||||
# total, used, free = map(int, os.popen('free -t -m').readlines()[-1].split()[1:])
|
# total, used, free = map(int, os.popen('free -t -m').readlines()[-1].split()[1:])
|
||||||
# without Swap, only real memory:
|
# without Swap, only real memory:
|
||||||
total, used, free = map(int, os.popen('free -t -m').readlines()[-3].split()[1:4])
|
total, used, free = map(int, os.popen('free -t -m').readlines()[-3].split()[1:4])
|
||||||
return "tm:"+str(total)+" um:"+str(used)+" fm:"+str(free)
|
return "\nT:"+str(total)+"M U:"+str(used)+"M\nF:"+str(free)+"M"
|
||||||
except:
|
except:
|
||||||
return "tm:0 um:0 fm:0"
|
return "\nT:- U:-\nF:- "
|
||||||
# tm:532 um:82 fm:353
|
# tm:532 um:82 fm:353
|
||||||
|
|
||||||
|
|
||||||
@ -57,7 +68,7 @@ def on_loaded():
|
|||||||
|
|
||||||
|
|
||||||
def on_ui_setup(ui):
|
def on_ui_setup(ui):
|
||||||
ui.add_element('memtemp', LabeledValue(color=BLACK, label='SYS', value='tm:0 um:0 fm:0 0.0C', position=(0, ui.height()-28),
|
ui.add_element('memtemp', LabeledValue(color=BLACK, label='', value='\nT:- U:-\nF:- -', position=(ui.width() / 2 + 17, ui.height() / 2),
|
||||||
label_font=fonts.Bold, text_font=fonts.Medium))
|
label_font=fonts.Bold, text_font=fonts.Medium))
|
||||||
|
|
||||||
|
|
||||||
@ -66,3 +77,4 @@ def on_ui_update(ui):
|
|||||||
ui.set('memtemp', "%s %s" % (memtemp.get_mem_info(), memtemp.get_temp()))
|
ui.set('memtemp', "%s %s" % (memtemp.get_mem_info(), memtemp.get_temp()))
|
||||||
memtemp.refresh_ts_last = time.time()
|
memtemp.refresh_ts_last = time.time()
|
||||||
|
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ class Inky(DisplayImpl):
|
|||||||
self._layout['face'] = (0, 37)
|
self._layout['face'] = (0, 37)
|
||||||
self._layout['name'] = (5, 18)
|
self._layout['name'] = (5, 18)
|
||||||
self._layout['channel'] = (0, 0)
|
self._layout['channel'] = (0, 0)
|
||||||
self._layout['aps'] = (25, 0)
|
self._layout['aps'] = (30, 0)
|
||||||
self._layout['uptime'] = (147, 0)
|
self._layout['uptime'] = (147, 0)
|
||||||
self._layout['line1'] = [0, 12, 212, 12]
|
self._layout['line1'] = [0, 12, 212, 12]
|
||||||
self._layout['line2'] = [0, 92, 212, 92]
|
self._layout['line2'] = [0, 92, 212, 92]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user