Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5fd5c92390 | ||
|
|
e3ae34a932 | ||
|
|
423022b8bc |
+9
-3
@@ -424,8 +424,14 @@ static void ICACHE_FLASH_ATTR do_csi_privattr(CSI_Data *opts)
|
|||||||
screen_set_charset(1, 'B');
|
screen_set_charset(1, 'B');
|
||||||
}
|
}
|
||||||
else if (n == 3) {
|
else if (n == 3) {
|
||||||
// 132 column mode - not implemented due to RAM demands
|
// DECCOLM 132 column mode - not implemented due to RAM demands
|
||||||
ansi_noimpl("80->132");
|
ansi_noimpl("132col");
|
||||||
|
|
||||||
|
// DECCOLM side effects as per
|
||||||
|
// https://www.chiark.greenend.org.uk/~sgtatham/putty/wishlist/deccolm-cls.html
|
||||||
|
screen_clear(CLEAR_ALL);
|
||||||
|
screen_set_scrolling_region(0, 0);
|
||||||
|
screen_cursor_set(0, 0);
|
||||||
}
|
}
|
||||||
else if (n == 4) {
|
else if (n == 4) {
|
||||||
// Smooth scroll - not implemented
|
// Smooth scroll - not implemented
|
||||||
@@ -463,7 +469,7 @@ static void ICACHE_FLASH_ATTR do_csi_privattr(CSI_Data *opts)
|
|||||||
else if (n == 40) {
|
else if (n == 40) {
|
||||||
// allow/disallow 80->132 mode
|
// allow/disallow 80->132 mode
|
||||||
// not implemented because of RAM demands
|
// not implemented because of RAM demands
|
||||||
ansi_noimpl("80->132 enable");
|
ansi_noimpl("132col enable");
|
||||||
}
|
}
|
||||||
else if (n == 45) {
|
else if (n == 45) {
|
||||||
// reverse wrap-around
|
// reverse wrap-around
|
||||||
|
|||||||
+8
-4
@@ -8,6 +8,8 @@
|
|||||||
#include "uart_buffer.h"
|
#include "uart_buffer.h"
|
||||||
#include "ansi_parser.h"
|
#include "ansi_parser.h"
|
||||||
|
|
||||||
|
#define LOOPBACK 0
|
||||||
|
|
||||||
#define SOCK_BUF_LEN 1024
|
#define SOCK_BUF_LEN 1024
|
||||||
static char sock_buff[SOCK_BUF_LEN];
|
static char sock_buff[SOCK_BUF_LEN];
|
||||||
|
|
||||||
@@ -128,11 +130,13 @@ void ICACHE_FLASH_ATTR updateSockRx(Websock *ws, char *data, int len, int flags)
|
|||||||
|
|
||||||
if (strstarts(data, "STR:")) {
|
if (strstarts(data, "STR:")) {
|
||||||
// pass string verbatim
|
// pass string verbatim
|
||||||
|
#if LOOPBACK
|
||||||
|
for(int i=4;i<strlen(data); i++) {
|
||||||
|
ansi_parser(data[i]);
|
||||||
|
}
|
||||||
|
#else
|
||||||
UART_SendAsync(data+4, -1);
|
UART_SendAsync(data+4, -1);
|
||||||
// debug loopback
|
#endif
|
||||||
// for(int i=4;i<strlen(data); i++) {
|
|
||||||
// ansi_parser(data[i]);
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
else if (strstarts(data, "BTN:")) {
|
else if (strstarts(data, "BTN:")) {
|
||||||
// send button as low ASCII value 1-9
|
// send button as low ASCII value 1-9
|
||||||
|
|||||||
+37
-24
@@ -4,12 +4,13 @@
|
|||||||
#include "persist.h"
|
#include "persist.h"
|
||||||
#include "sgr.h"
|
#include "sgr.h"
|
||||||
#include "ascii.h"
|
#include "ascii.h"
|
||||||
|
#include "apars_logging.h"
|
||||||
|
|
||||||
TerminalConfigBundle * const termconf = &persist.current.termconf;
|
TerminalConfigBundle * const termconf = &persist.current.termconf;
|
||||||
TerminalConfigBundle termconf_scratch;
|
TerminalConfigBundle termconf_scratch;
|
||||||
|
|
||||||
// forward declare
|
// forward declare
|
||||||
static void utf8_remap(char* out, char g, char table);
|
static void utf8_remap(char* out, char g, char charset);
|
||||||
|
|
||||||
#define W termconf_scratch.width
|
#define W termconf_scratch.width
|
||||||
#define H termconf_scratch.height
|
#define H termconf_scratch.height
|
||||||
@@ -54,9 +55,6 @@ static struct {
|
|||||||
// Vertical margin bounds (inclusive start/end of scrolling region)
|
// Vertical margin bounds (inclusive start/end of scrolling region)
|
||||||
int vm0;
|
int vm0;
|
||||||
int vm1;
|
int vm1;
|
||||||
|
|
||||||
char charset0;
|
|
||||||
char charset1;
|
|
||||||
} scr;
|
} scr;
|
||||||
|
|
||||||
#define R0 scr.vm0
|
#define R0 scr.vm0
|
||||||
@@ -76,6 +74,8 @@ typedef struct {
|
|||||||
|
|
||||||
// Other attribs
|
// Other attribs
|
||||||
int charsetN;
|
int charsetN;
|
||||||
|
char charset0;
|
||||||
|
char charset1;
|
||||||
bool wraparound; //!< Wrapping when EOL
|
bool wraparound; //!< Wrapping when EOL
|
||||||
bool origin_mode; // DECOM - absolute positioning is relative to vertical margins
|
bool origin_mode; // DECOM - absolute positioning is relative to vertical margins
|
||||||
bool selective_erase; // TODO implement
|
bool selective_erase; // TODO implement
|
||||||
@@ -94,6 +94,7 @@ static CursorTypeDef cursor;
|
|||||||
* Saved cursor position, used with the SCP RCP commands
|
* Saved cursor position, used with the SCP RCP commands
|
||||||
*/
|
*/
|
||||||
static CursorTypeDef cursor_sav;
|
static CursorTypeDef cursor_sav;
|
||||||
|
bool cursor_saved = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is used to prevent premature change notifications
|
* This is used to prevent premature change notifications
|
||||||
@@ -214,6 +215,8 @@ cursor_reset(void)
|
|||||||
cursor.origin_mode = false;
|
cursor.origin_mode = false;
|
||||||
|
|
||||||
cursor.charsetN = 0;
|
cursor.charsetN = 0;
|
||||||
|
cursor.charset0 = CS_USASCII;
|
||||||
|
cursor.charset1 = CS_DEC_SUPPLEMENTAL;
|
||||||
cursor.wraparound = true;
|
cursor.wraparound = true;
|
||||||
|
|
||||||
screen_reset_sgr();
|
screen_reset_sgr();
|
||||||
@@ -246,9 +249,6 @@ screen_reset(void)
|
|||||||
scr.newline_mode = false;
|
scr.newline_mode = false;
|
||||||
scr.reverse = false;
|
scr.reverse = false;
|
||||||
|
|
||||||
scr.charset0 = 'B';
|
|
||||||
scr.charset1 = '0';
|
|
||||||
|
|
||||||
scr.vm0 = 0;
|
scr.vm0 = 0;
|
||||||
scr.vm1 = H-1;
|
scr.vm1 = H-1;
|
||||||
|
|
||||||
@@ -646,7 +646,7 @@ screen_scroll_up(unsigned int lines)
|
|||||||
memcpy(screen + y * W, screen + (y + lines) * W, W * sizeof(Cell));
|
memcpy(screen + y * W, screen + (y + lines) * W, W * sizeof(Cell));
|
||||||
}
|
}
|
||||||
|
|
||||||
clear_range(R0 * W+y * W, (R1+1)*W-1);
|
clear_range(y * W, (R1+1)*W-1);
|
||||||
|
|
||||||
done:
|
done:
|
||||||
NOTIFY_DONE();
|
NOTIFY_DONE();
|
||||||
@@ -683,7 +683,7 @@ screen_scroll_down(unsigned int lines)
|
|||||||
void ICACHE_FLASH_ATTR
|
void ICACHE_FLASH_ATTR
|
||||||
screen_set_scrolling_region(int from, int to)
|
screen_set_scrolling_region(int from, int to)
|
||||||
{
|
{
|
||||||
if (from == 0 && to == 0) {
|
if (from <= 0 && to <= 0) {
|
||||||
scr.vm0 = 0;
|
scr.vm0 = 0;
|
||||||
scr.vm1 = H-1;
|
scr.vm1 = H-1;
|
||||||
} else if (from >= 0 && from < H-1 && to > from) {
|
} else if (from >= 0 && from < H-1 && to > from) {
|
||||||
@@ -691,6 +691,7 @@ screen_set_scrolling_region(int from, int to)
|
|||||||
scr.vm1 = to;
|
scr.vm1 = to;
|
||||||
} else {
|
} else {
|
||||||
// Bad range, do nothing
|
// Bad range, do nothing
|
||||||
|
ansi_warn("Bad SR bounds %d, %d", from, to);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Always move cursor home (may be translated due to DECOM)
|
// Always move cursor home (may be translated due to DECOM)
|
||||||
@@ -832,6 +833,7 @@ screen_cursor_save(bool withAttrs)
|
|||||||
{
|
{
|
||||||
// always save with attribs
|
// always save with attribs
|
||||||
memcpy(&cursor_sav, &cursor, sizeof(CursorTypeDef));
|
memcpy(&cursor_sav, &cursor, sizeof(CursorTypeDef));
|
||||||
|
cursor_saved = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -842,12 +844,18 @@ screen_cursor_restore(bool withAttrs)
|
|||||||
{
|
{
|
||||||
NOTIFY_LOCK();
|
NOTIFY_LOCK();
|
||||||
|
|
||||||
if (withAttrs) {
|
if (!cursor_saved) {
|
||||||
memcpy(&cursor_sav, &cursor, sizeof(CursorTypeDef));
|
cursor_reset();
|
||||||
} else {
|
}
|
||||||
cursor.x = cursor_sav.x;
|
else {
|
||||||
cursor.y = cursor_sav.y;
|
if (withAttrs) {
|
||||||
cursor.hanging = cursor_sav.hanging;
|
memcpy(&cursor, &cursor_sav, sizeof(CursorTypeDef));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
cursor.x = cursor_sav.x;
|
||||||
|
cursor.y = cursor_sav.y;
|
||||||
|
cursor.hanging = cursor_sav.hanging;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
NOTIFY_DONE();
|
NOTIFY_DONE();
|
||||||
@@ -936,8 +944,8 @@ screen_set_charset_n(int Gx)
|
|||||||
void ICACHE_FLASH_ATTR
|
void ICACHE_FLASH_ATTR
|
||||||
screen_set_charset(int Gx, char charset)
|
screen_set_charset(int Gx, char charset)
|
||||||
{
|
{
|
||||||
if (Gx == 0) scr.charset0 = charset;
|
if (Gx == 0) cursor.charset0 = charset;
|
||||||
else if (Gx == 1) scr.charset1 = charset;
|
else if (Gx == 1) cursor.charset1 = charset;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ICACHE_FLASH_ATTR
|
void ICACHE_FLASH_ATTR
|
||||||
@@ -1071,7 +1079,7 @@ screen_putchar(const char *ch)
|
|||||||
|
|
||||||
if (ch[1] == 0 && ch[0] <= 0x7f) {
|
if (ch[1] == 0 && ch[0] <= 0x7f) {
|
||||||
// we have len=1 and ASCII
|
// we have len=1 and ASCII
|
||||||
utf8_remap(c->c, ch[0], (cursor.charsetN == 0) ? scr.charset0 : scr.charset1);
|
utf8_remap(c->c, ch[0], (cursor.charsetN == 0) ? cursor.charset0 : cursor.charset1);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// copy unicode char
|
// copy unicode char
|
||||||
@@ -1239,32 +1247,37 @@ static const u16 codepage_1[] =
|
|||||||
* UTF remap
|
* UTF remap
|
||||||
* @param out - output char[4]
|
* @param out - output char[4]
|
||||||
* @param g - ASCII char
|
* @param g - ASCII char
|
||||||
* @param table - table name (0, A, B)
|
* @param charset - table name (0, A, B)
|
||||||
*/
|
*/
|
||||||
static void ICACHE_FLASH_ATTR
|
static void ICACHE_FLASH_ATTR
|
||||||
utf8_remap(char *out, char g, char table)
|
utf8_remap(char *out, char g, char charset)
|
||||||
{
|
{
|
||||||
u16 n;
|
u16 n;
|
||||||
u16 utf = (unsigned char)g;
|
u16 utf = (unsigned char)g;
|
||||||
|
|
||||||
switch (table) {
|
switch (charset) {
|
||||||
case '0': /* DEC Special Character & Line Drawing Set */
|
case CS_DEC_SUPPLEMENTAL: /* DEC Special Character & Line Drawing Set */
|
||||||
if ((g >= 96) && (g < 0x7F)) {
|
if ((g >= 96) && (g < 0x7F)) {
|
||||||
n = codepage_0[g - 96];
|
n = codepage_0[g - 96];
|
||||||
if (n) utf = n;
|
if (n) utf = n;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '1': /* ESPTerm Character Rom 1 */
|
case CS_DOS_437: /* ESPTerm Character Rom 1 */
|
||||||
if ((g >= 33) && (g < 0x7F)) {
|
if ((g >= 33) && (g < 0x7F)) {
|
||||||
n = codepage_1[g - 33];
|
n = codepage_1[g - 33];
|
||||||
if (n) utf = n;
|
if (n) utf = n;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'A': /* UK, replaces # with GBP */
|
case CS_UKASCII: /* UK, replaces # with GBP */
|
||||||
if (g == '#') utf = 0x20a4;
|
if (g == '#') utf = 0x20a4;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
case CS_USASCII:
|
||||||
|
// No change
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Encode to UTF-8
|
// Encode to UTF-8
|
||||||
|
|||||||
@@ -108,6 +108,13 @@ typedef struct {
|
|||||||
u8 xsb;
|
u8 xsb;
|
||||||
} WordB3;
|
} WordB3;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
CS_USASCII = 'B',
|
||||||
|
CS_UKASCII = 'A',
|
||||||
|
CS_DEC_SUPPLEMENTAL = '0',
|
||||||
|
CS_DOS_437 = '1',
|
||||||
|
} CHARSET;
|
||||||
|
|
||||||
/** Encode number to two nice ASCII bytes */
|
/** Encode number to two nice ASCII bytes */
|
||||||
void encode2B(u16 number, WordB2 *stru);
|
void encode2B(u16 number, WordB2 *stru);
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
#define FW_V_MAJOR 0
|
#define FW_V_MAJOR 0
|
||||||
#define FW_V_MINOR 6
|
#define FW_V_MINOR 6
|
||||||
#define FW_V_PATCH 8
|
#define FW_V_PATCH 9
|
||||||
|
|
||||||
#define FIRMWARE_VERSION STR(FW_V_MAJOR) "." STR(FW_V_MINOR) "." STR(FW_V_PATCH) "+" GIT_HASH
|
#define FIRMWARE_VERSION STR(FW_V_MAJOR) "." STR(FW_V_MINOR) "." STR(FW_V_PATCH) "+" GIT_HASH
|
||||||
#define FIRMWARE_VERSION_NUM (FW_V_MAJOR*10000 + FW_V_MINOR*100 + FW_V_PATCH) // this is used in ID queries
|
#define FIRMWARE_VERSION_NUM (FW_V_MAJOR*10000 + FW_V_MINOR*100 + FW_V_PATCH) // this is used in ID queries
|
||||||
|
|||||||
Reference in New Issue
Block a user