Skip to content

Commit f707608

Browse files
bill88tdhalbert
andauthored
Switch to settable default wifi power
Co-authored-by: Dan Halbert <[email protected]>
1 parent ae3817a commit f707608

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

ports/espressif/boards/lolin_c3_mini/mpconfigboard.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,4 @@
2828
#define CIRCUITPY_BOARD_UART_PIN {{.tx = &pin_GPIO21, .rx = &pin_GPIO20}}
2929

3030
// Reduce wifi.radio.tx_power due to the antenna design of this board
31-
#define CIRCUITPY_REDUCE_TX_POWER (1)
31+
#define CIRCUITPY_WIFI_DEFAULT_TX_POWER (11.0)

ports/espressif/boards/makergo_esp32c3_supermini/mpconfigboard.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@
2424
#define CIRCUITPY_BOARD_SPI_PIN {{.clock = &pin_GPIO4, .mosi = &pin_GPIO6, .miso = &pin_GPIO5}}
2525

2626
// Reduce wifi.radio.tx_power due to the antenna design of this board
27-
#define CIRCUITPY_REDUCE_TX_POWER (1)
27+
#define CIRCUITPY_WIFI_DEFAULT_TX_POWER (11.0)

ports/espressif/common-hal/wifi/Radio.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,9 @@ void common_hal_wifi_radio_set_enabled(wifi_radio_obj_t *self, bool enabled) {
8686
if (!self->started && enabled) {
8787
ESP_ERROR_CHECK(esp_wifi_start());
8888
self->started = true;
89-
#if CIRCUITPY_REDUCE_TX_POWER
90-
common_hal_wifi_radio_set_tx_power(self, 11.0);
91-
#endif
89+
if (CIRCUITPY_WIFI_DEFAULT_TX_POWER != 20) {
90+
common_hal_wifi_radio_set_tx_power(self, CIRCUITPY_WIFI_DEFAULT_TX_POWER);
91+
}
9292
return;
9393
}
9494
}

ports/espressif/mpconfigport.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ extern portMUX_TYPE background_task_mutex;
6060
#define CALLBACK_CRITICAL_BEGIN (taskENTER_CRITICAL(&background_task_mutex))
6161
#define CALLBACK_CRITICAL_END (taskEXIT_CRITICAL(&background_task_mutex))
6262

63-
// Reduce wifi radio power
64-
// Only for boards with imperfect radio designs
65-
#ifndef CIRCUITPY_REDUCE_TX_POWER
66-
#define CIRCUITPY_REDUCE_TX_POWER (0)
63+
// 20 dBm is the default and the highest max tx power.
64+
// Allow a different value to be specified for boards that have trouble with using the maximum power.
65+
#ifndef CIRCUITPY_WIFI_DEFAULT_TX_POWER
66+
#define CIRCUITPY_WIFI_DEFAULT_TX_POWER (20)
6767
#endif

0 commit comments

Comments
 (0)