Ticket #81 (assigned bug report)
Check COM_ReadI2C with USB for correct return values
|Reported by:||atorf||Owned by:||staas|
|Component:||Demos / Applications||Keywords:|
Description (last modified by atorf) (diff)
With toolbox version ~ 2.0 (r307) I introduced a function COM_ReadI2C for fast and easy I²C access to digital sensors. This function uses an optimization I discovered which can speed up retrieving sensor values via Bluetooth about 30 to 50%. The method is documented inside trunk/mfiles/COM_ReadI2C.m. Obviously this seemed to work all the time, but when I suggested this method to .net and Python developers, they discovered possible problems with USB connections. For full details, see https://code.google.com/p/nxt-python/issues/detail?id=11 and https://sourceforge.net/apps/phpbb/mindboards/viewtopic.php?f=3&t=1014 . We need to verify if this bug applies to us as well.
Problem: COM_ReadI2C might return just the "2nd to last" retrieved value, not the last one (i.e. the most current one we want) when being used with USB connections. This could've been caused by the Fantom driver, but no idea.
Testing is necessary to verify:
- Use USB connection
- Manually retrieve US values (e.g. on the command window) using GetUltrasonic
- Point the US sensor to a close distance, check value
- Point to a far distance, check value again
- Repeat and check if returned values match the distances
- If possible, repeat test with another digital sensor to confirm
If the test reveals whe too have this problem, then the optimization (COM_ReadI2C doesn't check LSGetStatus) has to be deactivated for USB connections. For Bluetooth it seems to work, but a cross-check wouldn't hurt…