mirror of
https://github.com/esphome/esphome.git
synced 2025-10-26 12:43:48 +00:00
Reduce number of calls to fetch time in the main loop (#8804)
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#include "uponor_smatrix_climate.h"
|
||||
#include "esphome/core/helpers.h"
|
||||
#include "esphome/core/log.h"
|
||||
#include "esphome/core/application.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace uponor_smatrix {
|
||||
@@ -13,7 +14,7 @@ void UponorSmatrixClimate::dump_config() {
|
||||
}
|
||||
|
||||
void UponorSmatrixClimate::loop() {
|
||||
const uint32_t now = millis();
|
||||
const uint32_t now = App.get_loop_component_start_time();
|
||||
|
||||
// Publish state after all update packets are processed
|
||||
if (this->last_data_ != 0 && (now - this->last_data_ > 100) && this->target_temperature_raw_ != 0) {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "uponor_smatrix.h"
|
||||
#include "esphome/core/log.h"
|
||||
#include "esphome/core/application.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace uponor_smatrix {
|
||||
@@ -35,7 +36,7 @@ void UponorSmatrixComponent::dump_config() {
|
||||
}
|
||||
|
||||
void UponorSmatrixComponent::loop() {
|
||||
const uint32_t now = millis();
|
||||
const uint32_t now = App.get_loop_component_start_time();
|
||||
|
||||
// Discard stale data
|
||||
if (!this->rx_buffer_.empty() && (now - this->last_rx_ > 50)) {
|
||||
|
||||
Reference in New Issue
Block a user