From 9d468f04148d3405cce507e555eedf48caaf8350 Mon Sep 17 00:00:00 2001 From: = <=> Date: Sun, 11 Oct 2026 18:48:44 +1000 Subject: [PATCH] Updates for fixed AP detect --- examples/src/micropython-webserver/main.py | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/examples/src/micropython-webserver/main.py b/examples/src/micropython-webserver/main.py index c3499e5..131a339 100755 --- a/examples/src/micropython-webserver/main.py +++ b/examples/src/micropython-webserver/main.py @@ -131,9 +131,9 @@ async def CTA_Stations(config): async def main(): server = asyncio.create_task(app.start_server(port=80)) - + # Only run if we have internet - if wlan.IF_STA: + if mode is "STA": asyncio.create_task(CTA_Stations(config)) await server @@ -166,6 +166,7 @@ try: print('Connection error:', e) print('Retrying connection...') sleep(2) + mode = "STA" except: # Failed to open config file, launch AP mode and disable trains demo = True @@ -179,11 +180,6 @@ except: print("AP active for initial setup: ", wlan.active()) print("AP IP address:", wlan.ifconfig()[0]) + mode = "AP" -asyncio.run(main()) - - - - - - +asyncio.run(main()) \ No newline at end of file