paraminj2 update and other fixes
This commit is contained in:
parent
dbe039ec34
commit
a91dc2de24
@ -189,7 +189,7 @@ class ECU:
|
|||||||
flist = []
|
flist = []
|
||||||
for root, dirs, files in os.walk("./dumps"):
|
for root, dirs, files in os.walk("./dumps"):
|
||||||
for f in files:
|
for f in files:
|
||||||
if (self.ecudata['ecuname']+'.') in f:
|
if (self.ecudata['ecuname']+'.txt') in f:
|
||||||
flist.append(f)
|
flist.append(f)
|
||||||
|
|
||||||
if len(flist)==0: return
|
if len(flist)==0: return
|
||||||
@ -720,9 +720,13 @@ class ECU:
|
|||||||
|
|
||||||
path = path+' -> '+defstr[dtchex]+'\n\n'+hlpstr[dtchex]+'\n'
|
path = path+' -> '+defstr[dtchex]+'\n\n'+hlpstr[dtchex]+'\n'
|
||||||
|
|
||||||
mem_dtrf_txt = mod_globals.language_dict['299'] + " DTC" + mod_globals.ext_cur_DTC + "\n"
|
cur_dtrf = []
|
||||||
|
mem_dtrf = []
|
||||||
|
|
||||||
|
if self.Defaults[dtchex[:4]].datarefs:
|
||||||
cur_dtrf = [ecu_screen_dataref(0, "\n" + mod_globals.language_dict['300'] + "\n", 'Text')] + self.Defaults[dtchex[:4]].datarefs
|
cur_dtrf = [ecu_screen_dataref(0, "\n" + mod_globals.language_dict['300'] + "\n", 'Text')] + self.Defaults[dtchex[:4]].datarefs
|
||||||
|
if self.Defaults[dtchex[:4]].memDatarefs:
|
||||||
|
mem_dtrf_txt = mod_globals.language_dict['299'] + " DTC" + mod_globals.ext_cur_DTC + "\n"
|
||||||
mem_dtrf = [ecu_screen_dataref(0, mem_dtrf_txt, 'Text')] + self.Defaults[dtchex[:4]].memDatarefs
|
mem_dtrf = [ecu_screen_dataref(0, mem_dtrf_txt, 'Text')] + self.Defaults[dtchex[:4]].memDatarefs
|
||||||
|
|
||||||
tmp_dtrf = mem_dtrf + cur_dtrf
|
tmp_dtrf = mem_dtrf + cur_dtrf
|
||||||
@ -766,10 +770,16 @@ class ECU:
|
|||||||
|
|
||||||
path = path+' -> '+defstr[dtchex]+'\n\n'+hlpstr[dtchex]+'\n'
|
path = path+' -> '+defstr[dtchex]+'\n\n'+hlpstr[dtchex]+'\n'
|
||||||
|
|
||||||
mem_dtrf_txt = mod_globals.language_dict['299'] + " DTC" + mod_globals.ext_cur_DTC + "\n"
|
cur_dtrf = []
|
||||||
|
mem_dtrf = []
|
||||||
|
ext_info_dtrf = []
|
||||||
|
|
||||||
|
if self.Defaults[dtchex[:4]].datarefs:
|
||||||
cur_dtrf = [ecu_screen_dataref(0, "\n" + mod_globals.language_dict['300'] + "\n", 'Text')] + self.Defaults[dtchex[:4]].datarefs
|
cur_dtrf = [ecu_screen_dataref(0, "\n" + mod_globals.language_dict['300'] + "\n", 'Text')] + self.Defaults[dtchex[:4]].datarefs
|
||||||
|
if self.Defaults[dtchex[:4]].memDatarefs:
|
||||||
|
mem_dtrf_txt = mod_globals.language_dict['299'] + " DTC" + mod_globals.ext_cur_DTC + "\n"
|
||||||
mem_dtrf = [ecu_screen_dataref(0, mem_dtrf_txt, 'Text')] + self.Defaults[dtchex[:4]].memDatarefs
|
mem_dtrf = [ecu_screen_dataref(0, mem_dtrf_txt, 'Text')] + self.Defaults[dtchex[:4]].memDatarefs
|
||||||
|
if self.ext_de:
|
||||||
ext_info_dtrf = [ecu_screen_dataref(0, "\n" + mod_globals.language_dict['1691'] + "\n", 'Text')] + self.ext_de
|
ext_info_dtrf = [ecu_screen_dataref(0, "\n" + mod_globals.language_dict['1691'] + "\n", 'Text')] + self.ext_de
|
||||||
|
|
||||||
tmp_dtrf = mem_dtrf + cur_dtrf + ext_info_dtrf
|
tmp_dtrf = mem_dtrf + cur_dtrf + ext_info_dtrf
|
||||||
|
@ -358,7 +358,7 @@ def loadDumpToELM( ecuname, elm ):
|
|||||||
flist = []
|
flist = []
|
||||||
for root, dirs, files in os.walk("./dumps"):
|
for root, dirs, files in os.walk("./dumps"):
|
||||||
for f in files:
|
for f in files:
|
||||||
if (ecuname+'.') in f:
|
if (ecuname+'.txt') in f:
|
||||||
flist.append(f)
|
flist.append(f)
|
||||||
|
|
||||||
if len(flist)==0: return
|
if len(flist)==0: return
|
||||||
|
@ -89,7 +89,6 @@ def run( elm, ecu, command, data ):
|
|||||||
|
|
||||||
paramsToSend = mnemo1Data + resetBytes + mnemo2Data
|
paramsToSend = mnemo1Data + resetBytes + mnemo2Data
|
||||||
|
|
||||||
print mod_ecu_mnemonic.get_mnemonicDTC(ecu.Mnemonics["_CSF_UPSTREAM_TEMPERATURE"], "62 24 42 0F 44 00 00")
|
|
||||||
print title
|
print title
|
||||||
print '*'*80
|
print '*'*80
|
||||||
print messageInfo
|
print messageInfo
|
||||||
|
@ -220,7 +220,7 @@ def run( elm, ecu, command, data ):
|
|||||||
buttons["exit"] = '<exit>'
|
buttons["exit"] = '<exit>'
|
||||||
|
|
||||||
#Get commands
|
#Get commands
|
||||||
commands = OrderedDict()
|
commands = {}
|
||||||
|
|
||||||
for child in root:
|
for child in root:
|
||||||
if child.attrib["name"] == "Commands":
|
if child.attrib["name"] == "Commands":
|
||||||
|
@ -59,17 +59,23 @@ def run( elm, ecu, command, data ):
|
|||||||
correctEcu = ''
|
correctEcu = ''
|
||||||
vdiagExists = False
|
vdiagExists = False
|
||||||
|
|
||||||
def get_message( msg ):
|
def get_message( msg, encode = 1 ):
|
||||||
if msg in ScmParam.keys():
|
if msg in ScmParam.keys():
|
||||||
value = ScmParam[msg]
|
value = ScmParam[msg]
|
||||||
else:
|
else:
|
||||||
value = msg
|
value = msg
|
||||||
if value.isdigit() and value in mod_globals.language_dict.keys():
|
if value.isdigit() and value in mod_globals.language_dict.keys():
|
||||||
|
if encode:
|
||||||
|
value = pyren_encode(mod_globals.language_dict[value])
|
||||||
|
else:
|
||||||
value = mod_globals.language_dict[value]
|
value = mod_globals.language_dict[value]
|
||||||
return value
|
return value
|
||||||
|
|
||||||
def get_message_by_id( id ):
|
def get_message_by_id( id, encode = 1 ):
|
||||||
if id.isdigit() and id in mod_globals.language_dict.keys():
|
if id.isdigit() and id in mod_globals.language_dict.keys():
|
||||||
|
if encode:
|
||||||
|
value = pyren_encode(mod_globals.language_dict[id])
|
||||||
|
else:
|
||||||
value = mod_globals.language_dict[id]
|
value = mod_globals.language_dict[id]
|
||||||
return value
|
return value
|
||||||
|
|
||||||
@ -142,19 +148,20 @@ def run( elm, ecu, command, data ):
|
|||||||
for bt in correctEcu.buttons.keys():
|
for bt in correctEcu.buttons.keys():
|
||||||
if bt == 'InjectorsButton':
|
if bt == 'InjectorsButton':
|
||||||
if str(correctEcu.buttons[bt]) == 'true':
|
if str(correctEcu.buttons[bt]) == 'true':
|
||||||
buttons[1] = get_message("Injectors")
|
buttons[1] = get_message("Injectors",0)
|
||||||
if bt == 'EGRValveButton':
|
if bt == 'EGRValveButton':
|
||||||
if str(correctEcu.buttons[bt]) == 'true':
|
if str(correctEcu.buttons[bt]) == 'true':
|
||||||
buttons[2] = get_message("EGR_VALVE")
|
buttons[2] = get_message("EGR_VALVE",0)
|
||||||
if bt == 'InletFlapButton':
|
if bt == 'InletFlapButton':
|
||||||
if str(correctEcu.buttons[bt]) == 'true':
|
if str(correctEcu.buttons[bt]) == 'true':
|
||||||
buttons[3] = get_message("INLET_FLAP")
|
buttons[3] = get_message("INLET_FLAP",0)
|
||||||
if bt == 'ParticleFilterButton':
|
if bt == 'ParticleFilterButton':
|
||||||
if str(correctEcu.buttons[bt]) == 'true':
|
if str(correctEcu.buttons[bt]) == 'true':
|
||||||
buttons[4] = get_message("PARTICLES_FILTER")
|
buttons[4] = get_message("PARTICLES_FILTER",0)
|
||||||
if bt.startswith("Button"):
|
if bt.startswith("Button"):
|
||||||
if str(correctEcu.buttons[bt]) == 'true':
|
if str(correctEcu.buttons[bt]) == 'true':
|
||||||
buttons[int(bt.strip('Button'))] = get_message(bt[:-6] + "Text")
|
buttons[int(bt.strip('Button'))] = get_message(bt[:-6] + "Text", 0)
|
||||||
|
buttons["loadDump"] = get_message_by_id('19802', 0)
|
||||||
buttons["exit"] = '<exit>'
|
buttons["exit"] = '<exit>'
|
||||||
|
|
||||||
#Get commands
|
#Get commands
|
||||||
@ -164,7 +171,13 @@ def run( elm, ecu, command, data ):
|
|||||||
if child.attrib["name"] == "Commands":
|
if child.attrib["name"] == "Commands":
|
||||||
if len(child.keys()) == 1:
|
if len(child.keys()) == 1:
|
||||||
for param in child:
|
for param in child:
|
||||||
commands[param.attrib["name"]] = param.attrib["value"]
|
serviceIDs = ecu.get_ref_cmd(param.attrib["value"]).serviceID
|
||||||
|
startReq = ""
|
||||||
|
for sid in serviceIDs:
|
||||||
|
if ecu.Services[sid].params:
|
||||||
|
startReq = ecu.Services[sid].startReq
|
||||||
|
break
|
||||||
|
commands[param.attrib["name"]] = {"command": param.attrib["value"], "startReq": startReq}
|
||||||
|
|
||||||
#Get identifications
|
#Get identifications
|
||||||
identsList = OrderedDict()
|
identsList = OrderedDict()
|
||||||
@ -175,14 +188,15 @@ def run( elm, ecu, command, data ):
|
|||||||
key = param[6:-5]
|
key = param[6:-5]
|
||||||
begin = int(ScmParam['Idents'+key+'Begin'])
|
begin = int(ScmParam['Idents'+key+'Begin'])
|
||||||
end = int(ScmParam['Idents'+key+'End'])
|
end = int(ScmParam['Idents'+key+'End'])
|
||||||
identsRangeKeys[key] = {"begin": begin, "end": end}
|
|
||||||
try: #10099 trap
|
try: #10099 trap
|
||||||
identsList['D'+str(begin)] = ScmParam['Ident'+str(begin)]
|
ecu.get_ref_id(ScmParam['Ident' + str(begin)]).mnemolist[0]
|
||||||
except:
|
except:
|
||||||
break
|
continue
|
||||||
else:
|
else:
|
||||||
for idnum in range(begin ,end + 1):
|
for idnum in range(begin ,end + 1):
|
||||||
identsList['D'+str(idnum)] = ScmParam['Ident'+str(idnum)]
|
identsList['D'+str(idnum)] = ScmParam['Ident'+str(idnum)]
|
||||||
|
frame = ecu.Mnemonics[ecu.get_ref_id(identsList['D'+str(begin)]).mnemolist[0]].request
|
||||||
|
identsRangeKeys[key] = {"begin": begin, "end": end, "frame": frame}
|
||||||
|
|
||||||
def getValuesToChange(resetItem):
|
def getValuesToChange(resetItem):
|
||||||
params = {}
|
params = {}
|
||||||
@ -193,15 +207,44 @@ def run( elm, ecu, command, data ):
|
|||||||
params[param.attrib["name"].replace("D0", "D")] = param.attrib["value"]
|
params[param.attrib["name"].replace("D0", "D")] = param.attrib["value"]
|
||||||
return params
|
return params
|
||||||
|
|
||||||
def getValuesFromEcu(rangeKey):
|
def takesParams(request):
|
||||||
paramToSend = ""
|
for cmd in commands.values():
|
||||||
idRangeKey = identsRangeKeys[identsRangeKeys.keys()[rangeKey]]
|
if cmd['startReq'] == request:
|
||||||
|
commandToRun = cmd['command']
|
||||||
|
return commandToRun
|
||||||
|
|
||||||
for idKey in range(idRangeKey['begin'], idRangeKey['end'] + 1):
|
def getValuesFromEcu(params):
|
||||||
|
paramToSend = ""
|
||||||
|
commandToRun = ""
|
||||||
|
requestToFindInCommandsRequests = ""
|
||||||
|
backupDict = {}
|
||||||
|
|
||||||
|
try:
|
||||||
|
idKeyToFindInRange = int((params.keys()[0]).replace("D",""))
|
||||||
|
except:
|
||||||
|
return commandToRun, paramToSend
|
||||||
|
else:
|
||||||
|
for rangeK in identsRangeKeys.keys():
|
||||||
|
if identsRangeKeys[rangeK]['begin'] <= idKeyToFindInRange <= identsRangeKeys[rangeK]['end']:
|
||||||
|
requestToFindInCommandsRequests = "3B" + identsRangeKeys[rangeK]['frame'][-2:]
|
||||||
|
isTakingParams = takesParams(requestToFindInCommandsRequests)
|
||||||
|
if isTakingParams:
|
||||||
|
for k,v in params.iteritems():
|
||||||
|
backupDict[k] = ecu.get_id(identsList[k], 1)
|
||||||
|
if v in identsList.keys():
|
||||||
|
identsList[k] = ecu.get_id(identsList[v], 1)
|
||||||
|
else:
|
||||||
|
identsList[k] = v
|
||||||
|
for idKey in range(identsRangeKeys[rangeK]['begin'], identsRangeKeys[rangeK]['end'] + 1):
|
||||||
if identsList["D" + str(idKey)].startswith("ID"):
|
if identsList["D" + str(idKey)].startswith("ID"):
|
||||||
identsList["D" + str(idKey)] = ecu.get_id(identsList["D" + str(idKey)], 1)
|
identsList["D" + str(idKey)] = ecu.get_id(identsList["D" + str(idKey)], 1)
|
||||||
|
backupDict["D" + str(idKey)] = identsList["D" + str(idKey)]
|
||||||
paramToSend += identsList["D" + str(idKey)]
|
paramToSend += identsList["D" + str(idKey)]
|
||||||
return paramToSend
|
commandToRun = isTakingParams
|
||||||
|
break
|
||||||
|
|
||||||
|
makeDump(commandToRun, backupDict)
|
||||||
|
return commandToRun, paramToSend
|
||||||
|
|
||||||
confirm = get_message_by_id('19800')
|
confirm = get_message_by_id('19800')
|
||||||
successMessage = get_message('Message32')
|
successMessage = get_message('Message32')
|
||||||
@ -239,7 +282,7 @@ def run( elm, ecu, command, data ):
|
|||||||
print
|
print
|
||||||
ch = raw_input('Press ENTER to exit')
|
ch = raw_input('Press ENTER to exit')
|
||||||
|
|
||||||
def afterEcuChange(title, button, command, rangeKey):
|
def afterEcuChange(title, button):
|
||||||
params = getValuesToChange(title)
|
params = getValuesToChange(title)
|
||||||
infoMessage = get_message("Message262")
|
infoMessage = get_message("Message262")
|
||||||
mileageText = get_message_by_id('2110')
|
mileageText = get_message_by_id('2110')
|
||||||
@ -254,20 +297,20 @@ def run( elm, ecu, command, data ):
|
|||||||
print '*'*80
|
print '*'*80
|
||||||
print get_message("MessageBox2")
|
print get_message("MessageBox2")
|
||||||
print
|
print
|
||||||
ch = raw_input(pyren_encode(confirm + ' <YES/NO>: '))
|
ch = raw_input(confirm + ' <YES/NO>: ')
|
||||||
if ch.upper()!='YES':
|
if ch.upper()!='YES':
|
||||||
return
|
return
|
||||||
mileage = raw_input(pyren_encode(mileageText + ' (' + mileageUnit + ')' + ': '))
|
mileage = raw_input(mileageText + ' (' + mileageUnit + ')' + ': ')
|
||||||
while not (mileage.isdigit() and 2 <= len(mileage) <= 6 and int(mileage) >= 10):
|
while not (mileage.isdigit() and 2 <= len(mileage) <= 6 and int(mileage) >= 10):
|
||||||
print get_message("MessageBox1")
|
print get_message("MessageBox1")
|
||||||
print
|
print
|
||||||
mileage = raw_input(pyren_encode(mileageText + ' (' + mileageUnit + ')' + ': '))
|
mileage = raw_input(mileageText + ' (' + mileageUnit + ')' + ': ')
|
||||||
|
|
||||||
clearScreen()
|
clearScreen()
|
||||||
|
|
||||||
print mileageText + ': ' + mileage + ' ' + mileageUnit
|
print mileageText + ': ' + mileage + ' ' + mileageUnit
|
||||||
print
|
print
|
||||||
ch = raw_input(pyren_encode(confirm + ' <YES/NO>: '))
|
ch = raw_input(confirm + ' <YES/NO>: ')
|
||||||
while (ch.upper()!='YES') and (ch.upper()!='NO'):
|
while (ch.upper()!='YES') and (ch.upper()!='NO'):
|
||||||
ch = raw_input(confirm + ' <YES/NO>: ')
|
ch = raw_input(confirm + ' <YES/NO>: ')
|
||||||
if ch.upper()!='YES':
|
if ch.upper()!='YES':
|
||||||
@ -280,16 +323,27 @@ def run( elm, ecu, command, data ):
|
|||||||
|
|
||||||
mileage = int(mileage)
|
mileage = int(mileage)
|
||||||
|
|
||||||
for k,v in params.iteritems():
|
for paramkey in params.keys():
|
||||||
if v in identsList.keys():
|
if params[paramkey] == "Mileage":
|
||||||
identsList[k] = ecu.get_id(identsList[v], 1)
|
mnemonics = ecu.get_ref_id(identsList[paramkey]).mnemolist[0]
|
||||||
elif v == "Mileage":
|
identValue = ecu.get_id(identsList[paramkey], 1)
|
||||||
identValue = ecu.get_id(identsList[k], 1)
|
if identValue == 'ERROR':
|
||||||
identsList[k] = "{0:0{1}X}".format(mileage,len(identValue))
|
identValue = '00000000'
|
||||||
else:
|
hexval = "{0:0{1}X}".format(mileage,len(identValue))
|
||||||
identsList[k] = v
|
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
|
||||||
|
|
||||||
paramToSend = getValuesFromEcu(rangeKey)
|
command, paramToSend = getValuesFromEcu(params)
|
||||||
|
|
||||||
|
if "ERROR" in paramToSend:
|
||||||
|
raw_input("Data downloading went wrong. Aborting.")
|
||||||
|
return
|
||||||
|
|
||||||
clearScreen()
|
clearScreen()
|
||||||
|
|
||||||
@ -305,7 +359,7 @@ def run( elm, ecu, command, data ):
|
|||||||
print
|
print
|
||||||
ch = raw_input('Press ENTER to exit')
|
ch = raw_input('Press ENTER to exit')
|
||||||
|
|
||||||
def setGlowPlugsType(title, button, command, rangeKey):
|
def setGlowPlugsType(title, button):
|
||||||
params = getValuesToChange(title)
|
params = getValuesToChange(title)
|
||||||
value, datastr = ecu.get_st(ScmParam['State1'])
|
value, datastr = ecu.get_st(ScmParam['State1'])
|
||||||
|
|
||||||
@ -314,9 +368,9 @@ def run( elm, ecu, command, data ):
|
|||||||
|
|
||||||
typesButtons = OrderedDict()
|
typesButtons = OrderedDict()
|
||||||
|
|
||||||
typesButtons[get_message_by_id('54031')] = ScmParam['54031']
|
typesButtons[get_message_by_id('54031',0)] = ScmParam['54031']
|
||||||
typesButtons[get_message_by_id('54030')] = ScmParam['54030']
|
typesButtons[get_message_by_id('54030',0)] = ScmParam['54030']
|
||||||
typesButtons[get_message_by_id('54032')] = ScmParam['54032']
|
typesButtons[get_message_by_id('54032',0)] = ScmParam['54032']
|
||||||
typesButtons['<exit>'] = ""
|
typesButtons['<exit>'] = ""
|
||||||
|
|
||||||
clearScreen()
|
clearScreen()
|
||||||
@ -341,9 +395,13 @@ def run( elm, ecu, command, data ):
|
|||||||
|
|
||||||
glowPlugType = "{0:0{1}X}".format((int(ScmParam['Mask1']) + int(typesButtons[choice[0]])),2)
|
glowPlugType = "{0:0{1}X}".format((int(ScmParam['Mask1']) + int(typesButtons[choice[0]])),2)
|
||||||
|
|
||||||
identsList[params.keys()[0]] = glowPlugType
|
params[params.keys()[0]] = glowPlugType
|
||||||
|
|
||||||
paramToSend = getValuesFromEcu(rangeKey)
|
command, paramToSend = getValuesFromEcu(params)
|
||||||
|
|
||||||
|
if "ERROR" in paramToSend:
|
||||||
|
raw_input("Data downloading went wrong. Aborting.")
|
||||||
|
return
|
||||||
|
|
||||||
clearScreen()
|
clearScreen()
|
||||||
|
|
||||||
@ -359,28 +417,11 @@ def run( elm, ecu, command, data ):
|
|||||||
print
|
print
|
||||||
ch = raw_input('Press ENTER to exit')
|
ch = raw_input('Press ENTER to exit')
|
||||||
|
|
||||||
def resetValues(title, button, command, rangeKey):
|
def resetValues(title, button, defaultCommand):
|
||||||
paramToSend = ""
|
paramToSend = ""
|
||||||
commandTakesParams = True
|
commandTakesParams = True
|
||||||
params = getValuesToChange(title)
|
params = getValuesToChange(title)
|
||||||
|
|
||||||
commandServices = ecu.Commands[command.replace("VP", "V")].serviceID
|
|
||||||
for sid in commandServices:
|
|
||||||
if not ecu.Services[sid].params: #For INLET_FLAP VP042 in 10959 or VP018 EGR_VALVE in 10527
|
|
||||||
commandTakesParams = False
|
|
||||||
else:
|
|
||||||
commandTakesParams = True
|
|
||||||
break
|
|
||||||
|
|
||||||
if commandTakesParams:
|
|
||||||
for k,v in params.iteritems():
|
|
||||||
if v in identsList.keys():
|
|
||||||
identsList[k] = ecu.get_id(identsList[v], 1)
|
|
||||||
else:
|
|
||||||
identsList[k] = v
|
|
||||||
|
|
||||||
paramToSend = getValuesFromEcu(rangeKey)
|
|
||||||
|
|
||||||
clearScreen()
|
clearScreen()
|
||||||
|
|
||||||
print mainText
|
print mainText
|
||||||
@ -394,7 +435,91 @@ def run( elm, ecu, command, data ):
|
|||||||
print get_message_by_id('55663')
|
print get_message_by_id('55663')
|
||||||
print '*'*80
|
print '*'*80
|
||||||
print
|
print
|
||||||
ch = raw_input(pyren_encode(confirm + ' <YES/NO>: '))
|
ch = raw_input(confirm + ' <YES/NO>: ')
|
||||||
|
while (ch.upper()!='YES') and (ch.upper()!='NO'):
|
||||||
|
ch = raw_input(confirm + ' <YES/NO>: ')
|
||||||
|
if ch.upper()!='YES':
|
||||||
|
return
|
||||||
|
|
||||||
|
clearScreen()
|
||||||
|
print
|
||||||
|
print inProgressMessage
|
||||||
|
|
||||||
|
command, paramToSend = getValuesFromEcu(params)
|
||||||
|
|
||||||
|
if "ERROR" in paramToSend:
|
||||||
|
raw_input("Data downloading went wrong. Aborting.")
|
||||||
|
return
|
||||||
|
|
||||||
|
clearScreen()
|
||||||
|
|
||||||
|
print
|
||||||
|
if command:
|
||||||
|
response = ecu.run_cmd(command,paramToSend)
|
||||||
|
else:
|
||||||
|
response = ecu.run_cmd(defaultCommand)
|
||||||
|
print
|
||||||
|
|
||||||
|
if "NR" in response:
|
||||||
|
print failMessage
|
||||||
|
else:
|
||||||
|
print successMessage
|
||||||
|
|
||||||
|
print
|
||||||
|
ch = raw_input('Press ENTER to exit')
|
||||||
|
|
||||||
|
def makeDump(cmd, idents):
|
||||||
|
fileRoot = et.Element("ScmRoot")
|
||||||
|
fileRoot.text = "\n "
|
||||||
|
|
||||||
|
cmdElement = et.Element("ScmParam", name="Command", value=cmd)
|
||||||
|
cmdElement.tail = "\n "
|
||||||
|
fileRoot.insert(1,cmdElement)
|
||||||
|
|
||||||
|
for k in idents:
|
||||||
|
el = et.Element("ScmParam", name='D'+ '{:0>2}'.format(k[1:]), value=idents[k])
|
||||||
|
el.tail = "\n "
|
||||||
|
fileRoot.insert(1,el)
|
||||||
|
|
||||||
|
tree = et.ElementTree(fileRoot)
|
||||||
|
tree.write(mod_globals.dumps_dir + ScmParam['FileName'])
|
||||||
|
|
||||||
|
def loadDump():
|
||||||
|
clearScreen()
|
||||||
|
|
||||||
|
paramToSend = ""
|
||||||
|
dumpScmParam = {}
|
||||||
|
try:
|
||||||
|
dumpData = open(mod_globals.dumps_dir + ScmParam['FileName'], 'r')
|
||||||
|
except:
|
||||||
|
print get_message_by_id('2194')
|
||||||
|
raw_input()
|
||||||
|
return
|
||||||
|
|
||||||
|
dumpDOMTree = xml.dom.minidom.parse(dumpData)
|
||||||
|
dumpScmRoot = dumpDOMTree.documentElement
|
||||||
|
dumpScmParams = dumpScmRoot.getElementsByTagName("ScmParam")
|
||||||
|
|
||||||
|
for Param in dumpScmParams:
|
||||||
|
name = pyren_encode( Param.getAttribute("name") )
|
||||||
|
value = pyren_encode( Param.getAttribute("value") )
|
||||||
|
|
||||||
|
dumpScmParam[name] = value
|
||||||
|
|
||||||
|
for k in sorted(dumpScmParam):
|
||||||
|
if k != "Command":
|
||||||
|
paramToSend += dumpScmParam[k]
|
||||||
|
|
||||||
|
if "ERROR" in paramToSend:
|
||||||
|
raw_input("Data downloading went wrong. Aborting.")
|
||||||
|
return
|
||||||
|
|
||||||
|
print '*'*80
|
||||||
|
print get_message_by_id('19802')
|
||||||
|
print '*'*80
|
||||||
|
print
|
||||||
|
|
||||||
|
ch = raw_input(confirm + ' <YES/NO>: ')
|
||||||
while (ch.upper()!='YES') and (ch.upper()!='NO'):
|
while (ch.upper()!='YES') and (ch.upper()!='NO'):
|
||||||
ch = raw_input(confirm + ' <YES/NO>: ')
|
ch = raw_input(confirm + ' <YES/NO>: ')
|
||||||
if ch.upper()!='YES':
|
if ch.upper()!='YES':
|
||||||
@ -403,10 +528,7 @@ def run( elm, ecu, command, data ):
|
|||||||
clearScreen()
|
clearScreen()
|
||||||
|
|
||||||
print
|
print
|
||||||
if commandTakesParams:
|
response = ecu.run_cmd(dumpScmParam['Command'],paramToSend)
|
||||||
response = ecu.run_cmd(command,paramToSend)
|
|
||||||
else:
|
|
||||||
response = ecu.run_cmd(command)
|
|
||||||
print
|
print
|
||||||
|
|
||||||
if "NR" in response:
|
if "NR" in response:
|
||||||
@ -422,22 +544,22 @@ def run( elm, ecu, command, data ):
|
|||||||
for cmdKey in commands.keys():
|
for cmdKey in commands.keys():
|
||||||
if cmdKey == 'Cmd1' and "Cmd5" in commands.keys():
|
if cmdKey == 'Cmd1' and "Cmd5" in commands.keys():
|
||||||
injectorsDict = OrderedDict()
|
injectorsDict = OrderedDict()
|
||||||
injectorsDict[get_message('Cylinder1')] = commands['Cmd1']
|
injectorsDict[get_message('Cylinder1', 0)] = commands['Cmd1']['command']
|
||||||
injectorsDict[get_message('Cylinder2')] = commands['Cmd2']
|
injectorsDict[get_message('Cylinder2', 0)] = commands['Cmd2']['command']
|
||||||
injectorsDict[get_message('Cylinder3')] = commands['Cmd3']
|
injectorsDict[get_message('Cylinder3', 0)] = commands['Cmd3']['command']
|
||||||
injectorsDict[get_message('Cylinder4')] = commands['Cmd4']
|
injectorsDict[get_message('Cylinder4', 0)] = commands['Cmd4']['command']
|
||||||
injectorsDict['<exit>'] = ""
|
injectorsDict['<exit>'] = ""
|
||||||
functions[1] = [1, injectorsDict]
|
functions[1] = [1, injectorsDict]
|
||||||
if cmdKey == 'Cmd5':
|
if cmdKey == 'Cmd5':
|
||||||
functions[2] = ["EGR_VALVE", 2, commands['Cmd5'], 0]
|
functions[2] = ["EGR_VALVE", 2, commands['Cmd5']['command']]
|
||||||
if cmdKey == 'Cmd6':
|
if cmdKey == 'Cmd6':
|
||||||
functions[3] = ["INLET_FLAP", 3, commands['Cmd6'], 1]
|
functions[3] = ["INLET_FLAP", 3, commands['Cmd6']['command']]
|
||||||
if cmdKey == 'Cmd7':
|
if cmdKey == 'Cmd7':
|
||||||
functions[4] = ["PARTICLE_FILTER", 4, commands['Cmd7'], 2]
|
functions[4] = ["PARTICLE_FILTER", 4, commands['Cmd7']['command']]
|
||||||
functions[5] = ["Button5ChangeData", 5, commands['Cmd7'], 2]
|
functions[5] = ["Button5ChangeData", 5, commands['Cmd7']['command']]
|
||||||
functions[6] = ["Button6ChangeData", 6, commands['Cmd7'], 2]
|
functions[6] = ["Button6ChangeData", 6, commands['Cmd7']['command']]
|
||||||
if len(commands) == 1 and cmdKey == 'Cmd1':
|
if len(commands) == 1 and cmdKey == 'Cmd1':
|
||||||
functions[7] = ["Button7ChangeData", 7, commands["Cmd1"], len(identsRangeKeys) - 1]
|
functions[7] = ["Button7ChangeData", 7]
|
||||||
|
|
||||||
infoMessage = get_message('Message1')
|
infoMessage = get_message('Message1')
|
||||||
|
|
||||||
@ -451,12 +573,14 @@ def run( elm, ecu, command, data ):
|
|||||||
for key, value in buttons.iteritems():
|
for key, value in buttons.iteritems():
|
||||||
if choice[0]=='<exit>': return
|
if choice[0]=='<exit>': return
|
||||||
if value == choice[0]:
|
if value == choice[0]:
|
||||||
if key == 1:
|
if key == 'loadDump':
|
||||||
|
loadDump()
|
||||||
|
elif key == 1:
|
||||||
resetInjetorsData(functions[key][0],functions[key][1])
|
resetInjetorsData(functions[key][0],functions[key][1])
|
||||||
elif key == 6:
|
elif key == 6:
|
||||||
afterEcuChange(functions[key][0],functions[key][1],functions[key][2],functions[key][3])
|
afterEcuChange(functions[key][0],functions[key][1])
|
||||||
elif key == 7:
|
elif key == 7:
|
||||||
setGlowPlugsType(functions[key][0],functions[key][1],functions[key][2],functions[key][3])
|
setGlowPlugsType(functions[key][0],functions[key][1])
|
||||||
else:
|
else:
|
||||||
resetValues(functions[key][0],functions[key][1],functions[key][2],functions[key][3])
|
resetValues(functions[key][0],functions[key][1],functions[key][2])
|
||||||
return
|
return
|
Loading…
x
Reference in New Issue
Block a user