diff --git a/code/b-parasite/README.md b/code/b-parasite/README.md index e653ce3..b0592f9 100644 --- a/code/b-parasite/README.md +++ b/code/b-parasite/README.md @@ -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 diff --git a/code/b-parasite/src/prst/ble.c b/code/b-parasite/src/prst/ble.c index 5cca8ba..6d74835 100644 --- a/code/b-parasite/src/prst/ble.c +++ b/code/b-parasite/src/prst/ble.c @@ -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