Add fast update to HMC5883L (#6669)

This commit is contained in:
mkmer 2024-05-05 18:48:09 -04:00 committed by GitHub
parent f78397c77e
commit 833d31ef7a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
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