Skip to content

Commit 3ee89b7

Browse files
morzackpeterbarker
authored andcommitted
Make HEARTBEAT handler ignore non-vehicle HEARTBEATs
1 parent 875986e commit 3ee89b7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

dronekit/__init__.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1249,7 +1249,7 @@ def listener(self, name, m):
12491249
@self.on_message('HEARTBEAT')
12501250
def listener(self, name, m):
12511251
# ignore groundstations
1252-
if m.type == mavutil.mavlink.MAV_TYPE_GCS:
1252+
if m.type == mavutil.mavlink.MAV_TYPE_GCS or (not self._handler.master.probably_vehicle_heartbeat(m)):
12531253
return
12541254
self._armed = (m.base_mode & mavutil.mavlink.MAV_MODE_FLAG_SAFETY_ARMED) != 0
12551255
self.notify_attribute_listeners('armed', self.armed, cache=True)
@@ -1413,7 +1413,7 @@ def listener(_):
14131413
@self.on_message(['HEARTBEAT'])
14141414
def listener(self, name, msg):
14151415
# ignore groundstations
1416-
if msg.type == mavutil.mavlink.MAV_TYPE_GCS:
1416+
if msg.type == mavutil.mavlink.MAV_TYPE_GCS or (not self._handler.master.probably_vehicle_heartbeat(msg)):
14171417
return
14181418
self._heartbeat_system = msg.get_srcSystem()
14191419
self._heartbeat_lastreceived = monotonic.monotonic()

0 commit comments

Comments
 (0)