1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-02-22 12:54:14 +01:00

Merge branch 'next' of ssh://gitolite@git.openpilot.org/OpenPilot.git into MikeL_ConfigVehicle

This commit is contained in:
Mike LaBranche 2012-06-26 16:43:06 -07:00
commit 3a8429d89b
14 changed files with 338 additions and 116 deletions

View File

@ -518,6 +518,7 @@ uavobjects_clean:
# $(1) = Canonical board name all in lower case (e.g. coptercontrol) # $(1) = Canonical board name all in lower case (e.g. coptercontrol)
# $(2) = Name of board used in source tree (e.g. CopterControl) # $(2) = Name of board used in source tree (e.g. CopterControl)
# $(3) = Short name for board (e.g CC)
define FW_TEMPLATE define FW_TEMPLATE
.PHONY: $(1) fw_$(1) .PHONY: $(1) fw_$(1)
$(1): fw_$(1)_opfw $(1): fw_$(1)_opfw
@ -528,6 +529,8 @@ fw_$(1)_%: uavobjects_flight
$(V1) cd $(ROOT_DIR)/flight/$(2) && \ $(V1) cd $(ROOT_DIR)/flight/$(2) && \
$$(MAKE) -r --no-print-directory \ $$(MAKE) -r --no-print-directory \
BOARD_NAME=$(1) \ BOARD_NAME=$(1) \
BOARD_SHORT_NAME=$(3) \
BUILD_TYPE=fw \
TCHAIN_PREFIX="$(ARM_SDK_PREFIX)" \ TCHAIN_PREFIX="$(ARM_SDK_PREFIX)" \
REMOVE_CMD="$(RM)" OOCD_EXE="$(OPENOCD)" \ REMOVE_CMD="$(RM)" OOCD_EXE="$(OPENOCD)" \
$$* $$*
@ -551,6 +554,8 @@ bl_$(1)_%:
$(V1) cd $(ROOT_DIR)/flight/Bootloaders/$(2) && \ $(V1) cd $(ROOT_DIR)/flight/Bootloaders/$(2) && \
$$(MAKE) -r --no-print-directory \ $$(MAKE) -r --no-print-directory \
BOARD_NAME=$(1) \ BOARD_NAME=$(1) \
BOARD_SHORT_NAME=$(3) \
BUILD_TYPE=bl \
TCHAIN_PREFIX="$(ARM_SDK_PREFIX)" \ TCHAIN_PREFIX="$(ARM_SDK_PREFIX)" \
REMOVE_CMD="$(RM)" OOCD_EXE="$(OPENOCD)" \ REMOVE_CMD="$(RM)" OOCD_EXE="$(OPENOCD)" \
$$* $$*
@ -585,6 +590,8 @@ bu_$(1)_%: bl_$(1)_bino
$(V1) cd $(ROOT_DIR)/flight/Bootloaders/BootloaderUpdater && \ $(V1) cd $(ROOT_DIR)/flight/Bootloaders/BootloaderUpdater && \
$$(MAKE) -r --no-print-directory \ $$(MAKE) -r --no-print-directory \
BOARD_NAME=$(1) \ BOARD_NAME=$(1) \
BOARD_SHORT_NAME=$(3) \
BUILD_TYPE=bu \
TCHAIN_PREFIX="$(ARM_SDK_PREFIX)" \ TCHAIN_PREFIX="$(ARM_SDK_PREFIX)" \
REMOVE_CMD="$(RM)" OOCD_EXE="$(OPENOCD)" \ REMOVE_CMD="$(RM)" OOCD_EXE="$(OPENOCD)" \
$$* $$*
@ -600,11 +607,13 @@ define EF_TEMPLATE
.PHONY: ef_$(1) .PHONY: ef_$(1)
ef_$(1): ef_$(1)_bin ef_$(1): ef_$(1)_bin
ef_$(1)_%: bl_$(1)_bin fw_$(1)_bin ef_$(1)_%: bl_$(1)_bin fw_$(1)_opfw
$(V1) mkdir -p $(BUILD_DIR)/ef_$(1)/dep $(V1) mkdir -p $(BUILD_DIR)/ef_$(1)/dep
$(V1) cd $(ROOT_DIR)/flight/EntireFlash && \ $(V1) cd $(ROOT_DIR)/flight/EntireFlash && \
$$(MAKE) -r --no-print-directory \ $$(MAKE) -r --no-print-directory \
BOARD_NAME=$(1) \ BOARD_NAME=$(1) \
BOARD_SHORT_NAME=$(3) \
BUILD_TYPE=ef \
TCHAIN_PREFIX="$(ARM_SDK_PREFIX)" \ TCHAIN_PREFIX="$(ARM_SDK_PREFIX)" \
DFU_CMD="$(DFUUTIL_DIR)/bin/dfu-util" \ DFU_CMD="$(DFUUTIL_DIR)/bin/dfu-util" \
$$* $$*
@ -615,6 +624,19 @@ ef_$(1)_clean:
$(V1) $(RM) -fr $(BUILD_DIR)/ef_$(1) $(V1) $(RM) -fr $(BUILD_DIR)/ef_$(1)
endef endef
# 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.
ifneq ($(strip $(filter all_%,$(MAKECMDGOALS))),)
export ENABLE_MSG_EXTRA := yes
endif
# When building more than one goal in a single make invocation, also
# enable the extra context for each output line
ifneq ($(word 2,$(MAKECMDGOALS)),)
export ENABLE_MSG_EXTRA := yes
endif
# $(1) = Canonical board name all in lower case (e.g. coptercontrol) # $(1) = Canonical board name all in lower case (e.g. coptercontrol)
define BOARD_PHONY_TEMPLATE define BOARD_PHONY_TEMPLATE
.PHONY: all_$(1) .PHONY: all_$(1)
@ -632,6 +654,12 @@ endef
ALL_BOARDS := coptercontrol pipxtreme simposix ALL_BOARDS := coptercontrol pipxtreme simposix
# SimPosix only builds on Linux so drop it from the list for
# all other platforms.
ifneq ($(UNAME), Linux)
ALL_BOARDS := $(filter-out simposix, $(ALL_BOARDS))
endif
# Friendly names of each board (used to find source tree) # Friendly names of each board (used to find source tree)
coptercontrol_friendly := CopterControl coptercontrol_friendly := CopterControl
pipxtreme_friendly := PipXtreme pipxtreme_friendly := PipXtreme
@ -644,6 +672,13 @@ ifneq ($(UNAME), Linux)
ALL_BOARDS := $(filter-out simposix, $(ALL_BOARDS)) ALL_BOARDS := $(filter-out simposix, $(ALL_BOARDS))
endif endif
# Short hames of each board (used to display board name in parallel builds)
coptercontrol_short := 'cc '
pipxtreme_short := 'pipx'
revolution_short := 'revo'
simposix_short := 'posx'
osd_short := 'osd '
# Start out assuming that we'll build fw, bl and bu for all boards # Start out assuming that we'll build fw, bl and bu for all boards
FW_BOARDS := $(ALL_BOARDS) FW_BOARDS := $(ALL_BOARDS)
BL_BOARDS := $(ALL_BOARDS) BL_BOARDS := $(ALL_BOARDS)
@ -655,6 +690,12 @@ EF_BOARDS := $(ALL_BOARDS)
BL_BOARDS := $(filter-out ins, $(BL_BOARDS)) BL_BOARDS := $(filter-out ins, $(BL_BOARDS))
BU_BOARDS := $(filter-out ins, $(BU_BOARDS)) BU_BOARDS := $(filter-out ins, $(BU_BOARDS))
# SimPosix doesn't have a BL, BU or EF target so we need to
# filter them out to prevent errors on the all_flight target.
BL_BOARDS := $(filter-out simposix, $(BL_BOARDS))
BU_BOARDS := $(filter-out simposix, $(BU_BOARDS))
EF_BOARDS := $(filter-out simposix, $(EF_BOARDS))
# Generate the targets for whatever boards are left in each list # Generate the targets for whatever boards are left in each list
FW_TARGETS := $(addprefix fw_, $(FW_BOARDS)) FW_TARGETS := $(addprefix fw_, $(FW_BOARDS))
BL_TARGETS := $(addprefix bl_, $(BL_BOARDS)) BL_TARGETS := $(addprefix bl_, $(BL_BOARDS))
@ -674,7 +715,7 @@ all_bu: $(addsuffix _opfw, $(BU_TARGETS))
all_bu_clean: $(addsuffix _clean, $(BU_TARGETS)) all_bu_clean: $(addsuffix _clean, $(BU_TARGETS))
.PHONY: all_ef all_ef_clean .PHONY: all_ef all_ef_clean
all_ef: $(EF_TARGETS)) all_ef: $(EF_TARGETS)
all_ef_clean: $(addsuffix _clean, $(EF_TARGETS)) all_ef_clean: $(addsuffix _clean, $(EF_TARGETS))
.PHONY: all_flight all_flight_clean .PHONY: all_flight all_flight_clean
@ -685,16 +726,16 @@ all_flight_clean: all_fw_clean all_bl_clean all_bu_clean all_ef_clean
$(foreach board, $(ALL_BOARDS), $(eval $(call BOARD_PHONY_TEMPLATE,$(board)))) $(foreach board, $(ALL_BOARDS), $(eval $(call BOARD_PHONY_TEMPLATE,$(board))))
# Expand the bootloader updater rules # Expand the bootloader updater rules
$(foreach board, $(ALL_BOARDS), $(eval $(call BU_TEMPLATE,$(board),$($(board)_friendly)))) $(foreach board, $(ALL_BOARDS), $(eval $(call BU_TEMPLATE,$(board),$($(board)_friendly),$($(board)_short))))
# Expand the firmware rules # Expand the firmware rules
$(foreach board, $(ALL_BOARDS), $(eval $(call FW_TEMPLATE,$(board),$($(board)_friendly)))) $(foreach board, $(ALL_BOARDS), $(eval $(call FW_TEMPLATE,$(board),$($(board)_friendly),$($(board)_short))))
# Expand the bootloader rules # Expand the bootloader rules
$(foreach board, $(ALL_BOARDS), $(eval $(call BL_TEMPLATE,$(board),$($(board)_friendly)))) $(foreach board, $(ALL_BOARDS), $(eval $(call BL_TEMPLATE,$(board),$($(board)_friendly),$($(board)_short))))
# Expand the entire-flash rules # Expand the entire-flash rules
$(foreach board, $(ALL_BOARDS), $(eval $(call EF_TEMPLATE,$(board),$($(board)_friendly)))) $(foreach board, $(ALL_BOARDS), $(eval $(call EF_TEMPLATE,$(board),$($(board)_friendly),$($(board)_short))))
.PHONY: sim_win32 .PHONY: sim_win32
sim_win32: sim_win32_exe sim_win32: sim_win32_exe

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 438 KiB

