Check for positive response, check for littleendian

This commit is contained in:
Marianpol 2020-02-19 22:43:49 +01:00
parent 3138414533
commit 63af3e9909
2 changed files with 26 additions and 2 deletions

View File

@ -65,7 +65,10 @@ def get_mnemonic( m, se, elm, raw = 0 ):
hexval = hexval.replace(" ","")
if raw:
return hexval
if resp.startswith(m.positive):
return hexval
else:
return 'ERROR'
#shift and mask
val = (int(hexval,16)>>rshift)&(2**bits-1)

View File

@ -375,10 +375,23 @@ def run( elm, ecu, command, data ):
for paramkey in params.keys():
if params[paramkey] == "Mileage":
mnemonics = ecu.get_ref_id(identsList[paramkey]).mnemolist[0]
identValue = ecu.get_id(identsList[paramkey], 1)
params[paramkey] = "{0:0{1}X}".format(mileage,len(identValue))
hexval = "{0:0{1}X}".format(mileage,len(identValue))
if ecu.Mnemonics[mnemonics].littleEndian == '1':
a = hexval
b = ''
if not len(a) % 2:
for i in range(0,len(a),2):
b = a[i:i+2]+b
hexval = b
params[paramkey] = hexval
command, paramToSend = getValuesFromEcu(params)
if "ERROR" in paramToSend:
raw_input("Data downloading went wrong. Aborting.")
return
clearScreen()
@ -438,6 +451,10 @@ def run( elm, ecu, command, data ):
params.pop("IdentToBeDisplayed")
command, paramToSend = getValuesFromEcu(params)
if "ERROR" in paramToSend:
raw_input("Data downloading went wrong. Aborting.")
return
clearScreen()
@ -483,6 +500,10 @@ def run( elm, ecu, command, data ):
command, paramToSend = getValuesFromEcu(params)
if "ERROR" in paramToSend:
raw_input("Data downloading went wrong. Aborting.")
return
clearScreen()
print