implement loadFDRS() & sendFDRS() for gateways

pull/139/head
Timm Bogner 1 year ago
parent d78ba15901
commit 6709d38bd9

@ -18,7 +18,8 @@
#define SERIAL_ACT sendESPNowNbr(2); sendLoRaNbr(2); sendESPNowPeers(); broadcastLoRa();
#define MQTT_ACT
#define LORAG_ACT sendSerial();
// Neighbor Actions
#define INTERNAL_ACT sendSerial();
#define ESPNOW1_ACT
#define ESPNOW2_ACT
#define LORA1_ACT sendSerial();
@ -50,6 +51,8 @@
#define RXD2 14
#define TXD2 15
//#define USE_LR // Use ESP-NOW LR mode (ESP32 only)
// WiFi and MQTT Credentials -- These will override the global settings
//#define WIFI_SSID "Your SSID"
//#define WIFI_PASS "Your Password"

@ -43,7 +43,8 @@ enum
event_mqtt,
event_lorag,
event_lora1,
event_lora2
event_lora2,
event_internal
};
#ifndef FDRS_DATA_TYPES
#define FDRS_DATA_TYPES

@ -15,6 +15,9 @@ uint8_t newData = event_clear;
uint8_t newCmd = cmd_clear;
bool is_ping = false;
DataReading fdrsData[256]; // buffer for loadFDRS()
uint8_t data_count = 0;
#include "fdrs_gateway_oled.h"
#include "fdrs_gateway_debug.h"
#include "fdrs_gateway_espnow.h"
@ -28,6 +31,31 @@ bool is_ping = false;
#include "fdrs_checkConfig.h"
#endif
void sendFDRS()
{
for (int i = 0; i < data_count; i++)
{
theData[i].id = fdrsData[i].id;
theData[i].t = fdrsData[i].t;
theData[i].d = fdrsData[i].d;
}
ln = data_count;
data_count = 0;
newData = event_internal;
DBG("Entered internal data.");
}
void loadFDRS(float d, uint8_t t, uint16_t id)
{
DBG("Id: " + String(id) + " - Type: " + String(t) + " - Data loaded: " + String(d));
DataReading dr;
dr.id = id;
dr.t = t;
dr.d = d;
fdrsData[data_count] = dr;
data_count++;
}
void beginFDRS()
{
#if defined(ESP8266)
@ -130,6 +158,9 @@ void loopFDRS()
case event_lora2:
LORA2_ACT
break;
case event_internal:
INTERNAL_ACT
break;
}
newData = event_clear;
}

Loading…
Cancel
Save