Tune Tx Enable timing

This commit is contained in:
Theo Arends 2023-01-01 15:12:15 +01:00
parent 14ee8decf7
commit ed0b7d69b6
2 changed files with 4 additions and 2 deletions

View File

@ -424,6 +424,7 @@ size_t TasmotaSerial::write(uint8_t b) {
if (m_tx_enable_pin > -1) {
digitalWrite(m_tx_enable_pin, HIGH);
delayMicroseconds(10); // delay(1) will exception here
}
size_t size = 0;
if (m_hardserial) {
@ -460,7 +461,7 @@ size_t TasmotaSerial::write(uint8_t b) {
size = 1;
}
if (m_tx_enable_pin > -1) {
delayMicroseconds(800); // delay(1) will exception here
delayMicroseconds(10); // delay(1) will exception here
digitalWrite(m_tx_enable_pin, LOW);
}
return size;

View File

@ -157,10 +157,11 @@ uint8_t TasmotaModbus::Send(uint8_t device_address, uint8_t function_code, uint1
flush();
if (mb_tx_enable_pin > -1) {
digitalWrite(mb_tx_enable_pin, HIGH);
delayMicroseconds(10); // delay(1) will exception here
}
write(frame, framepointer);
if (mb_tx_enable_pin > -1) {
delayMicroseconds(800); // delay(1) will exception here
delayMicroseconds(10); // delay(1) will exception here
digitalWrite(mb_tx_enable_pin, LOW);
}
free(frame);