From 092079fb513b5dc975e166344511fe32ceac5737 Mon Sep 17 00:00:00 2001 From: Philippe Renon Date: Thu, 8 Sep 2016 19:58:47 +0200 Subject: [PATCH 1/3] LP-404 make Makefile more vendor neutral --- Makefile | 39 ++++++++++---------- ground/gcs/src/plugins/uploader/uploader.pro | 7 ++-- 2 files changed, 24 insertions(+), 22 deletions(-) diff --git a/Makefile b/Makefile index ff952865c..318931eb6 100644 --- a/Makefile +++ b/Makefile @@ -50,9 +50,9 @@ export TOOLS_DIR export BUILD_DIR := $(CURDIR)/build export PACKAGE_DIR := $(BUILD_DIR)/package export DIST_DIR := $(BUILD_DIR)/dist -export OPGCSSYNTHDIR := $(BUILD_DIR)/gcs-synthetics +export GCS_SYNTH_DIR := $(BUILD_DIR)/gcs-synthetics -DIRS := $(DL_DIR) $(TOOLS_DIR) $(BUILD_DIR) $(PACKAGE_DIR) $(DIST_DIR) $(OPGCSSYNTHDIR) +DIRS := $(DL_DIR) $(TOOLS_DIR) $(BUILD_DIR) $(PACKAGE_DIR) $(DIST_DIR) $(GCS_SYNTH_DIR) # Naming for binaries and packaging etc,. export ORG_BIG_NAME := LibrePilot @@ -225,9 +225,9 @@ uavobjects_clean: # When building any of the "all_*" targets, tell all sub makefiles to display # additional details on each line of output to describe which build and target -# that each line applies to. The same applies also to all, opfw_resource, +# that each line applies to. The same applies also to all, fw_resource, # package targets -ifneq ($(strip $(filter all_% all opfw_resource package,$(MAKECMDGOALS))),) +ifneq ($(strip $(filter all_% all fw_resource package,$(MAKECMDGOALS))),) export ENABLE_MSG_EXTRA := yes endif @@ -323,38 +323,39 @@ PACKAGE_FW_TARGETS := fw_coptercontrol fw_oplinkmini fw_revolution fw_osd fw_rev # Rules to generate GCS resources used to embed firmware binaries into the GCS. # They are used later by the vehicle setup wizard to update board firmware. # To open a firmware image use ":/firmware/fw_coptercontrol.opfw" -OPFW_RESOURCE := $(OPGCSSYNTHDIR)/opfw_resource.qrc +FW_RESOURCE := $(GCS_SYNTH_DIR)/fw_resource.qrc ifeq ($(WITH_PREBUILT_FW),) FIRMWARE_DIR := $(FLIGHT_OUT_DIR) # We need to build the FW targets -$(OPFW_RESOURCE): $(PACKAGE_FW_TARGETS) +$(FW_RESOURCE): $(PACKAGE_FW_TARGETS) else FIRMWARE_DIR := $(WITH_PREBUILT_FW) endif -OPFW_FILES := $(foreach fw_targ, $(PACKAGE_FW_TARGETS), $(FIRMWARE_DIR)/$(fw_targ)/$(fw_targ).opfw) -OPFW_CONTENTS := \ +FW_FILES := $(foreach fw_targ, $(PACKAGE_FW_TARGETS), $(FIRMWARE_DIR)/$(fw_targ)/$(fw_targ).opfw) +FW_CONTENTS := \ \ \ - $(foreach fw_file, $(OPFW_FILES), $(call system_path,$(fw_file))) \ + $(foreach fw_file, $(FW_FILES), $(call system_path,$(fw_file))) \ \ -.PHONY: opfw_resource -opfw_resource: $(OPFW_RESOURCE) +.PHONY: fw_resource +fw_resource: $(FW_RESOURCE) +fw_resource: $(FW_RESOURCE) -$(OPFW_RESOURCE): | $(OPGCSSYNTHDIR) - @$(ECHO) Generating OPFW resource file $(call toprel, $@) - $(V1) $(ECHO) $(QUOTE)$(OPFW_CONTENTS)$(QUOTE) > $@ +$(FW_RESOURCE): | $(GCS_SYNTH_DIR) + @$(ECHO) Generating FW resource file $(call toprel, $@) + $(V1) $(ECHO) $(QUOTE)$(FW_CONTENTS)$(QUOTE) > $@ -# If opfw_resource or all firmware are requested, GCS should depend on the resource -ifneq ($(strip $(filter opfw_resource all all_fw all_flight package,$(MAKECMDGOALS))),) -$(GCS_MAKEFILE): $(OPFW_RESOURCE) +# If fw_resource or all firmware are requested, GCS should depend on the resource +ifneq ($(strip $(filter fw_resource all all_fw all_flight package,$(MAKECMDGOALS))),) +$(GCS_MAKEFILE): $(FW_RESOURCE) endif # Packaging targets: package -# - builds all firmware, opfw_resource, gcs +# - builds all firmware, fw_resource, gcs # - copies firmware into a package directory # - calls paltform-specific packaging script @@ -712,7 +713,7 @@ help: @$(ECHO) @$(ECHO) " [Packaging]" @$(ECHO) " package - Build and package the platform-dependent package (no clean)" - @$(ECHO) " opfw_resource - Generate resources to embed firmware binaries into the GCS" + @$(ECHO) " fw_resource - Generate resources to embed firmware binaries into the GCS" @$(ECHO) " dist - Generate source archive for distribution" @$(ECHO) " fw_dist - Generate archive of firmware" @$(ECHO) " install - Install GCS to \"DESTDIR\" with prefix \"prefix\" (Linux only)" diff --git a/ground/gcs/src/plugins/uploader/uploader.pro b/ground/gcs/src/plugins/uploader/uploader.pro index 23990f5a2..0d4c97441 100644 --- a/ground/gcs/src/plugins/uploader/uploader.pro +++ b/ground/gcs/src/plugins/uploader/uploader.pro @@ -63,8 +63,9 @@ FORMS += \ RESOURCES += uploader.qrc -exists( ../../../../../build/gcs-synthetics/opfw_resource.qrc ) { - RESOURCES += ../../../../../build/gcs-synthetics/opfw_resource.qrc +# TODO should use GCS_SYNTH_DIR... but that will break QtCreator +exists( ../../../../../build/gcs-synthetics/fw_resource.qrc ) { + RESOURCES += ../../../../../build/gcs-synthetics/fw_resource.qrc } else { - message("opfw_resource.qrc is not available, automatic firmware upgrades are disabled") + message("fw_resource.qrc is not available, automatic firmware upgrades are disabled") } From 365f0ca3ad503c9850e3ce6a8487f5a307d64ece Mon Sep 17 00:00:00 2001 From: Philippe Renon Date: Mon, 10 Oct 2016 18:49:11 +0200 Subject: [PATCH 2/3] LP-430 add description to serial devices display name will show in the Connections drop down --- ground/gcs/src/plugins/serialconnection/serialplugin.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ground/gcs/src/plugins/serialconnection/serialplugin.cpp b/ground/gcs/src/plugins/serialconnection/serialplugin.cpp index dcaed9919..3bc11cc3f 100644 --- a/ground/gcs/src/plugins/serialconnection/serialplugin.cpp +++ b/ground/gcs/src/plugins/serialconnection/serialplugin.cpp @@ -139,11 +139,16 @@ QList SerialConnection::availableDevices() // sort the list by port number (nice idea from PT_Dreamer :)) qSort(ports.begin(), ports.end(), sortPorts); + foreach(QSerialPortInfo port, ports) { device d; - d.displayName = port.portName(); d.name = port.portName(); + d.displayName = port.portName(); + if (!port.description().isEmpty()) { + d.displayName += " - " + port.description(); + } + list.append(d); } } From 4a6573db1ed6d3c003fc75f3c461a3e43c21ba57 Mon Sep 17 00:00:00 2001 From: Philippe Renon Date: Thu, 20 Oct 2016 00:27:30 +0200 Subject: [PATCH 3/3] LP-430 show serial port description as tooltip in connection drop down --- .../plugins/coreplugin/connectionmanager.cpp | 26 ++++++++++++++++++- .../plugins/coreplugin/connectionmanager.h | 12 +++------ .../gcs/src/plugins/coreplugin/iconnection.h | 1 + .../plugins/serialconnection/serialplugin.cpp | 4 +-- 4 files changed, 31 insertions(+), 12 deletions(-) diff --git a/ground/gcs/src/plugins/coreplugin/connectionmanager.cpp b/ground/gcs/src/plugins/coreplugin/connectionmanager.cpp index a225b97e6..1e1cc0410 100644 --- a/ground/gcs/src/plugins/coreplugin/connectionmanager.cpp +++ b/ground/gcs/src/plugins/coreplugin/connectionmanager.cpp @@ -40,6 +40,30 @@ #include namespace Core { +QString DevListItem::getConName() const +{ + if (connection == NULL) { + return ""; + } + return connection->shortName() + ": " + device.displayName; +} + +QString DevListItem::getConDescription() const +{ + if (connection == NULL) { + return ""; + } + QString description = device.displayName; + if (!device.description.isEmpty()) { + description += " - " + device.description; + } + // truncate description if too long + if (description.length() > 50) { + description = description.left(50) + "..."; + } + return description; +} + ConnectionManager::ConnectionManager(Internal::MainWindow *mainWindow) : QWidget(mainWindow), m_availableDevList(0), @@ -458,7 +482,7 @@ void ConnectionManager::updateConnectionDropdown() // add all the list again to the combobox foreach(DevListItem d, m_devList) { m_availableDevList->addItem(d.getConName()); - m_availableDevList->setItemData(m_availableDevList->count() - 1, d.getConName(), Qt::ToolTipRole); + m_availableDevList->setItemData(m_availableDevList->count() - 1, d.getConDescription(), Qt::ToolTipRole); if (!m_ioDev && d.getConName().startsWith("USB")) { if (m_mainWindow->generalSettings()->autoConnect() || m_mainWindow->generalSettings()->autoSelect()) { m_availableDevList->setCurrentIndex(m_availableDevList->count() - 1); diff --git a/ground/gcs/src/plugins/coreplugin/connectionmanager.h b/ground/gcs/src/plugins/coreplugin/connectionmanager.h index b19cc7c5d..50a9257a4 100644 --- a/ground/gcs/src/plugins/coreplugin/connectionmanager.h +++ b/ground/gcs/src/plugins/coreplugin/connectionmanager.h @@ -49,20 +49,16 @@ namespace Internal { class MainWindow; } // namespace Internal -class DevListItem { +class CORE_EXPORT DevListItem { public: DevListItem(IConnection *c, IConnection::device d) : connection(c), device(d) {} DevListItem() : connection(NULL) {} - QString getConName() - { - if (connection == NULL) { - return ""; - } - return connection->shortName() + ": " + device.displayName; - } + QString getConName() const; + + QString getConDescription() const; bool operator==(const DevListItem &rhs) { diff --git a/ground/gcs/src/plugins/coreplugin/iconnection.h b/ground/gcs/src/plugins/coreplugin/iconnection.h index a5ebbc17d..3a1de98f7 100644 --- a/ground/gcs/src/plugins/coreplugin/iconnection.h +++ b/ground/gcs/src/plugins/coreplugin/iconnection.h @@ -50,6 +50,7 @@ public: struct device { QString name; QString displayName; + QString description; bool operator==(device i) { return this->name == i.name; diff --git a/ground/gcs/src/plugins/serialconnection/serialplugin.cpp b/ground/gcs/src/plugins/serialconnection/serialplugin.cpp index 3bc11cc3f..964ec45e7 100644 --- a/ground/gcs/src/plugins/serialconnection/serialplugin.cpp +++ b/ground/gcs/src/plugins/serialconnection/serialplugin.cpp @@ -145,9 +145,7 @@ QList SerialConnection::availableDevices() d.name = port.portName(); d.displayName = port.portName(); - if (!port.description().isEmpty()) { - d.displayName += " - " + port.description(); - } + d.description = port.description(); list.append(d); }