mirror of
				https://github.com/esphome/esphome.git
				synced 2025-10-30 22:53:59 +00:00 
			
		
		
		
	Add fast update to HMC5883L (#6669)
This commit is contained in:
		| @@ -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 | ||||
|   | ||||
		Reference in New Issue
	
	Block a user