Rolling 20220903

This commit is contained in:
jomjol
2022-09-03 10:52:48 +02:00
parent 77427a8ec4
commit 90f204b833
8 changed files with 63 additions and 5 deletions

View File

@@ -40,6 +40,17 @@ In other cases you can contact the developer via email: <img src="https://raw.gi
------ ------
##### Rolling (2022-09-03)
- MQTT: improved handling based on the work of @**[caco3](https://github.com/caco3)** ([#971](https://github.com/jomjol/AI-on-the-edge-device/pull/971))
##### Rolling (2022-09-02)
- MQTT: extended logging and automated reconnect
- HTML: explanation for MQTT keys
- Improved post processing algo
- Bug fix: update algorithm
##### Rolling (2022-08-31) ##### Rolling (2022-08-31)
- **ATTENTION**: - **ATTENTION**:

View File

@@ -101,11 +101,23 @@ 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); 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, std::string _LWTContext, int _keepalive){ void MQTTInit(std::string _mqttURI, std::string _clientid, std::string _user, std::string _password, std::string _LWTContext, int _keepalive){
std::string _zwmessage = "connection lost"; std::string _zwmessage = "connection lost";
int _lzw = _zwmessage.length(); int _lzw = _zwmessage.length();
/* LWTContext = _LWTContext;
mqtt_cfg.uri = _mqttURI.c_str();
mqtt_cfg.client_id = _clientid.c_str();
mqtt_cfg.lwt_topic = _LWTContext.c_str();
mqtt_cfg.lwt_msg = _zwmessage.c_str();
mqtt_cfg.lwt_retain = 1;
mqtt_cfg.lwt_msg_len = _lzw;
mqtt_cfg.keepalive = _keepalive;
*/
esp_mqtt_client_config_t mqtt_cfg = { esp_mqtt_client_config_t mqtt_cfg = {
.uri = _mqttURI.c_str(), .uri = _mqttURI.c_str(),
.client_id = _clientid.c_str(), .client_id = _clientid.c_str(),
@@ -142,8 +154,43 @@ void MQTTInit(std::string _mqttURI, std::string _clientid, std::string _user, st
LogFile.WriteToFile("MQTT - Could not Init client!"); LogFile.WriteToFile("MQTT - Could not Init client!");
} }
} }
/*
void MQTTReConnect(){
std::string _zwmessage = "connection lost";
int _lzw = _zwmessage.length();
>>>>>>> Stashed changes
client = esp_mqtt_client_init(&mqtt_cfg);
if (client)
{
if (esp_mqtt_client_register_event(client, esp_mmqtt_ID, mqtt_event_handler, client) != ESP_OK)
LogFile.WriteToFile("MQTT - Could not register event!");
if (esp_mqtt_client_start(client) != ESP_OK)
LogFile.WriteToFile("MQTT - Could not start client!");
<<<<<<< Updated upstream
if(MQTTPublish(_LWTContext, "", 1)) {
LogFile.WriteToFile("MQTT - Client init successful");
}
=======
if (mqtt_connected)
MQTTPublish(LWTContext, "", 1);
else
LogFile.WriteToFile("Problem with (Re)Connection not successful!");
>>>>>>> Stashed changes
}
else
{
LogFile.WriteToFile("MQTT - Could not Init client!");
}
}
*/
void MQTTdestroy() { void MQTTdestroy() {
if (client != NULL) { if (client != NULL) {
esp_mqtt_client_stop(client); esp_mqtt_client_stop(client);

View File

@@ -1,4 +1,4 @@
const char* GIT_REV="5a31543"; const char* GIT_REV="77427a8";
const char* GIT_TAG=""; const char* GIT_TAG="";
const char* GIT_BRANCH="rolling"; const char* GIT_BRANCH="rolling";
const char* BUILD_TIME="2022-08-31 21:56"; const char* BUILD_TIME="2022-09-03 08:15";

View File

@@ -1,4 +1,4 @@
const char* GIT_REV="5a31543"; const char* GIT_REV="77427a8";
const char* GIT_TAG=""; const char* GIT_TAG="";
const char* GIT_BRANCH="rolling"; const char* GIT_BRANCH="rolling";
const char* BUILD_TIME="2022-08-31 21:56"; const char* BUILD_TIME="2022-09-03 08:15";

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -1 +1 @@
16.3.1 16.3.2