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
+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);