Commit 144dcddd authored by Julian Oes's avatar Julian Oes

set correct HIL bit, starting and stopping HIL works now as well

parent bd0d364d
......@@ -539,6 +539,8 @@ public:
bool isAuto();
/** @brief Check if vehicle is armed */
bool isArmed() const { return systemIsArmed; }
/** @brief Check if vehicle is in HIL mode */
bool isHilEnabled() const { return hilEnabled; }
/** @brief Get reference to the waypoint manager **/
UASWaypointManager* getWaypointManager() {
......
......@@ -230,8 +230,8 @@ void UASControlWidget::setMode(int mode)
void UASControlWidget::transmitMode()
{
UASInterface* uas = UASManager::instance()->getUASForId(this->uasID);
if (uas) {
UASInterface* uas_iface = UASManager::instance()->getUASForId(this->uasID);
if (uas_iface) {
if (modeIdx >= 0 && modeIdx < modesNum) {
struct full_mode_s mode = modesList[modeIdx];
// include armed state
......@@ -241,6 +241,14 @@ void UASControlWidget::transmitMode()
mode.baseMode &= ~MAV_MODE_FLAG_SAFETY_ARMED;
}
UAS* uas = dynamic_cast<UAS*>(uas_iface);
if (uas->isHilEnabled()) {
mode.baseMode |= MAV_MODE_FLAG_HIL_ENABLED;
} else {
mode.baseMode &= ~MAV_MODE_FLAG_HIL_ENABLED;
}
uas->setMode(mode.baseMode, mode.customMode);
QString modeText = ui.modeComboBox->currentText();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment