You've already forked MicroPythonOS
mirror of
https://github.com/m5stack/MicroPythonOS.git
synced 2026-05-20 11:51:27 -07:00
Cleanups
This commit is contained in:
-2
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user