diff --git a/README.md b/README.md index 4732fbda..b5d79f23 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ ESPurna ("spark" in Catalan) is a custom firmware for ESP8285/ESP8266 based smart switches, lights and sensors. It uses the Arduino Core for ESP8266 framework and a number of 3rd party libraries. -[![version](https://img.shields.io/badge/version-1.12.6-brightgreen.svg)](CHANGELOG.md) +[![version](https://img.shields.io/badge/version-1.12.7a-brightgreen.svg)](CHANGELOG.md) [![branch](https://img.shields.io/badge/branch-dev-orange.svg)](https://github.org/xoseperez/espurna/tree/dev/) [![travis](https://travis-ci.org/xoseperez/espurna.svg?branch=dev)](https://travis-ci.org/xoseperez/espurna) [![codacy](https://img.shields.io/codacy/grade/c9496e25cf07434cba786b462cb15f49/dev.svg)](https://www.codacy.com/app/xoseperez/espurna/dashboard) diff --git a/code/espurna/config/general.h b/code/espurna/config/general.h index 245792aa..2ca143ab 100644 --- a/code/espurna/config/general.h +++ b/code/espurna/config/general.h @@ -511,6 +511,10 @@ #define UART_MQTT_BAUDRATE 115200 // Serial speed #endif +#ifndef UART_MQTT_TERMINATION +#define UART_MQTT_TERMINATION '\n' // Termination character +#endif + #define UART_MQTT_BUFFER_SIZE 100 // UART buffer size // ----------------------------------------------------------------------------- diff --git a/code/espurna/uartmqtt.ino b/code/espurna/uartmqtt.ino index bc96878a..ed3132e6 100644 --- a/code/espurna/uartmqtt.ino +++ b/code/espurna/uartmqtt.ino @@ -32,15 +32,17 @@ void _uartmqttReceiveUART() { char rc = UART_MQTT_PORT.read(); - if (rc != '\n') { + if (rc != UART_MQTT_TERMINATION) { _uartmqttBuffer[ndx] = rc; if (ndx < UART_MQTT_BUFFER_SIZE - 1) ndx++; } else { + _uartmqttBuffer[ndx] = '\0'; _uartmqttNewData = true; ndx = 0; + } }