analogSetCycles, analogSetSamples
-
- Posts: 4
- Joined: Thu Aug 15, 2019 10:15 pm
analogSetCycles, analogSetSamples
Can someone provide detailed descriptions of analogSetCycles() and analogSetSamples()? Please don't say "sets the number of samples in the range" or "sets the number of cycles per sample". I have looked at the Arduino source code, but that led to a dead end trying to use the ESP32 documentation. My best guess is that analogSetSamples() does some sort of repeated sampling of a single channel (oversampling) to effectively increase the number of bits of resolution. I can't guess at analogSetCycles(). Clock cycles? Perhaps these both have to do with redundantly listing a channel in the DIG SAR ADC scan table. Note, you cannot search the forums for these functions because there are too many hits. Apparently, these function are in everyone's ADC code. Thanks.
Re: analogSetCycles, analogSetSamples
Set cycles refers to sampling time i.e. how long to to sample the input in clock cycles.
Set Samples, should be to take a number of samples and average the result but I don't really know.
One thing I know is if I use analogSetSamples in my code my adc return widely varying values.
For,example if I slowly move the potentiometer to lower values I get higher and lower values back from the
adc. I should be consistanly smaller values. When I take that line out, things work like they are supposed to.
Set Samples, should be to take a number of samples and average the result but I don't really know.
One thing I know is if I use analogSetSamples in my code my adc return widely varying values.
For,example if I slowly move the potentiometer to lower values I get higher and lower values back from the
adc. I should be consistanly smaller values. When I take that line out, things work like they are supposed to.
Re: analogSetCycles, analogSetSamples
Did anyone get to the bottom of this? I'd be really interested to know what these really do and when to use them, especially analogSetSamples(). Is there any way to request input from a mod/expert/Espressif on this? Do we know if they change something in the hardware or if they are just software-implemented?
As stated above, the description of "Set number of samples in the range, default is 1, it has an effect on sensitivity has been multiplied" doesn't make sense in English. It's anyone's guess as to what this is meant to mean.
And after we find out what it means, someone with power to do so needs to update the official documentation.
As stated above, the description of "Set number of samples in the range, default is 1, it has an effect on sensitivity has been multiplied" doesn't make sense in English. It's anyone's guess as to what this is meant to mean.
And after we find out what it means, someone with power to do so needs to update the official documentation.
-
- Posts: 826
- Joined: Mon Jul 22, 2019 3:20 pm
Re: analogSetCycles, analogSetSamples
Noweare's description is correct. These functions were holdovers from before esp-idf had an adc driver. They will be removed in v1.0.5, so you will need to do oversampling on your own.
Who is online
Users browsing this forum: No registered users and 62 guests