Skip to content

Commit 33f50d4

Browse files
projectgusdpgeorge
authored andcommitted
esp32: Fix machine.TouchPad startup on ESP32-S2 and S3.
Closes micropython#13178. TouchPad confirmed working on both chips, and fixes the the ESP32-S3 reading constant max value. Was unable to reproduce the bug on ESP32-S2 but this may be due to my test setup, and it still works with the fix. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <[email protected]>
1 parent eb0027b commit 33f50d4

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

ports/esp32/machine_touchpad.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,6 @@ static mp_obj_t mtp_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_
9696
if (!initialized) {
9797
touch_pad_init();
9898
touch_pad_set_fsm_mode(TOUCH_FSM_MODE_TIMER);
99-
#if TOUCH_HW_VER == 2
100-
touch_pad_fsm_start();
101-
#endif
10299
initialized = 1;
103100
}
104101
#if SOC_TOUCH_VERSION_1
@@ -107,6 +104,10 @@ static mp_obj_t mtp_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_
107104
esp_err_t err = touch_pad_config(self->touchpad_id);
108105
#endif
109106
if (err == ESP_OK) {
107+
#if SOC_TOUCH_VERSION_2
108+
touch_pad_fsm_start();
109+
#endif
110+
110111
return MP_OBJ_FROM_PTR(self);
111112
}
112113
mp_raise_ValueError(MP_ERROR_TEXT("Touch pad error"));

0 commit comments

Comments
 (0)