Clean up logging functions

This commit is contained in:
Theo Arends 2022-11-11 09:30:31 +01:00
parent 89e8f4b429
commit b7f6a7b00a
4 changed files with 29 additions and 10 deletions

View File

@ -299,6 +299,27 @@ int32_t ext_vsnprintf_P(char * out_buf, size_t buf_len, const char * fmt_P, va_l
}
}
break;
/*
case 'V': // 2-byte values, decimals indicates the length, default 2
{
if (decimals < 0) { decimals = 0; }
if (cur_val < min_valid_ptr) { new_val_str = ext_invalid_mem; }
else if (decimals > 0) {
uint32_t val_size = decimals*6 + 2;
char * val_char = (char*) malloc(val_size);
val_char[0] = '\0';
for (uint32_t count = 0; count < decimals; count++) {
uint32_t value = pgm_read_byte((const uint8_t *)cur_val +1) << 8 | pgm_read_byte((const uint8_t *)cur_val);
snprintf_P(val_char, val_size, PSTR("%s%s%d"), val_char, (count)?",":"", value);
cur_val += 2;
}
new_val_str = val_char;
allocs[alloc_idx++] = new_val_str;
// Serial.printf("> values=%s\n", hex_char);
}
}
break;
*/
// case 'D':
// decimals = *(int32_t*)cur_val_ptr;
// break;

View File

@ -549,7 +549,7 @@ void setup(void) {
#endif
#endif // USE_EMULATION
// AddLogBuffer(LOG_LEVEL_DEBUG, (uint8_t*)&TasmotaGlobal, sizeof(TasmotaGlobal));
// AddLog(LOG_LEVEL_INFO, PSTR("DBG: TasmotaGlobal size %d, data %*_H"), sizeof(TasmotaGlobal), 100, (uint8_t*)&TasmotaGlobal);
if (Settings->param[P_BOOT_LOOP_OFFSET]) { // SetOption36
// Disable functionality as possible cause of fast restart within BOOT_LOOP_TIME seconds (Exception, WDT or restarts)

View File

@ -116,11 +116,11 @@ String GetDeviceHardware(void) {
bool r0_4 = efuse0 & (1 << 4); // ESP8285
bool r2_16 = efuse2 & (1 << 16); // ESP8285
if (r0_4 || r2_16) { // ESP8285
// 1M 2M 2M 4M
// r0_4 1 1 0 0
bool r3_25 = efuse3 & (1 << 25); // ESP8285 flash matrix 0 0 1 1
bool r3_26 = efuse3 & (1 << 26); // ESP8285 flash matrix 0 1 0 1
bool r3_27 = efuse3 & (1 << 27); // ESP8285 flash matrix 0 0 0 0
// 1M 2M 2M 4M flash size
// r0_4 1 1 0 0
bool r3_25 = efuse3 & (1 << 25); // flash matrix 0 0 1 1
bool r3_26 = efuse3 & (1 << 26); // flash matrix 0 1 0 1
bool r3_27 = efuse3 & (1 << 27); // flash matrix 0 0 0 0
uint32_t pkg_version = 0;
if (!r3_27) {
if (r0_4 && !r3_25) {
@ -654,11 +654,9 @@ uint8_t* FlashDirectAccess(void) {
uint32_t address = FlashWriteStartSector() * SPI_FLASH_SEC_SIZE;
uint8_t* data = EspFlashMmap(address);
/*
AddLog(LOG_LEVEL_DEBUG, PSTR("DBG: Flash start address 0x%08X, Mmap address 0x%08X"), address, data);
uint8_t buf[32];
memcpy(buf, data, sizeof(buf));
AddLogBuffer(LOG_LEVEL_DEBUG, (uint8_t*)&buf, 32);
AddLog(LOG_LEVEL_DEBUG, PSTR("DBG: Flash start address 0x%08X, Mmap address 0x%08X, Data %*_H"), address, data, sizeof(buf), (uint8_t*)&buf);
*/
return data;
}

View File

@ -2072,7 +2072,7 @@ void GpioInit(void)
if (mpin) { SetPin(i, mpin); } // Anything above GPIO_NONE and below GPIO_SENSOR_END
}
// AddLogBufferSize(LOG_LEVEL_DEBUG, (uint8_t*)TasmotaGlobal.gpio_pin, nitems(TasmotaGlobal.gpio_pin), sizeof(TasmotaGlobal.gpio_pin[0]));
// AddLog(LOG_LEVEL_DEBUG, PSTR("DBG: TasmotaGlobal.gpio_pin %*_V"), nitems(TasmotaGlobal.gpio_pin), (uint8_t*)TasmotaGlobal.gpio_pin);
if (ResetReasonPowerOn()) {
TasmotaGlobal.power_on_delay = Settings->param[P_POWER_ON_DELAY2]; // SetOption47 - Delay switching relays to reduce power surge at power on