From eec675cba085f82bcb67a50fa7f14ef5b1387abc Mon Sep 17 00:00:00 2001 From: ShrLnm Date: Fri, 29 Jul 2022 06:01:38 +0000 Subject: [PATCH 1/5] [mod_elm] fix soft boufrate --- pyren/mod_elm.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyren/mod_elm.py b/pyren/mod_elm.py index 8fcce3b..6622cf2 100644 --- a/pyren/mod_elm.py +++ b/pyren/mod_elm.py @@ -465,7 +465,7 @@ class Port: continue self.buff += byte tc = time.time () - if 'ELM' or 'STN' in self.buff: + if ('ELM' in self.buff) or ('STN' in self.buff): break if (tc - tb) > 1: print "ERROR - rate not supported. Let's go back." From 9cef8e8646246c41b4184934fb4c4312ea90cd30 Mon Sep 17 00:00:00 2001 From: ShrLnm Date: Sun, 7 Aug 2022 05:48:35 +0000 Subject: [PATCH 2/5] Add new file --- pyren/macro/init.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 pyren/macro/init.txt diff --git a/pyren/macro/init.txt b/pyren/macro/init.txt new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/pyren/macro/init.txt @@ -0,0 +1 @@ + From 6c91a2e392c1e5fb38f5811138f8ada2759a30f6 Mon Sep 17 00:00:00 2001 From: ShrLnm Date: Sun, 7 Aug 2022 05:51:31 +0000 Subject: [PATCH 3/5] Update pyren/macro/init.txt --- pyren/macro/init.txt | 85 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/pyren/macro/init.txt b/pyren/macro/init.txt index 8b13789..b47e970 100644 --- a/pyren/macro/init.txt +++ b/pyren/macro/init.txt @@ -1 +1,86 @@ +# +# +# Initialisation macros for mod_term +# +# + +$addr = 7A +$txa = 7E0 +$rxa = 7E8 + +# reset elm +reset_elm { + at ws + $prompt = ELM +} + +# general CAN init +init_can { + reset_elm #macro + at e1 + at s0 + at h0 + at l0 + at al + at caf0 + at cfc0 + at sh $txa + at cra $rxa + at fc sh $txa + at fc sd 30 00 00 + at fc sm 1 + $prompt = CAN +} + +# CAN 250 init +can250 { + init_can + at st ff + at at 0 + at sp 8 + at at 1 + $prompt = CAN250 +} + +# CAN 500 init +can500 { + init_can + at st ff + at at 0 + at sp 6 + at at 1 + $prompt = CAN500 +} + +# general ISO init +init_iso { + reset_elm #macro + at e1 + at l1 + at d1 + at sh 81 $addr f1 + at sw 96 + at wm 81 $addr f1 3E + #at wm 82 $addr f1 3E01 + at ib10 + at st ff + at at 0 + $prompt = KL +} + +# K-Line slow init +slow { + init_iso + at sp 4 + at at 1 + $prompt = SLOW +} + +# K-Line fast init +fast { + init_iso + at sp 5 + at at 1 + $prompt = FAST +} From 807782ef69b4df765fd2d8e6c10e08818d8f30b5 Mon Sep 17 00:00:00 2001 From: ShrLnm Date: Sun, 7 Aug 2022 06:10:28 +0000 Subject: [PATCH 4/5] Update pyren/mod_scan_ecus.py --- pyren/mod_scan_ecus.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/pyren/mod_scan_ecus.py b/pyren/mod_scan_ecus.py index 429932c..dd8bcb2 100644 --- a/pyren/mod_scan_ecus.py +++ b/pyren/mod_scan_ecus.py @@ -645,7 +645,7 @@ class ScanEcus: ttrrsp = rrsp.replace(' ','') if not all(c in string.hexdigits for c in ttrrsp): return False - while base+6<=len(row) and (int(row[base+3])*3+2)<=len(rrsp): + while base+6<=len(row): if row[base]!=req: req = row[base] rrsp = self.elm.cmd(req)[3:] @@ -654,7 +654,10 @@ class ScanEcus: if not all(c in string.hexdigits for c in ttrrsp): return False if len( req )/2==3: rrsp = rrsp[3:] - + + if int(row[base+3])*3+2<=len(rrsp): + return False + byte = int(rrsp[int(row[base+3])*3:int(row[base+3])*3+2],16) mask = int(row[base+4],16) val = int(row[base+5],16) @@ -691,8 +694,8 @@ class ScanEcus: if row['stdType']=='UDS': rerr = self.elm.cmd('1902AF') #get errors UDS - if len(row['stopDiagReq'])>0: - self.elm.cmd(row['stopDiagReq']) #close session + #if len(row['stopDiagReq'])>0: + # self.elm.cmd(row['stopDiagReq']) #close session self.elm.cmd("at at 1") #enable adaptive timing From 6bfaaf537613333334a035ab897b7df63242165e Mon Sep 17 00:00:00 2001 From: ShrLnm Date: Sun, 7 Aug 2022 06:40:05 +0000 Subject: [PATCH 5/5] Fix for scan with multiple ids --- pyren/mod_scan_ecus.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyren/mod_scan_ecus.py b/pyren/mod_scan_ecus.py index dd8bcb2..91b43ec 100644 --- a/pyren/mod_scan_ecus.py +++ b/pyren/mod_scan_ecus.py @@ -655,7 +655,7 @@ class ScanEcus: if len( req )/2==3: rrsp = rrsp[3:] - if int(row[base+3])*3+2<=len(rrsp): + if int(row[base+3])*3+2 > len(rrsp): return False byte = int(rrsp[int(row[base+3])*3:int(row[base+3])*3+2],16)