mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-22 09:06:27 +00:00
adc: fixed the issue that multiply overflow before type expand
This commit is contained in:
@@ -167,7 +167,7 @@ uint32_t esp_adc_cal_raw_to_voltage(uint32_t adc_reading, const esp_adc_cal_char
|
||||
uint64_t v_cali_1 = 0;
|
||||
|
||||
//raw * gradient * 1000000
|
||||
v_cali_1 = adc_reading * chars->coeff_a;
|
||||
v_cali_1 = (uint64_t)adc_reading * chars->coeff_a;
|
||||
//convert to real number
|
||||
v_cali_1 = v_cali_1 / coeff_a_scaling;
|
||||
ESP_LOGV(LOG_TAG, "v_cali_1 is %llu", v_cali_1);
|
||||
|
Reference in New Issue
Block a user