Issue #090 [New/open] - TSL2561 sensor lux value not changing

Posted by 100300335@ucaribe.edu.mx

TSL2561 was configured on the default config file /etc/webiopi/config as a device. Using default app for devices monitor noticed that lux value was always zero.

WebIOPi version => 0.7.0

Python version => 2.7.3

Distro => Raspbian Wheezy

Raspberry Pi board revision => 2

There's an error in the file tslXXX.py when calculating the channel ratio in calculateLux method.

channelRatio = channel1value / channel0_value

Both, channel1value and channel0_value, are integers and result is always zero. Solved changing to:

channelRatio = channel1value / float(channel0_value)


Comment 1

Posted by andreas.riegg

You are right but the result is not always zero because when channel1value > channel0_value then the result will be 1 and the branch 0.80 < channel_ratio <= 1.30: will be used. Thats the reason why the code passed my tests, I had no Luxmeter to check the measured values. I will change it so that the other branches get also used, give me some days as I want also to test the code before giving the update to Eric. Your solution alsready works for now.

There is also a small typo inconsistence in the code I saw, channel1value should be named channel1_value to be perfect :-).

Thanks.

Andreas


Comment 2

Posted by andreas.riegg

I have updated the tested driver now, the new version is attached. It can be updated in the trunk.

Andreas

Files attached