Commit 47f6f81
committed
feat(config-steps): conditionally add, delete, and derive parameters per vehicle/FC state
Parameters in each configuration step can now be fully tailored at the JSON level to match
the connected flight controller, its current parameter set, and vehicle component data —
without requiring Python changes for each new vehicle type.
New JSON capabilities in configuration_steps_*.json:
- `derived_parameters` entries accept an optional `"if"` expression; the entry is skipped
when the condition is false. An entry with only `"if"` and no `"New Value"` is an
"add-from-FC" shorthand: the parameter is added at its current FC value when the
condition holds.
- New `delete_parameters` section removes parameters from a file when an optional `"if"`
expression evaluates to true, or unconditionally when no condition is given.
Engine changes (backend_filesystem_configuration_steps.py):
- `compute_parameters` refactored into focused helpers: `_condition_passes`,
`_eval_new_value`, `_resolve_string_result`, `_compute_single_parameter`.
- New `compute_deletions` method evaluates the `delete_parameters` section.
- `fc_parameters` detection uses a word-boundary regex to prevent false positives.
- `StopIteration` from doc-dict lookups now produces a descriptive error message instead
of propagating silently.
- `SyntaxError` in `"if"` conditions logs a warning; `NameError`/`KeyError` are silent
(expected when the FC is not yet connected).
Integration:
- `LocalFilesystem.calculate_derived_and_forced_param_changes` accepts an optional
`fc_parameters` dict that is injected into the eval context.
- `ParameterEditor._repopulate_configuration_step_parameters` applies add-from-FC entries
and deletions to the live UI domain model.
- `configuration_steps_schema.json` updated to validate the new structure.
- Applied in `configuration_steps_ArduCopter.json` for IMU temperature calibration
parameters (INS_TCAL2/3_ENABLE, BRD_HEAT_TARG) and battery monitor parameters
(BATT_I2C_BUS, BATT_AMP_OFFSET, BATT_AMP_PERVLT, BATT_VOLT_MULT).
- Tests added for `_condition_passes`, `compute_deletions`, and the add-from-FC shorthand.1 parent 8a51c5b commit 47f6f81
File tree
8 files changed
+538
-101
lines changed- ardupilot_methodic_configurator
- tests
8 files changed
+538
-101
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
576 | 576 | | |
577 | 577 | | |
578 | 578 | | |
| 579 | + | |
579 | 580 | | |
580 | 581 | | |
581 | 582 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
829 | 829 | | |
830 | 830 | | |
831 | 831 | | |
| 832 | + | |
832 | 833 | | |
833 | 834 | | |
834 | 835 | | |
835 | 836 | | |
836 | | - | |
837 | | - | |
838 | | - | |
839 | | - | |
840 | | - | |
841 | | - | |
842 | | - | |
843 | 837 | | |
844 | 838 | | |
845 | 839 | | |
846 | 840 | | |
847 | 841 | | |
848 | 842 | | |
849 | 843 | | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
850 | 848 | | |
851 | 849 | | |
852 | 850 | | |
| |||
872 | 870 | | |
873 | 871 | | |
874 | 872 | | |
875 | | - | |
876 | | - | |
| 873 | + | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
877 | 877 | | |
878 | 878 | | |
879 | 879 | | |
| |||
900 | 900 | | |
901 | 901 | | |
902 | 902 | | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
903 | 907 | | |
904 | 908 | | |
905 | 909 | | |
| |||
Lines changed: 225 additions & 70 deletions
Large diffs are not rendered by default.
Lines changed: 19 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
21 | | - | |
22 | | - | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
23 | 28 | | |
24 | 29 | | |
25 | 30 | | |
| |||
134 | 139 | | |
135 | 140 | | |
136 | 141 | | |
137 | | - | |
| 142 | + | |
138 | 143 | | |
139 | | - | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
140 | 154 | | |
141 | 155 | | |
142 | 156 | | |
| |||
Lines changed: 46 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
85 | 85 | | |
86 | 86 | | |
87 | 87 | | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
93 | 99 | | |
94 | | - | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
95 | 130 | | |
96 | | - | |
| 131 | + | |
97 | 132 | | |
98 | | - | |
| 133 | + | |
| 134 | + | |
99 | 135 | | |
100 | | - | |
| 136 | + | |
| 137 | + | |
101 | 138 | | |
102 | 139 | | |
103 | 140 | | |
| |||
Lines changed: 15 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
339 | 339 | | |
340 | 340 | | |
341 | 341 | | |
| 342 | + | |
| 343 | + | |
342 | 344 | | |
343 | 345 | | |
344 | 346 | | |
| |||
348 | 350 | | |
349 | 351 | | |
350 | 352 | | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
351 | 365 | | |
352 | 366 | | |
| 367 | + | |
353 | 368 | | |
354 | 369 | | |
355 | 370 | | |
| |||
Lines changed: 25 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1661 | 1661 | | |
1662 | 1662 | | |
1663 | 1663 | | |
1664 | | - | |
| 1664 | + | |
1665 | 1665 | | |
1666 | 1666 | | |
1667 | 1667 | | |
| |||
1731 | 1731 | | |
1732 | 1732 | | |
1733 | 1733 | | |
| 1734 | + | |
| 1735 | + | |
| 1736 | + | |
| 1737 | + | |
| 1738 | + | |
| 1739 | + | |
| 1740 | + | |
| 1741 | + | |
| 1742 | + | |
| 1743 | + | |
| 1744 | + | |
| 1745 | + | |
| 1746 | + | |
| 1747 | + | |
| 1748 | + | |
| 1749 | + | |
| 1750 | + | |
| 1751 | + | |
| 1752 | + | |
| 1753 | + | |
| 1754 | + | |
| 1755 | + | |
| 1756 | + | |
| 1757 | + | |
1734 | 1758 | | |
1735 | 1759 | | |
1736 | 1760 | | |
| |||
0 commit comments