Commit b7ea870f authored by Nate Weibley's avatar Nate Weibley

Implement click-to-retask via MISSION_SET_CURRENT in flight view for #2275

parent 36561731
......@@ -42,6 +42,7 @@ MapItemView {
z: QGroundControl.zOrderMapItems
missionItem: object
sequenceNumber: object.sequenceNumber
onClicked: object.tryMakingCurrent()
// These are the non-coordinate child mission items attached to this item
Row {
......@@ -55,8 +56,6 @@ MapItemView {
label: object.sequenceNumber
isCurrentItem: object.isCurrentItem
z: 2
onClicked: setCurrentItem(object.sequenceNumber)
}
}
}
......
......@@ -103,3 +103,8 @@ void VisualMissionItem::setAzimuth(double azimuth)
_azimuth = azimuth;
emit azimuthChanged(_azimuth);
}
void VisualMissionItem::tryMakingCurrent()
{
_vehicle->setCurrentMissionSequence(sequenceNumber());
}
......@@ -92,6 +92,8 @@ public:
/// are shown next to the exitCoordinate indidcator in the ui.
Q_PROPERTY(QmlObjectListModel* childItems READ childItems CONSTANT)
Q_INVOKABLE void tryMakingCurrent();
// Property accesors
double altDifference (void) const { return _altDifference; }
......
......@@ -1136,6 +1136,16 @@ void Vehicle::setFlightMode(const QString& flightMode)
}
}
void Vehicle::setCurrentMissionSequence(int seq)
{
if (!_firmwarePlugin->sendHomePositionToVehicle()) {
seq--;
}
mavlink_message_t msg;
mavlink_msg_mission_set_current_pack(_mavlink->getSystemId(), _mavlink->getComponentId(), &msg, id(), _compID, seq);
sendMessage(msg);
}
bool Vehicle::hilMode(void)
{
return _base_mode & MAV_MODE_FLAG_HIL_ENABLED;
......
......@@ -430,6 +430,8 @@ public:
QString flightMode(void) const;
void setFlightMode(const QString& flightMode);
void setCurrentMissionSequence(int seq);
bool hilMode(void);
void setHilMode(bool hilMode);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment