The reason for removing illuminance is to leave enough space for the
full name AD element "prst". There may be options for also sending the
illuminance (extended adv, scan response etc), with different power
consumption/overhead/complexity tradeoffs. For now let's keep it simple.
This protococol (https://bthome.io/) allows for automatic sensor
detection in Home Assistant, as long as the device broadcasts its
sensors in the expected format.
This flags makes use of the Coded PHY from Bluetooth 5. It should be
treated as an experimental feature and it's disabled by default.
Note that clients (such as ESPHomme) would also have to scan on the
Coded PHY to be able to find b-parasites operating in this mode.
Currently, no client does that. Thus the feature is disabled and marked
as experimental.
The only change from v1 is how the temperature is encoded. In v2, two
bytes at offset 4 and 5 represent a 16-bit signed int (in big-endian).
It contains the temperature in degrees Celsius * 100.
Fixes#29
In the BLE service data payload, one of the reserved bits is now used to
indicate whether or not the ambient lux value is encoded in the packet.
Bit 0 of the first byte is now the `has_lux` bit. If it is set, bytes
16-17 in the service data will contain the ambient lux. If `has_lux` is
not set, bytes 16-17 may not exist (for compatibility with older
firmwares) or may hold meaningless values.
This commit also introduces version-specific configuration in
prst_config.h. Photoresistor config, for example, is only meaninful for
version 1.1.x.
- Code now compiles
- Estimation of the photo resistor resistance works
- Lux estimation from the photo resistor resistance needs more work and calibration
- Lux is now encoded in the BLE advertisement payload
the code now should setup and use the photoresistor and read it's value by the adc.
the returned value is 0 just as a place holder until the correct values are measured.