File tree Expand file tree Collapse file tree
platformio/test/esp32_now/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -55,7 +55,7 @@ void add_broadcast_peer(){
5555 // Register peer
5656 esp_now_peer_info_t peerInfo = {};
5757 memcpy (peerInfo.peer_addr , broadcastAddress, 6 );
58- peerInfo.ifidx = WIFI_IF_STA ; // Interfaccia usata (Station o AP)
58+ // peerInfo.ifidx = WIFI_IF_STA; // Interfaccia usata (Station o AP)
5959 peerInfo.channel = 0 ;
6060 peerInfo.encrypt = false ;
6161
@@ -155,6 +155,16 @@ void setup() {
155155 // Set device as a Wi-Fi Station
156156 WiFi.mode (WIFI_STA );
157157 WiFi.disconnect ();
158+
159+ // ESP-Now Range Test: Real-World Results for ESP32 Devices
160+ // https://youtu.be/oz0a7Ur7nko?si=aUMBJ4SpeXTSMMPg
161+ esp_err_t err = esp_wifi_set_protocol (WIFI_IF_STA ,WIFI_PROTOCOL_LR );
162+ if (err == ESP_OK ) {
163+ Serial.println (" Protocol successfully restricted to Long Range (LR) Mode successfully enabled!" );
164+ } else {
165+ Serial.printf (" Failed to set protocol. Error code: %d\n " , err);
166+ }
167+
158168 WiFi.STA .begin ();
159169 Serial.print (" [DEFAULT] ESP32 Board MAC Address: " );
160170 readMacAddress ();
You can’t perform that action at this time.
0 commit comments