diff --git a/tasmota/tasmota_support/support.ino b/tasmota/tasmota_support/support.ino index 6446a44d8..ae7cb166e 100755 --- a/tasmota/tasmota_support/support.ino +++ b/tasmota/tasmota_support/support.ino @@ -383,7 +383,7 @@ char* Unescape(char* buffer, uint32_t* size) int32_t end_size = *size; uint8_t che = 0; -// AddLogBuffer(LOG_LEVEL_DEBUG, (uint8_t*)buffer, *size); +// AddLog(LOG_LEVEL_DEBUG, PSTR("DBG: UnescapeIn %*_H"), *size, (uint8_t*)buffer); while (start_size > 0) { uint8_t ch = *read++; @@ -427,7 +427,7 @@ char* Unescape(char* buffer, uint32_t* size) } *size = end_size; *write++ = 0; // add the end string pointer reference -// AddLogBuffer(LOG_LEVEL_DEBUG, (uint8_t*)buffer, *size); +// AddLog(LOG_LEVEL_DEBUG, PSTR("DBG: UnescapeOut %*_H"), *size, (uint8_t*)buffer); return buffer; } @@ -1479,7 +1479,7 @@ void GetInternalTemplate(void* ptr, uint32_t module, uint32_t option) { memcpy_P(&template8, &kModules8285[module_template - TMP_WEMOS], sizeof(template8)); } -// AddLogBuffer(LOG_LEVEL_DEBUG, (uint8_t *)&template8, sizeof(mytmplt8285)); +// AddLog(LOG_LEVEL_DEBUG, PSTR("DBG: GetInternalTemplate %*_H"), sizeof(mytmplt8285), (uint8_t *)&template8); // template16 = GPIO 0,1,2,3,4,5,9,10,12,13,14,15,16,Adc,Flg uint16_t template16[(sizeof(mytmplt) / 2)] = { GPIO_NONE }; @@ -1500,8 +1500,7 @@ void GetInternalTemplate(void* ptr, uint32_t module, uint32_t option) { } memcpy(ptr, &template16[index], size); -// AddLog(LOG_LEVEL_DEBUG, PSTR("FNC: GetInternalTemplate option %d"), option); -// AddLogBufferSize(LOG_LEVEL_DEBUG, (uint8_t *)ptr, size / 2, 2); +// AddLog(LOG_LEVEL_DEBUG, PSTR("FNC: GetInternalTemplate option %d, %*_V"), option, size / 2, (uint8_t *)ptr); } #endif // ESP8266 @@ -1528,7 +1527,7 @@ void TemplateGpios(myio *gp) } // 11 85 00 85 85 00 00 00 15 38 85 00 00 81 -// AddLogBuffer(LOG_LEVEL_DEBUG, (uint8_t *)&src, sizeof(mycfgio)); +// AddLog(LOG_LEVEL_DEBUG, PSTR("DBG: TemplateGpiosIn %*_H"), sizeof(mycfgio), (uint8_t *)&src); // Expand template to physical GPIO array, j=phy_GPIO, i=template_GPIO uint32_t j = 0; @@ -1550,7 +1549,7 @@ void TemplateGpios(myio *gp) } // 11 85 00 85 85 00 00 00 00 00 00 00 15 38 85 00 00 81 -// AddLogBuffer(LOG_LEVEL_DEBUG, (uint8_t *)gp, sizeof(myio)); +// AddLog(LOG_LEVEL_DEBUG, PSTR("DBG: TemplateGpiosOut %*_H"), sizeof(myio), (uint8_t *)gp); } gpio_flag ModuleFlag(void) @@ -1757,16 +1756,14 @@ bool JsonTemplate(char* dataBuf) } } -// AddLog(LOG_LEVEL_DEBUG, PSTR("TPL: Converted")); -// AddLogBufferSize(LOG_LEVEL_DEBUG, (uint8_t*)&Settings->user_template, sizeof(Settings->user_template) / 2, 2); +// AddLog(LOG_LEVEL_DEBUG, PSTR("TPL: Converted %*_V"), sizeof(Settings->user_template) / 2, (uint8_t*)&Settings->user_template); return true; } void TemplateJson(void) { -// AddLog(LOG_LEVEL_DEBUG, PSTR("TPL: Show")); -// AddLogBufferSize(LOG_LEVEL_DEBUG, (uint8_t*)&Settings->user_template, sizeof(Settings->user_template) / 2, 2); +// AddLog(LOG_LEVEL_DEBUG, PSTR("TPL: Show %*_V"), sizeof(Settings->user_template) / 2, (uint8_t*)&Settings->user_template); Response_P(PSTR("{\"" D_JSON_NAME "\":\"%s\",\"" D_JSON_GPIO "\":["), SettingsText(SET_TEMPLATE_NAME)); for (uint32_t i = 0; i < nitems(Settings->user_template.gp.io); i++) { @@ -2769,21 +2766,6 @@ void AddLogMissed(const char *sensor, uint32_t misses) AddLog(LOG_LEVEL_DEBUG, PSTR("SNS: %s missed %d"), sensor, SENSOR_MAX_MISS - misses); } -void AddLogBufferSize(uint32_t loglevel, uint8_t *buffer, uint32_t count, uint32_t size) { - char log_data[4 + (count * size * 3)]; - - snprintf_P(log_data, sizeof(log_data), PSTR("DMP:")); - for (uint32_t i = 0; i < count; i++) { - if (1 == size) { // uint8_t - snprintf_P(log_data, sizeof(log_data), PSTR("%s %02X"), log_data, *(buffer)); - } else { // uint16_t - snprintf_P(log_data, sizeof(log_data), PSTR("%s %02X%02X"), log_data, *(buffer +1), *(buffer)); - } - buffer += size; - } - AddLogData(loglevel, log_data); -} - void AddLogSpi(bool hardware, uint32_t clk, uint32_t mosi, uint32_t miso) { // Needs optimization uint32_t enabled = (hardware) ? TasmotaGlobal.spi_enabled : TasmotaGlobal.soft_spi_enabled; diff --git a/tasmota/tasmota_xdrv_driver/xdrv_01_9_webserver.ino b/tasmota/tasmota_xdrv_driver/xdrv_01_9_webserver.ino index 83692a06c..b62176159 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_01_9_webserver.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_01_9_webserver.ino @@ -2847,8 +2847,7 @@ void HandleUploadLoop(void) { #ifdef USE_WEB_FW_UPGRADE else if (BUpload.active) { // Write a block -// AddLog(LOG_LEVEL_DEBUG, PSTR("DBG: Size %d"), upload.currentSize); -// AddLogBuffer(LOG_LEVEL_DEBUG, upload.buf, 32); +// AddLog(LOG_LEVEL_DEBUG, PSTR("DBG: Size %d, Data '%32_H'"), upload.currentSize, upload.buf); Web.upload_error = BUploadWriteBuffer(upload.buf, upload.currentSize); if (Web.upload_error != 0) { return; } } diff --git a/tasmota/tasmota_xdrv_driver/xdrv_06_snfbridge.ino b/tasmota/tasmota_xdrv_driver/xdrv_06_snfbridge.ino index a928d8140..ff3a5500b 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_06_snfbridge.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_06_snfbridge.ino @@ -105,7 +105,7 @@ uint32_t rf_search_and_write(uint8_t *data, size_t size) { if (rec_end == sizeof(buf)) { return 9; } // File too large - Failed to decode RF firmware rec_size = rec_end - rec_start; -// AddLogBuffer(LOG_LEVEL_DEBUG, (uint8_t*)&buf + rec_start, rec_size); +// AddLog(LOG_LEVEL_DEBUG, PSTR("DBG: %*_H"), rec_size, (uint8_t*)&buf + rec_start); err = rf_decode_and_write(buf + rec_start, rec_size); if (err != 0) { return err; } diff --git a/tasmota/tasmota_xdrv_driver/xdrv_127_debug.ino b/tasmota/tasmota_xdrv_driver/xdrv_127_debug.ino index fe6caaf91..5a02108eb 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_127_debug.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_127_debug.ino @@ -659,7 +659,7 @@ void CmndI2cWrite(void) } if (index > 1) { - AddLogBuffer(LOG_LEVEL_INFO, buffer, index); + AddLog(LOG_LEVEL_INFO, PSTR("DBG: CmndI2cWrite %*_H"), index, buffer); Wire.beginTransmission(buffer[0]); for (uint32_t i = 1; i < index; i++) { @@ -698,7 +698,7 @@ void CmndI2cRead(void) buffer[index++] = Wire.read(); } if (index > 0) { - AddLogBuffer(LOG_LEVEL_INFO, buffer, index); + AddLog(LOG_LEVEL_INFO, PSTR("DBG: CmndI2cRead %*_H"), index, buffer); } } } diff --git a/tasmota/tasmota_xdrv_driver/xdrv_30_exs_dimmer.ino b/tasmota/tasmota_xdrv_driver/xdrv_30_exs_dimmer.ino index 3dfdcda73..597f3b9e6 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_30_exs_dimmer.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_30_exs_dimmer.ino @@ -124,8 +124,7 @@ void ExsSerialSend(const uint8_t data[] = nullptr, uint16_t len = 0) char rc; #ifdef EXS_DEBUG - AddLog(LOG_LEVEL_DEBUG_MORE, PSTR("EXS: Tx Packet:")); - AddLogBuffer(LOG_LEVEL_DEBUG_MORE, (uint8_t *)data, len); + AddLog(LOG_LEVEL_DEBUG_MORE, PSTR("EXS: Tx Packet %*_H"), len, (uint8_t *)data); #endif while (retries) @@ -363,8 +362,7 @@ bool ExsModuleSelected(void) bool ExsSetChannels(void) { #ifdef EXS_DEBUG - AddLog(LOG_LEVEL_DEBUG_MORE, PSTR("EXS: SetChannels:")); - AddLogBuffer(LOG_LEVEL_DEBUG_MORE, (uint8_t *)XdrvMailbox.data, XdrvMailbox.data_len); + AddLog(LOG_LEVEL_DEBUG_MORE, PSTR("EXS: SetChannels %*_H"), XdrvMailbox.data_len, (uint8_t *)XdrvMailbox.data); #endif Exs.dimm[0] = ((uint8_t *)XdrvMailbox.data)[0]; @@ -456,8 +454,7 @@ void ExsSerialInput(void) Exs.cmd_status = 0; #ifdef EXS_DEBUG - AddLog(LOG_LEVEL_DEBUG_MORE, PSTR("EXS: CRC: 0x%02x, RX Packet:"), crc); - AddLogBuffer(LOG_LEVEL_DEBUG_MORE, (uint8_t *)Exs.buffer, Exs.byte_counter); + AddLog(LOG_LEVEL_DEBUG_MORE, PSTR("EXS: CRC 0x%02x, RX Packet %*_H"), crc, Exs.byte_counter, (uint8_t *)Exs.buffer); #endif if (Exs.buffer[0] == crc) diff --git a/tasmota/tasmota_xdrv_driver/xdrv_31_tasmota_client.ino b/tasmota/tasmota_xdrv_driver/xdrv_31_tasmota_client.ino index 04ede81b3..3fb9710f9 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_31_tasmota_client.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_31_tasmota_client.ino @@ -238,15 +238,13 @@ uint8_t TasmotaClient_receiveData(char* buffer, int size) { } if (255 == index) { index = 0; } -// AddLog(LOG_LEVEL_DEBUG, PSTR("TCL: ReceiveData")); -// AddLogBuffer(LOG_LEVEL_DEBUG, (uint8_t*)buffer, index); +// AddLog(LOG_LEVEL_DEBUG, PSTR("TCL: ReceiveData %*_H"), index, (uint8_t*)buffer); return index; } uint8_t TasmotaClient_sendBytes(uint8_t* bytes, int count) { -// AddLog(LOG_LEVEL_DEBUG, PSTR("TCL: SendBytes")); -// AddLogBuffer(LOG_LEVEL_DEBUG, (uint8_t*)&bytes, count); +// AddLog(LOG_LEVEL_DEBUG, PSTR("TCL: SendBytes %*_H"), count, (uint8_t*)&bytes); TasmotaClient_Serial->write(bytes, count); TasmotaClient_waitForSerialData(2, TASMOTA_CLIENT_TIMEOUT); @@ -334,7 +332,7 @@ uint32_t TasmotaClient_Flash(uint8_t* data, size_t size) { memcpy(flash_buffer, data + read, sizeof(flash_buffer)); read = read + sizeof(flash_buffer); -// AddLogBuffer(LOG_LEVEL_DEBUG, (uint8_t*)flash_buffer, 32); +// AddLog(LOG_LEVEL_DEBUG, PSTR("TCL: Flash %32_H"), (uint8_t*)flash_buffer); for (uint32_t ca = 0; ca < sizeof(flash_buffer); ca++) { processed++; @@ -456,8 +454,7 @@ void TasmotaClient_sendCmnd(uint8_t cmnd, uint8_t param) { memcpy(&buffer[1], &TClientCommand, sizeof(TClientCommand)); buffer[sizeof(TClientCommand)+1] = CMND_END; -// AddLog(LOG_LEVEL_DEBUG, PSTR("TCL: SendCmnd")); -// AddLogBuffer(LOG_LEVEL_DEBUG, (uint8_t*)&buffer, sizeof(buffer)); +// AddLog(LOG_LEVEL_DEBUG, PSTR("TCL: SendCmnd %*_H"), sizeof(buffer), (uint8_t*)&buffer); for (uint32_t ca = 0; ca < sizeof(buffer); ca++) { TasmotaClient_Serial->write(buffer[ca]); diff --git a/tasmota/tasmota_xdrv_driver/xdrv_45_shelly_dimmer.ino b/tasmota/tasmota_xdrv_driver/xdrv_45_shelly_dimmer.ino index 6476fa172..4b157ac6e 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_45_shelly_dimmer.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_45_shelly_dimmer.ino @@ -268,8 +268,7 @@ bool ShdSerialSend(const uint8_t data[] = nullptr, uint16_t len = 0) int retries = 3; #ifdef SHELLY_DIMMER_DEBUG - AddLog(LOG_LEVEL_DEBUG_MORE, PSTR(SHD_LOGNAME "Tx Packet:")); - AddLogBuffer(LOG_LEVEL_DEBUG_MORE, (uint8_t*)data, len); + AddLog(LOG_LEVEL_DEBUG_MORE, PSTR(SHD_LOGNAME "Tx Packet %*_H"), len, (uint8_t*)data); #endif // SHELLY_DIMMER_DEBUG while (retries--) @@ -694,8 +693,7 @@ bool ShdSerialInput(void) // finished #ifdef SHELLY_DIMMER_DEBUG Shd.byte_counter++; - AddLog(LOG_LEVEL_DEBUG_MORE, PSTR(SHD_LOGNAME "Rx Packet:")); - AddLogBuffer(LOG_LEVEL_DEBUG_MORE, Shd.buffer, Shd.byte_counter); + AddLog(LOG_LEVEL_DEBUG_MORE, PSTR(SHD_LOGNAME "Rx Packet %*_H"), Shd.byte_counter, Shd.buffer); #endif // SHELLY_DIMMER_DEBUG Shd.byte_counter = 0; @@ -707,9 +705,8 @@ bool ShdSerialInput(void) { // wrong data #ifdef SHELLY_DIMMER_DEBUG - AddLog(LOG_LEVEL_DEBUG, PSTR(SHD_LOGNAME "Byte %i of received data frame is invalid. Rx Packet:"), Shd.byte_counter); - Shd.byte_counter++; - AddLogBuffer(LOG_LEVEL_DEBUG_MORE, Shd.buffer, Shd.byte_counter); + AddLog(LOG_LEVEL_DEBUG, PSTR(SHD_LOGNAME "Byte %i of received data frame is invalid. Rx Packet %*_H"), + Shd.byte_counter, Shd.byte_counter +1, Shd.buffer); #endif // SHELLY_DIMMER_DEBUG Shd.byte_counter = 0; } @@ -739,8 +736,7 @@ bool ShdModuleSelected(void) { bool ShdSetChannels(void) { #ifdef SHELLY_DIMMER_DEBUG - AddLog(LOG_LEVEL_DEBUG_MORE, PSTR(SHD_LOGNAME "SetChannels:")); - AddLogBuffer(LOG_LEVEL_DEBUG_MORE, (uint8_t *)XdrvMailbox.data, XdrvMailbox.data_len); + AddLog(LOG_LEVEL_DEBUG_MORE, PSTR(SHD_LOGNAME "SetChannels %*_H"), XdrvMailbox.data_len, (uint8_t *)XdrvMailbox.data); #endif // SHELLY_DIMMER_DEBUG uint16_t brightness = ((uint32_t *)XdrvMailbox.data)[0]; diff --git a/tasmota/tasmota_xdrv_driver/xdrv_46_ccloader.ino b/tasmota/tasmota_xdrv_driver/xdrv_46_ccloader.ino index ab37d271a..6b0bf7c75 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_46_ccloader.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_46_ccloader.ino @@ -614,7 +614,7 @@ bool CLLFlashFirmware(uint8_t* data, uint32_t size) uint32_t block = 0; unsigned int addr = 0x0000; AddLog(LOG_LEVEL_INFO,PSTR("CCL: will flash ....")); - AddLogBuffer(LOG_LEVEL_DEBUG,data,16); // quick check to compare with a hex editor + AddLog(LOG_LEVEL_DEBUG,PSTR("CCL: data %16_H"), data); // quick check to compare with a hex editor while((block*512)chunkSize; char _tag[16]; -// AddLog(LOG_LEVEL_DEBUG, PSTR("cc: %u, _size: %u"), _counter,_size); -// AddLogBuffer(LOG_LEVEL_DEBUG,(uint8_t*)_tag,16); +// AddLog(LOG_LEVEL_DEBUG, PSTR("MSH: cc %u, _size %u, _tag %16_H"), _counter,_size,(uint8_t*)_tag); br_chacha20_run bc = br_chacha20_ct_run; diff --git a/tasmota/tasmota_xdrv_driver/xdrv_57_9_tasmesh.ino b/tasmota/tasmota_xdrv_driver/xdrv_57_9_tasmesh.ino index 5395da2f7..b6cc16812 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_57_9_tasmesh.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_57_9_tasmesh.ino @@ -65,8 +65,7 @@ void CB_MESHDataReceived(const uint8_t *MAC, const uint8_t *packet, int len) { MESHencryptPayload(_recvPacket, 0); //decrypt it and check if (memcmp(_recvPacket->payload, MESH.broker, 6) == 0) { MESHaddPeer((uint8_t*)MAC); -// AddLog(LOG_LEVEL_INFO, PSTR("MSH: Rcvd topic %s"), (char*)_recvPacket->payload + 6); -// AddLogBuffer(LOG_LEVEL_INFO,(uint8_t *)&MESH.packetToConsume.front().payload,MESH.packetToConsume.front().chunkSize+5); +// AddLog(LOG_LEVEL_INFO, PSTR("MSH: Rcvd topic %s, payload %*_H"), (char*)_recvPacket->payload + 6, MESH.packetToConsume.front().chunkSize+5, (uint8_t *)&MESH.packetToConsume.front().payload); for (auto &_peer : MESH.peers) { if (memcmp(_peer.MAC, _recvPacket->sender, 6) == 0) { strcpy(_peer.topic, (char*)_recvPacket->payload + 6); @@ -340,8 +339,7 @@ bool MESHrouteMQTTtoMESH(const char* _topic, char* _data, bool _retained) { } MESH.sendPacket.chunkSize += _byteLeftInChunk; MESH.packetToResend.push(MESH.sendPacket); -// AddLog(LOG_LEVEL_INFO, PSTR("MSH: chunk:%u, size: %u"),MESH.sendPacket.chunk,MESH.sendPacket.chunkSize); -// AddLogBuffer(LOG_LEVEL_INFO, (uint8_t*)MESH.sendPacket.payload, MESH.sendPacket.chunkSize); +// AddLog(LOG_LEVEL_INFO, PSTR("MSH: chunk %u, size %u, payload %*_H"),MESH.sendPacket.chunk,MESH.sendPacket.chunkSize,MESH.sendPacket.chunkSize,(uint8_t*)MESH.sendPacket.payload); if (MESH.sendPacket.chunk == MESH.sendPacket.chunks) { // AddLog(LOG_LEVEL_INFO, PSTR("MSH: Too many chunks %u"), MESH.sendPacket.chunk +1); } diff --git a/tasmota/tasmota_xsns_sensor/xsns_91_vindriktning.ino b/tasmota/tasmota_xsns_sensor/xsns_91_vindriktning.ino index 3248ea7f6..c6e16c204 100644 --- a/tasmota/tasmota_xsns_sensor/xsns_91_vindriktning.ino +++ b/tasmota/tasmota_xsns_sensor/xsns_91_vindriktning.ino @@ -64,7 +64,7 @@ bool VindriktningReadData(void) { VindriktningSerial->readBytes(buffer, VINDRIKTNING_DATASET_SIZE); VindriktningSerial->flush(); // Make room for another burst - AddLogBuffer(LOG_LEVEL_DEBUG_MORE, buffer, VINDRIKTNING_DATASET_SIZE); + AddLog(LOG_LEVEL_DEBUG_MORE, PSTR("VDN: %*_H"), VINDRIKTNING_DATASET_SIZE, buffer); uint8_t crc = 0; for (uint32_t i = 0; i < VINDRIKTNING_DATASET_SIZE; i++) {