diff --git a/tasmota/tasmota_support/support_device_groups.ino b/tasmota/tasmota_support/support_device_groups.ino index 63b9eb965..35d0b9983 100644 --- a/tasmota/tasmota_support/support_device_groups.ino +++ b/tasmota/tasmota_support/support_device_groups.ino @@ -207,8 +207,9 @@ void DeviceGroupsStart() void DeviceGroupsStop() { +#ifdef ESP8266 device_groups_udp.flush(); -#ifdef ESP32 +#else device_groups_udp.clear(); // New with core3. Does what flush() did in core2; #endif device_groups_up = false; diff --git a/tasmota/tasmota_support/support_udp.ino b/tasmota/tasmota_support/support_udp.ino index 0cb6c4b75..ffd677a82 100644 --- a/tasmota/tasmota_support/support_udp.ino +++ b/tasmota/tasmota_support/support_udp.ino @@ -60,12 +60,11 @@ bool UdpDisconnect(void) { if (udp_connected) { // flush any outgoing packet - PortUdp.flush(); // Does nothing in core3 -#ifdef ESP32 - PortUdp.clear(); // New with core3. Does what flush() did in core2; -#endif #ifdef ESP8266 + PortUdp.flush(); UdpCtx.disconnect(); +#else + PortUdp.clear(); // New with core3. Does what flush() did in core2; #endif #ifdef USE_DEVICE_GROUPS // stop @@ -133,7 +132,6 @@ void PollUdp(void) int32_t len = PortUdp.read(packet_buffer, UDP_BUFFER_SIZE -1); packet_buffer[len] = 0; -// 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 diff --git a/tasmota/tasmota_xdrv_driver/xdrv_01_9_webserver.ino b/tasmota/tasmota_xdrv_driver/xdrv_01_9_webserver.ino index de9b796ba..9f8434f32 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_01_9_webserver.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_01_9_webserver.ino @@ -775,7 +775,11 @@ void WSSend(int code, int ctype, const String& content) **********************************************************************************************/ void WSContentBegin(int code, int ctype) { +#ifdef ESP8266 Webserver->client().flush(); +#else + Webserver->client().clear(); // New with core3. Does what flush() did in core2; +#endif WSHeaderSend(); Webserver->setContentLength(CONTENT_LENGTH_UNKNOWN); WSSend(code, ctype, ""); // Signal start of chunked content @@ -3085,7 +3089,7 @@ void HandlePreflightRequest(void) // return a simple status page as text/plain code 200 static void WSReturnSimpleString(const char *msg) { if (nullptr == msg) { msg = ""; } - Webserver->client().flush(); + Webserver->client().clear(); // New with core3. Does what flush() did in core2; WSHeaderSend(); Webserver->send(200, "text/plain", msg); } diff --git a/tasmota/tasmota_xdrv_driver/xdrv_04_light_artnet.ino b/tasmota/tasmota_xdrv_driver/xdrv_04_light_artnet.ino index 342c662f8..076c4a757 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_04_light_artnet.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_04_light_artnet.ino @@ -245,7 +245,6 @@ void ArtNetLoop(void) uint8_t packet_buffer[WS2812_ARTNET_UDP_BUFFER_SIZE]; // buffer to hold incoming UDP/SSDP packet packet_len = ArtNetUdp->read(packet_buffer, WS2812_ARTNET_UDP_BUFFER_SIZE); -// ArtNetUdp->flush(); // Finish reading the current packet ArtNetUdp->clear(); // New with core3. Does what flush() did in core2; #endif // AddLog(LOG_LEVEL_DEBUG_MORE, PSTR("UDP: Packet %*_H (%d)"), 32, packet_buffer, packet_len); diff --git a/tasmota/tasmota_xdrv_driver/xdrv_10_scripter.ino b/tasmota/tasmota_xdrv_driver/xdrv_10_scripter.ino index b2316a0f3..6b2a3827b 100755 --- a/tasmota/tasmota_xdrv_driver/xdrv_10_scripter.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_10_scripter.ino @@ -1386,8 +1386,9 @@ int32_t udp_call(char *url, uint32_t port, char *sbuf) { udp.beginPacket(adr, port); udp.write((const uint8_t*)sbuf, strlen(sbuf)); udp.endPacket(); +#ifdef ESP8266 udp.flush(); -#ifdef ESP32 +#else udp.clear(); // New with core3. Does what flush() did in core2; #endif udp.stop(); @@ -1408,8 +1409,9 @@ void Restart_globvars(void) { void Script_Stop_UDP(void) { if (!glob_script_mem.udp_flags.udp_used) return; if (glob_script_mem.udp_flags.udp_connected) { +#ifdef ESP8266 glob_script_mem.Script_PortUdp.flush(); -#ifdef ESP32 +#else glob_script_mem.Script_PortUdp.clear(); // New with core3. Does what flush() did in core2; #endif glob_script_mem.Script_PortUdp.stop(); @@ -6392,7 +6394,11 @@ void tmod_directModeOutput(uint32_t pin); fvar = -1; if (glob_script_mem.tcp_server) { if (glob_script_mem.tcp_client.connected()) { +#ifdef ESP8266 glob_script_mem.tcp_client.flush(); +#else + glob_script_mem.tcp_client.clear(); +#endif fvar = 0; } } diff --git a/tasmota/tasmota_xdrv_driver/xdrv_52_3_berry_webserver.ino b/tasmota/tasmota_xdrv_driver/xdrv_52_3_berry_webserver.ino index 0349736ee..850c53a10 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_52_3_berry_webserver.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_52_3_berry_webserver.ino @@ -184,7 +184,7 @@ extern "C" { if (argc >= 2 && be_isint(vm, 1) && be_isstring(vm, 2)) { int32_t httpcode = be_toint(vm, 1); const char * mimetype = be_tostring(vm, 2); - Webserver->client().flush(); + Webserver->client().clear(); // New with core3. Does what flush() did in core2; WSHeaderSend(); Webserver->setContentLength(CONTENT_LENGTH_UNKNOWN); Webserver->send(httpcode, mimetype, ""); diff --git a/tasmota/tasmota_xdrv_driver/xdrv_63_modbus_bridge.ino b/tasmota/tasmota_xdrv_driver/xdrv_63_modbus_bridge.ino index f3031997b..5be255f3c 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_63_modbus_bridge.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_63_modbus_bridge.ino @@ -311,7 +311,11 @@ void ModbusBridgeHandle(void) client.write(modbusBridge.buffer + 2, 4); // Don't send CRC nrOfBytes += 4; } +#ifdef ESP8266 client.flush(); +#else + client.clear(); // New with core3. Does what flush() did in core2; +#endif AddLog(LOG_LEVEL_DEBUG, PSTR("MBS: MBRTCP from Modbus deviceAddress %d, writing %d bytes to client"), modbusBridge.buffer[0], nrOfBytes); } } diff --git a/tasmota/tasmota_xdrv_driver/xdrv_81_esp32_webcam.ino b/tasmota/tasmota_xdrv_driver/xdrv_81_esp32_webcam.ino index 904e73c84..e9344c328 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_81_esp32_webcam.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_81_esp32_webcam.ino @@ -884,7 +884,7 @@ void HandleImageBasic(void) { } if (_jpg_buf_len) { - Webserver->client().flush(); + Webserver->client().clear(); // New with core3. Does what flush() did in core2; WSHeaderSend(); Webserver->sendHeader(F("Content-disposition"), F("inline; filename=snapshot.jpg")); Webserver->send_P(200, "image/jpeg", (char *)_jpg_buf, _jpg_buf_len); @@ -925,7 +925,7 @@ void HandleWebcamMjpegTask(void) { WcStats.clientfail++; } if (1 == Wc.stream_active) { - Wc.client.flush(); + Wc.client.clear(); // New with core3. Does what flush() did in core2; Wc.client.setTimeout(3); AddLog(LOG_LEVEL_DEBUG, PSTR("CAM: Start stream")); Wc.client.print("HTTP/1.1 200 OK\r\n" @@ -990,7 +990,7 @@ void HandleWebcamMjpegTask(void) { } if (0 == Wc.stream_active) { AddLog(LOG_LEVEL_DEBUG, PSTR("CAM: Stream exit")); - Wc.client.flush(); + Wc.client.clear(); // New with core3. Does what flush() did in core2; Wc.client.stop(); } } diff --git a/tasmota/tasmota_xdrv_driver/xdrv_81_esp32_webcam_task.ino b/tasmota/tasmota_xdrv_driver/xdrv_81_esp32_webcam_task.ino index bf36b2f08..a9f9a3488 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_81_esp32_webcam_task.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_81_esp32_webcam_task.ino @@ -1888,7 +1888,7 @@ static void WCOperationTask(void *pvParameters){ WcStats.clientfail++; } if (1 == client->active) { - client->client.flush(); + client->client.clear(); // New with core3. Does what flush() did in core2; client->client.setTimeout(3); #ifdef WEBCAM_DEV_DEBUG AddLog(LOG_LEVEL_DEBUG, PSTR("CAM: Start stream")); diff --git a/tasmota/tasmota_xsns_sensor/xsns_53_sml.ino b/tasmota/tasmota_xsns_sensor/xsns_53_sml.ino index e33c324d0..a06feeac3 100755 --- a/tasmota/tasmota_xsns_sensor/xsns_53_sml.ino +++ b/tasmota/tasmota_xsns_sensor/xsns_53_sml.ino @@ -1550,7 +1550,11 @@ void sml_shift_in(uint32_t meters, uint32_t shard) { memmove(&mp->sbuff[0], &mp->sbuff[6], mp->sbsiz - 6); SML_Decode(meters); if (mp->client) { +#ifdef ESP8266 mp->client->flush(); +#else + mp->client->clear(); // New with core3. Does what flush() did in core2; +#endif } //Hexdump(mp->sbuff + 6, 10); }