mirror of
https://github.com/arendst/Tasmota.git
synced 2025-04-25 07:17:16 +00:00
Remove redundant code
This commit is contained in:
parent
6c83787210
commit
6d5b0ed622
@ -296,7 +296,6 @@ void MqttUnsubscribe(const char *topic)
|
||||
|
||||
void MqttPublishLogging(const char *mxtime)
|
||||
{
|
||||
if (MqttIsConnected()) {
|
||||
char saved_mqtt_data[strlen(mqtt_data) +1];
|
||||
memcpy(saved_mqtt_data, mqtt_data, sizeof(saved_mqtt_data));
|
||||
|
||||
@ -308,7 +307,6 @@ void MqttPublishLogging(const char *mxtime)
|
||||
|
||||
memcpy(mqtt_data, saved_mqtt_data, sizeof(saved_mqtt_data));
|
||||
}
|
||||
}
|
||||
|
||||
void MqttPublish(const char* topic, bool retained)
|
||||
{
|
||||
@ -317,10 +315,10 @@ void MqttPublish(const char* topic, bool retained)
|
||||
#endif
|
||||
|
||||
#if defined(USE_MQTT_TLS) && defined(USE_MQTT_AWS_IOT)
|
||||
if (retained) {
|
||||
// if (retained) {
|
||||
// AddLog_P(LOG_LEVEL_INFO, S_LOG_MQTT, PSTR("Retained are not supported by AWS IoT, using retained = false."));
|
||||
// }
|
||||
retained = false; // AWS IoT does not support retained, it will disconnect if received
|
||||
}
|
||||
#endif
|
||||
|
||||
char sretained[CMDSZ];
|
||||
@ -329,7 +327,6 @@ void MqttPublish(const char* topic, bool retained)
|
||||
snprintf_P(slog_type, sizeof(slog_type), PSTR(D_LOG_RESULT));
|
||||
|
||||
if (Settings.flag.mqtt_enabled) { // SetOption3 - Enable MQTT
|
||||
if (MqttIsConnected()) {
|
||||
if (MqttPublishLib(topic, retained)) {
|
||||
snprintf_P(slog_type, sizeof(slog_type), PSTR(D_LOG_MQTT));
|
||||
if (retained) {
|
||||
@ -337,7 +334,6 @@ void MqttPublish(const char* topic, bool retained)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
snprintf_P(log_data, sizeof(log_data), PSTR("%s%s = %s"), slog_type, (Settings.flag.mqtt_enabled) ? topic : strrchr(topic,'/')+1, mqtt_data); // SetOption3 - Enable MQTT
|
||||
if (strlen(log_data) >= (sizeof(log_data) - strlen(sretained) -1)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user