diff --git a/src/Waypoint.cc b/src/Waypoint.cc index 7a1c295b977927584620afac41c69a680da57aa7..ed9207bc34d0f254469911284e487b95e46df854 100644 --- a/src/Waypoint.cc +++ b/src/Waypoint.cc @@ -33,8 +33,7 @@ This file is part of the QGROUNDCONTROL project #include "Waypoint.h" #include -Waypoint::Waypoint(quint16 _id, float _x, float _y, float _z, float _yaw, bool _autocontinue, bool _current, float _orbit, int _holdTime, - MAV_FRAME _frame, MAV_ACTION _action) +Waypoint::Waypoint(quint16 _id, float _x, float _y, float _z, float _yaw, bool _autocontinue, bool _current, float _orbit, int _holdTime, MAV_FRAME _frame, MAV_ACTION _action) : id(_id), x(_x), y(_y), diff --git a/src/uas/UASWaypointManager.cc b/src/uas/UASWaypointManager.cc index 9f64729f9b7867555b04c6f095a363442b1e6f04..6c7e177767d53e1d2dfd0f7879f2a887e07bb9d2 100644 --- a/src/uas/UASWaypointManager.cc +++ b/src/uas/UASWaypointManager.cc @@ -131,7 +131,8 @@ void UASWaypointManager::handleWaypoint(quint8 systemId, quint8 compId, mavlink_ if(wp->seq == current_wp_id) { - Waypoint *lwp = new Waypoint(wp->seq, wp->x, wp->y, wp->z, wp->yaw, wp->autocontinue, wp->current, wp->param1, wp->param2); + qDebug() << "Got WP: " << wp->seq << wp->x << wp->y << wp->z << wp->yaw << wp->autocontinue << wp->current << wp->param1 << wp->param2 << (MAV_FRAME) wp->frame << (MAV_ACTION) wp->action; + Waypoint *lwp = new Waypoint(wp->seq, wp->x, wp->y, wp->z, wp->yaw, wp->autocontinue, wp->current, wp->param1, wp->param2, (MAV_FRAME) wp->frame, (MAV_ACTION) wp->action); addWaypoint(lwp); //get next waypoint diff --git a/src/ui/WaypointList.cc b/src/ui/WaypointList.cc index 358668733e520872c54c7f14054bcd81f0559bc5..2eff2aad87c3b4c152ed92cddb2a779c0bc389a0 100644 --- a/src/ui/WaypointList.cc +++ b/src/ui/WaypointList.cc @@ -203,8 +203,6 @@ void WaypointList::add() Waypoint *wp = new Waypoint(0, uas->getLongitude(), uas->getLatitude(), uas->getAltitude(), 0.0, true, true, 0.15, 2000); uas->getWaypointManager().addWaypoint(wp); - - } } } diff --git a/src/ui/WaypointView.cc b/src/ui/WaypointView.cc index 5d1804741e02f7c534e6c7e04c4937c664f93742..b291fc8f24acc884c19c25c00dcdfb2105f4dd11 100644 --- a/src/ui/WaypointView.cc +++ b/src/ui/WaypointView.cc @@ -60,13 +60,13 @@ WaypointView::WaypointView(Waypoint* wp, QWidget* parent) : m_ui->comboBox_frame->addItem("Global",MAV_FRAME_GLOBAL); m_ui->comboBox_frame->addItem("Local",MAV_FRAME_LOCAL); - // defaults - changedAction(0); - changedFrame(wp->getFrame()); - // Read values and set user interface updateValues(); + // defaults + //changedAction(wp->getAction()); + //changedFrame(wp->getFrame()); + connect(m_ui->posNSpinBox, SIGNAL(valueChanged(double)), wp, SLOT(setX(double))); connect(m_ui->posESpinBox, SIGNAL(valueChanged(double)), wp, SLOT(setY(double))); connect(m_ui->posDSpinBox, SIGNAL(valueChanged(double)), wp, SLOT(setZ(double))); @@ -133,7 +133,7 @@ void WaypointView::changedAction(int index) m_ui->holdTimeSpinBox->hide(); // set waypoint action - MAV_ACTION action = (MAV_ACTION)m_ui->comboBox_action->itemData(index).toUInt(); + MAV_ACTION action = (MAV_ACTION) m_ui->comboBox_action->itemData(index).toUInt(); wp->setAction(action); // expose ui based on action @@ -206,7 +206,8 @@ void WaypointView::updateValues() { // update frame MAV_FRAME frame = wp->getFrame(); - changedFrame(m_ui->comboBox_frame->findData(frame)); + int frame_index = m_ui->comboBox_frame->findData(frame); + m_ui->comboBox_frame->setCurrentIndex(frame_index); switch(frame) { case(MAV_FRAME_LOCAL): @@ -220,11 +221,12 @@ void WaypointView::updateValues() m_ui->altSpinBox->setValue(wp->getZ()); break; } + changedFrame(frame_index); // update action MAV_ACTION action = wp->getAction(); - changedFrame(m_ui->comboBox_frame->findData(frame)); - changedAction(m_ui->comboBox_action->findData(action)); + int action_index = m_ui->comboBox_action->findData(action); + m_ui->comboBox_action->setCurrentIndex(action_index); switch(action) { case MAV_ACTION_TAKEOFF: @@ -238,6 +240,7 @@ void WaypointView::updateValues() default: std::cerr << "unknown action" << std::endl; } + changedAction(action_index); m_ui->yawSpinBox->setValue(wp->getYaw()/M_PI*180.); m_ui->selectedBox->setChecked(wp->getCurrent());