Skip to content

net: fix wifi_set not applying new credentials until reboot#71

Merged
zevorn merged 2 commits intomainfrom
fix/wifi-reconnect
Mar 18, 2026
Merged

net: fix wifi_set not applying new credentials until reboot#71
zevorn merged 2 commits intomainfrom
fix/wifi-reconnect

Conversation

@zevorn
Copy link
Copy Markdown
Owner

@zevorn zevorn commented Mar 18, 2026

Summary

  • /wifi_set saved credentials to NVS but reconnected with old runtime config — new SSID/password only took effect after reboot
  • Add wifi_manager_reconnect() that calls esp_wifi_set_config() before esp_wifi_disconnect(), so new credentials apply immediately
  • Remove direct esp_wifi.h dependency from wifi_board.c (now fully encapsulated in wifi_manager)

Test plan

  • make build-esp32c3-devkit compiles cleanly
  • /wifi_set <new_ssid> <new_pass> connects to new AP without reboot
  • Reboot still loads credentials from NVS correctly

zevorn added 2 commits March 18, 2026 13:00
wifi_manager_set_credentials() saves to NVS but the subsequent
esp_wifi_disconnect() triggers reconnection with the old runtime
config.  Add wifi_manager_reconnect() that calls esp_wifi_set_config()
before disconnecting, so new credentials take effect immediately.

Signed-off-by: Chao Liu <chao.liu.zevorn@gmail.com>
Signed-off-by: Chao Liu <chao.liu.zevorn@gmail.com>
@zevorn zevorn merged commit c175f3b into main Mar 18, 2026
8 checks passed
@zevorn zevorn deleted the fix/wifi-reconnect branch March 18, 2026 06:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant