You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In calibration_offset, I constantly got this error:
File "/home/pi/py3env/lib/python3.7/site-packages/qwiic_vl53l1x.py", line 1564, in __i2cWrite
buffer.append( (data >> 8) & 0xFF )
I changed the source code in this part of the calibration_offset function:
AverageDistance = AverageDistance / 50
and added // instead of / and it seems like it solved the problem. Is this a bug or there is a mistake in my process?
The text was updated successfully, but these errors were encountered:
It sounds like there is a mismatch in the number of bytes. Your fix using floor division to input an integer is probably the correct solution. I'd have to review the API manual for this sensor to double check.
Hi, I had the same issue with both the crosstalk and offset calibration functions. The full tracebacks from running the code are here:
Traceback (most recent call last):
File "chemical_tank.py", line 50, in
if(frickinlaser.calibrate_offset(TargetDistance) == None):
File "/usr/local/lib/python3.7/dist-packages/qwiic_vl53l1x.py", line 1409, in calibrate_offset
self.status = self.__i2cWrite(self.address, ALGO__PART_TO_PART_RANGE_OFFSET_MM, offset*4, 2)
File "/usr/local/lib/python3.7/dist-packages/qwiic_vl53l1x.py", line 1564, in __i2cWrite
buffer.append( (data >> 8) & 0xFF )
TypeError: unsupported operand type(s) for >>: 'float' and 'int'
Traceback (most recent call last):
File "chemical_tank.py", line 43, in
if(frickinlaser.calibrate_xtalk(TargetDistance) == None):
File "/usr/local/lib/python3.7/dist-packages/qwiic_vl53l1x.py", line 1455, in calibrate_xtalk
self.status = self.__i2cWrite(self.address, 0x0016, xtalk, 2)
File "/usr/local/lib/python3.7/dist-packages/qwiic_vl53l1x.py", line 1564, in __i2cWrite
buffer.append( (data >> 8) & 0xFF )
TypeError: unsupported operand type(s) for >>: 'float' and 'int'
In my case I simply edited the inputs to the i2c function by casting them to int, as in int(xtalk) and int(offset*4). Probably not the correct way to do it given possible rounding errors but it was a quick hack to confirm that it was a float/int issue.
In calibration_offset, I constantly got this error:
File "/home/pi/py3env/lib/python3.7/site-packages/qwiic_vl53l1x.py", line 1564, in __i2cWrite
buffer.append( (data >> 8) & 0xFF )
I changed the source code in this part of the calibration_offset function:
AverageDistance = AverageDistance / 50
and added // instead of / and it seems like it solved the problem. Is this a bug or there is a mistake in my process?
The text was updated successfully, but these errors were encountered: