1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-29 14:52:12 +01:00

Merge remote-tracking branch 'origin/next' into Brian-PipXtreme-V2

This commit is contained in:
Brian Webb 2012-05-11 17:44:23 -07:00
commit 513c014f5a
11 changed files with 137 additions and 38 deletions

View File

@ -1389,13 +1389,13 @@ margin:1px;</string>
<property name="autoFillBackground">
<bool>false</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3" stretch="0">
<layout class="QVBoxLayout" name="verticalLayout_31" stretch="0">
<item>
<layout class="QVBoxLayout" name="verticalLayout_6">
<layout class="QVBoxLayout" name="verticalLayout_61">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<layout class="QHBoxLayout" name="horizontalLayout_31">
<item>
<widget class="QLabel" name="label_5">
<widget class="QLabel" name="label_51">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
@ -1417,7 +1417,7 @@ margin:1px;</string>
<widget class="QComboBox" name="groundVehicleType"/>
</item>
<item>
<spacer name="horizontalSpacer_3">
<spacer name="horizontalSpacer_31">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
@ -1432,7 +1432,7 @@ margin:1px;</string>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_23">
<layout class="QHBoxLayout" name="horizontalLayout_33">
<item>
<widget class="QLabel" name="label_7">
<property name="font">
@ -1462,9 +1462,9 @@ margin:1px;</string>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<layout class="QHBoxLayout" name="horizontalLayout_41">
<item>
<widget class="QGroupBox" name="groupBox_2">
<widget class="QGroupBox" name="groupBox_7">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
@ -1480,7 +1480,7 @@ margin:1px;</string>
<property name="title">
<string>Output channel asignmets</string>
</property>
<layout class="QFormLayout" name="formLayout_3">
<layout class="QFormLayout" name="formLayout_5">
<item row="0" column="0">
<widget class="QLabel" name="gvEngineLabel">
<property name="minimumSize">
@ -1644,11 +1644,11 @@ margin:1px;</string>
<property name="title">
<string>Differential Steering Mix</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_13">
<layout class="QVBoxLayout" name="verticalLayout_33">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_8">
<layout class="QHBoxLayout" name="horizontalLayout_30">
<item>
<layout class="QVBoxLayout" name="verticalLayout_14">
<layout class="QVBoxLayout" name="verticalLayout_34">
<item>
<widget class="QLabel" name="differentialSteeringLabel1">
<property name="minimumSize">
@ -1685,7 +1685,7 @@ margin:1px;</string>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_15">
<layout class="QVBoxLayout" name="verticalLayout_35">
<item>
<widget class="QLabel" name="differentialSteeringLabel2">
<property name="minimumSize">
@ -1727,7 +1727,7 @@ margin:1px;</string>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_4">
<spacer name="horizontalSpacer_24">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
@ -1750,7 +1750,7 @@ margin:1px;</string>
<property name="title">
<string>Front throttle curve</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_16">
<layout class="QVBoxLayout" name="verticalLayout_36">
<item>
<widget class="MixerCurveWidget" name="groundVehicleThrottle1" native="true">
<property name="sizePolicy">
@ -1807,7 +1807,7 @@ margin:1px;</string>
<property name="title">
<string>Rear throttle curve</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_17">
<layout class="QVBoxLayout" name="verticalLayout_37">
<item>
<widget class="MixerCurveWidget" name="groundVehicleThrottle2" native="true">
<property name="sizePolicy">
@ -1850,7 +1850,7 @@ margin:1px;</string>
</layout>
</item>
<item>
<spacer name="verticalSpacer">
<spacer name="verticalSpacer_1">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
@ -1863,9 +1863,9 @@ margin:1px;</string>
</spacer>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_13">
<layout class="QHBoxLayout" name="horizontalLayout_28">
<item>
<spacer name="horizontalSpacer_11">
<spacer name="horizontalSpacer_21">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>

View File

