Browse Source

Fix hardcoded serial objects in _debugSendSerial, terminalLoop and PZEM sensor (#1573)

rules-rpn
Xose Pérez 5 years ago
parent
commit
1e831a0dd8
4 changed files with 10 additions and 6 deletions
  1. +2
    -2
      README.md
  2. +2
    -2
      code/espurna/debug.ino
  3. +5
    -1
      code/espurna/sensors/PZEM004TSensor.h
  4. +1
    -1
      code/espurna/terminal.ino

+ 2
- 2
README.md View File

@ -4,9 +4,9 @@ ESPurna ("spark" in Catalan) is a custom firmware for ESP8285/ESP8266 based smar
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.13.4-brightgreen.svg)](CHANGELOG.md) [![version](https://img.shields.io/badge/version-1.13.4-brightgreen.svg)](CHANGELOG.md)
[![branch](https://img.shields.io/badge/branch-master-orange.svg)](https://github.com/xoseperez/espurna/tree/master/)
[![branch](https://img.shields.io/badge/branch-dev-orange.svg)](https://github.com/xoseperez/espurna/tree/dev/)
[![license](https://img.shields.io/github/license/xoseperez/espurna.svg)](LICENSE) [![license](https://img.shields.io/github/license/xoseperez/espurna.svg)](LICENSE)
[![travis](https://travis-ci.org/xoseperez/espurna.svg?branch=master)](https://travis-ci.org/xoseperez/espurna)
[![travis](https://travis-ci.org/xoseperez/espurna.svg?branch=dev)](https://travis-ci.org/xoseperez/espurna)
[![codacy](https://api.codacy.com/project/badge/Grade/c9496e25cf07434cba786b462cb15f49)](https://www.codacy.com/app/xoseperez/espurna/dashboard) [![codacy](https://api.codacy.com/project/badge/Grade/c9496e25cf07434cba786b462cb15f49)](https://www.codacy.com/app/xoseperez/espurna/dashboard)
[![downloads](https://img.shields.io/github/downloads/xoseperez/espurna/total.svg)](https://github.com/xoseperez/espurna/releases) [![downloads](https://img.shields.io/github/downloads/xoseperez/espurna/total.svg)](https://github.com/xoseperez/espurna/releases)
<br /> <br />


+ 2
- 2
code/espurna/debug.ino View File

@ -19,9 +19,9 @@ char _udp_syslog_header[40] = {0};
#if DEBUG_SERIAL_SUPPORT #if DEBUG_SERIAL_SUPPORT
void _debugSendSerial(const char* prefix, const char* data) { void _debugSendSerial(const char* prefix, const char* data) {
if (prefix && (prefix[0] != '\0')) { if (prefix && (prefix[0] != '\0')) {
Serial.print(prefix);
DEBUG_PORT.print(prefix);
} }
Serial.print(data);
DEBUG_PORT.print(data);
} }
#endif #endif


+ 5
- 1
code/espurna/sensors/PZEM004TSensor.h View File

@ -247,7 +247,11 @@ class PZEM004TSensor : public BaseSensor {
_busy = true; _busy = true;
// Clear buffer in case of late response(Timeout) // Clear buffer in case of late response(Timeout)
while(Serial.available() > 0) Serial.read();
if (_serial) {
while(_serial.available() > 0) _serial.read();
} else {
// This we cannot do it from outside the library
}
float read; float read;
float* readings_p; float* readings_p;


+ 1
- 1
code/espurna/terminal.ino View File

@ -221,7 +221,7 @@ void _terminalLoop() {
#if SERIAL_RX_ENABLED #if SERIAL_RX_ENABLED
while (SERIAL_RX_PORT.available() > 0) { while (SERIAL_RX_PORT.available() > 0) {
char rc = Serial.read();
char rc = SERIAL_RX_PORT.read();
_serial_rx_buffer[_serial_rx_pointer++] = rc; _serial_rx_buffer[_serial_rx_pointer++] = rc;
if ((_serial_rx_pointer == TERMINAL_BUFFER_SIZE) || (rc == 10)) { if ((_serial_rx_pointer == TERMINAL_BUFFER_SIZE) || (rc == 10)) {
terminalInject(_serial_rx_buffer, (size_t) _serial_rx_pointer); terminalInject(_serial_rx_buffer, (size_t) _serial_rx_pointer);


Loading…
Cancel
Save