Update: Dynamically set Wi-Fi mode based on nconfig

- Read Wi-Fi mode from `nconfig` and default to APSTA if invalid or unavailable.
- Adjust initialization to handle AP or STA configurations accordingly.
- Enhance logging to reflect the selected mode during startup.

Signed-off-by: YoungSoo Shin <shinys000114@gmail.com>
This commit is contained in:
2025-09-04 11:30:29 +09:00
parent 630d3c4f58
commit 679f8d297c
2 changed files with 46 additions and 25 deletions

View File

@@ -44,6 +44,7 @@ void wifi_init_ap(void)
wifi_config_t wifi_config = {
.ap =
{
.password = "",
.channel = AP_CHANNEL,
.max_connection = AP_MAX_CONN,
.authmode = WIFI_AUTH_WPA2_PSK,
@@ -69,10 +70,6 @@ void wifi_init_ap(void)
{
nconfig_read(AP_PASSWORD, (char*)wifi_config.ap.password, sizeof(wifi_config.ap.password));
}
else
{
strcpy((char*)wifi_config.ap.password, DEFAULT_AP_PASS);
}
// If password is not set, use open authentication
if (strlen((char*)wifi_config.ap.password) == 0)