\e]W?;?\a
with rows;cols.Color is set using \e[?m
or \e[?;?m
where "?" are numbers from the following tables:
Bright foreground can also be set using the "bold" attribute 1 (eg. \e[31;1m
). For more details, see the ANSI code reference below.
All the user types on their keyboard is sent as-is to the UART, including ESC, ANSI sequences for arrow keys and CR-LF for Enter. The input is limited to ASCII codes 32-126, backspace 8 and tab 9.
The buttons under the screen send ASCII codes 1, 2, 3, 4, 5.
Mouse input (click/tap) is sent as \e?;?M
with row;column. You can use this for on-screen buttons, menu navigation etc.
Please note this is a custom sequence, not supported by PuTTY or other terminals.
Sequences are started by ASCII code 27 (ESC, \e
, \x1b
, \033
)
Instead of \a
(BELL, ASCII 7) in the commands, you can use `\e\` (ESC + backslash). It's the Text Separator code.
All text attributes are set using \e[...m
where the dots are numbers separated by semicolons.
You can combine up to 3 attributes in a single command.
Attribute | Meaning |
---|---|
0 | Reset text attributes to default |
7 | Inverse (fg/bg swap when printing) |
27 | Inverse OFF |
30-37, 90-97 | Foreground color, normal and bright |
40-47, 100-107 | Background color, normal and bright |
Movement commands scroll the screen if needed. The coordinates are 1-based, origin top left.
Code | Params | Meaning |
---|---|---|
\e[?A | [count] | Move cursor up |
\e[?B | [count] | Move cursor down |
\e[?C | [count] | Move cursor forward (right) |
\e[?D | [count] | Move cursor backward (left) |
\e[?E | [count] | Go N line down, start of line |
\e[?F | [count] | Go N lines up, start of line |
\e[?G | column | Go to column |
\e[?;?G | [row=1];[col=1] | Go to row and column |
\e[6n | -- | Query cursor position. Position is sent back as \e[?;?R with row;column. |
\e[s | -- | Store position |
\e[u | -- | Restore position |
\e7 | -- | Store position & attributes |
\e8 | -- | Restore position & attributes |
\e[?25l | -- | Hide cursor (literal question mark, lowercase L!) |
\e[?25h | -- | Show cursor (literal question mark!) |
Code | Params | Meaning |
---|---|---|
\e[?J | [mode=0] | Clear screen. Mode: 0 - from cursor, 1 - to cursor, 2 - all |
\e[?K | [mode=0] | Erase line. Mode: 0 - from cursor, 1 - to cursor, 2 - all |
\e[?S | [lines] | Scroll screen content up, add empty line at the bottom |
\e[?T | [lines] | Scroll screen content down, add empty line at the top |
\e]W?;?\a | rows;cols | Set screen size, maximum 25x80 (resp. total 2000 characters). This also clears the screen. |
Code | Params | Meaning |
---|---|---|
\ec | -- | "Device Reset" - clear screen, reset attributes, show cursor & move it to 1,1. The screen size and WiFi settings stay unchanged. |
\e]FR\a | -- | "Factory Reset", emergency code when you mess up the WiFi, restores SSID to unique default, clears stored credentials & enters Client+AP mode. |
\e[5n | -- | Query device status, replies with \e[0n "device is OK". Can be used to check if the UART works. |