Logging is now toggleable and updates are postponed if socket is busy

This commit is contained in:
2017-08-22 23:05:21 +02:00
parent 0e73f57da1
commit 5c57ea3b28
10 changed files with 41 additions and 15 deletions
+1 -2
View File
@@ -144,8 +144,7 @@ add_definitions(
-DFLAG_GZIP=2
-DADMIN_PASSWORD="asdf"
-DGIT_HASH="blabla"
-DDEBUG_ANSI=1
-DDEBUG_ANSI_NOIMPL=1
-DDEBUG_HEAP=1
-DESPFS_HEATSHRINK)
add_executable(esp_vt100_firmware ${SOURCE_FILES})
+3 -5
View File
@@ -67,14 +67,12 @@ CFLAGS = -Os -ggdb -std=gnu99 -Werror -Wpointer-arith -Wundef -Wall -Wl,-EL -fn
-nostdlib -mlongcalls -mtext-section-literals -D__ets__ -DICACHE_FLASH \
-Wno-address -Wno-unused
CFLAGS += -DHTTPD_MAX_BACKLOG_SIZE=10240
CFLAGS += -DGIT_HASH='"$(shell git rev-parse --short HEAD)"'
CFLAGS += -DADMIN_PASSWORD=$(ADMIN_PASSWORD)
# Debug logging
CFLAGS += -DDEBUG_ANSI=1
CFLAGS += -DDEBUG_ANSI_NOIMPL=1
CFLAGS += -DDEBUG_INPUT=1
ifdef GLOBAL_CFLAGS
CFLAGS += $(GLOBAL_CFLAGS)
endif
# linker flags used to generate the main object file
LDFLAGS = -nostdlib -Wl,--no-check-sections -u call_user_start -Wl,-static
+12
View File
@@ -40,3 +40,15 @@ ESP_SPI_FLASH_SIZE_K = 1024
# Admin password, used to store settings to flash as defaults
ADMIN_PASSWORD = "19738426"
GLOBAL_CFLAGS = \
-DDEBUG_ROUTER=0 \
-DDEBUG_CAPTDNS=0 \
-DDEBUG_HTTP=1 \
-DDEBUG_ESPFS=0 \
-DDEBUG_WS=0 \
-DDEBUG_ANSI=0 \
-DDEBUG_ANSI_NOIMPL=0 \
-DHTTPD_MAX_BACKLOG_SIZE=8192 \
-DDEBUG_INPUT=0 \
-DDEBUG_HEAP=1 \
+2 -2
View File
@@ -2003,10 +2003,10 @@ var Input = (function() {
'down': ca('\x1bOB', '\x1b[B'),
'right': ca('\x1bOC', '\x1b[C'),
'left': ca('\x1bOD', '\x1b[D'),
'home': fa('\x1bOH', '\x1b[1~'),
'home': ca('\x1bOH', fa('\x1b[H', '\x1b[1~')),
'insert': '\x1b[2~',
'delete': '\x1b[3~',
'end': fa('\x1bOF', '\x1b[4~'),
'end': ca('\x1bOF', fa('\x1b[F', '\x1b[4~')),
'pageup': '\x1b[5~',
'pagedown': '\x1b[6~',
'f1': fa('\x1bOP', '\x1b[11~'),
+10 -2
View File
@@ -9,13 +9,21 @@
#include <esp8266.h>
#ifndef DEBUG_ANSI
#define DEBUG_ANSI 0
#endif
#ifndef DEBUG_ANSI_NOIMPL
#define DEBUG_ANSI_NOIMPL 0
#endif
// defined in the makefile
#if DEBUG_ANSI
#define ansi_warn warn
#define ansi_dbg dbg
#else
#define ansi_warn(...)
#define ansi_dbg(...)
#define ansi_warn(fmt, ...)
#define ansi_dbg(fmt, ...)
#endif
#if DEBUG_ANSI_NOIMPL
+4 -2
View File
@@ -21,12 +21,14 @@ static ETSTimer notifyTim2;
static void ICACHE_FLASH_ATTR
notifyTimCb(void *arg) {
void *data = NULL;
int max_bl, total_bl;
cgiWebsockMeasureBacklog(URL_WS_UPDATE, &max_bl, &total_bl);
if (!notify_available) {
if (!notify_available || (max_bl > 2048)) { // do not send if we have anything significant backlogged
// postpone a little
os_timer_disarm(&notifyTim);
os_timer_setfn(&notifyTim, notifyTimCb, NULL);
os_timer_arm(&notifyTim, 1, 0);
os_timer_arm(&notifyTim, 5, 0);
return;
}
notify_available = false;
+5
View File
@@ -217,6 +217,11 @@ screen_reset(void)
screen_clear_all_tabs();
// Set initial tabstops
for (int i = 0; i < TABSTOP_WORDS; i++) {
tab_stops[i] = 0x80808080;
}
NOTIFY_DONE();
}
+1 -1
View File
@@ -63,7 +63,7 @@ void ICACHE_FLASH_ATTR UART_SetupAsyncReceiver(void)
ETS_UART_INTR_ATTACH((void *)uart0_rx_intr_handler, &(UartDev.rcv_buff)); // the buf will be used as an arg
// fifo threshold config (max: UART_RXFIFO_FULL_THRHD = 127)
uint32_t conf = ((60) << UART_RXFIFO_FULL_THRHD_S);
uint32_t conf = ((90) << UART_RXFIFO_FULL_THRHD_S);
conf |= ((0x10 & UART_TXFIFO_EMPTY_THRHD) << UART_TXFIFO_EMPTY_THRHD_S);
// timeout config
conf |= ((0x02 & UART_RX_TOUT_THRHD) << UART_RX_TOUT_THRHD_S); // timeout threshold
+2
View File
@@ -113,10 +113,12 @@ void ICACHE_FLASH_ATTR user_init(void)
espFsInit((void *) (webpages_espfs_start));
#endif
#if DEBUG_HEAP
// Heap use timer & blink
os_timer_disarm(&prHeapTimer);
os_timer_setfn(&prHeapTimer, prHeapTimerCb, NULL);
os_timer_arm(&prHeapTimer, 1000, 1);
#endif
// do later (some functions do not work if called from user_init)
os_timer_disarm(&userStartTimer);