From 71e2ec4cc90ce4b82123887d09684de6e5e1a4c8 Mon Sep 17 00:00:00 2001 From: Theo Arends Date: Sat, 30 Jun 2018 14:53:04 +0200 Subject: [PATCH] Add some delay to TM1638 - better Add some delay to TM1638 (#2226) --- sonoff/xsns_28_tm1638.ino | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/sonoff/xsns_28_tm1638.ino b/sonoff/xsns_28_tm1638.ino index 97fab3d1c..6945261c8 100644 --- a/sonoff/xsns_28_tm1638.ino +++ b/sonoff/xsns_28_tm1638.ino @@ -46,9 +46,9 @@ void Tm16XXSend(byte data) { for (int i = 0; i < 8; i++) { digitalWrite(tm1638_clock_pin, LOW); - delayMicroseconds(TM1638_CLOCK_DELAY); digitalWrite(tm1638_data_pin, data & 1 ? HIGH : LOW); data >>= 1; + delayMicroseconds(TM1638_CLOCK_DELAY); digitalWrite(tm1638_clock_pin, HIGH); } } @@ -81,9 +81,7 @@ byte Tm16XXReceive() temp >>= 1; digitalWrite(tm1638_clock_pin, LOW); delayMicroseconds(TM1638_CLOCK_DELAY); - if (digitalRead(tm1638_data_pin)) { - temp |= 0x80; - } + if (digitalRead(tm1638_data_pin)) { temp |= 0x80; } digitalWrite(tm1638_clock_pin, HIGH); }