Update esphome/components/apds9306/apds9306.cpp

Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
This commit is contained in:
Aodren Auffrédou-Heinicke 2024-05-14 15:09:16 -07:00 committed by GitHub
parent bc7ed7091e
commit 9d1266e3b3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 1 deletions

View File

@ -168,7 +168,7 @@ void APDS9306::update() {
uint8_t als_data[3];
APDS9306_WARNING_CHECK(this->read_byte(APDS9306_REG_ALS_DATA_0, als_data, 3), "Reading ALS data has failed.");
uint32_t light_level = 0x0000 | ((als_data[0]) + (als_data[1] << 8) + (als_data[2] << 16));
uint32_t light_level = encode_uint24(als_data[2], als_data[1], als_data[0]);
float lux = ((float) light_level / gain_val_) * (100.0f / rate_val_);