See espterm.github.io

help.html 45KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6. <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no, maximum-scale=1">
  7. <title>Quick Reference :: ESPTerm</title>
  8. <link href="/css/app.8b43b1d-en.css" rel="stylesheet">
  9. <script src="/js/app.8b43b1d-en.js"></script>
  10. <script>
  11. var _root = location.host;
  12. var _demo = 1;
  13. </script>
  14. </head>
  15. <body class="cfg page-help">
  16. <div id="outer">
  17. <nav id="menu">
  18. <div id="brand" tabindex=0>ESPTerm<sup> DEMO</sup></div>
  19. <a href="term.html" class="icn-back">Back to Terminal</a>
  20. <a href="cfg_term.html" class="icn-terminal ">Terminal Settings</a><a href="cfg_wifi.html" class="icn-wifi ">WiFi Settings</a><a href="cfg_network.html" class="icn-network ">Network Settings</a><a href="cfg_system.html" class="icn-configure ">System Settings</a><a href="help.html" class="icn-help selected">Quick Reference</a><a href="about.html" class="icn-about ">About ESPTerm</a></nav>
  21. <div id="content">
  22. <img src="/img/loader.gif" alt="Loading…" id="loader">
  23. <h1>Quick Reference</h1>
  24. <div class="Box errors hidden">
  25. <span class="lead">Validation errors for:</span>&nbsp;<span class="list"></span>
  26. </div>
  27. <div class="Box message hidden"></div>
  28. <div class="Box errmessage hidden"></div>
  29. <div class="Box">
  30. <div noprint><a href="#" onclick="hpfold(1);return false">Expand all</a>&nbsp;|&nbsp;<a href="#" onclick="hpfold(0);return false">Collapse all</a><br>
  31. <span class="smallpad"></span>
  32. </div>
  33. <i>Note: This list of commands is not exhaustive.<br>There's a more detailed and technical
  34. <a href="https://espterm.github.io/docs/espterm-xterm.html">document</a> available online.</i>
  35. </div>
  36. <div class="Box fold">
  37. <h2>Tips & Troubleshooting</h2>
  38. <div class="Row v">
  39. <ul>
  40. <li><b>Communication UART (Rx, Tx)</b> can be configured in the <a href="cfg_system.html">System Settings</a>.
  41. <li><b>Boot log and debug messages</b> are available on pin <b>GPIO2</b> (P2) at 115200&#8239;baud, 1 stop bit, no parity.
  42. Those messages may be disabled through compile flags.
  43. <li><b>Loopback test</b>: Connect the Rx and Tx pins with a piece of wire. Anything you type in the browser should
  44. appear on the screen. Set <i>Parser Timeout = 0</i> in <a href="cfg_term.html">Terminal Settings</a>
  45. to be able to manually enter escape sequences.
  46. <li>Use Ctrl+F12 to open a screen debug panel. Additional debugging can be enabled in the
  47. <a href="cfg_term.html">Terminal Settings</a> (near the bottom).
  48. <li><b>For best performance</b>, use the module in Client mode (connected to external network) and minimize the number
  49. of simultaneous connections. Enabling AP consumes extra RAM because the DHCP server and Captive Portal
  50. DNS server are started.
  51. <li><b>Check that the WiFi channel used is clear</b>; interference may cause flaky connection.
  52. A good mobile app to use for this is
  53. <a href="https://play.google.com/store/apps/details?id=com.farproc.wifi.analyzer">WiFi Analyzer (Google Play)</a>.
  54. Adjust the hotspot strength and range using the <i>Tx Power setting</i>.
  55. <li>Hold the BOOT button (GPIO0 to GND) for ~1 second to force enable AP. Hold it for ~6 seconds to restore default settings.
  56. (This is indicated by the blue LED rapidly flashing). Default settings can be overwritten in the
  57. <a href="cfg_system.html">System Settings</a>.
  58. </ul>
  59. </div>
  60. </div>
  61. <div class="Box fold">
  62. <h2>Basic Intro & Nomenclature</h2>
  63. <div class="Row v">
  64. <img src="/img/vt100.jpg" class="aside" alt="VT102">
  65. <p>
  66. ESPTerm emulates VT102 (pictured) with some additions from later VT models and Xterm.
  67. All commonly used attributes and commands are supported.
  68. ESPTerm is capable of displaying ncurses applications such as <i>Midnight Commander</i> using <i>agetty</i>.
  69. </p>
  70. <p>
  71. ESPTerm accepts UTF-8 characters received on the communication UART and displays them on the screen,
  72. interpreting some codes as Control Characters. Those are e.g. <i>Carriage Return</i> (13), <i>Line Feed</i> (10),
  73. <i>Tab</i> (9), <i>Backspace</i> (8) and <i>Bell</i> (7).
  74. </p>
  75. <p>
  76. Escape sequences start with the control character <i>ESC</i> (27),
  77. followed by any number of ASCII characters forming the body of the command.
  78. </p>
  79. <h3>Nomenclature & Command Types</h3>
  80. <p>
  81. Examples on this help page use the following symbols for special characters and command types:<br>(spaces are for clarity only, <i>DO NOT</i> include them in the commands!)
  82. </p>
  83. <div class="tscroll">
  84. <table class="nomen">
  85. <thead><tr><th>Name</th><th>Symbol</th><th>ASCII</th><th>C string</th><th>Function</th></tr></thead>
  86. <tbody>
  87. <tr>
  88. <td><b>ESC</b></td>
  89. <td><code>\e</code></td>
  90. <td><code>ESC</code> (27)</td>
  91. <td><code>"\e"</code>, <code>"\x1b"</code>, <code>"\033"</code></td>
  92. <td>Introduces an escape sequence. <i>(Note: <code>\e</code> is a GCC extension)</i></td>
  93. </tr>
  94. <tr>
  95. <td><b>Bell</b></td>
  96. <td><code>\a</code></td>
  97. <td><code>BEL</code>&nbsp;(7)</td>
  98. <td><code>"\a"</code>, <code>"\x7"</code>, <code>"\07"</code></td>
  99. <td>Audible beep</td>
  100. </tr>
  101. <tr>
  102. <td><b>String Terminator</b></td>
  103. <td><code>ST</code></td>
  104. <td><code>ESC \</code>&nbsp;(27&nbsp;92)<br><i>or</i>&nbsp;<code>\a</code>&nbsp;(7)</td>
  105. <td><code>"\x1b\\"</code>, <code>"\a"</code></td>
  106. <td>Terminates a string command (<code>\a</code> can be used as an alternative)</td>
  107. </tr>
  108. <tr>
  109. <td><b>Control Sequence Introducer</b></td>
  110. <td><code>CSI</code></td>
  111. <td><code>ESC [</code></td>
  112. <td><code>"\x1b["</code></td>
  113. <td>Starts a CSI command. Examples: <code>\e[?7;10h</code>, <code>\e[2J</code></td>
  114. </tr>
  115. <tr>
  116. <td><b>Operating System Command</b></td>
  117. <td><code>OSC</code></td>
  118. <td><code>ESC ]</code></td>
  119. <td><code>"\x1b]"</code></td>
  120. <td>Starts an OSC command. Is followed by a command string terminated by <code>ST</code>. Example: <code>\e]0;My Screen Title\a</code></td>
  121. </tr>
  122. <tr>
  123. <td><b>Select Graphic Rendition</b></td>
  124. <td><code>SGR</code></td>
  125. <td><code>CSI <i>n</i>;<i>n</i>;<i>n</i>m</code></td>
  126. <td><code>"\x1b[1;2;3m"</code></td>
  127. <td>Set text attributes, like color or style. 0 to 10 numbers can be used, <code>\e[m</code> is treated as <code>\e[0m</code></td>
  128. </tr>
  129. </tbody>
  130. </table>
  131. </div>
  132. <p>There are also some other commands that don't follow the CSI, SGR or OSC pattern, such as <code>\e7</code> or
  133. <code>\e#8</code>. A list of the most important escape sequences is presented in the following sections.</p>
  134. </div>
  135. </div>
  136. <div class="Box fold">
  137. <h2>Screen Behavior & Refreshing</h2>
  138. <div class="Row v">
  139. <p>
  140. The initial screen size, title text and button labels can be configured
  141. in <a href="cfg_term.html">Terminal Settings</a>.
  142. </p>
  143. <p>
  144. Screen updates are sent to the browser through a WebSocket after some time of inactivity on the communication UART
  145. (called "Redraw Delay"). After an update is sent, at least a time of "Redraw Cooldown" must elapse before the next
  146. update can be sent. Those delays are used is to avoid burdening the server with tiny updates during a large screen
  147. repaint. If you experience issues (broken image due to dropped bytes), try adjusting those config options. It may also
  148. be useful to try different baud rates.
  149. </p>
  150. <h3>UTF-8 support</h3>
  151. <p>
  152. ESPTerm supports all UTF-8 characters, but to reduce the screen buffer RAM size,
  153. only a small amount of unique multi-byte characters can be used at the same time
  154. (up to 160, depending on compile flags). Unique multi-byte characters are stored in a
  155. look-up table and are removed when they are no longer used on the screen. In
  156. rare cases it can happen that a character stays in the table after no longer
  157. being used (this can be noticed when the table fills up and new characters
  158. are not shown correctly). This is fixed by clearing the screen (<code>\e[2J</code> or <code>\ec</code>).
  159. </p>
  160. </div>
  161. </div>
  162. <div class="Box fold">
  163. <h2>User Input: Keyboard, Mouse</h2>
  164. <div class="Row v">
  165. <h3>Keyboard</h3>
  166. <p>
  167. The user can input text using their keyboard, or on Android, using the on-screen keyboard which is open using
  168. a button beneath the screen. Supported are all printable characters, as well as many control keys, such as arrows, <i>Ctrl+letters</i>
  169. and function keys. Sequences sent by function keys are based on VT102 and Xterm.
  170. </p>
  171. <p>
  172. The codes sent by <i>Home</i>, <i>End</i>, <i>F1-F4</i> and cursor keys are affected by various keyboard modes (<i>Application Cursor Keys</i>,
  173. <i>Application Numpad Mode</i>, <i>SS3 Fn Keys Mode</i>). Some can be set in the <a href="cfg_term.html">Terminal Settings</a>,
  174. others via commands.
  175. </p>
  176. <p>
  177. Here are some examples of control key codes:
  178. </p>
  179. <div class="tscroll">
  180. <table>
  181. <thead><tr><th>Key</th><th>Code</th><th>Key</th><th>Code</th></tr></thead>
  182. <tr>
  183. <td>Up</td>
  184. <td><code>\e[A</code>,&nbsp;<code>\eOA</code></td>
  185. <td>F1</td>
  186. <td><code>\eOP</code>,&nbsp;<code>\e[11~</code></td>
  187. </tr>
  188. <tr>
  189. <td>Down</td>
  190. <td><code>\e[B</code>,&nbsp;<code>\eOB</code></td>
  191. <td>F2</td>
  192. <td><code>\eOQ</code>,&nbsp;<code>\e[12~</code></td>
  193. </tr>
  194. <tr>
  195. <td>Right</td>
  196. <td><code>\e[C</code>,&nbsp;<code>\eOC</code></td>
  197. <td>F3</td>
  198. <td><code>\eOR</code>,&nbsp;<code>\e[13~</code></td>
  199. </tr>
  200. <tr>
  201. <td>Left</td>
  202. <td><code>\e[D</code>,&nbsp;<code>\eOD</code></td>
  203. <td>F4</td>
  204. <td><code>\eOS</code>,&nbsp;<code>\e[14~</code></td>
  205. </tr>
  206. <tr>
  207. <td>Home</td>
  208. <td><code>\eOH</code>,&nbsp;<code>\e[H</code>,&nbsp;<code>\e[1~</code></td>
  209. <td>F5</td>
  210. <td><code>\e[15&nbsp;</code></td>
  211. </tr>
  212. <tr>
  213. <td>End</td>
  214. <td><code>\eOF</code>,&nbsp;<code>\e[F</code>,&nbsp;<code>\e[4~</code></td>
  215. <td>F6</td>
  216. <td><code>\e[17~</code></td>
  217. </tr>
  218. <tr>
  219. <td>Insert</td>
  220. <td><code>\e[2~</code></td>
  221. <td>F7</td>
  222. <td><code>\e[18~</code></td>
  223. </tr>
  224. <tr>
  225. <td>Delete</td>
  226. <td><code>\e[3~</code></td>
  227. <td>F8</td>
  228. <td><code>\e[19~</code></td>
  229. </tr>
  230. <tr>
  231. <td>Page Up</td>
  232. <td><code>\e[5~</code></td>
  233. <td>F9</td>
  234. <td><code>\e[20~</code></td>
  235. </tr>
  236. <tr>
  237. <td>Page Down</td>
  238. <td><code>\e[6~</code></td>
  239. <td>F10</td>
  240. <td><code>\e[21~</code></td>
  241. </tr>
  242. <tr>
  243. <td>Enter</td>
  244. <td><code>\r</code> (13)</td>
  245. <td>F11</td>
  246. <td><code>\e[23~</code></td>
  247. </tr>
  248. <tr>
  249. <td>Ctrl+Enter</td>
  250. <td><code>\n</code> (10)</td>
  251. <td>F12</td>
  252. <td><code>\e[24~</code></td>
  253. </tr>
  254. <tr>
  255. <td>Tab</td>
  256. <td><code>\t</code> (9)</td>
  257. <td>ESC</td>
  258. <td><code>\e</code> (27)</td>
  259. </tr>
  260. <tr>
  261. <td>Backspace</td>
  262. <td><code>\b</code> (8)</td>
  263. <td>Ctrl+A..Z</td>
  264. <td>ASCII 1-26</td>
  265. </tr>
  266. </table>
  267. </div>
  268. <h3>Action buttons</h3>
  269. <p>
  270. The blue buttons under the screen send ASCII codes 1, 2, 3, 4, 5, which incidentally
  271. correspond to <i>Ctrl+A,B,C,D,E</i>. This choice was made to make button press parsing as simple as possible.
  272. </p>
  273. <h3>Mouse</h3>
  274. <p>
  275. ESPTerm implements standard mouse tracking modes based on Xterm. Mouse tracking can be used to implement
  276. powerful user interactions such as on-screen buttons, draggable sliders or dials, menus etc. ESPTerm's
  277. mouse tracking was tested using VTTest and should be compatible with all terminal applications
  278. that request mouse tracking.
  279. </p>
  280. <p>
  281. Mouse can be tracked in different ways; some are easier to parse, others more powerful. The coordinates
  282. can also be encoded in different ways. All mouse tracking options are set using option commands:
  283. <code>CSI ? <i>n</i> h</code> to enable, <code>CSI ? <i>n</i> l</code> to disable option <i>n</i>.
  284. </p>
  285. <h4>Mouse Tracking Modes</h4>
  286. <p>
  287. All tracking modes produce three numbers which are then encoded and send to the application.
  288. First is the <i>event number</i> N, then the <i>X and Y coordinates</i>, 1-based.
  289. </p>
  290. <p>
  291. Mouse buttons are numbered: 1=left, 2=middle, 3=right.
  292. Wheel works as two buttons (4 and 5) which generate only press events (no release).
  293. </p>
  294. <div class="tscroll">
  295. <table class="nomen">
  296. <thead><tr><th>Option</th><th>Name</th><th>Description</th></tr></thead>
  297. <tr>
  298. <td><code>9</code></td>
  299. <td><b>X10&nbsp;mode</b></td>
  300. <td>
  301. This is the most basic tracking mode, in which <b>only button presses</b> are reported.
  302. N = button - 1: (0 left, 1 middle, 2 right, 3, 4 wheel).
  303. </td>
  304. </tr>
  305. <tr>
  306. <td><code>1000</code></td>
  307. <td><b>Normal&nbsp;mode</b></td>
  308. <td>
  309. In Normal mode, both button presses and releases are reported.
  310. The lower two bits of N indicate the button pressed:
  311. <code>00b</code> (0) left, <code>01b</code> (1) middle, <code>10b</code> (2) right, <code>11b</code> (3) button release.
  312. Wheel buttons are reported as 0 and 1 with added 64 (e.g. 64 and 65).
  313. Normal mode also supports tracking of modifier keys, which are added to N as bit masks:
  314. 4=<i>Shift</i>, 8=<i>Meta/Alt</i>, 16=<i>Control/Cmd</i>. Example: middle button with <i>Shift</i> = 1 + 4 = <code>101b</code> (5).
  315. </td>
  316. </tr>
  317. <tr>
  318. <td><code>1002</code></td>
  319. <td><b>Button-Event tracking</b></td>
  320. <td>
  321. This is similar to Normal mode (<code>1000</code>), but mouse motion with a button held is also reported.
  322. A motion event is generated when the mouse cursor moves between screen character cells.
  323. A motion event has the same N as a press event, but 32 is added.
  324. For example, drag-drop event with the middle button will produce N = 1 (press), 33 (dragging) and 3 (release).
  325. </td>
  326. </tr>
  327. <tr>
  328. <td><code>1003</code></td>
  329. <td><b>Any-Event tracking</b></td>
  330. <td>
  331. This mode is almost identical to Button Event tracking (1002), but motion events
  332. are sent even when no mouse buttons are held. This could be used to draw on-screen mouse cursor, for example.
  333. Motion events with no buttons will use N = 32 + <i>11b</i> (35).
  334. </td>
  335. </tr>
  336. <tr>
  337. <td><code>1004</code></td>
  338. <td><b>Focus&nbsp;tracking</b></td>
  339. <td>
  340. Focus tracking is a separate function from the other mouse tracking modes, therefore they can be enabled together.
  341. Focus tracking reports when the terminal window (in Xterm) gets or loses focus, or in ESPTerm's case, when any
  342. user is connected. This can be used to pause/resume a game or on-screen animations.
  343. Focus tracking mode sends <code>CSI I</code> when the terminal receives, and <code>CSI O</code> when it loses focus.
  344. </td>
  345. </tr>
  346. </table>
  347. </div>
  348. <h4>Mouse Report Encoding</h4>
  349. <p>
  350. The following encoding schemes can be used with any of the tracking modes (except Focus tracking, which is not affected).
  351. </p>
  352. <div class="tscroll">
  353. <table class="nomen">
  354. <thead><tr><th>Option</th><th>Name</th><th>Description</th></tr></thead>
  355. <tr>
  356. <td>--</td>
  357. <td><b>Normal&nbsp;encoding</b></td>
  358. <td>
  359. This is the default encoding scheme used when no other option is selected.
  360. In this mode, a mouse report has the format <code>CSI M <i>n</i> <i>x</i> <i>y</i></code>,
  361. where <i>n</i>, <i>x</i> and <i>y</i> are characters with ASCII value = 32 (space) + the respective number, e.g.
  362. 0 becomes 32 (space), 1 becomes 33 (!). The reason for adding 32 is to avoid producing control characters.
  363. Example: <code>\e[M !!</code> - left button press at coordinates 1,1 when using X10 mode.
  364. </td>
  365. </tr>
  366. <tr>
  367. <td><code>1005</code></td>
  368. <td><b>UTF-8&nbsp;encoding</b></td>
  369. <td>
  370. This scheme should encode each of the numbers as a UTF-8 code point, expanding the maximum possible value.
  371. Since ESPTerm's screen size is limited and this has no practical benefit, this serves simply as an alias
  372. to the normal scheme.
  373. </td>
  374. </tr>
  375. <tr>
  376. <td><code>1006</code></td>
  377. <td><b>SGR&nbsp;encoding</b></td>
  378. <td>
  379. In SGR encoding, the response looks like a SGR sequence with the three numbers as semicolon-separated
  380. ASCII values. In this case 32 is not added like in the Normal and UTF-8 schemes, because
  381. it would serve nor purpose here. Also, button release is not reported as 11b,
  382. but using the normal button code while changing the final SGR character: <code>M</code> for button press
  383. and <code>m</code> for button release. Example: <code>\e[2;80;24m</code> - the right button was released
  384. at row 80, column 24.
  385. </td>
  386. </tr>
  387. <tr>
  388. <td><code>1015</code></td>
  389. <td><b>URXVT&nbsp;encoding</b></td>
  390. <td>
  391. This is similar to SGR encoding, but the final character is always <code>M</code> and the numbers are
  392. like in the Normal scheme, with 32 added. This scheme has no real advantage over the previous schemes and
  393. was added solely for completeness.
  394. </td>
  395. </tr>
  396. </table>
  397. </div>
  398. </div>
  399. </div>
  400. <div class="Box fold">
  401. <h2>Alternate Character Sets</h2>
  402. <div class="Row v">
  403. <p>
  404. ESPTerm implements Alternate Character Sets as a way to print box drawing characters
  405. and special symbols. A character set can change what each received ASCII character
  406. is printed as on the screen (eg. "{" is "π" in codepage <code>0</code>). The implementation is based
  407. on the original VT devices.
  408. </p>
  409. <p>
  410. Since ESPTerm also supports UTF-8, this feature is the most useful for applications
  411. which can't print UTF-8 or already use alternate character sets for historical reasons.
  412. </p>
  413. <h3>Supported codepages</h3>
  414. <ul>
  415. <li><code>B</code> - US ASCII (default)</li>
  416. <li><code>A</code> - UK ASCII: # replaced with £</li>
  417. <li><code>0</code> - Symbols and basic line drawing (standard DEC alternate character set)</li>
  418. <li><code>1</code> - Symbols and advanced line drawing (based on DOS codepage 437, ESPTerm specific)</li>
  419. <li><code>2</code> - Block characters and thick line drawing (ESPTerm specific)</li>
  420. <li><code>3</code> - Extra line drawing (ESPTerm specific)</li>
  421. </ul>
  422. <p>
  423. All codepages use codes 32-127, 32 being space. A character with no entry in the active codepage
  424. stays unchanged.
  425. </p>
  426. <script>
  427. function bchst(start, str) {
  428. var ar = str.split(' ');
  429. for(var i=0;i<ar.length;i++) {
  430. var a = String.fromCharCode(start+i);
  431. var r = ar[i];
  432. document.write('<div'+(r===a?' class="none"':'')+'><span>'+(start+i)+'</span><span>'+$.htmlEscape(a)+'</span><span>'+$.htmlEscape(r)+'</span></div>');
  433. }
  434. }
  435. </script>
  436. <h4>Codepage <code>0</code></h4>
  437. <div class="charset"><script>bchst(96,"♦ ▒ ␉ ␌ ␍ ␊ ° ± ␤ ␋ ┘ ┐ ┌ └ ┼ ⎺ ⎻ ─ ⎼ ⎽ ├ ┤ ┴ ┬ │ ≤ ≥ π ≠ £ ·")</script></div><h4>Codepage <code>1</code></h4>
  438. <div class="charset"><script>bchst(33,"☺ ☻ ♥ ♦ ♣ ♠ • ⌛ ○ ↯ ♪ ♫ ☼ ⌂ ☢ ░ ▒ ▓ │ ┤ ╡ ╢ ╖ ╕ ╣ ║ ╗ ╝ ╜ ╛ ┐ └ ┴ ┬ ├ ─ ┼ ╞ ╟ ╚ ╔ ╩ ╦ ╠ ═ ╬ ╧ ╨ ╤ ╥ ╙ ╘ ╒ ╓ ╫ ╪ ┘ ┌ █ ▄ ▌ ▐ ▀ ↕ ↑ ↓ → ← ↔ ▲ ▼ ► ◄ ◢ ◣ ◤ ◥ ╭ ╮ ╯ ╰ ╱ ╲ ╳ ↺ ↻ ¶ ⏻     ✔ ✘")</script></div><h4>Codepage <code>2</code></h4>
  439. <div class="charset"><script>bchst(33,"▁ ▂ ▃ ▄ ▅ ▆ ▇ █ ▉ ▊ ▋ ▌ ▍ ▎ ▏ ▔ ▕ ▐ ▀ ▘ ▝ ▗ ▖ ▟ ▙ ▛ ▜ ▞ ▚ ━ ┃ ┍ ┎ ┏ ┑ ┒ ┓ ┕ ┖ ┗ ┙ ┚ ┛ ┝ ┞ ┟ ┠ ┡ ┢ ┣ ┥ ┦ ┧ ┨ ┩ ┪ ┫ ┭ ┮ ┯ ┰ ┱ ┲ ┳ ┵ ┶ ┷ ┸ ┹ ┺ ┻ ┽ ┾ ┿ ╀ ╁ ╂ ╃ ╄ ╅ ╆ ╇ ╈ ╉ ╊ ╋ ╴ ╵ ╶ ╷ ╸ ╹ ╺ ╻")</script></div><h4>Codepage <code>3</code></h4>
  440. <div class="charset"><script>bchst(33,"╌ ┄ ┈ ╍ ┅ ┉ ╎ ┆ ┊ ╏ ┇ ┋ ╼ ╽ ╾ ╿")</script></div>
  441. <h3>Codepage switching commands</h3>
  442. <p>
  443. There are two character set slots, G0 and G1.
  444. Those slots are selected as active using ASCII codes Shift In and Shift Out (those originally served for shifting
  445. a red-black typewriter tape). Often only G0 is used for simplicity.
  446. </p>
  447. <p>
  448. Each slot (G0 and G1) can have a different codepage assigned. G0 and G1 and the active slot number are
  449. saved and restored with the cursor and cleared with a screen reset (<code>\ec</code>).
  450. </p>
  451. <p>The following commands are used:</p>
  452. <table class="ansiref w100">
  453. <thead><tr><th>Code</th><th>Meaning</th></tr></thead>
  454. <tbody>
  455. <tr>
  456. <td><code>\e(<i>x</i></code></td>
  457. <td>Set G0 = codepage <i>x</i></td>
  458. </tr>
  459. <tr>
  460. <td><code>\e)<i>x</i></code></td>
  461. <td>Set G1 = codepage <i>x</i></td>
  462. </tr>
  463. <tr>
  464. <td><i>SO</i> (14)</td>
  465. <td>Activate G0</td>
  466. </tr>
  467. <tr>
  468. <td><i>SI</i> (15)</td>
  469. <td>Activate G1</td>
  470. </tr>
  471. </table>
  472. </div>
  473. </div>
  474. <div class="Box fold">
  475. <h2>Commands: Style Attributes</h2>
  476. <div class="Row v">
  477. <p>
  478. All text attributes are set using SGR commands like <code>\e[1;4m</code>, with up to 10 numbers separated by semicolons.
  479. To restore all attributes to their default states, use SGR 0: <code>\e[0m</code> or <code>\e[m</code>.
  480. </p>
  481. <p>Those are the supported text attributes SGR codes:</p>
  482. <table>
  483. <thead><tr><th>Style</th><th>Enable</th><th>Disable</th></tr></thead>
  484. <tbody>
  485. <tr><td><b>Bold</b></td><td>1</td><td>21, 22</td></tr>
  486. <tr><td style="opacity:.6">Faint</td><td>2</td><td>22</td></tr>
  487. <tr><td><i>Italic</i></td><td>3</td><td>23</td></tr>
  488. <tr><td><u>Underlined</u></td><td>4</td><td>24</td></tr>
  489. <tr><td><s>Striked</s></td><td>9</td><td>29</td></tr>
  490. <tr><td style="text-decoration: overline;">Overline</td><td>53</td><td>55</td></tr>
  491. <tr><td><span id="blinkdemo">Blink</span></td><td>5</td><td>25</td></tr>
  492. <tr><td><span style="color:black;background:#ccc;">Inverse</span></td><td>7</td><td>27</td></tr>
  493. <tr><td>𝔉𝔯𝔞𝔨𝔱𝔲𝔯</td><td>20</td><td>23</td></tr>
  494. <tr><td>Conceal<sup>1</sup></td><td>8</td><td>28</td></tr>
  495. </tbody>
  496. </table>
  497. <p><sup>1</sup>Conceal turns all characters invisible.</p>
  498. </div>
  499. </div>
  500. <script>
  501. setInterval(function() {
  502. qs('#blinkdemo').className='';
  503. setTimeout(function() {
  504. qs('#blinkdemo').className='invisible';
  505. }, 750);
  506. }, 1000);
  507. </script>
  508. <div class="Box fold">
  509. <h2>Commands: Color Attributes</h2>
  510. <div class="Row v">
  511. <p>
  512. Colors are set using SGR commands (like <code>\e[30;47m</code>). The following tables list the SGR
  513. codes to use. Selected colors are used for any new text entered, as well as for empty
  514. space when using clearing commands (except screen reset <code>\ec</code>, which first clears all
  515. style attriutes. The configured default colors can be restored using <code>SGR 39</code> for
  516. foreground and <code>SGR 49</code> for background.
  517. </p>
  518. <p>
  519. The actual color representation of the basic 16 colors depends on a color theme which
  520. can be selected in <a href="cfg_term.html">Terminal Settings</a>.
  521. </p>
  522. <p>
  523. Background image can be set using <code>\e]70;<i>url</i>\a</code> (see section System Functions).
  524. </p>
  525. <h3>Foreground colors</h3>
  526. <div class="colorprev">
  527. <span data-bg="0" data-fg="0" style="text-shadow: 0 0 3px white;">30</span><!--
  528. --><span data-bg="0" data-fg="1">31</span><!--
  529. --><span data-bg="0" data-fg="2">32</span><!--
  530. --><span data-bg="0" data-fg="3">33</span><!--
  531. --><span data-bg="0" data-fg="4">34</span><!--
  532. --><span data-bg="0" data-fg="5">35</span><!--
  533. --><span data-bg="0" data-fg="6">36</span><!--
  534. --><span data-bg="0" data-fg="7">37</span>
  535. </div>
  536. <div class="colorprev">
  537. <span data-bg="0" data-fg="8">90</span><!--
  538. --><span data-bg="0" data-fg="9">91</span><!--
  539. --><span data-bg="0" data-fg="10">92</span><!--
  540. --><span data-bg="0" data-fg="11">93</span><!--
  541. --><span data-bg="0" data-fg="12">94</span><!--
  542. --><span data-bg="0" data-fg="13">95</span><!--
  543. --><span data-bg="0" data-fg="14">96</span><!--
  544. --><span data-bg="0" data-fg="15">97</span>
  545. </div>
  546. <h3>Background colors</h3>
  547. <div class="colorprev">
  548. <span data-bg="0" data-fg="15">40</span><!--
  549. --><span data-bg="1" data-fg="15">41</span><!--
  550. --><span data-bg="2" data-fg="15">42</span><!--
  551. --><span data-bg="3" data-fg="0">43</span><!--
  552. --><span data-bg="4" data-fg="15">44</span><!--
  553. --><span data-bg="5" data-fg="15">45</span><!--
  554. --><span data-bg="6" data-fg="15">46</span><!--
  555. --><span data-bg="7" data-fg="0">47</span>
  556. </div>
  557. <div class="colorprev">
  558. <span data-bg="8" data-fg="15">100</span><!--
  559. --><span data-bg="9" data-fg="0">101</span><!--
  560. --><span data-bg="10" data-fg="0">102</span><!--
  561. --><span data-bg="11" data-fg="0">103</span><!--
  562. --><span data-bg="12" data-fg="15">104</span><!--
  563. --><span data-bg="13" data-fg="0">105</span><!--
  564. --><span data-bg="14" data-fg="0">106</span><!--
  565. --><span data-bg="15" data-fg="0">107</span>
  566. </div>
  567. <h3>256-color palette</h3>
  568. <p>
  569. ESPTerm supports in total 256 standard colors. The dark and bright basic colors are
  570. numbered 0-7 and 8-15. To use colors higher than 15 (or 0-15 using this simpler numbering),
  571. send <code>CSI 38 ; 5 ; <i>n</i> m</code>, where <code>n</code> is the color to set. Use <code>CSI 48 ; 5 ; <i>n</i> m</code> for background colors.
  572. </p>
  573. <div class="colorprev" id="pal256">
  574. </div>
  575. </div>
  576. </div>
  577. <script>
  578. $.ready(function() {
  579. var wrap = qs('#pal256');
  580. var table = themes.buildColorTable();
  581. for (var i = 0; i < 256; i++) {
  582. var el = document.createElement('span')
  583. var clr = table[i]
  584. if (i < 16) {
  585. clr = themes.themes[1][i]
  586. }
  587. el.style.color = 'black'
  588. if ( i < 7 || i == 12 || i == 8 ||
  589. (i >= 16 && i <= 33) ||
  590. (i >= 52 && i <= 69) ||
  591. (i >= 88 && i <= 99) ||
  592. (i >= 124 && i <= 129)) {
  593. el.style.color = 'white'
  594. }
  595. el.textContent = ""+i
  596. el.style.backgroundColor = clr
  597. wrap.appendChild(el)
  598. if (i==15||(i-16)%24==23) {
  599. el = document.createElement('br')
  600. wrap.appendChild(el)
  601. }
  602. }
  603. });
  604. </script>
  605. <div class="Box fold">
  606. <h2>Commands: Cursor Functions</h2>
  607. <div class="Row v">
  608. <p>
  609. The coordinates are 1-based, origin is top left. The cursor can move within the entire screen,
  610. or in the active Scrolling Region if Origin Mode is enabled.
  611. </p>
  612. <p>After writing a character, the cursor advances to the right. If it has reached the end of the row,
  613. it stays on the same line, but writing the next character makes it jump to the start of the next
  614. line first, scrolling up if needed. If Auto-wrap mode is disabled, the cursor never wraps or scrolls
  615. the screen.
  616. </p>
  617. <p>
  618. <b>Legend:</b>
  619. Italic letters such as <i>n</i> are ASCII numbers that serve as arguments, separated with a semicolon.
  620. If an argument is left out, it's treated as 0 or 1, depending on what makes sense for the command.
  621. </p>
  622. <h3>Movement</h3>
  623. <table class="ansiref w100">
  624. <thead><tr><th>Code</th><th>Meaning</th></tr></thead>
  625. <tbody>
  626. <tr>
  627. <td>
  628. <code>
  629. \e[<i>n</i>A<br>\e[<i>n</i>B<br>\e[<i>n</i>C<br>\e[<i>n</i>D
  630. </code>
  631. </td>
  632. <td>Move cursor up (<code>A</code>), down (<code>B</code>), right (<code>C</code>), left (<code>D</code>)</td>
  633. </tr>
  634. <tr>
  635. <td>
  636. <code>
  637. \e[<i>n</i>F<br>\e[<i>n</i>E
  638. </code>
  639. </td>
  640. <td>Go <i>n</i> lines up (<code>F</code>) or down (<code>E</code>), start of line</td>
  641. </tr>
  642. <tr>
  643. <td>
  644. <code>
  645. \e[<i>r</i>d<br>\e[<i>c</i>G<br>\e[<i>r</i>;<i>c</i>H
  646. </code>
  647. </td>
  648. <td>
  649. Go to absolute position - row (<code>d</code>), column (<code>G</code>), or both (<code>H</code>). Use <code>\e[H</code> to go to 1,1.
  650. </td>
  651. </tr>
  652. <tr>
  653. <td>
  654. <code>\e[6n</code>
  655. </td>
  656. <td>
  657. Query cursor position. Sent back as <code>\e[<i>r</i>;<i>c</i>R</code>.
  658. </td>
  659. </tr>
  660. </tbody>
  661. </table>
  662. <h3>Save / restore</h3>
  663. <table class="ansiref w100">
  664. <thead><tr><th>Code</th><th>Meaning</th></tr></thead>
  665. <tbody>
  666. <tr>
  667. <td>
  668. <code>
  669. \e[s<br>\e[u
  670. </code>
  671. </td>
  672. <td>Save (<code>s</code>) or restore (<code>u</code>) cursor position</td>
  673. </tr>
  674. <tr>
  675. <td>
  676. <code>
  677. \e7<br>\e8
  678. </code>
  679. </td>
  680. <td>Save (<code>7</code>) or restore (<code>8</code>) cursor position and attributes</td>
  681. </tr>
  682. </tbody>
  683. </table>
  684. <h3>Scrolling Region</h3>
  685. <table class="ansiref w100">
  686. <thead><tr><th>Code</th><th>Meaning</th></tr></thead>
  687. <tbody>
  688. <tr>
  689. <td>
  690. <code>\e[<i>a</i>;<i>b</i>r</code>
  691. </td>
  692. <td>
  693. Set scrolling region to rows <i>a</i> through <i>b</i> and go to 1,1. By default, the
  694. scrolling region spans the entire screen height. The cursor can leave the region using
  695. absolute position commands, unless Origin Mode (see below) is active.
  696. </td>
  697. </tr>
  698. <tr>
  699. <td>
  700. <code>
  701. \e[?6h<br>\e[?6l
  702. </code>
  703. </td>
  704. <td>
  705. Enable (<code>h</code>) or disable (<code>l</code>) Origin Mode and go to 1,1. In Origin Mode, all coordinates
  706. are relative to the Scrolling Region and the cursor can't leave the region.
  707. </td>
  708. </tr>
  709. <tr>
  710. <td>
  711. <code>
  712. \e[<i>n</i>S<br>\e[<i>n</i>T
  713. </code>
  714. </td>
  715. <td>
  716. Move contents of the Scrolling Region up (<code>S</code>) or down (<code>T</code>), pad with empty
  717. lines of the current background color. This is similar to what happens when AutoWrap
  718. is enabled and some text is printed at the very end of the screen.
  719. </td>
  720. </tr>
  721. </tbody>
  722. </table>
  723. <h3>Tab stops</h3>
  724. <table class="ansiref w100">
  725. <thead><tr><th>Code</th><th>Meaning</th></tr></thead>
  726. <tbody>
  727. <tr>
  728. <td>
  729. <code>\eH</code>
  730. </td>
  731. <td>
  732. Set tab stop at the current column. There are, by default, tabs every 8 columns.
  733. </td>
  734. </tr>
  735. <tr>
  736. <td>
  737. <code>
  738. \e[<i>n</i>I<br>\e[<i>n</i>Z
  739. </code>
  740. </td>
  741. <td>Advance (<code>I</code>) or go back (<code>Z</code>) <i>n</i> tab stops or end/start of line. ASCII <i>TAB</i> (9) is equivalent to <code>\e[1I</code></td>
  742. </tr>
  743. <tr>
  744. <td>
  745. <code>
  746. \e[0g<br>\e[3g<br></code>
  747. </td>
  748. <td>Clear tab stop at the current column (<code>0</code>), or all columns (<code>3</code>).</td>
  749. </tr>
  750. </tbody>
  751. </table>
  752. <h3>Other options</h3>
  753. <table class="ansiref w100">
  754. <thead><tr><th>Code</th><th>Meaning</th></tr></thead>
  755. <tbody>
  756. <tr>
  757. <td>
  758. <code>
  759. \e[?7h<br>\e[?7l
  760. </code>
  761. </td>
  762. <td>Enable (<code>h</code>) or disable (<code>l</code>) cursor auto-wrap and screen auto-scroll</td>
  763. </tr>
  764. <tr>
  765. <td>
  766. <code>
  767. \e[?12h<br>\e[?12l
  768. </code>
  769. </td>
  770. <td>Toggle cursor blinking (<code>h</code> on, <code>l</code> off)</td>
  771. </tr>
  772. <tr>
  773. <td>
  774. <code>
  775. \e[?25h<br>\e[?25l
  776. </code>
  777. </td>
  778. <td>Show (<code>h</code>) or hide (<code>l</code>) the cursor</td>
  779. </tr>
  780. <tr>
  781. <td>
  782. <code>
  783. \e[?45h<br>\e[?45l
  784. </code>
  785. </td>
  786. <td>Enable (<code>h</code>) or disable (<code>l</code>) reverse wrap-around (when using "move left" or backspace)</td>
  787. </tr>
  788. </tbody>
  789. </table>
  790. </div>
  791. </div>
  792. <div class="Box fold">
  793. <h2>Commands: Screen Functions</h2>
  794. <div class="Row v">
  795. <p>
  796. <b>Legend:</b>
  797. Italic letters such as <i>n</i> are ASCII numbers that serve as arguments, separated with a semicolon.
  798. If an argument is left out, it's treated as 0 or 1, depending on what makes sense for the command.
  799. </p>
  800. <h3>Erasing &amp; Inserting</h3>
  801. <table class="ansiref w100">
  802. <thead><tr><th>Code</th><th>Meaning</th></tr></thead>
  803. <tbody>
  804. <tr>
  805. <td><code>\e[<i>m</i>J</code></td>
  806. <td>
  807. Clear part of screen. <i>m</i>: 0 - from cursor, 1 - to cursor, 2 - all
  808. </td>
  809. </tr>
  810. <tr>
  811. <td><code>\e[<i>m</i>K</code></td>
  812. <td>
  813. Erase part of line. <i>m</i>: 0 - from cursor, 1 - to cursor, 2 - all
  814. </td>
  815. </tr>
  816. <tr>
  817. <td><code>\e[<i>n</i>X</code></td>
  818. <td>
  819. Erase <i>n</i> characters in line.
  820. </td>
  821. </tr>
  822. <tr>
  823. <td><code>
  824. \e[<i>n</i>L<br>\e[<i>n</i>M
  825. </code></td>
  826. <td>
  827. Insert (<code>L</code>) or delete (<code>M</code>) <i>n</i> lines. Following lines are pulled up or pushed down.
  828. </td>
  829. </tr>
  830. <tr>
  831. <td><code>
  832. \e[<i>n</i>@<br>\e[<i>n</i>P
  833. </code></td>
  834. <td>
  835. Insert (<code>@</code>) or delete (<code>P</code>) <i>n</i> characters. The rest of the line is pulled left or pushed right.
  836. Characters going past the end of line are lost.
  837. </td>
  838. </tr>
  839. </tbody>
  840. </table>
  841. <h3>Supersized lines</h3>
  842. <table class="ansiref w100">
  843. <thead><tr><th>Code</th><th>Meaning</th></tr></thead>
  844. <tbody>
  845. <tr>
  846. <td><code>\e#1</code>, <code>\e#2</code></td>
  847. <td>
  848. Make the current line part of a double-height line.
  849. Use <code>1</code> for the top, <code>2</code> for the bottom half.
  850. </td>
  851. </tr>
  852. <tr>
  853. <td><code>\e#3</code>, <code>\e#4</code></td>
  854. <td>
  855. Make the current line part of a double-width, double-height line.
  856. Use <code>3</code> for the top, <code>4</code> for the bottom half.
  857. </td>
  858. </tr>
  859. <tr>
  860. <td><code>\e#6</code></td>
  861. <td>
  862. Make the current line double-width.
  863. </td>
  864. </tr>
  865. <tr>
  866. <td><code>\e#5</code></td>
  867. <td>
  868. Reset the current line to normal size.
  869. </td>
  870. </tr>
  871. </tbody>
  872. </table>
  873. <h3>Other</h3>
  874. <table class="ansiref w100">
  875. <thead><tr><th>Code</th><th>Meaning</th></tr></thead>
  876. <tbody>
  877. <tr>
  878. <td><code>\ec</code></td>
  879. <td>
  880. Clear screen, reset attributes and cursor. This command also restores the default
  881. screen size, title, button labels and messages and the background URL.
  882. </td>
  883. </tr>
  884. <tr>
  885. <td><code>
  886. \e[?1049h<br>\e[?1049l
  887. </code></td>
  888. <td>
  889. Switch to (<code>h</code>) or from (<code>l</code>) an alternate screen.
  890. ESPTerm can't implement this fully, so the original screen content is not saved,
  891. but it will remember the cursor, screen size, terminal title, button labels and messages.
  892. </td>
  893. </tr>
  894. <tr>
  895. <td><code>\e[8;<i>r</i>;<i>c</i>t</code></td>
  896. <td>Set screen size to <i>r</i> rows and <i>c</i> columns (this is a command borrowed from Xterm)</td>
  897. </tr>
  898. <tr>
  899. <td>
  900. <code>\e[<i>n</i>b</code></td>
  901. <td>
  902. Repeat last printed characters <i>n</i> times (moving cursor and using the current style).
  903. </td>
  904. </tr>
  905. <tr>
  906. <td><code>\e#8</code></td>
  907. <td>
  908. Reset all screen attributes to default and fill the screen with the letter "E". This was
  909. historically used for aligning CRT displays, now can be useful e.g. for testing erasing commands.
  910. </td>
  911. </tr>
  912. </tbody>
  913. </table>
  914. </div>
  915. </div>
  916. <div class="Box fold">
  917. <h2>Commands: Networking</h2>
  918. <div class="Row v">
  919. <p>
  920. ESPTerm implements commands for device-to-device messaging and for requesting external
  921. servers. This can be used e.g. for remote control, status reporting or data upload / download.
  922. </p>
  923. <p>
  924. Networking commands use the format <code>\e^...\a</code>, a Privacy Message (PM).
  925. PM is similar to OSC, which uses <code>]</code> in place of <code>^</code>. The PM payload (text between <code>\e^</code> and <code>\a</code>)
  926. must be shorter than 256 bytes, and should not contain any control characters (ASCII &lt; 32).
  927. </p>
  928. <h3>Device-to-device Messaging</h3>
  929. <p>
  930. To send a message to another ESPTerm module, use: <code>\e^M;<i>DestIP</i>;<i>message</i>\a</code>.
  931. </p>
  932. <p>
  933. This command sends a POST request to <code>http://<i>&lt;DestIP&gt;</i>/api/v1/msg</code>.
  934. The IP address may be appended by a port, if needed (eg. :8080). In addition to POST,
  935. a GET request can also be used. In that case, any GET arguments (<code>/api/v1/msg?<i>arguments</i></code>)
  936. will be used instead of the request body. This is intended for external access
  937. when sending POST requests is not convenient.
  938. </p>
  939. <p>
  940. Each ESPTerm listens for such requests and relays them to UART:
  941. <code>\e^m;<i>SrcIP</i>;L=<i>length</i>;<i>message</i>\a</code>, with <i>length</i> being the byte length of
  942. <i>message</i>, as ASCII.
  943. </p>
  944. <p>
  945. Notice a pattern with the first letter: capital is always a command, lower case a response.
  946. This is followed with the HTTP commands and any networking commands added in the future.
  947. </p>
  948. <p>
  949. <b>Example:</b> Node 192.168.0.10 sends a message to 192.168.0.19: <code>\e^M;192.168.0.19;Hello\a</code>.
  950. Node 192.168.0.19 receives <code>\e^m;192.168.0.10;L=5;Hello\a</code> on the UART. Note that the IP
  951. address in the reception message is that of the first node, thus it can be used to send a message back.
  952. </p>
  953. <h3>External HTTP requests</h3>
  954. <p>
  955. To request an external server, use <code>\e^H;<i>method</i>;<i>options</i>;<i>url</i>\n<i>body</i>\a</code>.
  956. </p>
  957. <ul>
  958. <li><code><i>method</i></code> - can be any usual HTTP verb, such as <code>GET</code>, <code>POST</code>, <code>PUT</code>, <code>HEAD</code>.
  959. <li><code><i>options</i></code> - is a comma-separated list of flags and parameters:
  960. <ul>
  961. <li><code>H</code> - get response headers
  962. <li><code>B</code> - get response body
  963. <li><code>X</code> - ignore the response, return nothing
  964. <li><code>N=<i>nonce</i></code> - a custom string that will be added in the options field of the response message.
  965. Use this to keep track of which request a response belongs to.
  966. <li><code>T=<i>ms</i></code> - request timeout (default 5000&nbsp;ms), in milliseconds
  967. <li><code>L=<i>bytes</i></code> - limit response length (default 0 = don't limit). Applies to the head, body, or both combined, depending on the <code>H</code> and <code>B</code> flags
  968. <li><code>l=<i>bytes</i></code> - limit the response buffer size (default 5000&nbsp;B).
  969. This can reduce RAM usage, however it shouldn't be set too small, as this buffer
  970. is used for both headers and the response body.
  971. </ul>
  972. <li><code><i>url</i></code> - full request URL, including <code>http://</code>. Port may be specified if different from :80,
  973. and GET arguments may be appended to the URL if needed.
  974. <li><code><i>body</i></code> - optional, separated from <code><i>url</i></code> by a single line feed character (<code>\n</code>).
  975. This can be used for POST and PUT requests. Note: the command may be truncated to the
  976. maximum total length of 256 characters if too long.
  977. </ul>
  978. <p>The response has the following format: <code>\e^h;<i>status</i>;<i>options</i>;<i>response</i>\a</code></p>
  979. <ul>
  980. <li><code><i>status</i></code> - a HTTP status code, eg. 200 is OK, 404 Not found.
  981. <li><code><i>options</i></code> - similar to those in the request, here describing the response data.
  982. This field can contain comma-separated <code>B</code>, <code>H</code> and <code>L=<i>bytes</i></code> and <code>N=<i>nonce</i></code>.
  983. <li><code><i>response</i></code> - the response, as requested. If both headers and body are received,
  984. they will be separated by an empty line (i.e. <code>\r\n\r\n</code>). Response can be up to several
  985. kilobytes long, depending on the <code>L=</code> and <code>l=</code> options.
  986. </ul>
  987. <p>
  988. <b>Example:</b> <code>\e^H;GET;B;http://wtfismyip.com/text\a</code> - get the body of a web page
  989. (wtfismyip.com is a service that sends back your IP address).
  990. A response could be <code>\e^h;200;B,L=11;80.70.60.50\a</code>.
  991. </p>
  992. </div>
  993. </div>
  994. <div class="Box fold">
  995. <h2>Commands: System Functions</h2>
  996. <div class="Row v">
  997. <p>
  998. It's possible to dynamically change the screen title text and action button labels.
  999. Setting an empty label to a button makes it look disabled. The buttons send ASCII 1-5 when clicked.
  1000. Those changes are not retained after restart.
  1001. </p>
  1002. <h3>Single-byte commands &amp; queries</h3>
  1003. <table class="ansiref w100">
  1004. <thead><tr><th>Code</th><th>Meaning</th></tr></thead>
  1005. <tbody>
  1006. <tr>
  1007. <td><i>CAN</i> (24)</td>
  1008. <td>
  1009. This ASCII code is sent by ESPTerm when it becomes ready to receive commands.
  1010. When this code is received on the UART, it means ESPTerm has restarted and is ready.
  1011. Use this to detect spontaneous restarts which require a full screen repaint.
  1012. As a control character sent to ESPTerm, CAN aborts any currently received commands
  1013. and clears the parser.
  1014. </td>
  1015. </tr>
  1016. <tr>
  1017. <td><i>ENQ</i> (5)</td>
  1018. <td>
  1019. ESPTerm responds to this control characters with an "answerback message".
  1020. This message contains the curretn version, unique ID, and the IP address if in Client mode.
  1021. </td>
  1022. </tr>
  1023. <tr>
  1024. <td><code>\e[5n</code></td>
  1025. <td>
  1026. Query device status, ESPTerm replies with <code>\e[0n</code> "device is OK".
  1027. Can be used to check if the terminal has booted up and is ready to receive commands.
  1028. </td>
  1029. </tr>
  1030. </tbody>
  1031. </table>
  1032. <h3>Setting parameters</h3>
  1033. <table class="ansiref w100">
  1034. <thead><tr><th>Code</th><th>Meaning</th></tr></thead>
  1035. <tbody>
  1036. <tr>
  1037. <td><code>\e[<i>n</i> q</code></td>
  1038. <td>
  1039. Set cursor style: eg. <code>\e[3 q</code> (the space is part of the command!).
  1040. 0&nbsp;-&nbsp;block&nbsp;(blink), 1&nbsp;-&nbsp;default, 2&nbsp;-&nbsp;block&nbsp;(steady), 3&nbsp;-&nbsp;underline&nbsp;(blink),
  1041. 4&nbsp;-&nbsp;underline&nbsp;(steady), 5&nbsp;-&nbsp;I-bar&nbsp;(blink), 6&nbsp;-&nbsp;I-bar&nbsp;(steady). The default style (number 1)
  1042. can be configured in Terminal Settings
  1043. </td>
  1044. </tr>
  1045. <tr>
  1046. <td><code>\e]0;<i>t</i>\a</code></td>
  1047. <td>Set screen title to <i>t</i> (this is a standard OSC command)</td>
  1048. </tr>
  1049. <tr>
  1050. <td><code>\e]27;1;<i>u</i>\a</code></td>
  1051. <td>
  1052. Set background image to URL <i>u</i> (including protocol)
  1053. that can be resolved by the user's browser. The image will be scaled
  1054. to fit the screen, preserving aspect ratio. A certain border must be added
  1055. to account for the screen margins. Use empty string to disable the image feature.
  1056. Note that this <b>won't work for users connected to the built-in AP</b>.
  1057. </td>
  1058. </tr>
  1059. <tr>
  1060. <td><code>\e]27;2;<i>n</i>\a</code></td>
  1061. <td>
  1062. Set number of visible buttons to <i>n</i> (0-5). To hide/show the entire buttons bar,
  1063. use the dedicated hiding commands (see below)
  1064. </td>
  1065. </tr>
  1066. <tr>
  1067. <td><code>
  1068. \e]28;<i>x</i>;<i>t</i>\a
  1069. </code></td>
  1070. <td>
  1071. Set label for button <i>x</i> (1-5) to <i>t</i> - e.g.<code>\e]28;1;Yes\a</code>
  1072. sets the first button text to "Yes".
  1073. </td>
  1074. </tr>
  1075. <tr>
  1076. <td><code>
  1077. \e]29;<i>x</i>;<i>m</i>\a
  1078. </code></td>
  1079. <td>
  1080. Set message for button <i>x</i> (1-5) to <i>m</i> - e.g.<code>\e]29;3;+\a</code>
  1081. sets the 3rd button to send "+" when pressed. The message can be up to
  1082. 10 bytes long.
  1083. </td>
  1084. </tr>
  1085. <tr>
  1086. <td><code>
  1087. \e]30;<i>x</i>;<i>c</i>\a
  1088. </code></td>
  1089. <td>
  1090. Set button <i>x</i> (1-5) color to <i>c</i> - e.g.<code>\e]30;2;#00FF00\a</code>
  1091. makes the 2nd button green. Supported are SGR colors 1-255
  1092. and TrueColor in the format <code>#RRGGBB</code>. Use 0 to
  1093. reset to the default color.
  1094. </td>
  1095. </tr>
  1096. <tr>
  1097. <td><code>
  1098. \e[?800h<br>\e[?800l
  1099. </code></td>
  1100. <td>
  1101. Show (<code>h</code>) or hide (<code>l</code>) the action buttons (the blue buttons under the screen).
  1102. </td>
  1103. </tr>
  1104. <tr>
  1105. <td><code>
  1106. \e[?801h<br>\e[?801l
  1107. </code></td>
  1108. <td>
  1109. Show (<code>h</code>) or hide (<code>l</code>) menu/help links under the screen.
  1110. </td>
  1111. </tr>
  1112. <tr>
  1113. <td><code>
  1114. \e[?2004h<br>\e[?2004l
  1115. </code></td>
  1116. <td>
  1117. Enable (<code>h</code>) or disable (<code>l</code>) Bracketed Paste mode.
  1118. This mode makes any text sent using the Upload Tool be preceded by <code>\e[200~</code>
  1119. and terminated by <code>\e[201~</code>. This is useful for distinguishing keyboard input
  1120. from uploads.
  1121. </td>
  1122. </tr>
  1123. <tr>
  1124. <td><code>
  1125. \e[12h<br>\e[12l
  1126. </code></td>
  1127. <td>
  1128. Enable (<code>h</code>) or disable (<code>l</code>) Send-Receive Mode (SRM).
  1129. SRM is the opposite of Local Echo, meaning <code>\e[12h</code> disables and <code>\e[12l</code> enables Local Echo.
  1130. </td>
  1131. </tr>
  1132. </tbody>
  1133. </table>
  1134. <h3>Other</h3>
  1135. <table class="ansiref w100">
  1136. <thead><tr><th>Code</th><th>Meaning</th></tr></thead>
  1137. <tbody>
  1138. <tr>
  1139. <td><code>
  1140. \e]9;<i>t</i>\a
  1141. </code></td>
  1142. <td>
  1143. Show a notification with text <i>t</i>. This will be either a desktop notification
  1144. or a pop-up balloon.
  1145. </td>
  1146. </tr>
  1147. <tr>
  1148. <td><code>
  1149. \e[?<i>n</i>s<br>\e[?<i>n</i>r
  1150. </code></td>
  1151. <td>
  1152. Save (<code>s</code>) and restore (<code>r</code>) any option set using <code>CSI ? <i>n</i> h</code>.
  1153. This is used by some applications to back up the original state before
  1154. making changes.
  1155. </td>
  1156. </tr>
  1157. </tbody>
  1158. </table>
  1159. </div>
  1160. </div>
  1161. <script>
  1162. function hpfold(yes) {
  1163. $('.fold').toggleClass('expanded', !!yes);
  1164. }
  1165. // show theme colors - but this is a static page, so we don't know the current theme.
  1166. themes.themePreview(1)
  1167. </script>
  1168. <div class="botpad"></div>
  1169. <div class="NotifyMsg hidden" id="notif"></div>
  1170. </div>
  1171. </div>
  1172. </body>
  1173. </html>