fix in doc_maker and ACI function in ECU menu
This commit is contained in:
parent
137de46ff1
commit
b38a668019
@ -51,10 +51,11 @@ def get_alternative_refs( platform ):
|
||||
else:
|
||||
print("ERROR in --ref option. ECU family not defined (" + aref + ")" )
|
||||
continue
|
||||
if len(ref1)==10:
|
||||
alt[aref] = {}
|
||||
else:
|
||||
print("ERROR. Wrong --ref option", aref )
|
||||
for r in ref1.split(','):
|
||||
if len(r)==10:
|
||||
alt[idf+':'+r] = {}
|
||||
else:
|
||||
print("ERROR. Wrong --ref option", aref )
|
||||
|
||||
#find in REF.DAT
|
||||
try:
|
||||
@ -78,11 +79,25 @@ def get_alternative_refs( platform ):
|
||||
except:
|
||||
print("\n\nREF.dat is absent!!!\n\n")
|
||||
|
||||
#now we have to remove emty records in alt
|
||||
for a in alt.copy().keys():
|
||||
if len( alt[a] ) == 0:
|
||||
del alt[a]
|
||||
|
||||
gmax = {}
|
||||
maxval = 0
|
||||
for a in alt.keys():
|
||||
max = list(alt[a].keys())[0]
|
||||
maxval = alt[a][max]
|
||||
for ak in alt[a].keys():
|
||||
if alt[a][ak]>alt[a][max]: max = ak
|
||||
if alt[a][ak]>alt[a][max]:
|
||||
max = ak
|
||||
maxval = alt[a][ak]
|
||||
idf,refPair = max.split(':')
|
||||
if idf in gmax.keys() and maxval < gmax[idf]:
|
||||
continue
|
||||
else:
|
||||
gmax[idf] = maxval
|
||||
res[idf] = refPair
|
||||
|
||||
end_time = time.time()
|
||||
|
2
pyren3/mod_dfg.py
Executable file → Normal file
2
pyren3/mod_dfg.py
Executable file → Normal file
@ -68,7 +68,7 @@ class class_dfg:
|
||||
if vehTypeCode.upper()==platform.upper():
|
||||
self.tcom = TCOM
|
||||
break
|
||||
self.dfgFile = 'Vehicles/DFG/DFG_'+self.tcom+'.xml'
|
||||
self.dfgFile = 'Vehicles/DFG/DFG_'+self.tcom+'.Xml'
|
||||
else:
|
||||
vhcls = []
|
||||
file_list = mod_db_manager.get_file_list_from_clip('Vehicles/DFG/DFG_*.[Xx]ml')
|
||||
|
@ -293,6 +293,26 @@ class ECU:
|
||||
r1, r2 = self.get_id( name )
|
||||
if r1!='none': return r1, r2
|
||||
return 'none','unknown name'
|
||||
|
||||
def acf_ready( self ):
|
||||
#check if scen_auto_config among commands and scenaium exists
|
||||
res = False
|
||||
c = ''
|
||||
for c in self.Commands.keys():
|
||||
if 'scen_auto_config' in self.Commands[c].scenario:
|
||||
res = True
|
||||
break
|
||||
if res:
|
||||
#check if scenario exists
|
||||
path = "EcuRenault/Scenarios/"
|
||||
scenarioName,scenarioData = self.Commands[c].scenario.split('#')
|
||||
scenarioData = scenarioData[:-4]+'.xml'
|
||||
if not mod_db_manager.file_in_clip(os.path.join(path,scenarioData)):
|
||||
return ''
|
||||
else:
|
||||
return c
|
||||
else:
|
||||
return ''
|
||||
|
||||
def run_cmd( self, name, param = '', partype = 'HEX' ):
|
||||
if name not in list(self.Commands.keys()):
|
||||
@ -981,6 +1001,7 @@ class ECU:
|
||||
if self.States : menu.append("ETA : States list")
|
||||
if self.Identifications : menu.append("IDA : Identifications list")
|
||||
if mod_globals.opt_ddt : menu.append("DDT : DDT screens")
|
||||
if self.acf_ready() != '': menu.append("ACI : Auto Config Info")
|
||||
menu.append("<Up>")
|
||||
choice = Choice(menu, "Choose :")
|
||||
if choice[0]=="<Up>":
|
||||
@ -1049,6 +1070,11 @@ class ECU:
|
||||
#gc.collect ()
|
||||
continue
|
||||
|
||||
if choice[0][:3]=="ACI":
|
||||
acf_cmd = self.acf_ready()
|
||||
executeCommand( self.Commands[acf_cmd], self, self.elm, header )
|
||||
continue
|
||||
|
||||
fav_sc = self.screens[int(choice[1]) - 1]
|
||||
if choice[0][:3] == "FAV":
|
||||
for sc in self.screens:
|
||||
|
94
pyren3/scen_auto_config.py
Normal file
94
pyren3/scen_auto_config.py
Normal file
@ -0,0 +1,94 @@
|
||||
#!/usr/bin/env python3
|
||||
'''
|
||||
Scenarium usage example
|
||||
|
||||
Name of this script should be exactly the same as in scenaruim URL but with '.py' extension
|
||||
|
||||
URL - scm:scen_ecri_codevin#scen_ecri_codevin_xxxxx.xml
|
||||
|
||||
'run' procedure will be executed by pyren script
|
||||
|
||||
'''
|
||||
|
||||
import os
|
||||
import sys
|
||||
import re
|
||||
import time
|
||||
|
||||
import mod_globals
|
||||
import mod_utils
|
||||
import mod_ecu
|
||||
import mod_db_manager
|
||||
from mod_utils import pyren_encode
|
||||
from mod_utils import clearScreen
|
||||
from mod_utils import hex_VIN_plus_CRC
|
||||
|
||||
import xml.dom.minidom
|
||||
|
||||
def run( elm, ecu, command, data ):
|
||||
'''
|
||||
MAIN function of scenarium
|
||||
|
||||
Parameters:
|
||||
elm - refernce to adapter class
|
||||
ecu - reference to ecu class
|
||||
command - refernce to the command this scenarium belongs to
|
||||
data - name of xml file with parameters from scenarium URL
|
||||
'''
|
||||
|
||||
clearScreen()
|
||||
header = '['+command.codeMR+'] '+command.label
|
||||
|
||||
ScmSet = {}
|
||||
ScmParam = {}
|
||||
|
||||
def get_message( msg ):
|
||||
if msg in list(ScmParam.keys()):
|
||||
value = ScmParam[msg]
|
||||
else:
|
||||
value = msg
|
||||
if value.isdigit() and value in list(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 list(mod_globals.language_dict.keys()):
|
||||
value = pyren_encode( mod_globals.language_dict[id] )
|
||||
return value
|
||||
|
||||
|
||||
#
|
||||
# Data file parsing
|
||||
#
|
||||
DOMTree = xml.dom.minidom.parse(mod_db_manager.get_file_from_clip(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
|
||||
|
||||
#
|
||||
# Get IDs
|
||||
#
|
||||
value1, datastr1 = ecu.get_id(ScmParam['ref_C_2180'])
|
||||
value2, datastr2 = ecu.get_id(ScmParam['ref_C_21FE'])
|
||||
value3, datastr3 = ecu.get_id(ScmParam['ref_C_22F187'])
|
||||
value4, datastr4 = ecu.get_id(ScmParam['ref_C_22F18E'])
|
||||
|
||||
res = ecu.ecudata['idf'] + ':'
|
||||
if len(value1)==10: res += ( value1 + ',' )
|
||||
if len(value2)==10: res += ( value2 + ',' )
|
||||
if len(value3)==10: res += ( value3 + ',' )
|
||||
if len(value4)==10: res += ( value4 + ',' )
|
||||
if res.endswith(','): res = res[:-1]
|
||||
|
||||
print('## This info intended to be used as a value of --ref parameter of acf.py ##')
|
||||
print()
|
||||
print( res )
|
||||
print()
|
||||
|
||||
ch = input('Press ENTER to continue')
|
||||
|
Loading…
x
Reference in New Issue
Block a user