Fix ESP32 slow response when using UDP as in emulation (#21470)

This commit is contained in:
Theo Arends 2024-05-29 11:46:55 +02:00
parent bc6faa733c
commit f132663dfe
4 changed files with 12 additions and 2 deletions

View File

@ -14,6 +14,8 @@ All notable changes to this project will be documented in this file.
### Fixed
- Telegram TLS fingerprint, remove CA validation (#21514)
- ESP32 I2S multiple fixes (#21511)
- ESP32 slow response when using UDP as in emulation (#21470)
### Removed

View File

@ -149,6 +149,7 @@ The latter links can be used for OTA upgrades too like ``OtaUrl https://ota.tasm
- Telegram TLS fingerprint, remove CA validation [#21514](https://github.com/arendst/Tasmota/issues/21514)
- Zigbee crash when removing `ZbName` [#21449](https://github.com/arendst/Tasmota/issues/21449)
- Avoid connection errors when switching to safeboot to upload OTA firmware [#21428](https://github.com/arendst/Tasmota/issues/21428)
- ESP32 slow response when using UDP as in emulation [#21470](https://github.com/arendst/Tasmota/issues/21470)
- ESP32 BLE fix scanning [#21451](https://github.com/arendst/Tasmota/issues/21451)
- I2S APLL not supported on all SOCs [#21483](https://github.com/arendst/Tasmota/issues/21483)
- Webradio crash with invalid url [#21446](https://github.com/arendst/Tasmota/issues/21446)

View File

@ -60,7 +60,10 @@ bool UdpDisconnect(void)
{
if (udp_connected) {
// flush any outgoing packet
PortUdp.flush();
PortUdp.flush(); // Does nothing in core3
#ifdef ESP32
PortUdp.clear(); // New with core3. Does what flush() did in core2;
#endif
#ifdef ESP8266
UdpCtx.disconnect();
#endif
@ -130,7 +133,8 @@ void PollUdp(void)
int32_t len = PortUdp.read(packet_buffer, UDP_BUFFER_SIZE -1);
packet_buffer[len] = 0;
PortUdp.flush();
// PortUdp.flush();
PortUdp.clear(); // New with core3. Does what flush() did in core2;
AddLog(LOG_LEVEL_DEBUG_MORE, PSTR("UDP: Packet (%d/%d)"), len, pack_len);
#endif // ESP32

View File

@ -1406,6 +1406,9 @@ void Script_Stop_UDP(void) {
if (!glob_script_mem.udp_flags.udp_used) return;
if (glob_script_mem.udp_flags.udp_connected) {
glob_script_mem.Script_PortUdp.flush();
#ifdef ESP32
glob_script_mem.Script_PortUdp.clear(); // New with core3. Does what flush() did in core2;
#endif
glob_script_mem.Script_PortUdp.stop();
glob_script_mem.udp_flags.udp_connected = 0;
}