From 137de46ff1b27a898e29e0717010130a7ee36a5e Mon Sep 17 00:00:00 2001 From: shrlnm Date: Tue, 28 Mar 2023 00:12:20 +0300 Subject: [PATCH] fix acf in connected mode --- pyren3/acf.py | 5 ++++- pyren3/mod_acf_func.py | 11 ++++++++++- pyren3/mod_ecu_scenario.py | 10 +++++++--- 3 files changed, 21 insertions(+), 5 deletions(-) mode change 100755 => 100644 pyren3/mod_ecu_scenario.py diff --git a/pyren3/acf.py b/pyren3/acf.py index fd830f0..1093d7b 100755 --- a/pyren3/acf.py +++ b/pyren3/acf.py @@ -272,7 +272,10 @@ def main(): ent['vehTypeCode'] = platform ent['startDiagReq'] = '' for a in pl_id[platform][bus_brp][idf]: - ent['dst'],ent['idRx'],ent['idTx'],starts = a.split('#') + if ent['pin'] == 'iso': + ent['dst'] = a.split('#')[0] + else: + ent['dst'],ent['idRx'],ent['idTx'],starts = a.split('#') if ent['startDiagReq'] == '': ent['startDiagReq'] = starts else: diff --git a/pyren3/mod_acf_func.py b/pyren3/mod_acf_func.py index 806357b..4424881 100644 --- a/pyren3/mod_acf_func.py +++ b/pyren3/mod_acf_func.py @@ -46,9 +46,15 @@ def get_alternative_refs( platform ): idf,refPair = aref.split(':') res[idf] = refPair continue - idf,ref1 = aref.split(':') + if ':' in aref: + idf,ref1 = aref.split(':') + 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 ) #find in REF.DAT try: @@ -154,6 +160,9 @@ def acf_loadModules( de, refdata, platform ): m['sref'] = ref2 m['mo']='' m['dst'] = '' + m['pin'] = 'undef' + m['idRx'] = '' + m['idTx'] = '' m['ecuname'] = '' m['startDiagReq'] = '10C0' if ref2 + '.dat' in zipflist: diff --git a/pyren3/mod_ecu_scenario.py b/pyren3/mod_ecu_scenario.py old mode 100755 new mode 100644 index e97c192..14de294 --- a/pyren3/mod_ecu_scenario.py +++ b/pyren3/mod_ecu_scenario.py @@ -17,7 +17,7 @@ def playScenario(command, ecu, elm): path = "EcuRenault/Scenarios/" scenarioName,scenarioData = command.scenario.split('#') - scenarioData = scenarioData.upper()[:-4]+'.xml' + scenarioData = scenarioData[:-4]+'.xml' showable = False if scenarioName.lower().startswith('scm'): @@ -48,10 +48,14 @@ def playScenario(command, ecu, elm): if not mod_db_manager.file_in_clip(os.path.join(path,scenarioData)): 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: + l = l.rstrip('\r') pa = re.compile(r'name=\"(\w+)\"\s+value=\"(\w+)\"') ma = pa.search( l ) if ma: