1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-02-21 11:54:15 +01:00

Merge branch 'next' into revo

This commit is contained in:
James Cotton 2012-06-03 19:00:51 -05:00
commit 71e14a691e
18 changed files with 266 additions and 202 deletions

View File

@ -1,5 +1,12 @@
Short summary of changes. For a complete list see the git log. Short summary of changes. For a complete list see the git log.
2012-05-26
Revert some UI changes that didn't work consistently between OSX and Windows.
2012-05-24
Merged the updated firmware for the PipXtreme, thanks to Brian for a lot of
work on this.
2012-05-04 2012-05-04
Support for CC3D. This involved changes to various things such as the sensors Support for CC3D. This involved changes to various things such as the sensors
being split from AttitudeRaw to Accels,Gyros,Magnetometer. A single firmware being split from AttitudeRaw to Accels,Gyros,Magnetometer. A single firmware

View File

@ -122,6 +122,7 @@ static const struct flashfs_cfg flashfs_w25x_cfg = {
.obj_table_start = 0x00000010, .obj_table_start = 0x00000010,
.obj_table_end = 0x00001000, .obj_table_end = 0x00001000,
.sector_size = 0x00001000, .sector_size = 0x00001000,
.chip_size = 0x00080000,
}; };
static const struct pios_flash_jedec_cfg flash_w25x_cfg = { static const struct pios_flash_jedec_cfg flash_w25x_cfg = {
@ -135,6 +136,7 @@ static const struct flashfs_cfg flashfs_m25p_cfg = {
.obj_table_start = 0x00000010, .obj_table_start = 0x00000010,
.obj_table_end = 0x00010000, .obj_table_end = 0x00010000,
.sector_size = 0x00010000, .sector_size = 0x00010000,
.chip_size = 0x00200000,
}; };
static const struct pios_flash_jedec_cfg flash_m25p_cfg = { static const struct pios_flash_jedec_cfg flash_m25p_cfg = {

View File

@ -215,7 +215,7 @@ static void objectUpdatedCb(UAVObjEvent * ev)
// Get object data // Get object data
ObjectPersistenceGet(&objper); ObjectPersistenceGet(&objper);
int retval = -1; int retval = 1;
// Execute action // Execute action
if (objper.Operation == OBJECTPERSISTENCE_OPERATION_LOAD) { if (objper.Operation == OBJECTPERSISTENCE_OPERATION_LOAD) {
if (objper.Selection == OBJECTPERSISTENCE_SELECTION_SINGLEOBJECT) { if (objper.Selection == OBJECTPERSISTENCE_SELECTION_SINGLEOBJECT) {
@ -242,6 +242,13 @@ static void objectUpdatedCb(UAVObjEvent * ev)
} }
// Save selected instance // Save selected instance
retval = UAVObjSave(obj, objper.InstanceID); retval = UAVObjSave(obj, objper.InstanceID);
// Not sure why this is needed
vTaskDelay(10);
// Verify saving worked
if (retval == 0)
retval = UAVObjLoad(obj, objper.InstanceID);
} else if (objper.Selection == OBJECTPERSISTENCE_SELECTION_ALLSETTINGS } else if (objper.Selection == OBJECTPERSISTENCE_SELECTION_ALLSETTINGS
|| objper.Selection == OBJECTPERSISTENCE_SELECTION_ALLOBJECTS) { || objper.Selection == OBJECTPERSISTENCE_SELECTION_ALLOBJECTS) {
retval = UAVObjSaveSettings(); retval = UAVObjSaveSettings();
@ -271,9 +278,17 @@ static void objectUpdatedCb(UAVObjEvent * ev)
retval = PIOS_FLASHFS_Format(); retval = PIOS_FLASHFS_Format();
#endif #endif
} }
if(retval == 0) { switch(retval) {
objper.Operation = OBJECTPERSISTENCE_OPERATION_COMPLETED; case 0:
ObjectPersistenceSet(&objper); objper.Operation = OBJECTPERSISTENCE_OPERATION_COMPLETED;
ObjectPersistenceSet(&objper);
break;
case -1:
objper.Operation = OBJECTPERSISTENCE_OPERATION_ERROR;
ObjectPersistenceSet(&objper);
break;
default:
break;
} }
} }
} }

