Measurement data group.
More...
#include <unit_Light_data.hpp>
|
| float | normalized () const |
| | Normalized brightness in 0..100 (%), where 0% = dark reference and 100% = bright reference.
|
| |
|
|
uint16_t | analog_raw {} |
| | Raw ADC value from the photoresistor path.
|
| |
|
bool | digital {} |
| | Comparator threshold output (active level is board-specific; verify with calibration)
|
| |
|
uint16_t | dark {0} |
| | ADC reading captured when the sensor was covered (dark reference)
|
| |
|
uint16_t | bright {4095} |
| | ADC reading captured when the sensor was lit (bright reference)
|
| |
◆ normalized()
| float m5::unit::light::Data::normalized |
( |
| ) |
const |
|
inline |
Normalized brightness in 0..100 (%), where 0% = dark reference and 100% = bright reference.
- Returns
- NaN only when dark == bright (cannot form a range)
- Note
- dark and bright are stored as the raw ADC values captured during calibration; their magnitudes do not imply polarity. On U021 the photoresistor circuit polarity is board-specific (some revisions yield higher ADC in the dark, others in the light) — normalized() handles either polarity and always maps dark to 0% and bright to 100%.