X-Git-Url: https://apps.delaporte.us/gitweb/dotfiles.git/blobdiff_plain/8cee1ed3b1f7f3c1196956e7e919231c41d18a85..49460cf0fa01c3928e9837bdeba80d7b9fed9621:/invoke/esptool/tasks.py diff --git a/invoke/esptool/tasks.py b/invoke/esptool/tasks.py index 454cc47..43df54e 100644 --- a/invoke/esptool/tasks.py +++ b/invoke/esptool/tasks.py @@ -6,8 +6,34 @@ import os HOME = os.path.expanduser('~') TODAY = dt.now().strftime('%Y.%m.%d') +@task +def help(c): + ''' + On using this tasks file + + - Set the Cardputer Adv power to 'off' state + - Plugging in to USB will cause it to boot + - Hold 'Go' while booting + - Hold 'Go' and press 'Reset' to try again. + - On success, the usual screen content still shows up + > Tip: Be sure to use a cable that can carry data, not just power. + + Consider burnin + https://github.com/echo-lalia/MicroHydra + + ''' + print(help.__doc__) + +@task +def groups(c): + '''Check that the current user is a member of dialout''' + result = c.run(f'groups {os.getlogin()}') + assert 'dialout' in result.stdout + print('ok') + @task def usbdiff(c): + '''Use lsusb to try to find the new device.''' input('Un-plug in the device...') c.run('lsusb > /tmp/before.txt') input('Plug in the device...') @@ -16,19 +42,23 @@ def usbdiff(c): print(result.stdout) # breakpoint() +# Maybe https://thelastoutpostworkshop.github.io/ESPConnect/ in Chromium? -# Set power to 'off' state -# Hold 'Go' while booting +DEV='/dev/ttyACM0' -# Maybe https://thelastoutpostworkshop.github.io/ESPConnect/ in Chromium? +@task +def check_connected(c): + dev = 'Espressif' + result = c.run(f'lsusb | grep {dev}') + assert dev in result.stdout + print('[ok]') @task def listusb(c): - c.run('ls /dev/ttyUSB*') c.run('ls /dev/ttyACM*') + # c.run('ls /dev/ttyUSB*') @task() -def status(c): - - c.run('esptool --port /dev/ttyUSB0 chip-id') +def chip_id(c): + c.run(f'esptool --port {DEV} chip-id')