Signed-off-by: Jeroen Oudshoorn <oudshoorn.jeroen@gmail.com>
This commit is contained in:
Jeroen Oudshoorn
2023-09-15 13:35:29 +02:00
parent f1feedad72
commit 078b8b6374
5 changed files with 135 additions and 127 deletions

View File

@ -46,6 +46,7 @@ class BluetoothSniffer(plugins.Plugin):
self.data = json.load(f)
def on_ui_setup(self, ui):
with ui._lock:
ui.add_element('BtS', LabeledValue(color=BLACK,
label='BT SNFD',
value=" ",
@ -59,6 +60,7 @@ class BluetoothSniffer(plugins.Plugin):
ui.remove_element('BtS')
def on_ui_update(self, ui):
with ui._lock:
current_time = time.time()
# Checking the time elapsed since last scan
if current_time - self.last_scan_time >= self.options['timer']:

View File

@ -583,4 +583,5 @@ class BTTether(plugins.Plugin):
label_font=fonts.Bold, text_font=fonts.Medium))
def on_ui_update(self, ui):
with ui._lock:
ui.set('bluetooth', self.status)

View File

@ -378,6 +378,7 @@ class FixServices(plugins.Plugin):
# called to setup the ui elements
def on_ui_setup(self, ui):
with ui._lock:
# add custom UI elements
if "position" in self.options:
pos = self.options['position'].split(',')
@ -389,8 +390,8 @@ class FixServices(plugins.Plugin):
ui.add_element('brcmfmac_status', Text(color=BLACK, value='--', position=pos, font=fonts.Small))
# called when the ui is updated
def on_ui_update(self, ui):
with ui._lock:
# update those elements
if self._status:
ui.set('brcmfmac_status', "wlan0mon %s" % self._status)
@ -398,6 +399,7 @@ class FixServices(plugins.Plugin):
ui.set('brcmfmac_status', "rst#%s" % self._count)
def on_unload(self, ui):
with ui._lock:
try:
ui.remove_element('brcmfmac_status')
logging.info("[Fix_Services] unloaded")

View File

@ -151,6 +151,7 @@ class GPS(plugins.Plugin):
ui.remove_element('altitude')
def on_ui_update(self, ui):
with ui._lock:
if self.coordinates and all([
# avoid 0.000... measurements
self.coordinates["Latitude"], self.coordinates["Longitude"]

View File

@ -103,6 +103,7 @@ class MemTemp(plugins.Plugin):
return " " * (self.FIELD_WIDTH - len(data)) + data
def on_ui_setup(self, ui):
with ui._lock:
try:
# Configure field list
self.fields = self.options['fields'].split(',')
@ -199,6 +200,7 @@ class MemTemp(plugins.Plugin):
ui.remove_element('memtemp_data')
def on_ui_update(self, ui):
with ui._lock:
if self.options['orientation'] == "vertical":
for idx, field in enumerate(self.fields):
ui.set(f"memtemp_{field}", getattr(self, self.ALLOWED_FIELDS[field])())