curious if locks are lagging

pull/36039/head
Shane Smiskol 2 days ago
parent 1efba50de0
commit 085dd185b0
  1. 6
      system/ui/widgets/network.py

@ -67,7 +67,6 @@ class WifiManagerUI(Widget):
self.wifi_manager.set_active(False) self.wifi_manager.set_active(False)
def _render(self, rect: rl.Rectangle): def _render(self, rect: rl.Rectangle):
with self._lock:
if not self._networks: if not self._networks:
gui_label(rect, "Scanning Wi-Fi networks...", 72, alignment=rl.GuiTextAlignment.TEXT_ALIGN_CENTER) gui_label(rect, "Scanning Wi-Fi networks...", 72, alignment=rl.GuiTextAlignment.TEXT_ALIGN_CENTER)
return return
@ -219,7 +218,6 @@ class WifiManagerUI(Widget):
def _on_network_updated(self, networks: list[Network]): def _on_network_updated(self, networks: list[Network]):
print('CALLBACK: _on_network_updated') print('CALLBACK: _on_network_updated')
# TODO: wifimanager has a nonblocking getter, we don't need to use callbacks nearly as much # TODO: wifimanager has a nonblocking getter, we don't need to use callbacks nearly as much
with self._lock:
t = time.monotonic() t = time.monotonic()
self._networks = networks self._networks = networks
for n in self._networks: for n in self._networks:
@ -231,7 +229,6 @@ class WifiManagerUI(Widget):
def _on_need_auth(self, ssid): def _on_need_auth(self, ssid):
print('CALLBACK: _on_need_auth') print('CALLBACK: _on_need_auth')
with self._lock:
network = next((n for n in self._networks if n.ssid == ssid), None) network = next((n for n in self._networks if n.ssid == ssid), None)
if network: if network:
self.state = UIState.NEEDS_AUTH self.state = UIState.NEEDS_AUTH
@ -240,19 +237,16 @@ class WifiManagerUI(Widget):
def _on_activated(self): def _on_activated(self):
print('CALLBACK: _on_activated') print('CALLBACK: _on_activated')
with self._lock:
if self.state == UIState.CONNECTING: if self.state == UIState.CONNECTING:
self.state = UIState.IDLE self.state = UIState.IDLE
def _on_forgotten(self, ssid): def _on_forgotten(self, ssid):
print('CALLBACK: _on_forgotten') print('CALLBACK: _on_forgotten')
with self._lock:
if self.state == UIState.FORGETTING: if self.state == UIState.FORGETTING:
self.state = UIState.IDLE self.state = UIState.IDLE
def _on_disconnected(self): def _on_disconnected(self):
print('CALLBACK: _on_disconnected') print('CALLBACK: _on_disconnected')
with self._lock:
if self.state == UIState.CONNECTING: if self.state == UIState.CONNECTING:
self.state = UIState.IDLE self.state = UIState.IDLE

Loading…
Cancel
Save