Skip to content

Commit 368c02c

Browse files
committed
pbio/dcm_ev3: Fix EV3 Touch Sensor detection.
The sensor would not be detected until it was released. Now it is detected either way. Fixes pybricks/support#2589
1 parent 44a4ef8 commit 368c02c

2 files changed

Lines changed: 10 additions & 6 deletions

File tree

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@
66

77
### Fixed
88
- Fixed EV3 screen animation not closing on user display actions ([support#2585]).
9+
- Fixed EV3 Touch Sensor not detected it is pressed while plugged in ([support#2589]).
910

10-
[support#1382]: https://github.com/pybricks/support/issues/2585
11+
[support#2585]: https://github.com/pybricks/support/issues/2585
12+
[support#2589]: https://github.com/pybricks/support/issues/2589
1113

1214
## [4.0.0b6] - 2026-02-19
1315

lib/pbio/src/port_dcm_ev3.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,8 @@
1515

1616
#define DEBUG 0
1717
#if DEBUG
18-
#include <stdio.h>
19-
#include <inttypes.h>
20-
#include <pbdrv/usb.h>
21-
#define debug_pr pbdrv_usb_debug_printf
18+
#include <pbio/debug.h>
19+
#define debug_pr pbio_debug
2220
#else
2321
#define debug_pr(...)
2422
#endif
@@ -77,7 +75,7 @@ typedef enum {
7775
/**
7876
* Device category is EV3 analog sensor.
7977
*/
80-
DCM_CATEGORY_EV3_ANALOG = PIN_STATE_ADC1_100_to_3100 | PIN_STATE_P2_HIGH,
78+
DCM_CATEGORY_EV3_ANALOG = PIN_STATE_ADC1_100_to_3100 | PIN_STATE_P2_HIGH | PIN_STATE_MASK_P6,
8179
/**
8280
* No device is connected.
8381
*/
@@ -149,6 +147,10 @@ static uint32_t pbio_port_dcm_get_mv(const pbdrv_ioport_pins_t *pins, uint8_t pi
149147
*/
150148
static pbio_port_dcm_category_t pbio_port_dcm_get_category(pbio_port_dcm_pin_state_t state) {
151149

150+
if ((state | PIN_STATE_MASK_P6) == DCM_CATEGORY_EV3_ANALOG) {
151+
return DCM_CATEGORY_EV3_ANALOG;
152+
}
153+
152154
if ((state | PIN_STATE_MASK_P6) == DCM_CATEGORY_LUMP) {
153155
return DCM_CATEGORY_LUMP;
154156
}

0 commit comments

Comments
 (0)