Tools: scripts: mavlink_parse: improve robustness

This commit is contained in:
ES-Alexander 2024-06-12 23:12:10 +10:00
parent adf87f360e
commit ce98da7aa0
1 changed files with 11 additions and 2 deletions

View File

@ -198,7 +198,12 @@ class MAVLinkDetector:
folder = file.parent.stem
if folder in exclude_libraries:
continue
try:
text = file.read_text()
except FileNotFoundError: # Broken symlink
continue
source = f'{folder}/{file.name}'
if file == self.COMMON_FILE:
for mavlink, ap_message in self.find_requestable_messages(text):
@ -267,7 +272,11 @@ class MAVLinkDetector:
def get_stream_groups(self, vehicle):
stream_groups = ['stream_groups']
try:
text = (self.BASE_DIR / vehicle / self.STREAM_GROUP_FILE).read_text()
except FileNotFoundError: # No stream groups
return []
for group_name, message_data in self.STREAM_GROUPS.findall(text):
stream_groups.extend(sorted(
MAVLinkMessage(self._ap_to_mavlink.get(ap_message, ap_message),