fix acf in connected mode

This commit is contained in:
shrlnm 2023-03-28 00:12:20 +03:00
parent 4a983a6771
commit 137de46ff1
3 changed files with 21 additions and 5 deletions

View File

@ -272,6 +272,9 @@ def main():
ent['vehTypeCode'] = platform ent['vehTypeCode'] = platform
ent['startDiagReq'] = '' ent['startDiagReq'] = ''
for a in pl_id[platform][bus_brp][idf]: for a in pl_id[platform][bus_brp][idf]:
if ent['pin'] == 'iso':
ent['dst'] = a.split('#')[0]
else:
ent['dst'],ent['idRx'],ent['idTx'],starts = a.split('#') ent['dst'],ent['idRx'],ent['idTx'],starts = a.split('#')
if ent['startDiagReq'] == '': if ent['startDiagReq'] == '':
ent['startDiagReq'] = starts ent['startDiagReq'] = starts

View File

@ -46,9 +46,15 @@ def get_alternative_refs( platform ):
idf,refPair = aref.split(':') idf,refPair = aref.split(':')
res[idf] = refPair res[idf] = refPair
continue continue
if ':' in aref:
idf,ref1 = aref.split(':') idf,ref1 = aref.split(':')
else:
print("ERROR in --ref option. ECU family not defined (" + aref + ")" )
continue
if len(ref1)==10: if len(ref1)==10:
alt[aref] = {} alt[aref] = {}
else:
print("ERROR. Wrong --ref option", aref )
#find in REF.DAT #find in REF.DAT
try: try:
@ -154,6 +160,9 @@ def acf_loadModules( de, refdata, platform ):
m['sref'] = ref2 m['sref'] = ref2
m['mo']='' m['mo']=''
m['dst'] = '' m['dst'] = ''
m['pin'] = 'undef'
m['idRx'] = ''
m['idTx'] = ''
m['ecuname'] = '' m['ecuname'] = ''
m['startDiagReq'] = '10C0' m['startDiagReq'] = '10C0'
if ref2 + '.dat' in zipflist: if ref2 + '.dat' in zipflist:

8
pyren3/mod_ecu_scenario.py Executable file → Normal file
View File

@ -17,7 +17,7 @@ def playScenario(command, ecu, elm):
path = "EcuRenault/Scenarios/" path = "EcuRenault/Scenarios/"
scenarioName,scenarioData = command.scenario.split('#') scenarioName,scenarioData = command.scenario.split('#')
scenarioData = scenarioData.upper()[:-4]+'.xml' scenarioData = scenarioData[:-4]+'.xml'
showable = False showable = False
if scenarioName.lower().startswith('scm'): if scenarioName.lower().startswith('scm'):
@ -49,9 +49,13 @@ def playScenario(command, ecu, elm):
if not mod_db_manager.file_in_clip(os.path.join(path,scenarioData)): if not mod_db_manager.file_in_clip(os.path.join(path,scenarioData)):
return return
lines = [line.rstrip('\n') for line in mod_db_manager.get_file_from_clip(os.path.join(path,scenarioData))] scenFile = mod_db_manager.get_file_from_clip(os.path.join(path,scenarioData)).read()
if isinstance(scenFile, (bytes, bytearray)):
scenFile = scenFile.decode("utf-8", errors='ignore')
lines = scenFile.split('\n')
for l in lines: for l in lines:
l = l.rstrip('\r')
pa = re.compile(r'name=\"(\w+)\"\s+value=\"(\w+)\"') pa = re.compile(r'name=\"(\w+)\"\s+value=\"(\w+)\"')
ma = pa.search( l ) ma = pa.search( l )
if ma: if ma: