     }
     else
     if(pinSupport[pinCTS])
-      uart_set_hw_flow_ctrl(UART_NUM_2,UART_HW_FLOWCTRL_RTS,SER_BUFSIZE);
+      uart_set_hw_flow_ctrl(UART_NUM_2,UART_HW_FLOWCTRL_CTS,SER_BUFSIZE);
   }
   else
     uart_set_hw_flow_ctrl(UART_NUM_2,UART_HW_FLOWCTRL_DISABLE,0);

    uint32_t invertMask = 0;
    if(pinSupport[pinCTS])
    {
      uart_set_pin(UART_NUM_2, UART_PIN_NO_CHANGE, UART_PIN_NO_CHANGE, pinCTS, /*cts_io_num*/UART_PIN_NO_CHANGE);
      // cts is input to me, output to true RS232
      if(ctsActive == 0)
        invertMask = invertMask | UART_INVERSE_RTS;
    }
    if(pinSupport[pinRTS])
    {
      uart_set_pin(UART_NUM_2, UART_PIN_NO_CHANGE, UART_PIN_NO_CHANGE, /*rts_io_num*/UART_PIN_NO_CHANGE, pinRTS);
      s_pinWrite(pinRTS, rtsActive);
      // rts is output to me, input to true RS232
      if(rtsActive == 0)
        invertMask = invertMask | UART_INVERSE_CTS;
    }
    uart_set_line_inverse(UART_NUM_2, invertMask);     
    //uart_set_hw_flow_ctrl(UART_NUM_2,UART_HW_FLOWCTRL_DISABLE,0);
    if(pinSupport[pinRTS])
    {
      if(pinSupport[pinCTS])


bool ZSerial::isSerialCancelled()
{
#ifndef ZIMODEM_ESP32
  if(flowControlType == FCT_RTSCTS)
  {
    if(pinSupport[pinCTS])
      return (digitalRead(pinCTS) == ctsInactive);
  }
#endif
  return false;
}

