diff --git a/esp-link.vcxproj b/esp-link.vcxproj index 3e727e4..27d9fcc 100644 --- a/esp-link.vcxproj +++ b/esp-link.vcxproj @@ -129,8 +129,8 @@ - __ets__;_STDINT_H;ICACHE_FLASH;__MINGW32__;__WIN32__ - .\rest;.\esp-link;.\mqtt;.\cmd;.\serial;.\user;.\espfs;.\httpd;.\include;..\esp_iot_sdk_v1.3.0\include;..\xtensa-lx106-elf\xtensa-lx106-elf\include;c:\tools\mingw64\x86_64-w64-mingw32\include;c:\tools\mingw64\lib\gcc\x86_64-w64-mingw32\4.8.3\include + __ets__;_STDINT_H;ICACHE_FLASH;__MINGW32__;__WIN32__;MQTT + .\rest;.\esp-link;.\mqtt;.\cmd;.\serial;.\user;.\espfs;.\httpd;.\include;..\esp_iot_sdk_v1.4.0\include;..\xtensa-lx106-elf\xtensa-lx106-elf\include;c:\tools\mingw64\x86_64-w64-mingw32\include;c:\tools\mingw64\lib\gcc\x86_64-w64-mingw32\4.8.3\include diff --git a/esp-link/mqtt_client.c b/esp-link/mqtt_client.c index 3969530..431e5f0 100644 --- a/esp-link/mqtt_client.c +++ b/esp-link/mqtt_client.c @@ -12,11 +12,6 @@ MQTT_Client mqttClient; // main mqtt client used by esp-link -#ifdef BRUNNELS -char* statusTopicStr; -static char* onlineMsgStr; -#endif - static MqttCallback connected_cb; static MqttCallback disconnected_cb; static MqttCallback published_cb; @@ -27,9 +22,6 @@ mqttConnectedCb(uint32_t *args) { DBG_MQTTCLIENT("MQTT Client: Connected\n"); //MQTT_Client* client = (MQTT_Client*)args; //MQTT_Subscribe(client, "system/time", 0); // handy for testing -#ifdef BRUNNELS - MQTT_Publish(client, "announce/all", onlineMsgStr, 0, 0); -#endif if (connected_cb) connected_cb(args); } @@ -93,29 +85,6 @@ mqtt_client_init() flashConfig.mqtt_clientid, flashConfig.mqtt_username, flashConfig.mqtt_password, flashConfig.mqtt_keepalive); -// removed client_id concat for now until a better solution is devised -// statusTopicStr = (char*)os_zalloc(strlen(flashConfig.mqtt_clientid) + strlen(flashConfig.mqtt_status_topic) + 2); -// os_strcpy(statusTopicStr, flashConfig.mqtt_clientid); -// os_strcat(statusTopicStr, "/"); - -#ifdef BRUNNELS - char* onlineMsg = " is online"; - onlineMsgStr = (char*)os_zalloc(strlen(flashConfig.mqtt_clientid) + strlen(onlineMsg) + 1); - os_strcpy(onlineMsgStr, flashConfig.mqtt_clientid); - os_strcat(onlineMsgStr, onlineMsg); - - char* offlineMsg = " is offline"; - char* offlineMsgStr = (char*)os_zalloc(strlen(flashConfig.mqtt_clientid) + strlen(offlineMsg) + 1); - os_strcpy(offlineMsgStr, flashConfig.mqtt_clientid); - os_strcat(offlineMsgStr, offlineMsg); - - char* lwt = "/lwt"; - char *lwtMsgStr = (char*)os_zalloc(strlen(flashConfig.mqtt_clientid) + strlen(lwt) + 1); - os_strcpy(lwtMsgStr, flashConfig.mqtt_clientid); - os_strcat(lwtMsgStr, lwt); - MQTT_InitLWT(&mqttClient, lwtMsgStr, offlineMsg, 0, 0); -#endif - MQTT_OnConnected(&mqttClient, mqttConnectedCb); MQTT_OnDisconnected(&mqttClient, mqttDisconnectedCb); MQTT_OnPublished(&mqttClient, mqttPublishedCb); diff --git a/serial/slip.c b/serial/slip.c index 4125a08..b9446e3 100644 --- a/serial/slip.c +++ b/serial/slip.c @@ -7,6 +7,12 @@ #include "console.h" #include "cmd.h" +#ifdef SLIP_DBG +#define DBG(format, ...) os_printf(format, ## __VA_ARGS__) +#else +#define DBG(format, ...) do { } while(0) +#endif + uint8_t slip_disabled; // temporarily disable slip to allow flashing of attached MCU extern void ICACHE_FLASH_ATTR console_process(char *buf, short len); @@ -48,15 +54,15 @@ slip_process() { } else { os_printf("SLIP: bad CRC, crc=%x rcv=%x\n", crc, rcv); -#ifdef SLIP_DBG for (short i=0; i= ' ' && slip_buf[i] <= '~') - os_printf("%c", slip_buf[i]); - else - os_printf("\\%02X", slip_buf[i]); + if (slip_buf[i] >= ' ' && slip_buf[i] <= '~') { + DBG("%c", slip_buf[i]); + } + else { + DBG("\\%02X", slip_buf[i]); + } } - os_printf("\n"); -#endif + DBG("\n"); } } } @@ -86,9 +92,7 @@ slip_parse_char(char c) { if (slip_len > 0) console_process(slip_buf, slip_len); slip_reset(); slip_inpkt = true; -#ifdef SLIP_DBG - os_printf("SLIP: start\n"); -#endif + DBG("SLIP: start\n"); return; } } else if (slip_escaped) {