forked from badgeteam/ESP32-platform-firmware
-
Notifications
You must be signed in to change notification settings - Fork 0
/
batchflash.py
executable file
·31 lines (25 loc) · 900 Bytes
/
batchflash.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import sys, threading, time
from os import system
from os.path import exists
def flash_daemon(number):
device = '/dev/ttyUSB%d' % number
print('Starting flash thread for %s' % device)
sys.stdout.flush()
while True:
if exists(device):
print('Flashing %s' % device)
sys.stdout.flush()
system('env CONFIG_ESPTOOLPY_PORT_X=%s ./erase.sh' % device)
system('env CONFIG_ESPTOOLPY_PORT_X=%s ./flash.sh' % device)
system('env CONFIG_ESPTOOLPY_PORT_X=%s ./write_zip_disobey2020.sh' % device)
# Give system time to adjust
time.sleep(1)
# Wait for device to detach
while exists(device):
time.sleep(0.1)
time.sleep(0.1)
for i in range(0,10):
threading.Thread(target=flash_daemon, args=(i,)).start()
while True:
time.sleep(1)
# flash_daemon(0)