From 81bf049836a4e05c00db38c5b6f4ed2102dea1bb Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Wed, 5 Aug 2026 15:13:54 +0200 Subject: [PATCH] Fix AddLog(0 regression --- tasmota/tasmota_xsns_sensor/xsns_02_analog.ino | 7 ++++--- .../tasmota_xsns_sensor/xsns_62_esp32_mi_ble.ino | 14 +++++++------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/tasmota/tasmota_xsns_sensor/xsns_02_analog.ino b/tasmota/tasmota_xsns_sensor/xsns_02_analog.ino index 89a2cfe1d..7ea307476 100644 --- a/tasmota/tasmota_xsns_sensor/xsns_02_analog.ino +++ b/tasmota/tasmota_xsns_sensor/xsns_02_analog.ino @@ -714,8 +714,9 @@ float AdcGetRange(uint32_t channel) { */ int adc = AdcRead(Adc[channel].pin, 5); float adcrange = ( ((float)Adc[channel].param[1] - (float)adc) / ( ((float)Adc[channel].param[1] - (float)Adc[channel].param[0])) * ((float)Adc[channel].param[2] - (float)Adc[channel].param[3]) + (float)Adc[channel].param[3] ); -// AddLog(LOG_LEVEL_DEBUG_MORE, PSTR("DBG: ADC%d, AdcRead %d, Range %4_f"), channel +1, adc, &adcrange); - +#ifdef ADC_DEBUG + AddLog(LOG_LEVEL_DEBUG_MORE, PSTR("DBG: ADC%d, AdcRead %d, Range %4_f"), channel +1, adc, &adcrange); +#endif // ADC_DEBUG return adcrange; } @@ -741,7 +742,7 @@ void AdcGetCurrentPower(uint32_t channel, uint32_t factor) { analog_max = analog; } } - //AddLog(0, PSTR("min: %u, max:%u, dif:%u"), analog_min, analog_max, analog_max-analog_min); +// AddLog(LOG_LEVEL_DEBUG, PSTR("min: %u, max:%u, dif:%u"), analog_min, analog_max, analog_max-analog_min); Adc[channel].current = (float)(analog_max-analog_min) * ((float)(Adc[channel].param[1]) / 100000); if (Adc[channel].current < (((float)Adc[channel].param[3]) / 10000.0)) { Adc[channel].current = 0.0; diff --git a/tasmota/tasmota_xsns_sensor/xsns_62_esp32_mi_ble.ino b/tasmota/tasmota_xsns_sensor/xsns_62_esp32_mi_ble.ino index be89a5003..bd8c2bc1c 100644 --- a/tasmota/tasmota_xsns_sensor/xsns_62_esp32_mi_ble.ino +++ b/tasmota/tasmota_xsns_sensor/xsns_62_esp32_mi_ble.ino @@ -1691,12 +1691,9 @@ void MI32Init(void) { MI32.option.onlyAliased = MI32_OPTION5_ONLY_ALIASED; // Mi32Option5: only include sensors that are aliased MI32.option.MQTTType = MI32_OPTION6_MQTT_TYPE; // Mi32Option6: publish sensor on MI32.bleTopic with 1 topic per sensor -AddLog(0,PSTR("MI32Option0: %d"), MI32.option.allwaysAggregate); -AddLog(0,PSTR("MI32Option1: %d"), MI32.option.noSummary); -AddLog(0,PSTR("MI32Option2: %d"), MI32.option.directBridgeMode); -AddLog(0,PSTR("MI32Option4: %d"), MI32.option.ignoreBogusBattery); -AddLog(0,PSTR("MI32Option5: %d"), MI32.option.onlyAliased); -AddLog(0,PSTR("MI32Option6: %d"), MI32.option.MQTTType); + AddLog(LOG_LEVEL_DEBUG, PSTR("M32: MI32Option0:%d, 1:%d, 2:%d, 4:%d, 5:%d, 6:%d"), + MI32.option.allwaysAggregate, MI32.option.noSummary, MI32.option.directBridgeMode, + MI32.option.ignoreBogusBattery, MI32.option.onlyAliased, MI32.option.MQTTType); BLE_ESP32::registerForAdvertismentCallbacks((const char *)"MI32", MI32advertismentCallback); BLE_ESP32::registerForScanCallbacks((const char *)"MI32", MI32scanCompleteCallback); @@ -2124,7 +2121,10 @@ static const bthome_obj_def_t BTHOME_OBJECTS[] = { {0x63, 4}, // Acceleration (0.000001 m/s2) int32 {0x64, 1}, // Light level (0 = Dark, 1 = Twilight, 2 = Bright) uint8 {0x65, 1}, // Settings revision uint8 - {0xFF, 0}, // sentinel + {0xF0, 2}, // Device type id uint16 + {0xF1, 4}, // Firmware version (F100010204 = 4.2.1.0} uint32 + {0xF2, 3}, // Firmware version (F2000106 = 6.1.0} uint24 + {0xFF, 0} // sentinel }; // Returns data length for a BTHome v2 object ID, or -1 if unknown