From 383e8b5089d6d27cc07505b7f347b52192141453 Mon Sep 17 00:00:00 2001 From: alexdz18 Date: Fri, 11 Jun 2021 22:33:58 +0300 Subject: [PATCH] Arch/Esp8266/Core/Digital.cpp: fixed pulseIn() for pins >= 8 (#2337) --- Sming/Arch/Esp8266/Core/Digital.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sming/Arch/Esp8266/Core/Digital.cpp b/Sming/Arch/Esp8266/Core/Digital.cpp index 240de8e91f..68a81dbccd 100644 --- a/Sming/Arch/Esp8266/Core/Digital.cpp +++ b/Sming/Arch/Esp8266/Core/Digital.cpp @@ -141,9 +141,9 @@ unsigned long pulseIn(uint16_t pin, uint8_t state, unsigned long timeout) // cache the port and bit of the pin in order to speed up the // pulse width measuring loop and achieve finer resolution. calling // digitalRead() instead yields much coarser resolution. - uint8_t bit = digitalPinToBitMask(pin); + uint32_t bit = digitalPinToBitMask(pin); // uint8_t port = digitalPinToPort(pin); // Does nothing in Sming, comment-out to prevent compiler warning - uint8_t stateMask = (state ? bit : 0); + uint32_t stateMask = (state ? bit : 0); unsigned long width = 0; // keep initialization out of time critical area // convert the timeout from microseconds to a number of times through