Compare commits

...
5 Commits
Author SHA1 Message Date
MightyPork b074eb4f2c version bump 2017-03-02 00:52:31 +01:00
MightyPork 9dd5a1f082 Implemented cursor wrap control codes e[?7h and l 2017-03-02 00:06:45 +01:00
MightyPork e7c26b3e94 send code 0x18 on restart 2017-03-01 23:57:07 +01:00
MightyPork b6a0e796d8 Fixed broken Report Device OK response 2017-01-30 01:22:16 +01:00
MightyPork 29f726c073 Fixed some broken impl 2017-01-30 01:10:10 +01:00
8 changed files with 83 additions and 40 deletions
+1 -1
View File
@@ -748,7 +748,7 @@ input[type="number"], input[type="password"], input[type="text"], textarea, sele
.ansiref.w100 { .ansiref.w100 {
width: 100%; } width: 100%; }
.ansiref.w100 td:nth-child(1) { .ansiref.w100 td:nth-child(1) {
width: 7em; } width: 9em; }
.ansiref.w100 td:nth-child(2) { .ansiref.w100 td:nth-child(2) {
width: 8em; } width: 8em; }
+29 -19
View File
@@ -29,7 +29,7 @@
<ul> <ul>
<li>Most ANSI escape sequences are supported.</li> <li>Most ANSI escape sequences are supported.</li>
<li>The max screen size is 2000 characters (eg. <b>25x80</b>), default is <b>10x26</b>. Set using <code>\e]W?;?\a</code> with rows;cols.</li> <li>The max screen size is 2000 characters (eg. <b>25x80</b>), default is <b>10x26</b>. Set using <code>\e]W&lt;rows&gt;;&lt;cols&gt;\a</code>.</li>
<li>The screen will automatically scroll, can be used for log output.</li> <li>The screen will automatically scroll, can be used for log output.</li>
<li>Display update is sent <b>after 20 ms of inactivity</b>.</li> <li>Display update is sent <b>after 20 ms of inactivity</b>.</li>
<li>The browser display needs WebSockets for the real-time updating. It may not work on really old phones / browsers.</li> <li>The browser display needs WebSockets for the real-time updating. It may not work on really old phones / browsers.</li>
@@ -39,7 +39,7 @@
<div class="Box"> <div class="Box">
<h2>Color Reference</h2> <h2>Color Reference</h2>
<p>Color is set using <code>\e[?m</code> or <code>\e[?;?m</code> where "?" are numbers from the following tables:</p> <p>Color is set using <code>\e[&lt;c&gt;m</code> or <code>\e[&lt;c&gt;;&lt;c&gt;m</code> where "&lt;c&gt;" are numbers from the following tables:</p>
<b>Foreground</b> <b>Foreground</b>
@@ -103,8 +103,8 @@
<p>The buttons under the screen send ASCII codes 1, 2, 3, 4, 5.</p> <p>The buttons under the screen send ASCII codes 1, 2, 3, 4, 5.</p>
<p> <p>
<b>Mouse input</b> (click/tap) is sent as <code>\e?;?M</code> with row;column. You can use this for on-screen buttons, menu navigation etc. <b>Mouse input</b> (click/tap) is sent as <code>\e[&lt;y&gt;;&lt;x&gt;M</code>. You can use this for on-screen buttons, menu navigation etc.
<i>Please note this is a custom sequence, not supported by PuTTY or other terminals.</i> <i>Please note this is a custom escape sequence, not supported by PuTTY or other terminals.</i>
</p> </p>
</div> </div>
@@ -167,42 +167,42 @@
</thead> </thead>
<tbody> <tbody>
<tr> <tr>
<td>\e[?A</td> <td>\e[&lt;n&gt;A</td>
<td>[count]</td> <td>[count]</td>
<td>Move cursor up</td> <td>Move cursor up</td>
</tr> </tr>
<tr> <tr>
<td>\e[?B</td> <td>\e[&lt;n&gt;B</td>
<td>[count]</td> <td>[count]</td>
<td>Move cursor down</td> <td>Move cursor down</td>
</tr> </tr>
<tr> <tr>
<td>\e[?C</td> <td>\e[&lt;n&gt;C</td>
<td>[count]</td> <td>[count]</td>
<td>Move cursor forward (right)</td> <td>Move cursor forward (right)</td>
</tr> </tr>
<tr> <tr>
<td>\e[?D</td> <td>\e[&lt;n&gt;D</td>
<td>[count]</td> <td>[count]</td>
<td>Move cursor backward (left)</td> <td>Move cursor backward (left)</td>
</tr> </tr>
<tr> <tr>
<td>\e[?E</td> <td>\e[&lt;n&gt;E</td>
<td>[count]</td> <td>[count]</td>
<td>Go N line down, start of line</td> <td>Go N line down, start of line</td>
</tr> </tr>
<tr> <tr>
<td>\e[?F</td> <td>\e[&lt;n&gt;F</td>
<td>[count]</td> <td>[count]</td>
<td>Go N lines up, start of line</td> <td>Go N lines up, start of line</td>
</tr> </tr>
<tr> <tr>
<td>\e[?G</td> <td>\e[&lt;n&gt;G</td>
<td>column</td> <td>column</td>
<td>Go to column</td> <td>Go to column</td>
</tr> </tr>
<tr> <tr>
<td>\e[?;?G</td> <td>\e[&lt;y&gt;;&lt;x&gt;G</td>
<td>[row=1];[col=1]</td> <td>[row=1];[col=1]</td>
<td>Go to row and column</td> <td>Go to row and column</td>
</tr> </tr>
@@ -234,12 +234,22 @@
<tr> <tr>
<td>\e[?25l</td> <td>\e[?25l</td>
<td>--</td> <td>--</td>
<td>Hide cursor (literal question mark, lowercase L!)</td> <td>Hide cursor</td>
</tr> </tr>
<tr> <tr>
<td>\e[?25h</td> <td>\e[?25h</td>
<td>--</td> <td>--</td>
<td>Show cursor (literal question mark!)</td> <td>Show cursor</td>
</tr>
<tr>
<td>\e[?7l</td>
<td>--</td>
<td>Disable cursor auto-wrap & auto-scroll at end of screen</td>
</tr>
<tr>
<td>\e[?7h</td>
<td>--</td>
<td>Enable cursor auto-wrap & auto-scroll at end of screen</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
@@ -256,27 +266,27 @@
</thead> </thead>
<tbody> <tbody>
<tr> <tr>
<td>\e[?J</td> <td>\e[&lt;m&gt;J</td>
<td>[mode=0]</td> <td>[mode=0]</td>
<td>Clear screen. Mode: 0 - from cursor, 1 - to cursor, 2 - all</td> <td>Clear screen. Mode: 0 - from cursor, 1 - to cursor, 2 - all</td>
</tr> </tr>
<tr> <tr>
<td>\e[?K</td> <td>\e[&lt;m&gt;K</td>
<td>[mode=0]</td> <td>[mode=0]</td>
<td>Erase line. Mode: 0 - from cursor, 1 - to cursor, 2 - all</td> <td>Erase line. Mode: 0 - from cursor, 1 - to cursor, 2 - all</td>
</tr> </tr>
<tr> <tr>
<td>\e[?S</td> <td>\e[&lt;n&gt;S</td>
<td>[lines]</td> <td>[lines]</td>
<td>Scroll screen content up, add empty line at the bottom</td> <td>Scroll screen content up, add empty line at the bottom</td>
</tr> </tr>
<tr> <tr>
<td>\e[?T</td> <td>\e[&lt;n&gt;T</td>
<td>[lines]</td> <td>[lines]</td>
<td>Scroll screen content down, add empty line at the top</td> <td>Scroll screen content down, add empty line at the top</td>
</tr> </tr>
<tr> <tr>
<td>\e]W?;?\a</td> <td>\e]W&lt;r&gt;;&lt;c&gt;\a</td>
<td>rows;cols</td> <td>rows;cols</td>
<td>Set screen size, maximum 25x80 (resp. total 2000 characters). This also clears the screen.</td> <td>Set screen size, maximum 25x80 (resp. total 2000 characters). This also clears the screen.</td>
</tr> </tr>
+1 -1
View File
@@ -53,7 +53,7 @@
width: 100%; width: 100%;
td:nth-child(1) { td:nth-child(1) {
width: 7em; width: 9em;
} }
td:nth-child(2) { td:nth-child(2) {
+17 -9
View File
@@ -138,7 +138,6 @@ apars_handle_CSI(char leadchar, int *params, char keychar)
screen_clear_line(CLEAR_FROM_CURSOR); screen_clear_line(CLEAR_FROM_CURSOR);
} else { } else {
screen_clear_line(CLEAR_ALL); screen_clear_line(CLEAR_ALL);
screen_cursor_set_x(0);
} }
break; break;
@@ -157,20 +156,29 @@ apars_handle_CSI(char leadchar, int *params, char keychar)
} }
else if (n1 == 5) { else if (n1 == 5) {
// Query device status - reply "Device is OK" // Query device status - reply "Device is OK"
UART_WriteString(UART0, "\0330n", UART_TIMEOUT_US); UART_WriteString(UART0, "\033[0n", UART_TIMEOUT_US);
} }
break; break;
// DECTCEM cursor show hide // DECTCEM feature enable / disable
case 'l':
if (leadchar == '?' && n1 == 25) {
screen_cursor_enable(1);
}
break;
case 'h': case 'h':
if (leadchar == '?' && n1 == 25) { if (leadchar == '?') {
if (n1 == 25) {
screen_cursor_enable(1);
} else if (n1 == 7) {
screen_wrap_enable(1);
}
}
break;
case 'l':
if (leadchar == '?') {
if (n1 == 25) {
screen_cursor_enable(0); screen_cursor_enable(0);
} else if (n1 == 7) {
screen_wrap_enable(0);
}
} }
break; break;
+18 -1
View File
@@ -31,6 +31,7 @@ static struct {
int y; //!< Y coordinate int y; //!< Y coordinate
bool visible; //!< Visible bool visible; //!< Visible
bool inverse; //!< Inverse colors bool inverse; //!< Inverse colors
bool autowrap; //!< Wrapping when EOL
Color fg; //!< Foreground color for writing Color fg; //!< Foreground color for writing
Color bg; //!< Background color for writing Color bg; //!< Background color for writing
} cursor; } cursor;
@@ -102,6 +103,7 @@ cursor_reset(void)
cursor.bg = SCREEN_DEF_BG; cursor.bg = SCREEN_DEF_BG;
cursor.visible = 1; cursor.visible = 1;
cursor.inverse = 0; cursor.inverse = 0;
cursor.autowrap = 1;
} }
//endregion //endregion
@@ -397,6 +399,17 @@ screen_cursor_enable(bool enable)
NOTIFY_DONE(); NOTIFY_DONE();
} }
/**
* Enable autowrap
*/
void ICACHE_FLASH_ATTR
screen_wrap_enable(bool enable)
{
NOTIFY_LOCK();
cursor.autowrap = enable;
NOTIFY_DONE();
}
//endregion //endregion
//region Colors //region Colors
@@ -492,7 +505,7 @@ screen_putchar(char ch)
cursor.x--; cursor.x--;
} else { } else {
// wrap around start of line // wrap around start of line
if (cursor.y>0) { if (cursor.autowrap && cursor.y>0) {
cursor.x=W-1; cursor.x=W-1;
cursor.y--; cursor.y--;
} }
@@ -532,6 +545,7 @@ screen_putchar(char ch)
cursor.x++; cursor.x++;
// X wrap // X wrap
if (cursor.x >= W) { if (cursor.x >= W) {
if (cursor.autowrap) {
cursor.x = 0; cursor.x = 0;
cursor.y++; cursor.y++;
// Y wrap // Y wrap
@@ -540,6 +554,9 @@ screen_putchar(char ch)
screen_scroll_up(1); screen_scroll_up(1);
cursor.y = H - 1; cursor.y = H - 1;
} }
} else {
cursor.x = W - 1;
}
} }
done: done:
+3
View File
@@ -109,6 +109,9 @@ void screen_cursor_restore(bool withAttrs);
/** Enable cursor display */ /** Enable cursor display */
void screen_cursor_enable(bool enable); void screen_cursor_enable(bool enable);
/** Enable auto wrap */
void screen_wrap_enable(bool enable);
// --- Colors --- // --- Colors ---
/** Set cursor foreground color */ /** Set cursor foreground color */
+5
View File
@@ -24,6 +24,7 @@
#include "screen.h" #include "screen.h"
#include "routes.h" #include "routes.h"
#include "user_main.h" #include "user_main.h"
#include "uart_driver.h"
#ifdef ESPFS_POS #ifdef ESPFS_POS
CgiUploadFlashDef uploadParams={ CgiUploadFlashDef uploadParams={
@@ -114,6 +115,10 @@ void ICACHE_FLASH_ATTR user_init(void)
// The terminal screen // The terminal screen
screen_init(); screen_init();
// Print the CANCEL character to indicate the module has restarted
// Critically important for client application if any kind of screen persistence / content re-use is needed
UART_WriteChar(UART0, 24, UART_TIMEOUT_US); // 0x18 - 24 - CAN
info("Listening on UART0, 115200-8-N-1!"); info("Listening on UART0, 115200-8-N-1!");
} }
+1 -1
View File
@@ -1,7 +1,7 @@
#ifndef USER_MAIN_H_H #ifndef USER_MAIN_H_H
#define USER_MAIN_H_H #define USER_MAIN_H_H
#define FIRMWARE_VERSION "0.5" #define FIRMWARE_VERSION "0.5.2"
#define TERMINAL_GITHUB_REPO "https://github.com/MightyPork/esp-vt100-firmware" #define TERMINAL_GITHUB_REPO "https://github.com/MightyPork/esp-vt100-firmware"
#endif //USER_MAIN_H_H #endif //USER_MAIN_H_H