gpio handler is working

This commit is contained in:
Zwer2k
2021-07-04 23:59:59 +02:00
parent 7b8f10a14e
commit b205326782
24 changed files with 719 additions and 112 deletions

View File

@@ -442,7 +442,7 @@ int ClassFlowControll::CleanTempFolder() {
esp_err_t ClassFlowControll::SendRawJPG(httpd_req_t *req)
{
return flowmakeimage->SendRawJPG(req);
return flowmakeimage != NULL ? flowmakeimage->SendRawJPG(req) : ESP_FAIL;
}

View File

@@ -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;

View File

@@ -9,7 +9,7 @@ class ClassFlowMQTT :
public ClassFlow
{
protected:
std::string uri, topic, topicError, clientname, topicRate, topicTimeStamp;
std::string uri, topic, topicError, clientname, topicRate, topicTimeStamp, topicUptime, topicFreeMem;
std::string OldValue;
ClassFlowPostProcessing* flowpostprocessing;
std::string user, password;