]> apps.delaporte.us Git - dotfiles.git/blob - invoke/esptool/tasks.py
590d70028d53952191d592322a94c8f74df5da3e
[dotfiles.git] / invoke / esptool / tasks.py
1 from invoke import task
2
3 from datetime import datetime as dt
4 import os
5
6 HOME = os.path.expanduser('~')
7 TODAY = dt.now().strftime('%Y.%m.%d')
8
9 @task
10 def help(c):
11 '''
12 - Set the Cardputer Adv power to 'off' state
13 - Plugging in to USB will cause it to boot
14 - Hold 'Go' while booting
15 - Hold 'Go' and press 'Reset' to try again.
16 - On success, the usual screen content still shows up
17 > Tip: Be sure to use a cable that can carry data, not just power.
18
19 '''
20 print(help.__doc__)
21
22
23 @task
24 def usbdiff(c):
25 input('Un-plug in the device...')
26 c.run('lsusb > /tmp/before.txt')
27 input('Plug in the device...')
28 c.run('lsusb > /tmp/after.txt')
29 result = c.run('diff /tmp/before.txt /tmp/after.txt')
30 print(result.stdout)
31 # breakpoint()
32
33 # Maybe https://thelastoutpostworkshop.github.io/ESPConnect/ in Chromium?
34
35 DEV='/dev/ttyACM0'
36
37 @task
38 def listusb(c):
39 c.run('ls /dev/ttyACM*')
40 # c.run('ls /dev/ttyUSB*')
41
42 @task()
43 def chip_id(c):
44 c.run(f'esptool --port {DEV} chip-id')
45