XON/XOFF

For those wondering about using Xon/Xoff for terminal flow control. I tried the method below in Jan 2020 and it didn’t provide useful flow control with my USB/3.3v dongle, exactly as Matthias predicted. It all worked fine right up until the small UART buffers in my STM32F103 microcontroller were overun.

~BIG FAIL~

Note from Matthias:

The XON/XOFF mechanism is fine in theory, but often enough, there are buffers quite large in the USB-serial bridge, and the XON/XOFF characters reach the PC for effect when the small UART buffers in microcontroller have been already overflown far beyond their capacity. I think the RTS/CTS handshake is the better choice.

XON and XOFF should be inserted into quit, I think (untested by Matthias, tested by myself):

: handshake-quit ( -- )
  begin
    xon
    query
    xoff
    interpret
    ."  ok." cr
  again
;

' handshake-quit hook-quit ! quit