From 65220fbf6a3215b1e93ac2d479953d7ce0724aa5 Mon Sep 17 00:00:00 2001 From: Marianpol Date: Wed, 21 Apr 2021 21:32:21 +0200 Subject: [PATCH] Search for negative response in single frame fix --- pyren/mod_elm.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/pyren/mod_elm.py b/pyren/mod_elm.py index 57497db..14a33dd 100644 --- a/pyren/mod_elm.py +++ b/pyren/mod_elm.py @@ -2064,6 +2064,9 @@ class ELM: paramToSend += dataids.keys()[lvl] cmd = frameLength + '22' + paramToSend + '1' resp = self.send_raw(cmd) + for s in resp.split('\n'): + if s.strip().startswith('037F'): + return False else: # send multiframe command for more than 3 dataids # Some modules can return NO DATA if multi frame command is sent after some no activity time # Sending anything before main command usually helps that command to be accepted @@ -2076,11 +2079,11 @@ class ELM: paramToSend += dataids.keys()[lvl] cmd = '22' + paramToSend resp = self.send_cmd(cmd) - if not any(s in resp for s in ['?', 'NR']): - self.performanceModeLevel = level - return True - - return False + if any(s in resp for s in ['?', 'NR']): + return False + + self.performanceModeLevel = level + return True def getRefreshRate(self): refreshRate = 0