From c61015fa2195478414a0a42a213654b18d141441 Mon Sep 17 00:00:00 2001 From: Jeroen88 Date: Sun, 8 Jan 2023 11:06:25 +0100 Subject: [PATCH] Back to millis() instead of micros() to check interval between OpenTherm request. Check in the latest release was too short --- src/EasyOpenTherm.cpp | 6 ++---- src/EasyOpenTherm.h | 3 +-- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/EasyOpenTherm.cpp b/src/EasyOpenTherm.cpp index f586103..e8df629 100644 --- a/src/EasyOpenTherm.cpp +++ b/src/EasyOpenTherm.cpp @@ -376,8 +376,7 @@ bool OTPhysicalLayer::send(uint32_t fr return false; } -// if(_state == STATE::READY && millis() - _lastReceivedTimestampMs < 100) { - if(_state == STATE::READY && millis() - _lastReceivedTimestampMicros < 100) { + if(_state == STATE::READY && millis() - _lastReceivedTimestampMs < 100) { return false; // Wait at least 100 ms after receiving the final bit of the latest frame before sending a new frame } @@ -485,8 +484,7 @@ void OTPhysicalLayer::handleInterrupt() { lastTimestamp = timestamp; mask >>= 1; } else { // stop bit -// _lastReceivedTimestampMs = millis(); - _lastReceivedTimestampMicros = micros(); + _lastReceivedTimestampMs = millis(); _state = STATE::READY; } } diff --git a/src/EasyOpenTherm.h b/src/EasyOpenTherm.h index 4100575..935240a 100644 --- a/src/EasyOpenTherm.h +++ b/src/EasyOpenTherm.h @@ -527,8 +527,7 @@ private: volatile uint32_t _frame; uint32_t _lastSentTimestampMs; -// volatile uint32_t _lastReceivedTimestampMs; - volatile uint32_t _lastReceivedTimestampMicros; + volatile uint32_t _lastReceivedTimestampMs; uint8_t _rxPin; uint8_t _txPin; -- libgit2 0.21.4