MethodicConfigurator

External Parameter File Upload Architecture

Overview

The external parameter file comparison and upload feature allows a user to load an ArduPilot .parm or .param file that is not part of the files managed by ArduPilot Methodic Configurator (AMC), inspect its values against the connected flight controller (FC), optionally make temporary per-parameter changes, and selectively upload parameters.

This workflow is deliberately separate from the sequential configuration-step workflow. Opening or editing an external file does not add it to the vehicle project, change the current configuration step, write to the selected file, or ask whether temporary edits should be saved.

Requirements

Functional Requirements

  1. External file selection
    • Provide an Compare and upload button beside the parameter-editor legend.
    • Disable this entry button when no FC is connected.
    • Allow selection of .parm and .param files.
    • Parse and validate the selected file with the standard ParDict parser.
    • Report parsing and file-access errors without changing the active AMC project.
  2. Modal parameter preview
    • Display the selected file in a modal child window.
    • Reuse the standard parameter table and parameter metadata presentation.
    • Display parameter name, current FC value, difference indicator, file/new value, unit, Upload checkbox, and Manual checkbox.
    • Omit parameter add/delete controls and the change-reason field.
  3. Upload selection
    • Provide one Upload checkbox per parameter.
    • Select changed or FC-missing parameters by default when an FC is connected.
    • Leave parameters whose file value equals the FC value deselected by default.
    • Upload only parameters whose Upload checkbox is selected and currently displayed.
    • Preserve Upload selections while the table is repopulated.
  4. Temporary manual editing
    • Keep every loaded value non-editable by default.
    • Provide one Manual checkbox per writable parameter.
    • Make only that parameter’s value editable when its Manual checkbox is selected.
    • Keep edits in memory and use them only for the current upload operation.
    • Restore the value loaded from the external file when Manual is cleared.
    • Never persist a temporary edit to the external file or an AMC-managed file.
  5. Changed-parameter filtering
    • Provide a Show only changed parameters checkbox.
    • Treat parameters missing from the FC as changed.
    • Do not advance or skip an AMC configuration step when no differences exist.
  6. FC upload: Provide Compare and upload and Cancel buttons. Use the comparison table to review FC values against the external file before uploading. Reuse the standard parameter upload, reset, reconnect, re-download, validation, retry, error-reporting, and progress-window workflows. Warn before upload when a temporary manual edit differs from the FC value but its Upload checkbox is not selected. Close the modal after a successful upload without advancing the AMC configuration step.

Non-Functional Requirements

Architectural Context

The feature is launched from the normal parameter editor but owns a separate set of ArduPilotParameter objects:

External .parm/.param file
          |
          v
      ParDict parser
          |
          v
External ArduPilotParameter objects <---- FC values + parameter metadata
          |
          v
Configurable shared ParameterEditorTable
          |
          v
Selected temporary values as ParDict
          |
          v
Existing FC upload workflow

The active ParameterEditor.current_step_parameters remains untouched throughout this flow.

Components

Parameter Editor Entry Point

The entry point does not alter current_file, the configuration-step combobox, or project filesystem state.

External Parameter Upload Window

The modal upload button does not duplicate the entry-point connection-state gate. The upload precondition remains in the data model to handle a connection that disappears while the modal is open.

The window is transient to the main parameter editor. A Tk grab is used for modality on platforms other than macOS, where grabs are intentionally avoided because of known Tk freezes.

Configurable Parameter Table

The external modal uses these options:

Option Value Effect
show_parameter_actions False Hides add/delete controls
show_upload_column True Shows per-parameter Upload checkboxes
show_manual_override_column True Shows per-parameter Manual checkboxes
show_change_reason_column False Omits the change-reason field
values_editable False Makes all values read-only initially
skip_when_no_differences False Prevents AMC step navigation
manual_override_for_all_parameters True Gives external parameters temporary Manual behavior

manually_editable_parameters is an in-memory set of names whose Manual checkbox is active. It is table-view state, not the persisted manual-override state used by forced and derived AMC parameters.

Parameter Editor Data Model

