Browse Source

Remove unnecessary and memory inefficient code

fastled
Xose Pérez 8 years ago
parent
commit
6db8513f6b
1 changed files with 3 additions and 6 deletions
  1. +3
    -6
      code/src/websockets.ino

+ 3
- 6
code/src/websockets.ino View File

@ -30,13 +30,8 @@ bool webSocketSend(uint8_t num, char * payload) {
void webSocketParse(uint8_t num, uint8_t * payload, size_t length) {
// Parse JSON input
char buffer[length+1];
memcpy(buffer, payload, length);
buffer[length] = 0;
DynamicJsonBuffer jsonBuffer;
JsonObject& root = jsonBuffer.parseObject(buffer);
JsonObject& root = jsonBuffer.parseObject((char *) payload);
if (!root.success()) {
DEBUG_MSG("[WEBSOCKET] Error parsing data\n");
return;
@ -67,6 +62,8 @@ void webSocketParse(uint8_t num, uint8_t * payload, size_t length) {
for (unsigned int i=0; i<config.size(); i++) {
yield();
String key = config[i]["name"];
String value = config[i]["value"];


Loading…
Cancel
Save