Commit bfe6d609 authored by DonLakeFlyer's avatar DonLakeFlyer

Fix flight speed signaling to update further mission items

parent ee83b76b
......@@ -67,6 +67,7 @@ CameraSection::CameraSection(Vehicle* vehicle, QObject* parent)
connect(this, &CameraSection::specifyGimbalChanged, this, &CameraSection::_setDirty);
connect(this, &CameraSection::specifyCameraModeChanged, this, &CameraSection::_setDirty);
connect(this, &CameraSection::specifyGimbalChanged, this, &CameraSection::_updateSpecifiedGimbalYaw);
connect(&_gimbalYawFact, &Fact::valueChanged, this, &CameraSection::_updateSpecifiedGimbalYaw);
}
......
......@@ -63,6 +63,7 @@ public:
void setSpecifyGimbal (bool specifyGimbal);
void setSpecifyCameraMode (bool specifyCameraMode);
///< Signals specifiedGimbalYawChanged
///< @return The gimbal yaw specified by this item, NaN if not specified
double specifiedGimbalYaw(void) const;
......
......@@ -61,8 +61,8 @@ MissionSettingsItem::MissionSettingsItem(Vehicle* vehicle, QObject* parent)
connect(&_cameraSection, &CameraSection::dirtyChanged, this, &MissionSettingsItem::_sectionDirtyChanged);
connect(&_speedSection, &SpeedSection::dirtyChanged, this, &MissionSettingsItem::_sectionDirtyChanged);
connect(&_cameraSection, &CameraSection::specifyGimbalChanged, this, &MissionSettingsItem::specifiedGimbalYawChanged);
connect(&_cameraSection, &CameraSection::specifiedGimbalYawChanged, this, &MissionSettingsItem::specifiedGimbalYawChanged);
connect(&_speedSection, &SpeedSection::specifiedFlightSpeedChanged, this, &MissionSettingsItem::specifiedFlightSpeedChanged);
}
......
......@@ -755,13 +755,11 @@ void SimpleMissionItem::_updateOptionalSections(void)
connect(_cameraSection, &CameraSection::dirtyChanged, this, &SimpleMissionItem::_sectionDirtyChanged);
connect(_cameraSection, &CameraSection::itemCountChanged, this, &SimpleMissionItem::_updateLastSequenceNumber);
connect(_cameraSection, &CameraSection::availableChanged, this, &SimpleMissionItem::specifiedGimbalYawChanged);
connect(_cameraSection, &CameraSection::specifyGimbalChanged, this, &SimpleMissionItem::specifiedGimbalYawChanged);
connect(_cameraSection, &CameraSection::specifiedGimbalYawChanged, this, &SimpleMissionItem::specifiedGimbalYawChanged);
connect(_speedSection, &SpeedSection::dirtyChanged, this, &SimpleMissionItem::_sectionDirtyChanged);
connect(_speedSection, &SpeedSection::itemCountChanged, this, &SimpleMissionItem::_updateLastSequenceNumber);
connect(_speedSection, &SpeedSection::specifyFlightSpeedChanged, this, &SimpleMissionItem::specifiedFlightSpeedChanged);
connect(_speedSection->flightSpeed(), &Fact::rawValueChanged, this, &SimpleMissionItem::specifiedFlightSpeedChanged);
connect(_speedSection, &SpeedSection::dirtyChanged, this, &SimpleMissionItem::_sectionDirtyChanged);
connect(_speedSection, &SpeedSection::itemCountChanged, this, &SimpleMissionItem::_updateLastSequenceNumber);
connect(_speedSection, &SpeedSection::specifiedFlightSpeedChanged, this, &SimpleMissionItem::specifiedFlightSpeedChanged);
emit cameraSectionChanged(_cameraSection);
emit speedSectionChanged(_speedSection);
......
......@@ -38,8 +38,11 @@ SpeedSection::SpeedSection(Vehicle* vehicle, QObject* parent)
_flightSpeedFact.setMetaData(_metaDataMap[_flightSpeedName]);
_flightSpeedFact.setRawValue(flightSpeed);
connect(this, &SpeedSection::specifyFlightSpeedChanged, this, &SpeedSection::settingsSpecifiedChanged);
connect(&_flightSpeedFact, &Fact::valueChanged, this, &SpeedSection::_setDirty);
connect(this, &SpeedSection::specifyFlightSpeedChanged, this, &SpeedSection::settingsSpecifiedChanged);
connect(&_flightSpeedFact, &Fact::valueChanged, this, &SpeedSection::_setDirty);
connect(this, &SpeedSection::specifyFlightSpeedChanged, this, &SpeedSection::_updateSpecifiedFlightSpeed);
connect(&_flightSpeedFact, &Fact::valueChanged, this, &SpeedSection::_updateSpecifiedFlightSpeed);
}
bool SpeedSection::settingsSpecified(void) const
......@@ -134,3 +137,15 @@ bool SpeedSection::scanForSection(QmlObjectListModel* visualItems, int scanIndex
return false;
}
double SpeedSection::specifiedFlightSpeed(void) const
{
return _specifyFlightSpeed ? _flightSpeedFact.rawValue().toDouble() : std::numeric_limits<double>::quiet_NaN();
}
void SpeedSection::_updateSpecifiedFlightSpeed(void)
{
emit specifiedFlightSpeedChanged(specifiedFlightSpeed());
}
......@@ -27,6 +27,10 @@ public:
Fact* flightSpeed (void) { return &_flightSpeedFact; }
void setSpecifyFlightSpeed (bool specifyFlightSpeed);
///< Signals specifiedFlightSpeedChanged
///< @return The flight speed specified by this item, NaN if not specified
double specifiedFlightSpeed(void) const;
// Overrides from Section
bool available (void) const override { return _available; }
bool dirty (void) const override { return _dirty; }
......@@ -38,10 +42,12 @@ public:
bool settingsSpecified (void) const override;
signals:
void specifyFlightSpeedChanged(bool specifyFlightSpeed);
void specifyFlightSpeedChanged (bool specifyFlightSpeed);
void specifiedFlightSpeedChanged (double flightSpeed);
private slots:
void _setDirty(void);
void _setDirty (void);
void _updateSpecifiedFlightSpeed(void);
private:
bool _available;
......
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