From 36c71bb2eae3ddddf5791200b17cd1e4cbd8a9bf Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Wed, 18 Mar 2026 20:47:00 +0100 Subject: [PATCH] Quick Fix ESP8266 I2C Clock Stretch limit - It seems the current implementation fails to set the clock stretch limit using functions from Wire library; It's set to 0 whatever the user wants it to be. This quick fix at least sets a default of 150ms to allow clock stretch to be used for devices that need it. It fixes support for Sensirion SCD30 and SGP30 which rely on clock stretching.. I'll dive deeper to solve the Wire provided functions. --- lib/default/TasmotaWire/src/twi_class.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/default/TasmotaWire/src/twi_class.h b/lib/default/TasmotaWire/src/twi_class.h index 228a118e3..7b66770b9 100644 --- a/lib/default/TasmotaWire/src/twi_class.h +++ b/lib/default/TasmotaWire/src/twi_class.h @@ -14,7 +14,7 @@ private: unsigned char twi_sda = 0; unsigned char twi_scl = 0; unsigned char twi_addr = 0; - uint32_t twi_clockStretchLimit = 0; + uint32_t twi_clockStretchLimit = 150000; // These are int-wide, even though they could all fit in a byte, to reduce code size and avoid any potential // issues about RmW on packed bytes. The int-wide variations of asm instructions are smaller than the equivalent