diff options
author | suchinton2001 <suchinton.2001@gmail.com> | 2023-12-04 19:33:48 +0530 |
---|---|---|
committer | suchinton2001 <suchinton.2001@gmail.com> | 2023-12-04 19:36:09 +0530 |
commit | 545256365dc0603658ad5e17bfa1fa00ba829d7e (patch) | |
tree | 8852946c5c3de6a8ca58d09a2baee7cf734f882b | |
parent | 34fbf0965783cc993876af307a353ba9d33ca69d (diff) |
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 <suchinton.2001@gmail.com>
-rw-r--r-- | Widgets/ICPage.py | 3 | ||||
-rw-r--r-- | Widgets/settings.py | 7 |
2 files changed, 6 insertions, 4 deletions
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" |