-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflash.py
More file actions
31 lines (23 loc) · 856 Bytes
/
flash.py
File metadata and controls
31 lines (23 loc) · 856 Bytes
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
#!/usr/bin/env python3
"""
flash.py — Atajo para compilar y flashear modbusproxy por USB.
Equivalente a ejecutar directamente:
pio run -e esp32_usb -t upload
El script pre_upload.py (enganchado en PlatformIO) gestiona automaticamente
el resumen de configuracion, la confirmacion y la opcion de forzar modo Setup.
Uso: python flash.py
python flash.py -e PROD_ota
"""
import subprocess
import sys
import argparse
DEFAULT_ENV = "esp32_usb"
def main():
parser = argparse.ArgumentParser(description="Flash modbusproxy via USB")
parser.add_argument("-e", "--env", default=DEFAULT_ENV,
help=f"Entorno PlatformIO (default: {DEFAULT_ENV})")
args = parser.parse_args()
ret = subprocess.run(["pio", "run", "-e", args.env, "-t", "upload"]).returncode
sys.exit(ret)
if __name__ == "__main__":
main()