Commit c61015fa2195478414a0a42a213654b18d141441

Authored by Jeroen88
1 parent 93556e84

Back to millis() instead of micros() to check interval between OpenTherm request…

…. Check in the latest release was too short
src/EasyOpenTherm.cpp
@@ -376,8 +376,7 @@ bool OTPhysicalLayer::send(uint32_t fr @@ -376,8 +376,7 @@ bool OTPhysicalLayer::send(uint32_t fr
376 return false; 376 return false;
377 } 377 }
378 378
379 -// if(_state == STATE::READY && millis() - _lastReceivedTimestampMs < 100) {  
380 - if(_state == STATE::READY && millis() - _lastReceivedTimestampMicros < 100) { 379 + if(_state == STATE::READY && millis() - _lastReceivedTimestampMs < 100) {
381 380
382 return false; // Wait at least 100 ms after receiving the final bit of the latest frame before sending a new frame 381 return false; // Wait at least 100 ms after receiving the final bit of the latest frame before sending a new frame
383 } 382 }
@@ -485,8 +484,7 @@ void OTPhysicalLayer::handleInterrupt() { @@ -485,8 +484,7 @@ void OTPhysicalLayer::handleInterrupt() {
485 lastTimestamp = timestamp; 484 lastTimestamp = timestamp;
486 mask >>= 1; 485 mask >>= 1;
487 } else { // stop bit 486 } else { // stop bit
488 -// _lastReceivedTimestampMs = millis();  
489 - _lastReceivedTimestampMicros = micros(); 487 + _lastReceivedTimestampMs = millis();
490 _state = STATE::READY; 488 _state = STATE::READY;
491 } 489 }
492 } 490 }
src/EasyOpenTherm.h
@@ -527,8 +527,7 @@ private: @@ -527,8 +527,7 @@ private:
527 527
528 volatile uint32_t _frame; 528 volatile uint32_t _frame;
529 uint32_t _lastSentTimestampMs; 529 uint32_t _lastSentTimestampMs;
530 -// volatile uint32_t _lastReceivedTimestampMs;  
531 - volatile uint32_t _lastReceivedTimestampMicros; 530 + volatile uint32_t _lastReceivedTimestampMs;
532 531
533 uint8_t _rxPin; 532 uint8_t _rxPin;
534 uint8_t _txPin; 533 uint8_t _txPin;