From 69f4fa932e5b064463e585b40dbebde39d1fd294 Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Mon, 4 Oct 2021 17:57:03 +0200 Subject: [PATCH] Remove logging causing heap degradation (#13251) --- tasmota/xsns_62_esp32_mi_ble.ino | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/tasmota/xsns_62_esp32_mi_ble.ino b/tasmota/xsns_62_esp32_mi_ble.ino index f8e55e819..cb9548e6e 100644 --- a/tasmota/xsns_62_esp32_mi_ble.ino +++ b/tasmota/xsns_62_esp32_mi_ble.ino @@ -3066,18 +3066,17 @@ void MI32ShowTriggeredSensors(){ if (alias && *alias){ id = alias; } else { - sprintf(idstr, PSTR("%s%02x%02x%02x"), + snprintf_P(idstr, sizeof(idstr), PSTR("%s%02x%02x%02x"), kMI32DeviceType[p->type-1], p->MAC[3], p->MAC[4], p->MAC[5]); } - sprintf(SensorTopic, "tele/tasmota_ble/%s", - id); + snprintf_P(SensorTopic, sizeof(SensorTopic), PSTR("tele/tasmota_ble/%s"), id); MqttPublish(SensorTopic, Settings->flag.mqtt_sensor_retain); + AddLog(LOG_LEVEL_DEBUG, PSTR("M32: triggered %d %s"), sensor, ResponseData()); + XdrvRulesProcess(0); } else { - MqttPublishPrefixTopic_P(STAT, PSTR(D_RSLT_SENSOR), Settings->flag.mqtt_sensor_retain); + MqttPublishPrefixTopicRulesProcess_P(STAT, PSTR(D_RSLT_SENSOR), Settings->flag.mqtt_sensor_retain); } - AddLog(LOG_LEVEL_DEBUG,PSTR("M32: %s: triggered %d %s"),D_CMND_MI32, sensor, ResponseData()); - XdrvRulesProcess(0); } else { // else don't and clear ResponseClear();