nodesign / weio

weio
http://we-io.net
128 stars 35 forks source link

examples using I2C bus error #145

Closed manuio closed 9 years ago

manuio commented 9 years ago

Examples using I2C bus doesn't work and return this error:

weioRunner.py: UPER API: I2C bus not connected.
Exception in thread Thread-4:
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 810, in __bootstrap_inner
self.run()
File "/usr/lib/python2.7/threading.py", line 763, in run
self.__target(*self.__args, **self.__kwargs)
File "/weio/www/examples/i2c/lm75sensor_PY/main.py", line 18, in myProcess
print i2c.scan()
File "/weio/IoTPy/pyuper/i2c.py", line 42, in scan
raise IoTPy_IOError("I2C bus not connected.")
IoTPy_IOError: I2C bus not connected.

I've also noticed that after error message, when you run other examples, all seems good but nothing happens (no print on IDE console and no HW events). WeIO needs to be restarted otherwise this behavior is still there.

All examples returns this error except lm75sensorSMBus_PY, however all examples have the same strange behavior...

manuio commented 9 years ago

I've tested this examples without I2C HW, I suppose that the error is normal but not the strange behavior.

ks156 commented 9 years ago

Without hardware, all of this is normal. i2c = initI2C() display the following error : weioRunner.py: UPER API: I2C bus not connected. and i2c.scan() raise the exception.

Normally, if initI2C fails, i2c.scan shouldn't be called. So all of that is normal.

_lm75senslrSMBusPY opens the I2CBus via SMBus, while all other examples open the I2C bus via the api function initI2C(). That's why the behavior is different.

manuio commented 9 years ago

Ok for the error, I assumed that is normal but try to run one of this examples without HW (It can happen if you are "exploring" examples) and then try to run other examples). For me the result is that nothing happens but no new error messages appears.

ks156 commented 9 years ago

You mean that the other examples are not working anymore ? You need to soft reset the board, right ?

manuio commented 9 years ago

Yes right!

ks156 commented 9 years ago

It will be fixed soon with this commit : https://github.com/ks156/weio/commit/464d66b07b7e6b322078a763903b7f7ad2cb2b6c

I still need to test it before submitting a pull request.

manuio commented 9 years ago

:+1:

ks156 commented 9 years ago

Fixed ? Can be closed ?

ukicar commented 9 years ago

yes :)