Skip to content

Commit 23355a1

Browse files
Move auto_connect.py to WifiService.py
1 parent 8fe4971 commit 23355a1

File tree

2 files changed

+7
-14
lines changed

2 files changed

+7
-14
lines changed

internal_filesystem/builtin/apps/com.micropythonos.wifi/assets/auto_connect.py renamed to internal_filesystem/builtin/system/WifiService.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import network
66
except Exception as e:
77
have_network=False
8-
print("auto_connect.py could not import network, have_network=False")
8+
print("Could not import network, have_network=False")
99

1010
import ujson
1111
import os

internal_filesystem/lib/mpos/apps.py

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -205,21 +205,14 @@ def parse_manifest(manifest_path):
205205

206206

207207
def auto_connect():
208-
# A generic "start at boot" mechanism hasn't been implemented yet, so do it like this:
209-
custom_auto_connect = "apps/com.example.wificonf/assets/auto_connect.py"
210-
builtin_auto_connect = "builtin/apps/com.example.wificonf/assets/auto_connect.py"
211-
# Maybe start_app_by_name() and start_app_by_name() could be merged so the try-except logic is not duplicated...
208+
builtin_auto_connect = "builtin/system/WifiService.py"
212209
try:
213-
stat = uos.stat(custom_auto_connect)
214-
execute_script_new_thread(custom_auto_connect, True)
210+
print(f"Starting {builtin_auto_connect}...")
211+
stat = uos.stat(builtin_auto_connect)
212+
execute_script_new_thread(builtin_auto_connect, True)
215213
except Exception as e:
216-
try:
217-
print(f"Couldn't execute {custom_auto_connect} because exception {e}, trying {builtin_auto_connect}...")
218-
stat = uos.stat(builtin_auto_connect)
219-
execute_script_new_thread(builtin_auto_connect, True)
220-
except Exception as e:
221-
print("Couldn't execute {builtin_auto_connect} because exception {e}, continuing...")
222-
214+
print("Couldn't execute {builtin_auto_connect} because exception {e}, continuing...")
215+
223216

224217
class Activity:
225218

0 commit comments

Comments
 (0)