From 09daf7343b6b5f929000c4001ff946e19de8914e Mon Sep 17 00:00:00 2001 From: Edward Delaporte Date: Mon, 8 Jun 2026 23:07:37 -0500 Subject: [PATCH] Stronger status checks --- invoke/esptool/tasks.py | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/invoke/esptool/tasks.py b/invoke/esptool/tasks.py index 43df54e..54793ee 100644 --- a/invoke/esptool/tasks.py +++ b/invoke/esptool/tasks.py @@ -6,6 +6,11 @@ import os HOME = os.path.expanduser('~') TODAY = dt.now().strftime('%Y.%m.%d') +# Examples for CardputerAdv +DEVICE = 'Espressif' +PORT='/dev/ttyACM0' # Linux +# PORT='COM0' # Windows + @task def help(c): ''' @@ -44,21 +49,29 @@ def usbdiff(c): # Maybe https://thelastoutpostworkshop.github.io/ESPConnect/ in Chromium? -DEV='/dev/ttyACM0' @task -def check_connected(c): - dev = 'Espressif' - result = c.run(f'lsusb | grep {dev}') - assert dev in result.stdout +def check_conn(c): + result = c.run(f'lsusb | grep {DEVICE}') + assert DEVICE in result.stdout print('[ok]') @task def listusb(c): - c.run('ls /dev/ttyACM*') + # result = c.run('ls /dev/ttyACM*') + result = c.run(f'ls {PORT}') + assert result.ok + print('[ok]') # c.run('ls /dev/ttyUSB*') -@task() +@task def chip_id(c): - c.run(f'esptool --port {DEV} chip-id') + c.run(f'esptool --port {PORT} chip-id') + print('[ok]') + +@task +def check_all(c): + listusb(c) + check_conn(c) + chip_id(c) -- 2.47.3