Skip to content

Commit

Permalink
Make fast update intervals in qmc5883l work (esphome#6647)
Browse files Browse the repository at this point in the history
Co-authored-by: Jesse Hills <[email protected]>
  • Loading branch information
tronikos and jesserockz authored May 2, 2024
1 parent 1b9a30e commit bc65e6e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions esphome/components/qmc5883l/qmc5883l.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "qmc5883l.h"
#include "esphome/core/application.h"
#include "esphome/core/log.h"
#include "esphome/core/hal.h"
#include <cmath>
Expand Down Expand Up @@ -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:");
Expand Down
1 change: 1 addition & 0 deletions esphome/components/qmc5883l/qmc5883l.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit bc65e6e

Please sign in to comment.