diff --git a/examples/ESPNOW_Controller/ESPNOW_Controller.ino b/examples/ESPNOW_Controller/ESPNOW_Controller.ino index 39bc97d..4391bd2 100644 --- a/examples/ESPNOW_Controller/ESPNOW_Controller.ino +++ b/examples/ESPNOW_Controller/ESPNOW_Controller.ino @@ -9,23 +9,21 @@ #include "fdrs_node_config.h" #include -void fdrs_recv_cb(DataReading theData) { +void fdrs_recv_cb(DataReading theData) +{ DBG("ID: " + String(theData.id)); DBG("Type: " + String(theData.t)); DBG("Data: " + String(theData.d)); } -void setup() { +void setup() +{ beginFDRS(); - //pingFDRS(1000); - addFDRS(1000, fdrs_recv_cb); + pingFDRS(1000); + addFDRS(fdrs_recv_cb); subscribeFDRS(READING_ID); } -void loop() { - // data1 = readHum(); - // loadFDRS(data1, HUMIDITY_T); - // data2 = readTemp(); - // loadFDRS(data2, TEMP_T); - // sendFDRS(); - // sleepFDRS(10); //Sleep time in seconds +void loop() +{ + loopFDRS(); } diff --git a/examples/LoRa_Controller/LoRa_Controller.ino b/examples/LoRa_Controller/LoRa_Controller.ino index 624d376..4391bd2 100644 --- a/examples/LoRa_Controller/LoRa_Controller.ino +++ b/examples/LoRa_Controller/LoRa_Controller.ino @@ -9,18 +9,21 @@ #include "fdrs_node_config.h" #include -void fdrs_recv_cb(DataReading theData) { +void fdrs_recv_cb(DataReading theData) +{ DBG("ID: " + String(theData.id)); DBG("Type: " + String(theData.t)); DBG("Data: " + String(theData.d)); } -void setup() { +void setup() +{ beginFDRS(); - //pingFDRS(1000); + pingFDRS(1000); addFDRS(fdrs_recv_cb); subscribeFDRS(READING_ID); } -void loop() { -loopFDRS(); +void loop() +{ + loopFDRS(); } diff --git a/extras/Gateway.md b/extras/Gateway.md index 71deea4..a1387ca 100644 --- a/extras/Gateway.md +++ b/extras/Gateway.md @@ -149,7 +149,7 @@ Enables ESP-NOW Long-Range mode. Requires ESP32. ## User-Defined Functions This feature allows the user to send data from the gateway itself. For example: the battery level or ambient temperature at the gateway. -Calling ```scheduleFDRS(function, interval);``` after initializing FDRS will schedule ```function();``` to be called every ```interval``` milliseconds. +Calling ```scheduleFDRS(function, interval);``` after initializing FDRS will schedule ```function()``` to be called every ```interval``` milliseconds. Within this function, the user may utilize the same ```loadFDRS()``` and ```sendFDRS()``` commands used by sensors. After the data is sent, it triggers ```INTERNAL_ACT``` where it can be routed to the front-end. @@ -161,7 +161,7 @@ Sends the current packet using actions defined by ```INTERNAL_ACT```. Does not r **Example:** ``` cpp #define GTWY_READING_ID 42 -#define INTERVAL_SECONDS +#define INTERVAL_SECONDS 60 #include "fdrs_gateway_config.h" #include diff --git a/extras/Node.md b/extras/Node.md index 85c1754..96d3cfa 100644 --- a/extras/Node.md +++ b/extras/Node.md @@ -36,6 +36,9 @@ Always add this to ```loop()``` to handle the controller's listening capabilitie ### Sensor Sensors load a packet with data, then send the packet to the gateway that they are addressed to. ``` cpp +#include "fdrs_node_config.h" +#include + void setup() {   beginFDRS(); // Start the system pingFDRS(2000); // Send ping and wait 2000ms for response @@ -51,6 +54,9 @@ void loop() { Controllers register with the gateway they are addressed to, then receive data from it. ``` cpp +#include "fdrs_node_config.h" +#include + void fdrs_recv_cb(DataReading theData) { DBG("ID: " + String(theData.id)); DBG("Type: " + String(theData.t));