From 7166faf04b1ab6c6df601e5ad04db766bc526902 Mon Sep 17 00:00:00 2001 From: Marianpol Date: Mon, 23 Aug 2021 23:19:16 +0200 Subject: [PATCH] Use STI to recognize OBDLink OBDLink needs to support STPX command --- pyren/mod_elm.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pyren/mod_elm.py b/pyren/mod_elm.py index 4bbc1f9..e7fc0ee 100644 --- a/pyren/mod_elm.py +++ b/pyren/mod_elm.py @@ -604,9 +604,14 @@ class ELM: self.lf.flush() # check OBDLink - elm_rsp = self.cmd("STPR") + elm_rsp = self.cmd("STI") if elm_rsp and '?' not in elm_rsp: - mod_globals.opt_obdlink = True + firmware_version = elm_rsp.split(" ")[-1] + firmware_version = firmware_version.split(".") + version_number = int(''.join([re.sub('\D', '', version) for version in firmware_version])) + stpx_introduced_in_version_number = 420 #STN1110 got STPX last in version v4.2.0 + if version_number >= stpx_introduced_in_version_number: + mod_globals.opt_obdlink = True # check STN elm_rsp = self.cmd("STP 53")