Skip to content

Conversation

@HTRamsey
Copy link

No description provided.

@HTRamsey
Copy link
Author

@ES-Alexander what else do I need to add to this PR? I know I'm missing something but not sure what

Copy link
Contributor

@ES-Alexander ES-Alexander left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @HTRamsey - sorry I didn't see this earlier!

A couple of suggestions, one for slightly cleaner code, and the other to fix the MAVLink message generation for Tracker :-)

Comment on lines 51 to +64
path1 = Path(f'{self.repository_path}/{tag["matches"]["name"]}/version.h')
path2 = Path(f'{self.repository_path}/{self.valid_name_map[tag["matches"]["name"]]}/version.h')
file = path1 if path1.exists() else path2
path3 = Path(f'{self.repository_path}/Tools/{tag["matches"]["name"]}/version.h')
path4 = Path(f'{self.repository_path}/Tools/{self.valid_name_map[tag["matches"]["name"]]}/version.h')
if path1.exists():
file = path1
elif path2.exists():
file = path2
elif path3.exists():
file = path3
elif path4.exists():
file = path4
else:
raise FileNotFoundError(f'No version.h found for tag {tag["matches"]["name"]}')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
path1 = Path(f'{self.repository_path}/{tag["matches"]["name"]}/version.h')
path2 = Path(f'{self.repository_path}/{self.valid_name_map[tag["matches"]["name"]]}/version.h')
file = path1 if path1.exists() else path2
path3 = Path(f'{self.repository_path}/Tools/{tag["matches"]["name"]}/version.h')
path4 = Path(f'{self.repository_path}/Tools/{self.valid_name_map[tag["matches"]["name"]]}/version.h')
if path1.exists():
file = path1
elif path2.exists():
file = path2
elif path3.exists():
file = path3
elif path4.exists():
file = path4
else:
raise FileNotFoundError(f'No version.h found for tag {tag["matches"]["name"]}')
potential_paths = (
f'{self.repository_path}/{tag["matches"]["name"]}/version.h',
f'{self.repository_path}/{self.valid_name_map[tag["matches"]["name"]]}/version.h',
f'{self.repository_path}/Tools/{tag["matches"]["name"]}/version.h',
f'{self.repository_path}/Tools/{self.valid_name_map[tag["matches"]["name"]]}/version.h',
)
if (file := next((p for p in potential_paths if Path(p).exists()), None)) is None:
raise FileNotFoundError(f'No version.h found for tag {tag["matches"]["name"]}')

This isn't particularly necessary, but it does make it easier to add additional options in future...


# Run MAVLink messages parser
vehicle = f'{"Ardu" if vehicle_type != "Rover" else ""}{vehicle_type}'
vehicle = f'{"Ardu" if vehicle_type in ["Copter", "Plane", "Sub"] else ""}{vehicle_type}'
Copy link
Contributor

@ES-Alexander ES-Alexander Nov 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
vehicle = f'{"Ardu" if vehicle_type in ["Copter", "Plane", "Sub"] else ""}{vehicle_type}'
prefix = 'Ardu' if vehicle_type in ('Copter', 'Plane', 'Sub') else 'Antenna' if vehicle_type == 'Tracker' else ''
vehicle = f'{prefix}{vehicle_type}'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants