I am getting this repeat manner
I need to get calculate adc voltage every 5/10 seconds and show on my web page.
when every i calculate it gets this debug logs.
Setup:
Code: Select all
voltage_ = 0;
//Check TP is burned into eFuse
if (esp_adc_cal_check_efuse(ESP_ADC_CAL_VAL_EFUSE_TP) != ESP_OK) {
ACDTRACEF(ES24_ADC_CONV_BASE, "eFuse Two Point : not Supported\n");
return ES24_ADC_CONV_BASE;
}
//Check Vref is burned into eFuse
if (esp_adc_cal_check_efuse(ESP_ADC_CAL_VAL_EFUSE_VREF) != ESP_OK) {
return ES24_ADC_CONV_BASE;
}
//Configure ADC
if (unit == ADC_UNIT_1) {
adc1_config_width(ADC_WIDTH_BIT_12);
adc1_config_channel_atten((adc1_channel_t)channel, atten);
}
else {
adc2_config_channel_atten((adc2_channel_t)channel, atten);
}
//Characterize ADC
__adc_chars = (esp_adc_cal_characteristics_t*)calloc(1, sizeof(esp_adc_cal_characteristics_t));
esp_adc_cal_characterize(unit, atten, ADC_WIDTH_BIT_12, DEFAULT_VREF, __adc_chars);
Measure
Code: Select all
//Multisampling
for (int i = 0; i < NO_OF_SAMPLES; i++) {
if (unit == ADC_UNIT_1) {
adc_reading += adc1_get_raw((adc1_channel_t)channel);
}
else {
int raw;
adc2_get_raw((adc2_channel_t)channel, ADC_WIDTH_BIT_12, &raw);
adc_reading += raw;
}
}
adc_reading /= NO_OF_SAMPLES;
//Convert adc_reading to voltage in mV
voltage_ = esp_adc_cal_raw_to_voltage(adc_reading, __adc_chars);
D (29368) RTC_MODULE: returns adc1 lock.
D (29372) RTC_MODULE: adc mode takes adc1 lock.
D (29377) RTC_MODULE: returns adc1 lock.
D (29381) RTC_MODULE: adc mode takes adc1 lock.
D (29385) RTC_MODULE: returns adc1 lock.
D (29389) RTC_MODULE: adc mode takes adc1 lock.
D (29394) RTC_MODULE: returns adc1 lock.
D (29398) RTC_MODULE: adc mode takes adc1 lock.
D (29403) RTC_MODULE: returns adc1 lock.
D (29407) RTC_MODULE: adc mode takes adc1 lock.
D (29411) RTC_MODULE: returns adc1 lock.
D (29415) RTC_MODULE: adc mode takes adc1 lock.
D (29420) RTC_MODULE: returns adc1 lock.
D (29424) RTC_MODULE: adc mode takes adc1 lock.
D (29428) RTC_MODULE: returns adc1 lock.
D (29432) RTC_MODULE: adc mode takes adc1 lock.
D (29437) RTC_MODULE: returns adc1 lock.
D (29441) RTC_MODULE: adc mode takes adc1 lock.
D (29446) RTC_MODULE: returns adc1 lock.
D (29450) RTC_MODULE: adc mode takes adc1 lock.
D (29454) RTC_MODULE: returns adc1 lock.
D (29458) RTC_MODULE: adc mode takes adc1 lock.
D (29463) RTC_MODULE: returns adc1 lock.
D (29467) RTC_MODULE: adc mode takes adc1 lock.
D (29471) RTC_MODULE: returns adc1 lock.