Logging is now toggleable and updates are postponed if socket is busy
This commit is contained in:
+10
-2
@@ -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
@@ -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(¬ifyTim);
|
||||
os_timer_setfn(¬ifyTim, notifyTimCb, NULL);
|
||||
os_timer_arm(¬ifyTim, 1, 0);
|
||||
os_timer_arm(¬ifyTim, 5, 0);
|
||||
return;
|
||||
}
|
||||
notify_available = false;
|
||||
|
||||
@@ -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
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user