mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-31 04:25:35 +08:00
refs #288, made setFrequency methods virtual
* rounding in setFrequency of com system * minor fixes in com/modulator
This commit is contained in:
committed by
Roland Winklmeier
parent
89806e69ce
commit
d6cc6e3dd3
@@ -30,20 +30,44 @@ namespace BlackMisc
|
||||
CComSystem::isValidMilitaryFrequency(this->getFrequencyStandby()));
|
||||
}
|
||||
|
||||
/*
|
||||
* COM frequency
|
||||
*/
|
||||
void CComSystem::setFrequencyActiveMHz(double frequencyMHz)
|
||||
{
|
||||
CFrequency f(frequencyMHz, CFrequencyUnit::MHz());
|
||||
if (f == this->getFrequencyActive()) return; // save all the comparisons / rounding
|
||||
CComSystem::roundToChannelSpacing(f, this->m_channelSpacing);
|
||||
this->CModulator::setFrequencyActive(f);
|
||||
this->setFrequencyActive(f);
|
||||
}
|
||||
|
||||
/*
|
||||
* COM frequency
|
||||
*/
|
||||
void CComSystem::setFrequencyStandbyMHz(double frequencyMHz)
|
||||
{
|
||||
CFrequency f(frequencyMHz, CFrequencyUnit::MHz());
|
||||
if (f == this->getFrequencyStandby()) return; // save all the comparisons / rounding
|
||||
CComSystem::roundToChannelSpacing(f, this->m_channelSpacing);
|
||||
CModulator::setFrequencyStandby(f);
|
||||
this->setFrequencyStandby(f);
|
||||
}
|
||||
|
||||
/*
|
||||
* COM frequency
|
||||
*/
|
||||
void CComSystem::setFrequencyActive(const CFrequency &frequency)
|
||||
{
|
||||
if (frequency == this->getFrequencyActive()) { return; } // save all the comparisons / rounding
|
||||
CFrequency fRounded(frequency);
|
||||
roundToChannelSpacing(fRounded, this->m_channelSpacing);
|
||||
this->CModulator::setFrequencyActive(fRounded);
|
||||
}
|
||||
|
||||
/*
|
||||
* COM frequency
|
||||
*/
|
||||
void CComSystem::setFrequencyStandby(const CFrequency &frequency)
|
||||
{
|
||||
if (frequency == this->getFrequencyStandby()) { return; } // save all the comparisons / rounding
|
||||
CFrequency fRounded(frequency);
|
||||
roundToChannelSpacing(fRounded, this->m_channelSpacing);
|
||||
this->CModulator::setFrequencyStandby(fRounded);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -54,11 +54,19 @@ namespace BlackMisc
|
||||
|
||||
//! Set active frequency
|
||||
//! \remarks will be rounded to channel spacing
|
||||
void setFrequencyActiveMHz(double frequencyMHz);
|
||||
virtual void setFrequencyActiveMHz(double frequencyMHz) override;
|
||||
|
||||
//! Set standby frequency
|
||||
//! \remarks will be rounded to channel spacing
|
||||
void setFrequencyStandbyMHz(double frequencyMHz);
|
||||
virtual void setFrequencyStandbyMHz(double frequencyMHz) override;
|
||||
|
||||
//! Set active frequency
|
||||
//! \remarks will be rounded to channel spacing
|
||||
virtual void setFrequencyActive(const BlackMisc::PhysicalQuantities::CFrequency &frequency) override;
|
||||
|
||||
//! Set active frequency
|
||||
//! \remarks will be rounded to channel spacing
|
||||
virtual void setFrequencyStandby(const BlackMisc::PhysicalQuantities::CFrequency &frequency) override;
|
||||
|
||||
//! Is active frequency within 8.3383kHz channel?
|
||||
bool isActiveFrequencyWithin8_33kHzChannel(const BlackMisc::PhysicalQuantities::CFrequency &comFrequency) const
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace BlackMisc
|
||||
//! Default value?
|
||||
virtual bool isDefaultValue() const
|
||||
{
|
||||
return this->m_frequencyActive == CModulator::FrequencyNotSet();
|
||||
return (this->m_frequencyActive == FrequencyNotSet());
|
||||
}
|
||||
|
||||
//! Toggle active and standby frequencies
|
||||
@@ -60,13 +60,13 @@ namespace BlackMisc
|
||||
}
|
||||
|
||||
//! Set active frequency
|
||||
void setFrequencyActive(const BlackMisc::PhysicalQuantities::CFrequency &frequency)
|
||||
virtual void setFrequencyActive(const BlackMisc::PhysicalQuantities::CFrequency &frequency)
|
||||
{
|
||||
this->m_frequencyActive = frequency;
|
||||
}
|
||||
|
||||
//! Set standby frequency
|
||||
void setFrequencyStandby(const BlackMisc::PhysicalQuantities::CFrequency &frequency)
|
||||
virtual void setFrequencyStandby(const BlackMisc::PhysicalQuantities::CFrequency &frequency)
|
||||
{
|
||||
this->m_frequencyStandby = frequency;
|
||||
}
|
||||
@@ -126,14 +126,14 @@ namespace BlackMisc
|
||||
}
|
||||
|
||||
//! Set active frequency
|
||||
void setFrequencyActiveMHz(double frequencyMHz)
|
||||
virtual void setFrequencyActiveMHz(double frequencyMHz)
|
||||
{
|
||||
frequencyMHz = Math::CMath::round(frequencyMHz, 3);
|
||||
this->m_frequencyActive = BlackMisc::PhysicalQuantities::CFrequency(frequencyMHz, BlackMisc::PhysicalQuantities::CFrequencyUnit::MHz());
|
||||
}
|
||||
|
||||
//! Set standby frequency
|
||||
void setFrequencyStandbyMHz(double frequencyMHz)
|
||||
virtual void setFrequencyStandbyMHz(double frequencyMHz)
|
||||
{
|
||||
frequencyMHz = Math::CMath::round(frequencyMHz, 3);
|
||||
this->m_frequencyStandby = BlackMisc::PhysicalQuantities::CFrequency(frequencyMHz, BlackMisc::PhysicalQuantities::CFrequencyUnit::MHz());
|
||||
|
||||
Reference in New Issue
Block a user