From: suchinton2001 Date: Mon, 4 Dec 2023 14:03:48 +0000 (+0530) Subject: Fix demo mode crash due to demo mode toggle X-Git-Tag: 17.90.0~1 X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=commitdiff_plain;h=545256365dc0603658ad5e17bfa1fa00ba829d7e;p=src%2Fagl-demo-control-panel.git Fix demo mode crash due to demo mode toggle - Avoid starting the same thread twice when running demo-mode - Add red highlight to toggle button when unchecked - Log errors when running running steering signals in CAN mode Bug-AGL: SPEC-5005 Change-Id: I73e163c87149e7d8eee53a7ab953339a7b94e1af Signed-off-by: suchinton2001 --- diff --git a/Widgets/ICPage.py b/Widgets/ICPage.py index 8681d61..859f3e7 100644 --- a/Widgets/ICPage.py +++ b/Widgets/ICPage.py @@ -384,7 +384,8 @@ class VehicleSimulator(QObject): if not self.running: self.reset() self.running = True - self.thread.start() + if not self.thread.is_alive(): + self.thread.start() def stop(self): self.running = False diff --git a/Widgets/settings.py b/Widgets/settings.py index 72b1bea..b0512cc 100644 --- a/Widgets/settings.py +++ b/Widgets/settings.py @@ -47,6 +47,7 @@ def create_animated_toggle(): return AnimatedToggle( checked_color="#4BD7D6", pulse_checked_color="#00ffff", + pulse_unchecked_color= "#4BD7D6", ) @@ -153,12 +154,12 @@ class settings(Base, Form): # check if can0 is available try: can_bus = can.interface.Bus( - channel='can0', bustype='socketcan_native') + channel='can0', bustype='socketcan') can_bus.shutdown() Steering_Signal_Type = "CAN" - except: + except OSError as e: self.CAN_Kuksa_toggle.setChecked(False) - logging.error("CAN Bus not available") + logging.error(f"CAN0 is not available{e}") else: Steering_Signal_Type = "Kuksa"