mirror of
https://github.com/esphome/esphome.git
synced 2024-11-15 10:35:51 +01:00
added float conversion to light level in lux calculation
This commit is contained in:
parent
790edcc04a
commit
f02b30e7f3
@ -163,7 +163,7 @@ void APDS9306::update() {
|
||||
|
||||
uint32_t light_level = 0x0000 | ( (als_data[0]) + (als_data[1] << 8) + (als_data[2] << 16));
|
||||
|
||||
float lux = (light_level / gain_val_) * (100.0f / rate_val_);
|
||||
float lux = ((float)light_level / gain_val_) * (100.0f / rate_val_);
|
||||
|
||||
ESP_LOGD(TAG, "Got illuminance=%.1flx", lux);
|
||||
this->publish_state(lux);
|
||||
|
Loading…
Reference in New Issue
Block a user