Skip to content

Commit d645e9c

Browse files
authored
Merge pull request #6743 from Sciss/patch-1
Touchin.c - fix clean up in constructor before exception is thrown
2 parents 5a2d870 + 92231e8 commit d645e9c

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

shared-module/touchio/TouchIn.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ void common_hal_touchio_touchin_construct(touchio_touchin_obj_t *self, const mcu
7878

7979
uint16_t raw_reading = get_raw_reading(self);
8080
if (raw_reading == TIMEOUT_TICKS) {
81+
common_hal_touchio_touchin_deinit(self);
8182
mp_raise_ValueError(translate("No pulldown on pin; 1Mohm recommended"));
8283
}
8384
self->threshold = raw_reading * 1.05 + 100;

0 commit comments

Comments
 (0)