mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-21 11: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 <math.h>
|
||||||
#include <QDesktopServices>
|
#include <QDesktopServices>
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
|
#include "systemsettings.h"
|
||||||
|
#include "mixersettings.h"
|
||||||
|
#include "actuatorsettings.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Helper delegate for the custom mixer editor table.
|
Helper delegate for the custom mixer editor table.
|
||||||
@ -443,6 +446,13 @@ void ConfigAirframeWidget::updateCustomThrottle2CurveValue(QList<double> list, d
|
|||||||
*/
|
*/
|
||||||
void ConfigAirframeWidget::refreshWidgetsValues()
|
void ConfigAirframeWidget::refreshWidgetsValues()
|
||||||
{
|
{
|
||||||
|
if(!allObjectsUpdated())
|
||||||
|
{
|
||||||
|
SystemSettings::GetInstance(getObjectManager())->requestUpdate();
|
||||||
|
MixerSettings::GetInstance(getObjectManager())->requestUpdate();
|
||||||
|
ActuatorSettings::GetInstance(getObjectManager())->requestUpdate();
|
||||||
|
return;
|
||||||
|
}
|
||||||
bool dirty=isDirty();
|
bool dirty=isDirty();
|
||||||
// Get the Airframe type from the system settings:
|
// Get the Airframe type from the system settings:
|
||||||
UAVDataObject* obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("SystemSettings")));
|
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));
|
obj = objManager->getObject(QString(object));
|
||||||
Q_ASSERT(obj);
|
Q_ASSERT(obj);
|
||||||
|
objectUpdates.insert(obj,false);
|
||||||
|
connect(obj, SIGNAL(objectUpdated(UAVObject*)),this, SLOT(objectUpdated(UAVObject*)));
|
||||||
connect(obj, SIGNAL(objectUpdated(UAVObject*)), this, SLOT(refreshWidgetsValues()));
|
connect(obj, SIGNAL(objectUpdated(UAVObject*)), this, SLOT(refreshWidgetsValues()));
|
||||||
}
|
}
|
||||||
//smartsave->addObject(obj);
|
//smartsave->addObject(obj);
|
||||||
@ -153,6 +155,10 @@ void ConfigTaskWidget::onAutopilotDisconnect()
|
|||||||
{
|
{
|
||||||
isConnected=false;
|
isConnected=false;
|
||||||
enableControls(false);
|
enableControls(false);
|
||||||
|
foreach(UAVObject *obj, objectUpdates.keys())
|
||||||
|
{
|
||||||
|
objectUpdates[obj]=false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigTaskWidget::onAutopilotConnect()
|
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();
|
bool isDirty();
|
||||||
void setDirty(bool value);
|
void setDirty(bool value);
|
||||||
void addUAVObjectToWidgetRelation(QString object, QString field, QWidget *widget, QString index);
|
void addUAVObjectToWidgetRelation(QString object, QString field, QWidget *widget, QString index);
|
||||||
|
bool allObjectsUpdated();
|
||||||
public slots:
|
public slots:
|
||||||
void onAutopilotDisconnect();
|
void onAutopilotDisconnect();
|
||||||
void onAutopilotConnect();
|
void onAutopilotConnect();
|
||||||
@ -78,6 +79,7 @@ public slots:
|
|||||||
private slots:
|
private slots:
|
||||||
virtual void refreshValues();
|
virtual void refreshValues();
|
||||||
virtual void updateObjectsFromWidgets();
|
virtual void updateObjectsFromWidgets();
|
||||||
|
void objectUpdated(UAVObject*);
|
||||||
private:
|
private:
|
||||||
bool isConnected;
|
bool isConnected;
|
||||||
QStringList objectsList;
|
QStringList objectsList;
|
||||||
@ -85,6 +87,7 @@ private:
|
|||||||
ExtensionSystem::PluginManager *pm;
|
ExtensionSystem::PluginManager *pm;
|
||||||
UAVObjectManager *objManager;
|
UAVObjectManager *objManager;
|
||||||
smartSaveButton *smartsave;
|
smartSaveButton *smartsave;
|
||||||
|
QMap<UAVObject *,bool> objectUpdates;
|
||||||
bool dirty;
|
bool dirty;
|
||||||
protected slots:
|
protected slots:
|
||||||
virtual void disableObjUpdates();
|
virtual void disableObjUpdates();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user