From c2f9fcb0c404f287a9c72a86af46d01b924de6f4 Mon Sep 17 00:00:00 2001 From: Furtif Date: Sun, 15 Dec 2024 08:51:09 +0100 Subject: [PATCH] Small fix conditional simulation mode --- ecu.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/ecu.py b/ecu.py index ae5fdb1..469837a 100644 --- a/ecu.py +++ b/ecu.py @@ -1005,13 +1005,14 @@ def connect_to_hardware(self, canline=0): # Can ecuname = self.ecuname.encode('ascii', errors='ignore') if self.ecu_protocol == 'CAN': - if len(self.ecu_send_id) == 8: - short_addr = elm.get_can_addr_ext(self.ecu_send_id) - else: - short_addr = elm.get_can_addr(self.ecu_send_id) - if short_addr is None: - print(_("Cannot retrieve functionnal address of ECU") + " %s @ %s" % (self.ecuname, self.ecu_send_id)) - return False + if not options.simulation_mode: + if len(self.ecu_send_id) == 8: + short_addr = elm.get_can_addr_ext(self.ecu_send_id) + else: + short_addr = elm.get_can_addr(self.ecu_send_id) + if short_addr is None: + print(_("Cannot retrieve functionnal address of ECU") + " %s @ %s" % (self.ecuname, self.ecu_send_id)) + return False ecu_conf = {'idTx': self.ecu_send_id, 'idRx': self.ecu_recv_id, 'ecuname': str(ecuname)} if not options.simulation_mode: