From 344c7538d98c50d7203678e192f292a152750bff Mon Sep 17 00:00:00 2001 From: Amit Ate Date: Sun, 12 Feb 2017 07:45:15 +0530 Subject: [PATCH 1/3] Update eashMeshConnection.cpp Just copy data before parsing json object. --- src/eashMeshConnection.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/eashMeshConnection.cpp b/src/eashMeshConnection.cpp index bfe5cae..875551e 100644 --- a/src/eashMeshConnection.cpp +++ b/src/eashMeshConnection.cpp @@ -281,7 +281,7 @@ void ICACHE_FLASH_ATTR easyMesh::meshRecvCb(void *arg, char *data, unsigned shor return; } - + String justCopy(data); //just copy data before parsing json object and it is working now DynamicJsonBuffer jsonBuffer( JSON_BUFSIZE ); JsonObject& root = jsonBuffer.parseObject( data ); From 3f85890e21edb56999e9692f7858e900bc85215d Mon Sep 17 00:00:00 2001 From: Amit Ate Date: Tue, 14 Feb 2017 08:01:51 +0530 Subject: [PATCH 2/3] Update startHere.ino I was testing with three nodes which send data to the gateway node every 5 sec. Gateway node shows data from any node which is closer to it or which start first (with no delay to mesh.update). I found that after giving delay to mesh.update() I got data from all three node and don't get any more errors such like (0x1 meshRecvCb: parseObject() failed. data=dest<--) . --- examples/startHere/startHere.ino | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/examples/startHere/startHere.ino b/examples/startHere/startHere.ino index c19c16a..b2e81fc 100644 --- a/examples/startHere/startHere.ino +++ b/examples/startHere/startHere.ino @@ -9,7 +9,7 @@ // //************************************************************ #include - +#include // some gpio pin that is connected to an LED... // on my rig, this is 5, change to the right number of your LED. #define LED 5 // GPIO number of connected LED @@ -22,12 +22,18 @@ #define MESH_PORT 5555 easyMesh mesh; +Ticker meshUpdateTimer; uint32_t sendMessageTime = 0; +void meshUpdate(){ + mesh.update(); //update mesh parameters +} + void setup() { Serial.begin(115200); - + //call meshUpdate function every 3 sec + meshUpdateTimer.attach(3,meshUpdate); //delay depends on how frequently nodes are moving pinMode( LED, OUTPUT ); //mesh.setDebugMsgTypes( ERROR | MESH_STATUS | CONNECTION | SYNC | COMMUNICATION | GENERAL | MSG_TYPES | REMOTE ); // all types on @@ -41,8 +47,6 @@ void setup() { } void loop() { - mesh.update(); - // run the blinky bool onFlag = false; uint32_t cycleTime = mesh.getNodeTime() % BLINK_PERIOD; @@ -75,4 +79,3 @@ void receivedCallback( uint32_t from, String &msg ) { void newConnectionCallback( bool adopt ) { Serial.printf("startHere: New Connection, adopt=%d\n", adopt); } - From e3313286b011f291c55e646d2a5d1a9868fb6e67 Mon Sep 17 00:00:00 2001 From: Amit Ate Date: Tue, 14 Feb 2017 08:05:27 +0530 Subject: [PATCH 3/3] Revert "Update eashMeshConnection.cpp" --- src/eashMeshConnection.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/eashMeshConnection.cpp b/src/eashMeshConnection.cpp index 875551e..bfe5cae 100644 --- a/src/eashMeshConnection.cpp +++ b/src/eashMeshConnection.cpp @@ -281,7 +281,7 @@ void ICACHE_FLASH_ATTR easyMesh::meshRecvCb(void *arg, char *data, unsigned shor return; } - String justCopy(data); //just copy data before parsing json object and it is working now + DynamicJsonBuffer jsonBuffer( JSON_BUFSIZE ); JsonObject& root = jsonBuffer.parseObject( data );