mirror of
				https://github.com/esphome/esphome.git
				synced 2025-10-30 22:53:59 +00:00 
			
		
		
		
	[bh1750] Remove redundant platform name from logging (#9153)
This commit is contained in:
		| @@ -50,7 +50,7 @@ void BH1750Sensor::read_lx_(BH1750Mode mode, uint8_t mtreg, const std::function< | |||||||
|   // turn on (after one-shot sensor automatically powers down) |   // turn on (after one-shot sensor automatically powers down) | ||||||
|   uint8_t turn_on = BH1750_COMMAND_POWER_ON; |   uint8_t turn_on = BH1750_COMMAND_POWER_ON; | ||||||
|   if (this->write(&turn_on, 1) != i2c::ERROR_OK) { |   if (this->write(&turn_on, 1) != i2c::ERROR_OK) { | ||||||
|     ESP_LOGW(TAG, "Turning on BH1750 failed"); |     ESP_LOGW(TAG, "Power on failed"); | ||||||
|     f(NAN); |     f(NAN); | ||||||
|     return; |     return; | ||||||
|   } |   } | ||||||
| @@ -60,7 +60,7 @@ void BH1750Sensor::read_lx_(BH1750Mode mode, uint8_t mtreg, const std::function< | |||||||
|     uint8_t mtreg_hi = BH1750_COMMAND_MT_REG_HI | ((mtreg >> 5) & 0b111); |     uint8_t mtreg_hi = BH1750_COMMAND_MT_REG_HI | ((mtreg >> 5) & 0b111); | ||||||
|     uint8_t mtreg_lo = BH1750_COMMAND_MT_REG_LO | ((mtreg >> 0) & 0b11111); |     uint8_t mtreg_lo = BH1750_COMMAND_MT_REG_LO | ((mtreg >> 0) & 0b11111); | ||||||
|     if (this->write(&mtreg_hi, 1) != i2c::ERROR_OK || this->write(&mtreg_lo, 1) != i2c::ERROR_OK) { |     if (this->write(&mtreg_hi, 1) != i2c::ERROR_OK || this->write(&mtreg_lo, 1) != i2c::ERROR_OK) { | ||||||
|       ESP_LOGW(TAG, "Setting measurement time for BH1750 failed"); |       ESP_LOGW(TAG, "Set measurement time failed"); | ||||||
|       active_mtreg_ = 0; |       active_mtreg_ = 0; | ||||||
|       f(NAN); |       f(NAN); | ||||||
|       return; |       return; | ||||||
| @@ -88,7 +88,7 @@ void BH1750Sensor::read_lx_(BH1750Mode mode, uint8_t mtreg, const std::function< | |||||||
|       return; |       return; | ||||||
|   } |   } | ||||||
|   if (this->write(&cmd, 1) != i2c::ERROR_OK) { |   if (this->write(&cmd, 1) != i2c::ERROR_OK) { | ||||||
|     ESP_LOGW(TAG, "Starting measurement for BH1750 failed"); |     ESP_LOGW(TAG, "Start measurement failed"); | ||||||
|     f(NAN); |     f(NAN); | ||||||
|     return; |     return; | ||||||
|   } |   } | ||||||
| @@ -99,7 +99,7 @@ void BH1750Sensor::read_lx_(BH1750Mode mode, uint8_t mtreg, const std::function< | |||||||
|   this->set_timeout("read", meas_time, [this, mode, mtreg, f]() { |   this->set_timeout("read", meas_time, [this, mode, mtreg, f]() { | ||||||
|     uint16_t raw_value; |     uint16_t raw_value; | ||||||
|     if (this->read(reinterpret_cast<uint8_t *>(&raw_value), 2) != i2c::ERROR_OK) { |     if (this->read(reinterpret_cast<uint8_t *>(&raw_value), 2) != i2c::ERROR_OK) { | ||||||
|       ESP_LOGW(TAG, "Reading BH1750 data failed"); |       ESP_LOGW(TAG, "Read data failed"); | ||||||
|       f(NAN); |       f(NAN); | ||||||
|       return; |       return; | ||||||
|     } |     } | ||||||
| @@ -156,7 +156,7 @@ void BH1750Sensor::update() { | |||||||
|         this->publish_state(NAN); |         this->publish_state(NAN); | ||||||
|         return; |         return; | ||||||
|       } |       } | ||||||
|       ESP_LOGD(TAG, "'%s': Got illuminance=%.1flx", this->get_name().c_str(), val); |       ESP_LOGD(TAG, "'%s': Illuminance=%.1flx", this->get_name().c_str(), val); | ||||||
|       this->status_clear_warning(); |       this->status_clear_warning(); | ||||||
|       this->publish_state(val); |       this->publish_state(val); | ||||||
|     }); |     }); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user