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.
I initially tried calling prst_pwm_init() in main(), and just using start/stop in
the callback, but that led to a weird behavior in the PWM output. It was set to
high after the end of the callback.
Callnig uninit/re-calling init() inside the RTC callback fixed, but more investigation
is required.