Skip to content

Commit ae2c7b4

Browse files
esp32: Fix.
1 parent c0689ae commit ae2c7b4

File tree

2 files changed

+11
-16
lines changed

2 files changed

+11
-16
lines changed

ports/esp32/machine_touchpad.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
#include "modmachine.h"
3030
#include "driver/gpio.h"
3131

32-
#if SOC_TOUCH_SENSOR_SUPPORTED //&& !CONFIG_IDF_TARGET_ESP32P4
32+
#if SOC_TOUCH_SENSOR_SUPPORTED
3333

3434
#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 3, 0)
3535
#if SOC_TOUCH_VERSION_1
@@ -41,9 +41,9 @@
4141

4242
#if SOC_TOUCH_SENSOR_VERSION == 1 // ESP32 only
4343
#include "driver/touch_pad.h"
44-
#elif SOC_TOUCH_SENSOR_VERSION == 2 // All other SoCs with touch, to date
44+
#elif SOC_TOUCH_SENSOR_VERSION == 2 // most ESP32
4545
#include "driver/touch_sensor.h"
46-
#elif SOC_TOUCH_SENSOR_VERSION == 3 // All other SoCs with touch, to date
46+
#elif SOC_TOUCH_SENSOR_VERSION == 3 // At present, it can only be used on ESP32P4.
4747
#include "driver/touch_sens.h"
4848
#else
4949
#error "Unknown touch hardware version"
@@ -140,13 +140,13 @@ static mp_obj_t mtp_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_
140140
touch_sensor_config_t sens_cfg = TOUCH_SENSOR_DEFAULT_BASIC_CONFIG(3, sample_cfg);
141141
esp_err_t err = touch_sensor_new_controller(&sens_cfg, &s_sens_handle);
142142
if (err != ESP_OK) {
143-
mp_raise_ValueError(MP_ERROR_TEXT("Touch pad error 1"));
143+
mp_raise_ValueError(MP_ERROR_TEXT("Touch pad error"));
144144
}
145145
/* Configure the touch sensor filter */
146146
touch_sensor_filter_config_t filter_cfg = TOUCH_SENSOR_DEFAULT_FILTER_CONFIG();
147147
err = touch_sensor_config_filter(s_sens_handle, &filter_cfg);
148148
if (err != ESP_OK) {
149-
mp_raise_ValueError(MP_ERROR_TEXT("Touch pad error 2"));
149+
mp_raise_ValueError(MP_ERROR_TEXT("Touch pad error"));
150150
}
151151
touch_channel_config_t chan_cfg = {
152152
.active_thresh = {1000, 2500, 5000},
@@ -156,15 +156,15 @@ static mp_obj_t mtp_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_
156156
err = touch_sensor_new_channel(s_sens_handle, i, &chan_cfg, &s_chan_handle[i]);
157157
};
158158
if (err != ESP_OK) {
159-
mp_raise_ValueError(MP_ERROR_TEXT("Touch pad error 3"));
159+
mp_raise_ValueError(MP_ERROR_TEXT("Touch pad error"));
160160
}
161161
err = touch_sensor_enable(s_sens_handle);
162162
if (err != ESP_OK) {
163-
mp_raise_ValueError(MP_ERROR_TEXT("Touch pad error 4"));
163+
mp_raise_ValueError(MP_ERROR_TEXT("Touch pad error"));
164164
}
165165
err = touch_sensor_start_continuous_scanning(s_sens_handle);
166166
if (err != ESP_OK) {
167-
mp_raise_ValueError(MP_ERROR_TEXT("Touch pad error 5"));
167+
mp_raise_ValueError(MP_ERROR_TEXT("Touch pad error"));
168168
}
169169
#endif
170170
initialized = 1;
@@ -183,7 +183,7 @@ static mp_obj_t mtp_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_
183183

184184
return MP_OBJ_FROM_PTR(self);
185185
}
186-
mp_raise_ValueError(MP_ERROR_TEXT("Touch pad error 6"));
186+
mp_raise_ValueError(MP_ERROR_TEXT("Touch pad error"));
187187
}
188188

189189
static mp_obj_t mtp_config(mp_obj_t self_in, mp_obj_t value_in) {
@@ -199,7 +199,7 @@ static mp_obj_t mtp_config(mp_obj_t self_in, mp_obj_t value_in) {
199199
if (err == ESP_OK) {
200200
return mp_const_none;
201201
}
202-
mp_raise_ValueError(MP_ERROR_TEXT("Touch pad error 7"));
202+
mp_raise_ValueError(MP_ERROR_TEXT("Touch pad error"));
203203
}
204204
MP_DEFINE_CONST_FUN_OBJ_2(mtp_config_obj, mtp_config);
205205

@@ -219,7 +219,7 @@ static mp_obj_t mtp_read(mp_obj_t self_in) {
219219
if (err == ESP_OK) {
220220
return MP_OBJ_NEW_SMALL_INT(value);
221221
}
222-
mp_raise_ValueError(MP_ERROR_TEXT("Touch pad error 8"));
222+
mp_raise_ValueError(MP_ERROR_TEXT("Touch pad error"));
223223
}
224224
MP_DEFINE_CONST_FUN_OBJ_1(mtp_read_obj, mtp_read);
225225

ports/esp32/mpconfigport.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -276,11 +276,6 @@
276276
#define MICROPY_HW_USB_CDC (MICROPY_HW_ENABLE_USBDEV)
277277
#endif
278278

279-
// Enable stdio over native USB peripheral HID via TinyUSB
280-
#ifndef MICROPY_HW_USB_HID
281-
#define MICROPY_HW_USB_HID (MICROPY_HW_USB_CDC)
282-
#endif
283-
284279
// Enable stdio over USB Serial/JTAG peripheral
285280
#ifndef MICROPY_HW_ESP_USB_SERIAL_JTAG
286281
#if !CONFIG_IDF_TARGET_ESP32P4

0 commit comments

Comments
 (0)