Browse Source

Added UART_MQTT_TERMINATION setting

rfm69
Xose Pérez 6 years ago
parent
commit
3dae7b71a0
3 changed files with 8 additions and 2 deletions
  1. +1
    -1
      README.md
  2. +4
    -0
      code/espurna/config/general.h
  3. +3
    -1
      code/espurna/uartmqtt.ino

+ 1
- 1
README.md View File

@ -3,7 +3,7 @@
ESPurna ("spark" in Catalan) is a custom firmware for ESP8285/ESP8266 based smart switches, lights and sensors. 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. 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/) [![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) [![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) [![codacy](https://img.shields.io/codacy/grade/c9496e25cf07434cba786b462cb15f49/dev.svg)](https://www.codacy.com/app/xoseperez/espurna/dashboard)


+ 4
- 0
code/espurna/config/general.h View File

@ -511,6 +511,10 @@
#define UART_MQTT_BAUDRATE 115200 // Serial speed #define UART_MQTT_BAUDRATE 115200 // Serial speed
#endif #endif
#ifndef UART_MQTT_TERMINATION
#define UART_MQTT_TERMINATION '\n' // Termination character
#endif
#define UART_MQTT_BUFFER_SIZE 100 // UART buffer size #define UART_MQTT_BUFFER_SIZE 100 // UART buffer size
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------


+ 3
- 1
code/espurna/uartmqtt.ino View File

@ -32,15 +32,17 @@ void _uartmqttReceiveUART() {
char rc = UART_MQTT_PORT.read(); char rc = UART_MQTT_PORT.read();
if (rc != '\n') {
if (rc != UART_MQTT_TERMINATION) {
_uartmqttBuffer[ndx] = rc; _uartmqttBuffer[ndx] = rc;
if (ndx < UART_MQTT_BUFFER_SIZE - 1) ndx++; if (ndx < UART_MQTT_BUFFER_SIZE - 1) ndx++;
} else { } else {
_uartmqttBuffer[ndx] = '\0'; _uartmqttBuffer[ndx] = '\0';
_uartmqttNewData = true; _uartmqttNewData = true;
ndx = 0; ndx = 0;
} }
} }


Loading…
Cancel
Save