Commit bed216dd authored by lm's avatar lm

Fixed last waypoint widget issues

parent 58c62971
...@@ -36,7 +36,8 @@ This file is part of the PIXHAWK project ...@@ -36,7 +36,8 @@ This file is part of the PIXHAWK project
#include <QTimer> #include <QTimer>
#include <QStringList> #include <QStringList>
#ifdef Q_OS_MAC #ifdef Q_OS_MAC
#include <Phonon> #include <MediaObject>
#include <AudioOutput>
#endif #endif
#ifdef Q_OS_LINUX #ifdef Q_OS_LINUX
//#include <flite/flite.h> //#include <flite/flite.h>
......
...@@ -29,8 +29,10 @@ This file is part of the QGROUNDCONTROL project ...@@ -29,8 +29,10 @@ This file is part of the QGROUNDCONTROL project
* *
*/ */
#include "Waypoint.h"
#include <QStringList> #include <QStringList>
#include <QDebug>
#include "Waypoint.h"
Waypoint::Waypoint(quint16 _id, double _x, double _y, double _z, double _param1, double _param2, double _param3, double _param4, Waypoint::Waypoint(quint16 _id, double _x, double _y, double _z, double _param1, double _param2, double _param3, double _param4,
bool _autocontinue, bool _current, MAV_FRAME _frame, MAV_CMD _action) bool _autocontinue, bool _current, MAV_FRAME _frame, MAV_CMD _action)
...@@ -229,6 +231,8 @@ void Waypoint::setAcceptanceRadius(double radius) ...@@ -229,6 +231,8 @@ void Waypoint::setAcceptanceRadius(double radius)
void Waypoint::setParam1(double param1) void Waypoint::setParam1(double param1)
{ {
qDebug() << "SENDER:" << QObject::sender();
qDebug() << "PARAM1 SET REQ:" << param1;
if (this->param1 != param1) if (this->param1 != param1)
{ {
this->param1 = param1; this->param1 = param1;
......
...@@ -43,10 +43,10 @@ WaypointView::WaypointView(Waypoint* wp, QWidget* parent) : ...@@ -43,10 +43,10 @@ WaypointView::WaypointView(Waypoint* wp, QWidget* parent) :
m_ui->comboBox_action->addItem(tr("NAV: Loiter Turns"),MAV_CMD_NAV_LOITER_TURNS); m_ui->comboBox_action->addItem(tr("NAV: Loiter Turns"),MAV_CMD_NAV_LOITER_TURNS);
m_ui->comboBox_action->addItem(tr("NAV: Ret. to Launch"),MAV_CMD_NAV_RETURN_TO_LAUNCH); m_ui->comboBox_action->addItem(tr("NAV: Ret. to Launch"),MAV_CMD_NAV_RETURN_TO_LAUNCH);
m_ui->comboBox_action->addItem(tr("NAV: Land"),MAV_CMD_NAV_LAND); m_ui->comboBox_action->addItem(tr("NAV: Land"),MAV_CMD_NAV_LAND);
m_ui->comboBox_action->addItem(tr("NAV: Target"),MAV_CMD_NAV_TARGET); // m_ui->comboBox_action->addItem(tr("NAV: Target"),MAV_CMD_NAV_TARGET);
m_ui->comboBox_action->addItem(tr("IF: Delay over"),MAV_CMD_CONDITION_DELAY); //m_ui->comboBox_action->addItem(tr("IF: Delay over"),MAV_CMD_CONDITION_DELAY);
m_ui->comboBox_action->addItem(tr("IF: Yaw angle is"),MAV_CMD_CONDITION_YAW); //m_ui->comboBox_action->addItem(tr("IF: Yaw angle is"),MAV_CMD_CONDITION_YAW);
m_ui->comboBox_action->addItem(tr("DO: Jump to Index"),MAV_CMD_DO_JUMP); //m_ui->comboBox_action->addItem(tr("DO: Jump to Index"),MAV_CMD_DO_JUMP);
m_ui->comboBox_action->addItem(tr("Other"), MAV_CMD_ENUM_END); m_ui->comboBox_action->addItem(tr("Other"), MAV_CMD_ENUM_END);
// add frames // add frames
...@@ -261,6 +261,7 @@ void WaypointView::changedAction(int index) ...@@ -261,6 +261,7 @@ void WaypointView::changedAction(int index)
void WaypointView::changeViewMode(QGC_WAYPOINTVIEW_MODE mode) void WaypointView::changeViewMode(QGC_WAYPOINTVIEW_MODE mode)
{ {
viewMode = mode;
switch (mode) switch (mode)
{ {
case QGC_WAYPOINTVIEW_MODE_NAV: case QGC_WAYPOINTVIEW_MODE_NAV:
...@@ -285,6 +286,9 @@ void WaypointView::changeViewMode(QGC_WAYPOINTVIEW_MODE mode) ...@@ -285,6 +286,9 @@ void WaypointView::changeViewMode(QGC_WAYPOINTVIEW_MODE mode)
m_ui->lonSpinBox->hide(); m_ui->lonSpinBox->hide();
m_ui->altSpinBox->hide(); m_ui->altSpinBox->hide();
int action_index = m_ui->comboBox_action->findData(MAV_CMD_ENUM_END);
m_ui->comboBox_action->setCurrentIndex(action_index);
// Show action widget // Show action widget
if (!m_ui->customActionWidget->isVisible()) if (!m_ui->customActionWidget->isVisible())
{ {
...@@ -296,6 +300,7 @@ void WaypointView::changeViewMode(QGC_WAYPOINTVIEW_MODE mode) ...@@ -296,6 +300,7 @@ void WaypointView::changeViewMode(QGC_WAYPOINTVIEW_MODE mode)
} }
break; break;
} }
} }
void WaypointView::updateFrameView(int frame) void WaypointView::updateFrameView(int frame)
...@@ -438,9 +443,12 @@ void WaypointView::updateValues() ...@@ -438,9 +443,12 @@ void WaypointView::updateValues()
} }
else else
{ {
// Action ID known, update if (viewMode != QGC_WAYPOINTVIEW_MODE_DIRECT_EDITING)
m_ui->comboBox_action->setCurrentIndex(action_index); {
updateActionView(action); // Action ID known, update
m_ui->comboBox_action->setCurrentIndex(action_index);
updateActionView(action);
}
} }
} }
switch(action) switch(action)
...@@ -459,7 +467,9 @@ void WaypointView::updateValues() ...@@ -459,7 +467,9 @@ void WaypointView::updateValues()
if (m_ui->yawSpinBox->value() != wp->getYaw()) if (m_ui->yawSpinBox->value() != wp->getYaw())
{ {
if (!m_ui->yawSpinBox->isVisible()) m_ui->yawSpinBox->blockSignals(true);
m_ui->yawSpinBox->setValue(wp->getYaw()); m_ui->yawSpinBox->setValue(wp->getYaw());
if (!m_ui->yawSpinBox->isVisible()) m_ui->yawSpinBox->blockSignals(false);
} }
if (m_ui->selectedBox->isChecked() != wp->getCurrent()) if (m_ui->selectedBox->isChecked() != wp->getCurrent())
{ {
...@@ -472,23 +482,33 @@ void WaypointView::updateValues() ...@@ -472,23 +482,33 @@ void WaypointView::updateValues()
m_ui->idLabel->setText(QString("%1").arg(wp->getId())); m_ui->idLabel->setText(QString("%1").arg(wp->getId()));
if (m_ui->orbitSpinBox->value() != wp->getLoiterOrbit()) if (m_ui->orbitSpinBox->value() != wp->getLoiterOrbit())
{ {
if (!m_ui->orbitSpinBox->isVisible()) m_ui->orbitSpinBox->blockSignals(true);
m_ui->orbitSpinBox->setValue(wp->getLoiterOrbit()); m_ui->orbitSpinBox->setValue(wp->getLoiterOrbit());
if (!m_ui->orbitSpinBox->isVisible()) m_ui->orbitSpinBox->blockSignals(false);
} }
if (m_ui->acceptanceSpinBox->value() != wp->getAcceptanceRadius()) if (m_ui->acceptanceSpinBox->value() != wp->getAcceptanceRadius())
{ {
if (!m_ui->acceptanceSpinBox->isVisible()) m_ui->acceptanceSpinBox->blockSignals(true);
m_ui->acceptanceSpinBox->setValue(wp->getAcceptanceRadius()); m_ui->acceptanceSpinBox->setValue(wp->getAcceptanceRadius());
if (!m_ui->acceptanceSpinBox->isVisible()) m_ui->acceptanceSpinBox->blockSignals(false);
} }
if (m_ui->holdTimeSpinBox->value() != wp->getHoldTime()) if (m_ui->holdTimeSpinBox->value() != wp->getHoldTime())
{ {
if (!m_ui->holdTimeSpinBox->isVisible()) m_ui->holdTimeSpinBox->blockSignals(true);
m_ui->holdTimeSpinBox->setValue(wp->getHoldTime()); m_ui->holdTimeSpinBox->setValue(wp->getHoldTime());
if (!m_ui->holdTimeSpinBox->isVisible()) m_ui->holdTimeSpinBox->blockSignals(false);
} }
if (m_ui->turnsSpinBox->value() != wp->getTurns()) if (m_ui->turnsSpinBox->value() != wp->getTurns())
{ {
if (!m_ui->turnsSpinBox->isVisible()) m_ui->turnsSpinBox->blockSignals(true);
m_ui->turnsSpinBox->setValue(wp->getTurns()); m_ui->turnsSpinBox->setValue(wp->getTurns());
if (!m_ui->turnsSpinBox->isVisible()) m_ui->turnsSpinBox->blockSignals(false);
} }
if (m_ui->takeOffAngleSpinBox->value() != wp->getParam1()) if (m_ui->takeOffAngleSpinBox->value() != wp->getParam1())
{ {
if (!m_ui->takeOffAngleSpinBox->isVisible()) m_ui->takeOffAngleSpinBox->blockSignals(true);
m_ui->takeOffAngleSpinBox->setValue(wp->getParam1()); m_ui->takeOffAngleSpinBox->setValue(wp->getParam1());
if (!m_ui->takeOffAngleSpinBox->isVisible()) m_ui->takeOffAngleSpinBox->blockSignals(false);
} }
// UPDATE CUSTOM ACTION WIDGET // UPDATE CUSTOM ACTION WIDGET
......
...@@ -6,14 +6,14 @@ ...@@ -6,14 +6,14 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>1105</width> <width>1228</width>
<height>25</height> <height>25</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>Form</string> <string>Form</string>
</property> </property>
<layout class="QHBoxLayout" name="horizontalLayout" stretch="10,10,10,10,10,10,0,0"> <layout class="QHBoxLayout" name="horizontalLayout" stretch="10,0,10,10,10,10,0,0">
<property name="spacing"> <property name="spacing">
<number>5</number> <number>5</number>
</property> </property>
......
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