Skip to content

Commit ee48e4b

Browse files
committed
ESP32-S2: Initialize touch in proper order
1 parent 6a76b60 commit ee48e4b

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)