An empty configuration-step filename is supplied while constructing external parameter objects. This prevents forced or derived definitions from the active AMC step being applied to the external file.

ArduPilot Parameter Model

The reset method changes only the in-memory candidate value. It performs no file I/O.

Existing Upload Infrastructure

The external model entry point delegates to the common upload implementation with configuration step-state persistence disabled. Every FC download, including one made for an external upload, refreshes complete.param in the vehicle directory. MAVFTP-capable FCs also supply and refresh the 00_default.param snapshot; MAVLink parameter downloads do not expose defaults. The shared FC safety mechanics remain common, while the normal workflow continues to write the current-step marker and reports.

State Model

Each external parameter has four relevant pieces of state:

State Owner Lifetime Persistent?
Value loaded from file ArduPilotParameter Modal lifetime No writes
Candidate/new value ArduPilotParameter Modal lifetime No
Upload selection ParameterEditorTable.upload_checkbutton_var Modal lifetime No
Manual selection ParameterTableOptions.manually_editable_parameters Modal lifetime No

The FC value and parameter metadata in each external parameter object are snapshots supplied when the object is created. The shared upload workflow refreshes its FC parameter cache for verification; it does not convert the modal’s original comparison values into project state.

Detailed Workflows

Open and Display

  1. The user presses Compare and upload to choose an external file for comparison.
  2. Tk displays a file picker restricted to ArduPilot parameter files, with an all-files fallback.
  3. Cancellation returns without side effects.
  4. ParameterEditor.load_external_parameter_file() parses the selected file.
  5. Each parsed Par is converted to an ArduPilotParameter with metadata, default value, and matching FC value when available.
  6. ParameterFileUploadWindow creates the configured shared table.
  7. The modal grab prevents configuration-step changes behind the window.

Manual Edit

  1. All New Value widgets begin disabled.
  2. Selecting Manual for a writable row adds its name to manually_editable_parameters.
  3. The table enables only that row’s existing value widget; the static table is not rebuilt.
  4. The user edits the value; standard parameter validation runs.
  5. The candidate value and difference indicator update in memory.
  6. Clearing Manual removes the name from the set and restores the original external-file value.
  7. Closing or cancelling the modal discards every temporary edit.

This Manual behavior must not be confused with the persisted @manual_override mechanism for forced and derived parameters in AMC-managed configuration steps.

Changed-Only Filter

  1. Selecting Show only changed parameters repopulates the shared table.
  2. A parameter remains visible when its candidate value differs from the FC value or the parameter is absent from the FC parameter set.
  3. Upload selections are captured before widgets are destroyed so they survive repopulation.
  4. An empty result leaves the modal open and does not call the parameter editor’s skip action.

Upload

  1. ParameterEditorTable.get_upload_selected_params() reads the visible Upload checkbox states.
  2. The table identifies manually enabled parameters that were edited, differ from the FC, and are not selected for upload; the modal warns the user and stops that upload attempt when this set is non-empty.
  3. Selected external ArduPilotParameter objects are converted to a ParDict using their current candidate values.
  4. ensure_upload_preconditions() rejects an empty selection or missing FC connection.
  5. ParameterEditorWindow.upload_external_params() invokes the shared progress-managed upload UI with ParameterEditor.upload_external_params_workflow().
  6. Reset-required parameters, reconnection, remaining uploads, re-download, and validation follow the normal parameter editor rules.
  7. The user reviews the differences and may edit values temporarily before pressing Upload selected params to the FC.
  8. On success the modal closes.
  9. The current AMC configuration step is not saved, skipped, or advanced; no tuning report or FC-difference export is written.

Data Integrity Invariants

The following invariants define the boundary between external upload and project editing:

Error Handling

Testing Strategy

Data Model Tests

Table and Modal Tests

Regression Tests

The default ParameterTableOptions retain the normal parameter editor layout and behavior. Existing parameter editor and ArduPilotParameter tests protect the managed-file editing, forced/derived manual override, validation, bitmask, and upload workflows while the external-specific tests cover the alternate table configuration. Model-level external upload tests exercise the shared upload orchestration and assert that it produces no AMC project markers, reports, or exports.

Extension Points