mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-26 04:06:34 +00:00
parent
14030df1f4
commit
b33fa68c01
@ -76,11 +76,12 @@ bool Bh1750Read(void)
|
|||||||
if (Bh1750.valid) { Bh1750.valid--; }
|
if (Bh1750.valid) { Bh1750.valid--; }
|
||||||
|
|
||||||
if (2 != Wire.requestFrom(Bh1750.address, (uint8_t)2)) { return false; }
|
if (2 != Wire.requestFrom(Bh1750.address, (uint8_t)2)) { return false; }
|
||||||
Bh1750.illuminance = (Wire.read() << 8) | Wire.read();
|
float illuminance = (Wire.read() << 8) | Wire.read();
|
||||||
Bh1750.illuminance /= (1.2 * (69 / Bh1750.mtreg));
|
illuminance /= (1.2 * (69 / (float)Bh1750.mtreg));
|
||||||
if (1 == Settings.SensorBits1.bh1750_resolution) {
|
if (1 == Settings.SensorBits1.bh1750_resolution) {
|
||||||
Bh1750.illuminance >>= 1;
|
illuminance /= 2;
|
||||||
}
|
}
|
||||||
|
Bh1750.illuminance = illuminance;
|
||||||
|
|
||||||
Bh1750.valid = SENSOR_MAX_MISS;
|
Bh1750.valid = SENSOR_MAX_MISS;
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user