Add dev script and dependencies

This commit is contained in:
Jimmy 2025-05-05 22:18:24 +12:00
parent dc691b522b
commit 28fa71b8ad
2 changed files with 47 additions and 0 deletions

14
Pipfile Normal file
View File

@ -0,0 +1,14 @@
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"
[packages]
mpremote = "*"
pyserial = "*"
esptool = "*"
[dev-packages]
[requires]
python_version = "3.12"

33
dev.py Executable file
View File

@ -0,0 +1,33 @@
#!/usr/bin/env python3
import subprocess
import serial
import sys
print(sys.argv)
port = sys.argv[1]
cmd = sys.argv[1]
for cmd in sys.argv[1:]:
print(cmd)
match cmd:
case "src":
subprocess.call(["mpremote", "connect", port, "fs", "cp", "-r", ".", ":" ], cwd="src")
case "lib":
subprocess.call(["mpremote", "connect", port, "fs", "cp", "-r", "lib", ":" ])
case "ls":
subprocess.call(["mpremote", "connect", port, "fs", "ls", ":" ])
case "reset":
with serial.Serial(port, baudrate=115200) as ser:
ser.write(b'\x03\x03\x04')
case "follow":
with serial.Serial(port, baudrate=115200) as ser:
while True:
if ser.in_waiting > 0: # Check if there is data in the buffer
data = ser.readline().decode('utf-8').strip() # Read and decode the data
print(data)