Add fast update

This commit is contained in:
mkmer 2024-05-02 12:56:13 +00:00
parent c7c0d97a5e
commit dad9e5c44b
2 changed files with 6 additions and 0 deletions

View File

@ -1,5 +1,6 @@
#include "hmc5883l.h"
#include "esphome/core/log.h"
#include "esphome/core/application.h"
namespace esphome {
namespace hmc5883l {
@ -31,6 +32,10 @@ void HMC5883LComponent::setup() {
return;
}
if (this->get_update_interval() < App.get_loop_interval()) {
high_freq_.start();
}
if (id[0] != 0x48 || id[1] != 0x34 || id[2] != 0x33) {
this->error_code_ = ID_REGISTERS;
this->mark_failed();

View File

@ -63,6 +63,7 @@ class HMC5883LComponent : public PollingComponent, public i2c::I2CDevice {
COMMUNICATION_FAILED,
ID_REGISTERS,
} error_code_;
HighFrequencyLoopRequester high_freq_;
};
} // namespace hmc5883l