mirror of https://github.com/arendst/Tasmota.git
Add SO130 1 to show heap with logging timestamp
This commit is contained in:
parent
e03aa46607
commit
019ccae4d0
|
@ -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 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 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 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 spare17 : 1; // bit 17
|
||||||
uint32_t spare18 : 1; // bit 18
|
uint32_t spare18 : 1; // bit 18
|
||||||
uint32_t spare19 : 1; // bit 19
|
uint32_t spare19 : 1; // bit 19
|
||||||
|
|
|
@ -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);
|
TasAutoMutex mutex((SemaphoreHandle_t *)&TasmotaGlobal.log_buffer_mutex);
|
||||||
#endif // ESP32
|
#endif // ESP32
|
||||||
|
|
||||||
char mxtime[14]; // "13:45:21.999 "
|
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());
|
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 };
|
char empty[2] = { 0 };
|
||||||
if (!log_data_payload) { log_data_payload = empty; }
|
if (!log_data_payload) { log_data_payload = empty; }
|
||||||
|
|
|
@ -3121,22 +3121,18 @@ void CmndBLEOperation(void){
|
||||||
\*********************************************************************************************/
|
\*********************************************************************************************/
|
||||||
static void BLEPostMQTTSeenDevices(int type) {
|
static void BLEPostMQTTSeenDevices(int type) {
|
||||||
int remains = 0;
|
int remains = 0;
|
||||||
#ifdef MQTT_DATA_STRING
|
nextSeenDev = 0;
|
||||||
ResponseTime_P(PSTR(""));
|
|
||||||
String response_time = ResponseData();
|
|
||||||
|
|
||||||
|
#ifdef MQTT_DATA_STRING
|
||||||
int maxlen = 1024;
|
int maxlen = 1024;
|
||||||
char dest[maxlen];
|
char dest[maxlen];
|
||||||
do {
|
do {
|
||||||
Response_P(response_time.c_str()); // Keep using same time stamp
|
|
||||||
remains = getSeenDevicesToJson(dest, maxlen);
|
remains = getSeenDevicesToJson(dest, maxlen);
|
||||||
ResponseAppend_P(dest);
|
ResponseTime_P(dest);
|
||||||
// no retain - this is present devices, not historic
|
// 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);
|
} while (remains);
|
||||||
#else
|
#else
|
||||||
nextSeenDev = 0;
|
|
||||||
|
|
||||||
memset(TasmotaGlobal.mqtt_data, 0, sizeof(TasmotaGlobal.mqtt_data));
|
memset(TasmotaGlobal.mqtt_data, 0, sizeof(TasmotaGlobal.mqtt_data));
|
||||||
int timelen = ResponseTime_P(PSTR(""));
|
int timelen = ResponseTime_P(PSTR(""));
|
||||||
char *dest = TasmotaGlobal.mqtt_data + timelen;
|
char *dest = TasmotaGlobal.mqtt_data + timelen;
|
||||||
|
@ -3338,8 +3334,7 @@ static void mainThreadOpCallbacks() {
|
||||||
static void BLEShowStats(){
|
static void BLEShowStats(){
|
||||||
uint32_t totalCount = BLEAdvertisment.totalCount;
|
uint32_t totalCount = BLEAdvertisment.totalCount;
|
||||||
uint32_t deviceCount = seenDevices.size();
|
uint32_t deviceCount = seenDevices.size();
|
||||||
ResponseTime_P(PSTR(""));
|
ResponseTime_P(PSTR(",\"BLE\":{\"scans\":%u,\"adverts\":%u,\"devices\":%u,\"resets\":%u}}"), BLEScanCount, totalCount, deviceCount, BLEResets);
|
||||||
ResponseAppend_P(PSTR(",\"BLE\":{\"scans\":%u,\"adverts\":%u,\"devices\":%u,\"resets\":%u}}"), BLEScanCount, totalCount, deviceCount, BLEResets);
|
|
||||||
MqttPublishPrefixTopicRulesProcess_P(TELE, PSTR("BLE"), 0);
|
MqttPublishPrefixTopicRulesProcess_P(TELE, PSTR("BLE"), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue