From 043095b6052950907611738a15492f38643dfb80 Mon Sep 17 00:00:00 2001 From: hcoohb Date: Tue, 2 Feb 2021 00:59:27 +1000 Subject: [PATCH 1/3] fix esp8266 remote_transmitter using incorrect timings (#1465) * replace delay by delayMicroseconds in delay_microseconds_accurate * Use delay(0) to let wifi and os function run * Linting * Remove unneeded delayMicroseconds, keep it for low usec * Avoid micros() overflow issue --- esphome/core/helpers.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/esphome/core/helpers.cpp b/esphome/core/helpers.cpp index f0e0c65f66..3e7472d2fe 100644 --- a/esphome/core/helpers.cpp +++ b/esphome/core/helpers.cpp @@ -171,15 +171,17 @@ uint8_t crc8(uint8_t *data, uint8_t len) { } return crc; } + void delay_microseconds_accurate(uint32_t usec) { if (usec == 0) return; - - if (usec <= 16383UL) { + if (usec < 5000UL) { delayMicroseconds(usec); - } else { - delay(usec / 1000UL); - delayMicroseconds(usec % 1000UL); + return; + } + uint32_t start = micros(); + while (micros() - start < usec) { + delay(0); } } From 1952d275f713c2ad2671c3ac9bb3fb8eb44a93ef Mon Sep 17 00:00:00 2001 From: Guillermo Ruffino Date: Tue, 2 Feb 2021 20:30:20 -0300 Subject: [PATCH 2/3] RC522 increased retry loop count (#1506) --- esphome/components/rc522/rc522.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/esphome/components/rc522/rc522.cpp b/esphome/components/rc522/rc522.cpp index ff8d18e3ea..8182c1e8c9 100644 --- a/esphome/components/rc522/rc522.cpp +++ b/esphome/components/rc522/rc522.cpp @@ -349,7 +349,7 @@ RC522::StatusCode RC522::pcd_communicate_with_picc_( // transmitting. Each iteration of the do-while-loop takes 17.86μs. // TODO check/modify for other architectures than Arduino Uno 16bit uint16_t i; - for (i = 4; i > 0; i--) { + for (i = 2000; i > 0; i--) { uint8_t n = pcd_read_register( COM_IRQ_REG); // ComIrqReg[7..0] bits are: Set1 TxIRq RxIRq IdleIRq HiAlertIRq LoAlertIRq ErrIRq TimerIRq if (n & wait_i_rq) { // One of the interrupts that signal success has been set. From 89a89e17851c7a35b031523322763060690216ce Mon Sep 17 00:00:00 2001 From: Jesse Hills <3060199+jesserockz@users.noreply.github.com> Date: Wed, 3 Feb 2021 12:33:30 +1300 Subject: [PATCH 3/3] Bump version to v1.16.0b8 --- esphome/const.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/esphome/const.py b/esphome/const.py index 89d9db414d..c61054ddbd 100644 --- a/esphome/const.py +++ b/esphome/const.py @@ -2,7 +2,7 @@ MAJOR_VERSION = 1 MINOR_VERSION = 16 -PATCH_VERSION = '0b7' +PATCH_VERSION = '0b8' __short_version__ = f'{MAJOR_VERSION}.{MINOR_VERSION}' __version__ = f'{__short_version__}.{PATCH_VERSION}'