mirror of
https://github.com/apache/nuttx.git
synced 2026-06-04 14:53:47 +08:00
esp32/wifi: fix typos, goto and macro definitions
This commit is contained in:
committed by
Gustavo Henrique Nihei
parent
49d43a35b9
commit
eb01b66978
@@ -2159,7 +2159,7 @@ static int esp_event_id_map(int event_id)
|
|||||||
case WIFI_EVENT_STA_STOP:
|
case WIFI_EVENT_STA_STOP:
|
||||||
id = WIFI_ADPT_EVT_STA_STOP;
|
id = WIFI_ADPT_EVT_STA_STOP;
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif /* ESP32_WLAN_HAS_STA */
|
||||||
|
|
||||||
#ifdef ESP32_WLAN_HAS_SOFTAP
|
#ifdef ESP32_WLAN_HAS_SOFTAP
|
||||||
case WIFI_EVENT_AP_START:
|
case WIFI_EVENT_AP_START:
|
||||||
@@ -2177,7 +2177,7 @@ static int esp_event_id_map(int event_id)
|
|||||||
case WIFI_EVENT_AP_STADISCONNECTED:
|
case WIFI_EVENT_AP_STADISCONNECTED:
|
||||||
id = WIFI_ADPT_EVT_AP_STADISCONNECTED;
|
id = WIFI_ADPT_EVT_AP_STADISCONNECTED;
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif /* ESP32_WLAN_HAS_SOFTAP */
|
||||||
default:
|
default:
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@@ -2264,7 +2264,7 @@ static void esp_evt_work_cb(void *arg)
|
|||||||
wlinfo("Wi-Fi sta stop\n");
|
wlinfo("Wi-Fi sta stop\n");
|
||||||
g_sta_connected = false;
|
g_sta_connected = false;
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif /* ESP32_WLAN_HAS_STA */
|
||||||
|
|
||||||
#ifdef ESP32_WLAN_HAS_SOFTAP
|
#ifdef ESP32_WLAN_HAS_SOFTAP
|
||||||
case WIFI_ADPT_EVT_AP_START:
|
case WIFI_ADPT_EVT_AP_START:
|
||||||
@@ -4114,7 +4114,8 @@ static IRAM_ATTR void esp_wifi_tx_done_cb(uint8_t ifidx, uint8_t *data,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif /* ESP32_WLAN_HAS_STA */
|
||||||
|
|
||||||
#ifdef ESP32_WLAN_HAS_SOFTAP
|
#ifdef ESP32_WLAN_HAS_SOFTAP
|
||||||
if (ifidx == ESP_IF_WIFI_AP)
|
if (ifidx == ESP_IF_WIFI_AP)
|
||||||
{
|
{
|
||||||
@@ -4124,14 +4125,14 @@ static IRAM_ATTR void esp_wifi_tx_done_cb(uint8_t ifidx, uint8_t *data,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif /* ESP32_WLAN_HAS_SOFTAP */
|
||||||
{
|
{
|
||||||
wlerr("ifidx=%d is error\n", ifidx);
|
wlerr("ifidx=%d is error\n", ifidx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: esp_wifi_set_auth_param
|
* Name: esp_wifi_auth_trans
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Converts a ESP32 authenticate mode values to WEXT authenticate mode.
|
* Converts a ESP32 authenticate mode values to WEXT authenticate mode.
|
||||||
@@ -4172,7 +4173,7 @@ static int esp_wifi_auth_trans(uint32_t wifi_auth)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: esp_wifi_set_auth_param
|
* Name: esp_wifi_cipher_trans
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Converts a ESP32 cipher type values to WEXT cipher type values.
|
* Converts a ESP32 cipher type values to WEXT cipher type values.
|
||||||
@@ -4884,16 +4885,18 @@ int esp_wifi_sta_start(void)
|
|||||||
{
|
{
|
||||||
mode = WIFI_MODE_APSTA;
|
mode = WIFI_MODE_APSTA;
|
||||||
}
|
}
|
||||||
#else
|
else
|
||||||
|
#endif /* ESP32_WLAN_HAS_SOFTAP */
|
||||||
|
{
|
||||||
mode = WIFI_MODE_STA;
|
mode = WIFI_MODE_STA;
|
||||||
#endif
|
}
|
||||||
|
|
||||||
ret = esp_wifi_set_mode(mode);
|
ret = esp_wifi_set_mode(mode);
|
||||||
if (ret)
|
if (ret)
|
||||||
{
|
{
|
||||||
wlerr("Failed to set Wi-Fi mode=%d ret=%d\n", mode, ret);
|
wlerr("Failed to set Wi-Fi mode=%d ret=%d\n", mode, ret);
|
||||||
ret = wifi_errno_trans(ret);
|
ret = wifi_errno_trans(ret);
|
||||||
goto errout_set_mode;
|
goto errout;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = esp_wifi_start();
|
ret = esp_wifi_start();
|
||||||
@@ -4901,17 +4904,14 @@ int esp_wifi_sta_start(void)
|
|||||||
{
|
{
|
||||||
wlerr("Failed to start Wi-Fi with mode=%d ret=%d\n", mode, ret);
|
wlerr("Failed to start Wi-Fi with mode=%d ret=%d\n", mode, ret);
|
||||||
ret = wifi_errno_trans(ret);
|
ret = wifi_errno_trans(ret);
|
||||||
goto errout_set_mode;
|
goto errout;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_sta_started = true;
|
g_sta_started = true;
|
||||||
|
|
||||||
wlinfo("OK to start Wi-Fi station\n");
|
wlinfo("OK to start Wi-Fi station\n");
|
||||||
|
|
||||||
esp_wifi_lock(false);
|
errout:
|
||||||
return OK;
|
|
||||||
|
|
||||||
errout_set_mode:
|
|
||||||
esp_wifi_lock(false);
|
esp_wifi_lock(false);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -4953,7 +4953,7 @@ int esp_wifi_sta_stop(void)
|
|||||||
{
|
{
|
||||||
wlerr("Failed to set Wi-Fi AP mode ret=%d\n", ret);
|
wlerr("Failed to set Wi-Fi AP mode ret=%d\n", ret);
|
||||||
ret = wifi_errno_trans(ret);
|
ret = wifi_errno_trans(ret);
|
||||||
goto errout_set_mode;
|
goto errout;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = esp_wifi_start();
|
ret = esp_wifi_start();
|
||||||
@@ -4961,21 +4961,19 @@ int esp_wifi_sta_stop(void)
|
|||||||
{
|
{
|
||||||
wlerr("Failed to start Wi-Fi AP ret=%d\n", ret);
|
wlerr("Failed to start Wi-Fi AP ret=%d\n", ret);
|
||||||
ret = wifi_errno_trans(ret);
|
ret = wifi_errno_trans(ret);
|
||||||
goto errout_set_mode;
|
goto errout;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* ESP32_WLAN_HAS_SOFTAP */
|
||||||
|
|
||||||
wlinfo("OK to stop Wi-Fi station\n");
|
wlinfo("OK to stop Wi-Fi station\n");
|
||||||
|
|
||||||
esp_wifi_lock(false);
|
|
||||||
return OK;
|
|
||||||
|
|
||||||
#ifdef ESP32_WLAN_HAS_SOFTAP
|
#ifdef ESP32_WLAN_HAS_SOFTAP
|
||||||
errout_set_mode:
|
errout:
|
||||||
esp_wifi_lock(true);
|
#endif /* ESP32_WLAN_HAS_SOFTAP */
|
||||||
|
|
||||||
|
esp_wifi_lock(false);
|
||||||
return ret;
|
return ret;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@@ -5423,7 +5421,7 @@ int esp_wifi_sta_connect(void)
|
|||||||
{
|
{
|
||||||
wlerr("Failed to connect ret=%d\n", ret);
|
wlerr("Failed to connect ret=%d\n", ret);
|
||||||
ret = wifi_errno_trans(ret);
|
ret = wifi_errno_trans(ret);
|
||||||
goto errout_wifi_connect;
|
goto errout;
|
||||||
}
|
}
|
||||||
|
|
||||||
esp_wifi_lock(false);
|
esp_wifi_lock(false);
|
||||||
@@ -5449,7 +5447,7 @@ int esp_wifi_sta_connect(void)
|
|||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
|
|
||||||
errout_wifi_connect:
|
errout:
|
||||||
g_sta_reconnect = false;
|
g_sta_reconnect = false;
|
||||||
esp_wifi_lock(false);
|
esp_wifi_lock(false);
|
||||||
return ret;
|
return ret;
|
||||||
@@ -6082,7 +6080,7 @@ int esp_wifi_sta_rssi(struct iwreq *iwr, bool set)
|
|||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* ESP32_WLAN_HAS_STA */
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* SoftAP functions
|
* SoftAP functions
|
||||||
@@ -6123,16 +6121,18 @@ int esp_wifi_softap_start(void)
|
|||||||
{
|
{
|
||||||
mode = WIFI_MODE_APSTA;
|
mode = WIFI_MODE_APSTA;
|
||||||
}
|
}
|
||||||
#else
|
else
|
||||||
|
#endif /* ESP32_WLAN_HAS_STA */
|
||||||
|
{
|
||||||
mode = WIFI_MODE_AP;
|
mode = WIFI_MODE_AP;
|
||||||
#endif
|
}
|
||||||
|
|
||||||
ret = esp_wifi_set_mode(mode);
|
ret = esp_wifi_set_mode(mode);
|
||||||
if (ret)
|
if (ret)
|
||||||
{
|
{
|
||||||
wlerr("Failed to set Wi-Fi mode=%d ret=%d\n", mode, ret);
|
wlerr("Failed to set Wi-Fi mode=%d ret=%d\n", mode, ret);
|
||||||
ret = wifi_errno_trans(ret);
|
ret = wifi_errno_trans(ret);
|
||||||
goto errout_set_mode;
|
goto errout;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = esp_wifi_start();
|
ret = esp_wifi_start();
|
||||||
@@ -6140,17 +6140,14 @@ int esp_wifi_softap_start(void)
|
|||||||
{
|
{
|
||||||
wlerr("Failed to start Wi-Fi with mode=%d ret=%d\n", mode, ret);
|
wlerr("Failed to start Wi-Fi with mode=%d ret=%d\n", mode, ret);
|
||||||
ret = wifi_errno_trans(ret);
|
ret = wifi_errno_trans(ret);
|
||||||
goto errout_set_mode;
|
goto errout;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_softap_started = true;
|
g_softap_started = true;
|
||||||
|
|
||||||
wlinfo("OK to start Wi-Fi SoftAP\n");
|
wlinfo("OK to start Wi-Fi SoftAP\n");
|
||||||
|
|
||||||
esp_wifi_lock(false);
|
errout:
|
||||||
return OK;
|
|
||||||
|
|
||||||
errout_set_mode:
|
|
||||||
esp_wifi_lock(false);
|
esp_wifi_lock(false);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -6192,29 +6189,27 @@ int esp_wifi_softap_stop(void)
|
|||||||
{
|
{
|
||||||
wlerr("Failed to set Wi-Fi AP mode ret=%d\n", ret);
|
wlerr("Failed to set Wi-Fi AP mode ret=%d\n", ret);
|
||||||
ret = wifi_errno_trans(ret);
|
ret = wifi_errno_trans(ret);
|
||||||
goto errout_set_mode;
|
goto errout;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = esp_wifi_start();
|
ret = esp_wifi_start();
|
||||||
if (ret)
|
if (ret)
|
||||||
{
|
{
|
||||||
wlerr("Failed to start Wi-Fi AP ret=%d\n", ret);
|
wlerr("Failed to start Wi-Fi STA ret=%d\n", ret);
|
||||||
ret = wifi_errno_trans(ret);
|
ret = wifi_errno_trans(ret);
|
||||||
goto errout_set_mode;
|
goto errout;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* ESP32_WLAN_HAS_STA */
|
||||||
|
|
||||||
wlinfo("OK to stop Wi-Fi SoftAP\n");
|
wlinfo("OK to stop Wi-Fi SoftAP\n");
|
||||||
|
|
||||||
esp_wifi_lock(false);
|
|
||||||
return OK;
|
|
||||||
|
|
||||||
#ifdef ESP32_WLAN_HAS_STA
|
#ifdef ESP32_WLAN_HAS_STA
|
||||||
errout_set_mode:
|
errout:
|
||||||
esp_wifi_lock(true);
|
#endif /* ESP32_WLAN_HAS_STA */
|
||||||
|
|
||||||
|
esp_wifi_lock(false);
|
||||||
return ret;
|
return ret;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
|||||||
@@ -495,7 +495,7 @@ int esp_wifi_sta_country(struct iwreq *iwr, bool set);
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int esp_wifi_sta_rssi(struct iwreq *iwr, bool set);
|
int esp_wifi_sta_rssi(struct iwreq *iwr, bool set);
|
||||||
#endif
|
#endif /* ESP32_WLAN_HAS_STA */
|
||||||
|
|
||||||
#ifdef ESP32_WLAN_HAS_SOFTAP
|
#ifdef ESP32_WLAN_HAS_SOFTAP
|
||||||
|
|
||||||
|
|||||||
@@ -223,7 +223,7 @@ static const struct wlan_ops g_sta_ops =
|
|||||||
.event = esp_wifi_notify_subscribe,
|
.event = esp_wifi_notify_subscribe,
|
||||||
.stop = esp_wifi_sta_stop
|
.stop = esp_wifi_sta_stop
|
||||||
};
|
};
|
||||||
#endif
|
#endif /* ESP32_WLAN_HAS_STA */
|
||||||
|
|
||||||
#ifdef ESP32_WLAN_HAS_SOFTAP
|
#ifdef ESP32_WLAN_HAS_SOFTAP
|
||||||
static const struct wlan_ops g_softap_ops =
|
static const struct wlan_ops g_softap_ops =
|
||||||
@@ -246,7 +246,7 @@ static const struct wlan_ops g_softap_ops =
|
|||||||
.event = esp_wifi_notify_subscribe,
|
.event = esp_wifi_notify_subscribe,
|
||||||
.stop = esp_wifi_softap_stop
|
.stop = esp_wifi_softap_stop
|
||||||
};
|
};
|
||||||
#endif
|
#endif /* ESP32_WLAN_HAS_SOFTAP */
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Function Prototypes
|
* Private Function Prototypes
|
||||||
@@ -1712,7 +1712,7 @@ static void wlan_sta_tx_done(uint8_t *data, uint16_t *len, bool status)
|
|||||||
|
|
||||||
wlan_tx_done(priv);
|
wlan_tx_done(priv);
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* ESP32_WLAN_HAS_STA */
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Function: wlan_softap_rx_done
|
* Function: wlan_softap_rx_done
|
||||||
@@ -1763,7 +1763,7 @@ static void wlan_softap_tx_done(uint8_t *data, uint16_t *len, bool status)
|
|||||||
|
|
||||||
wlan_tx_done(priv);
|
wlan_tx_done(priv);
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* ESP32_WLAN_HAS_SOFTAP */
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
@@ -1827,7 +1827,7 @@ int esp32_wlan_sta_initialize(void)
|
|||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* ESP32_WLAN_HAS_STA */
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: esp32_wlan_softap_initialize
|
* Name: esp32_wlan_softap_initialize
|
||||||
@@ -1888,6 +1888,6 @@ int esp32_wlan_softap_initialize(void)
|
|||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* ESP32_WLAN_HAS_SOFTAP */
|
||||||
|
|
||||||
#endif /* CONFIG_ESP32_WIFI */
|
#endif /* CONFIG_ESP32_WIFI */
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ extern "C"
|
|||||||
|
|
||||||
#ifdef ESP32_WLAN_HAS_STA
|
#ifdef ESP32_WLAN_HAS_STA
|
||||||
int esp32_wlan_sta_initialize(void);
|
int esp32_wlan_sta_initialize(void);
|
||||||
#endif
|
#endif /* ESP32_WLAN_HAS_STA */
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: esp32_wlan_softap_initialize
|
* Name: esp32_wlan_softap_initialize
|
||||||
@@ -80,7 +80,7 @@ int esp32_wlan_sta_initialize(void);
|
|||||||
|
|
||||||
#ifdef ESP32_WLAN_HAS_SOFTAP
|
#ifdef ESP32_WLAN_HAS_SOFTAP
|
||||||
int esp32_wlan_softap_initialize(void);
|
int esp32_wlan_softap_initialize(void);
|
||||||
#endif
|
#endif /* ESP32_WLAN_HAS_SOFTAP */
|
||||||
|
|
||||||
#endif /* CONFIG_ESP32_WIFI */
|
#endif /* CONFIG_ESP32_WIFI */
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ int board_wlan_init(void)
|
|||||||
wlerr("ERROR: Failed to initialize Wi-Fi station\n");
|
wlerr("ERROR: Failed to initialize Wi-Fi station\n");
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* ESP32_WLAN_HAS_STA */
|
||||||
|
|
||||||
#ifdef ESP32_WLAN_HAS_SOFTAP
|
#ifdef ESP32_WLAN_HAS_SOFTAP
|
||||||
ret = esp32_wlan_softap_initialize();
|
ret = esp32_wlan_softap_initialize();
|
||||||
@@ -80,7 +80,7 @@ int board_wlan_init(void)
|
|||||||
wlerr("ERROR: Failed to initialize Wi-Fi softAP\n");
|
wlerr("ERROR: Failed to initialize Wi-Fi softAP\n");
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* ESP32_WLAN_HAS_SOFTAP */
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user