Skip to content

Commit ebfde5c

Browse files
authored
Merge pull request #7865 from CanyonCasa/reset
Reset stuck low detection
2 parents 4b2578c + 61f868a commit ebfde5c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

shared-module/onewireio/OneWire.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,10 @@ bool common_hal_onewireio_onewire_reset(onewireio_onewire_obj_t *self) {
5959
common_hal_mcu_delay_us(70);
6060
bool value = common_hal_digitalio_digitalinout_get_value(&self->pin);
6161
common_hal_mcu_delay_us(410);
62+
// test if bus returned high (idle) and not stuck at low
63+
bool idle = common_hal_digitalio_digitalinout_get_value(&self->pin);
6264
common_hal_mcu_enable_interrupts();
63-
return value;
65+
return value || !idle;
6466
}
6567

6668
bool common_hal_onewireio_onewire_read_bit(onewireio_onewire_obj_t *self) {

0 commit comments

Comments
 (0)