diff --git a/ports/nrf/common-hal/touchio/TouchIn.c b/ports/nrf/common-hal/touchio/TouchIn.c index 5d8d640e07..ba50b17b0c 100644 --- a/ports/nrf/common-hal/touchio/TouchIn.c +++ b/ports/nrf/common-hal/touchio/TouchIn.c @@ -77,6 +77,8 @@ void common_hal_touchio_touchin_construct(touchio_touchin_obj_t* self, const mcu_pin_obj_t *pin) { self->pin = pin; claim_pin(pin); + + self->threshold = get_raw_reading(self) * 1.05 + 100; } bool common_hal_touchio_touchin_deinited(touchio_touchin_obj_t* self) { @@ -108,6 +110,7 @@ uint16_t common_hal_touchio_touchin_get_threshold(touchio_touchin_obj_t *self) { return self->threshold; } -void common_hal_touchio_touchin_set_threshold(touchio_touchin_obj_t *self, uint16_t new_threshold) { +void common_hal_touchio_touchin_set_threshold(touchio_touchin_obj_t *self, + uint16_t new_threshold) { self->threshold = new_threshold; }