mirror of
https://github.com/jomjol/AI-on-the-edge-device.git
synced 2025-12-07 12:06:58 +03:00
gpio handler is working
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
#include <sstream>
|
||||
#include "ClassFlowMQTT.h"
|
||||
#include "Helper.h"
|
||||
|
||||
#include "time_sntp.h"
|
||||
#include "interface_mqtt.h"
|
||||
#include "ClassFlowPostProcessing.h"
|
||||
|
||||
@@ -13,6 +15,8 @@ void ClassFlowMQTT::SetInitialParameter(void)
|
||||
topicError = "";
|
||||
topicRate = "";
|
||||
topicTimeStamp = "";
|
||||
topicUptime = "";
|
||||
topicFreeMem = "";
|
||||
clientname = "watermeter";
|
||||
OldValue = "";
|
||||
flowpostprocessing = NULL;
|
||||
@@ -104,6 +108,14 @@ bool ClassFlowMQTT::ReadParameter(FILE* pfile, string& aktparamgraph)
|
||||
{
|
||||
this->topicTimeStamp = zerlegt[1];
|
||||
}
|
||||
if ((toUpper(zerlegt[0]) == "TOPICUPTIME") && (zerlegt.size() > 1))
|
||||
{
|
||||
this->topicUptime = zerlegt[1];
|
||||
}
|
||||
if ((toUpper(zerlegt[0]) == "TOPICFREEMEM") && (zerlegt.size() > 1))
|
||||
{
|
||||
this->topicFreeMem = zerlegt[1];
|
||||
}
|
||||
|
||||
if ((toUpper(zerlegt[0]) == "CLIENTID") && (zerlegt.size() > 1))
|
||||
{
|
||||
@@ -169,6 +181,18 @@ bool ClassFlowMQTT::doFlow(string zwtime)
|
||||
MQTTPublish(topicTimeStamp, resulttimestamp);
|
||||
}
|
||||
|
||||
if (topicUptime.length() > 0) {
|
||||
char uptimeStr[11];
|
||||
sprintf(uptimeStr, "%ld", (long)getUpTime());
|
||||
MQTTPublish(topicUptime, uptimeStr);
|
||||
}
|
||||
|
||||
if (topicFreeMem.length() > 0) {
|
||||
char freeheapmem[11];
|
||||
sprintf(freeheapmem, "%zu", esp_get_free_heap_size());
|
||||
MQTTPublish(topicFreeMem, freeheapmem);
|
||||
}
|
||||
|
||||
OldValue = result;
|
||||
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user