Deploy firmware using fbuild with optional monitoring. Uses the daemon's combined build+deploy path which checks the firmware ledger — if source hash + build flags are unchanged, the entire build+flash is skipped (returns in ~1s). Args: build_dir: Project directory containi
(
build_dir: Path,
environment: str | None = None,
upload_port: str | None = None,
verbose: bool = False,
clean: bool = False,
monitor_after: bool = False,
timeout: float = 1800,
quiet: bool = False,
log_file: IO[str] | None = None,
)
| 613 | |
| 614 | |
| 615 | def run_fbuild_deploy( |
| 616 | build_dir: Path, |
| 617 | environment: str | None = None, |
| 618 | upload_port: str | None = None, |
| 619 | verbose: bool = False, |
| 620 | clean: bool = False, |
| 621 | monitor_after: bool = False, |
| 622 | timeout: float = 1800, |
| 623 | quiet: bool = False, |
| 624 | log_file: IO[str] | None = None, |
| 625 | ) -> bool: |
| 626 | """Deploy firmware using fbuild with optional monitoring. |
| 627 | |
| 628 | Uses the daemon's combined build+deploy path which checks the firmware |
| 629 | ledger — if source hash + build flags are unchanged, the entire |
| 630 | build+flash is skipped (returns in ~1s). |
| 631 | |
| 632 | Args: |
| 633 | build_dir: Project directory containing platformio.ini |
| 634 | environment: Build environment (None = auto-detect) |
| 635 | upload_port: Serial port (None = auto-detect) |
| 636 | verbose: Enable verbose output |
| 637 | clean: Perform clean build before deploy |
| 638 | monitor_after: Start monitoring after deploy |
| 639 | timeout: Maximum deploy time in seconds (default: 30 minutes) |
| 640 | quiet: Suppress verbose output (emit single summary line) |
| 641 | log_file: File to redirect verbose output to in quiet mode |
| 642 | |
| 643 | Returns: |
| 644 | True if deploy (and optional monitoring) succeeded, False otherwise |
| 645 | """ |
| 646 | import subprocess |
| 647 | |
| 648 | out = _get_output(quiet, log_file) |
| 649 | print("=" * 60, file=out) |
| 650 | print("DEPLOYING (fbuild)", file=out) |
| 651 | print("=" * 60, file=out) |
| 652 | |
| 653 | if environment is None: |
| 654 | raise ValueError("environment must be specified for fbuild deploy") |
| 655 | |
| 656 | fbuild_exe = get_fbuild_executable() |
| 657 | if fbuild_exe is None: |
| 658 | print("BUILD+FLASH FAIL fbuild not found on PATH") |
| 659 | return False |
| 660 | |
| 661 | cmd: list[str] = [ |
| 662 | fbuild_exe, |
| 663 | str(build_dir), |
| 664 | "deploy", |
| 665 | "-e", |
| 666 | environment, |
| 667 | ] |
| 668 | if upload_port: |
| 669 | cmd.extend(["-p", upload_port]) |
| 670 | if verbose: |
| 671 | cmd.append("-v") |
| 672 | if clean: |
no test coverage detected