From a24375ca716c12b4600f6c8267ac460355c6e35f Mon Sep 17 00:00:00 2001 From: James Cotton Date: Sat, 26 May 2012 03:07:36 -0500 Subject: [PATCH 1/2] Fix bug introduced with PiPX merge where the refreshWidgetsValues(UAVObject *) gained the parameter. However, objects that had overriden that method were now creating a new method and not getting called at the right time. This fixes the Output and Aircraft type panels --- ground/openpilotgcs/src/plugins/config/config_pro_hw_widget.cpp | 2 +- ground/openpilotgcs/src/plugins/config/configoutputwidget.cpp | 2 +- ground/openpilotgcs/src/plugins/config/configoutputwidget.h | 2 +- .../openpilotgcs/src/plugins/config/configvehicletypewidget.cpp | 2 +- .../openpilotgcs/src/plugins/config/configvehicletypewidget.h | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ground/openpilotgcs/src/plugins/config/config_pro_hw_widget.cpp b/ground/openpilotgcs/src/plugins/config/config_pro_hw_widget.cpp index c554cae31..0f050cbc2 100644 --- a/ground/openpilotgcs/src/plugins/config/config_pro_hw_widget.cpp +++ b/ground/openpilotgcs/src/plugins/config/config_pro_hw_widget.cpp @@ -43,7 +43,7 @@ ConfigProHWWidget::ConfigProHWWidget(QWidget *parent) : ConfigTaskWidget(parent) addUAVObjectToWidgetRelation("HwSettings","TelemetrySpeed",m_telemetry->telemetrySpeed); enableControls(false); populateWidgets(); - refreshWidgetsValues(); + refreshWidgetsValues(NULL); } ConfigProHWWidget::~ConfigProHWWidget() diff --git a/ground/openpilotgcs/src/plugins/config/configoutputwidget.cpp b/ground/openpilotgcs/src/plugins/config/configoutputwidget.cpp index 4b2f260b8..ff0927709 100644 --- a/ground/openpilotgcs/src/plugins/config/configoutputwidget.cpp +++ b/ground/openpilotgcs/src/plugins/config/configoutputwidget.cpp @@ -242,7 +242,7 @@ void ConfigOutputWidget::sendChannelTest(int index, int value) /** Request the current config from the board (RC Output) */ -void ConfigOutputWidget::refreshWidgetsValues() +void ConfigOutputWidget::refreshWidgetsValues(UAVObject *) { bool dirty=isDirty(); diff --git a/ground/openpilotgcs/src/plugins/config/configoutputwidget.h b/ground/openpilotgcs/src/plugins/config/configoutputwidget.h index b20839aa4..4602487ba 100644 --- a/ground/openpilotgcs/src/plugins/config/configoutputwidget.h +++ b/ground/openpilotgcs/src/plugins/config/configoutputwidget.h @@ -69,7 +69,7 @@ private: private slots: void stopTests(); void disableIfNotMe(UAVObject *obj); - virtual void refreshWidgetsValues(); + virtual void refreshWidgetsValues(UAVObject * obj = NULL); void updateObjectsFromWidgets(); void runChannelTests(bool state); void sendChannelTest(int index, int value); diff --git a/ground/openpilotgcs/src/plugins/config/configvehicletypewidget.cpp b/ground/openpilotgcs/src/plugins/config/configvehicletypewidget.cpp index 21d47a77a..ceffdccc6 100644 --- a/ground/openpilotgcs/src/plugins/config/configvehicletypewidget.cpp +++ b/ground/openpilotgcs/src/plugins/config/configvehicletypewidget.cpp @@ -525,7 +525,7 @@ void ConfigVehicleTypeWidget::updateCustomThrottle2CurveValue(QList list /** Refreshes the current value of the SystemSettings which holds the aircraft type */ -void ConfigVehicleTypeWidget::refreshWidgetsValues() +void ConfigVehicleTypeWidget::refreshWidgetsValues(UAVObject *) { if(!allObjectsUpdated()) return; diff --git a/ground/openpilotgcs/src/plugins/config/configvehicletypewidget.h b/ground/openpilotgcs/src/plugins/config/configvehicletypewidget.h index 9c6daf16e..7d1e4ec88 100644 --- a/ground/openpilotgcs/src/plugins/config/configvehicletypewidget.h +++ b/ground/openpilotgcs/src/plugins/config/configvehicletypewidget.h @@ -76,7 +76,7 @@ private: UAVObject::Metadata accInitialData; private slots: - virtual void refreshWidgetsValues(); + virtual void refreshWidgetsValues(UAVObject * obj = NULL); void refreshFixedWingWidgetsValues(QString frameType); void refreshMultiRotorWidgetsValues(QString frameType); void refreshGroundVehicleWidgetsValues(QString frameType); From f1f01f2b4b6634e6ae4934292a4e093aa359591c Mon Sep 17 00:00:00 2001 From: James Cotton Date: Sat, 26 May 2012 09:46:29 -0500 Subject: [PATCH 2/2] Fix uploader gadget to not throw warnings when uploading to CC3D. Also added a different icon to it. The description is still "CC3D" for "CopterControl". The whole names/board types/etc really needs centralizing into devicedescriptorstructure which should become a general class for checking if firmware is good etc. --- .../uavobjectutil/devicedescriptorstruct.h | 17 +- .../src/plugins/uploader/devicewidget.cpp | 28 +- .../src/plugins/uploader/devicewidget.h | 1 - .../plugins/uploader/images/deviceID-0402.svg | 2389 +++++++++++++++++ .../src/plugins/uploader/uploader.qrc | 1 + 5 files changed, 2406 insertions(+), 30 deletions(-) create mode 100644 ground/openpilotgcs/src/plugins/uploader/images/deviceID-0402.svg diff --git a/ground/openpilotgcs/src/plugins/uavobjectutil/devicedescriptorstruct.h b/ground/openpilotgcs/src/plugins/uavobjectutil/devicedescriptorstruct.h index bf8fafb19..a725c0bfe 100644 --- a/ground/openpilotgcs/src/plugins/uavobjectutil/devicedescriptorstruct.h +++ b/ground/openpilotgcs/src/plugins/uavobjectutil/devicedescriptorstruct.h @@ -12,18 +12,23 @@ public: int boardRevision; static QString idToBoardName(int id) { - switch (id | 0x0011) { - case 0x0111://MB + switch (id) { + case 0x0101://MB return QString("OpenPilot MainBoard"); break; - case 0x0311://PipX + case 0x0201://INS + return QString("OpenPilot INS"); + break; + case 0x0301://PipX return QString("PipXtreame"); break; - case 0x0411://Coptercontrol + case 0x0401://Coptercontrol return QString("CopterControl"); break; - case 0x0211://INS - return QString("OpenPilot INS"); + case 0x0402://Coptercontrol + // It would be nice to say CC3D here but since currently we use string comparisons + // for firmware compatibility and the filename path that would break + return QString("CopterControl"); break; default: return QString(""); diff --git a/ground/openpilotgcs/src/plugins/uploader/devicewidget.cpp b/ground/openpilotgcs/src/plugins/uploader/devicewidget.cpp index 0393d5534..e3ca707b3 100644 --- a/ground/openpilotgcs/src/plugins/uploader/devicewidget.cpp +++ b/ground/openpilotgcs/src/plugins/uploader/devicewidget.cpp @@ -78,27 +78,6 @@ void deviceWidget::setDfu(DFUObject *dfu) m_dfu = dfu; } -QString deviceWidget::idToBoardName(int id) -{ - switch (id | 0x0011) { - case 0x0111://MB - return QString("OpenPilot MainBoard"); - break; - case 0x0311://PipX - return QString("PipXtreme"); - break; - case 0x0411://Coptercontrol - return QString("CopterControl"); - break; - case 0x0211://INS - return QString("OpenPilot INS"); - break; - default: - return QString(""); - break; - } -} - /** Fills the various fields for the device */ @@ -125,6 +104,9 @@ void deviceWidget::populate() case 0x0401: devicePic->renderer()->load(QString(":/uploader/images/deviceID-0401.svg")); break; + case 0x0402: + devicePic->renderer()->load(QString(":/uploader/images/deviceID-0402.svg")); + break; case 0x0201: devicePic->renderer()->load(QString(":/uploader/images/deviceID-0201.svg")); break; @@ -200,7 +182,7 @@ bool deviceWidget::populateBoardStructuredDescription(QByteArray desc) myDevice->lblCertified->setToolTip(tr("Untagged or custom firmware build")); } - myDevice->lblBrdName->setText(idToBoardName(onBoardDescription.boardType<<8)); + myDevice->lblBrdName->setText(deviceDescriptorStruct::idToBoardName(onBoardDescription.boardType << 8 | onBoardDescription.boardRevision)); return true; } @@ -230,7 +212,7 @@ bool deviceWidget::populateLoadedStructuredDescription(QByteArray desc) myDevice->lblCertifiedL->setPixmap(pix); myDevice->lblCertifiedL->setToolTip(tr("Untagged or custom firmware build")); } - myDevice->lblBrdNameL->setText(deviceDescriptorStruct::idToBoardName(LoadedDescription.boardType<<8)); + myDevice->lblBrdNameL->setText(deviceDescriptorStruct::idToBoardName(LoadedDescription.boardType << 8 | LoadedDescription.boardRevision)); return true; } diff --git a/ground/openpilotgcs/src/plugins/uploader/devicewidget.h b/ground/openpilotgcs/src/plugins/uploader/devicewidget.h index 6415985df..202023d50 100644 --- a/ground/openpilotgcs/src/plugins/uploader/devicewidget.h +++ b/ground/openpilotgcs/src/plugins/uploader/devicewidget.h @@ -59,7 +59,6 @@ private: deviceDescriptorStruct onBoardDescription; deviceDescriptorStruct LoadedDescription; QByteArray loadedFW; - QString idToBoardName(int id); Ui_deviceWidget *myDevice; int deviceID; DFUObject *m_dfu; diff --git a/ground/openpilotgcs/src/plugins/uploader/images/deviceID-0402.svg b/ground/openpilotgcs/src/plugins/uploader/images/deviceID-0402.svg new file mode 100644 index 000000000..90121943d --- /dev/null +++ b/ground/openpilotgcs/src/plugins/uploader/images/deviceID-0402.svg @@ -0,0 +1,2389 @@ + + + +image/svg+xmlCC3D + \ No newline at end of file diff --git a/ground/openpilotgcs/src/plugins/uploader/uploader.qrc b/ground/openpilotgcs/src/plugins/uploader/uploader.qrc index 7d2677927..083eab94d 100644 --- a/ground/openpilotgcs/src/plugins/uploader/uploader.qrc +++ b/ground/openpilotgcs/src/plugins/uploader/uploader.qrc @@ -12,5 +12,6 @@ images/application-certificate.svg images/warning.svg images/error.svg + images/deviceID-0402.svg