From 8d623a91ff3c29cdd896c86f51910ada7bbd5694 Mon Sep 17 00:00:00 2001 From: Marianpol Date: Sat, 8 Feb 2020 17:03:30 +0100 Subject: [PATCH] Reset each injector data --- pyren/scen_ecri_paraminj1.py | 25 +++++---- pyren/scen_ecri_paraminj2.py | 103 ----------------------------------- 2 files changed, 13 insertions(+), 115 deletions(-) delete mode 100644 pyren/scen_ecri_paraminj2.py diff --git a/pyren/scen_ecri_paraminj1.py b/pyren/scen_ecri_paraminj1.py index 66d5dd0..e1d6d0d 100644 --- a/pyren/scen_ecri_paraminj1.py +++ b/pyren/scen_ecri_paraminj1.py @@ -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 + ' : ') - while (ch.upper()!='YES') and (ch.upper()!='NO'): - ch = raw_input(confirm + ' : ') - if ch.upper()!='YES': - return + choice = Choice(injectorsList.keys(), "Choose :") + if choice[0]=='': 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[''] = "" + functions[1] = [1, injectorsDict] if cmdKey == 'Cmd5': functions[2] = ["EGR_VALVE", 2, commands['Cmd5'], 0] if cmdKey == 'Cmd6': diff --git a/pyren/scen_ecri_paraminj2.py b/pyren/scen_ecri_paraminj2.py deleted file mode 100644 index 1caeae3..0000000 --- a/pyren/scen_ecri_paraminj2.py +++ /dev/null @@ -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? ') - while (ch.upper() != 'YES') and (ch.upper()!= 'NO'): - ch = raw_input('Do you want to continue? ') - 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