I have a project where I use ADCTouchSensor to manage a cap touch button. The problem I am up againtst is, if my code captures baseline capacitance during startup, then, in case someone touches the button during that time, e.g. in an event of power flicker, which would cause the board to restart, further touch detection is compromised. One idea to handle that was to have an udjustable baseline, as in having a variable recording the lowest capacitance the button senses, so once that drops in value, that becomes the new baseline. That would work, except for one issue - what if further during the operation, variations in environmental conditions were to cause the baseline to go up in value.
Is there some tried and true way anybody is aware of to track such baseline reliably?