Skip to content

Commit 0f8ff72

Browse files
committed
feat(apm.pdef.xml): detect and delete incorrect apm.pdef.xml files
1 parent d36b8d7 commit 0f8ff72

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

ardupilot_methodic_configurator/__main__.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"""
2020

2121
import argparse
22+
import os
2223
from logging import basicConfig as logging_basicConfig
2324
from logging import debug as logging_debug
2425
from logging import error as logging_error
@@ -520,6 +521,26 @@ def main() -> None:
520521
if not files:
521522
vehicle_directory_selection(state)
522523

524+
if (
525+
state.flight_controller.fc_parameters
526+
and state.flight_controller.info.flight_sw_version.startswith("4.6.")
527+
and state.local_filesystem.doc_dict
528+
and "FSTRATE_ENABLE" in state.local_filesystem.doc_dict
529+
):
530+
show_error_message(
531+
_("Incompatible parameter definition file detected"),
532+
_(
533+
"The parameter definition file 'apm.pdef.xml' is incompatible with ArduPilot 4.6.x firmware. "
534+
"It appears to be from the master branch. The file will be deleted. "
535+
"Please restart the ArduPilot Methodic Configurator."
536+
),
537+
)
538+
# delete apm.pdef.xml file as it is from master and not from 4.6.x
539+
file_path = os.path.join(state.local_filesystem.vehicle_dir, "apm.pdef.xml")
540+
if os.path.exists(file_path):
541+
os.remove(file_path)
542+
sys_exit(1)
543+
523544
# Run component editor workflow
524545
component_editor(state)
525546

0 commit comments

Comments
 (0)