From 73c98eb2d1a584cdf2f84e55af7b36f11815a22b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Hru=C5=A1ka?= Date: Wed, 4 Oct 2017 00:10:54 +0200 Subject: [PATCH] some logging adjustments --- include/user_config.h | 1 - user/ansi_parser_callbacks.c | 2 ++ user/cgi_d2d.c | 13 ++++++------- user/user_main.c | 14 +++++++------- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/include/user_config.h b/include/user_config.h index 8b13789..e69de29 100644 --- a/include/user_config.h +++ b/include/user_config.h @@ -1 +0,0 @@ - diff --git a/user/ansi_parser_callbacks.c b/user/ansi_parser_callbacks.c index 906a072..d17187f 100644 --- a/user/ansi_parser_callbacks.c +++ b/user/ansi_parser_callbacks.c @@ -62,6 +62,8 @@ apars_handle_enq(void) else buf--; // remove the trailing space buf += sprintf(buf, "\x1b\\"); + (void)buf; + // version encased in SOS and ST apars_respond(buf100); diff --git a/user/cgi_d2d.c b/user/cgi_d2d.c index 522c50e..1c28235 100644 --- a/user/cgi_d2d.c +++ b/user/cgi_d2d.c @@ -63,8 +63,6 @@ requestCb(int http_status, struct d2d_request_opts *opts = userArg; - d2d_dbg("Rx url response, code %d, nonce \"%s\"", http_status, opts->nonce?opts->nonce:""); - // ensure positive - would be hard to parse if (http_status < 0) http_status = -http_status; @@ -77,6 +75,8 @@ requestCb(int http_status, if (opts->max_result_len > 0 && len > opts->max_result_len) len = (int) opts->max_result_len; + d2d_info("Rx HTTP response, code %d, len %d, nonce \"%s\"", http_status, len, opts->nonce?opts->nonce:""); + char *bb = buff100; bb += sprintf(bb, "\x1b^h;%d;", http_status); const char *comma = ""; @@ -160,7 +160,7 @@ d2d_parse_command(char *msg) FIND_NEXT(ip, ';'); const char *payload = msg; - d2d_dbg("D2D Tx,dest=%s,msg=%s", ip, payload); + d2d_info("D2D Tx,dest=%s,msg=%s", ip, payload); sprintf(buff40, "http://%s" API_D2D_MSG, ip); httpclient_args args; @@ -203,9 +203,8 @@ d2d_parse_command(char *msg) FIND_NEXT(params, ';'); + d2d_info("HTTP request"); d2d_dbg("Method %s", method); - d2d_dbg("Params %s", params); - size_t max_buf_len = HTTPCLIENT_DEF_MAX_LEN; size_t max_result_len = 0; // 0 = no truncate uint timeout = HTTPCLIENT_DEF_TIMEOUT_MS; @@ -274,7 +273,7 @@ d2d_parse_command(char *msg) request_pending = true; http_request(&args, no_resp ? requestNoopCb : requestCb); - d2d_dbg("Done"); + d2d_dbg("Request sent."); return true; } @@ -308,7 +307,7 @@ httpd_cgi_state ICACHE_FLASH_ATTR cgiD2DMessage(HttpdConnData *connData) sendResponseToUART("\a"); - d2d_dbg("D2D Rx src="IPSTR",len=%d", ip[0], ip[1], ip[2], ip[3],len); + d2d_info("D2D Rx src="IPSTR",len=%d", ip[0], ip[1], ip[2], ip[3],len); // Received a msg diff --git a/user/user_main.c b/user/user_main.c index 62afe2e..db52518 100644 --- a/user/user_main.c +++ b/user/user_main.c @@ -74,12 +74,12 @@ static void ICACHE_FLASH_ATTR prHeapTimerCb(void *arg) if (diff == 0) { if (cnt == 5) { // only every 5 secs if no change - dbg("Rx: %2d%c, Tx: %2d%c, Hp: %d", rxp, '%', txp, '%', heap); + dbg("Rx/Tx: %d/%d%c, Hp: %d", rxp, txp, '%', heap); cnt = 0; } } else { // report change - dbg("Rx: %2d%c, Tx: %2d%c, Hp: %d (%s%d)", rxp, '%', txp, '%', heap, cc, diff); + dbg("Rx/Tx: %d/%d%c, Hp: %d (%s%d)", rxp, txp, '%', heap, cc, diff); cnt = 0; } @@ -131,11 +131,6 @@ void ICACHE_FLASH_ATTR user_init(void) espFsInit((void *) (webpages_espfs_start)); #endif -#if DEBUG_HEAP - // Heap use timer & blink - TIMER_START(&prHeapTimer, prHeapTimerCb, HEAP_TIMER_MS, 1); -#endif - // do later (some functions do not work if called from user_init) TIMER_START(&userStartTimer, user_start, 10, 0); } @@ -154,6 +149,11 @@ static void ICACHE_FLASH_ATTR user_start(void *unused) // Print the CANCEL character to indicate the module has restarted // Critically important for client application if any kind of screen persistence / content re-use is needed UART_WriteChar(UART0, CAN, UART_TIMEOUT_US); // 0x18 - 24 - CAN + +#if DEBUG_HEAP + // Heap use timer & blink + TIMER_START(&prHeapTimer, prHeapTimerCb, HEAP_TIMER_MS, 1); +#endif } // ---- unused funcs removed from sdk to save space ---