Closed Footleg closed 3 years ago
Thanks Footleg. I fixed that in my forked version. Still not great at doing PRs on githb but as the change is trivial I'm sure 4tronics can replicate that.
All files updated to provide both Python2 and Python3 compatibility. Integer divisions used as appropriate. Thanks guys, Gareth
I found a minor bug from the code being ported to python3 in the getRevision function.
Get Version and Revision info
def getRevision(): for i in range(RETRIES): try: rval = bus.read_word_data (pzaddr, 0) return [rval/256, rval%256] except: if (DEBUG): print("Error in getRevision(), retrying")
Under python2, the / operator did integer division. But under python3 it returns a float, so you get the board revision byte/256 included in the firmware version returned. Under python3 you need to use the integer divide // operator. So just change the return line to: return [rval//256, rval%256]