Skip to content

Commit

Permalink
FEATURE: Ignore the TCAL steps if not supported by the FC
Browse files Browse the repository at this point in the history
  • Loading branch information
amilcarlucas committed Jul 12, 2024
1 parent 5eca10a commit 92a21ec
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
4 changes: 2 additions & 2 deletions MethodicConfigurator/ardupilot_methodic_configurator.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,10 @@ def main():
vehicle_dir_window = VehicleDirectorySelectionWindow(local_filesystem, len(flight_controller.fc_parameters) > 0)
vehicle_dir_window.root.mainloop()

start_file = local_filesystem.get_start_file(args.n)

component_editor(args, flight_controller, local_filesystem.vehicle_type, local_filesystem, vehicle_dir_window)

start_file = local_filesystem.get_start_file(args.n, 'INS_TCAL1_ENABLE' in flight_controller.fc_parameters)

# Call the GUI function with the starting intermediate parameter file
ParameterEditorWindow(start_file, flight_controller, local_filesystem, VERSION)

Expand Down
8 changes: 7 additions & 1 deletion MethodicConfigurator/backend_filesystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ def __read_last_uploaded_filename(self) -> str:
logging_error("Error reading last uploaded filename: %s", e)
return ""

def get_start_file(self, explicit_index: int):
def get_start_file(self, explicit_index: int, tcal_enabled: bool) -> str:
# Get the list of intermediate parameter files files that will be processed sequentially
files = list(self.file_parameters.keys())

Expand All @@ -479,11 +479,17 @@ def get_start_file(self, explicit_index: int):
if last_uploaded_filename:
logging_info("Last uploaded file was %s.", last_uploaded_filename)
else:
if tcal_enabled:
logging_info("No last uploaded file found. Starting with the first non-tcal file.")
return files[2]
logging_info("No last uploaded file found. Starting with the first file.")
return files[0]

if last_uploaded_filename not in files:
# Handle the case where last_uploaded_filename is not found in the list
if tcal_enabled:
logging_info("Last uploaded file not found in the list of files. Starting with the first non-tcal file.")
return files[2]
logging_warning("Last uploaded file not found in the list of files. Starting with the first file.")
return files[0]

Expand Down

0 comments on commit 92a21ec

Please sign in to comment.