breadboard-os icon indicating copy to clipboard operation
breadboard-os copied to clipboard

Up/down arrows do not process over UART

Open mcknly opened this issue 1 year ago • 1 comments

The up/down arrows do not work to trigger the command history feature when using CLI over UART, however they do work with CLI over USB. It is believed that is because more bytes are buffered over USB, whereas with UART only a single byte is buffered/services at a time. This means that if multiple bytes are sent in series and the CLI task does not service them fast enough, they will be dropped. Up/down arrows use escape codes that are 3 bytes long, so instead of receiving \033[A (or ESC followed by ASCII [A) for example up arrow, the CLI will only receive and echo back the last byte A.

It may be possible to fix this with changes to RTOS task scheduling, otherwise may need to implement a multi-byte buffer for the CLI UART.

mcknly avatar Oct 31 '24 17:10 mcknly

Thinking this through more... as-is, microshell and the CLI task are written such that only one byte is serviced per OS tick (currently 1ms) - if we are able to determine a multi-byte escape sequence is coming in, it may be possible to hijack the state machine sequence so that it waits for the next bytes before returning. This would be a change in the microshell submodule.

mcknly avatar Jan 09 '25 23:01 mcknly