[ESPEasySerial] Fix issues on ESP32 with serial (restart serial)

ESP32 does have an issue with restarting serial communication.
Calling `end()` followed by `begin()` on the serial port, may render the port unusable.

This work-around is to keep track of the last used pins and do not call `end()` and `begin()` if the pins have not changed.

It is a really dirty hack, but it does work.

The serial port may be stopped/started when updating a setting on a task, so this was for sure a big issue on ESP32.
This commit is contained in:
TD-er
2021-10-14 00:06:41 +02:00
parent 6c1fc2c2d9
commit 313144ca85
3 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -170,6 +170,6 @@ platform_packages = framework-arduinoespressif32 @ https://github.com/Ja
[core_esp32_stage]
platform = espressif32
platform = https://github.com/platformio/platform-espressif32.git#feature/arduino-upstream
platform_packages = framework-arduinoespressif32 @ https://github.com/Jason2866/arduino-esp32/releases/download/v.2.0-post/framework-arduinoespressif32_i2c.zip
build_flags = -DESP32_STAGE
+1 -1
View File
@@ -10,7 +10,7 @@ lib_ignore = ESP8266WiFi, ESP8266Ping, ESP8266WebServer, ESP8266H
[esp32_common]
extends = common, core_esp32_3_3_0
lib_deps = td-er/ESPeasySerial @ 2.0.6, adafruit/Adafruit ILI9341 @ ^1.5.6, Adafruit GFX Library, LOLIN_EPD, Adafruit BusIO, VL53L0X @ 1.3.0, SparkFun VL53L1X 4m Laser Distance Sensor @ 1.2.9, td-er/SparkFun MAX1704x Fuel Gauge Arduino Library @ ^1.0.1
lib_deps = td-er/ESPeasySerial @ 2.0.7, adafruit/Adafruit ILI9341 @ ^1.5.6, Adafruit GFX Library, LOLIN_EPD, Adafruit BusIO, VL53L0X @ 1.3.0, SparkFun VL53L1X 4m Laser Distance Sensor @ 1.2.9, td-er/SparkFun MAX1704x Fuel Gauge Arduino Library @ ^1.0.1
lib_ignore = ${esp32_always.lib_ignore}, ESP32_ping, IRremoteESP8266, HeatpumpIR
board_build.f_flash = 80000000L
board_build.flash_mode = dout
+1 -1
View File
@@ -52,7 +52,7 @@ extends = common
board_build.f_cpu = 80000000L
build_flags = ${debug_flags.build_flags} ${mqtt_flags.build_flags} -DHTTPCLIENT_1_1_COMPATIBLE=0
build_unflags = -DDEBUG_ESP_PORT
lib_deps = td-er/ESPeasySerial @ 2.0.6, adafruit/Adafruit ILI9341 @ ^1.5.6, Adafruit GFX Library, LOLIN_EPD, Adafruit BusIO, bblanchon/ArduinoJson @ ^6.17.2, VL53L0X @ 1.3.0, SparkFun VL53L1X 4m Laser Distance Sensor @ 1.2.9, td-er/RABurton ESP8266 Mutex @ ^1.0.2, td-er/SparkFun MAX1704x Fuel Gauge Arduino Library @ ^1.0.1
lib_deps = td-er/ESPeasySerial @ 2.0.7, adafruit/Adafruit ILI9341 @ ^1.5.6, Adafruit GFX Library, LOLIN_EPD, Adafruit BusIO, bblanchon/ArduinoJson @ ^6.17.2, VL53L0X @ 1.3.0, SparkFun VL53L1X 4m Laser Distance Sensor @ 1.2.9, td-er/RABurton ESP8266 Mutex @ ^1.0.2, td-er/SparkFun MAX1704x Fuel Gauge Arduino Library @ ^1.0.1
lib_ignore = ${esp82xx_defaults.lib_ignore}, IRremoteESP8266, HeatpumpIR, LittleFS(esp8266), ServoESP32, TinyWireM
board = esp12e
monitor_filters = esp8266_exception_decoder