-
Notifications
You must be signed in to change notification settings - Fork 19
Open
Description
Hi there,
I run Your code, and it seems to not save credentials.
2000-01-01 00:31:14 [info / 106kB] > GET /generate_204 (200 OK) [331ms]
Saving wifi credentials...
2000-01-01 00:31:41 [debug / 103kB] > parsed template: ap_templates/configured.html (took 44 ms)
2000-01-01 00:31:41 [info / 102kB] > POST /configure (200 OK) [725ms]
2000-01-01 00:31:41 [debug / 96kB] > parsed template: ap_templates/redirect.html (took 29 ms)
2000-01-01 00:31:42 [info / 95kB] > GET /generate_204 (200 OK) [1240ms]
Resetting...
ets Jun 8 2016 00:22:57
rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:4728
load:0x40078000,len:14888
load:0x40080400,len:3368
entry 0x400805cc
Entering setup mode...
2000-01-01 00:31:44 [info / 129kB] > starting catch all dns server on port 53
2000-01-01 00:31:44 [info / 127kB] > starting web server on port 80
after some debugging:
try:
print(f"Trying to connect to wifi")
os.stat(WIFI_FILE)
print(f"wifi file found")
# File was found, attempt to connect to wifi...
with open(WIFI_FILE) as f:
print(f"wifi file loaded")
wifi_current_attempt = 1
wifi_credentials = json.load(f)
print(f"wifi credentials loaded")
while (wifi_current_attempt < WIFI_MAX_ATTEMPTS):
ip_address = connect_to_wifi(wifi_credentials["ssid"], wifi_credentials["password"])
print(f"I am here now")
if is_connected_to_wifi():
print(f"Connected to wifi, IP address {ip_address}")
break
else:
wifi_current_attempt += 1
if is_connected_to_wifi():
application_mode()
else:
# Bad configuration, delete the credentials file, reboot
# into setup mode to get new credentials from the user.
print("Bad wifi connection!")
print(wifi_credentials)
os.remove(WIFI_FILE)
machine_reset()
except Exception:
# Either no wifi configuration file found, or something went wrong,
# so go into setup mode.
print(f"Something went wrong")
setup_mode()
rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:4728
load:0x40078000,len:14888
load:0x40080400,len:3368
entry 0x400805cc
Trying to connect to wifi
wifi file found
wifi file loaded
wifi credentials loaded
Something went wrong
Entering setup mode...
2000-01-01 01:14:30 [info / 128kB] > starting catch all dns server on port 53
2000-01-01 01:14:30 [info / 126kB] > starting web server on port 80
Metadata
Metadata
Assignees
Labels
No labels