After

Width:  |  Height:  |  Size: 436 KiB

View File

@ -35,13 +35,13 @@ bin: $(OUTDIR)/$(TARGET).bin
FW_PAD = $(shell echo $$[$(FW_BANK_BASE)-$(BL_BANK_BASE)-$(BL_BANK_SIZE)]) FW_PAD = $(shell echo $$[$(FW_BANK_BASE)-$(BL_BANK_BASE)-$(BL_BANK_SIZE)])
$(OUTDIR)/$(TARGET).pad: $(OUTDIR)/$(TARGET).pad:
$(V0) @echo " PADDING $@" $(V0) @echo $(MSG_PADDING) $@
$(V1) dd status=noxfer if=/dev/zero count=$(FW_PAD) bs=1 2>/dev/null | tr '\000' '\377' > $@ $(V1) dd status=noxfer if=/dev/zero count=$(FW_PAD) bs=1 2>/dev/null | tr '\000' '\377' > $@
BL_BIN = $(TOP)/build/bl_$(BOARD_NAME)/bl_$(BOARD_NAME).bin BL_BIN = $(TOP)/build/bl_$(BOARD_NAME)/bl_$(BOARD_NAME).bin
FW_BIN = $(TOP)/build/fw_$(BOARD_NAME)/fw_$(BOARD_NAME).bin FW_BIN = $(TOP)/build/fw_$(BOARD_NAME)/fw_$(BOARD_NAME).bin
$(OUTDIR)/$(TARGET).bin: $(BL_BIN) $(FW_BIN) $(OUTDIR)/$(TARGET).pad $(OUTDIR)/$(TARGET).bin: $(BL_BIN) $(FW_BIN) $(OUTDIR)/$(TARGET).pad
$(V0) @echo " FLASH IMG $@" $(V0) @echo $(MSG_FLASH_IMG) $@
$(V1) cat $(BL_BIN) $(OUTDIR)/$(TARGET).pad $(FW_BIN) > $@ $(V1) cat $(BL_BIN) $(OUTDIR)/$(TARGET).pad $(FW_BIN) > $@
.PHONY: dfu .PHONY: dfu

