Update digital CNN, bug fixing

This commit is contained in:
jomjol
2020-12-29 22:27:48 +01:00
parent 3502ac9263
commit becb886ab7
23 changed files with 28 additions and 13 deletions

View File

@@ -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()){