Really fixing BTHome v2 illuminance encoding this time
This commit is contained in:
parent
cab55d9b8c
commit
f7806d4c7e
1 changed files with 5 additions and 3 deletions
|
|
@ -108,9 +108,11 @@ int prst_ble_encode_service_data(const prst_sensors_t* sensors,
|
||||||
out[8] = humi_val >> 8;
|
out[8] = humi_val >> 8;
|
||||||
// Illuminance.
|
// Illuminance.
|
||||||
out[9] = 0x05;
|
out[9] = 0x05;
|
||||||
out[10] = sensors->photo.brightness & 0xff;
|
// Value. Factor of 0.01.
|
||||||
out[11] = sensors->photo.brightness >> 8;
|
uint32_t lux_val = sensors->photo.brightness * 100;
|
||||||
out[12] = 0;
|
out[10] = lux_val & 0xff;
|
||||||
|
out[11] = (lux_val >> 8) & 0xff;
|
||||||
|
out[12] = (lux_val >> 16) & 0xff;
|
||||||
// Battery voltage.
|
// Battery voltage.
|
||||||
out[13] = 0x0c;
|
out[13] = 0x0c;
|
||||||
// Value. Factor of 0.001.
|
// Value. Factor of 0.001.
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue