use private serial reader library
This commit is contained in:
parent
c8710a1cc9
commit
739b64014d
@ -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
|
||||
|
||||
@ -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);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user