From 79161d3c430ef19dcea4555e16fe2ee023a47d41 Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Wed, 20 Jul 2022 11:11:18 +0200 Subject: [PATCH] Fix BH1750 illuminance formula Fix BH1750 illuminance formula (#16022) --- tasmota/tasmota_xdrv_driver/xdrv_63_modbus_bridge.ino | 7 +++---- tasmota/tasmota_xsns_sensor/xsns_10_bh1750.ino | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/tasmota/tasmota_xdrv_driver/xdrv_63_modbus_bridge.ino b/tasmota/tasmota_xdrv_driver/xdrv_63_modbus_bridge.ino index e095198fb..faf102934 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_63_modbus_bridge.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_63_modbus_bridge.ino @@ -17,13 +17,12 @@ along with this program. If not, see . */ -/* - Example Command: modbussend {"deviceaddress": 1, "functioncode": 3, "startaddress": 1, "type":"uint8", "count":4} -*/ - #ifdef USE_MODBUS_BRIDGE /*********************************************************************************************\ * Modbus Bridge using Modbus library (TasmotaModbus) + * + * Example Command: + * ModbusSend {"deviceaddress": 1, "functioncode": 3, "startaddress": 1, "type":"uint8", "count":4} \*********************************************************************************************/ #define XDRV_63 63 diff --git a/tasmota/tasmota_xsns_sensor/xsns_10_bh1750.ino b/tasmota/tasmota_xsns_sensor/xsns_10_bh1750.ino index b8be7a04e..c67b0e24e 100644 --- a/tasmota/tasmota_xsns_sensor/xsns_10_bh1750.ino +++ b/tasmota/tasmota_xsns_sensor/xsns_10_bh1750.ino @@ -101,7 +101,7 @@ bool Bh1750Read(uint32_t sensor_index) { if (2 != Wire.requestFrom(Bh1750_sensors[sensor_index].address, (uint8_t)2)) { return false; } float illuminance = (Wire.read() << 8) | Wire.read(); - illuminance /= (1.2 * (69 / (float)Bh1750_sensors[sensor_index].mtreg)); + illuminance *= 57.5 / (float)Bh1750_sensors[sensor_index].mtreg; // Fix #16022 if (1 == Bh1750Resolution(sensor_index)) { illuminance /= 2; }