use private serial reader library

This commit is contained in:
Nicu Hodos 2023-01-20 09:30:33 +01:00
parent c8710a1cc9
commit 739b64014d
2 changed files with 5 additions and 2 deletions

View File

@ -22,6 +22,7 @@ lib_deps =
bblanchon/ArduinoJson@6.19.4
adafruit/Adafruit Unified Sensor@^1.1.4
adafruit/DHT sensor library@1.3.10
https://git.hodos.ro/arduino/lib_serial-reader.git@^1.0.0
build_flags = -D DHT_SENSOR=0
upload_port = /dev/ttyUSB0
check_tool = cppcheck

View File

@ -3,6 +3,7 @@
#include "Dht.h"
#include "Protocol_1.h"
#include "Protocol_2.h"
#include <SerialReader.h>
#define RESET_PIN 10
#define SEND_PIN 11
@ -10,6 +11,7 @@
RCSwitch mySwitch = RCSwitch();
SerialReader<512> serialReader;
void setup() {
digitalWrite(RESET_PIN, HIGH);
@ -87,8 +89,8 @@ void runJsonCommands(const char* cmd) {
}
void readCommand() {
if (Serial.available() > 0) {
String cmd = Serial.readStringUntil('\n');
if (serialReader.readLine(Serial) > 0) {
String cmd{serialReader.getBuffer()};
if (cmd == "reset") {
Serial.println("resetting...");
delay(200);