espressif / esp-iot-bridge

A smart bridge to make both ESP and the other MCU or smart device can access the Internet.
Apache License 2.0
144 stars 49 forks source link

WiFi Long Range - WIFI_PROTOCOL_LR - esp32s3 #12

Closed ldab closed 1 year ago

ldab commented 1 year ago

Hi,

Using ESP-IDF: v4.4.1 If I change the protocol by adding ESP_ERROR_CHECK(esp_wifi_set_protocol(ESP_IF_WIFI_AP, WIFI_PROTOCOL_LR | WIFI_PROTOCOL_11B | WIFI_PROTOCOL_11G | WIFI_PROTOCOL_11N)); here: https://github.com/espressif/esp-gateway/blob/4753c94e6e30eb3fd6726db8164ee60951375c55/components/gateway/src/gateway_wifi.c#L271 The AP is not visible any longer from the PC/Phone, the log shows:

Add netif ap with 4753c94(commit id)
I (811) gateway_common: netif list add success
I (817) wifi:mode : softAP (f4:12:fa:81:f6:c5)
I (821) wifi:Total power save buffer number: 16
I (825) wifi:Init max length of beacon: 752/752
I (830) wifi:Init max length of beacon: 752/752
I (837) wifi:Total power save buffer number: 16
I (1361) wifi:Total power save buffer number: 16
I (1364) gateway_wifi: softap ssid: ESP_Gateway password: 12345678
Add netif sta with 4753c94(commit id)
I (1365) gateway_common: netif list add success
I (1370) wifi:mode : sta (f4:12:fa:81:f6:c4) + softAP (f4:12:fa:81:f6:c5)
I (1377) wifi:enable tsf
I (1380) gpio: GPIO[38]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
start web server

In Device2 I run:

...
esp_wifi_set_mode(WIFI_MODE_STA);
ESP_ERROR_CHECK(esp_wifi_set_protocol(ESP_IF_WIFI_STA, WIFI_PROTOCOL_LR);
...
esp_wifi_connect();

Device2 successfully connects to esp-gateway which leads me to me conclude that AP is working on WIFI_PROTOCOL_LR only.

1 - Have you tested this scenario? 2 - Did I initialize things wrong?

ldab commented 1 year ago

Never mind For LR-enabled AP of ESP32, it is incompatible with traditional 802.11 mode, because the beacon is sent in LR mode.

https://docs.espressif.com/projects/esp-idf/en/v4.4.2/esp32s3/api-guides/wifi.html#lr-compatibility