final review

This commit is contained in:
Timm Bogner 2023-03-04 07:42:26 -06:00
parent 3f138eed2b
commit 0c3f6f5c3c
4 changed files with 25 additions and 18 deletions

View File

@ -9,23 +9,21 @@
#include "fdrs_node_config.h" #include "fdrs_node_config.h"
#include <fdrs_node.h> #include <fdrs_node.h>
void fdrs_recv_cb(DataReading theData) { void fdrs_recv_cb(DataReading theData)
{
DBG("ID: " + String(theData.id)); DBG("ID: " + String(theData.id));
DBG("Type: " + String(theData.t)); DBG("Type: " + String(theData.t));
DBG("Data: " + String(theData.d)); DBG("Data: " + String(theData.d));
} }
void setup() { void setup()
{
beginFDRS(); beginFDRS();
//pingFDRS(1000); pingFDRS(1000);
addFDRS(1000, fdrs_recv_cb); addFDRS(fdrs_recv_cb);
subscribeFDRS(READING_ID); subscribeFDRS(READING_ID);
} }
void loop() { void loop()
// data1 = readHum(); {
// loadFDRS(data1, HUMIDITY_T); loopFDRS();
// data2 = readTemp();
// loadFDRS(data2, TEMP_T);
// sendFDRS();
// sleepFDRS(10); //Sleep time in seconds
} }

View File

@ -9,18 +9,21 @@
#include "fdrs_node_config.h" #include "fdrs_node_config.h"
#include <fdrs_node.h> #include <fdrs_node.h>
void fdrs_recv_cb(DataReading theData) { void fdrs_recv_cb(DataReading theData)
{
DBG("ID: " + String(theData.id)); DBG("ID: " + String(theData.id));
DBG("Type: " + String(theData.t)); DBG("Type: " + String(theData.t));
DBG("Data: " + String(theData.d)); DBG("Data: " + String(theData.d));
} }
void setup() { void setup()
{
beginFDRS(); beginFDRS();
//pingFDRS(1000); pingFDRS(1000);
addFDRS(fdrs_recv_cb); addFDRS(fdrs_recv_cb);
subscribeFDRS(READING_ID); subscribeFDRS(READING_ID);
} }
void loop() { void loop()
loopFDRS(); {
loopFDRS();
} }

View File

@ -149,7 +149,7 @@ Enables ESP-NOW Long-Range mode. Requires ESP32.
## User-Defined Functions ## 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. 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. 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:** **Example:**
``` cpp ``` cpp
#define GTWY_READING_ID 42 #define GTWY_READING_ID 42
#define INTERVAL_SECONDS #define INTERVAL_SECONDS 60
#include "fdrs_gateway_config.h" #include "fdrs_gateway_config.h"
#include <fdrs_gateway.h> #include <fdrs_gateway.h>

View File

@ -36,6 +36,9 @@ Always add this to ```loop()``` to handle the controller's listening capabilitie
### Sensor ### Sensor
Sensors load a packet with data, then send the packet to the gateway that they are addressed to. Sensors load a packet with data, then send the packet to the gateway that they are addressed to.
``` cpp ``` cpp
#include "fdrs_node_config.h"
#include <fdrs_node.h>
void setup() { void setup() {
  beginFDRS(); // Start the system   beginFDRS(); // Start the system
pingFDRS(2000); // Send ping and wait 2000ms for response 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. Controllers register with the gateway they are addressed to, then receive data from it.
``` cpp ``` cpp
#include "fdrs_node_config.h"
#include <fdrs_node.h>
void fdrs_recv_cb(DataReading theData) { void fdrs_recv_cb(DataReading theData) {
DBG("ID: " + String(theData.id)); DBG("ID: " + String(theData.id));
DBG("Type: " + String(theData.t)); DBG("Type: " + String(theData.t));