From 1ac49234e889dacde09730c5217399e4612a019e Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 23 Apr 2020 10:51:36 +1000 Subject: [PATCH] fixed last_heartbeat function this should return the time since the last heartbeat, but instead it was giving the time between the last hearbeat and the last mavlink pkt. That means if you lose link completely then last_heartbeat wouldn't update --- dronekit/__init__.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/dronekit/__init__.py b/dronekit/__init__.py index 4f3613906..132dc6b65 100644 --- a/dronekit/__init__.py +++ b/dronekit/__init__.py @@ -1381,12 +1381,9 @@ def listener(self, name, msg): self._logger.info('...link restored.') self._heartbeat_timeout = False - self._last_heartbeat = None - @handler.forward_loop def listener(_): if self._heartbeat_lastreceived: - self._last_heartbeat = monotonic.monotonic() - self._heartbeat_lastreceived self.notify_attribute_listeners('last_heartbeat', self.last_heartbeat) @property @@ -1424,7 +1421,7 @@ def listener(self, attr_name, value): parameter passed to the :py:func:`connect() ` function. """ - return self._last_heartbeat + return monotonic.monotonic() - self._heartbeat_lastreceived def on_message(self, name): """