View File

@ -186,6 +186,7 @@ static int32_t PIOS_FLASHFS_GetObjAddress(uint32_t objId, uint16_t instId)
* @retval -2 No room in object table * @retval -2 No room in object table
* @retval -3 Unable to write entry into object table * @retval -3 Unable to write entry into object table
* @retval -4 FS not initialized * @retval -4 FS not initialized
* @retval -5
*/ */
int32_t PIOS_FLASHFS_GetNewAddress(uint32_t objId, uint16_t instId) int32_t PIOS_FLASHFS_GetNewAddress(uint32_t objId, uint16_t instId)
{ {
@ -206,6 +207,10 @@ int32_t PIOS_FLASHFS_GetNewAddress(uint32_t objId, uint16_t instId)
if((addr + sizeof(header)) > cfg->obj_table_end) if((addr + sizeof(header)) > cfg->obj_table_end)
return -2; return -2;
// Verify the address is within the chip
if((addr + cfg->sector_size) > cfg->chip_size)
return -5;
if(PIOS_Flash_Jedec_WriteData(addr, (uint8_t *) &header, sizeof(header)) != 0) if(PIOS_Flash_Jedec_WriteData(addr, (uint8_t *) &header, sizeof(header)) != 0)
return -3; return -3;

View File

@ -37,6 +37,7 @@ struct flashfs_cfg {
uint32_t obj_table_start; uint32_t obj_table_start;
uint32_t obj_table_end; uint32_t obj_table_end;
uint32_t sector_size; uint32_t sector_size;
uint32_t chip_size;
}; };
int32_t PIOS_FLASHFS_Init(const struct flashfs_cfg * cfg); int32_t PIOS_FLASHFS_Init(const struct flashfs_cfg * cfg);

View File

@ -277,6 +277,7 @@ static const struct flashfs_cfg flashfs_m25p_cfg = {
.obj_table_start = 0x00000010, .obj_table_start = 0x00000010,
.obj_table_end = 0x00010000, .obj_table_end = 0x00010000,
.sector_size = 0x00010000, .sector_size = 0x00010000,
.chip_size = 0x00200000,
}; };
static const struct pios_flash_jedec_cfg flash_m25p_cfg = { static const struct pios_flash_jedec_cfg flash_m25p_cfg = {

View File

@ -74,8 +74,8 @@ typedef enum {
* *
* Bit(s) Name Meaning * Bit(s) Name Meaning
* ------ ---- ------- * ------ ---- -------
* 0 access Defines the access level for the local transactions (readonly=0 and readwrite=1) * 0 access Defines the access level for the local transactions (readonly=1 and readwrite=0)
* 1 gcsAccess Defines the access level for the local GCS transactions (readonly=0 and readwrite=1), not used in the flight s/w * 1 gcsAccess Defines the access level for the local GCS transactions (readonly=1 and readwrite=0), not used in the flight s/w
* 2 telemetryAcked Defines if an ack is required for the transactions of this object (1:acked, 0:not acked) * 2 telemetryAcked Defines if an ack is required for the transactions of this object (1:acked, 0:not acked)
* 3 gcsTelemetryAcked Defines if an ack is required for the transactions of this object (1:acked, 0:not acked) * 3 gcsTelemetryAcked Defines if an ack is required for the transactions of this object (1:acked, 0:not acked)
* 4-5 telemetryUpdateMode Update mode used by the telemetry module (UAVObjUpdateMode) * 4-5 telemetryUpdateMode Update mode used by the telemetry module (UAVObjUpdateMode)

View File

@ -721,10 +721,11 @@ int32_t UAVObjLoad(UAVObjHandle obj, uint16_t instId)
return -1; return -1;
// Fire event on success // Fire event on success
if (PIOS_FLASHFS_ObjLoad(obj, instId, instEntry->data) == 0) int32_t retval;
if ((retval = PIOS_FLASHFS_ObjLoad(obj, instId, instEntry->data)) == 0)
sendEvent(objEntry, instId, EV_UNPACKED); sendEvent(objEntry, instId, EV_UNPACKED);
else else
return -1; return retval;
#endif #endif
#if defined(PIOS_INCLUDE_SDCARD) #if defined(PIOS_INCLUDE_SDCARD)

View File

@ -97,6 +97,9 @@ ConfigPipXtremeWidget::ConfigPipXtremeWidget(QWidget *parent) : ConfigTaskWidget
// Request and update of the setting object. // Request and update of the setting object.
settingsUpdated = false; settingsUpdated = false;
pipxSettingsObj->requestUpdate(); pipxSettingsObj->requestUpdate();
disableMouseWheelEvents();
} }
ConfigPipXtremeWidget::~ConfigPipXtremeWidget() ConfigPipXtremeWidget::~ConfigPipXtremeWidget()

View File

@ -23,6 +23,96 @@
<enum>QFrame::Raised</enum> <enum>QFrame::Raised</enum>
</property> </property>
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout">
<item row="1" column="0" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout_12">
<item>
<widget class="QGraphicsView" name="graphicsView_Spectrum">
<property name="backgroundBrush">
<brush brushstyle="NoBrush">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</property>
<property name="foregroundBrush">
<brush brushstyle="NoBrush">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</property>
<property name="interactive">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item row="2" column="0" colspan="2">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="message">
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="submitButtons">
<item>
<widget class="QFrame" name="frame">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="Apply">
<property name="toolTip">
<string>Send settings to the board but do not save to the non-volatile memory</string>
</property>
<property name="text">
<string>Apply</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="Save">
<property name="toolTip">
<string>Send settings to the board and save to the non-volatile memory</string>
</property>
<property name="text">
<string>Save</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item row="0" column="0"> <item row="0" column="0">
<widget class="QFrame" name="frame_2"> <widget class="QFrame" name="frame_2">
<property name="frameShape"> <property name="frameShape">
@ -1216,106 +1306,54 @@
</layout> </layout>
</widget> </widget>
</item> </item>
<item row="1" column="0" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout_12">
<item>
<widget class="QGraphicsView" name="graphicsView_Spectrum">
<property name="backgroundBrush">
<brush brushstyle="NoBrush">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</property>
<property name="foregroundBrush">
<brush brushstyle="NoBrush">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</property>
<property name="interactive">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item row="2" column="0" colspan="2">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="message">
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="submitButtons">
<item>
<widget class="QFrame" name="frame">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="Apply">
<property name="toolTip">
<string>Send settings to the board but do not save to the non-volatile memory</string>
</property>
<property name="text">
<string>Apply</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="Save">
<property name="toolTip">
<string>Send settings to the board and save to the non-volatile memory</string>
</property>
<property name="text">
<string>Save</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
</layout> </layout>
<zorder>frame_2</zorder>
<zorder>groupBox</zorder>
<zorder>layoutWidget</zorder>
<zorder>layoutWidget_2</zorder>
<zorder>graphicsView_Spectrum</zorder>
</widget> </widget>
</item> </item>
</layout> </layout>
</widget> </widget>
<tabstops>
<tabstop>PairSelect1</tabstop>
<tabstop>PairID1</tabstop>
<tabstop>PairSelect2</tabstop>
<tabstop>PairID2</tabstop>
<tabstop>PairSelect3</tabstop>
<tabstop>PairID3</tabstop>
<tabstop>PairSelect4</tabstop>
<tabstop>PairID4</tabstop>
<tabstop>FirmwareVersion</tabstop>
<tabstop>SerialNumber</tabstop>
<tabstop>DeviceID</tabstop>
<tabstop>MinFrequency</tabstop>
<tabstop>MaxFrequency</tabstop>
<tabstop>FrequencyStepSize</tabstop>
<tabstop>LinkState</tabstop>
<tabstop>RxAFC</tabstop>
<tabstop>Retries</tabstop>
<tabstop>Errors</tabstop>
<tabstop>UAVTalkErrors</tabstop>
<tabstop>Resets</tabstop>
<tabstop>TXRate</tabstop>
<tabstop>RXRate</tabstop>
<tabstop>TelemPortConfig</tabstop>
<tabstop>TelemPortSpeed</tabstop>
<tabstop>FlexiPortConfig</tabstop>
<tabstop>FlexiPortSpeed</tabstop>
<tabstop>VCPConfig</tabstop>
<tabstop>VCPSpeed</tabstop>
<tabstop>MaxRFDatarate</tabstop>
<tabstop>MaxRFTxPower</tabstop>
<tabstop>SendTimeout</tabstop>
<tabstop>MinPacketSize</tabstop>
<tabstop>FrequencyCalibration</tabstop>
<tabstop>Frequency</tabstop>
<tabstop>ScanSpectrum</tabstop>
<tabstop>AESKey</tabstop>
<tabstop>AESKeyRandom</tabstop>
<tabstop>AESEnable</tabstop>
<tabstop>graphicsView_Spectrum</tabstop>
<tabstop>Apply</tabstop>
<tabstop>Save</tabstop>
</tabstops>
<resources/> <resources/>
<connections/> <connections/>
</ui> </ui>

View File

@ -124,6 +124,17 @@ void ModeManager::activateMode(const QString &id)
m_modeStack->setCurrentIndex(index); m_modeStack->setCurrentIndex(index);
} }
void ModeManager::activateModeByWorkspaceName(const QString &id)
{
for (int i = 0; i < m_modes.count(); ++i) {
if (m_modes.at(i)->name() == id)
{
m_modeStack->setCurrentIndex(i);
return;
}
}
}
void ModeManager::objectAdded(QObject *obj) void ModeManager::objectAdded(QObject *obj)
{ {
IMode *mode = Aggregation::query<IMode>(obj); IMode *mode = Aggregation::query<IMode>(obj);

View File

@ -80,6 +80,7 @@ signals:
public slots: public slots:
void activateMode(const QString &id); void activateMode(const QString &id);
void activateModeByWorkspaceName(const QString &id);
void setFocusToCurrentMode(); void setFocusToCurrentMode();
private slots: private slots:

View File

@ -256,7 +256,10 @@ void NotifyPluginOptionsPage::addDynamicField(UAVObjectField* objField)
_dynamicFieldCondition->removeItem(smaller); _dynamicFieldCondition->removeItem(smaller);
_dynamicFieldCondition->removeItem(bigger); _dynamicFieldCondition->removeItem(bigger);
} }
_dynamicFieldCondition->setCurrentIndex(_dynamicFieldCondition->findText(NotifyPluginOptionsPage::conditionValues.at(_selectedNotification->getCondition()))); int cond=_selectedNotification->getCondition();
if(cond<0)
return;
_dynamicFieldCondition->setCurrentIndex(_dynamicFieldCondition->findText(NotifyPluginOptionsPage::conditionValues.at(cond)));
connect(_dynamicFieldCondition, SIGNAL(currentIndexChanged(QString)), connect(_dynamicFieldCondition, SIGNAL(currentIndexChanged(QString)),
this, SLOT(on_changedIndex_rangeValue(QString))); this, SLOT(on_changedIndex_rangeValue(QString)));
@ -434,8 +437,10 @@ void NotifyPluginOptionsPage::updateConfigView(NotificationItem* notification)
_optionsPage->SoundCollectionList->setCurrentIndex(_optionsPage->SoundCollectionList->findText("default")); _optionsPage->SoundCollectionList->setCurrentIndex(_optionsPage->SoundCollectionList->findText("default"));
_optionsPage->Sound3->setCurrentIndex(_optionsPage->Sound3->findText(notification->getSound3())); _optionsPage->Sound3->setCurrentIndex(_optionsPage->Sound3->findText(notification->getSound3()));
} }
int cond=notification->getCondition();
_dynamicFieldCondition->setCurrentIndex(_dynamicFieldCondition->findText(NotifyPluginOptionsPage::conditionValues.at(notification->getCondition()))); if(cond<0)
return;
_dynamicFieldCondition->setCurrentIndex(_dynamicFieldCondition->findText(NotifyPluginOptionsPage::conditionValues.at(cond)));
_sayOrder->setCurrentIndex(notification->getSayOrder()); _sayOrder->setCurrentIndex(notification->getSayOrder());

