From 08d06d2c7f4c51837b111ad274dbcc65f6d3ccbd Mon Sep 17 00:00:00 2001 From: Julian Oes Date: Wed, 12 Nov 2014 22:45:39 +1000 Subject: [PATCH] uas: hack to include HIL bitfield when UAV is in HIL mode but not through QGC --- src/uas/UAS.h | 4 +++- src/ui/uas/UASControlWidget.cc | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/uas/UAS.h b/src/uas/UAS.h index 9d9681caa..20c7e629f 100644 --- a/src/uas/UAS.h +++ b/src/uas/UAS.h @@ -569,8 +569,10 @@ public: bool isAuto(); /** @brief Check if vehicle is armed */ bool isArmed() const { return systemIsArmed; } - /** @brief Check if vehicle is in HIL mode */ + /** @brief Check if vehicle is supposed to be in HIL mode by the GS */ bool isHilEnabled() const { return hilEnabled; } + /** @brief Check if vehicle is in HIL mode */ + bool isHilActive() const { return base_mode & MAV_MODE_FLAG_HIL_ENABLED; } /** @brief Get reference to the waypoint manager **/ UASWaypointManager* getWaypointManager() { diff --git a/src/ui/uas/UASControlWidget.cc b/src/ui/uas/UASControlWidget.cc index 99666bbab..3d9b150c6 100644 --- a/src/ui/uas/UASControlWidget.cc +++ b/src/ui/uas/UASControlWidget.cc @@ -246,7 +246,7 @@ void UASControlWidget::transmitMode() UAS* uas = dynamic_cast(uas_iface); - if (uas->isHilEnabled()) { + if (uas->isHilEnabled() || uas->isHilActive()) { mode.baseMode |= MAV_MODE_FLAG_HIL_ENABLED; } else { mode.baseMode &= ~MAV_MODE_FLAG_HIL_ENABLED; -- 2.22.0