From bcf2bc5cf1fccb41bb9f7b33a9a3c5e307440bb1 Mon Sep 17 00:00:00 2001 From: SteWers <42718143+SteWers@users.noreply.github.com> Date: Thu, 17 Feb 2022 19:16:24 +0100 Subject: [PATCH] [SR04] fix mode 1 detection Detection of sensors running in mode 1 fixed. --- tasmota/xsns_22_sr04.ino | 1 + 1 file changed, 1 insertion(+) diff --git a/tasmota/xsns_22_sr04.ino b/tasmota/xsns_22_sr04.ino index da201e54e..717f76566 100644 --- a/tasmota/xsns_22_sr04.ino +++ b/tasmota/xsns_22_sr04.ino @@ -136,6 +136,7 @@ void Sr04TModeDetect(void) { sonar_serial = nullptr; } sonar = new NewPing(sr04_trig_pin, sr04_echo_pin, SR04_MAX_SENSOR_DISTANCE); + delay(100); // give time to inizialise, preventing ping_median fails if (!sonar || !sonar->ping_median(5)) { SR04.type = SR04_MODE_NONE; }