Skip to content

Commit 9143268

Browse files
authored
Merge pull request #4021 from dhalbert/esp32-s2-touch-init-order
ESP32-S2: Initialize touch in proper order
2 parents 6a76b60 + ee48e4b commit 9143268

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

ports/esp32s2/peripherals/touch.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,13 @@ void peripherals_touch_init(const touch_pad_t touchpad) {
4646
if (!touch_inited) {
4747
touch_pad_init();
4848
touch_pad_set_fsm_mode(TOUCH_FSM_MODE_TIMER);
49+
}
50+
// touch_pad_config() must be done before touch_pad_fsm_start() the first time.
51+
// Otherwise the calibration is wrong and we get maximum raw values if there is
52+
// a trace of any significant length on the pin.
53+
touch_pad_config(touchpad);
54+
if (!touch_inited) {
4955
touch_pad_fsm_start();
5056
touch_inited = true;
5157
}
52-
touch_pad_config(touchpad);
5358
}

0 commit comments

Comments
 (0)