Commit 6ed3a883 authored by Theodor-Adrian Stana's avatar Theodor-Adrian Stana

sw: Fixed bug in therm.py and added support for old gw versions

parent aa15ee48
...@@ -225,8 +225,8 @@ if __name__ == "__main__": ...@@ -225,8 +225,8 @@ if __name__ == "__main__":
ip = ei2cdefine.HNAME ip = ei2cdefine.HNAME
user = ei2cdefine.USER user = ei2cdefine.USER
pwd = ei2cdefine.PWD pwd = ei2cdefine.PWD
testelma = EI2C(ip, user, pwd) elma = EI2C(ip, user, pwd)
testelma.open() elma.open()
# Ask for slot number # Ask for slot number
while 1: while 1:
...@@ -243,8 +243,16 @@ if __name__ == "__main__": ...@@ -243,8 +243,16 @@ if __name__ == "__main__":
except: except:
print("Unexpected error: ", sys.exc_info()[0]) print("Unexpected error: ", sys.exc_info()[0])
# CONV-TTL-BLO gateware changed memory map in v3.0 and golden v0.2
boardid = elma.read(slot,0x00)
gwvers = elma.read(slot, 0x04) & 0xff
baseaddr = 0x200
if (boardid == 0x54424c4f):
if ((gwvers > 0x10) and (gwvers < 0x30)):
baseaddr = 0x080
# Create onewire and thermometer objects # Create onewire and thermometer objects
onewire = COpenCoresOneWire(testelma, 1, 0x200, 99, 19) onewire = COpenCoresOneWire(elma, slot, baseaddr, 99, 19)
ds18b20 = CDS18B20(onewire, 0) ds18b20 = CDS18B20(onewire, 0)
# Reading of unique ID # Reading of unique ID
...@@ -269,5 +277,5 @@ if __name__ == "__main__": ...@@ -269,5 +277,5 @@ if __name__ == "__main__":
msg = "ERROR: TempID IC20: Invalid family code: 0x%.8X" % (family_code) msg = "ERROR: TempID IC20: Invalid family code: 0x%.8X" % (family_code)
print(msg) print(msg)
testelma.close() elma.close()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment