diff options
| author | Jeff Epler <jeff@adafruit.com> | 2021-01-19 08:17:27 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-01-19 08:17:27 -0600 |
| commit | 914326872f75e5ff2fda9fdb9865030d53356335 (patch) | |
| tree | 2ce03cba01a37e5fdfb9bdb1f2177af701222601 | |
| parent | 6a76b60027aa163756aace389a5c9203594759ce (diff) | |
| parent | ee48e4b4528b7cfea7f568d83eb31c0fde1867d8 (diff) | |
Merge pull request #4021 from dhalbert/esp32-s2-touch-init-order
ESP32-S2: Initialize touch in proper order
| -rw-r--r-- | ports/esp32s2/peripherals/touch.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/ports/esp32s2/peripherals/touch.c b/ports/esp32s2/peripherals/touch.c index 6cf33b2bd..cd895b10b 100644 --- a/ports/esp32s2/peripherals/touch.c +++ b/ports/esp32s2/peripherals/touch.c @@ -46,8 +46,13 @@ void peripherals_touch_init(const touch_pad_t touchpad) { if (!touch_inited) { touch_pad_init(); touch_pad_set_fsm_mode(TOUCH_FSM_MODE_TIMER); + } + // touch_pad_config() must be done before touch_pad_fsm_start() the first time. + // Otherwise the calibration is wrong and we get maximum raw values if there is + // a trace of any significant length on the pin. + touch_pad_config(touchpad); + if (!touch_inited) { touch_pad_fsm_start(); touch_inited = true; } - touch_pad_config(touchpad); } |
