From e967575a47b83e3898ea6a4d4ed7289e6e3edd78 Mon Sep 17 00:00:00 2001 From: Jason Morley Date: Wed, 4 Jan 2023 20:29:24 +0000 Subject: [PATCH 1/2] Log connection errors --- Software/Source/src/pijuice_sys.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Software/Source/src/pijuice_sys.py b/Software/Source/src/pijuice_sys.py index 18b791c0..e0d5e955 100644 --- a/Software/Source/src/pijuice_sys.py +++ b/Software/Source/src/pijuice_sys.py @@ -284,7 +284,8 @@ def _LoadConfiguration(): bus = configData['board']['general']['i2c_bus'] pijuice = PiJuice(bus, addr) except: - sys.exit(0) + print("Failed to connect with error '%s'" % e) + sys.exit(1) try: for b in pijuice.config.buttons: From c6f2133557b306fd8078b8909050fb48f0c441b3 Mon Sep 17 00:00:00 2001 From: Jason Morley Date: Wed, 4 Jan 2023 20:35:42 +0000 Subject: [PATCH 2/2] Why use two lines when you can use one? --- Software/Source/src/pijuice_sys.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Software/Source/src/pijuice_sys.py b/Software/Source/src/pijuice_sys.py index e0d5e955..19c8b6db 100644 --- a/Software/Source/src/pijuice_sys.py +++ b/Software/Source/src/pijuice_sys.py @@ -284,8 +284,7 @@ def _LoadConfiguration(): bus = configData['board']['general']['i2c_bus'] pijuice = PiJuice(bus, addr) except: - print("Failed to connect with error '%s'" % e) - sys.exit(1) + exit("Failed to connect with error '%s'" % e) try: for b in pijuice.config.buttons: