ESP32 DMX-controller (core mod ? )

I am making an attempt at creating a wifi-based (for the UI) DMX controller / receiver / recorder, using an ESP32, which in itself should be a very feasible project. The ESP32 is plenty fast and has 3 UART's that can work independently (and assignable to any pin :slight_smile: ) That support the 250000kbps BAUD-rate that DMX requires.
I am starting out using this library which uses this method for sending.

void DMXESPSerial::update() {
  if (dmxStarted == false) init();

  //Send break
  digitalWrite(sendPin, HIGH);
  Serial1.begin(BREAKSPEED, BREAKFORMAT);
  Serial1.write(0);
  Serial1.flush();
  delay(1);
  Serial1.end();

  //send data
  Serial1.begin(DMXSPEED, DMXFORMAT);
  digitalWrite(sendPin, LOW);
  Serial1.write(dmxData, chanSize);
  Serial1.flush();
  delay(1);
  Serial1.end();
}

And i am thinking that the .flush() in particular is holding up the program unnecessarily. (it blocks) and looking into HardwareSerial.cpp i get referenced

void HardwareSerial::flush()
{
    uartFlush(_uart);
}

and in esp-hal-uart.c i find

void uartFlush(uart_t* uart)
{
    if(uart == NULL) {
        return;
    }

    UART_MUTEX_LOCK();
    while(uart->dev->status.txfifo_cnt || uart->dev->status.st_utx_out);

    //Due to hardware issue, we can not use fifo_rst to reset uart fifo.
    //See description about UART_TXFIFO_RST and UART_RXFIFO_RST in <<esp32_technical_reference_manual>> v2.6 or later.

    // we read the data out and make `fifo_len == 0 && rd_addr == wr_addr`.
    while(uart->dev->status.rxfifo_cnt != 0 || (uart->dev->mem_rx_status.wr_addr != uart->dev->mem_rx_status.rd_addr)) {
        READ_PERI_REG(UART_FIFO_REG(uart->num));
    }

    xQueueReset(uart->queue);

    UART_MUTEX_UNLOCK();
}

Now what i want really is just confirmation that the buffer is empty (and the (3 byte ?) FIFO ) before i switch it off and either send the break and / or the frame.
Now my question is how to do that ? Since i am focusing on the tx i suspect the appropriate line is while(uart->dev->status.txfifo_cnt || uart->dev->status.st_utx_out);which holds up until that condition is false, so my function could look something like

boolean uartEmpty(uart_t* uart) 
 UART_MUTEX_LOCK();
 boolean empty = (uart->dev->status.txfifo_cnt || uart->dev->status.st_utx_out);
 UART_MUTEX_UNLOCK();
 return empty;
}

Any thoughts ?