From 8758ef3a521f8c77ad5bf34ee83a40554a5578cb Mon Sep 17 00:00:00 2001 From: Falko Schindler Date: Tue, 10 Oct 2023 15:42:06 +0200 Subject: [PATCH] code review --- esp.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/esp.py b/esp.py index 906f68b..09e9ad8 100644 --- a/esp.py +++ b/esp.py @@ -5,8 +5,12 @@ class Esp: - def __init__( - self, nand: bool = False, xavier: bool = False, orin: bool = False, device: Optional[str] = None) -> None: + def __init__(self, + nand: bool = False, + xavier: bool = False, + orin: bool = False, + device: Optional[str] = None, + ) -> None: print('Initializing ESP...') self.en = 436 if xavier else 492 if orin else 216 self.g0 = 428 if xavier else 460 if orin else 50 @@ -24,7 +28,7 @@ def write(self, path: str, value: Union[str, int]) -> None: print(f'echo {value:3} > /sys/class/gpio/{path}') with open(f'/sys/class/gpio/{path}', 'w') as f: f.write(f'{value}\n') - except: + except Exception: print(f'could not write {value} to {path}') @contextmanager