From 3cb55b5648badf29ec5c3be5d7aad94efe320540 Mon Sep 17 00:00:00 2001 From: Thorsten von Eicken Date: Sat, 22 Oct 2016 20:38:23 -0700 Subject: [PATCH] fix serial LED, fixes #199 --- serial/console.c | 9 +++++---- serial/serbridge.c | 4 ---- serial/serled.c | 3 +-- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/serial/console.c b/serial/console.c index 330c870..234dd06 100644 --- a/serial/console.c +++ b/serial/console.c @@ -5,6 +5,7 @@ #include "cgi.h" #include "uart.h" #include "serbridge.h" +#include "serled.h" #include "config.h" #include "console.h" @@ -80,6 +81,7 @@ ajaxConsoleBaud(HttpdConnData *connData) { httpdSend(connData, buff, -1); return HTTPD_CGI_DONE; } + int ICACHE_FLASH_ATTR ajaxConsoleFormat(HttpdConnData *connData) { if (connData->conn==NULL) return HTTPD_CGI_DONE; // Connection aborted. Clean up. @@ -104,10 +106,8 @@ ajaxConsoleFormat(HttpdConnData *connData) { } jsonHeader(connData, status); - os_sprintf(buff, "{\"fmt\": \"%c%c%c\"}", - flashConfig.data_bits + '5', - flashConfig.parity ? 'E' : 'N', - flashConfig.stop_bits ? '2': '1'); + os_sprintf(buff, "{\"fmt\": \"%c%c%c\"}", flashConfig.data_bits + '5', + flashConfig.parity ? 'E' : 'N', flashConfig.stop_bits ? '2': '1'); httpdSend(connData, buff, -1); return HTTPD_CGI_DONE; } @@ -122,6 +122,7 @@ ajaxConsoleSend(HttpdConnData *connData) { // figure out where to start in buffer based on URI param len = httpdFindArg(connData->getArgs, "text", buff, sizeof(buff)); if (len > 0) { + serledFlash(50); // short blink on serial LED uart0_tx_buffer(buff, len); status = 200; } diff --git a/serial/serbridge.c b/serial/serbridge.c index 9f782bb..cebc561 100644 --- a/serial/serbridge.c +++ b/serial/serbridge.c @@ -16,8 +16,6 @@ #define syslog(X1...) #endif -#define SKIP_AT_RESET - static struct espconn serbridgeConn1; // plain bridging port static struct espconn serbridgeConn2; // programming port static esp_tcp serbridgeTcp1, serbridgeTcp2; @@ -223,10 +221,8 @@ serbridgeRecvCb(void *arg, char *data, unsigned short len) os_delay_us(1000L); // wait a millisecond before writing to the UART below conn->conn_mode = cmPGM; in_mcu_flashing++; // disable SLIP so it doesn't interfere with flashing -#ifdef SKIP_AT_RESET serledFlash(50); // short blink on serial LED return; -#endif } diff --git a/serial/serled.c b/serial/serled.c index 6780eb6..5bd66a2 100644 --- a/serial/serled.c +++ b/serial/serled.c @@ -29,7 +29,6 @@ void ICACHE_FLASH_ATTR serledFlash(int duration) { } void ICACHE_FLASH_ATTR serledInit(void) { - return; int8_t pin = flashConfig.ser_led_pin; if (pin >= 0) { makeGpio(pin); @@ -37,7 +36,7 @@ void ICACHE_FLASH_ATTR serledInit(void) { serledFlash(1000); // turn it on for 1 second } #ifdef SERLED_DBG - os_printf("SER led=%d\n", pin); + os_printf("SER led=%d\n", pin); #endif }