diff --git a/tasmota/tasmota_xsns_sensor/xsns_02_analog.ino b/tasmota/tasmota_xsns_sensor/xsns_02_analog.ino index 0be99724e9bc..07d28a566b55 100644 --- a/tasmota/tasmota_xsns_sensor/xsns_02_analog.ino +++ b/tasmota/tasmota_xsns_sensor/xsns_02_analog.ino @@ -335,10 +335,17 @@ uint16_t AdcRead(uint32_t pin, uint32_t factor) { uint32_t samples = 1 << factor; uint32_t analog = 0; for (uint32_t i = 0; i < samples; i++) { +#ifdef ESP32 + analog += analogReadMilliVolts(pin); // get the value corrected by calibrated values from the eFuses +#else analog += analogRead(pin); +#endif delay(1); } analog >>= factor; +#ifdef ESP32 + analog = analog/(ANALOG_V33*1000) * ANALOG_RANGE; // go back from mV to ADC +#endif return analog; }