Skip to content

Commit 2b582a3

Browse files
committed
AMC-975: add check supported autopilot is not found
1 parent fe8f8ef commit 2b582a3

1 file changed

Lines changed: 11 additions & 11 deletions

File tree

ardupilot_methodic_configurator/backend_flightcontroller.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
"""
1010

1111
import os
12-
import time
1312
from argparse import ArgumentParser
1413
from logging import debug as logging_debug
1514
from logging import error as logging_error
@@ -458,13 +457,13 @@ def __create_connection_with_retry( # pylint: disable=too-many-arguments, too-m
458457
msg = f"Failed to create mavlink connect to {self.comport.device}"
459458
raise ConnectionError(msg)
460459
# --- NEW: collect all vehicles detected within timeout ---
461-
start_time = time.time()
460+
start_time = time_time()
462461
detected_vehicles = {} # sysid -> last HEARTBEAT
463462

464-
while time.time() - start_time < timeout:
463+
while time_time() - start_time < timeout:
465464
m = self.master.recv_match(type="HEARTBEAT", blocking=False)
466465
if m is None:
467-
time.sleep(0.1)
466+
time_sleep(0.1)
468467
continue
469468
sysid = m.get_srcSystem()
470469
compid = m.get_srcComponent()
@@ -483,14 +482,15 @@ def __create_connection_with_retry( # pylint: disable=too-many-arguments, too-m
483482
if self.info.is_supported:
484483
msg = _("Autopilot type {self.info.autopilot}")
485484
logging_info(msg.format(**locals()))
486-
else:
487-
msg = _("Unsupported autopilot type {self.info.autopilot}")
488-
# return msg.format(**locals())
489-
continue
485+
self.info.set_type(m.type)
486+
msg = _("Vehicle type: {self.info.mav_type} running {self.info.vehicle_type} firmware")
487+
logging_info(msg.format(**locals()))
488+
break
489+
msg = _("Unsupported autopilot type {self.info.autopilot}")
490490

491-
self.info.set_type(m.type)
492-
msg = _("Vehicle type: {self.info.mav_type} running {self.info.vehicle_type} firmware")
493-
logging_info(msg.format(**locals()))
491+
if not self.info.is_supported:
492+
msg = _("No supported autopilots found")
493+
return msg.format(**locals())
494494

495495
self.__request_banner()
496496
banner_msgs = self.__receive_banner_text()

0 commit comments

Comments
 (0)