Skip to content

Commit a3c6545

Browse files
committed
Merge branch 'master' into hgw_remove_requests_dependency
2 parents dc30747 + 1a1fcb3 commit a3c6545

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

dronekit/__init__.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1071,14 +1071,17 @@ def listener(self, name, m):
10711071

10721072
self._capabilities = None
10731073
self._raw_version =None
1074+
self._autopilot_version_msg_count = 0
10741075

10751076
@self.on_message('AUTOPILOT_VERSION')
10761077
def listener(vehicle, name, m):
10771078
self._capabilities = m.capabilities
10781079
self._raw_version = m.flight_sw_version
1079-
if self._capabilities != 0:
1080+
self._autopilot_version_msg_count += 1
1081+
if self._capabilities != 0 or self._autopilot_version_msg_count > 5:
10801082
# ArduPilot <3.4 fails to send capabilities correctly
1081-
# straight after boot.
1083+
# straight after boot, and even older versions send
1084+
# this back as always-0.
10821085
vehicle.remove_message_listener('HEARTBEAT', self.send_capabilties_request)
10831086
self.notify_attribute_listeners('autopilot_version', self._raw_version)
10841087

0 commit comments

Comments
 (0)