Browse Source

Retransmit param list request; fix null data model

QGC4.4
tstellanova 12 years ago
parent
commit
3090fcf259
  1. 1
      libs/eigen/Eigen/src/Core/BandMatrix.h
  2. 8
      src/uas/UAS.cc
  3. 27
      src/uas/UASParameterCommsMgr.cc
  4. 1
      src/uas/UASParameterCommsMgr.h

1
libs/eigen/Eigen/src/Core/BandMatrix.h

@ -285,6 +285,7 @@ class BandMatrixWrapper : public BandMatrixBase<BandMatrixWrapper<_CoefficientsT
m_rows(rows), m_supers(supers), m_subs(subs) m_rows(rows), m_supers(supers), m_subs(subs)
{ {
//internal::assert(coeffs.cols()==cols() && (supers()+subs()+1)==coeffs.rows()); //internal::assert(coeffs.cols()==cols() && (supers()+subs()+1)==coeffs.rows());
cols=0; //workaround for compiler warning
} }
/** \returns the number of columns */ /** \returns the number of columns */

8
src/uas/UAS.cc

@ -234,6 +234,8 @@ UAS::UAS(MAVLinkProtocol* protocol, int id) : UASInterface(),
*/ */
UAS::~UAS() UAS::~UAS()
{ {
delete paramCommsMgr;
delete paramDataModel;
writeSettings(); writeSettings();
delete links; delete links;
delete statusTimeout; delete statusTimeout;
@ -2029,6 +2031,7 @@ void UAS::forwardMessage(mavlink_message_t message)
{ {
if(serial != links->at(i)) if(serial != links->at(i))
{ {
if (link->isConnected()) {
qDebug()<<"Antenna tracking: Forwarding Over link: "<<serial->getName()<<" "<<serial; qDebug()<<"Antenna tracking: Forwarding Over link: "<<serial->getName()<<" "<<serial;
sendMessage(serial, message); sendMessage(serial, message);
} }
@ -2037,6 +2040,7 @@ void UAS::forwardMessage(mavlink_message_t message)
} }
} }
} }
}
/** /**
* Send a message to the link that is connected. * Send a message to the link that is connected.
@ -2541,7 +2545,7 @@ void UAS::setParameter(const int component, const QString& id, const QVariant& v
// TODO: This is a hack for MAV_AUTOPILOT_ARDUPILOTMEGA until the new version of MAVLink and a fix for their param handling. // TODO: This is a hack for MAV_AUTOPILOT_ARDUPILOTMEGA until the new version of MAVLink and a fix for their param handling.
if (getAutopilotType() == MAV_AUTOPILOT_ARDUPILOTMEGA) if (getAutopilotType() == MAV_AUTOPILOT_ARDUPILOTMEGA)
{ {
switch (value.type()) switch ((int)value.type())
{ {
case QVariant::Char: case QVariant::Char:
union_value.param_float = (unsigned char)value.toChar().toAscii(); union_value.param_float = (unsigned char)value.toChar().toAscii();
@ -2566,7 +2570,7 @@ void UAS::setParameter(const int component, const QString& id, const QVariant& v
} }
else else
{ {
switch (value.type()) switch ((int)value.type())
{ {
case QVariant::Char: case QVariant::Char:
union_value.param_int8 = (unsigned char)value.toChar().toAscii(); union_value.param_int8 = (unsigned char)value.toChar().toAscii();

27
src/uas/UASParameterCommsMgr.cc

@ -10,6 +10,7 @@
UASParameterCommsMgr::UASParameterCommsMgr(QObject *parent, UASInterface *uas) : UASParameterCommsMgr::UASParameterCommsMgr(QObject *parent, UASInterface *uas) :
QObject(parent), QObject(parent),
mav(uas), mav(uas),
paramDataModel(NULL),
transmissionListMode(false), transmissionListMode(false),
transmissionActive(false), transmissionActive(false),
transmissionTimeout(0), transmissionTimeout(0),
@ -17,7 +18,7 @@ UASParameterCommsMgr::UASParameterCommsMgr(QObject *parent, UASInterface *uas) :
rewriteTimeout(500), rewriteTimeout(500),
retransmissionBurstRequestSize(5) retransmissionBurstRequestSize(5)
{ {
mav = uas; paramDataModel = mav->getParamDataModel();
loadParamCommsSettings(); loadParamCommsSettings();
@ -57,6 +58,8 @@ void UASParameterCommsMgr::loadParamCommsSettings()
settings.endGroup(); settings.endGroup();
} }
/** /**
* Send a request to deliver the list of onboard parameters * Send a request to deliver the list of onboard parameters
* from the MAV. * from the MAV.
@ -82,7 +85,9 @@ void UASParameterCommsMgr::requestParameterList()
transmissionActive = true; transmissionActive = true;
setParameterStatusMsg(tr("Requested param list.. waiting")); setParameterStatusMsg(tr("Requested param list.. waiting"));
listRecvTimeout = QGC::groundTimeMilliseconds() + 10000;
mav->requestParameters(); mav->requestParameters();
setRetransmissionGuardEnabled(true);
} }
else { else {
qDebug() << __FILE__ << __LINE__ << "Ignoring requestParameterList because we're receiving params list"; qDebug() << __FILE__ << __LINE__ << "Ignoring requestParameterList because we're receiving params list";
@ -94,6 +99,17 @@ void UASParameterCommsMgr::requestParameterList()
void UASParameterCommsMgr::retransmissionGuardTick() void UASParameterCommsMgr::retransmissionGuardTick()
{ {
if (transmissionActive) { if (transmissionActive) {
if (transmissionListMode && transmissionListSizeKnown.isEmpty() ) {
//we are still waitin for the first parameter list response
if (QGC::groundTimeMilliseconds() > this->listRecvTimeout) {
//re-request parameters
setParameterStatusMsg(tr("TIMEOUT: Re-requesting param list"),ParamCommsStatusLevel_Warning);
listRecvTimeout = QGC::groundTimeMilliseconds() + 10000;
mav->requestParameters();
}
return;
}
qDebug() << __FILE__ << __LINE__ << "RETRANSMISSION GUARD ACTIVE, CHECKING FOR DROPS.."; qDebug() << __FILE__ << __LINE__ << "RETRANSMISSION GUARD ACTIVE, CHECKING FOR DROPS..";
// Check for timeout // Check for timeout
@ -466,11 +482,9 @@ void UASParameterCommsMgr::receivedParameterUpdate(int uas, int compId, int para
transmissionMissingPackets.value(key)->clear(); transmissionMissingPackets.value(key)->clear();
} }
setRetransmissionGuardEnabled(false);
//all parameters have been received, broadcast to UI //all parameters have been received, broadcast to UI
emit parameterListUpToDate(); emit parameterListUpToDate();
//TODO in UI
// Expand visual tree
//tree->expandItem(tree->topLevelItem(0));
} }
} }
@ -527,5 +541,10 @@ void UASParameterCommsMgr::sendPendingParameters()
UASParameterCommsMgr::~UASParameterCommsMgr() UASParameterCommsMgr::~UASParameterCommsMgr()
{ {
setRetransmissionGuardEnabled(false); setRetransmissionGuardEnabled(false);
QString ptrStr;
ptrStr.sprintf("%8p", this);
qDebug() << "UASParameterCommsMgr destructor: " << ptrStr ;
} }

1
src/uas/UASParameterCommsMgr.h

@ -98,6 +98,7 @@ protected:
int retransmissionTimeout; ///< Retransmission request timeout, in milliseconds int retransmissionTimeout; ///< Retransmission request timeout, in milliseconds
int rewriteTimeout; ///< Write request timeout, in milliseconds int rewriteTimeout; ///< Write request timeout, in milliseconds
int retransmissionBurstRequestSize; ///< Number of packets requested for retransmission per burst int retransmissionBurstRequestSize; ///< Number of packets requested for retransmission per burst
quint64 listRecvTimeout; ///< How long to wait for first parameter list response before re-requesting
// Status // Status
QString parameterStatusMsg; QString parameterStatusMsg;

Loading…
Cancel
Save