mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-11-30 08:24:11 +01:00
Merge branch 'next' into thread/OP-39
This commit is contained in:
commit
59d71c2b98
@ -33,7 +33,6 @@
|
|||||||
#define PIOS_INCLUDE_SYS
|
#define PIOS_INCLUDE_SYS
|
||||||
#define PIOS_INCLUDE_DELAY
|
#define PIOS_INCLUDE_DELAY
|
||||||
#define PIOS_INCLUDE_LED
|
#define PIOS_INCLUDE_LED
|
||||||
#define PIOS_INCLUDE_SDCARD
|
|
||||||
#define PIOS_INCLUDE_FREERTOS
|
#define PIOS_INCLUDE_FREERTOS
|
||||||
#define PIOS_INCLUDE_COM
|
#define PIOS_INCLUDE_COM
|
||||||
#define PIOS_INCLUDE_UDP
|
#define PIOS_INCLUDE_UDP
|
||||||
|
@ -463,15 +463,6 @@ static void updateSystemAlarms()
|
|||||||
AlarmsClear(SYSTEMALARMS_ALARM_STACKOVERFLOW);
|
AlarmsClear(SYSTEMALARMS_ALARM_STACKOVERFLOW);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(PIOS_INCLUDE_SDCARD)
|
|
||||||
// Check for SD card
|
|
||||||
if (PIOS_SDCARD_IsMounted() == 0) {
|
|
||||||
AlarmsSet(SYSTEMALARMS_ALARM_SDCARD, SYSTEMALARMS_ALARM_ERROR);
|
|
||||||
} else {
|
|
||||||
AlarmsClear(SYSTEMALARMS_ALARM_SDCARD);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Check for event errors
|
// Check for event errors
|
||||||
UAVObjGetStats(&objStats);
|
UAVObjGetStats(&objStats);
|
||||||
EventGetStats(&evStats);
|
EventGetStats(&evStats);
|
||||||
|
@ -33,7 +33,6 @@
|
|||||||
#define PIOS_INCLUDE_SYS
|
#define PIOS_INCLUDE_SYS
|
||||||
#define PIOS_INCLUDE_DELAY
|
#define PIOS_INCLUDE_DELAY
|
||||||
#define PIOS_INCLUDE_LED
|
#define PIOS_INCLUDE_LED
|
||||||
#define PIOS_INCLUDE_SDCARD
|
|
||||||
#define PIOS_INCLUDE_FREERTOS
|
#define PIOS_INCLUDE_FREERTOS
|
||||||
#define PIOS_INCLUDE_COM
|
#define PIOS_INCLUDE_COM
|
||||||
#define PIOS_INCLUDE_UDP
|
#define PIOS_INCLUDE_UDP
|
||||||
|
@ -46,13 +46,6 @@
|
|||||||
#define UAVOBJ_GCS_TELEMETRY_UPDATE_MODE_SHIFT 6
|
#define UAVOBJ_GCS_TELEMETRY_UPDATE_MODE_SHIFT 6
|
||||||
#define UAVOBJ_UPDATE_MODE_MASK 0x3
|
#define UAVOBJ_UPDATE_MODE_MASK 0x3
|
||||||
|
|
||||||
|
|
||||||
// FIXME: All this typedef for SDCARD needs to be abstracted away
|
|
||||||
#if !defined(PIOS_INCLUDE_SDCARD)
|
|
||||||
typedef struct {} FILEINFO;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
typedef void* UAVObjHandle;
|
typedef void* UAVObjHandle;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -164,8 +157,10 @@ int32_t UAVObjPack(UAVObjHandle obj_handle, uint16_t instId, uint8_t* dataOut);
|
|||||||
int32_t UAVObjSave(UAVObjHandle obj_handle, uint16_t instId);
|
int32_t UAVObjSave(UAVObjHandle obj_handle, uint16_t instId);
|
||||||
int32_t UAVObjLoad(UAVObjHandle obj_handle, uint16_t instId);
|
int32_t UAVObjLoad(UAVObjHandle obj_handle, uint16_t instId);
|
||||||
int32_t UAVObjDelete(UAVObjHandle obj_handle, uint16_t instId);
|
int32_t UAVObjDelete(UAVObjHandle obj_handle, uint16_t instId);
|
||||||
|
#if defined(PIOS_INCLUDE_SDCARD)
|
||||||
int32_t UAVObjSaveToFile(UAVObjHandle obj_handle, uint16_t instId, FILEINFO* file);
|
int32_t UAVObjSaveToFile(UAVObjHandle obj_handle, uint16_t instId, FILEINFO* file);
|
||||||
UAVObjHandle UAVObjLoadFromFile(FILEINFO* file);
|
UAVObjHandle UAVObjLoadFromFile(FILEINFO* file);
|
||||||
|
#endif
|
||||||
int32_t UAVObjSaveSettings();
|
int32_t UAVObjSaveSettings();
|
||||||
int32_t UAVObjLoadSettings();
|
int32_t UAVObjLoadSettings();
|
||||||
int32_t UAVObjDeleteSettings();
|
int32_t UAVObjDeleteSettings();
|
||||||
|
@ -668,6 +668,7 @@ unlock_exit:
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(PIOS_INCLUDE_SDCARD)
|
||||||
/**
|
/**
|
||||||
* Save the data of the specified object instance to the file system (SD card).
|
* Save the data of the specified object instance to the file system (SD card).
|
||||||
* The object will be appended and the file will not be closed.
|
* The object will be appended and the file will not be closed.
|
||||||
@ -682,7 +683,6 @@ int32_t UAVObjSaveToFile(UAVObjHandle obj_handle, uint16_t instId,
|
|||||||
{
|
{
|
||||||
PIOS_Assert(obj_handle);
|
PIOS_Assert(obj_handle);
|
||||||
|
|
||||||
#if defined(PIOS_INCLUDE_SDCARD)
|
|
||||||
uint32_t bytesWritten;
|
uint32_t bytesWritten;
|
||||||
// Check for file system availability
|
// Check for file system availability
|
||||||
if (PIOS_SDCARD_IsMounted() == 0) {
|
if (PIOS_SDCARD_IsMounted() == 0) {
|
||||||
@ -741,9 +741,9 @@ int32_t UAVObjSaveToFile(UAVObjHandle obj_handle, uint16_t instId,
|
|||||||
}
|
}
|
||||||
// Done
|
// Done
|
||||||
xSemaphoreGiveRecursive(mutex);
|
xSemaphoreGiveRecursive(mutex);
|
||||||
#endif /* PIOS_INCLUDE_SDCARD */
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#endif /* PIOS_INCLUDE_SDCARD */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Save the data of the specified object to the file system (SD card).
|
* Save the data of the specified object to the file system (SD card).
|
||||||
@ -811,6 +811,7 @@ int32_t UAVObjSave(UAVObjHandle obj_handle, uint16_t instId)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(PIOS_INCLUDE_SDCARD)
|
||||||
/**
|
/**
|
||||||
* Load an object from the file system (SD card).
|
* Load an object from the file system (SD card).
|
||||||
* @param[in] file File to read from
|
* @param[in] file File to read from
|
||||||
@ -818,7 +819,6 @@ int32_t UAVObjSave(UAVObjHandle obj_handle, uint16_t instId)
|
|||||||
*/
|
*/
|
||||||
UAVObjHandle UAVObjLoadFromFile(FILEINFO * file)
|
UAVObjHandle UAVObjLoadFromFile(FILEINFO * file)
|
||||||
{
|
{
|
||||||
#if defined(PIOS_INCLUDE_SDCARD)
|
|
||||||
uint32_t bytesRead;
|
uint32_t bytesRead;
|
||||||
struct UAVOBase *objEntry;
|
struct UAVOBase *objEntry;
|
||||||
InstanceHandle instEntry;
|
InstanceHandle instEntry;
|
||||||
@ -898,10 +898,8 @@ UAVObjHandle UAVObjLoadFromFile(FILEINFO * file)
|
|||||||
// Unlock
|
// Unlock
|
||||||
xSemaphoreGiveRecursive(mutex);
|
xSemaphoreGiveRecursive(mutex);
|
||||||
return obj_handle;
|
return obj_handle;
|
||||||
#else /* PIOS_INCLUDE_SDCARD */
|
|
||||||
return NULL;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
#endif /* PIOS_INCLUDE_SDCARD */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load an object from the file system (SD card).
|
* Load an object from the file system (SD card).
|
||||||
|
@ -1385,26 +1385,6 @@
|
|||||||
id="Telemetry-Critical"
|
id="Telemetry-Critical"
|
||||||
style="fill:#cf0e0e;fill-opacity:1;stroke:#ffffff;stroke-width:0.29055119;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;display:inline" />
|
style="fill:#cf0e0e;fill-opacity:1;stroke:#ffffff;stroke-width:0.29055119;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;display:inline" />
|
||||||
</g>
|
</g>
|
||||||
<g
|
|
||||||
style="display:inline"
|
|
||||||
inkscape:label="SDCard-OK"
|
|
||||||
id="layer1"
|
|
||||||
inkscape:groupmode="layer" />
|
|
||||||
<g
|
|
||||||
style="display:inline"
|
|
||||||
inkscape:label="SDCard-Warning"
|
|
||||||
id="layer6"
|
|
||||||
inkscape:groupmode="layer" />
|
|
||||||
<g
|
|
||||||
style="display:inline"
|
|
||||||
inkscape:label="SDCard-Error"
|
|
||||||
id="layer11"
|
|
||||||
inkscape:groupmode="layer" />
|
|
||||||
<g
|
|
||||||
style="display:inline"
|
|
||||||
inkscape:label="SDCard-Critical"
|
|
||||||
id="layer20"
|
|
||||||
inkscape:groupmode="layer" />
|
|
||||||
<g
|
<g
|
||||||
style="display:none"
|
style="display:none"
|
||||||
inkscape:label="Memory-OK"
|
inkscape:label="Memory-OK"
|
||||||
|
Before Width: | Height: | Size: 236 KiB After Width: | Height: | Size: 235 KiB |
@ -82,12 +82,12 @@ ConfigInputWidget::ConfigInputWidget(QWidget *parent) : ConfigTaskWidget(parent)
|
|||||||
connect(m_config->wzBack,SIGNAL(clicked()),this,SLOT(wzBack()));
|
connect(m_config->wzBack,SIGNAL(clicked()),this,SLOT(wzBack()));
|
||||||
|
|
||||||
m_config->stackedWidget->setCurrentIndex(0);
|
m_config->stackedWidget->setCurrentIndex(0);
|
||||||
addUAVObjectToWidgetRelation("ManualControlSettings","FlightModePosition",m_config->fmsModePos1,0);
|
addUAVObjectToWidgetRelation("ManualControlSettings","FlightModePosition",m_config->fmsModePos1,0,1,true);
|
||||||
addUAVObjectToWidgetRelation("ManualControlSettings","FlightModePosition",m_config->fmsModePos2,1);
|
addUAVObjectToWidgetRelation("ManualControlSettings","FlightModePosition",m_config->fmsModePos2,1,1,true);
|
||||||
addUAVObjectToWidgetRelation("ManualControlSettings","FlightModePosition",m_config->fmsModePos3,2);
|
addUAVObjectToWidgetRelation("ManualControlSettings","FlightModePosition",m_config->fmsModePos3,2,1,true);
|
||||||
addUAVObjectToWidgetRelation("ManualControlSettings","FlightModePosition",m_config->fmsModePos4,3);
|
addUAVObjectToWidgetRelation("ManualControlSettings","FlightModePosition",m_config->fmsModePos4,3,1,true);
|
||||||
addUAVObjectToWidgetRelation("ManualControlSettings","FlightModePosition",m_config->fmsModePos5,4);
|
addUAVObjectToWidgetRelation("ManualControlSettings","FlightModePosition",m_config->fmsModePos5,4,1,true);
|
||||||
addUAVObjectToWidgetRelation("ManualControlSettings","FlightModePosition",m_config->fmsModePos6,5);
|
addUAVObjectToWidgetRelation("ManualControlSettings","FlightModePosition",m_config->fmsModePos6,5,1,true);
|
||||||
addUAVObjectToWidgetRelation("ManualControlSettings","FlightModeNumber",m_config->fmsPosNum);
|
addUAVObjectToWidgetRelation("ManualControlSettings","FlightModeNumber",m_config->fmsPosNum);
|
||||||
|
|
||||||
addUAVObjectToWidgetRelation("ManualControlSettings","Stabilization1Settings",m_config->fmsSsPos1Roll,"Roll");
|
addUAVObjectToWidgetRelation("ManualControlSettings","Stabilization1Settings",m_config->fmsSsPos1Roll,"Roll");
|
||||||
|
@ -112,13 +112,27 @@ void UAVObjectField::limitsInitialize(const QString &limits)
|
|||||||
QStringList stringPerElement=limits.split(",");
|
QStringList stringPerElement=limits.split(",");
|
||||||
quint32 index=0;
|
quint32 index=0;
|
||||||
foreach (QString str, stringPerElement) {
|
foreach (QString str, stringPerElement) {
|
||||||
QString _str=str.trimmed();
|
QStringList ruleList=str.split(";");
|
||||||
|
QList<LimitStruct> limitList;
|
||||||
|
foreach(QString rule,ruleList)
|
||||||
|
{
|
||||||
|
QString _str=rule.trimmed();
|
||||||
|
if(_str.isEmpty())
|
||||||
|
continue;
|
||||||
QStringList valuesPerElement=_str.split(":");
|
QStringList valuesPerElement=_str.split(":");
|
||||||
LimitStruct lstruc;
|
LimitStruct lstruc;
|
||||||
bool b1=valuesPerElement.at(0).startsWith("%");
|
bool b1=valuesPerElement.at(0).startsWith("%");
|
||||||
bool b2=(int)(index)<(int)numElements;
|
bool b2=(int)(index)<(int)numElements;
|
||||||
if(b1 && b2)
|
bool b3=valuesPerElement.at(0).size()==3;
|
||||||
|
bool auxb;
|
||||||
|
valuesPerElement.at(0).mid(1,4).toInt(&auxb,16);
|
||||||
|
bool b4=((valuesPerElement.at(0).size())==7 && auxb);
|
||||||
|
if(b1 && b2 && (b3 || b4))
|
||||||
{
|
{
|
||||||
|
if(b4)
|
||||||
|
lstruc.board=valuesPerElement.at(0).mid(1,4).toInt(&auxb,16);
|
||||||
|
else
|
||||||
|
lstruc.board=0;
|
||||||
if(valuesPerElement.at(0).right(2)=="EQ")
|
if(valuesPerElement.at(0).right(2)=="EQ")
|
||||||
lstruc.type=EQUAL;
|
lstruc.type=EQUAL;
|
||||||
else if(valuesPerElement.at(0).right(2)=="NE")
|
else if(valuesPerElement.at(0).right(2)=="NE")
|
||||||
@ -161,8 +175,7 @@ void UAVObjectField::limitsInitialize(const QString &limits)
|
|||||||
lstruc.values.append(QVariant());
|
lstruc.values.append(QVariant());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
elementLimits.insert(index,lstruc);
|
limitList.append(lstruc);
|
||||||
++index;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -170,14 +183,35 @@ void UAVObjectField::limitsInitialize(const QString &limits)
|
|||||||
qDebug()<<"limits parsing failed (property doesn't start with %) on UAVObjectField"<<name;
|
qDebug()<<"limits parsing failed (property doesn't start with %) on UAVObjectField"<<name;
|
||||||
else if(!b2)
|
else if(!b2)
|
||||||
qDebug()<<"limits parsing failed (index>numelements) on UAVObjectField"<<name<<"index"<<index<<"numElements"<<numElements;
|
qDebug()<<"limits parsing failed (index>numelements) on UAVObjectField"<<name<<"index"<<index<<"numElements"<<numElements;
|
||||||
|
else if(!b3 || !b4 )
|
||||||
|
qDebug()<<"limits parsing failed limit not starting with %XX or %YYYYXX where XX is the limit type and YYYY is the board type on UAVObjectField"<<name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
elementLimits.insert(index,limitList);
|
||||||
|
++index;
|
||||||
|
|
||||||
|
}
|
||||||
|
foreach(QList<LimitStruct> limitList,elementLimits)
|
||||||
|
{
|
||||||
|
foreach(LimitStruct limit,limitList)
|
||||||
|
{
|
||||||
|
qDebug()<<"Limit type"<<limit.type<<"for board"<<limit.board<<"for field"<<getName();
|
||||||
|
foreach(QVariant var,limit.values)
|
||||||
|
{
|
||||||
|
qDebug()<<"value"<<var;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bool UAVObjectField::isWithinLimits(QVariant var,quint32 index)
|
bool UAVObjectField::isWithinLimits(QVariant var,quint32 index, int board)
|
||||||
{
|
{
|
||||||
if(!elementLimits.keys().contains(index))
|
if(!elementLimits.keys().contains(index))
|
||||||
return true;
|
return true;
|
||||||
LimitStruct struc=elementLimits.value(index);
|
|
||||||
|
foreach(LimitStruct struc,elementLimits.value(index))
|
||||||
|
{
|
||||||
|
if((struc.board!=board) && board!=0 && struc.board!=0)
|
||||||
|
continue;
|
||||||
switch(struc.type)
|
switch(struc.type)
|
||||||
{
|
{
|
||||||
case EQUAL:
|
case EQUAL:
|
||||||
@ -381,14 +415,18 @@ bool UAVObjectField::isWithinLimits(QVariant var,quint32 index)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant UAVObjectField::getMaxLimit(quint32 index)
|
QVariant UAVObjectField::getMaxLimit(quint32 index,int board)
|
||||||
{
|
{
|
||||||
if(!elementLimits.keys().contains(index))
|
if(!elementLimits.keys().contains(index))
|
||||||
return QVariant();
|
return QVariant();
|
||||||
LimitStruct struc=elementLimits.value(index);
|
foreach(LimitStruct struc,elementLimits.value(index))
|
||||||
|
{
|
||||||
|
if((struc.board!=board) && board!=0 && struc.board!=0)
|
||||||
|
continue;
|
||||||
switch(struc.type)
|
switch(struc.type)
|
||||||
{
|
{
|
||||||
case EQUAL:
|
case EQUAL:
|
||||||
@ -407,13 +445,17 @@ QVariant UAVObjectField::getMaxLimit(quint32 index)
|
|||||||
return QVariant();
|
return QVariant();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
QVariant UAVObjectField::getMinLimit(quint32 index)
|
QVariant UAVObjectField::getMinLimit(quint32 index, int board)
|
||||||
{
|
{
|
||||||
if(!elementLimits.keys().contains(index))
|
if(!elementLimits.keys().contains(index))
|
||||||
return QVariant();
|
return QVariant();
|
||||||
LimitStruct struc=elementLimits.value(index);
|
foreach(LimitStruct struc,elementLimits.value(index))
|
||||||
|
{
|
||||||
|
if((struc.board!=board) && board!=0 && struc.board!=0)
|
||||||
|
return QVariant();
|
||||||
switch(struc.type)
|
switch(struc.type)
|
||||||
{
|
{
|
||||||
case EQUAL:
|
case EQUAL:
|
||||||
@ -432,6 +474,7 @@ QVariant UAVObjectField::getMinLimit(quint32 index)
|
|||||||
return QVariant();
|
return QVariant();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
void UAVObjectField::initialize(quint8* data, quint32 dataOffset, UAVObject* obj)
|
void UAVObjectField::initialize(quint8* data, quint32 dataOffset, UAVObject* obj)
|
||||||
|
@ -48,6 +48,7 @@ public:
|
|||||||
{
|
{
|
||||||
LimitType type;
|
LimitType type;
|
||||||
QList<QVariant> values;
|
QList<QVariant> values;
|
||||||
|
int board;
|
||||||
} LimitStruct;
|
} LimitStruct;
|
||||||
|
|
||||||
UAVObjectField(const QString& name, const QString& units, FieldType type, quint32 numElements, const QStringList& options,const QString& limits=QString());
|
UAVObjectField(const QString& name, const QString& units, FieldType type, quint32 numElements, const QStringList& options,const QString& limits=QString());
|
||||||
@ -74,9 +75,9 @@ public:
|
|||||||
bool isText();
|
bool isText();
|
||||||
QString toString();
|
QString toString();
|
||||||
|
|
||||||
bool isWithinLimits(QVariant var, quint32 index);
|
bool isWithinLimits(QVariant var, quint32 index, int board=0);
|
||||||
QVariant getMaxLimit(quint32 index);
|
QVariant getMaxLimit(quint32 index, int board=0);
|
||||||
QVariant getMinLimit(quint32 index);
|
QVariant getMinLimit(quint32 index, int board=0);
|
||||||
signals:
|
signals:
|
||||||
void fieldUpdated(UAVObjectField* field);
|
void fieldUpdated(UAVObjectField* field);
|
||||||
|
|
||||||
@ -91,7 +92,7 @@ protected:
|
|||||||
quint32 offset;
|
quint32 offset;
|
||||||
quint8* data;
|
quint8* data;
|
||||||
UAVObject* obj;
|
UAVObject* obj;
|
||||||
QMap<quint32,LimitStruct> elementLimits;
|
QMap<quint32, QList<LimitStruct> > elementLimits;
|
||||||
void clear();
|
void clear();
|
||||||
void constructorInitialize(const QString& name, const QString& units, FieldType type, const QStringList& elementNames, const QStringList& options, const QString &limits);
|
void constructorInitialize(const QString& name, const QString& units, FieldType type, const QStringList& elementNames, const QStringList& options, const QString &limits);
|
||||||
void limitsInitialize(const QString &limits);
|
void limitsInitialize(const QString &limits);
|
||||||
|
@ -37,6 +37,7 @@ ConfigTaskWidget::ConfigTaskWidget(QWidget *parent) : QWidget(parent),isConnecte
|
|||||||
pm = ExtensionSystem::PluginManager::instance();
|
pm = ExtensionSystem::PluginManager::instance();
|
||||||
objManager = pm->getObject<UAVObjectManager>();
|
objManager = pm->getObject<UAVObjectManager>();
|
||||||
TelemetryManager* telMngr = pm->getObject<TelemetryManager>();
|
TelemetryManager* telMngr = pm->getObject<TelemetryManager>();
|
||||||
|
utilMngr = pm->getObject<UAVObjectUtilManager>();
|
||||||
connect(telMngr, SIGNAL(connected()), this, SLOT(onAutopilotConnect()));
|
connect(telMngr, SIGNAL(connected()), this, SLOT(onAutopilotConnect()));
|
||||||
connect(telMngr, SIGNAL(disconnected()), this, SLOT(onAutopilotDisconnect()));
|
connect(telMngr, SIGNAL(disconnected()), this, SLOT(onAutopilotDisconnect()));
|
||||||
connect(telMngr, SIGNAL(connected()), this, SIGNAL(autoPilotConnected()));
|
connect(telMngr, SIGNAL(connected()), this, SIGNAL(autoPilotConnected()));
|
||||||
@ -226,9 +227,15 @@ void ConfigTaskWidget::onAutopilotDisconnect()
|
|||||||
|
|
||||||
void ConfigTaskWidget::onAutopilotConnect()
|
void ConfigTaskWidget::onAutopilotConnect()
|
||||||
{
|
{
|
||||||
|
if (utilMngr)
|
||||||
|
currentBoard = utilMngr->getBoardModel();//TODO REMEMBER TO ADD THIS TO FORCE CONNECTED FUNC ON CC3D_RELEASE
|
||||||
invalidateObjects();
|
invalidateObjects();
|
||||||
dirty=false;
|
dirty=false;
|
||||||
isConnected=true;
|
isConnected=true;
|
||||||
|
foreach(objectToWidget * ow,objOfInterest)
|
||||||
|
{
|
||||||
|
loadWidgetLimits(ow->widget,ow->field,ow->index,ow->isLimited,ow->scale);
|
||||||
|
}
|
||||||
enableControls(true);
|
enableControls(true);
|
||||||
refreshWidgetsValues();
|
refreshWidgetsValues();
|
||||||
}
|
}
|
||||||
@ -1057,7 +1064,7 @@ void ConfigTaskWidget::checkWidgetsLimits(QWidget * widget,UAVObjectField * fiel
|
|||||||
{
|
{
|
||||||
if(!hasLimits)
|
if(!hasLimits)
|
||||||
return;
|
return;
|
||||||
if(!field->isWithinLimits(value,index))
|
if(!field->isWithinLimits(value,index,currentBoard))
|
||||||
{
|
{
|
||||||
if(!widget->property("styleBackup").isValid())
|
if(!widget->property("styleBackup").isValid())
|
||||||
widget->setProperty("styleBackup",widget->styleSheet());
|
widget->setProperty("styleBackup",widget->styleSheet());
|
||||||
@ -1131,7 +1138,7 @@ void ConfigTaskWidget::loadWidgetLimits(QWidget * widget,UAVObjectField * field,
|
|||||||
{
|
{
|
||||||
foreach(QString str,option)
|
foreach(QString str,option)
|
||||||
{
|
{
|
||||||
if(field->isWithinLimits(str,index))
|
if(field->isWithinLimits(str,index,currentBoard))
|
||||||
cb->addItem(str);
|
cb->addItem(str);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1144,33 +1151,33 @@ void ConfigTaskWidget::loadWidgetLimits(QWidget * widget,UAVObjectField * field,
|
|||||||
{
|
{
|
||||||
if(field->getMaxLimit(index).isValid())
|
if(field->getMaxLimit(index).isValid())
|
||||||
{
|
{
|
||||||
cb->setMaximum((double)(field->getMaxLimit(index).toDouble()/scale));
|
cb->setMaximum((double)(field->getMaxLimit(index,currentBoard).toDouble()/scale));
|
||||||
}
|
}
|
||||||
if(field->getMinLimit(index).isValid())
|
if(field->getMinLimit(index,currentBoard).isValid())
|
||||||
{
|
{
|
||||||
cb->setMinimum((double)(field->getMinLimit(index).toDouble()/scale));
|
cb->setMinimum((double)(field->getMinLimit(index,currentBoard).toDouble()/scale));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(QSpinBox * cb=qobject_cast<QSpinBox *>(widget))
|
else if(QSpinBox * cb=qobject_cast<QSpinBox *>(widget))
|
||||||
{
|
{
|
||||||
if(field->getMaxLimit(index).isValid())
|
if(field->getMaxLimit(index,currentBoard).isValid())
|
||||||
{
|
{
|
||||||
cb->setMaximum((int)qRound(field->getMaxLimit(index).toDouble()/scale));
|
cb->setMaximum((int)qRound(field->getMaxLimit(index,currentBoard).toDouble()/scale));
|
||||||
}
|
}
|
||||||
if(field->getMinLimit(index).isValid())
|
if(field->getMinLimit(index,currentBoard).isValid())
|
||||||
{
|
{
|
||||||
cb->setMinimum((int)qRound(field->getMinLimit(index).toDouble()/scale));
|
cb->setMinimum((int)qRound(field->getMinLimit(index,currentBoard).toDouble()/scale));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(QSlider * cb=qobject_cast<QSlider *>(widget))
|
else if(QSlider * cb=qobject_cast<QSlider *>(widget))
|
||||||
{
|
{
|
||||||
if(field->getMaxLimit(index).isValid())
|
if(field->getMaxLimit(index,currentBoard).isValid())
|
||||||
{
|
{
|
||||||
cb->setMaximum((int)qRound(field->getMaxLimit(index).toDouble()/scale));
|
cb->setMaximum((int)qRound(field->getMaxLimit(index,currentBoard).toDouble()/scale));
|
||||||
}
|
}
|
||||||
if(field->getMinLimit(index).isValid())
|
if(field->getMinLimit(index,currentBoard).isValid())
|
||||||
{
|
{
|
||||||
cb->setMinimum((int)(field->getMinLimit(index).toDouble()/scale));
|
cb->setMinimum((int)(field->getMinLimit(index,currentBoard).toDouble()/scale));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -144,12 +144,14 @@ private slots:
|
|||||||
void defaultButtonClicked();
|
void defaultButtonClicked();
|
||||||
void reloadButtonClicked();
|
void reloadButtonClicked();
|
||||||
private:
|
private:
|
||||||
|
int currentBoard;
|
||||||
bool isConnected;
|
bool isConnected;
|
||||||
bool allowWidgetUpdates;
|
bool allowWidgetUpdates;
|
||||||
QStringList objectsList;
|
QStringList objectsList;
|
||||||
QList <objectToWidget*> objOfInterest;
|
QList <objectToWidget*> objOfInterest;
|
||||||
ExtensionSystem::PluginManager *pm;
|
ExtensionSystem::PluginManager *pm;
|
||||||
UAVObjectManager *objManager;
|
UAVObjectManager *objManager;
|
||||||
|
UAVObjectUtilManager* utilMngr;
|
||||||
smartSaveButton *smartsave;
|
smartSaveButton *smartsave;
|
||||||
QMap<UAVObject *,bool> objectUpdates;
|
QMap<UAVObject *,bool> objectUpdates;
|
||||||
QMap<int,QList<objectToWidget*> *> defaultReloadGroups;
|
QMap<int,QList<objectToWidget*> *> defaultReloadGroups;
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
<!-- Note these options values should be identical to those defined in FlightMode -->
|
<!-- Note these options values should be identical to those defined in FlightMode -->
|
||||||
<field name="FlightModeNumber" units="" type="uint8" elements="1" defaultvalue="3"/>
|
<field name="FlightModeNumber" units="" type="uint8" elements="1" defaultvalue="3"/>
|
||||||
<field name="FlightModePosition" units="" type="enum" elements="6" options="Manual,Stabilized1,Stabilized2,Stabilized3,AltitudeHold,VelocityControl,PositionHold" defaultvalue="Manual,Stabilized1,Stabilized2,Stabilized3,AltitudeHold,PositionHold"/>
|
<field name="FlightModePosition" units="" type="enum" elements="6" options="Manual,Stabilized1,Stabilized2,Stabilized3,AltitudeHold,VelocityControl,PositionHold" defaultvalue="Manual,Stabilized1,Stabilized2,Stabilized3,Stabilized1,Stabilized2" limits="%0401NE:AltitudeHold:VelocityControl:PositionHold;%0402NE:AltitudeHold:VelocityControl:PositionHold,%0401NE:AltitudeHold:VelocityControl:PositionHold;%0402NE:AltitudeHold:VelocityControl:PositionHold,%0401NE:AltitudeHold:VelocityControl:PositionHold;%0402NE:AltitudeHold:VelocityControl:PositionHold,%0401NE:AltitudeHold:VelocityControl:PositionHold;%0402NE:AltitudeHold:VelocityControl:PositionHold,%0401NE:AltitudeHold:VelocityControl:PositionHold;%0402NE:AltitudeHold:VelocityControl:PositionHold,%0401NE:AltitudeHold:VelocityControl:PositionHold;%0402NE:AltitudeHold:VelocityControl:PositionHold"/>
|
||||||
|
|
||||||
<field name="ArmedTimeout" units="ms" type="uint16" elements="1" defaultvalue="30000"/>
|
<field name="ArmedTimeout" units="ms" type="uint16" elements="1" defaultvalue="30000"/>
|
||||||
<access gcs="readwrite" flight="readwrite"/>
|
<access gcs="readwrite" flight="readwrite"/>
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<object name="SystemAlarms" singleinstance="true" settings="false">
|
<object name="SystemAlarms" singleinstance="true" settings="false">
|
||||||
<description>Alarms from OpenPilot to indicate failure conditions or warnings. Set by various modules.</description>
|
<description>Alarms from OpenPilot to indicate failure conditions or warnings. Set by various modules.</description>
|
||||||
<field name="Alarm" units="" type="enum" options="Uninitialised,OK,Warning,Error,Critical"
|
<field name="Alarm" units="" type="enum" options="Uninitialised,OK,Warning,Error,Critical"
|
||||||
elementnames="OutOfMemory,StackOverflow,CPUOverload,EventSystem,SDCard,Telemetry,ManualControl,Actuator,Attitude,Sensors,Stabilization,Guidance,AHRSComms,Battery,FlightTime,I2C,GPS,BootFault" defaultvalue="Uninitialised"/>
|
elementnames="OutOfMemory,StackOverflow,CPUOverload,EventSystem,Telemetry,ManualControl,Actuator,Attitude,Sensors,Stabilization,Guidance,Battery,FlightTime,I2C,GPS,BootFault" defaultvalue="Uninitialised"/>
|
||||||
<access gcs="readwrite" flight="readwrite"/>
|
<access gcs="readwrite" flight="readwrite"/>
|
||||||
<telemetrygcs acked="true" updatemode="onchange" period="0"/>
|
<telemetrygcs acked="true" updatemode="onchange" period="0"/>
|
||||||
<telemetryflight acked="true" updatemode="onchange" period="0"/>
|
<telemetryflight acked="true" updatemode="onchange" period="0"/>
|
||||||
|
Loading…
Reference in New Issue
Block a user