Skip to content

Commit f85c8da

Browse files
Cleanups
1 parent 4262bac commit f85c8da

2 files changed

Lines changed: 10 additions & 15 deletions

File tree

internal_filesystem/builtin/apps/com.micropythonos.webserver/assets/webserver_settings.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,8 @@ class WebServerSettings(Activity):
99
action_button = None
1010
action_label = None
1111
settings_button = None
12-
prefs = None
1312

1413
def onCreate(self):
15-
self.prefs = SharedPreferences(WebServer.PREFS_NAMESPACE, defaults=WebServer.DEFAULTS)
1614
self.ui_prefs = SharedPreferences(WebServer.PREFS_NAMESPACE)
1715
screen = lv.obj()
1816
screen.set_style_border_width(0, lv.PART.MAIN)

internal_filesystem/lib/mpos/net/wifi_service.py

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -553,6 +553,13 @@ def is_busy():
553553
"""
554554
return WifiService.wifi_busy
555555

556+
@staticmethod
557+
def _ensure_access_points_loaded():
558+
if not WifiService.access_points:
559+
WifiService.access_points = mpos.config.SharedPreferences(
560+
"com.micropythonos.system.wifiservice"
561+
).get_dict("access_points")
562+
556563
@staticmethod
557564
def get_saved_networks():
558565
"""
@@ -561,11 +568,7 @@ def get_saved_networks():
561568
Returns:
562569
list: List of saved SSIDs
563570
"""
564-
if not WifiService.access_points:
565-
WifiService.access_points = mpos.config.SharedPreferences(
566-
"com.micropythonos.system.wifiservice"
567-
).get_dict("access_points")
568-
571+
WifiService._ensure_access_points_loaded()
569572
return list(WifiService.access_points.keys())
570573

571574
@staticmethod
@@ -662,10 +665,7 @@ def get_network_password(ssid):
662665
Returns:
663666
str or None: Password if found, None otherwise
664667
"""
665-
if not WifiService.access_points:
666-
WifiService.access_points = mpos.config.SharedPreferences(
667-
"com.micropythonos.system.wifiservice"
668-
).get_dict("access_points")
668+
WifiService._ensure_access_points_loaded()
669669

670670
ap = WifiService.access_points.get(ssid)
671671
if ap:
@@ -683,10 +683,7 @@ def get_network_hidden(ssid):
683683
Returns:
684684
bool: True if network is hidden, False otherwise
685685
"""
686-
if not WifiService.access_points:
687-
WifiService.access_points = mpos.config.SharedPreferences(
688-
"com.micropythonos.system.wifiservice"
689-
).get_dict("access_points")
686+
WifiService._ensure_access_points_loaded()
690687

691688
ap = WifiService.access_points.get(ssid)
692689
if ap:

0 commit comments

Comments
 (0)