]> granicus.if.org Git - esp-idf/commitdiff
wifi: add long range code
authorzhangyanjiao <zhangyanjiao@espressif.com>
Wed, 24 Oct 2018 02:31:58 +0000 (10:31 +0800)
committerbot <bot@espressif.com>
Fri, 23 Nov 2018 09:09:07 +0000 (09:09 +0000)
examples/wifi/espnow/README.md
examples/wifi/espnow/main/Kconfig.projbuild
examples/wifi/espnow/main/espnow_example_main.c

index 0c3642b43a1e574c5dfb02b231242a2d9deddc03..047cf85a4a2c2cad72c9c5c608df80fe50863ef4 100644 (file)
@@ -44,6 +44,9 @@ make menuconfig
   The sending device and the recving device must be on the same channel.
 * Set Send count and Send delay under Example Configuration Options.
 * Set Send len under Example Configuration Options.
+* Set Enable Long Range Options.
+  When this parameter is enabled, the ESP32 device will send data at the PHY rate of 512Kbps or 256Kbps
+  then the data can be transmitted over long range between two ESP32 devices. 
 
 ### Build and Flash
 
index be6b6ffdd9d962d2338ee315ae38cf6769daf4d0..782fd5b01733ed0904166e1afac8ee09d23efc1d 100644 (file)
@@ -48,8 +48,14 @@ config ESPNOW_SEND_DELAY
 config ESPNOW_SEND_LEN
     int "Send len"
     range 10 250
-    default 200
+    default 10
     help
         Length of ESPNOW data to be sent, unit: byte.
 
+config ENABLE_LONG_RANGE
+    bool "Enable Long Range"
+    default "n"
+    help 
+        When enable long range, the PHY rate of ESP32 will be 512Kbps or 256Kbps
+
 endmenu
index 78576137a820ccf0daead1a580f59a7d14b61248..49e04c83661f6ace202f78fbe4bb6f7ed4c27312 100644 (file)
@@ -67,6 +67,10 @@ static void example_wifi_init(void)
      * been already on the same channel.
      */
     ESP_ERROR_CHECK( esp_wifi_set_channel(CONFIG_ESPNOW_CHANNEL, 0) );
+
+#if CONFIG_ENABLE_LONG_RANGE
+    ESP_ERROR_CHECK( esp_wifi_set_protocol(ESPNOW_WIFI_IF, WIFI_PROTOCOL_11B|WIFI_PROTOCOL_11G|WIFI_PROTOCOL_11N|WIFI_PROTOCOL_LR) );
+#endif
 }
 
 /* ESPNOW sending or receiving callback function is called in WiFi task.