mirror of
https://github.com/esphome/esphome.git
synced 2024-11-22 06:58:11 +01:00
Add fast update to HMC5883L (#6669)
This commit is contained in:
parent
f78397c77e
commit
833d31ef7a
2 changed files with 6 additions and 0 deletions
|
@ -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();
|
||||
|
|
|
@ -63,6 +63,7 @@ class HMC5883LComponent : public PollingComponent, public i2c::I2CDevice {
|
|||
COMMUNICATION_FAILED,
|
||||
ID_REGISTERS,
|
||||
} error_code_;
|
||||
HighFrequencyLoopRequester high_freq_;
|
||||
};
|
||||
|
||||
} // namespace hmc5883l
|
||||
|
|
Loading…
Reference in a new issue