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 "qmc5883l.h"
#include "esphome/core/application.h"
#include "esphome/core/log.h" #include "esphome/core/log.h"
#include "esphome/core/hal.h" #include "esphome/core/hal.h"
#include <cmath> #include <cmath>
@ -59,6 +60,10 @@ void QMC5883LComponent::setup() {
this->mark_failed(); this->mark_failed();
return; return;
} }
if (this->get_update_interval() < App.get_loop_interval()) {
high_freq_.start();
}
} }
void QMC5883LComponent::dump_config() { void QMC5883LComponent::dump_config() {
ESP_LOGCONFIG(TAG, "QMC5883L:"); ESP_LOGCONFIG(TAG, "QMC5883L:");

View File

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