two hundred and fifty six colors, ladies and gentlemen!!
This commit is contained in:
+1
-1
@@ -47,7 +47,7 @@ GLOBAL_CFLAGS = \
|
|||||||
-DDEBUG_HTTP=0 \
|
-DDEBUG_HTTP=0 \
|
||||||
-DDEBUG_ESPFS=0 \
|
-DDEBUG_ESPFS=0 \
|
||||||
-DDEBUG_PERSIST=0 \
|
-DDEBUG_PERSIST=0 \
|
||||||
-DDEBUG_UTFCACHE=1 \
|
-DDEBUG_UTFCACHE=0 \
|
||||||
-DDEBUG_CGI=0 \
|
-DDEBUG_CGI=0 \
|
||||||
-DDEBUG_WIFI=0 \
|
-DDEBUG_WIFI=0 \
|
||||||
-DDEBUG_WS=0 \
|
-DDEBUG_WS=0 \
|
||||||
|
|||||||
+1
-1
Submodule front-end updated: c07a6162f2...810782a7f2
+9
-8
@@ -557,12 +557,12 @@ do_csi_sgr(CSI_Data *opts)
|
|||||||
else if (n == SGR_FG_256 || n == SGR_BG_256) {
|
else if (n == SGR_FG_256 || n == SGR_BG_256) {
|
||||||
if (i < count-2) {
|
if (i < count-2) {
|
||||||
if (opts->n[i + 1] == 5) {
|
if (opts->n[i + 1] == 5) {
|
||||||
u16 color = (u16) opts->n[i + 2];
|
u8 color = (u8) opts->n[i + 2];
|
||||||
bool fg = n == SGR_FG_256;
|
bool fg = n == SGR_FG_256;
|
||||||
if (fg) {
|
if (fg) {
|
||||||
screen_set_fg_ext(color);
|
screen_set_fg(color);
|
||||||
} else {
|
} else {
|
||||||
screen_set_bg_ext(color);
|
screen_set_bg(color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -664,7 +664,8 @@ do_csi_set_private_option(CSI_Data *opts)
|
|||||||
}
|
}
|
||||||
else if (n == 3) {
|
else if (n == 3) {
|
||||||
// DECCOLM 132 column mode - not implemented due to RAM demands
|
// DECCOLM 132 column mode - not implemented due to RAM demands
|
||||||
ansi_noimpl("132col");
|
// XXX 132col
|
||||||
|
// ansi_noimpl("132col");
|
||||||
|
|
||||||
// DECCOLM side effects as per
|
// DECCOLM side effects as per
|
||||||
// https://www.chiark.greenend.org.uk/~sgtatham/putty/wishlist/deccolm-cls.html
|
// https://www.chiark.greenend.org.uk/~sgtatham/putty/wishlist/deccolm-cls.html
|
||||||
@@ -688,7 +689,7 @@ do_csi_set_private_option(CSI_Data *opts)
|
|||||||
// Key auto-repeat
|
// Key auto-repeat
|
||||||
// We don't implement this currently, but it could be added
|
// We don't implement this currently, but it could be added
|
||||||
// - discard repeated keypress events between keydown and keyup.
|
// - discard repeated keypress events between keydown and keyup.
|
||||||
ansi_noimpl("Auto-repeat toggle");
|
// XXX auto repeat toggle
|
||||||
}
|
}
|
||||||
else if (n == 9 || (n >= 1000 && n <= 1006) || n == 1015) {
|
else if (n == 9 || (n >= 1000 && n <= 1006) || n == 1015) {
|
||||||
// 9 - X10 tracking
|
// 9 - X10 tracking
|
||||||
@@ -708,7 +709,7 @@ do_csi_set_private_option(CSI_Data *opts)
|
|||||||
else if (n == 1006) mouse_tracking.encoding = yn ? MTE_SGR : MTE_SIMPLE;
|
else if (n == 1006) mouse_tracking.encoding = yn ? MTE_SGR : MTE_SIMPLE;
|
||||||
else if (n == 1015) mouse_tracking.encoding = yn ? MTE_URXVT : MTE_SIMPLE;
|
else if (n == 1015) mouse_tracking.encoding = yn ? MTE_URXVT : MTE_SIMPLE;
|
||||||
|
|
||||||
dbg("Mouse mode=%d, enc=%d, foctr=%d",
|
ansi_dbg("Mouse mode=%d, enc=%d, foctr=%d",
|
||||||
mouse_tracking.mode,
|
mouse_tracking.mode,
|
||||||
mouse_tracking.encoding,
|
mouse_tracking.encoding,
|
||||||
mouse_tracking.focus_tracking);
|
mouse_tracking.focus_tracking);
|
||||||
@@ -722,7 +723,7 @@ do_csi_set_private_option(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("132col enable");
|
// ansi_noimpl("132col enable");
|
||||||
}
|
}
|
||||||
else if (n == 45) {
|
else if (n == 45) {
|
||||||
// reverse wrap-around
|
// reverse wrap-around
|
||||||
@@ -756,7 +757,7 @@ do_csi_set_private_option(CSI_Data *opts)
|
|||||||
}
|
}
|
||||||
else if (n == 2004) {
|
else if (n == 2004) {
|
||||||
// Bracketed paste mode
|
// Bracketed paste mode
|
||||||
ansi_noimpl("Bracketed paste");
|
screen_set_bracketed_paste(yn);
|
||||||
}
|
}
|
||||||
else if (n == 800) { // ESPTerm: Toggle display of buttons
|
else if (n == 800) { // ESPTerm: Toggle display of buttons
|
||||||
termconf_live.show_buttons = yn;
|
termconf_live.show_buttons = yn;
|
||||||
|
|||||||
@@ -40,6 +40,9 @@ apars_handle_osc(char *buffer)
|
|||||||
// Window title (or "icon name" in Xterm)
|
// Window title (or "icon name" in Xterm)
|
||||||
screen_set_title(buffer);
|
screen_set_title(buffer);
|
||||||
}
|
}
|
||||||
|
else if (n == 4) {
|
||||||
|
// XXX setting RGB color, ignore
|
||||||
|
}
|
||||||
else if (n == 9) {
|
else if (n == 9) {
|
||||||
// iTerm2-style "growl" notifications
|
// iTerm2-style "growl" notifications
|
||||||
buffer--;
|
buffer--;
|
||||||
|
|||||||
+36
-36
@@ -28,10 +28,10 @@ static void utf8_remap(char* out, char g, char charset);
|
|||||||
/**
|
/**
|
||||||
* Screen cell data type (16 bits)
|
* Screen cell data type (16 bits)
|
||||||
*/
|
*/
|
||||||
typedef struct __attribute__((packed)){
|
typedef struct __attribute__((packed)) {
|
||||||
UnicodeCacheRef symbol : 8;
|
UnicodeCacheRef symbol : 8;
|
||||||
Color fg : 8;
|
Color fg;
|
||||||
Color bg : 8;
|
Color bg;
|
||||||
u8 attrs;
|
u8 attrs;
|
||||||
} Cell;
|
} Cell;
|
||||||
|
|
||||||
@@ -68,8 +68,8 @@ static struct {
|
|||||||
#define R1 scr.vm1
|
#define R1 scr.vm1
|
||||||
#define RH (scr.vm1 - scr.vm0 + 1)
|
#define RH (scr.vm1 - scr.vm0 + 1)
|
||||||
// horizontal edges - will be useful if horizontal margin is implemented
|
// horizontal edges - will be useful if horizontal margin is implemented
|
||||||
#define C0 0
|
//#define C0 0
|
||||||
#define C1 (W-1)
|
//#define C1 (W-1)
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
/* Cursor position */
|
/* Cursor position */
|
||||||
@@ -1165,7 +1165,6 @@ screen_reverse_wrap_enable(bool enable)
|
|||||||
void ICACHE_FLASH_ATTR
|
void ICACHE_FLASH_ATTR
|
||||||
screen_set_fg(Color color)
|
screen_set_fg(Color color)
|
||||||
{
|
{
|
||||||
if (color > COLOR_MAX) color = COLOR_MAX;
|
|
||||||
cursor.fg = color;
|
cursor.fg = color;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1175,28 +1174,9 @@ screen_set_fg(Color color)
|
|||||||
void ICACHE_FLASH_ATTR
|
void ICACHE_FLASH_ATTR
|
||||||
screen_set_bg(Color color)
|
screen_set_bg(Color color)
|
||||||
{
|
{
|
||||||
if (color > COLOR_MAX) color = COLOR_MAX;
|
|
||||||
cursor.bg = color;
|
cursor.bg = color;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Set cursor foreground color, extended
|
|
||||||
*/
|
|
||||||
void ICACHE_FLASH_ATTR
|
|
||||||
screen_set_fg_ext(u16 color)
|
|
||||||
{
|
|
||||||
// TODO validate and set
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set cursor background color, extended
|
|
||||||
*/
|
|
||||||
void ICACHE_FLASH_ATTR
|
|
||||||
screen_set_bg_ext(u16 color)
|
|
||||||
{
|
|
||||||
// TODO validate and set
|
|
||||||
}
|
|
||||||
|
|
||||||
void ICACHE_FLASH_ATTR
|
void ICACHE_FLASH_ATTR
|
||||||
screen_set_sgr(u8 attrs, bool ena)
|
screen_set_sgr(u8 attrs, bool ena)
|
||||||
{
|
{
|
||||||
@@ -1264,6 +1244,14 @@ screen_set_reverse_video(bool reverse)
|
|||||||
NOTIFY_DONE();
|
NOTIFY_DONE();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ICACHE_FLASH_ATTR
|
||||||
|
screen_set_bracketed_paste(bool ena)
|
||||||
|
{
|
||||||
|
NOTIFY_LOCK();
|
||||||
|
scr.bracketed_paste = ena;
|
||||||
|
NOTIFY_DONE();
|
||||||
|
}
|
||||||
|
|
||||||
void ICACHE_FLASH_ATTR
|
void ICACHE_FLASH_ATTR
|
||||||
screen_set_newline_mode(bool nlm)
|
screen_set_newline_mode(bool nlm)
|
||||||
{
|
{
|
||||||
@@ -1562,6 +1550,7 @@ struct ScreenSerializeState {
|
|||||||
void ICACHE_FLASH_ATTR
|
void ICACHE_FLASH_ATTR
|
||||||
screenSerializeLabelsToBuffer(char *buffer, size_t buf_len)
|
screenSerializeLabelsToBuffer(char *buffer, size_t buf_len)
|
||||||
{
|
{
|
||||||
|
(void)buf_len;
|
||||||
// let's just assume it's long enough - called with the huge websocket buffer
|
// let's just assume it's long enough - called with the huge websocket buffer
|
||||||
sprintf(buffer, "T%s\x01%s\x01%s\x01%s\x01%s\x01%s", // use 0x01 as separator
|
sprintf(buffer, "T%s\x01%s\x01%s\x01%s\x01%s\x01%s", // use 0x01 as separator
|
||||||
termconf_live.title,
|
termconf_live.title,
|
||||||
@@ -1658,10 +1647,17 @@ screenSerializeToBuffer(char *buffer, size_t buf_len, void **data)
|
|||||||
(termconf_live.show_buttons << 7) |
|
(termconf_live.show_buttons << 7) |
|
||||||
(termconf_live.show_config_links << 8) |
|
(termconf_live.show_config_links << 8) |
|
||||||
((termconf_live.cursor_shape&0x07) << 9) | // 9,10,11 - cursor shape based on DECSCUSR
|
((termconf_live.cursor_shape&0x07) << 9) | // 9,10,11 - cursor shape based on DECSCUSR
|
||||||
(termconf_live.crlf_mode << 12)
|
(termconf_live.crlf_mode << 12) |
|
||||||
|
(scr.bracketed_paste << 13)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define SEQ_TAG_REPEAT '\x02'
|
||||||
|
#define SEQ_TAG_COLORS '\x03'
|
||||||
|
#define SEQ_TAG_ATTRS '\x04'
|
||||||
|
#define SEQ_TAG_FG '\x05'
|
||||||
|
#define SEQ_TAG_BG '\x06'
|
||||||
|
|
||||||
int i = ss->index;
|
int i = ss->index;
|
||||||
while(i < W*H && remain > 12) {
|
while(i < W*H && remain > 12) {
|
||||||
cell = cell0 = &screen[i];
|
cell = cell0 = &screen[i];
|
||||||
@@ -1681,7 +1677,9 @@ screenSerializeToBuffer(char *buffer, size_t buf_len, void **data)
|
|||||||
if (repCnt == 0) {
|
if (repCnt == 0) {
|
||||||
// No repeat
|
// No repeat
|
||||||
bool changeAttrs = cell0->attrs != ss->lastAttrs;
|
bool changeAttrs = cell0->attrs != ss->lastAttrs;
|
||||||
bool changeColors = (cell0->fg != ss->lastFg || cell0->bg != ss->lastBg);
|
bool changeFg = cell0->fg != ss->lastFg;
|
||||||
|
bool changeBg = cell0->bg != ss->lastBg;
|
||||||
|
bool changeColors = changeFg && changeBg;
|
||||||
Color fg, bg;
|
Color fg, bg;
|
||||||
|
|
||||||
// Reverse fg and bg if we're in global reverse mode
|
// Reverse fg and bg if we're in global reverse mode
|
||||||
@@ -1694,16 +1692,18 @@ screenSerializeToBuffer(char *buffer, size_t buf_len, void **data)
|
|||||||
bg = cell0->fg;
|
bg = cell0->fg;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!changeAttrs && changeColors) {
|
if (changeColors) {
|
||||||
bufput_t2B('\x03', fg | (bg<<4));
|
bufput_t3B(SEQ_TAG_COLORS, bg<<8 | fg);
|
||||||
}
|
}
|
||||||
else if (changeAttrs && !changeColors) {
|
else if (changeFg) {
|
||||||
// attrs only
|
bufput_t2B(SEQ_TAG_FG, fg);
|
||||||
bufput_t2B('\x04', cell0->attrs);
|
|
||||||
}
|
}
|
||||||
else if (changeAttrs && changeColors) {
|
else if (changeBg) {
|
||||||
// colors and attrs
|
bufput_t2B(SEQ_TAG_BG, bg);
|
||||||
bufput_t3B('\x01', (u32) (fg | (bg<<4) | (cell0->attrs<<8)));
|
}
|
||||||
|
|
||||||
|
if (changeAttrs) {
|
||||||
|
bufput_t2B(SEQ_TAG_ATTRS, cell0->attrs);
|
||||||
}
|
}
|
||||||
|
|
||||||
// copy the symbol, until first 0 or reached 4 bytes
|
// copy the symbol, until first 0 or reached 4 bytes
|
||||||
@@ -1728,7 +1728,7 @@ screenSerializeToBuffer(char *buffer, size_t buf_len, void **data)
|
|||||||
int savings = ss->lastCharLen*repCnt;
|
int savings = ss->lastCharLen*repCnt;
|
||||||
if (savings > 3) {
|
if (savings > 3) {
|
||||||
// Repeat count
|
// Repeat count
|
||||||
bufput_t2B('\x02', repCnt);
|
bufput_t2B(SEQ_TAG_REPEAT, repCnt);
|
||||||
} else {
|
} else {
|
||||||
// repeat it manually
|
// repeat it manually
|
||||||
for(int k = 0; k < repCnt; k++) {
|
for(int k = 0; k < repCnt; k++) {
|
||||||
|
|||||||
+2
-4
@@ -238,10 +238,6 @@ typedef uint8_t Color; // 0-16
|
|||||||
void screen_set_fg(Color color);
|
void screen_set_fg(Color color);
|
||||||
/** Set cursor background coloor */
|
/** Set cursor background coloor */
|
||||||
void screen_set_bg(Color color);
|
void screen_set_bg(Color color);
|
||||||
/** Set cursor foreground color, extended */
|
|
||||||
void screen_set_fg_ext(u16 color);
|
|
||||||
/** Set cursor background coloor, extended */
|
|
||||||
void screen_set_bg_ext(u16 color);
|
|
||||||
/** Enable/disable attrs by bitmask */
|
/** Enable/disable attrs by bitmask */
|
||||||
void screen_set_sgr(u8 attrs, bool ena);
|
void screen_set_sgr(u8 attrs, bool ena);
|
||||||
/** Set the inverse attribute */
|
/** Set the inverse attribute */
|
||||||
@@ -265,6 +261,8 @@ void screen_set_reverse_video(bool reverse);
|
|||||||
void screen_save_private_opt(int n);
|
void screen_save_private_opt(int n);
|
||||||
/** Restore DECOPT */
|
/** Restore DECOPT */
|
||||||
void screen_restore_private_opt(int n);
|
void screen_restore_private_opt(int n);
|
||||||
|
/** Set bracketed paste */
|
||||||
|
void screen_set_bracketed_paste(bool ena);
|
||||||
|
|
||||||
// --- Charset ---
|
// --- Charset ---
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -31,7 +31,7 @@ buf_pop(void *unused)
|
|||||||
lb_ls++;
|
lb_ls++;
|
||||||
if (lb_ls >= LOGBUF_SIZE) lb_ls = 0;
|
if (lb_ls >= LOGBUF_SIZE) lb_ls = 0;
|
||||||
|
|
||||||
if (OK == UART_WriteCharCRLF(UART1, logbuf[lb_ls], 1000)) {
|
if (OK == UART_WriteCharCRLF(UART1, logbuf[lb_ls], 5)) {
|
||||||
quantity--;
|
quantity--;
|
||||||
} else {
|
} else {
|
||||||
// try another time
|
// try another time
|
||||||
|
|||||||
+9
-11
@@ -64,12 +64,12 @@ static void ICACHE_FLASH_ATTR prHeapTimerCb(void *arg)
|
|||||||
if (diff == 0) {
|
if (diff == 0) {
|
||||||
if (cnt == 5) {
|
if (cnt == 5) {
|
||||||
// only every 5 secs if no change
|
// only every 5 secs if no change
|
||||||
dbg("Free heap: %d bytes", heap);
|
dbg("FH: %d", heap);
|
||||||
cnt = 0;
|
cnt = 0;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// report change
|
// report change
|
||||||
dbg("Free heap: %d bytes (%s%d)", heap, cc, diff);
|
dbg("FH: %d (%s%d)", heap, cc, diff);
|
||||||
cnt = 0;
|
cnt = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -79,13 +79,14 @@ static void ICACHE_FLASH_ATTR prHeapTimerCb(void *arg)
|
|||||||
|
|
||||||
// Deferred init
|
// Deferred init
|
||||||
static void user_start(void *unused);
|
static void user_start(void *unused);
|
||||||
|
static void user_start2(void *unused);
|
||||||
|
|
||||||
|
static ETSTimer userStartTimer;
|
||||||
|
static ETSTimer prHeapTimer;
|
||||||
|
|
||||||
//Main routine. Initialize stdout, the I/O, filesystem and the webserver and we're done.
|
//Main routine. Initialize stdout, the I/O, filesystem and the webserver and we're done.
|
||||||
void ICACHE_FLASH_ATTR user_init(void)
|
void ICACHE_FLASH_ATTR user_init(void)
|
||||||
{
|
{
|
||||||
static ETSTimer userStartTimer;
|
|
||||||
static ETSTimer prHeapTimer;
|
|
||||||
|
|
||||||
serialInitBase();
|
serialInitBase();
|
||||||
|
|
||||||
// Prevent WiFi starting and connecting by default
|
// Prevent WiFi starting and connecting by default
|
||||||
@@ -113,17 +114,14 @@ void ICACHE_FLASH_ATTR user_init(void)
|
|||||||
|
|
||||||
#if DEBUG_HEAP
|
#if DEBUG_HEAP
|
||||||
// Heap use timer & blink
|
// Heap use timer & blink
|
||||||
os_timer_disarm(&prHeapTimer);
|
TIMER_START(&prHeapTimer, prHeapTimerCb, 1000, 1);
|
||||||
os_timer_setfn(&prHeapTimer, prHeapTimerCb, NULL);
|
|
||||||
os_timer_arm(&prHeapTimer, 1000, 1);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// do later (some functions do not work if called from user_init)
|
// do later (some functions do not work if called from user_init)
|
||||||
os_timer_disarm(&userStartTimer);
|
TIMER_START(&userStartTimer, user_start, 10, 0);
|
||||||
os_timer_setfn(&userStartTimer, user_start, NULL);
|
|
||||||
os_timer_arm(&userStartTimer, 10, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void ICACHE_FLASH_ATTR user_start(void *unused)
|
static void ICACHE_FLASH_ATTR user_start(void *unused)
|
||||||
{
|
{
|
||||||
// Load and apply stored settings, or defaults if stored settings are invalid
|
// Load and apply stored settings, or defaults if stored settings are invalid
|
||||||
|
|||||||
Reference in New Issue
Block a user