mirror of
https://github.com/esphome/esphome.git
synced 2025-10-30 06:33:51 +00:00
Reduce number of calls to fetch time in the main loop (#8804)
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
*/
|
||||
#include "gcja5.h"
|
||||
#include "esphome/core/log.h"
|
||||
#include "esphome/core/application.h"
|
||||
#include <cstring>
|
||||
|
||||
namespace esphome {
|
||||
@@ -16,7 +17,7 @@ static const char *const TAG = "gcja5";
|
||||
void GCJA5Component::setup() { ESP_LOGCONFIG(TAG, "Setting up gcja5..."); }
|
||||
|
||||
void GCJA5Component::loop() {
|
||||
const uint32_t now = millis();
|
||||
const uint32_t now = App.get_loop_component_start_time();
|
||||
if (now - this->last_transmission_ >= 500) {
|
||||
// last transmission too long ago. Reset RX index.
|
||||
this->rx_message_.clear();
|
||||
|
||||
Reference in New Issue
Block a user