Re: [PATCH] iio: humidity: hdc3020: fix hysteresis representation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 23/05/2024 16:28, Dimitri Fedrau wrote:
> Am Thu, May 23, 2024 at 04:12:37PM +0200 schrieb Javier Carrasco:
>> Hi Dimitri, a few comments inline.
>>
>> On 23/05/2024 13:43, Dimitri Fedrau wrote:
>>> According to the ABI docs hysteresis values are represented as offsets to
>>> threshold values. Current implementation represents hysteresis values as
>>> absolute values which is wrong. Nevertheless the device stores them as
>>> absolute values and the datasheet refers to them as clear thresholds. Fix
>>> the reading and writing of hysteresis values by including thresholds into
>>> calculations.
>>>
>>> Fixes: 3ad0e7e5f0cb ("iio: humidity: hdc3020: add threshold events support")
>>> Signed-off-by: Dimitri Fedrau <dima.fedrau@xxxxxxxxx>
>>> ---
>>>
>>> Since absolute values are used on the device, the hysteresis values are
>>> influenced by setting thresholds. Is this behavior in line with the ABI docs ?
>>> It can be fixed by readjusting the threshold clear value whenever setting
>>> thresholds to have the same hysteresis value as before. See some example below:
>>>
>>> # echo 25 > /sys/bus/iio/devices/iio\:device0/events/in_temp_thresh_rising_value
>>> # cat /sys/bus/iio/devices/iio\:device0/events/in_temp_thresh_rising_value
>>> 24.727626459
>>> # echo 5 > /sys/bus/iio/devices/iio\:device0/events/in_temp_thresh_rising_hysteresis
>>> # cat /sys/bus/iio/devices/iio\:device0/events/in_temp_thresh_rising_hysteresis
>>> 5.127031357
>>> # echo 35 > /sys/bus/iio/devices/iio\:device0/events/in_temp_thresh_rising_value
>>> # cat /sys/bus/iio/devices/iio\:device0/events/in_temp_thresh_rising_hysteresis
>>> 15.381094071
>>>

> Hi Javier,
> 
> thanks for reviewing so quickly. Do you think I should correct the clear
> threshold values once I changed the threshold. I have an example
> provided where I set the threshold and hysteresis. After setting the
> threshold again the hysteresis value also changes.
> 
> Dimitri

I am not sure if I got that right. Did the rising hysteresis change its
value automatically from ~5 to ~15 by just adding 10 to the threshold?
If we are treating the hysteresis as an offset, then it should not
change its value i.e. it should keep the configured value.

Best regards,
Javier Carrasco




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux