STAR
Cal STAR — firmware, DAQ server, and engine design
Loading...
Searching...
No Matches
pio_ota_upload Namespace Reference

Functions

 _on_upload (source, target, env)

Variables

 _THIS_FILE = __file__
 _TOOLS_DIR = os.path.dirname(os.path.abspath(_THIS_FILE))
 _UPLOADER = os.path.join(_TOOLS_DIR, "ota_upload.py")
 UPLOADCMD

Detailed Description

PlatformIO extra_script: make ``pio run -t upload`` push over Ethernet.

Adapted from maxgerhardt/pio-esp32-ethernet-ota, which replaces UPLOADCMD with
a custom command — the idea being that OTA should be the same one-button
action as a USB upload, not a separate script you have to remember. The
difference here is that it drives ``ota_upload.py`` (our own protocol and our
own error messages) rather than curl.

Wire it into any project by adding an OTA env to its platformio.ini:

    [env:ota]
    extends = env:adafruit_feather_esp32s3   ; your normal build env
    upload_protocol = custom
    extra_scripts = post:../../tools/pio_ota_upload.py   ; adjust depth
    upload_flags =
        --ip=192.168.2.41

Then:

    pio run -e ota -t upload

``upload_flags`` are passed straight through to ota_upload.py, so anything it
accepts works here — e.g. ``--port=3232`` or a longer ``--timeout=90``.

The path depth differs per project (the repo's projects sit at different
levels), which is why this is spelled out per project rather than in
platformio-common.ini — the same reason lib_extra_dirs is per-project there.

Function Documentation

◆ _on_upload()

pio_ota_upload._on_upload ( source,
target,
env )
protected
Run ota_upload.py against the just-built firmware.bin.

Definition at line 49 of file pio_ota_upload.py.

Variable Documentation

◆ _THIS_FILE

pio_ota_upload._THIS_FILE = __file__
protected

Definition at line 37 of file pio_ota_upload.py.

◆ _TOOLS_DIR

pio_ota_upload._TOOLS_DIR = os.path.dirname(os.path.abspath(_THIS_FILE))
protected

Definition at line 45 of file pio_ota_upload.py.

◆ _UPLOADER

pio_ota_upload._UPLOADER = os.path.join(_TOOLS_DIR, "ota_upload.py")
protected

Definition at line 46 of file pio_ota_upload.py.

◆ UPLOADCMD

pio_ota_upload.UPLOADCMD

Definition at line 78 of file pio_ota_upload.py.