1
0
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:
J. Nick Koston
2025-05-18 15:48:57 -04:00
committed by GitHub
parent e47741d471
commit 574aabdede
36 changed files with 107 additions and 53 deletions

View File

@@ -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) {

View File

@@ -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)) {