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

pull/111/merge
Ondřej Hruška 7 years ago
parent 0e73f57da1
commit 5c57ea3b28
  1. 3
      CMakeLists.txt
  2. 8
      Makefile
  3. 12
      esphttpdconfig.mk
  4. 4
      html_orig/js/app.js
  5. 2
      libesphttpd
  6. 12
      user/apars_logging.h
  7. 6
      user/cgi_sockets.c
  8. 5
      user/screen.c
  9. 2
      user/uart_handler.c
  10. 2
      user/user_main.c

@ -144,8 +144,7 @@ add_definitions(
-DFLAG_GZIP=2 -DFLAG_GZIP=2
-DADMIN_PASSWORD="asdf" -DADMIN_PASSWORD="asdf"
-DGIT_HASH="blabla" -DGIT_HASH="blabla"
-DDEBUG_ANSI=1 -DDEBUG_HEAP=1
-DDEBUG_ANSI_NOIMPL=1
-DESPFS_HEATSHRINK) -DESPFS_HEATSHRINK)
add_executable(esp_vt100_firmware ${SOURCE_FILES}) add_executable(esp_vt100_firmware ${SOURCE_FILES})

@ -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 \ -nostdlib -mlongcalls -mtext-section-literals -D__ets__ -DICACHE_FLASH \
-Wno-address -Wno-unused -Wno-address -Wno-unused
CFLAGS += -DHTTPD_MAX_BACKLOG_SIZE=10240
CFLAGS += -DGIT_HASH='"$(shell git rev-parse --short HEAD)"' CFLAGS += -DGIT_HASH='"$(shell git rev-parse --short HEAD)"'
CFLAGS += -DADMIN_PASSWORD=$(ADMIN_PASSWORD) CFLAGS += -DADMIN_PASSWORD=$(ADMIN_PASSWORD)
# Debug logging ifdef GLOBAL_CFLAGS
CFLAGS += -DDEBUG_ANSI=1 CFLAGS += $(GLOBAL_CFLAGS)
CFLAGS += -DDEBUG_ANSI_NOIMPL=1 endif
CFLAGS += -DDEBUG_INPUT=1
# linker flags used to generate the main object file # linker flags used to generate the main object file
LDFLAGS = -nostdlib -Wl,--no-check-sections -u call_user_start -Wl,-static LDFLAGS = -nostdlib -Wl,--no-check-sections -u call_user_start -Wl,-static

@ -40,3 +40,15 @@ ESP_SPI_FLASH_SIZE_K = 1024
# Admin password, used to store settings to flash as defaults # Admin password, used to store settings to flash as defaults
ADMIN_PASSWORD = "19738426" 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 \

@ -2003,10 +2003,10 @@ var Input = (function() {
'down': ca('\x1bOB', '\x1b[B'), 'down': ca('\x1bOB', '\x1b[B'),
'right': ca('\x1bOC', '\x1b[C'), 'right': ca('\x1bOC', '\x1b[C'),
'left': ca('\x1bOD', '\x1b[D'), 'left': ca('\x1bOD', '\x1b[D'),
'home': fa('\x1bOH', '\x1b[1~'), 'home': ca('\x1bOH', fa('\x1b[H', '\x1b[1~')),
'insert': '\x1b[2~', 'insert': '\x1b[2~',
'delete': '\x1b[3~', 'delete': '\x1b[3~',
'end': fa('\x1bOF', '\x1b[4~'), 'end': ca('\x1bOF', fa('\x1b[F', '\x1b[4~')),
'pageup': '\x1b[5~', 'pageup': '\x1b[5~',
'pagedown': '\x1b[6~', 'pagedown': '\x1b[6~',
'f1': fa('\x1bOP', '\x1b[11~'), 'f1': fa('\x1bOP', '\x1b[11~'),

@ -1 +1 @@
Subproject commit b804b196fca6abf28a7e2b5bd482b76b49d518f7 Subproject commit 3237c6f8fb9fd91b22980116b89768e1ca21cf66

@ -9,13 +9,21 @@
#include <esp8266.h> #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 // defined in the makefile
#if DEBUG_ANSI #if DEBUG_ANSI
#define ansi_warn warn #define ansi_warn warn
#define ansi_dbg dbg #define ansi_dbg dbg
#else #else
#define ansi_warn(...) #define ansi_warn(fmt, ...)
#define ansi_dbg(...) #define ansi_dbg(fmt, ...)
#endif #endif
#if DEBUG_ANSI_NOIMPL #if DEBUG_ANSI_NOIMPL

@ -21,12 +21,14 @@ static ETSTimer notifyTim2;
static void ICACHE_FLASH_ATTR static void ICACHE_FLASH_ATTR
notifyTimCb(void *arg) { notifyTimCb(void *arg) {
void *data = NULL; 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 // postpone a little
os_timer_disarm(&notifyTim); os_timer_disarm(&notifyTim);
os_timer_setfn(&notifyTim, notifyTimCb, NULL); os_timer_setfn(&notifyTim, notifyTimCb, NULL);
os_timer_arm(&notifyTim, 1, 0); os_timer_arm(&notifyTim, 5, 0);
return; return;
} }
notify_available = false; notify_available = false;

@ -217,6 +217,11 @@ screen_reset(void)
screen_clear_all_tabs(); screen_clear_all_tabs();
// Set initial tabstops
for (int i = 0; i < TABSTOP_WORDS; i++) {
tab_stops[i] = 0x80808080;
}
NOTIFY_DONE(); NOTIFY_DONE();
} }

@ -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 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) // 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); conf |= ((0x10 & UART_TXFIFO_EMPTY_THRHD) << UART_TXFIFO_EMPTY_THRHD_S);
// timeout config // timeout config
conf |= ((0x02 & UART_RX_TOUT_THRHD) << UART_RX_TOUT_THRHD_S); // timeout threshold conf |= ((0x02 & UART_RX_TOUT_THRHD) << UART_RX_TOUT_THRHD_S); // timeout threshold

@ -113,10 +113,12 @@ void ICACHE_FLASH_ATTR user_init(void)
espFsInit((void *) (webpages_espfs_start)); espFsInit((void *) (webpages_espfs_start));
#endif #endif
#if DEBUG_HEAP
// Heap use timer & blink // Heap use timer & blink
os_timer_disarm(&prHeapTimer); os_timer_disarm(&prHeapTimer);
os_timer_setfn(&prHeapTimer, prHeapTimerCb, NULL); os_timer_setfn(&prHeapTimer, prHeapTimerCb, NULL);
os_timer_arm(&prHeapTimer, 1000, 1); os_timer_arm(&prHeapTimer, 1000, 1);
#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); os_timer_disarm(&userStartTimer);

Loading…
Cancel
Save