mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-18 03:52:11 +01:00
Several bugfixes.
Created "simple wizard" button witch bypasses the sticks identification screen. Small bugfix to fix GCS crashing if trying to upload a firmware bigger then the HW capacity.
This commit is contained in:
parent
7bf9f4e817
commit
0d92e00125
@ -45,8 +45,6 @@ ConfigCCAttitudeWidget::ConfigCCAttitudeWidget(QWidget *parent) :
|
|||||||
setupButtons(ui->applyButton,ui->saveButton);
|
setupButtons(ui->applyButton,ui->saveButton);
|
||||||
addUAVObject("AttitudeSettings");
|
addUAVObject("AttitudeSettings");
|
||||||
|
|
||||||
UAVObject * settings = AttitudeSettings::GetInstance(getObjectManager());
|
|
||||||
|
|
||||||
// Connect the help button
|
// Connect the help button
|
||||||
connect(ui->ccAttitudeHelp, SIGNAL(clicked()), this, SLOT(openHelp()));
|
connect(ui->ccAttitudeHelp, SIGNAL(clicked()), this, SLOT(openHelp()));
|
||||||
addUAVObjectToWidgetRelation("AttitudeSettings","ZeroDuringArming",ui->zeroGyroBiasOnArming);
|
addUAVObjectToWidgetRelation("AttitudeSettings","ZeroDuringArming",ui->zeroGyroBiasOnArming);
|
||||||
|
@ -71,7 +71,11 @@ ConfigInputWidget::ConfigInputWidget(QWidget *parent) : ConfigTaskWidget(parent)
|
|||||||
}
|
}
|
||||||
goWizard=new QPushButton(tr("Start Wizard"),this);
|
goWizard=new QPushButton(tr("Start Wizard"),this);
|
||||||
m_config->advancedPage->layout()->addWidget(goWizard);
|
m_config->advancedPage->layout()->addWidget(goWizard);
|
||||||
connect(goWizard,SIGNAL(clicked()),this,SLOT(goToWizard()));
|
connect(goWizard,SIGNAL(clicked()),this,SLOT(goToNormalWizard()));
|
||||||
|
goSimpleWizard=new QPushButton(tr("Start Simple Wizard"),this);
|
||||||
|
m_config->advancedPage->layout()->addWidget(goSimpleWizard);
|
||||||
|
connect(goSimpleWizard,SIGNAL(clicked()),this,SLOT(goToSimpleWizard()));
|
||||||
|
|
||||||
connect(m_config->wzNext,SIGNAL(clicked()),this,SLOT(wzNext()));
|
connect(m_config->wzNext,SIGNAL(clicked()),this,SLOT(wzNext()));
|
||||||
connect(m_config->wzCancel,SIGNAL(clicked()),this,SLOT(wzCancel()));
|
connect(m_config->wzCancel,SIGNAL(clicked()),this,SLOT(wzCancel()));
|
||||||
connect(m_config->wzBack,SIGNAL(clicked()),this,SLOT(wzBack()));
|
connect(m_config->wzBack,SIGNAL(clicked()),this,SLOT(wzBack()));
|
||||||
@ -92,9 +96,10 @@ ConfigInputWidget::ConfigInputWidget(QWidget *parent) : ConfigTaskWidget(parent)
|
|||||||
addUAVObjectToWidgetRelation("ManualControlSettings","Stabilization3Settings",m_config->fmsSsPos3Yaw,"Yaw");
|
addUAVObjectToWidgetRelation("ManualControlSettings","Stabilization3Settings",m_config->fmsSsPos3Yaw,"Yaw");
|
||||||
|
|
||||||
addUAVObjectToWidgetRelation("ManualControlSettings","Arming",m_config->armControl);
|
addUAVObjectToWidgetRelation("ManualControlSettings","Arming",m_config->armControl);
|
||||||
addUAVObjectToWidgetRelation("ManualControlSettings","armTimeout",m_config->armTimeout,0,1000);
|
addUAVObjectToWidgetRelation("ManualControlSettings","ArmedTimeout",m_config->armTimeout,0,1000);
|
||||||
addUAVObject("ManualControlCommand");
|
connect( ManualControlCommand::GetInstance(getObjectManager()),SIGNAL(objectUpdated(UAVObject*)),this,SLOT(moveFMSlider()));
|
||||||
addWidget(goWizard);
|
addWidget(goWizard);
|
||||||
|
addWidget(goSimpleWizard);
|
||||||
enableControls(false);
|
enableControls(false);
|
||||||
|
|
||||||
populateWidgets();
|
populateWidgets();
|
||||||
@ -252,7 +257,16 @@ void ConfigInputWidget::openHelp()
|
|||||||
|
|
||||||
QDesktopServices::openUrl( QUrl("http://wiki.openpilot.org/display/Doc/Input+Configuration", QUrl::StrictMode) );
|
QDesktopServices::openUrl( QUrl("http://wiki.openpilot.org/display/Doc/Input+Configuration", QUrl::StrictMode) );
|
||||||
}
|
}
|
||||||
|
void ConfigInputWidget::goToSimpleWizard()
|
||||||
|
{
|
||||||
|
isSimple=true;
|
||||||
|
goToWizard();
|
||||||
|
}
|
||||||
|
void ConfigInputWidget::goToNormalWizard()
|
||||||
|
{
|
||||||
|
isSimple=false;
|
||||||
|
goToWizard();
|
||||||
|
}
|
||||||
void ConfigInputWidget::goToWizard()
|
void ConfigInputWidget::goToWizard()
|
||||||
{
|
{
|
||||||
QMessageBox msgBox;
|
QMessageBox msgBox;
|
||||||
@ -357,7 +371,7 @@ void ConfigInputWidget::setupWizardWidget(int step)
|
|||||||
m_config->checkBoxesLayout->layout()->addWidget(mode2);
|
m_config->checkBoxesLayout->layout()->addWidget(mode2);
|
||||||
wizardStep=wizardChooseMode;
|
wizardStep=wizardChooseMode;
|
||||||
}
|
}
|
||||||
else if(step==wizardIdentifySticks)
|
else if(step==wizardIdentifySticks && !isSimple)
|
||||||
{
|
{
|
||||||
usedChannels.clear();
|
usedChannels.clear();
|
||||||
if(wizardStep==wizardChooseMode)
|
if(wizardStep==wizardChooseMode)
|
||||||
@ -380,8 +394,19 @@ void ConfigInputWidget::setupWizardWidget(int step)
|
|||||||
connect(receiverActivityObj, SIGNAL(objectUpdated(UAVObject*)), this, SLOT(identifyControls()));
|
connect(receiverActivityObj, SIGNAL(objectUpdated(UAVObject*)), this, SLOT(identifyControls()));
|
||||||
m_config->wzNext->setEnabled(false);
|
m_config->wzNext->setEnabled(false);
|
||||||
}
|
}
|
||||||
else if(step==wizardIdentifyCenter)
|
else if(step==wizardIdentifyCenter || (isSimple && step==wizardIdentifySticks))
|
||||||
{
|
{
|
||||||
|
if(wizardStep==wizardChooseMode)
|
||||||
|
{
|
||||||
|
QRadioButton * mode=qobject_cast<QRadioButton *>(extraWidgets.at(0));
|
||||||
|
if(mode->isChecked())
|
||||||
|
transmitterMode=mode1;
|
||||||
|
else
|
||||||
|
transmitterMode=mode2;
|
||||||
|
delete extraWidgets.at(0);
|
||||||
|
delete extraWidgets.at(1);
|
||||||
|
extraWidgets.clear();
|
||||||
|
}
|
||||||
setTxMovement(centerAll);
|
setTxMovement(centerAll);
|
||||||
if(wizardStep==wizardIdentifySticks)
|
if(wizardStep==wizardIdentifySticks)
|
||||||
disconnect(receiverActivityObj, SIGNAL(objectUpdated(UAVObject*)), this, SLOT(identifyControls()));
|
disconnect(receiverActivityObj, SIGNAL(objectUpdated(UAVObject*)), this, SLOT(identifyControls()));
|
||||||
@ -409,10 +434,17 @@ void ConfigInputWidget::setupWizardWidget(int step)
|
|||||||
}
|
}
|
||||||
manualSettingsObj->setData(manualSettingsData);
|
manualSettingsObj->setData(manualSettingsData);
|
||||||
}
|
}
|
||||||
foreach (QWidget * wd, extraWidgets)
|
if(wizardStep==wizardIdentifyInverted)
|
||||||
{
|
{
|
||||||
if(wd)
|
foreach(QWidget * wd,extraWidgets)
|
||||||
delete wd;
|
{
|
||||||
|
QCheckBox * cb=qobject_cast<QCheckBox *>(wd);
|
||||||
|
if(cb)
|
||||||
|
{
|
||||||
|
disconnect(cb,SIGNAL(toggled(bool)),this,SLOT(invertControls()));
|
||||||
|
delete cb;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
extraWidgets.clear();
|
extraWidgets.clear();
|
||||||
disconnect(manualCommandObj, SIGNAL(objectUpdated(UAVObject*)), this, SLOT(moveSticks()));
|
disconnect(manualCommandObj, SIGNAL(objectUpdated(UAVObject*)), this, SLOT(moveSticks()));
|
||||||
@ -423,7 +455,7 @@ void ConfigInputWidget::setupWizardWidget(int step)
|
|||||||
mdata.flightTelemetryUpdatePeriod = 150;
|
mdata.flightTelemetryUpdatePeriod = 150;
|
||||||
manualCommandObj->setMetadata(mdata);
|
manualCommandObj->setMetadata(mdata);
|
||||||
manualSettingsData=manualSettingsObj->getData();
|
manualSettingsData=manualSettingsObj->getData();
|
||||||
for(int i=0;i<ManualControlSettings::CHANNELMAX_NUMELEM;++i)
|
for(uint i=0;i<ManualControlSettings::CHANNELMAX_NUMELEM;++i)
|
||||||
{
|
{
|
||||||
manualSettingsData.ChannelMin[i]=manualSettingsData.ChannelNeutral[i];
|
manualSettingsData.ChannelMin[i]=manualSettingsData.ChannelNeutral[i];
|
||||||
manualSettingsData.ChannelMax[i]=manualSettingsData.ChannelNeutral[i];
|
manualSettingsData.ChannelMax[i]=manualSettingsData.ChannelNeutral[i];
|
||||||
@ -460,7 +492,10 @@ void ConfigInputWidget::setupWizardWidget(int step)
|
|||||||
{
|
{
|
||||||
QCheckBox * cb=qobject_cast<QCheckBox *>(wd);
|
QCheckBox * cb=qobject_cast<QCheckBox *>(wd);
|
||||||
if(cb)
|
if(cb)
|
||||||
|
{
|
||||||
|
disconnect(cb,SIGNAL(toggled(bool)),this,SLOT(invertControls()));
|
||||||
delete cb;
|
delete cb;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
wizardStep=wizardFinish;
|
wizardStep=wizardFinish;
|
||||||
extraWidgets.clear();
|
extraWidgets.clear();
|
||||||
@ -537,7 +572,7 @@ void ConfigInputWidget::identifyControls()
|
|||||||
void ConfigInputWidget::identifyLimits()
|
void ConfigInputWidget::identifyLimits()
|
||||||
{
|
{
|
||||||
manualCommandData=manualCommandObj->getData();
|
manualCommandData=manualCommandObj->getData();
|
||||||
for(int i=0;i<ManualControlSettings::CHANNELMAX_NUMELEM;++i)
|
for(uint i=0;i<ManualControlSettings::CHANNELMAX_NUMELEM;++i)
|
||||||
{
|
{
|
||||||
if(manualSettingsData.ChannelMin[i]>manualCommandData.Channel[i])
|
if(manualSettingsData.ChannelMin[i]>manualCommandData.Channel[i])
|
||||||
manualSettingsData.ChannelMin[i]=manualCommandData.Channel[i];
|
manualSettingsData.ChannelMin[i]=manualCommandData.Channel[i];
|
||||||
@ -878,7 +913,10 @@ void ConfigInputWidget::dimOtherControls(bool value)
|
|||||||
void ConfigInputWidget::enableControls(bool enable)
|
void ConfigInputWidget::enableControls(bool enable)
|
||||||
{
|
{
|
||||||
if(goWizard)
|
if(goWizard)
|
||||||
|
{
|
||||||
goWizard->setEnabled(enable);
|
goWizard->setEnabled(enable);
|
||||||
|
goSimpleWizard->setEnabled(enable);
|
||||||
|
}
|
||||||
ConfigTaskWidget::enableControls(enable);
|
ConfigTaskWidget::enableControls(enable);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -891,9 +929,10 @@ void ConfigInputWidget::invertControls()
|
|||||||
QCheckBox * cb=qobject_cast<QCheckBox *>(wd);
|
QCheckBox * cb=qobject_cast<QCheckBox *>(wd);
|
||||||
if(cb)
|
if(cb)
|
||||||
{
|
{
|
||||||
if(cb->isChecked())
|
int index=manualSettingsObj->getFields().at(0)->getElementNames().indexOf(cb->text());
|
||||||
|
if((cb->isChecked() && (manualSettingsData.ChannelMax[index]>manualSettingsData.ChannelMin[index])) ||
|
||||||
|
(!cb->isChecked() && (manualSettingsData.ChannelMax[index]<manualSettingsData.ChannelMin[index])))
|
||||||
{
|
{
|
||||||
int index=manualSettingsObj->getFields().at(0)->getElementNames().indexOf(cb->text());
|
|
||||||
qint16 aux;
|
qint16 aux;
|
||||||
aux=manualSettingsData.ChannelMax[index];
|
aux=manualSettingsData.ChannelMax[index];
|
||||||
manualSettingsData.ChannelMax[index]=manualSettingsData.ChannelMin[index];
|
manualSettingsData.ChannelMax[index]=manualSettingsData.ChannelMin[index];
|
||||||
@ -903,20 +942,19 @@ void ConfigInputWidget::invertControls()
|
|||||||
}
|
}
|
||||||
manualSettingsObj->setData(manualSettingsData);
|
manualSettingsObj->setData(manualSettingsData);
|
||||||
}
|
}
|
||||||
void ConfigInputWidget::refreshWidgetsValues()
|
void ConfigInputWidget::moveFMSlider()
|
||||||
{
|
{
|
||||||
ConfigTaskWidget::refreshWidgetsValues();
|
ManualControlSettings::DataFields manualSettingsDataPriv = manualSettingsObj->getData();
|
||||||
manualSettingsData = manualSettingsObj->getData();
|
ManualControlCommand::DataFields manualCommandDataPriv=manualCommandObj->getData();
|
||||||
manualCommandData=manualCommandObj->getData();
|
uint chIndex = manualSettingsDataPriv.ChannelNumber[ManualControlSettings::CHANNELNUMBER_FLIGHTMODE];
|
||||||
uint chIndex = manualSettingsData.ChannelNumber[ManualControlSettings::CHANNELNUMBER_FLIGHTMODE];
|
|
||||||
if (chIndex < 8) {
|
if (chIndex < 8) {
|
||||||
float valueScaled;
|
float valueScaled;
|
||||||
|
|
||||||
int chMin = manualSettingsData.ChannelMin[ManualControlSettings::CHANNELMIN_FLIGHTMODE];
|
int chMin = manualSettingsDataPriv.ChannelMin[ManualControlSettings::CHANNELMIN_FLIGHTMODE];
|
||||||
int chMax = manualSettingsData.ChannelMax[ManualControlSettings::CHANNELMAX_FLIGHTMODE];
|
int chMax = manualSettingsDataPriv.ChannelMax[ManualControlSettings::CHANNELMAX_FLIGHTMODE];
|
||||||
int chNeutral = manualSettingsData.ChannelNeutral[ManualControlSettings::CHANNELNEUTRAL_FLIGHTMODE];
|
int chNeutral = manualSettingsDataPriv.ChannelNeutral[ManualControlSettings::CHANNELNEUTRAL_FLIGHTMODE];
|
||||||
|
|
||||||
int value = manualCommandData.Channel[chIndex];
|
int value = manualCommandDataPriv.Channel[chIndex];
|
||||||
if ((chMax > chMin && value >= chNeutral) || (chMin > chMax && value <= chNeutral))
|
if ((chMax > chMin && value >= chNeutral) || (chMin > chMax && value <= chNeutral))
|
||||||
{
|
{
|
||||||
if (chMax != chNeutral)
|
if (chMax != chNeutral)
|
||||||
|
@ -82,7 +82,7 @@ private:
|
|||||||
QEventLoop * loop;
|
QEventLoop * loop;
|
||||||
bool skipflag;
|
bool skipflag;
|
||||||
|
|
||||||
int currentCommand;
|
uint currentCommand;
|
||||||
|
|
||||||
ManualControlCommand * manualCommandObj;
|
ManualControlCommand * manualCommandObj;
|
||||||
ManualControlCommand::DataFields manualCommandData;
|
ManualControlCommand::DataFields manualCommandData;
|
||||||
@ -117,23 +117,27 @@ private:
|
|||||||
void resetTxControls();
|
void resetTxControls();
|
||||||
void setMoveFromCommand(int command);
|
void setMoveFromCommand(int command);
|
||||||
QPushButton * goWizard;
|
QPushButton * goWizard;
|
||||||
|
QPushButton * goSimpleWizard;
|
||||||
|
bool isSimple;
|
||||||
|
void goToWizard();
|
||||||
private slots:
|
private slots:
|
||||||
void wzNext();
|
void wzNext();
|
||||||
void wzBack();
|
void wzBack();
|
||||||
void wzCancel();
|
void wzCancel();
|
||||||
void goToWizard();
|
void goToNormalWizard();
|
||||||
|
void goToSimpleWizard();
|
||||||
void openHelp();
|
void openHelp();
|
||||||
void identifyControls();
|
void identifyControls();
|
||||||
void identifyLimits();
|
void identifyLimits();
|
||||||
void moveTxControls();
|
void moveTxControls();
|
||||||
void moveSticks();
|
void moveSticks();
|
||||||
void dimOtherControls(bool value);
|
void dimOtherControls(bool value);
|
||||||
|
void moveFMSlider();
|
||||||
void invertControls();
|
void invertControls();
|
||||||
protected:
|
protected:
|
||||||
void resizeEvent(QResizeEvent *event);
|
void resizeEvent(QResizeEvent *event);
|
||||||
virtual void enableControls(bool enable);
|
virtual void enableControls(bool enable);
|
||||||
protected slots:
|
|
||||||
virtual void refreshWidgetsValues();
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
#include <QtGui/QWidget>
|
#include <QtGui/QWidget>
|
||||||
|
|
||||||
|
|
||||||
ConfigTaskWidget::ConfigTaskWidget(QWidget *parent) : QWidget(parent),smartsave(NULL),dirty(false)
|
ConfigTaskWidget::ConfigTaskWidget(QWidget *parent) : QWidget(parent),isConnected(false),smartsave(NULL),dirty(false)
|
||||||
{
|
{
|
||||||
pm = ExtensionSystem::PluginManager::instance();
|
pm = ExtensionSystem::PluginManager::instance();
|
||||||
objManager = pm->getObject<UAVObjectManager>();
|
objManager = pm->getObject<UAVObjectManager>();
|
||||||
@ -72,7 +72,7 @@ void ConfigTaskWidget::addUAVObjectToWidgetRelation(QString object, QString fiel
|
|||||||
ow->scale=scale;
|
ow->scale=scale;
|
||||||
objOfInterest.append(ow);
|
objOfInterest.append(ow);
|
||||||
if(obj)
|
if(obj)
|
||||||
smartsave->addObject(obj);
|
smartsave->addObject((UAVDataObject*)obj);
|
||||||
if(widget==NULL)
|
if(widget==NULL)
|
||||||
{
|
{
|
||||||
// do nothing
|
// do nothing
|
||||||
@ -148,13 +148,16 @@ double ConfigTaskWidget::listMean(QList<double> list)
|
|||||||
|
|
||||||
void ConfigTaskWidget::onAutopilotDisconnect()
|
void ConfigTaskWidget::onAutopilotDisconnect()
|
||||||
{
|
{
|
||||||
enableControls(false);
|
isConnected=false;
|
||||||
|
enableControls(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigTaskWidget::onAutopilotConnect()
|
void ConfigTaskWidget::onAutopilotConnect()
|
||||||
{
|
{
|
||||||
enableControls(true);
|
dirty=false;
|
||||||
refreshWidgetsValues();
|
isConnected=true;
|
||||||
|
enableControls(true);
|
||||||
|
refreshWidgetsValues();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigTaskWidget::populateWidgets()
|
void ConfigTaskWidget::populateWidgets()
|
||||||
@ -262,7 +265,10 @@ void ConfigTaskWidget::setDirty(bool value)
|
|||||||
}
|
}
|
||||||
bool ConfigTaskWidget::isDirty()
|
bool ConfigTaskWidget::isDirty()
|
||||||
{
|
{
|
||||||
return dirty;
|
if(isConnected)
|
||||||
|
return dirty;
|
||||||
|
else
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigTaskWidget::refreshValues()
|
void ConfigTaskWidget::refreshValues()
|
||||||
|
@ -79,6 +79,7 @@ private slots:
|
|||||||
virtual void refreshValues();
|
virtual void refreshValues();
|
||||||
virtual void updateObjectsFromWidgets();
|
virtual void updateObjectsFromWidgets();
|
||||||
private:
|
private:
|
||||||
|
bool isConnected;
|
||||||
QStringList objectsList;
|
QStringList objectsList;
|
||||||
QList <objectToWidget*> objOfInterest;
|
QList <objectToWidget*> objOfInterest;
|
||||||
ExtensionSystem::PluginManager *pm;
|
ExtensionSystem::PluginManager *pm;
|
||||||
|
@ -24,8 +24,11 @@ void smartSaveButton::processClick()
|
|||||||
bool error=false;
|
bool error=false;
|
||||||
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
|
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
|
||||||
UAVObjectUtilManager* utilMngr = pm->getObject<UAVObjectUtilManager>();
|
UAVObjectUtilManager* utilMngr = pm->getObject<UAVObjectUtilManager>();
|
||||||
foreach(UAVObject * obj,objects)
|
foreach(UAVDataObject * obj,objects)
|
||||||
{
|
{
|
||||||
|
UAVObject::Metadata mdata= obj->getMetadata();
|
||||||
|
if(mdata.gcsAccess==UAVObject::ACCESS_READONLY)
|
||||||
|
continue;
|
||||||
up_result=false;
|
up_result=false;
|
||||||
current_object=obj;
|
current_object=obj;
|
||||||
for(int i=0;i<3;++i)
|
for(int i=0;i<3;++i)
|
||||||
@ -35,9 +38,9 @@ void smartSaveButton::processClick()
|
|||||||
connect(&timer,SIGNAL(timeout()),&loop,SLOT(quit()));
|
connect(&timer,SIGNAL(timeout()),&loop,SLOT(quit()));
|
||||||
obj->updated();
|
obj->updated();
|
||||||
timer.start(1000);
|
timer.start(1000);
|
||||||
qDebug()<<"begin loop";
|
//qDebug()<<"begin loop";
|
||||||
loop.exec();
|
loop.exec();
|
||||||
qDebug()<<"end loop";
|
//qDebug()<<"end loop";
|
||||||
timer.stop();
|
timer.stop();
|
||||||
disconnect(obj,SIGNAL(transactionCompleted(UAVObject*,bool)),this,SLOT(transaction_finished(UAVObject*, bool)));
|
disconnect(obj,SIGNAL(transactionCompleted(UAVObject*,bool)),this,SLOT(transaction_finished(UAVObject*, bool)));
|
||||||
disconnect(&timer,SIGNAL(timeout()),&loop,SLOT(quit()));
|
disconnect(&timer,SIGNAL(timeout()),&loop,SLOT(quit()));
|
||||||
@ -46,30 +49,32 @@ void smartSaveButton::processClick()
|
|||||||
}
|
}
|
||||||
if(up_result==false)
|
if(up_result==false)
|
||||||
{
|
{
|
||||||
|
//qDebug()<<"Object upload error:"<<obj->getName();
|
||||||
error=true;
|
error=true;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
sv_result=false;
|
sv_result=false;
|
||||||
current_objectID=obj->getObjID();
|
current_objectID=obj->getObjID();
|
||||||
if(save)
|
if(save && (obj->isSettings()))
|
||||||
{
|
{
|
||||||
for(int i=0;i<3;++i)
|
for(int i=0;i<3;++i)
|
||||||
{
|
{
|
||||||
connect(utilMngr,SIGNAL(saveCompleted(int,bool)),this,SLOT(saving_finished(int,bool)));
|
//qDebug()<<"try to save:"<<obj->getName();
|
||||||
connect(&timer,SIGNAL(timeout()),&loop,SLOT(quit()));
|
connect(utilMngr,SIGNAL(saveCompleted(int,bool)),this,SLOT(saving_finished(int,bool)));
|
||||||
utilMngr->saveObjectToSD(obj);
|
connect(&timer,SIGNAL(timeout()),&loop,SLOT(quit()));
|
||||||
timer.start(1000);
|
utilMngr->saveObjectToSD(obj);
|
||||||
loop.exec();
|
timer.start(1000);
|
||||||
timer.stop();
|
loop.exec();
|
||||||
disconnect(utilMngr,SIGNAL(saveCompleted(int,bool)),this,SLOT(saving_finished(int,bool)));
|
timer.stop();
|
||||||
disconnect(&timer,SIGNAL(timeout()),&loop,SLOT(quit()));
|
disconnect(utilMngr,SIGNAL(saveCompleted(int,bool)),this,SLOT(saving_finished(int,bool)));
|
||||||
if(sv_result)
|
disconnect(&timer,SIGNAL(timeout()),&loop,SLOT(quit()));
|
||||||
break;
|
if(sv_result)
|
||||||
}
|
break;
|
||||||
if(sv_result==false)
|
}
|
||||||
{
|
if(sv_result==false)
|
||||||
error=true;
|
{
|
||||||
}
|
error=true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
button->setEnabled(true);
|
button->setEnabled(true);
|
||||||
@ -85,12 +90,12 @@ void smartSaveButton::processClick()
|
|||||||
emit endOp();
|
emit endOp();
|
||||||
}
|
}
|
||||||
|
|
||||||
void smartSaveButton::setObjects(QList<UAVObject *> list)
|
void smartSaveButton::setObjects(QList<UAVDataObject *> list)
|
||||||
{
|
{
|
||||||
objects=list;
|
objects=list;
|
||||||
}
|
}
|
||||||
|
|
||||||
void smartSaveButton::addObject(UAVObject * obj)
|
void smartSaveButton::addObject(UAVDataObject * obj)
|
||||||
{
|
{
|
||||||
if(!objects.contains(obj))
|
if(!objects.contains(obj))
|
||||||
objects.append(obj);
|
objects.append(obj);
|
||||||
@ -114,7 +119,7 @@ void smartSaveButton::saving_finished(int id, bool result)
|
|||||||
if(id==current_objectID)
|
if(id==current_objectID)
|
||||||
{
|
{
|
||||||
sv_result=result;
|
sv_result=result;
|
||||||
qDebug()<<"saving_finished result="<<result;
|
//qDebug()<<"saving_finished result="<<result;
|
||||||
loop.quit();
|
loop.quit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,8 +17,8 @@ public:
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
smartSaveButton(QPushButton * update,QPushButton * save);
|
smartSaveButton(QPushButton * update,QPushButton * save);
|
||||||
void setObjects(QList<UAVObject *>);
|
void setObjects(QList<UAVDataObject *>);
|
||||||
void addObject(UAVObject *);
|
void addObject(UAVDataObject *);
|
||||||
void clearObjects();
|
void clearObjects();
|
||||||
signals:
|
signals:
|
||||||
void preProcessOperations();
|
void preProcessOperations();
|
||||||
@ -34,11 +34,11 @@ private:
|
|||||||
QPushButton *bupdate;
|
QPushButton *bupdate;
|
||||||
QPushButton *bsave;
|
QPushButton *bsave;
|
||||||
quint32 current_objectID;
|
quint32 current_objectID;
|
||||||
UAVObject * current_object;
|
UAVDataObject * current_object;
|
||||||
bool up_result;
|
bool up_result;
|
||||||
bool sv_result;
|
bool sv_result;
|
||||||
QEventLoop loop;
|
QEventLoop loop;
|
||||||
QList<UAVObject *> objects;
|
QList<UAVDataObject *> objects;
|
||||||
protected:
|
protected:
|
||||||
public slots:
|
public slots:
|
||||||
void enableControls(bool value);
|
void enableControls(bool value);
|
||||||
|
@ -303,7 +303,10 @@ void deviceWidget::loadFirmware()
|
|||||||
myDevice->youdont->setChecked(false);
|
myDevice->youdont->setChecked(false);
|
||||||
QByteArray desc = loadedFW.right(100);
|
QByteArray desc = loadedFW.right(100);
|
||||||
QPixmap px;
|
QPixmap px;
|
||||||
myDevice->lblCRCL->setText( QString::number(DFUObject::CRCFromQBArray(loadedFW,m_dfu->devices[deviceID].SizeOfCode)));
|
if(loadedFW.length()>m_dfu->devices[deviceID].SizeOfCode)
|
||||||
|
myDevice->lblCRCL->setText(tr("Can't calculate, file too big for device"));
|
||||||
|
else
|
||||||
|
myDevice->lblCRCL->setText( QString::number(DFUObject::CRCFromQBArray(loadedFW,m_dfu->devices[deviceID].SizeOfCode)));
|
||||||
//myDevice->lblFirmwareSizeL->setText(QString("Firmware size: ")+QVariant(loadedFW.length()).toString()+ QString(" bytes"));
|
//myDevice->lblFirmwareSizeL->setText(QString("Firmware size: ")+QVariant(loadedFW.length()).toString()+ QString(" bytes"));
|
||||||
if (populateLoadedStructuredDescription(desc))
|
if (populateLoadedStructuredDescription(desc))
|
||||||
{
|
{
|
||||||
|
@ -956,7 +956,7 @@ quint32 DFUObject::CRC32WideFast(quint32 Crc, quint32 Size, quint32 *Buffer)
|
|||||||
*/
|
*/
|
||||||
quint32 DFUObject::CRCFromQBArray(QByteArray array, quint32 Size)
|
quint32 DFUObject::CRCFromQBArray(QByteArray array, quint32 Size)
|
||||||
{
|
{
|
||||||
int pad=Size-array.length();
|
quint32 pad=Size-array.length();
|
||||||
array.append(QByteArray(pad,255));
|
array.append(QByteArray(pad,255));
|
||||||
quint32 t[Size/4];
|
quint32 t[Size/4];
|
||||||
for(int x=0;x<array.length()/4;x++)
|
for(int x=0;x<array.length()/4;x++)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user