Fix justfile parsing: extract inline Python to reset-mcu.py script
Validate and Test / validate-patches (push) Failing after 13s
Validate and Test / validate-patches (push) Failing after 13s
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
#!/usr/bin/env python3
|
||||
import socket, msgpack, time, sys
|
||||
|
||||
ROUTER_SOCK = sys.argv[1] if len(sys.argv) > 1 else "/var/run/arduino-router.sock"
|
||||
SERIAL_DEV = sys.argv[2] if len(sys.argv) > 2 else "/dev/ttyHS1"
|
||||
|
||||
s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
|
||||
s.settimeout(5)
|
||||
s.connect(ROUTER_SOCK)
|
||||
p = msgpack.Packer()
|
||||
|
||||
req = p.pack([0, 1, "mon/reset", []])
|
||||
s.sendall(req); s.recv(4096)
|
||||
|
||||
req = p.pack([0, 2, "$/serial/close", [SERIAL_DEV]])
|
||||
s.sendall(req); s.recv(4096)
|
||||
|
||||
req = p.pack([0, 3, "$/serial/open", [SERIAL_DEV]])
|
||||
s.sendall(req); s.recv(4096)
|
||||
|
||||
s.close()
|
||||
print("MCU reset, serial reopened. Wait 20s for Bridge.begin()...")
|
||||
Reference in New Issue
Block a user