1
0
mirror of https://github.com/esphome/esphome.git synced 2025-10-29 22:24:26 +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 "endstop_cover.h"
#include "esphome/core/log.h"
#include "esphome/core/hal.h"
#include "esphome/core/application.h"
namespace esphome {
namespace endstop {
@@ -65,7 +66,7 @@ void EndstopCover::loop() {
if (this->current_operation == COVER_OPERATION_IDLE)
return;
const uint32_t now = millis();
const uint32_t now = App.get_loop_component_start_time();
if (this->current_operation == COVER_OPERATION_OPENING && this->is_open_()) {
float dur = (now - this->start_dir_time_) / 1e3f;