mirror of
https://github.com/jomjol/AI-on-the-edge-device.git
synced 2025-12-10 05:26:52 +03:00
Update digital CNN, bug fixing
This commit is contained in:
@@ -101,7 +101,7 @@ bool ClassFlowMQTT::ReadParameter(FILE* pfile, string& aktparamgraph)
|
||||
|
||||
if ((uri.length() > 0) && (topic.length() > 0))
|
||||
{
|
||||
MQTTInit(uri, clientname, user, password);
|
||||
MQTTInit(uri, clientname, user, password, topicError, 60);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -108,6 +108,8 @@ void ClassFlowPostProcessing::SavePreValue(float value, string zwtime)
|
||||
zwtime = std::string(buffer);
|
||||
}
|
||||
|
||||
PreValue = value;
|
||||
|
||||
fputs(zwtime.c_str(), pFile);
|
||||
fputs("\n", pFile);
|
||||
fputs(to_string(value).c_str(), pFile);
|
||||
|
||||
@@ -64,10 +64,19 @@ static void mqtt_event_handler(void *handler_args, esp_event_base_t base, int32_
|
||||
mqtt_event_handler_cb((esp_mqtt_event_handle_t) event_data);
|
||||
}
|
||||
|
||||
void MQTTInit(std::string _mqttURI, std::string _clientid, std::string _user, std::string _password){
|
||||
void MQTTInit(std::string _mqttURI, std::string _clientid, std::string _user, std::string _password, std::string _LWTContext, int _keepalive){
|
||||
std::string _zwmessage = "connection lost";
|
||||
|
||||
int _lzw = _LWTContext.length();
|
||||
|
||||
esp_mqtt_client_config_t mqtt_cfg = {
|
||||
.uri = _mqttURI.c_str(),
|
||||
.client_id = _clientid.c_str(),
|
||||
// .lwt_topic = _LWTContext.c_str(),
|
||||
.lwt_topic = "wasserzaehler/connection",
|
||||
.lwt_msg = _zwmessage.c_str(),
|
||||
.lwt_msg_len = _lzw,
|
||||
.keepalive = _keepalive
|
||||
};
|
||||
|
||||
if (_user.length() && _password.length()){
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
#include <string>
|
||||
|
||||
void MQTTInit(std::string _mqttURI, std::string _clientid, std::string _user = "", std::string _password = "");
|
||||
void MQTTInit(std::string _mqttURI, std::string _clientid, std::string _user, std::string _password, std::string _LWTContext, int _keepalive);
|
||||
|
||||
//void MQTTInit(std::string _mqttURI, std::string _clientid, std::string _user = "", std::string _password = "");
|
||||
|
||||
void MQTTPublish(std::string _key, std::string _content);
|
||||
Reference in New Issue
Block a user