final review

pull/131/head
Timm Bogner 2 years ago
parent 3f138eed2b
commit 0c3f6f5c3c

@ -9,23 +9,21 @@
#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("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();
}

@ -9,18 +9,21 @@
#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("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();
}

@ -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 <fdrs_gateway.h>

@ -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 <fdrs_node.h>
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 <fdrs_node.h>
void fdrs_recv_cb(DataReading theData) {
DBG("ID: " + String(theData.id));
DBG("Type: " + String(theData.t));

Loading…
Cancel
Save