🐛 Fix ADC calculation (#28279)

Followup to 89379cd
This commit is contained in:
ellensp
2026-01-15 15:19:45 +13:00
committed by GitHub
parent d897251c17
commit 834241dfb5

View File

@@ -271,7 +271,8 @@ void MarlinHAL::adc_start(const pin_t pin) {
uint32_t mv;
esp_adc_cal_get_voltage((adc_channel_t)chan, &characteristics[attenuations[chan]], &mv);
adc_result = (mv * 1023) * (1000.f / (ADC_REFERENCE_VOLTAGE));
static constexpr uint32_t adc_divisor = uint32_t((ADC_REFERENCE_VOLTAGE) * 1000UL);
adc_result = (mv * 1023UL) / adc_divisor;
// Change the attenuation level based on the new reading
adc_atten_t atten;