Lean on Arduino log library instead of custom logging methods (#546)

* Lean on Arduino log library instead of custom logging methods
This commit is contained in:
Florian authored and GitHub committed 2020-02-09 16:01:52 +01:00
1 parent 824346b19c
commit f3c9d6dd90
28 files changed
+557 -745

No files matched your search

+2 -3
View File
@@ -36,6 +36,7 @@ int lastInputState = 3;
void setupGPIOInput()
{
Log.notice(F("Reading GPIO at pin: %d" CR), GPIOInput_PIN);
pinMode(GPIOInput_PIN, INPUT_PULLUP); // declare GPIOInput pin as input_pullup to prevent floating. Pin will be high when not connected to ground
}
@@ -65,18 +66,16 @@ void MeasureGPIOInput()
if (reading != InputState)
{
InputState = reading;
trc(F("Creating GPIOInput buffer"));
Log.trace(F("Creating GPIOInput buffer" CR));
const int JSON_MSG_CALC_BUFFER = JSON_OBJECT_SIZE(1);
StaticJsonBuffer<JSON_MSG_CALC_BUFFER> jsonBuffer;
JsonObject &GPIOdata = jsonBuffer.createObject();
if (InputState == HIGH)
{
trc(F("GPIO HIGH"));
GPIOdata.set("gpio", "HIGH");
}
if (InputState == LOW)
{
trc(F("GPIO LOW"));
GPIOdata.set("gpio", "LOW");
}
if (GPIOdata.size() > 0)