From 5dcdc1ecb1c65f4283d3755db8b35ee3668fb96f Mon Sep 17 00:00:00 2001 From: lm Date: Mon, 24 Jan 2011 18:07:44 +0100 Subject: [PATCH] Fixed CRLF, fixed some graphic issues, improved other minor things --- src/comm/MAVLinkSimulationLink.cc | 1 + src/uas/UASInterface.h | 17 ++++++++-------- src/ui/DebugConsole.cc | 33 +++++++++++++++++++++++-------- src/ui/DebugConsole.h | 2 ++ src/ui/DebugConsole.ui | 14 +++++++++++-- src/ui/UASView.ui | 10 ++++++++-- src/ui/designer/QGCToolWidget.cc | 3 +++ src/ui/map/MAV2DIcon.cc | 1 + src/ui/uas/UASView.cc | 3 ++- 9 files changed, 63 insertions(+), 21 deletions(-) diff --git a/src/comm/MAVLinkSimulationLink.cc b/src/comm/MAVLinkSimulationLink.cc index c8039c505..7920a4be6 100644 --- a/src/comm/MAVLinkSimulationLink.cc +++ b/src/comm/MAVLinkSimulationLink.cc @@ -957,6 +957,7 @@ bool MAVLinkSimulationLink::connect() start(LowPriority); MAVLinkSimulationMAV* mav1 = new MAVLinkSimulationMAV(this, 1); + MAVLinkSimulationMAV* mav3 = new MAVLinkSimulationMAV(this, 2); Q_UNUSED(mav1); // timer->start(rate); return true; diff --git a/src/uas/UASInterface.h b/src/uas/UASInterface.h index 8e584e607..cf7f65b48 100644 --- a/src/uas/UASInterface.h +++ b/src/uas/UASInterface.h @@ -103,14 +103,15 @@ public: enum Airframe { QGC_AIRFRAME_GENERIC = 0, - QGC_AIRFRAME_EASYSTAR = 1, - QGC_AIRFRAME_TWINSTAR = 2, - QGC_AIRFRAME_MERLIN = 3, - QGC_AIRFRAME_CHEETAH = 4, - QGC_AIRFRAME_MIKROKOPTER = 5, - QGC_AIRFRAME_REAPER = 6, - QGC_AIRFRAME_PREDATOR = 7, - QGC_AIRFRAME_COAXIAL = 8 + QGC_AIRFRAME_EASYSTAR, + QGC_AIRFRAME_TWINSTAR, + QGC_AIRFRAME_MERLIN, + QGC_AIRFRAME_CHEETAH, + QGC_AIRFRAME_MIKROKOPTER, + QGC_AIRFRAME_REAPER, + QGC_AIRFRAME_PREDATOR, + QGC_AIRFRAME_COAXIAL, + QGC_AIRFRAME_PTERYX }; /** diff --git a/src/ui/DebugConsole.cc b/src/ui/DebugConsole.cc index 7c6c112a7..820b7d340 100644 --- a/src/ui/DebugConsole.cc +++ b/src/ui/DebugConsole.cc @@ -64,6 +64,8 @@ DebugConsole::DebugConsole(QWidget *parent) : m_ui->setupUi(this); // Hide sent text field - it is only useful after send has been hit m_ui->sentText->setVisible(false); + // Hide auto-send checkbox + m_ui->specialCheckBox->setVisible(false); // Make text area not editable m_ui->receiveText->setReadOnly(true); // Limit to 500 lines @@ -109,6 +111,8 @@ DebugConsole::DebugConsole(QWidget *parent) : connect(m_ui->connectButton, SIGNAL(clicked()), this, SLOT(handleConnectButton())); // Connect the special chars combo box connect(m_ui->addSymbolButton, SIGNAL(clicked()), this, SLOT(appendSpecialSymbol())); + // Connect Checkbox + connect(m_ui->specialComboBox, SIGNAL(highlighted(QString)), this, SLOT(specialSymbolSelected(QString))); hold(false); @@ -270,7 +274,7 @@ void DebugConsole::receiveBytes(LinkInterface* link, QByteArray bytes) for (int j = 0; j < bytes.size(); j++) { unsigned char byte = bytes.at(j); - // Filter MAVLink (http://pixhawk.ethz.ch/mavlink) messages out of the stream. + // Filter MAVLink (http://pixhawk.ethz.ch/wiki/mavlink/) messages out of the stream. if (filterMAVLINK && bytes.size() > 1) { // Filtering is done by setting an ignore counter based on the MAVLINK packet length @@ -288,12 +292,13 @@ void DebugConsole::receiveBytes(LinkInterface* link, QByteArray bytes) switch (byte) { // Catch line feed - case (unsigned char)'\n': - m_ui->receiveText->appendPlainText(str); - str = ""; - break; - // Catch carriage return - case (unsigned char)'\r': +// case (unsigned char)'\n': +// m_ui->receiveText->appendPlainText(str); +// str = ""; +// break; + // Catch carriage return and line feed + case (unsigned char)0xD: + case (unsigned char)0xA: // Ignore break; default: @@ -323,7 +328,7 @@ void DebugConsole::receiveBytes(LinkInterface* link, QByteArray bytes) } } - m_ui->receiveText->appendPlainText(lineBuffer); + if (lineBuffer.length() > 0) m_ui->receiveText->appendPlainText(lineBuffer); lineBuffer.clear(); } @@ -376,6 +381,12 @@ QByteArray DebugConsole::symbolNameToBytes(const QString& text) return b; } +void DebugConsole::specialSymbolSelected(const QString& text) +{ + Q_UNUSED(text); + m_ui->specialCheckBox->setVisible(true); +} + void DebugConsole::appendSpecialSymbol(const QString& text) { QString line = m_ui->sendText->text(); @@ -415,6 +426,12 @@ void DebugConsole::sendBytes() return; } + // Append special symbol if checkbox is checked + if (m_ui->specialCheckBox->isChecked()) + { + appendSpecialSymbol(m_ui->specialComboBox->currentText()); + } + QByteArray transmit; QString feedback; bool ok = true; diff --git a/src/ui/DebugConsole.h b/src/ui/DebugConsole.h index db22a1af5..a441d84f4 100644 --- a/src/ui/DebugConsole.h +++ b/src/ui/DebugConsole.h @@ -87,6 +87,8 @@ public slots: void appendSpecialSymbol(const QString& text); /** @brief Append the special symbol currently selected in combo box */ void appendSpecialSymbol(); + /** @brief A new special symbol is selected */ + void specialSymbolSelected(const QString& text); protected slots: /** @brief Draw information overlay */ diff --git a/src/ui/DebugConsole.ui b/src/ui/DebugConsole.ui index bf7b09233..bb32e331b 100644 --- a/src/ui/DebugConsole.ui +++ b/src/ui/DebugConsole.ui @@ -6,7 +6,7 @@ 0 0 - 469 + 466 190 @@ -120,7 +120,7 @@ - + 5 @@ -204,6 +204,16 @@ + + + + Automatically send special char at end of message + + + Auto-Add + + + diff --git a/src/ui/UASView.ui b/src/ui/UASView.ui index 3daf1479f..acdc5dbd6 100644 --- a/src/ui/UASView.ui +++ b/src/ui/UASView.ui @@ -6,12 +6,12 @@ 0 0 - 310 + 260 111 - + 0 0 @@ -22,6 +22,12 @@ 0 + + + 360 + 16777215 + + Form diff --git a/src/ui/designer/QGCToolWidget.cc b/src/ui/designer/QGCToolWidget.cc index 9dc23f98b..dad5c8a3f 100644 --- a/src/ui/designer/QGCToolWidget.cc +++ b/src/ui/designer/QGCToolWidget.cc @@ -221,6 +221,7 @@ void QGCToolWidget::addParam() if (ui->hintLabel) { ui->hintLabel->deleteLater(); + ui->hintLabel = NULL; } toolLayout->addWidget(slider); slider->startEditMode(); @@ -232,6 +233,7 @@ void QGCToolWidget::addAction() if (ui->hintLabel) { ui->hintLabel->deleteLater(); + ui->hintLabel = NULL; } toolLayout->addWidget(button); button->startEditMode(); @@ -242,6 +244,7 @@ void QGCToolWidget::addToolWidget(QGCToolWidgetItem* widget) if (ui->hintLabel) { ui->hintLabel->deleteLater(); + ui->hintLabel = NULL; } toolLayout->addWidget(widget); } diff --git a/src/ui/map/MAV2DIcon.cc b/src/ui/map/MAV2DIcon.cc index 1e2dc7651..18440d697 100644 --- a/src/ui/map/MAV2DIcon.cc +++ b/src/ui/map/MAV2DIcon.cc @@ -191,6 +191,7 @@ void MAV2DIcon::drawIcon(QPen* pen) case UASInterface::QGC_AIRFRAME_EASYSTAR: case UASInterface::QGC_AIRFRAME_MERLIN: case UASInterface::QGC_AIRFRAME_TWINSTAR: + case UASInterface::QGC_AIRFRAME_PTERYX: { // DRAW AIRPLANE diff --git a/src/ui/uas/UASView.cc b/src/ui/uas/UASView.cc index bcde6a526..59de83d6a 100644 --- a/src/ui/uas/UASView.cc +++ b/src/ui/uas/UASView.cc @@ -452,7 +452,8 @@ void UASView::selectAirframe() << "Mikrokopter" << "Reaper" << "Predator" - << "Coaxial"; + << "Coaxial" + << "Pteryx"; bool ok; QString item = QInputDialog::getItem(this, tr("Select Airframe for %1").arg(uas->getUASName()), -- 2.22.0