Skip to content

Commit f47b63e

Browse files
committed
working on esp_now example
1 parent 11110ba commit f47b63e

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

platformio/test/esp32_now/src/esp-now.ino

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff 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();

0 commit comments

Comments
 (0)