Add flush before disabling tx (#17247)

This commit is contained in:
Theo Arends 2023-03-14 09:28:00 +01:00
parent bda32739a8
commit 1a6076c253
2 changed files with 2 additions and 0 deletions

View File

@ -460,6 +460,7 @@ size_t TasmotaSerial::write(uint8_t b) {
size = 1;
}
if (m_tx_enable_pin > -1) {
flush(); // Must wait for all data sent
digitalWrite(m_tx_enable_pin, LOW);
}
return size;

View File

@ -171,6 +171,7 @@ uint8_t TasmotaModbus::Send(uint8_t device_address, uint8_t function_code, uint1
write(frame, framepointer);
#ifdef TASMOTA_MODBUS_TX_ENABLE
if (mb_tx_enable_pin > -1) {
flush(); // Must wait for all data sent
digitalWrite(mb_tx_enable_pin, LOW);
}
#endif // TASMOTA_MODBUS_TX_ENABLE