Troubleshooting

Screen

Color Reference

Color is set using \e[<c>m where <c> are numbers separated by semicolons (and \e is ESC, code 27). The actual color representation depends on a color theme which can be selected in Terminal Settings.

Foreground
30 31 32 33 34 35 36 37
90 91 92 93 94 95 96 97
Background
40 41 42 43 44 45 46 47
100 101 102 103 104 105 106 107

To make the text bold, use the "bold" attribute (eg. \e[31;40;1m for bold red on black).

The colors are reset to default using \e[0m. For more info, see the tables below.

User Input

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 buttons under the screen send ASCII codes 1, 2, 3, 4, 5. This choice was made to make their parsing as simple as possible.

Mouse input (click/tap) is sent as \e[<y>;<x>M. You can use this for virtual on-screen buttons.

Supported ANSI Escape Sequences

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.

Text Attributes

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
1 Bold
21 or 22 Bold off
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

Cursor

Movement commands scroll the screen if needed. The coordinates are 1-based, origin top left.

Code Params Meaning
\e[<n>A [count] Move cursor up
\e[<n>B [count] Move cursor down
\e[<n>C [count] Move cursor forward (right)
\e[<n>D [count] Move cursor backward (left)
\e[<n>E [count] Go N lines down, start of line
\e[<n>F [count] Go N lines up, start of line
\e[<n>G column Go to column
\e[<y>;<x>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
\e[?25h -- Show cursor
\e[?7l -- Disable cursor auto-wrap & auto-scroll at end of screen
\e[?7h -- Enable cursor auto-wrap & auto-scroll at end of screen

Screen

Code Params Meaning
\e[<m>J [mode=0] Clear screen. Mode: 0 - from cursor, 1 - to cursor, 2 - all
\e[<m>K [mode=0] Erase line. Mode: 0 - from cursor, 1 - to cursor, 2 - all
\e[<n>S [lines] Scroll screen content up, add empty line at the bottom
\e[<n>T [lines] Scroll screen content down, add empty line at the top
\e]W<r>;<c>\a rows;cols Set screen size (max ~ 80x30). This also clears the screen. This is a custom ESPTerm OSC command.

System Commands

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[5n -- Query device status, replies with \e[0n "device is OK". Can be used to check if the UART works.
ASCII 24 (18h) This symbol is sent by ESPTerm when it becomes ready to receive commands. It can be used to wait before it becomes ready on power-up, or to detect a spontaneous ESPTerm restart - that could happen due to RAM exhaustion due to a memory leak, or perhaps a power outage.