Skip to content

Commit

Permalink
C3 patch to lower tx power if board do not start (#1011)
Browse files Browse the repository at this point in the history
* Patch for ESP32-C3 - WIP

* remove unecessary code
  • Loading branch information
luc-github committed Mar 20, 2024
1 parent 6b9f57b commit 06a7ac3
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
13 changes: 13 additions & 0 deletions esp3d/configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,19 @@
#include "myconfig.h"
#endif
#endif
/************************************
*
* ESP32 C3 -patch
*
* Uncomment only if your ESP32 C3 board cannot start
*
************************************/
//Possible values
//WIFI_POWER_5dBm
//WIFI_POWER_8_5dBm
//WIFI_POWER_15dBm

//#define ESP32_WIFI_TX_POWER WIFI_POWER_15dBm

/************************************
*
Expand Down
8 changes: 8 additions & 0 deletions esp3d/src/modules/wifi/wificonfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,10 @@ bool WiFiConfig::StartSTA() {
WiFi.setMinSecurity(WIFI_AUTH_WEP);
WiFi.setScanMethod(WIFI_ALL_CHANNEL_SCAN);
WiFi.setSortMethod(WIFI_CONNECT_AP_BY_SIGNAL);
#if defined(ESP32_WIFI_TX_POWER)
WiFi.setTxPower(ESP32_WIFI_TX_POWER);
delay(100);
#endif // ESP32_WIFI_TX_POWER
#endif // ARDUINO_ARCH_ESP32
// Get parameters for STA
String SSID = ESP3DSettings::readString(ESP_STA_SSID);
Expand Down Expand Up @@ -228,6 +232,10 @@ bool WiFiConfig::StartAP(bool setupMode) {
_ap_gateway = setupMode ? ip : gw;
_ap_subnet = mask;
#endif // ARDUINO_ARCH_ESP8266
#if defined(ESP32_WIFI_TX_POWER) && defined(ARDUINO_ARCH_ESP32)
WiFi.setTxPower(ESP32_WIFI_TX_POWER);
delay(100);
#endif // ESP32_WIFI_TX_POWER

// Start AP
if (WiFi.softAP(SSID.c_str(),
Expand Down

0 comments on commit 06a7ac3

Please sign in to comment.