Reset each injector data

This commit is contained in:
Marianpol 2020-02-08 17:03:30 +01:00
parent 6f84c940d5
commit 8d623a91ff
2 changed files with 13 additions and 115 deletions

View File

@ -257,7 +257,7 @@ def run( elm, ecu, command, data ):
if child.attrib["name"] == resetItem:
if len(child.keys()) == 1:
for param in child:
params[param.attrib["name"]] = param.attrib["value"]
params[param.attrib["name"].replace("D0", "D")] = param.attrib["value"]
return params
confirm = get_message_by_id('19800')
@ -266,7 +266,7 @@ def run( elm, ecu, command, data ):
mainText = get_message('Title')
inProgressMessage = get_message('CommandInProgressMessage')
def resetInjetorsData(button, commandsList):
def resetInjetorsData(button, injectorsList):
injectorsInfoMessage = get_message('Message21')
response = ""
clearScreen()
@ -279,17 +279,13 @@ def run( elm, ecu, command, data ):
print '*'*80
print
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
choice = Choice(injectorsList.keys(), "Choose :")
if choice[0]=='<exit>': return
clearScreen()
print
for command in commandsList:
response += ecu.run_cmd(command)
response = ecu.run_cmd(injectorsList[choice[0]])
print
if "NR" in response:
@ -352,8 +348,7 @@ def run( elm, ecu, command, data ):
if identsList["D" + str(idKey)].startswith("ID"):
identsList["D" + str(idKey)] = ecu.get_id(identsList["D" + str(idKey)], 1)
paramToSend += identsList["D" + str(idKey)]
# print str(idKey), identsList["D" + str(idKey)]
# raw_input()
# print str(idKey), identsList["D" + str(idKey)]
clearScreen()
print
@ -428,7 +423,13 @@ def run( elm, ecu, command, data ):
functions = OrderedDict()
for cmdKey in commands.keys():
if cmdKey == 'Cmd1':
functions[1] = [1, [commands['Cmd1'],commands['Cmd2'],commands['Cmd3'],commands['Cmd4']]]
injectorsDict = OrderedDict()
injectorsDict[get_message('Cylinder1')] = commands['Cmd1']
injectorsDict[get_message('Cylinder2')] = commands['Cmd2']
injectorsDict[get_message('Cylinder3')] = commands['Cmd3']
injectorsDict[get_message('Cylinder4')] = commands['Cmd4']
injectorsDict['<exit>'] = ""
functions[1] = [1, injectorsDict]
if cmdKey == 'Cmd5':
functions[2] = ["EGR_VALVE", 2, commands['Cmd5'], 0]
if cmdKey == 'Cmd6':

View File

@ -1,103 +0,0 @@
#!/usr/bin/env python
import os
import sys
import re
import time
import string
import mod_globals
import mod_utils
import mod_ecu
from mod_utils import clearScreen
from mod_utils import pyren_encode
from mod_utils import KBHit
import xml.dom.minidom
def run( elm, ecu, command, data ):
clearScreen()
header = '['+command.codeMR+'] '+command.label
ScmSet = {}
ScmParam = {}
def get_message( msg ):
if msg in ScmParam.keys():
value = ScmParam[msg]
else:
value = msg
if value.isdigit() and value in mod_globals.language_dict.keys():
value = pyren_encode( mod_globals.language_dict[value] )
return value
def get_message_by_id( id ):
if id.isdigit() and id in mod_globals.language_dict.keys():
value = pyren_encode( mod_globals.language_dict[id] )
return value
DOMTree = xml.dom.minidom.parse(data)
ScmRoom = DOMTree.documentElement
ScmParams = ScmRoom.getElementsByTagName("ScmParam")
for Param in ScmParams:
name = pyren_encode( Param.getAttribute("name") )
value = pyren_encode( Param.getAttribute("value") )
ScmParam[name] = value
ScmSets = ScmRoom.getElementsByTagName("ScmSet")
for Set in ScmSets:
setname = pyren_encode(Set.getAttribute("name"))
ScmParams = Set.getElementsByTagName("ScmParam")
for Param in ScmParams:
name = pyren_encode( Param.getAttribute("name") )
value = pyren_encode( Param.getAttribute("value") )
ScmSet[setname]= value
ScmParam[name] = value
# print setname, value
# print name
kb = KBHit()
# mainText = get_message('TexteTitre')
# important = get_message('TexteConsigne')
# tilt = get_message('TexteValeurInclinaison')
# degreeSymbol = get_message('TexteDegre')
# value2, datastr2 = ecu.get_pr(ScmParam['ParametreInclinaison'])
# clearScreen()
# print pyren_encode(header)
# print mainText
# print '*'*80
# print
# print important
# print
ch = raw_input('Do you want to continue? <yes/no> ')
while (ch.upper() != 'YES') and (ch.upper()!= 'NO'):
ch = raw_input('Do you want to continue? <yes/no> ')
if ch.upper() != 'YES':
return
# clearScreen()
# cmd = ecu.get_ref_cmd(get_message('Commande1'))
# resVal = ScmParam['ParametreCommande1']
# print '*'*80
# responce = ecu.run_cmd(ScmParam['Commande1'], resVal)
# print '*'*80
# if 'NR' in responce:
# print get_message('TexteProcedureInterompue')
# else:
# print get_message('TexteInitialisationEffectuee')
# print
# print tilt, pyren_encode(':'), value2, degreeSymbol
# print
# ch = raw_input('Press ENTER to exit')
# return