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