espressif / esp-idf

Espressif IoT Development Framework. Official development framework for Espressif SoCs.
Apache License 2.0
13.44k stars 7.25k forks source link

[TW#17151] ESPNOW tx power configuration #1414

Closed jobidon closed 6 years ago

jobidon commented 6 years ago

I am trying to set the max TX power for ESPNOW communications. I have tried to set the max TX power for WiFi, hoping that it would also apply to ESPNOW comms, but it doesn't seem to be the case. In fact setting WiFi power requires the wifi to be both initialized and started, while ESPNOW won't start if wifi is started first. However both technologies use the same communications mechanism, so there must be a way to control that as well. So is there a way to control TX power and RX sensitivity for ESPNOW communications using the current API?

TimXia commented 6 years ago

Before using ESPNOW, wifi should start first in station or softap mode or both. You can do it like this: ... esp_wifi_init(); esp_wifi_set_mode(WIFI_MODE_STA); esp_wifi_start(); esp_now_init(); ... And you can control TX power after wifi started, the API is esp_wifi_set_max_tx_power(int8_t power) We haven't API to control RX sensitivity yet.