Skip to content

Commit 878e02c

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

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

ardupilot_methodic_configurator/backend_flightcontroller.py

Lines changed: 7 additions & 6 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()
@@ -485,13 +484,15 @@ def __create_connection_with_retry( # pylint: disable=too-many-arguments, too-m
485484
logging_info(msg.format(**locals()))
486485
else:
487486
msg = _("Unsupported autopilot type {self.info.autopilot}")
488-
# return msg.format(**locals())
489487
continue
490-
491488
self.info.set_type(m.type)
492489
msg = _("Vehicle type: {self.info.mav_type} running {self.info.vehicle_type} firmware")
493490
logging_info(msg.format(**locals()))
494491

492+
if not self.info.is_supported:
493+
msg = _("No supported autopilots found")
494+
return msg.format(**locals())
495+
495496
self.__request_banner()
496497
banner_msgs = self.__receive_banner_text()
497498

0 commit comments

Comments
 (0)