mirror of
https://github.com/UtilitechAS/amsreader-firmware.git
synced 2026-01-22 02:35:29 +00:00
If debug mode and HW_ROARFRED, use software serial to set upp RX for HAN with 2400 and TX for debugging with 115200
This commit is contained in:
parent
fe79a96827
commit
b2174dd521
@ -17,7 +17,13 @@
|
||||
#include <OneWire.h>
|
||||
#define TEMP_SENSOR_PIN 5 // Temperature sensor connected to GPIO5
|
||||
|
||||
#if DEBUG_MODE
|
||||
#define SOFTWARE_SERIAL 1
|
||||
#include <SoftwareSerial.h>
|
||||
SoftwareSerial *hanSerial = new SoftwareSerial(3);
|
||||
#else
|
||||
HardwareSerial *hanSerial = &Serial;
|
||||
#endif
|
||||
|
||||
// Build settings for Wemos Lolin D32
|
||||
#elif defined(ARDUINO_LOLIN_D32)
|
||||
|
||||
@ -27,7 +27,7 @@ WiFiClient *client;
|
||||
MQTTClient mqtt(512);
|
||||
|
||||
// Object used for debugging
|
||||
HardwareSerial* debugger = NULL;
|
||||
Stream* debugger = NULL;
|
||||
|
||||
// The HAN Port reader, used to read serial data and decode DLMS
|
||||
HanReader hanReader;
|
||||
@ -39,17 +39,15 @@ void setup() {
|
||||
}
|
||||
|
||||
#if DEBUG_MODE
|
||||
debugger = &Serial;
|
||||
#if SOFTWARE_SERIAL
|
||||
debugger->begin(115200, SERIAL_8N1);
|
||||
#else
|
||||
if(config.meterType == 3) {
|
||||
hanSerial->begin(2400, SERIAL_8N1);
|
||||
} else {
|
||||
hanSerial->begin(2400, SERIAL_8E1);
|
||||
}
|
||||
#endif
|
||||
while (!&debugger);
|
||||
#if HW_ROARFRED
|
||||
SoftwareSerial *ser = new SoftwareSerial(-1, 1);
|
||||
ser->begin(115200, SWSERIAL_8N1);
|
||||
debugger = ser;
|
||||
#else
|
||||
HardwareSerial *ser = &Serial;
|
||||
ser->begin(115200, SERIAL_8N1);
|
||||
#endif
|
||||
debugger = ser;
|
||||
#endif
|
||||
|
||||
if (debugger) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user