Revert "System instable"

This reverts commit cb84074981339d44266a1a999a7567a722af11f4.

Cleanup REST API (#1255)

* Replaced URIs:
- value.html => value
- statusflow.html => statusflow
- cputemp.html => cputemp
- rssi.html => rssi
- statusflow.html => statusflow

Removed URLs:
 - wasserzaehler.html

* keep legacy API

* .

* .

* .

* .

* .

* .

* updated links

Remove ErrorMessage

Fix various warnings which become fatal with later gcc versons in esp-idf 5.x (#1268)

- we cannot use partial initialisation of structs in C++ files (copied from example C files initially it seems)
- IRAM_ATTR uses a COUNTER, do not use the attribute on the implementation
- provide missing copy implementations for Rgb and Hsv
- one no longer can |= on volatile variables; use = | instead
- fix project and header includes
- avoid redefining BLINK_GPIO
- Remove defined but unused variables
- Fix printf formats
- Add missing case statement (HTTP_EVENT_REDIRECT)
- RMT needs to be updated to new interface (CONFIG_RMT_SUPPRESS_DEPRECATE_WARN is on currently; see https://docs.espressif.com/projects/esp-idf/en/release-v5.0/esp32/api-reference/peripherals/rmt.html)
- Adjust tcpip_adpater_* to esp_netif_*
- Use buffered versions of *ntoa* functions for IPv4 addresses and not a static on the stack (also fixes warnings)
- Whatever I missed

Correct spelling of "Hostname" (#1270)

Correct sdkonfig

Increase max handler due to new handlers

Revert "Cleanup REST API (#1255)"

This reverts commit f3e73ec64a.

Revert "Increase max handler due to new handlers"

This reverts commit cbd63ad4bd.

System instable

Revert "Revert "Cleanup REST API (#1255)""

This reverts commit 2793c761413ffb987ab6a75da372e00e9f2f2cbd.

Co-Authored-By: Bjoern A. Zeeb <patch@zabbadoz.net>
This commit is contained in:
CaCO3
2022-11-04 17:32:38 +01:00
committed by jomjol
parent 1be49a75b1
commit 1d9ef7e634
31 changed files with 1807 additions and 125 deletions

View File

@@ -116,7 +116,11 @@ static esp_err_t mqtt_event_handler_cb(esp_mqtt_event_handle_t event)
}
static void mqtt_event_handler(void *handler_args, esp_event_base_t base, int32_t event_id, void *event_data) {
#if (ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 0))
ESP_LOGD(TAG_INTERFACEMQTT, "Event dispatched from event loop base=%s, event_id=%ld", base, event_id);
#else
ESP_LOGD(TAG_INTERFACEMQTT, "Event dispatched from event loop base=%s, event_id=%d", base, event_id);
#endif
mqtt_event_handler_cb((esp_mqtt_event_handle_t) event_data);
}
@@ -149,6 +153,7 @@ void MQTT_Configure(std::string _mqttURI, std::string _clientid, std::string _us
}
bool MQTT_Init() {
esp_mqtt_client_config_t mqtt_cfg;
esp_err_t ret;
LogFile.WriteToFile(ESP_LOG_INFO, "MQTT - Init");
@@ -156,19 +161,33 @@ bool MQTT_Init() {
std::string lw = lwt_disconnected;
esp_mqtt_client_config_t mqtt_cfg = {
.uri = uri.c_str(),
.client_id = client_id.c_str(),
.lwt_topic = lwt_topic.c_str(),
.lwt_msg = lw.c_str(),
.lwt_retain = 1,
.lwt_msg_len = (int)(lw.length()),
.keepalive = keepalive
};
#if (ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 0))
mqtt_cfg.broker.address.uri = uri.c_str();
mqtt_cfg.credentials.client_id = client_id.c_str();
mqtt_cfg.session.last_will.topic = lwt_topic.c_str();
mqtt_cfg.session.last_will.msg = lw.c_str();
mqtt_cfg.session.last_will.msg_len = (int)(lw.length());
mqtt_cfg.session.last_will.retain = 1;
mqtt_cfg.session.keepalive = keepalive;
#else
mqtt_cfg.uri = uri.c_str();
mqtt_cfg.client_id = client_id.c_str();
mqtt_cfg.lwt_topic = lwt_topic.c_str();
mqtt_cfg.lwt_msg = lw.c_str();
mqtt_cfg.lwt_retain = 1;
mqtt_cfg.lwt_msg_len = (int)(lw.length());
mqtt_cfg.keepalive = keepalive;
#endif
if (user.length() && password.length()){
#if (ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 0))
mqtt_cfg.credentials.username = user.c_str();
mqtt_cfg.credentials.authentication.password = password.c_str();
mqtt_cfg.credentials.authentication.key_password_len = password.length();
#else
mqtt_cfg.username = user.c_str();
mqtt_cfg.password = password.c_str();
#endif
};
client = esp_mqtt_client_init(&mqtt_cfg);