Skip to content

Commit

Permalink
Merge branch 'feature/add_long_range_code' into 'master'
Browse files Browse the repository at this point in the history
example: add long range code

See merge request idf/esp-idf!3552
  • Loading branch information
jack0c committed Nov 26, 2018
2 parents 9890fea + ad22d28 commit 90a6c9a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
3 changes: 3 additions & 0 deletions examples/wifi/espnow/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
8 changes: 7 additions & 1 deletion examples/wifi/espnow/main/Kconfig.projbuild
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 4 additions & 0 deletions examples/wifi/espnow/main/espnow_example_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 90a6c9a

Please sign in to comment.