fix setting reconnect attempts
authormilaq <micha.laqua@gmail.com>
Mon, 26 May 2014 00:41:47 +0000 (02:41 +0200)
committerTamber Penketh <tamber@furryhelix.co.uk>
Wed, 6 Jun 2018 23:03:33 +0000 (00:03 +0100)
obd_io.py

index c9f6b33..55a7a43 100644 (file)
--- a/obd_io.py
+++ b/obd_io.py
@@ -83,6 +83,7 @@ class OBDPort:
         par = serial.PARITY_NONE  # parity
         sb = 1                   # stop bits
         to = SERTIMEOUT
+        self.retrymax = RECONNATTEMPTS
         self.ELMver = "Unknown"
         # state SERIAL is 1 connected, 0 disconnected (connection failed)
         self.State = 1
@@ -191,9 +192,9 @@ class OBDPort:
             while 1:
                 c = self.port.read(1)
                 if len(c) == 0:
-                    if(repeat_count == 5):
+                    if(repeat_count == self.retrymax):
                         break
-                    print "Got nothing\n"
+                    print "Retrying...\n"
                     repeat_count = repeat_count + 1
                     continue