View File

@ -67,7 +67,8 @@ static xTaskHandle taskHandle;
static float lastResult[MAX_MIX_ACTUATORS]={0,0,0,0,0,0,0,0}; static float lastResult[MAX_MIX_ACTUATORS]={0,0,0,0,0,0,0,0};
static float lastFilteredResult[MAX_MIX_ACTUATORS]={0,0,0,0,0,0,0,0}; static float lastFilteredResult[MAX_MIX_ACTUATORS]={0,0,0,0,0,0,0,0};
static float filterAccumulator[MAX_MIX_ACTUATORS]={0,0,0,0,0,0,0,0}; static float filterAccumulator[MAX_MIX_ACTUATORS]={0,0,0,0,0,0,0,0};
// used to inform the actuator thread that actuator update rate is changed
static uint8_t updateRateChanged = 0;
// Private functions // Private functions
static void actuatorTask(void* parameters); static void actuatorTask(void* parameters);
@ -76,10 +77,12 @@ static int16_t scaleChannel(float value, int16_t max, int16_t min, int16_t neutr
static void setFailsafe(); static void setFailsafe();
static float MixerCurve(const float throttle, const float* curve, uint8_t elements); static float MixerCurve(const float throttle, const float* curve, uint8_t elements);
static bool set_channel(uint8_t mixer_channel, uint16_t value); static bool set_channel(uint8_t mixer_channel, uint16_t value);
static void change_update_rate();
float ProcessMixer(const int index, const float curve1, const float curve2, float ProcessMixer(const int index, const float curve1, const float curve2,
MixerSettingsData* mixerSettings, ActuatorDesiredData* desired, MixerSettingsData* mixerSettings, ActuatorDesiredData* desired,
const float period); const float period);
static uint16_t lastChannelUpdateFreq[ACTUATORSETTINGS_CHANNELUPDATEFREQ_NUMELEM] = {0,0,0,0};
//this structure is equivalent to the UAVObjects for one mixer. //this structure is equivalent to the UAVObjects for one mixer.
typedef struct { typedef struct {
uint8_t type; uint8_t type;
@ -157,9 +160,8 @@ static void actuatorTask(void* parameters)
int16_t ChannelMax[ACTUATORCOMMAND_CHANNEL_NUMELEM]; int16_t ChannelMax[ACTUATORCOMMAND_CHANNEL_NUMELEM];
int16_t ChannelMin[ACTUATORCOMMAND_CHANNEL_NUMELEM]; int16_t ChannelMin[ACTUATORCOMMAND_CHANNEL_NUMELEM];
int16_t ChannelNeutral[ACTUATORCOMMAND_CHANNEL_NUMELEM]; int16_t ChannelNeutral[ACTUATORCOMMAND_CHANNEL_NUMELEM];
uint16_t ChannelUpdateFreq[ACTUATORSETTINGS_CHANNELUPDATEFREQ_NUMELEM];
ActuatorSettingsChannelUpdateFreqGet(ChannelUpdateFreq); change_update_rate();
PIOS_Servo_SetHz(&ChannelUpdateFreq[0], ACTUATORSETTINGS_CHANNELUPDATEFREQ_NUMELEM);
float * status = (float *)&mixerStatus; //access status objects as an array of floats float * status = (float *)&mixerStatus; //access status objects as an array of floats
@ -179,6 +181,12 @@ static void actuatorTask(void* parameters)
continue; continue;
} }
if(updateRateChanged!=0)
{
change_update_rate();
updateRateChanged=0;
}
// Check how long since last update // Check how long since last update
thisSysTime = xTaskGetTickCount(); thisSysTime = xTaskGetTickCount();
if(thisSysTime > lastSysTime) // reuse dt in case of wraparound if(thisSysTime > lastSysTime) // reuse dt in case of wraparound
@ -547,10 +555,27 @@ static void setFailsafe()
static void actuator_update_rate(UAVObjEvent * ev) static void actuator_update_rate(UAVObjEvent * ev)
{ {
uint16_t ChannelUpdateFreq[ACTUATORSETTINGS_CHANNELUPDATEFREQ_NUMELEM]; uint16_t ChannelUpdateFreq[ACTUATORSETTINGS_CHANNELUPDATEFREQ_NUMELEM];
if ( ev->obj == ActuatorSettingsHandle() ) { // ActuatoSettings are not changed
if ( ev->obj != ActuatorSettingsHandle() )
return;
ActuatorSettingsChannelUpdateFreqGet(ChannelUpdateFreq); ActuatorSettingsChannelUpdateFreqGet(ChannelUpdateFreq);
// check if the any rate setting is changed
if (lastChannelUpdateFreq[0]!=0 && memcmp(&lastChannelUpdateFreq[0], &ChannelUpdateFreq[0], sizeof(int16_t) * ACTUATORSETTINGS_CHANNELUPDATEFREQ_NUMELEM) ==0)
return;
// signal to the actuator task that ChannelUpdateFreq are changed
updateRateChanged = 1;
}
/**
* @brief Change the update rates according to the ActuatorSettingsChannelUpdateFreq.
*/
static void change_update_rate()
{
uint16_t ChannelUpdateFreq[ACTUATORSETTINGS_CHANNELUPDATEFREQ_NUMELEM];
// save the new rates
ActuatorSettingsChannelUpdateFreqGet(ChannelUpdateFreq);
memcpy(lastChannelUpdateFreq, ChannelUpdateFreq, sizeof(int16_t) * ACTUATORSETTINGS_CHANNELUPDATEFREQ_NUMELEM);
PIOS_Servo_SetHz(&ChannelUpdateFreq[0], ACTUATORSETTINGS_CHANNELUPDATEFREQ_NUMELEM); PIOS_Servo_SetHz(&ChannelUpdateFreq[0], ACTUATORSETTINGS_CHANNELUPDATEFREQ_NUMELEM);
}
} }
#if defined(ARCH_POSIX) || defined(ARCH_WIN32) #if defined(ARCH_POSIX) || defined(ARCH_WIN32)

View File

@ -331,10 +331,10 @@ int32_t PIOS_Flash_Jedec_EraseChip()
// Keep polling when bus is busy too // Keep polling when bus is busy too
int i = 0; int i = 0;
while(PIOS_Flash_Jedec_Busy() != 0) { while(PIOS_Flash_Jedec_Busy() != 0) {
#if defined(PIOS_INCLUDE_FREERTOS) #if defined(FLASH_FREERTOS)
vTaskDelay(1); vTaskDelay(1);
#endif #endif
if ((i++) % 100 == 0) if ((i++) % 10000 == 0)
PIOS_LED_Toggle(PIOS_LED_HEARTBEAT); PIOS_LED_Toggle(PIOS_LED_HEARTBEAT);
} }

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 438 KiB

After

Width:  |  Height:  |  Size: 436 KiB

View File

@ -1,5 +1,5 @@
TEMPLATE = lib TEMPLATE = lib
TARGET = HITLV2 TARGET = HITLv2
QT += network QT += network
include(../../openpilotgcsplugin.pri) include(../../openpilotgcsplugin.pri)
include(hitlv2_dependencies.pri) include(hitlv2_dependencies.pri)

View File

@ -128,7 +128,7 @@ QList <Core::IConnection::device> SerialConnection::availableDevices()
foreach( QextPortInfo port, ports ) { foreach( QextPortInfo port, ports ) {
device d; device d;
d.displayName=port.friendName; d.displayName=port.friendName;
d.name=port.friendName; d.name=port.physName;
list.append(d); list.append(d);
} }
} }
@ -143,7 +143,7 @@ QIODevice *SerialConnection::openDevice(const QString &deviceName)
} }
QList<QextPortInfo> ports = QextSerialEnumerator::getPorts(); QList<QextPortInfo> ports = QextSerialEnumerator::getPorts();
foreach( QextPortInfo port, ports ) { foreach( QextPortInfo port, ports ) {
if(port.friendName == deviceName) if(port.physName == deviceName)
{ {
//we need to handle port settings here... //we need to handle port settings here...
PortSettings set; PortSettings set;

View File

@ -27,6 +27,77 @@
#include "treeitem.h" #include "treeitem.h"
/* Constructor */
HighLightManager::HighLightManager(long checkingInterval)
{
// Start the timer and connect it to the callback
m_expirationTimer.start(checkingInterval);
connect(&m_expirationTimer, SIGNAL(timeout()), this, SLOT(checkItemsExpired()));
}
/*
* Called to add item to list. Item is only added if absent.
* Returns true if item was added, otherwise false.
*/
bool HighLightManager::add(TreeItem *itemToAdd)
{
// Lock to ensure thread safety
QMutexLocker locker(&m_listMutex);
// Check so that the item isn't already in the list
if(!m_itemsList.contains(itemToAdd))
{
m_itemsList.append(itemToAdd);
return true;
}
return false;
}
/*
* Called to remove item from list.
* Returns true if item was removed, otherwise false.
*/
bool HighLightManager::remove(TreeItem *itemToRemove)
{
// Lock to ensure thread safety
QMutexLocker locker(&m_listMutex);
// Remove item and return result
return m_itemsList.removeOne(itemToRemove);
}
/*
* Callback called periodically by the timer.
* This method checks for expired highlights and
* removes them if they are expired.
* Expired highlights are restored.
*/
void HighLightManager::checkItemsExpired()
{
// Lock to ensure thread safety
QMutexLocker locker(&m_listMutex);
// Get a mutable iterator for the list
QMutableLinkedListIterator<TreeItem*> iter(m_itemsList);
// This is the timestamp to compare with
QTime now = QTime::currentTime();
// Loop over all items, check if they expired.
while(iter.hasNext())
{
TreeItem* item = iter.next();
if(item->getHiglightExpires() < now)
{
// If expired, call removeHighlight
item->removeHighlight();
// Remove from list since it is restored.
iter.remove();
}
}
}
int TreeItem::m_highlightTimeMs = 500; int TreeItem::m_highlightTimeMs = 500;
TreeItem::TreeItem(const QList<QVariant> &data, TreeItem *parent) : TreeItem::TreeItem(const QList<QVariant> &data, TreeItem *parent) :
@ -36,7 +107,6 @@ TreeItem::TreeItem(const QList<QVariant> &data, TreeItem *parent) :
m_highlight(false), m_highlight(false),
m_changed(false) m_changed(false)
{ {
connect(&m_timer, SIGNAL(timeout()), this, SLOT(removeHighlight()));
} }
TreeItem::TreeItem(const QVariant &data, TreeItem *parent) : TreeItem::TreeItem(const QVariant &data, TreeItem *parent) :
@ -46,7 +116,6 @@ TreeItem::TreeItem(const QVariant &data, TreeItem *parent) :
m_changed(false) m_changed(false)
{ {
m_data << data << "" << ""; m_data << data << "" << "";
connect(&m_timer, SIGNAL(timeout()), this, SLOT(removeHighlight()));
} }
TreeItem::~TreeItem() TreeItem::~TreeItem()
@ -108,21 +177,50 @@ void TreeItem::apply() {
child->apply(); child->apply();
} }
/*
* Called after a value has changed to trigger highlightning of tree item.
*/
void TreeItem::setHighlight(bool highlight) { void TreeItem::setHighlight(bool highlight) {
m_highlight = highlight; m_highlight = highlight;
m_changed = false; m_changed = false;
if (highlight) { if (highlight) {
if (m_timer.isActive()) { // Update the expires timestamp
m_timer.stop(); m_highlightExpires = QTime::currentTime().addMSecs(m_highlightTimeMs);
}
m_timer.setSingleShot(true); // Add to highlightmanager
m_timer.start(m_highlightTimeMs); if(m_highlightManager->add(this))
} {
// Only emit signal if it was added
emit updateHighlight(this); emit updateHighlight(this);
}
}
else if(m_highlightManager->remove(this))
{
// Only emit signal if it was removed
emit updateHighlight(this);
}
// If we have a parent, call recursively to update highlight status of parents.
// This will ensure that the root of a leaf that is changed also is highlighted.
// Only updates that really changes values will trigger highlight of parents.
if(m_parent)
{
m_parent->setHighlight(highlight);
}
} }
void TreeItem::removeHighlight() { void TreeItem::removeHighlight() {
m_highlight = false; m_highlight = false;
update(); //update();
emit updateHighlight(this); emit updateHighlight(this);
} }
void TreeItem::setHighlightManager(HighLightManager *mgr)
{
m_highlightManager = mgr;
}
QTime TreeItem::getHiglightExpires()
{
return m_highlightExpires;
}

View File

@ -32,10 +32,58 @@
#include "uavmetaobject.h" #include "uavmetaobject.h"
#include "uavobjectfield.h" #include "uavobjectfield.h"
#include <QtCore/QList> #include <QtCore/QList>
#include <QtCore/QLinkedList>
#include <QtCore/QVariant> #include <QtCore/QVariant>
#include <QtCore/QTime>
#include <QtCore/QTimer> #include <QtCore/QTimer>
#include <QtCore/QObject> #include <QtCore/QObject>
#include <QtCore/QDebug>
class TreeItem;
/*
* Small utility class that handles the higlighting of
* tree grid items.
* Basicly it maintains all items due to be restored to
* non highlighted state in a linked list.
* A timer traverses this list periodically to find out
* if any of the items should be restored. All items are
* updated withan expiration timestamp when they expires.
* An item that is beeing restored is removed from the
* list and its removeHighlight() method is called. Items
* that are not expired are left in the list til next time.
* Items that are updated during the expiration time are
* left untouched in the list. This reduces unwanted emits
* of signals to the repaint/update function.
*/
class HighLightManager : public QObject
{
Q_OBJECT
public:
// Constructor taking the checking interval in ms.
HighLightManager(long checkingInterval);
// This is called when an item has been set to
// highlighted = true.
bool add(TreeItem* itemToAdd);
//This is called when an item is set to highlighted = false;
bool remove(TreeItem* itemToRemove);
private slots:
// Timer callback method.
void checkItemsExpired();
private:
// The timer checking highlight expiration.
QTimer m_expirationTimer;
// The list holding all items due to be updated.
QLinkedList<TreeItem*> m_itemsList;
//Mutex to lock when accessing list.
QMutex m_listMutex;
};
class TreeItem : public QObject class TreeItem : public QObject
{ {
@ -77,11 +125,16 @@ public:
inline bool changed() { return m_changed; } inline bool changed() { return m_changed; }
inline void setChanged(bool changed) { m_changed = changed; } inline void setChanged(bool changed) { m_changed = changed; }
virtual void setHighlightManager(HighLightManager* mgr);
QTime getHiglightExpires();
virtual void removeHighlight();
signals: signals:
void updateHighlight(TreeItem*); void updateHighlight(TreeItem*);
private slots: private slots:
void removeHighlight();
private: private:
QList<TreeItem*> m_children; QList<TreeItem*> m_children;
@ -91,7 +144,8 @@ private:
TreeItem *m_parent; TreeItem *m_parent;
bool m_highlight; bool m_highlight;
bool m_changed; bool m_changed;
QTimer m_timer; QTime m_highlightExpires;
HighLightManager* m_highlightManager;
public: public:
static const int dataColumn = 1; static const int dataColumn = 1;
private: private:

View File

@ -47,6 +47,8 @@ UAVObjectTreeModel::UAVObjectTreeModel(QObject *parent) :
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
UAVObjectManager *objManager = pm->getObject<UAVObjectManager>(); UAVObjectManager *objManager = pm->getObject<UAVObjectManager>();
// Create highlight manager, let it run every 300 ms.
m_highlightManager = new HighLightManager(300);
connect(objManager, SIGNAL(newObject(UAVObject*)), this, SLOT(newObject(UAVObject*))); connect(objManager, SIGNAL(newObject(UAVObject*)), this, SLOT(newObject(UAVObject*)));
connect(objManager, SIGNAL(newInstance(UAVObject*)), this, SLOT(newObject(UAVObject*))); connect(objManager, SIGNAL(newInstance(UAVObject*)), this, SLOT(newObject(UAVObject*)));
@ -56,6 +58,7 @@ UAVObjectTreeModel::UAVObjectTreeModel(QObject *parent) :
UAVObjectTreeModel::~UAVObjectTreeModel() UAVObjectTreeModel::~UAVObjectTreeModel()
{ {
delete m_highlightManager;
delete m_rootItem; delete m_rootItem;
} }
@ -67,9 +70,12 @@ void UAVObjectTreeModel::setupModelData(UAVObjectManager *objManager)
m_rootItem = new TreeItem(rootData); m_rootItem = new TreeItem(rootData);
m_settingsTree = new TopTreeItem(tr("Settings"), m_rootItem); m_settingsTree = new TopTreeItem(tr("Settings"), m_rootItem);
m_settingsTree->setHighlightManager(m_highlightManager);
m_rootItem->appendChild(m_settingsTree); m_rootItem->appendChild(m_settingsTree);
m_nonSettingsTree = new TopTreeItem(tr("Data Objects"), m_rootItem); m_nonSettingsTree = new TopTreeItem(tr("Data Objects"), m_rootItem);
m_nonSettingsTree->setHighlightManager(m_highlightManager);
m_rootItem->appendChild(m_nonSettingsTree); m_rootItem->appendChild(m_nonSettingsTree);
m_rootItem->setHighlightManager(m_highlightManager);
connect(m_settingsTree, SIGNAL(updateHighlight(TreeItem*)), this, SLOT(updateHighlight(TreeItem*))); connect(m_settingsTree, SIGNAL(updateHighlight(TreeItem*)), this, SLOT(updateHighlight(TreeItem*)));
connect(m_nonSettingsTree, SIGNAL(updateHighlight(TreeItem*)), this, SLOT(updateHighlight(TreeItem*))); connect(m_nonSettingsTree, SIGNAL(updateHighlight(TreeItem*)), this, SLOT(updateHighlight(TreeItem*)));
@ -96,6 +102,7 @@ void UAVObjectTreeModel::addDataObject(UAVDataObject *obj)
addInstance(obj, root->child(index)); addInstance(obj, root->child(index));
} else { } else {
DataObjectTreeItem *data = new DataObjectTreeItem(obj->getName() + " (" + QString::number(obj->getNumBytes()) + " bytes)"); DataObjectTreeItem *data = new DataObjectTreeItem(obj->getName() + " (" + QString::number(obj->getNumBytes()) + " bytes)");
data->setHighlightManager(m_highlightManager);
connect(data, SIGNAL(updateHighlight(TreeItem*)), this, SLOT(updateHighlight(TreeItem*))); connect(data, SIGNAL(updateHighlight(TreeItem*)), this, SLOT(updateHighlight(TreeItem*)));
int index = root->nameIndex(obj->getName()); int index = root->nameIndex(obj->getName());
root->insert(index, data); root->insert(index, data);
@ -110,6 +117,7 @@ void UAVObjectTreeModel::addMetaObject(UAVMetaObject *obj, TreeItem *parent)
{ {
connect(obj, SIGNAL(objectUpdated(UAVObject*)), this, SLOT(highlightUpdatedObject(UAVObject*))); connect(obj, SIGNAL(objectUpdated(UAVObject*)), this, SLOT(highlightUpdatedObject(UAVObject*)));
MetaObjectTreeItem *meta = new MetaObjectTreeItem(obj, tr("Meta Data")); MetaObjectTreeItem *meta = new MetaObjectTreeItem(obj, tr("Meta Data"));
meta->setHighlightManager(m_highlightManager);
connect(meta, SIGNAL(updateHighlight(TreeItem*)), this, SLOT(updateHighlight(TreeItem*))); connect(meta, SIGNAL(updateHighlight(TreeItem*)), this, SLOT(updateHighlight(TreeItem*)));
foreach (UAVObjectField *field, obj->getFields()) { foreach (UAVObjectField *field, obj->getFields()) {
if (field->getNumElements() > 1) { if (field->getNumElements() > 1) {
@ -132,6 +140,7 @@ void UAVObjectTreeModel::addInstance(UAVObject *obj, TreeItem *parent)
} else { } else {
QString name = tr("Instance") + " " + QString::number(obj->getInstID()); QString name = tr("Instance") + " " + QString::number(obj->getInstID());
item = new InstanceTreeItem(obj, name); item = new InstanceTreeItem(obj, name);
item->setHighlightManager(m_highlightManager);
connect(item, SIGNAL(updateHighlight(TreeItem*)), this, SLOT(updateHighlight(TreeItem*))); connect(item, SIGNAL(updateHighlight(TreeItem*)), this, SLOT(updateHighlight(TreeItem*)));
parent->appendChild(item); parent->appendChild(item);
} }
@ -148,6 +157,7 @@ void UAVObjectTreeModel::addInstance(UAVObject *obj, TreeItem *parent)
void UAVObjectTreeModel::addArrayField(UAVObjectField *field, TreeItem *parent) void UAVObjectTreeModel::addArrayField(UAVObjectField *field, TreeItem *parent)
{ {
TreeItem *item = new ArrayFieldTreeItem(field->getName()); TreeItem *item = new ArrayFieldTreeItem(field->getName());
item->setHighlightManager(m_highlightManager);
connect(item, SIGNAL(updateHighlight(TreeItem*)), this, SLOT(updateHighlight(TreeItem*))); connect(item, SIGNAL(updateHighlight(TreeItem*)), this, SLOT(updateHighlight(TreeItem*)));
for (uint i = 0; i < field->getNumElements(); ++i) { for (uint i = 0; i < field->getNumElements(); ++i) {
addSingleField(i, field, item); addSingleField(i, field, item);
@ -192,6 +202,7 @@ void UAVObjectTreeModel::addSingleField(int index, UAVObjectField *field, TreeIt
default: default:
Q_ASSERT(false); Q_ASSERT(false);
} }
item->setHighlightManager(m_highlightManager);
connect(item, SIGNAL(updateHighlight(TreeItem*)), this, SLOT(updateHighlight(TreeItem*))); connect(item, SIGNAL(updateHighlight(TreeItem*)), this, SLOT(updateHighlight(TreeItem*)));
parent->appendChild(item); parent->appendChild(item);
} }
@ -352,7 +363,6 @@ void UAVObjectTreeModel::highlightUpdatedObject(UAVObject *obj)
Q_ASSERT(obj); Q_ASSERT(obj);
ObjectTreeItem *item = findObjectTreeItem(obj); ObjectTreeItem *item = findObjectTreeItem(obj);
Q_ASSERT(item); Q_ASSERT(item);
item->setHighlight(true);
item->update(); item->update();
QModelIndex itemIndex = index(item); QModelIndex itemIndex = index(item);
Q_ASSERT(itemIndex != QModelIndex()); Q_ASSERT(itemIndex != QModelIndex());

View File

@ -97,6 +97,9 @@ private:
int m_recentlyUpdatedTimeout; int m_recentlyUpdatedTimeout;
QColor m_recentlyUpdatedColor; QColor m_recentlyUpdatedColor;
QColor m_manuallyChangedColor; QColor m_manuallyChangedColor;
// Highlight manager to handle highlighting of tree items.
HighLightManager *m_highlightManager;
}; };
#endif // UAVOBJECTTREEMODEL_H #endif // UAVOBJECTTREEMODEL_H

View File

@ -23,32 +23,41 @@ else
quote = quote =
endif endif
# Add a board designator to the terse message text
ifeq ($(ENABLE_MSG_EXTRA),yes)
MSG_EXTRA := [$(BUILD_TYPE)|$(BOARD_SHORT_NAME)]
else
MSG_BOARD :=
endif
# Define Messages # Define Messages
# English # English
MSG_FORMATERROR := ${quote} Can not handle output-format${quote} MSG_FORMATERROR = ${quote} Can not handle output-format${quote}
MSG_MODINIT := ${quote} MODINIT ${quote} MSG_MODINIT = ${quote} MODINIT $(MSG_EXTRA) ${quote}
MSG_SIZE := ${quote} SIZE ${quote} MSG_SIZE = ${quote} SIZE $(MSG_EXTRA) ${quote}
MSG_LOAD_FILE := ${quote} BIN/HEX ${quote} MSG_LOAD_FILE = ${quote} BIN/HEX $(MSG_EXTRA) ${quote}
MSG_BIN_OBJ := ${quote} BINO ${quote} MSG_BIN_OBJ = ${quote} BINO $(MSG_EXTRA) ${quote}
MSG_STRIP_FILE := ${quote} STRIP ${quote} MSG_STRIP_FILE = ${quote} STRIP $(MSG_EXTRA) ${quote}
MSG_EXTENDED_LISTING := ${quote} LIS ${quote} MSG_EXTENDED_LISTING = ${quote} LIS $(MSG_EXTRA) ${quote}
MSG_SYMBOL_TABLE := ${quote} NM ${quote} MSG_SYMBOL_TABLE = ${quote} NM $(MSG_EXTRA) ${quote}
MSG_LINKING := ${quote} LD ${quote} MSG_LINKING = ${quote} LD $(MSG_EXTRA) ${quote}
MSG_COMPILING := ${quote} CC ${quote} MSG_COMPILING = ${quote} CC ${MSG_EXTRA} ${quote}
MSG_COMPILING_ARM := ${quote} CC-ARM ${quote} MSG_COMPILING_ARM = ${quote} CC-ARM $(MSG_EXTRA) ${quote}
MSG_COMPILINGCPP := ${quote} CXX ${quote} MSG_COMPILINGCPP = ${quote} CXX $(MSG_EXTRA) ${quote}
MSG_COMPILINGCPP_ARM := ${quote} CXX-ARM ${quote} MSG_COMPILINGCPP_ARM = ${quote} CXX-ARM $(MSG_EXTRA) ${quote}
MSG_ASSEMBLING := ${quote} AS ${quote} MSG_ASSEMBLING = ${quote} AS $(MSG_EXTRA) ${quote}
MSG_ASSEMBLING_ARM := ${quote} AS-ARM ${quote} MSG_ASSEMBLING_ARM = ${quote} AS-ARM $(MSG_EXTRA) ${quote}
MSG_CLEANING := ${quote} CLEAN ${quote} MSG_CLEANING = ${quote} CLEAN $(MSG_EXTRA) ${quote}
MSG_ASMFROMC := ${quote} AS(C) ${quote} MSG_ASMFROMC = ${quote} AS(C) $(MSG_EXTRA) ${quote}
MSG_ASMFROMC_ARM := ${quote} AS(C)-ARM ${quote} MSG_ASMFROMC_ARM = ${quote} AS(C)-ARM $(MSG_EXTRA) ${quote}
MSG_PYMITEINIT := ${quote} PY ${quote} MSG_PYMITEINIT = ${quote} PY $(MSG_EXTRA) ${quote}
MSG_INSTALLING := ${quote} INSTALL ${quote} MSG_INSTALLING = ${quote} INSTALL $(MSG_EXTRA) ${quote}
MSG_OPFIRMWARE := ${quote} OPFW ${quote} MSG_OPFIRMWARE = ${quote} OPFW $(MSG_EXTRA) ${quote}
MSG_FWINFO := ${quote} FWINFO ${quote} MSG_FWINFO = ${quote} FWINFO $(MSG_EXTRA) ${quote}
MSG_JTAG_PROGRAM := ${quote} JTAG-PGM ${quote} MSG_JTAG_PROGRAM = ${quote} JTAG-PGM $(MSG_EXTRA) ${quote}
MSG_JTAG_WIPE := ${quote} JTAG-WIPE ${quote} MSG_JTAG_WIPE = ${quote} JTAG-WIPE $(MSG_EXTRA) ${quote}
MSG_PADDING = ${quote} PADDING $(MSG_EXTRA) ${quote}
MSG_FLASH_IMG = ${quote} FLASH_IMG $(MSG_EXTRA) ${quote}
toprel = $(subst $(realpath $(TOP))/,,$(abspath $(1))) toprel = $(subst $(realpath $(TOP))/,,$(abspath $(1)))

View File

@ -200,6 +200,8 @@ Section "Shortcuts" InSecShortcuts
CreateDirectory "$SMPROGRAMS\OpenPilot" CreateDirectory "$SMPROGRAMS\OpenPilot"
CreateShortCut "$SMPROGRAMS\OpenPilot\OpenPilot GCS.lnk" "$INSTDIR\bin\openpilotgcs.exe" \ CreateShortCut "$SMPROGRAMS\OpenPilot\OpenPilot GCS.lnk" "$INSTDIR\bin\openpilotgcs.exe" \
"" "$INSTDIR\bin\openpilotgcs.exe" 0 "" "" "${PRODUCT_NAME} ${PRODUCT_VERSION}. ${BUILD_DESCRIPTION}" "" "$INSTDIR\bin\openpilotgcs.exe" 0 "" "" "${PRODUCT_NAME} ${PRODUCT_VERSION}. ${BUILD_DESCRIPTION}"
CreateShortCut "$SMPROGRAMS\OpenPilot\OpenPilot GCS (clean configuration).lnk" "$INSTDIR\bin\openpilotgcs.exe" \
"-clean-config" "$INSTDIR\bin\openpilotgcs.exe" 0 "" "" "${PRODUCT_NAME} ${PRODUCT_VERSION}. ${BUILD_DESCRIPTION}"
CreateShortCut "$SMPROGRAMS\OpenPilot\OpenPilot ChangeLog.lnk" "$INSTDIR\HISTORY.txt" \ CreateShortCut "$SMPROGRAMS\OpenPilot\OpenPilot ChangeLog.lnk" "$INSTDIR\HISTORY.txt" \
"" "$INSTDIR\bin\openpilotgcs.exe" 0 "" "$INSTDIR\bin\openpilotgcs.exe" 0
CreateShortCut "$SMPROGRAMS\OpenPilot\OpenPilot Website.lnk" "http://www.openpilot.org" \ CreateShortCut "$SMPROGRAMS\OpenPilot\OpenPilot Website.lnk" "http://www.openpilot.org" \