Make fast update intervals in qmc5883l work (#6647)

Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
This commit is contained in:
tronikos 2024-05-01 18:24:18 -07:00 committed by GitHub
parent 1b9a30e921
commit bc65e6e914
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,4 +1,5 @@
#include "qmc5883l.h"
#include "esphome/core/application.h"
#include "esphome/core/log.h"
#include "esphome/core/hal.h"
#include <cmath>
@ -59,6 +60,10 @@ void QMC5883LComponent::setup() {
this->mark_failed();
return;
}
if (this->get_update_interval() < App.get_loop_interval()) {
high_freq_.start();
}
}
void QMC5883LComponent::dump_config() {
ESP_LOGCONFIG(TAG, "QMC5883L:");

View file

@ -56,6 +56,7 @@ class QMC5883LComponent : public PollingComponent, public i2c::I2CDevice {
COMMUNICATION_FAILED,
} error_code_;
bool read_byte_16_(uint8_t a_register, uint16_t *data);
HighFrequencyLoopRequester high_freq_;
};
} // namespace qmc5883l