This commit is contained in:
Thomas Farstrike
2026-03-18 11:56:31 +01:00
parent 4262bacc42
commit f85c8daea8
2 changed files with 10 additions and 15 deletions
@@ -9,10 +9,8 @@ class WebServerSettings(Activity):
action_button = None
action_label = None
settings_button = None
prefs = None
def onCreate(self):
self.prefs = SharedPreferences(WebServer.PREFS_NAMESPACE, defaults=WebServer.DEFAULTS)
self.ui_prefs = SharedPreferences(WebServer.PREFS_NAMESPACE)
screen = lv.obj()
screen.set_style_border_width(0, lv.PART.MAIN)
@@ -553,6 +553,13 @@ class WifiService:
"""
return WifiService.wifi_busy
@staticmethod
def _ensure_access_points_loaded():
if not WifiService.access_points:
WifiService.access_points = mpos.config.SharedPreferences(
"com.micropythonos.system.wifiservice"
).get_dict("access_points")
@staticmethod
def get_saved_networks():
"""
@@ -561,11 +568,7 @@ class WifiService:
Returns:
list: List of saved SSIDs
"""
if not WifiService.access_points:
WifiService.access_points = mpos.config.SharedPreferences(
"com.micropythonos.system.wifiservice"
).get_dict("access_points")
WifiService._ensure_access_points_loaded()
return list(WifiService.access_points.keys())
@staticmethod
@@ -662,10 +665,7 @@ class WifiService:
Returns:
str or None: Password if found, None otherwise
"""
if not WifiService.access_points:
WifiService.access_points = mpos.config.SharedPreferences(
"com.micropythonos.system.wifiservice"
).get_dict("access_points")
WifiService._ensure_access_points_loaded()
ap = WifiService.access_points.get(ssid)
if ap:
@@ -683,10 +683,7 @@ class WifiService:
Returns:
bool: True if network is hidden, False otherwise
"""
if not WifiService.access_points:
WifiService.access_points = mpos.config.SharedPreferences(
"com.micropythonos.system.wifiservice"
).get_dict("access_points")
WifiService._ensure_access_points_loaded()
ap = WifiService.access_points.get(ssid)
if ap: