M5Unit-LIGHT 0.1.0 git rev:1ddbe92
Loading...
Searching...
No Matches
m5::unit::light::Data Struct Reference

Measurement data group. More...

#include <unit_Light_data.hpp>

Public Member Functions

float normalized () const
 Normalized brightness in 0..100 (%), where 0% = dark reference and 100% = bright reference.
 

Public Attributes

uint16_t analog_raw {}
 Raw ADC value from the photoresistor path.
 
bool digital {}
 Comparator threshold output (active level is board-specific; check it on the board)
 
uint16_t dark {DEFAULT_DARK}
 ADC reading captured when the sensor was covered (dark reference)
 
uint16_t bright {DEFAULT_BRIGHT}
 ADC reading captured when the sensor was lit (bright reference)
 

Detailed Description

Measurement data group.

Member Function Documentation

◆ normalized()

float m5::unit::light::Data::normalized ( ) const
inline

Normalized brightness in 0..100 (%), where 0% = dark reference and 100% = bright reference.

Returns
Normalized brightness 0..100 (%), clamped; NaN when dark == bright
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%.