From 0bf328bf772889330cf843113e2196d3e0cd23f0 Mon Sep 17 00:00:00 2001 From: Astro Date: Mon, 11 Oct 2021 02:04:05 +0200 Subject: [PATCH] pi-sensors: slew the onewire delay for lossy cables --- overlay/pi-sensors/src/dht.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/overlay/pi-sensors/src/dht.rs b/overlay/pi-sensors/src/dht.rs index 1be20cf9..15d260be 100644 --- a/overlay/pi-sensors/src/dht.rs +++ b/overlay/pi-sensors/src/dht.rs @@ -25,7 +25,7 @@ impl Sensor for DHT22 { fn read(&mut self) -> Vec { let mut delay_us = |d: u16| { // We are using here more accurate delays than in std library - spin_sleep::sleep(Duration::from_micros(d as u64)); + spin_sleep::sleep(Duration::from_micros(2 * (d as u64))); }; self.pin.switch_output();