hacklab-in / webiopi

Automatically exported from code.google.com/p/webiopi
0 stars 1 forks source link

TSL2561 sensor lux value not changing #90

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
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)

Original issue reported on code.google.com by 100300...@ucaribe.edu.mx on 27 Mar 2014 at 6:45

GoogleCodeExporter commented 9 years ago
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

Original comment by andreas....@googlemail.com on 31 Mar 2014 at 12:11

GoogleCodeExporter commented 9 years ago
I have updated the tested driver now, the new version is attached. It can be 
updated in the trunk.

Andreas

Original comment by andreas....@googlemail.com on 3 Apr 2014 at 7:09

Attachments: