Skip to content

Commit

Permalink
Merge pull request #27 from softhack007/S2_patch3
Browse files Browse the repository at this point in the history
LOLIN_WIFI_FIX
  • Loading branch information
ewoudwijma authored Feb 8, 2024
2 parents 0744f70 + 8ce574e commit ea7eafc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ build_flags = ${env.build_flags}
; -DARDUINO_USB_CDC_ON_BOOT=0 -DARDUINO_USB_DFU_ON_BOOT=1 -DARDUINO_USB_MSC_ON_BOOT=0 ;; with serial-to-USB moddule (use in case your board hangs without USB connection)
-DARDUINO_USB_MODE=0 ;; Make sure that the right HardwareSerial driver is picked in arduino-esp32 (mandatory on -S2)
; -D DEBUG=1 -D CORE_DEBUG_LEVEL=1 -D ARDUINOJSON_DEBUG=1 ;; for more debug output
-D LOLIN_WIFI_FIX ;; workaround for LOLIN C3/S2/S3 wifi instability. https://www.wemos.cc/en/latest/c3/c3_mini_1_0_0.html#about-wifi


[env:lolin_c3_mini]
Expand Down
6 changes: 6 additions & 0 deletions src/Sys/SysModNetwork.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,9 @@ void SysModNetwork::initConnection() {
for (int i = 0; i < strlen(password); i++) strncat(passXXX, "*", sizeof(passXXX)-1);
USER_PRINTF("Connecting to WiFi %s / %s\n", ssid, passXXX);
WiFi.begin(ssid, password);
#if defined(LOLIN_WIFI_FIX) && (defined(ARDUINO_ARCH_ESP32C3) || defined(ARDUINO_ARCH_ESP32S2) || defined(ARDUINO_ARCH_ESP32S3))
WiFi.setTxPower(WIFI_POWER_8_5dBm);
#endif
}
else
USER_PRINTF("No SSID");
Expand All @@ -140,6 +143,9 @@ void SysModNetwork::initAP() {
USER_PRINTF("Opening access point %s\n", apSSID);
WiFi.softAPConfig(IPAddress(4, 3, 2, 1), IPAddress(4, 3, 2, 1), IPAddress(255, 255, 255, 0));
WiFi.softAP(apSSID, apPass, apChannel, apHide);
#if defined(LOLIN_WIFI_FIX) && (defined(ARDUINO_ARCH_ESP32C3) || defined(ARDUINO_ARCH_ESP32S2) || defined(ARDUINO_ARCH_ESP32S3))
WiFi.setTxPower(WIFI_POWER_8_5dBm);
#endif
if (!apActive) // start captive portal if AP active
{
mdl->setUIValueV("nwstatus", "AP %s / %s @ %s", apSSID, apPass, WiFi.softAPIP().toString().c_str());
Expand Down

0 comments on commit ea7eafc

Please sign in to comment.