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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user