Fixes #if PRST_HAS_LDR check in ble.c

This commit is contained in:
rbaron 2021-09-22 22:30:22 +02:00
parent d8aea1d4ef
commit e1f385adbd
2 changed files with 11 additions and 11 deletions

View file

@ -30,16 +30,16 @@ Sensor data is encoded in the BLE advertisement packet as Service Data for the [
Sensor data is encoded in unsigned 16 bits (2 bytes), and whenever multiple
bytes are used to represent a single value, the encoding is big-endian.
| Byte index | Description |
|------------|-----------------------------------------------------------------|
| 0 | Protocol version (4 bits) + reserved (3 bits) + has_lux* (1 bit)|
| 1 | Reserved (4 bits) + increasing, wrap-around counter (4 bits) |
| 2-3 | Battery voltage in millivolts |
| 4-5 | Temperature in millidegrees Celcius |
| 6-7 | Relative air humidity, scaled from 0 (0%) to 0xffff (100%) |
| 8-9 | Soil moisture, scaled from from 0 (0%) to 0xffff (100%) |
| 10-15 | b-parasite's own MAC address |
| 16-17* | Ambient light in lux |
| Byte index | Description |
|------------|-------------------------------------------------------------------|
| 0 | Protocol version (4 bits) + reserved (3 bits) + `has_lux`* (1 bit)|
| 1 | Reserved (4 bits) + increasing, wrap-around counter (4 bits) |
| 2-3 | Battery voltage in millivolts |
| 4-5 | Temperature in millidegrees Celcius |
| 6-7 | Relative air humidity, scaled from 0 (0%) to 0xffff (100%) |
| 8-9 | Soil moisture, scaled from from 0 (0%) to 0xffff (100%) |
| 10-15 | b-parasite's own MAC address |
| 16-17* | Ambient light in lux |
\* If the `has_lux` bit is set, bytes 16-17 shall contain the ambient light in lux.
If the `has_lux` bit is not set, bytes 16-17 may not exist or may contain

View file

@ -171,7 +171,7 @@ void prst_ble_update_adv_data(uint16_t batt_millivolts,
service_data[8] = soil_moisture >> 8;
service_data[9] = soil_moisture & 0xff;
#ifdef PRST_HAS_LDR
#if PRST_HAS_LDR
service_data[16] = brightness >> 8;
service_data[17] = brightness & 0xff;
#endif