mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2024-11-23 12:48:40 -05:00
Rig polling not detecting changes against cached values correctly
The PollingTransceiver class was not dealing with frequency change commands correctly when the mode was not specified. Improved some diagnostic messages. Only leave transmit mode when PTT is seen to drop. Merged from wsjtx-1.4 branch. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@4886 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
parent
f88870df60
commit
f4db871ebd
@ -100,7 +100,7 @@ void EmulateSplitTransceiver::handle_update (TransceiverState state)
|
|||||||
|
|
||||||
if (state.split ())
|
if (state.split ())
|
||||||
{
|
{
|
||||||
Q_EMIT failure (tr ("Emulated split mode requires rig to in simplex mode"));
|
Q_EMIT failure (tr ("Emulated split mode requires rig to be in simplex mode"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -21,9 +21,6 @@ class PollingTransceiver::impl final
|
|||||||
{
|
{
|
||||||
Q_OBJECT;
|
Q_OBJECT;
|
||||||
|
|
||||||
private:
|
|
||||||
Q_DISABLE_COPY (impl);
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
impl (PollingTransceiver * self, int poll_interval)
|
impl (PollingTransceiver * self, int poll_interval)
|
||||||
: QObject {self}
|
: QObject {self}
|
||||||
@ -35,6 +32,9 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
impl (impl const&) = delete;
|
||||||
|
impl& operator = (impl const&) = delete;
|
||||||
|
|
||||||
void start_timer ()
|
void start_timer ()
|
||||||
{
|
{
|
||||||
if (interval_)
|
if (interval_)
|
||||||
@ -108,11 +108,17 @@ void PollingTransceiver::do_post_stop ()
|
|||||||
|
|
||||||
void PollingTransceiver::do_post_frequency (Frequency f, MODE m)
|
void PollingTransceiver::do_post_frequency (Frequency f, MODE m)
|
||||||
{
|
{
|
||||||
if (m_->next_state_.frequency () != f || m_->next_state_.mode () != m)
|
// take care not to set the expected next mode to unknown since some
|
||||||
|
// callers use mode == unknown to signify that they do not know the
|
||||||
|
// mode and don't care
|
||||||
|
if (m_->next_state_.frequency () != f || (m != UNK && m_->next_state_.mode () != m))
|
||||||
{
|
{
|
||||||
// update expected state with new frequency and set poll count
|
// update expected state with new frequency and set poll count
|
||||||
m_->next_state_.frequency (f);
|
m_->next_state_.frequency (f);
|
||||||
m_->next_state_.mode (m);
|
if (m != UNK)
|
||||||
|
{
|
||||||
|
m_->next_state_.mode (m);
|
||||||
|
}
|
||||||
m_->retries_ = polls_to_stabilize;
|
m_->retries_ = polls_to_stabilize;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -131,7 +137,8 @@ void PollingTransceiver::do_post_tx_frequency (Frequency f, bool /* rationalize
|
|||||||
|
|
||||||
void PollingTransceiver::do_post_mode (MODE m, bool /*rationalize_mode*/)
|
void PollingTransceiver::do_post_mode (MODE m, bool /*rationalize_mode*/)
|
||||||
{
|
{
|
||||||
if (m_->next_state_.mode () != m)
|
// we don't ever expect mode to goto to unknown
|
||||||
|
if (m != UNK && m_->next_state_.mode () != m)
|
||||||
{
|
{
|
||||||
// update expected state with new mode and set poll count
|
// update expected state with new mode and set poll count
|
||||||
m_->next_state_.mode (m);
|
m_->next_state_.mode (m);
|
||||||
@ -139,6 +146,16 @@ void PollingTransceiver::do_post_mode (MODE m, bool /*rationalize_mode*/)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PollingTransceiver::do_post_ptt (bool p)
|
||||||
|
{
|
||||||
|
if (m_->next_state_.ptt () != p)
|
||||||
|
{
|
||||||
|
// update expected state with new PTT and set poll count
|
||||||
|
m_->next_state_.ptt (p);
|
||||||
|
m_->retries_ = polls_to_stabilize;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool PollingTransceiver::do_pre_update ()
|
bool PollingTransceiver::do_pre_update ()
|
||||||
{
|
{
|
||||||
// if we are holding off a change then withhold the signal
|
// if we are holding off a change then withhold the signal
|
||||||
|
@ -52,6 +52,7 @@ protected:
|
|||||||
void do_post_frequency (Frequency, MODE = UNK) override final;
|
void do_post_frequency (Frequency, MODE = UNK) override final;
|
||||||
void do_post_tx_frequency (Frequency, bool rationalize = true) override final;
|
void do_post_tx_frequency (Frequency, bool rationalize = true) override final;
|
||||||
void do_post_mode (MODE, bool rationalize = true) override final;
|
void do_post_mode (MODE, bool rationalize = true) override final;
|
||||||
|
void do_post_ptt (bool = true) override final;
|
||||||
bool do_pre_update () override final;
|
bool do_pre_update () override final;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -12,20 +12,38 @@ namespace
|
|||||||
}
|
}
|
||||||
|
|
||||||
class TransceiverBase::impl final
|
class TransceiverBase::impl final
|
||||||
|
: public QObject
|
||||||
{
|
{
|
||||||
|
Q_OBJECT;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
impl ()
|
impl (TransceiverBase * parent)
|
||||||
|
: parent_ {parent}
|
||||||
{
|
{
|
||||||
|
connect (this, &TransceiverBase::impl::updated, this, &TransceiverBase::impl::update_complete, Qt::QueuedConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
impl (impl const&) = delete;
|
impl (impl const&) = delete;
|
||||||
impl& operator = (impl const&) = delete;
|
impl& operator = (impl const&) = delete;
|
||||||
|
|
||||||
|
Q_SIGNAL void updated ();
|
||||||
|
Q_SLOT void update_complete ()
|
||||||
|
{
|
||||||
|
if (parent_->do_pre_update ())
|
||||||
|
{
|
||||||
|
Q_EMIT parent_->update (state_);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TransceiverBase * parent_;
|
||||||
TransceiverState state_;
|
TransceiverState state_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#include "TransceiverBase.moc"
|
||||||
|
|
||||||
TransceiverBase::TransceiverBase ()
|
TransceiverBase::TransceiverBase ()
|
||||||
|
: m_ {this}
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -260,10 +278,9 @@ void TransceiverBase::update_PTT (bool state)
|
|||||||
|
|
||||||
void TransceiverBase::update_complete ()
|
void TransceiverBase::update_complete ()
|
||||||
{
|
{
|
||||||
if (do_pre_update ())
|
// Use a signal to ensure that the calling function completes before
|
||||||
{
|
// the Transceiver::update signal is triggered.
|
||||||
Q_EMIT update (m_->state_);
|
Q_EMIT m_->updated ();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TransceiverBase::offline (QString const& reason)
|
void TransceiverBase::offline (QString const& reason)
|
||||||
|
@ -120,7 +120,7 @@ protected:
|
|||||||
void update_mode (MODE);
|
void update_mode (MODE);
|
||||||
void update_PTT (bool = true);
|
void update_PTT (bool = true);
|
||||||
|
|
||||||
// Calling this triggers the Transceiver::update(State) signal.
|
// Calling this eventually triggers the Transceiver::update(State) signal.
|
||||||
void update_complete ();
|
void update_complete ();
|
||||||
|
|
||||||
// sub class may asynchronously take the rig offline by calling this
|
// sub class may asynchronously take the rig offline by calling this
|
||||||
|
@ -2883,8 +2883,7 @@ void MainWindow::on_cbPlus2kHz_toggled(bool checked)
|
|||||||
|
|
||||||
void MainWindow::handle_transceiver_update (Transceiver::TransceiverState s)
|
void MainWindow::handle_transceiver_update (Transceiver::TransceiverState s)
|
||||||
{
|
{
|
||||||
|
transmitDisplay (s.ptt ());
|
||||||
transmitDisplay (false);
|
|
||||||
|
|
||||||
if ((s.frequency () - m_dialFreq) || s.split () != m_splitMode)
|
if ((s.frequency () - m_dialFreq) || s.split () != m_splitMode)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user