tmedicci commented on code in PR #8818:
URL: https://github.com/apache/nuttx/pull/8818#discussion_r1138559802
##########
arch/xtensa/src/esp32s3/esp32s3_wifi_adapter.c:
##########
@@ -4701,10 +4783,37 @@ int esp_wifi_sta_stop(void)
g_sta_started = false;
+#ifdef ESP32S3_WLAN_HAS_SOFTAP
+ if (g_softap_started)
+ {
+ ret = esp_wifi_set_mode(WIFI_MODE_AP);
+ if (ret)
+ {
+ wlerr("Failed to set Wi-Fi AP mode ret=%d\n", ret);
+ ret = wifi_errno_trans(ret);
+ goto errout_set_mode;
+ }
+
+ ret = esp_wifi_start();
+ if (ret)
+ {
+ wlerr("Failed to start Wi-Fi AP ret=%d\n", ret);
+ ret = wifi_errno_trans(ret);
+ goto errout_set_mode;
+ }
+ }
+#endif /* ESP32S3_WLAN_HAS_SOFTAP */
+
wlinfo("OK to stop Wi-Fi station\n");
esp_wifi_lock(false);
return OK;
+
+#ifdef ESP32S3_WLAN_HAS_SOFTAP
+errout_set_mode:
+ esp_wifi_lock(false);
+ return ret;
+#endif /* ESP32S3_WLAN_HAS_SOFTAP */
Review Comment:
Partially done:
If the label `errout` is present outside the `#ifdef`, the compiler will
throw a warning:
```
chip/esp32s3_wifi_adapter.c:4804:1: error: label 'errout' defined but not
used [-Werror=unused-label]
4804 | errout:
```
I changed the label itself and removed the redundant `esp_wifi_lock`. Please
take a look if it fits ;)
```
wlinfo("OK to stop Wi-Fi station\n");
#ifdef ESP32S3_WLAN_HAS_SOFTAP
errout:
#endif /* ESP32S3_WLAN_HAS_SOFTAP */
esp_wifi_lock(false);
return ret;
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]