@ -119,7 +119,7 @@ ConfigVehicleTypeWidget::ConfigVehicleTypeWidget(QWidget *parent) : ConfigTaskWi
QStringList airframeTypes;
airframeTypes << "Fixed Wing" << "Multirotor" << "Helicopter" << "Ground" << "Custom";
m_aircraft->aircraftType->addItems(airframeTypes);
m_aircraft->aircraftType->setCurrentIndex(1);
m_aircraft->aircraftType->setCurrentIndex(0); //Set default vehicle to Fixed Wing
QStringList fixedWingTypes;
fixedWingTypes << "Elevator aileron rudder" << "Elevon" << "Vtail";
@ -655,7 +655,8 @@ void ConfigVehicleTypeWidget::setupAirframeUI(QString frameType)
frameType == "HexaCoax" || frameType == "Hexacopter Y6" ||
frameType == "Octo" || frameType == "Octocopter" ||
frameType == "OctoV" || frameType == "Octocopter V" ||
frameType == "OctoCoaxP" || frameType == "Octo Coax +" ) {
frameType == "OctoCoaxP" || frameType == "Octo Coax +" ||
frameType == "OctoCoaxX" || frameType == "Octo Coax X" ) {
//Call multi-rotor setup UI
setupMultiRotorUI(frameType);

View File

@ -3383,6 +3383,10 @@ border-radius: 5;</string>
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
<property name="toolTip">
<string>Slowly raise Proportional until you start seeing clear oscillations when you fly.
Then lower the value by 5 or so.</string>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
@ -3433,6 +3437,10 @@ border-radius: 5;</string>
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
<property name="toolTip">
<string>Slowly raise Proportional until you start seeing clear oscillations when you fly.
Then lower the value by 5 or so.</string>
</property>
<property name="maximum">
<number>200</number>
</property>
@ -3484,6 +3492,10 @@ border-radius: 5;</string>
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
<property name="toolTip">
<string>Slowly raise Proportional until you start seeing clear oscillations when you fly.
Then lower the value by 5 or so.</string>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
@ -3531,6 +3543,10 @@ border-radius: 5;</string>
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
<property name="toolTip">
<string>Slowly raise Proportional until you start seeing clear oscillations when you fly.
Then lower the value by 5 or so.</string>
</property>
<property name="maximum">
<number>200</number>
</property>
@ -3582,6 +3598,10 @@ border-radius: 5;</string>
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
<property name="toolTip">
<string>Slowly raise Proportional until you start seeing clear oscillations when you fly.
Then lower the value by 5 or so.</string>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
@ -3629,6 +3649,10 @@ border-radius: 5;</string>
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
<property name="toolTip">
<string>Slowly raise Proportional until you start seeing clear oscillations when you fly.
Then lower the value by 5 or so.</string>
</property>
<property name="maximum">
<number>200</number>
</property>
@ -3683,6 +3707,10 @@ border-radius: 5;</string>
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
<property name="toolTip">
<string>As a rule of thumb, you can set the Integral at roughly the same
value as the Kp.</string>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
@ -3730,6 +3758,10 @@ border-radius: 5;</string>
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
<property name="toolTip">
<string>As a rule of thumb, you can set the Integral at roughly the same
value as the Kp.</string>
</property>
<property name="maximum">
<number>200</number>
</property>
@ -3765,6 +3797,10 @@ border-radius: 5;</string>
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
<property name="toolTip">
<string>As a rule of thumb, you can set the Integral at roughly the same
value as the Kp.</string>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
@ -3812,6 +3848,10 @@ border-radius: 5;</string>
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
<property name="toolTip">
<string>As a rule of thumb, you can set the Integral at roughly the same
value as the Kp.</string>
</property>
<property name="maximum">
<number>200</number>
</property>
@ -3847,6 +3887,10 @@ border-radius: 5;</string>
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
<property name="toolTip">
<string>As a rule of thumb, you can set the Integral at roughly the same
value as the Kp.</string>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
@ -3894,6 +3938,10 @@ border-radius: 5;</string>
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
<property name="toolTip">
<string>As a rule of thumb, you can set the Integral at roughly the same
value as the Kp.</string>
</property>
<property name="maximum">
<number>200</number>
</property>
@ -11709,6 +11757,10 @@ automatically every 300ms, which will help for fast tuning.</string>
<pointsize>8</pointsize>
</font>
</property>
<property name="toolTip">
<string>Reloads the saved settings into GCS.
Useful if you have accidentally changed some settings.</string>
</property>
<property name="styleSheet">
<string notr="true">QPushButton {
border: 1px outset #999;

View File

@ -531,7 +531,7 @@ void UAVObject::SetGcsAccess(UAVObject::Metadata& metadata, UAVObject::AccessMod
* \param[in] metadata The metadata object
* \return the telemetry acked boolean
*/
uint8_t UAVObject::GetFlightTelemetryAcked(const UAVObject::Metadata& metadata) {
quint8 UAVObject::GetFlightTelemetryAcked(const UAVObject::Metadata& metadata) {
return (metadata.flags >> UAVOBJ_TELEMETRY_ACKED_SHIFT) & 1;
}
@ -540,7 +540,7 @@ uint8_t UAVObject::GetFlightTelemetryAcked(const UAVObject::Metadata& metadata)
* \param[in] metadata The metadata object
* \param[in] val The telemetry acked boolean
*/
void UAVObject::SetFlightTelemetryAcked(UAVObject::Metadata& metadata, uint8_t val) {
void UAVObject::SetFlightTelemetryAcked(UAVObject::Metadata& metadata, quint8 val) {
SET_BITS(metadata.flags, UAVOBJ_TELEMETRY_ACKED_SHIFT, val, 1);
}
@ -549,7 +549,7 @@ void UAVObject::SetFlightTelemetryAcked(UAVObject::Metadata& metadata, uint8_t v
* \param[in] metadata The metadata object
* \return the telemetry acked boolean
*/
uint8_t UAVObject::GetGcsTelemetryAcked(const UAVObject::Metadata& metadata) {
quint8 UAVObject::GetGcsTelemetryAcked(const UAVObject::Metadata& metadata) {
return (metadata.flags >> UAVOBJ_GCS_TELEMETRY_ACKED_SHIFT) & 1;
}
@ -558,7 +558,7 @@ uint8_t UAVObject::GetGcsTelemetryAcked(const UAVObject::Metadata& metadata) {
* \param[in] metadata The metadata object
* \param[in] val The GCS telemetry acked boolean
*/
void UAVObject::SetGcsTelemetryAcked(UAVObject::Metadata& metadata, uint8_t val) {
void UAVObject::SetGcsTelemetryAcked(UAVObject::Metadata& metadata, quint8 val) {
SET_BITS(metadata.flags, UAVOBJ_GCS_TELEMETRY_ACKED_SHIFT, val, 1);
}

View File

@ -90,10 +90,10 @@ public:
* 6-7 gcsTelemetryUpdateMode Update mode used by the GCS (UAVObjUpdateMode)
*/
typedef struct {
uint8_t flags; /** Defines flags for update and logging modes and whether an update should be ACK'd (bits defined above) */
uint16_t flightTelemetryUpdatePeriod; /** Update period used by the telemetry module (only if telemetry mode is PERIODIC) */
uint16_t gcsTelemetryUpdatePeriod; /** Update period used by the GCS (only if telemetry mode is PERIODIC) */
uint16_t loggingUpdatePeriod; /** Update period used by the logging module (only if logging mode is PERIODIC) */
quint8 flags; /** Defines flags for update and logging modes and whether an update should be ACK'd (bits defined above) */
quint16 flightTelemetryUpdatePeriod; /** Update period used by the telemetry module (only if telemetry mode is PERIODIC) */
quint16 gcsTelemetryUpdatePeriod; /** Update period used by the GCS (only if telemetry mode is PERIODIC) */
quint16 loggingUpdatePeriod; /** Update period used by the logging module (only if logging mode is PERIODIC) */
} __attribute__((packed)) Metadata;
@ -132,10 +132,10 @@ public:
static void SetFlightAccess(Metadata& meta, AccessMode mode);
static AccessMode GetGcsAccess(const Metadata& meta);
static void SetGcsAccess(Metadata& meta, AccessMode mode);
static uint8_t GetFlightTelemetryAcked(const Metadata& meta);
static void SetFlightTelemetryAcked(Metadata& meta, uint8_t val);
static uint8_t GetGcsTelemetryAcked(const Metadata& meta);
static void SetGcsTelemetryAcked(Metadata& meta, uint8_t val);
static quint8 GetFlightTelemetryAcked(const Metadata& meta);
static void SetFlightTelemetryAcked(Metadata& meta, quint8 val);
static quint8 GetGcsTelemetryAcked(const Metadata& meta);
static void SetGcsTelemetryAcked(Metadata& meta, quint8 val);
static UpdateMode GetFlightTelemetryUpdateMode(const Metadata& meta);
static void SetFlightTelemetryUpdateMode(Metadata& meta, UpdateMode val);
static UpdateMode GetGcsTelemetryUpdateMode(const Metadata& meta);

View File

@ -31,7 +31,7 @@
/**
* Constructor
*/
ConfigTaskWidget::ConfigTaskWidget(QWidget *parent) : QWidget(parent),isConnected(false),smartsave(NULL),dirty(false),outOfLimitsStyle("background-color: rgb(255, 0, 0);")
ConfigTaskWidget::ConfigTaskWidget(QWidget *parent) : QWidget(parent),isConnected(false),smartsave(NULL),dirty(false),outOfLimitsStyle("background-color: rgb(255, 0, 0);"),timeOut(NULL)
{
pm = ExtensionSystem::PluginManager::instance();
objManager = pm->getObject<UAVObjectManager>();
@ -175,6 +175,10 @@ ConfigTaskWidget::~ConfigTaskWidget()
if(oTw)
delete oTw;
}
if(timeOut)
{
delete timeOut;
}
}
void ConfigTaskWidget::saveObjectToSD(UAVObject *obj)
@ -780,7 +784,7 @@ void ConfigTaskWidget::reloadButtonClicked()
if(!list)
return;
ObjectPersistence* objper = dynamic_cast<ObjectPersistence*>( getObjectManager()->getObject(ObjectPersistence::NAME) );
QTimer * timeOut=new QTimer(this);
timeOut=new QTimer(this);
QEventLoop * eventLoop=new QEventLoop(this);
connect(timeOut, SIGNAL(timeout()),eventLoop,SLOT(quit()));
connect(objper, SIGNAL(objectUpdated(UAVObject*)), eventLoop, SLOT(quit()));
@ -799,13 +803,22 @@ void ConfigTaskWidget::reloadButtonClicked()
eventLoop->exec();
if(timeOut->isActive())
{
oTw->object->requestUpdate();
setWidgetFromField(oTw->widget,oTw->field,oTw->index,oTw->scale,oTw->isLimited);
}
timeOut->stop();
}
}
delete eventLoop;
delete timeOut;
if(eventLoop)
{
delete eventLoop;
eventLoop=NULL;
}
if(timeOut)
{
delete timeOut;
timeOut=NULL;
}
}
/**

View File

@ -164,6 +164,7 @@ private:
void disconnectWidgetUpdatesToSlot(QWidget *widget, const char *function);
void loadWidgetLimits(QWidget *widget, UAVObjectField *field, int index, bool hasLimits, double sclale);
QString outOfLimitsStyle;
QTimer * timeOut;
protected slots:
virtual void disableObjUpdates();
virtual void enableObjUpdates();

View File

@ -404,10 +404,12 @@ void deviceWidget::uploadFirmware()
status("Starting firmware upload", STATUSICON_RUNNING);
// We don't know which device was used previously, so we
// are cautious and reenter DFU for this deviceID:
emit uploadStarted();
if(!m_dfu->enterDFU(deviceID))
{
status("Error:Could not enter DFU mode", STATUSICON_FAIL);
myDevice->updateButton->setEnabled(true);
emit uploadEnded(false);
return;
}
OP_DFU::Status ret=m_dfu->StatusRequest();
@ -421,6 +423,7 @@ void deviceWidget::uploadFirmware()
if(!retstatus ) {
status("Could not start upload", STATUSICON_FAIL);
myDevice->updateButton->setEnabled(true);
emit uploadEnded(false);
return;
}
status("Uploading, please wait...", STATUSICON_RUNNING);
@ -480,6 +483,7 @@ void deviceWidget::uploadFinished(OP_DFU::Status retstatus)
disconnect(m_dfu, SIGNAL(operationProgress(QString)), this, SLOT(dfuStatus(QString)));
if(retstatus != OP_DFU::Last_operation_Success) {
status(QString("Upload failed with code: ") + m_dfu->StatusToString(retstatus).toLatin1().data(), STATUSICON_FAIL);
emit uploadEnded(false);
return;
} else
if (!descriptionArray.isEmpty()) {
@ -489,6 +493,7 @@ void deviceWidget::uploadFinished(OP_DFU::Status retstatus)
retstatus = m_dfu->UploadDescription(descriptionArray);
if( retstatus != OP_DFU::Last_operation_Success) {
status(QString("Upload failed with code: ") + m_dfu->StatusToString(retstatus).toLatin1().data(), STATUSICON_FAIL);
emit uploadEnded(false);
return;
}
@ -499,10 +504,12 @@ void deviceWidget::uploadFinished(OP_DFU::Status retstatus)
retstatus = m_dfu->UploadDescription(myDevice->description->text());
if( retstatus != OP_DFU::Last_operation_Success) {
status(QString("Upload failed with code: ") + m_dfu->StatusToString(retstatus).toLatin1().data(), STATUSICON_FAIL);
emit uploadEnded(false);
return;
}
}
populate();
emit uploadEnded(true);
status("Upload successful", STATUSICON_OK);
}

View File

@ -72,7 +72,8 @@ private:
bool populateLoadedStructuredDescription(QByteArray arr);
signals:
void uploadStarted();
void uploadEnded(bool success);
public slots:
void uploadFirmware();
void loadFirmware();

View File

@ -116,6 +116,12 @@ QString UploaderGadgetWidget::getPortDevice(const QString &friendName)
}
return "";
}
void UploaderGadgetWidget::connectSignalSlot(QWidget *widget)
{
connect(qobject_cast<deviceWidget *>(widget),SIGNAL(uploadStarted()),this,SLOT(uploadStarted()));
connect(qobject_cast<deviceWidget *>(widget),SIGNAL(uploadEnded(bool)),this,SLOT(uploadEnded(bool)));
}
void UploaderGadgetWidget::onPhisicalHWConnect()
{
m_config->bootButton->setEnabled(false);
@ -305,6 +311,7 @@ void UploaderGadgetWidget::goToBootloader(UAVObject* callerObj, bool success)
}
for(int i=0;i<dfu->numberOfDevices;i++) {
deviceWidget* dw = new deviceWidget(this);
connectSignalSlot(dw);
dw->setDeviceID(i);
dw->setDfu(dfu);
dw->populate();
@ -540,6 +547,7 @@ void UploaderGadgetWidget::systemRescue()
}
for(int i=0;i<dfu->numberOfDevices;i++) {
deviceWidget* dw = new deviceWidget(this);
connectSignalSlot(dw);
dw->setDeviceID(i);
dw->setDfu(dfu);
dw->populate();
@ -567,6 +575,19 @@ void UploaderGadgetWidget::cancel()
m_eventloop.exit();
}
void UploaderGadgetWidget::uploadStarted()
{
m_config->bootButton->setEnabled(false);
m_config->safeBootButton->setEnabled(false);
}
void UploaderGadgetWidget::uploadEnded(bool succeed)
{
Q_UNUSED(succeed);
m_config->bootButton->setEnabled(true);
m_config->safeBootButton->setEnabled(true);
}
/**
Update log entry
*/

View File

@ -88,6 +88,7 @@ private:
QLineEdit* openFileNameLE;
QEventLoop m_eventloop;
QErrorMessage * msg;
void connectSignalSlot(QWidget * widget);
private slots:
void onPhisicalHWConnect();
void versionMatchCheck();
@ -102,6 +103,8 @@ private slots:
void getSerialPorts();
void perform();
void cancel();
void uploadStarted();
void uploadEnded(bool succeed);
};