From bc0d53527db4be52e0b0d777338e1a1ee5db3b7a Mon Sep 17 00:00:00 2001 From: Johann Neuhauser Date: Wed, 23 Dec 2020 12:59:23 +0100 Subject: [PATCH 1/2] Add proper gitignore --- .gitignore | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..67177193 --- /dev/null +++ b/.gitignore @@ -0,0 +1,13 @@ +### ddt4all specific +/ecu.zip +/ecus/ +/logs/ + +### Python generic ### +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +### IDE generic ### +/.vscode/ From e64c3bc04210a2e564c7d5aecf5b74f0bb67b7a6 Mon Sep 17 00:00:00 2001 From: Johann Neuhauser Date: Wed, 23 Dec 2020 14:54:57 +0100 Subject: [PATCH 2/2] Fix maxspeed parameter handling fixes: cc944b5: Possibility to choose baudrate At least if you choose bluetooth as connection type, `raise_port_speed` in `portChooser` gets unset instead of "No" or a valid baudrate and causes trouble in the init function of the `ELM` class. Fix this with a simple try except combo and adapt the following conditions on maxspeed. --- elm.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/elm.py b/elm.py index 993482a2..472e674e 100644 --- a/elm.py +++ b/elm.py @@ -568,10 +568,6 @@ def __init__(self, portName, rate, adapter_type="STD", maxspeed="No"): self.sim_mode = options.simulation_mode self.portName = portName self.adapter_type = adapter_type - if maxspeed == "No": - maxspeed = 0 - else: - maxspeed = int(maxspeed) if not options.simulation_mode: self.port = Port(portName, speed, self.portTimeout) @@ -603,7 +599,12 @@ def __init__(self, portName, rate, adapter_type="STD", maxspeed="No"): rate = speed break - if adapter_type == "OBDLINK" and maxspeed and not options.elm_failed and rate != 2000000: + try: + maxspeed = int(maxspeed) + except: + maxspeed = 0 + + if adapter_type == "OBDLINK" and maxspeed > 0 and not options.elm_failed and rate != 2000000: print("OBDLink Connection OK, attempting full speed UART switch") try: self.raise_odb_speed(maxspeed) @@ -611,7 +612,7 @@ def __init__(self, portName, rate, adapter_type="STD", maxspeed="No"): options.elm_failed = True self.connectionStatus = False print("Failed to switch to change OBDLink to " + str(maxspeed)) - elif adapter_type == "STD_USB" and rate != 115200 and maxspeed: + elif adapter_type == "STD_USB" and rate != 115200 and maxspeed > 0: print("ELM Connection OK, attempting high speed UART switch") try: self.raise_elm_speed(maxspeed)