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

View File

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