diff --git a/tasmota/settings.h b/tasmota/settings.h index 91b1ff552..2a4ba3917 100644 --- a/tasmota/settings.h +++ b/tasmota/settings.h @@ -159,7 +159,7 @@ typedef union { // Restricted by MISRA-C Rule 18.4 bu uint32_t wifi_no_sleep : 1; // bit 13 (v9.5.0.2) - SetOption127 - (Wifi) Keep wifi in no-sleep mode, prevents some occasional unresponsiveness uint32_t disable_referer_chk : 1; // bit 14 (v9.5.0.5) - SetOption128 - (Web) Allow access without referer check uint32_t energy_phase : 1; // bit 15 (v9.5.0.9) - SetOption129 - (Energy) Show phase information - uint32_t spare16 : 1; // bit 16 + uint32_t show_heap_with_timestamp : 1; // bit 16 (v9.5.0.9) - SetOption130 - (Debug) Show heap with logging timestamp uint32_t spare17 : 1; // bit 17 uint32_t spare18 : 1; // bit 18 uint32_t spare19 : 1; // bit 19 diff --git a/tasmota/support.ino b/tasmota/support.ino index 24a2a953b..718ac28c2 100644 --- a/tasmota/support.ino +++ b/tasmota/support.ino @@ -2414,8 +2414,14 @@ void AddLogData(uint32_t loglevel, const char* log_data, const char* log_data_pa TasAutoMutex mutex((SemaphoreHandle_t *)&TasmotaGlobal.log_buffer_mutex); #endif // ESP32 - char mxtime[14]; // "13:45:21.999 " - snprintf_P(mxtime, sizeof(mxtime), PSTR("%02d" D_HOUR_MINUTE_SEPARATOR "%02d" D_MINUTE_SECOND_SEPARATOR "%02d.%03d "), RtcTime.hour, RtcTime.minute, RtcTime.second, RtcMillis()); + char mxtime[18]; // "13:45:21.999-123 " + snprintf_P(mxtime, sizeof(mxtime), PSTR("%02d" D_HOUR_MINUTE_SEPARATOR "%02d" D_MINUTE_SECOND_SEPARATOR "%02d.%03d"), + RtcTime.hour, RtcTime.minute, RtcTime.second, RtcMillis()); + if (Settings->flag5.show_heap_with_timestamp) { + snprintf_P(mxtime, sizeof(mxtime), PSTR("%s-%03d"), + mxtime, ESP_getFreeHeap1024()); + } + strcat(mxtime, " "); char empty[2] = { 0 }; if (!log_data_payload) { log_data_payload = empty; } diff --git a/tasmota/xdrv_79_esp32_ble.ino b/tasmota/xdrv_79_esp32_ble.ino index c96f5f8e2..94589f4c4 100644 --- a/tasmota/xdrv_79_esp32_ble.ino +++ b/tasmota/xdrv_79_esp32_ble.ino @@ -3121,22 +3121,18 @@ void CmndBLEOperation(void){ \*********************************************************************************************/ static void BLEPostMQTTSeenDevices(int type) { int remains = 0; -#ifdef MQTT_DATA_STRING - ResponseTime_P(PSTR("")); - String response_time = ResponseData(); + nextSeenDev = 0; +#ifdef MQTT_DATA_STRING int maxlen = 1024; char dest[maxlen]; do { - Response_P(response_time.c_str()); // Keep using same time stamp remains = getSeenDevicesToJson(dest, maxlen); - ResponseAppend_P(dest); + ResponseTime_P(dest); // no retain - this is present devices, not historic - MqttPublishPrefixTopicRulesProcess_P((1== type) ? TELE : STAT, PSTR("BLE")); + MqttPublishPrefixTopicRulesProcess_P((1 == type) ? TELE : STAT, PSTR("BLE")); } while (remains); #else - nextSeenDev = 0; - memset(TasmotaGlobal.mqtt_data, 0, sizeof(TasmotaGlobal.mqtt_data)); int timelen = ResponseTime_P(PSTR("")); char *dest = TasmotaGlobal.mqtt_data + timelen; @@ -3338,8 +3334,7 @@ static void mainThreadOpCallbacks() { static void BLEShowStats(){ uint32_t totalCount = BLEAdvertisment.totalCount; uint32_t deviceCount = seenDevices.size(); - ResponseTime_P(PSTR("")); - ResponseAppend_P(PSTR(",\"BLE\":{\"scans\":%u,\"adverts\":%u,\"devices\":%u,\"resets\":%u}}"), BLEScanCount, totalCount, deviceCount, BLEResets); + ResponseTime_P(PSTR(",\"BLE\":{\"scans\":%u,\"adverts\":%u,\"devices\":%u,\"resets\":%u}}"), BLEScanCount, totalCount, deviceCount, BLEResets); MqttPublishPrefixTopicRulesProcess_P(TELE, PSTR("BLE"), 0); }