Automatic protocol handshake
authorTamber Penketh <tamber@furryhelix.co.uk>
Wed, 6 Jun 2018 16:34:29 +0000 (17:34 +0100)
committerTamber Penketh <tamber@furryhelix.co.uk>
Wed, 6 Jun 2018 16:34:29 +0000 (17:34 +0100)
1  2 
obd_io.py

diff --cc obd_io.py
+++ b/obd_io.py
@@@ -106,21 -104,14 +106,24 @@@ class OBDPort
              return None
              
           self.ELMver = self.get_result()
 -         wx.PostEvent(self._notify_window, DebugEvent([2,"atz response:" + self.ELMver]))
 +         if(self.ELMver is None):
 +            self.State = 0
 +            return None
 +         
 +         debug_display(self._notify_window, 2, "atz response:" + self.ELMver)
           self.send_command("ate0")  # echo off
 -         wx.PostEvent(self._notify_window, DebugEvent([2,"ate0 response:" + self.get_result()]))
 +         debug_display(self._notify_window, 2, "ate0 response:" + self.get_result())
+          self.send_command("ATSP0")  # select protocol automatically
 -         wx.PostEvent(self._notify_window, DebugEvent([2,"ATSP0 response:" + self.get_result()]))
++         debug_display(self._notify_window, 2, "ATSP0 response:" + self.get_result())
++
           self.send_command("0100")
           ready = self.get_result()
 -         wx.PostEvent(self._notify_window, DebugEvent([2,"0100 response:" + ready]))
 +         
 +         if(ready is None):
 +            self.State = 0
 +            return None
 +            
 +         debug_display(self._notify_window, 2, "0100 response:" + ready)
           return None
                
       def close(self):