cli_batch
Run multiple iNAV CLI commands in one batch session, reducing multiple reboots to a single one. Ideal for ad-hoc multi-command reads or writes.
Instructions
Run MANY CLI commands in ONE CLI session — a single reboot for the whole batch.
On iNAV, leaving the CLI ALWAYS reboots the FC, so every separate cli() call
costs a full reboot + USB re-enumeration + reconnect (~7s). Doing a run of
commands one cli() call at a time means one reboot PER command — the rapid
reboot cadence is disruptive and can even knock the board into DFU/bootloader
mode. This collapses N commands into ONE session = ONE reboot. Prefer it for
any ad-hoc multi-command work (several get reads, or several set writes).
(The dedicated write tools — apply_aircraft_setup, set_flight_mode, etc. —
already batch internally; this is the escape hatch for everything else.)
Behaviour:
All read-only batch (get/diff/dump/status/tasks/version): the session exits WITHOUT saving — no EEPROM write, nothing persists. Still one reboot (unavoidable on iNAV), but reads are free of a save.
Any write (set/aux/feature/…): requires confirm_for_writes=True; a backup is taken first and the whole batch is SAVED once at the end (persist + reboot). If ANY command is rejected by the FC, the batch exits WITHOUT saving so nothing partial persists (all-or-nothing).
Live
motorcommands and session-control verbs (save/exit/batch) are rejected up front — motor tests must never be saved (use cli(..., props_removed=True) / test_motor()), and the batch manages save/exit itself.
Args: commands: Ordered list of CLI commands to run in one session. confirm_for_writes: Set True to run and persist a batch containing writes.
Returns per-command output, whether it saved, the backup path (if it wrote), and the measured reboot/reconnect seconds for the single reboot.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| commands | Yes | ||
| confirm_for_writes | No |