From b98ca673cee11da3834d2dffb7e5c3eb07b4f136 Mon Sep 17 00:00:00 2001 From: Nicolas Bachschwell Date: Fri, 21 Apr 2017 21:11:34 +0200 Subject: [PATCH] Added V0.6 Tested oneled. Homie Limit to 2 leds for oneled --- src/main.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 19463e4..4ae8cbc 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -3,8 +3,7 @@ * Normally befor sending it to git, I am testing it. But I can't test it while in school... * So the code here might work or not. But I should be able to garantee that it is working on a Node-MCU (ESP8266) when I tested it. * -* Tested: NO (I did not test it yet) -* Not Tested funktion: oneled +* TESTED: YES */ #include #include @@ -38,7 +37,7 @@ int nextLed = 0; bool onLedsShouldChange(String value){ char chars[value.length() + 1]; strcpy(chars, value.c_str()); //Transforming String into char array. - StaticJsonBuffer<200> jsonBuffer; + StaticJsonBuffer<400> jsonBuffer; JsonObject& root = jsonBuffer.parseObject(chars); //Parsing JSON String if(!root.success()){ //Parsing succeed? Homie.setNodeProperty(stripNode, "last", "{\"state\":\"error\",\"id\":\"jsonParseError\",\"msg\":\"Failed to parse Data.\"}"); //Rückmeldung an den Broker das der String nicht geparsed werden konnte @@ -124,6 +123,7 @@ bool onLedsShouldChange(String value){ else if(actionToDo == "oneled"){ reset(); thingToDo = "oneLed"; + Serial.println("Ha: " + String(root["leds"].size())); for(int count = 0;count < root["leds"].size(); count++){ strip.setPixelColor((int)root["leds"][count]["id"], strip.Color((int)root["leds"][count]["red"], (int)root["leds"][count]["green"], (int)root["leds"][count]["blue"])); }