View File

@ -35,6 +35,7 @@
#include <QEventLoop> #include <QEventLoop>
#include <QTimer> #include <QTimer>
#include <objectpersistence.h> #include <objectpersistence.h>
#include <firmwareiapobj.h>
// ****************************** // ******************************
// constructor/destructor // constructor/destructor
@ -199,25 +200,63 @@ void UAVObjectUtilManager::objectPersistenceOperationFailed()
*/ */
void UAVObjectUtilManager::objectPersistenceUpdated(UAVObject * obj) void UAVObjectUtilManager::objectPersistenceUpdated(UAVObject * obj)
{ {
qDebug() << "objectPersistenceUpdated: " << obj->getField("Operation")->getValue().toString(); Q_ASSERT(obj);
Q_ASSERT(obj->getName().compare("ObjectPersistence") == 0); Q_ASSERT(obj->getObjID() == ObjectPersistence::OBJID);
if(saveState == AWAITING_COMPLETED) { ObjectPersistence::DataFields objectPersistence = ((ObjectPersistence *)obj)->getData();
failureTimer.stop();
// Check flight is saying it completed. This is the only thing flight should do to trigger an update.
Q_ASSERT( obj->getField("Operation")->getValue().toString().compare(QString("Completed")) == 0 );
if(saveState == AWAITING_COMPLETED && objectPersistence.Operation == ObjectPersistence::OPERATION_ERROR) {
failureTimer.stop();
objectPersistenceOperationFailed();
} else if (saveState == AWAITING_COMPLETED &&
objectPersistence.Operation == ObjectPersistence::OPERATION_COMPLETED) {
failureTimer.stop();
// Check right object saved // Check right object saved
UAVObject* savingObj = queue.head(); UAVObject* savingObj = queue.head();
Q_ASSERT( obj->getField("ObjectID")->getValue() == savingObj->getObjID() ); if(objectPersistence.ObjectID != savingObj->getObjID() ) {
objectPersistenceOperationFailed();
return;
}
obj->disconnect(this); obj->disconnect(this);
queue.dequeue(); // We can now remove the object, it's done. queue.dequeue(); // We can now remove the object, it's done.
saveState = IDLE; saveState = IDLE;
emit saveCompleted(obj->getField("ObjectID")->getValue().toInt(), true);
emit saveCompleted(objectPersistence.ObjectID, true);
saveNextObject(); saveNextObject();
} }
} }
/**
* Helper function that makes sure FirmwareIAP is updated and then returns the data
*/
FirmwareIAPObj::DataFields UAVObjectUtilManager::getFirmwareIap()
{
FirmwareIAPObj::DataFields dummy;
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
Q_ASSERT(pm);
if (!pm)
return dummy;
UAVObjectManager *om = pm->getObject<UAVObjectManager>();
Q_ASSERT(om);
if (!om)
return dummy;
FirmwareIAPObj *firmwareIap = FirmwareIAPObj::GetInstance(om);
Q_ASSERT(firmwareIap);
if (!firmwareIap)
return dummy;
// The code below will ask for the object update and wait for the updated to be received,
// or the timeout of the timer, set to 1 second.
QEventLoop loop;
connect(firmwareIap, SIGNAL(objectUpdated(UAVObject*)), &loop, SLOT(quit()));
QTimer::singleShot(1000, &loop, SLOT(quit())); // Create a timeout
firmwareIap->requestUpdate();
loop.exec();
return firmwareIap->getData();
}
/** /**
* Get the UAV Board model, for anyone interested. Return format is: * Get the UAV Board model, for anyone interested. Return format is:
@ -225,25 +264,8 @@ void UAVObjectUtilManager::objectPersistenceUpdated(UAVObject * obj)
*/ */
int UAVObjectUtilManager::getBoardModel() int UAVObjectUtilManager::getBoardModel()
{ {
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); FirmwareIAPObj::DataFields firmwareIapData = getFirmwareIap();
if (!pm) return (firmwareIapData.BoardType << 8) + firmwareIapData.BoardRevision;
return 0;
UAVObjectManager *om = pm->getObject<UAVObjectManager>();
if (!om)
return 0;
UAVDataObject *obj = dynamic_cast<UAVDataObject *>(om->getObject(QString("FirmwareIAPObj")));
// The code below will ask for the object update and wait for the updated to be received,
// or the timeout of the timer, set to 1 second.
QEventLoop loop;
connect(obj, SIGNAL(objectUpdated(UAVObject*)), &loop, SLOT(quit()));
QTimer::singleShot(1000, &loop, SLOT(quit())); // Create a timeout
obj->requestUpdate();
loop.exec();
int boardType = (obj->getField("BoardType")->getValue().toInt()) << 8;
boardType += obj->getField("BoardRevision")->getValue().toInt();
return boardType;
} }
/** /**
@ -252,54 +274,18 @@ int UAVObjectUtilManager::getBoardModel()
QByteArray UAVObjectUtilManager::getBoardCPUSerial() QByteArray UAVObjectUtilManager::getBoardCPUSerial()
{ {
QByteArray cpuSerial; QByteArray cpuSerial;
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); FirmwareIAPObj::DataFields firmwareIapData = getFirmwareIap();
if (!pm)
return 0;
UAVObjectManager *om = pm->getObject<UAVObjectManager>();
if (!om)
return 0;
UAVDataObject *obj = dynamic_cast<UAVDataObject *>(om->getObject(QString("FirmwareIAPObj"))); for (int i = 0; i < FirmwareIAPObj::CPUSERIAL_NUMELEM; i++)
// The code below will ask for the object update and wait for the updated to be received, cpuSerial.append(firmwareIapData.CPUSerial[i]);
// or the timeout of the timer, set to 1 second.
QEventLoop loop;
connect(obj, SIGNAL(objectUpdated(UAVObject*)), &loop, SLOT(quit()));
QTimer::singleShot(1000, &loop, SLOT(quit())); // Create a timeout
obj->requestUpdate();
loop.exec();
UAVObjectField* cpuField = obj->getField("CPUSerial");
for (uint i = 0; i < cpuField->getNumElements(); ++i) {
cpuSerial.append(cpuField->getValue(i).toUInt());
}
return cpuSerial; return cpuSerial;
} }
quint32 UAVObjectUtilManager::getFirmwareCRC() quint32 UAVObjectUtilManager::getFirmwareCRC()
{ {
quint32 fwCRC; FirmwareIAPObj::DataFields firmwareIapData = getFirmwareIap();
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); return firmwareIapData.crc;
if (!pm)
return 0;
UAVObjectManager *om = pm->getObject<UAVObjectManager>();
if (!om)
return 0;
UAVDataObject *obj = dynamic_cast<UAVDataObject *>(om->getObject(QString("FirmwareIAPObj")));
obj->getField("crc")->setValue(0);
obj->updated();
// The code below will ask for the object update and wait for the updated to be received,
// or the timeout of the timer, set to 1 second.
QEventLoop loop;
connect(obj, SIGNAL(objectUpdated(UAVObject*)), &loop, SLOT(quit()));
QTimer::singleShot(1000, &loop, SLOT(quit())); // Create a timeout
obj->requestUpdate();
loop.exec();
UAVObjectField* fwCRCField = obj->getField("crc");
fwCRC=(quint32)fwCRCField->getValue().toLongLong();
return fwCRC;
} }
/** /**
@ -308,27 +294,11 @@ quint32 UAVObjectUtilManager::getFirmwareCRC()
QByteArray UAVObjectUtilManager::getBoardDescription() QByteArray UAVObjectUtilManager::getBoardDescription()
{ {
QByteArray ret; QByteArray ret;
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); FirmwareIAPObj::DataFields firmwareIapData = getFirmwareIap();
if (!pm)
return 0;
UAVObjectManager *om = pm->getObject<UAVObjectManager>();
if (!om)
return 0;
UAVDataObject *obj = dynamic_cast<UAVDataObject *>(om->getObject(QString("FirmwareIAPObj"))); for (int i = 0; i < FirmwareIAPObj::DESCRIPTION_NUMELEM; i++)
// The code below will ask for the object update and wait for the updated to be received, ret.append(firmwareIapData.Description[i]);
// or the timeout of the timer, set to 1 second.
QEventLoop loop;
connect(obj, SIGNAL(objectUpdated(UAVObject*)), &loop, SLOT(quit()));
QTimer::singleShot(1000, &loop, SLOT(quit())); // Create a timeout
obj->requestUpdate();
loop.exec();
UAVObjectField* descriptionField = obj->getField("Description");
// Description starts with an offset of
for (uint i = 0; i < descriptionField->getNumElements(); ++i) {
ret.append(descriptionField->getValue(i).toInt());
}
return ret; return ret;
} }

View File

@ -43,6 +43,8 @@
#include <QQueue> #include <QQueue>
#include <QComboBox> #include <QComboBox>
#include <QDateTime> #include <QDateTime>
#include <firmwareiapobj.h>
class UAVOBJECTUTIL_EXPORT UAVObjectUtilManager: public QObject class UAVOBJECTUTIL_EXPORT UAVObjectUtilManager: public QObject
{ {
Q_OBJECT Q_OBJECT
@ -69,6 +71,8 @@ public:
static bool descriptionToStructure(QByteArray desc,deviceDescriptorStruct * struc); static bool descriptionToStructure(QByteArray desc,deviceDescriptorStruct * struc);
UAVObjectManager* getObjectManager(); UAVObjectManager* getObjectManager();
void saveObjectToSD(UAVObject *obj); void saveObjectToSD(UAVObject *obj);
protected:
FirmwareIAPObj::DataFields getFirmwareIap();
signals: signals:
void saveCompleted(int objectID, bool status); void saveCompleted(int objectID, bool status);

View File

@ -51,37 +51,37 @@ Rectangle {
WelcomePageButton { WelcomePageButton {
baseIconName: "flightdata" baseIconName: "flightdata"
label: "Flight Data" label: "Flight Data"
onClicked: welcomePlugin.openPage("Mode1") onClicked: welcomePlugin.openPage("Flight data")
} }
WelcomePageButton { WelcomePageButton {
baseIconName: "config" baseIconName: "config"
label: "Configuration" label: "Configuration"
onClicked: welcomePlugin.openPage("Mode2") onClicked: welcomePlugin.openPage("Configuration")
} }
WelcomePageButton { WelcomePageButton {
baseIconName: "planner" baseIconName: "planner"
label: "Flight Planner" label: "Flight Planner"
onClicked: welcomePlugin.openPage("Mode3") onClicked: welcomePlugin.openPage("Flight Planner")
} }
WelcomePageButton { WelcomePageButton {
baseIconName: "scopes" baseIconName: "scopes"
label: "Scopes" label: "Scopes"
onClicked: welcomePlugin.openPage("Mode4") onClicked: welcomePlugin.openPage("Scopes")
} }
WelcomePageButton { WelcomePageButton {
baseIconName: "hitl" baseIconName: "hitl"
label: "HIL" label: "HITL"
onClicked: welcomePlugin.openPage("Mode5") onClicked: welcomePlugin.openPage("HITL")
} }
WelcomePageButton { WelcomePageButton {
baseIconName: "firmware" baseIconName: "firmware"
label: "Firmware" label: "Firmware"
onClicked: welcomePlugin.openPage("Mode6") onClicked: welcomePlugin.openPage("Firmware")
} }
} //icons grid } //icons grid
} // images row } // images row

View File

@ -124,7 +124,7 @@ void WelcomeMode::openUrl(const QString &url)
void WelcomeMode::openPage(const QString &page) void WelcomeMode::openPage(const QString &page)
{ {
Core::ModeManager::instance()->activateMode(page); Core::ModeManager::instance()->activateModeByWorkspaceName(page);
} }
} // namespace Welcome } // namespace Welcome

View File

@ -1,7 +1,7 @@
<xml> <xml>
<object name="ObjectPersistence" singleinstance="true" settings="false"> <object name="ObjectPersistence" singleinstance="true" settings="false">
<description>Someone who knows please enter this</description> <description>Someone who knows please enter this</description>
<field name="Operation" units="" type="enum" elements="1" options="NOP,Load,Save,Delete,FullErase,Completed"/> <field name="Operation" units="" type="enum" elements="1" options="NOP,Load,Save,Delete,FullErase,Completed,Error"/>
<field name="Selection" units="" type="enum" elements="1" options="SingleObject,AllSettings,AllMetaObjects,AllObjects"/> <field name="Selection" units="" type="enum" elements="1" options="SingleObject,AllSettings,AllMetaObjects,AllObjects"/>
<field name="ObjectID" units="" type="uint32" elements="1"/> <field name="ObjectID" units="" type="uint32" elements="1"/>
<field name="InstanceID" units="" type="uint32" elements="1"/> <field name="InstanceID" units="" type="uint32" elements="1"/>