On 14.02.24 09:53, Dimitri Fedrau wrote: > Add threshold events support for temperature and relative humidity. To > enable them the higher and lower threshold registers must be programmed > and the higher threshold must be greater then or equal to the lower > threshold. Otherwise the event is disabled. Invalid hysteresis values > are ignored by the device. There is no further configuration possible. > > Tested by setting thresholds/hysteresis and turning the heater on/off. > Used iio_event_monitor in tools/iio to catch events while constantly > displaying temperature and humidity values. > > Signed-off-by: Dimitri Fedrau <dima.fedrau@xxxxxxxxx> > --- Hi Dimitri, now that the decimal part is used, the resolution loss is within the ranges mentioned in the datasheet. For the records: the truncated values lead to alerts slightly lower than the target alerts. Therefore, measured values below the "comfort zone" defined by the user (but close to the low alert) will not trigger events. The other way around is "more secure" because the target comfort zone is guaranteed: -------- High val -> event (as expected) ******** Target High Alert -------- Meas -> **event** (still in target comfort zone) ######## Truncated High Alert ... ******** Target Low Alert -------- Meas -> **no event** (out of target comfort zone) ######## Truncated Low Alert -------- Meas -> event (as expected) But as I said, the resolution loss is in the valid range anyway: Tested-by: Javier Carrasco <javier.carrasco.cruz@xxxxxxxxx> Thank you for adding this feature. Best regards, Javier Carrasco