mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-19 09:54:15 +01:00
Mixer bug fix try
This commit is contained in:
parent
acf2aa218b
commit
246318af7b
@ -36,6 +36,9 @@
|
||||
#include <math.h>
|
||||
#include <QDesktopServices>
|
||||
#include <QUrl>
|
||||
#include "systemsettings.h"
|
||||
#include "mixersettings.h"
|
||||
#include "actuatorsettings.h"
|
||||
|
||||
/**
|
||||
Helper delegate for the custom mixer editor table.
|
||||
@ -443,6 +446,13 @@ void ConfigAirframeWidget::updateCustomThrottle2CurveValue(QList<double> list, d
|
||||
*/
|
||||
void ConfigAirframeWidget::refreshWidgetsValues()
|
||||
{
|
||||
if(!allObjectsUpdated())
|
||||
{
|
||||
SystemSettings::GetInstance(getObjectManager())->requestUpdate();
|
||||
MixerSettings::GetInstance(getObjectManager())->requestUpdate();
|
||||
ActuatorSettings::GetInstance(getObjectManager())->requestUpdate();
|
||||
return;
|
||||
}
|
||||
bool dirty=isDirty();
|
||||
// Get the Airframe type from the system settings:
|
||||
UAVDataObject* obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("SystemSettings")));
|
||||
|
@ -62,6 +62,8 @@ void ConfigTaskWidget::addUAVObjectToWidgetRelation(QString object, QString fiel
|
||||
{
|
||||
obj = objManager->getObject(QString(object));
|
||||
Q_ASSERT(obj);
|
||||
objectUpdates.insert(obj,false);
|
||||
connect(obj, SIGNAL(objectUpdated(UAVObject*)),this, SLOT(objectUpdated(UAVObject*)));
|
||||
connect(obj, SIGNAL(objectUpdated(UAVObject*)), this, SLOT(refreshWidgetsValues()));
|
||||
}
|
||||
//smartsave->addObject(obj);
|
||||
@ -153,6 +155,10 @@ void ConfigTaskWidget::onAutopilotDisconnect()
|
||||
{
|
||||
isConnected=false;
|
||||
enableControls(false);
|
||||
foreach(UAVObject *obj, objectUpdates.keys())
|
||||
{
|
||||
objectUpdates[obj]=false;
|
||||
}
|
||||
}
|
||||
|
||||
void ConfigTaskWidget::onAutopilotConnect()
|
||||
@ -308,6 +314,22 @@ void ConfigTaskWidget::enableObjUpdates()
|
||||
}
|
||||
}
|
||||
|
||||
void ConfigTaskWidget::objectUpdated(UAVObject *obj)
|
||||
{
|
||||
objectUpdates[obj]=true;
|
||||
}
|
||||
|
||||
bool ConfigTaskWidget::allObjectsUpdated()
|
||||
{
|
||||
bool ret=true;
|
||||
foreach(UAVObject *obj, objectUpdates.keys())
|
||||
{
|
||||
ret=ret & objectUpdates[obj];
|
||||
}
|
||||
qDebug()<<"ALL OBJECTS UPDATE:"<<ret;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -71,6 +71,7 @@ public:
|
||||
bool isDirty();
|
||||
void setDirty(bool value);
|
||||
void addUAVObjectToWidgetRelation(QString object, QString field, QWidget *widget, QString index);
|
||||
bool allObjectsUpdated();
|
||||
public slots:
|
||||
void onAutopilotDisconnect();
|
||||
void onAutopilotConnect();
|
||||
@ -78,6 +79,7 @@ public slots:
|
||||
private slots:
|
||||
virtual void refreshValues();
|
||||
virtual void updateObjectsFromWidgets();
|
||||
void objectUpdated(UAVObject*);
|
||||
private:
|
||||
bool isConnected;
|
||||
QStringList objectsList;
|
||||
@ -85,6 +87,7 @@ private:
|
||||
ExtensionSystem::PluginManager *pm;
|
||||
UAVObjectManager *objManager;
|
||||
smartSaveButton *smartsave;
|
||||
QMap<UAVObject *,bool> objectUpdates;
|
||||
bool dirty;
|
||||
protected slots:
|
||||
virtual void disableObjUpdates();
|
||||
|
Loading…
x
Reference in New Issue
Block a user