Resolve RTS-timing problem

On some devices there is a timing problem with the RTS line, when not using flush.
flush does wait until all data is send: https://www.arduino.cc/reference/en/language/functions/communication/serial/flush/
This commit is contained in:
SteWers 2022-01-07 12:47:23 +01:00
parent c26742f9b5
commit 38886e987f
1 changed files with 1 additions and 0 deletions

View File

@ -162,6 +162,7 @@ void solaxX1_RS485Send(uint16_t msgLen)
solaxX1Serial->write(message, msgLen); solaxX1Serial->write(message, msgLen);
solaxX1Serial->write(highByte(crc)); solaxX1Serial->write(highByte(crc));
solaxX1Serial->write(lowByte(crc)); solaxX1Serial->write(lowByte(crc));
solaxX1Serial->flush();
if (PinUsed(GPIO_SOLAXX1_RTS)) { if (PinUsed(GPIO_SOLAXX1_RTS)) {
digitalWrite(Pin(GPIO_SOLAXX1_RTS), LOW); digitalWrite(Pin(GPIO_SOLAXX1_RTS), LOW);
} }