mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2026-06-08 00:44:39 -04:00
Various defect repairs and ambigous behaviour clarifications
A regression introduced in v1.5.0-rc1 where PTT on an alternate serial port when using no CAT control is resolved. A regression introduced in v1.5.0-rc1 where the network server field was not being restored in the settings dialog has been resolved. In settings the "Test PTT" button is now styled by checked state. The "Test PTT" button is enabled without needing click "Test CAT" first when no CAT rig control is selected. Various parts of the settings dialog are now disabled when no CAT rig control is selected. These are the "Mode" group, the "Split Operation" group and the "Monitor returns to last used frequency" check box. None of these have any visible impact nor make sense without CAT rig control. Initialization and teardown of rig control internals has been revised to avoid several problems related to timing and when switching between different CAT settings. This includes improvements in having the operating frequency restored between sessions when not using CAT rig control. The initialization of OmniRig connections has been improved, unfortunately it is still possible to get an exception when clicking the "Test CAT" button where just clicking "OK" and leaving the settings dialog will probably work. Some unnecessary CAT commands output during direct rig control have been elided to reduce the level of traffic a little. The handling of some automatically generated free text messages used when the station is a type 2 compound callsign or is working a type 2 compound callsign has been improved. This is related to how a double click on a message of the form "DE TI4/N0URE 73" is double clicked. The new behaviour depends on whether the current "DX Call" matches the call in the message. This resolves the ambiguity as to whether this message is a sign off at the end of a QSO with current operator (a 73 message is generated) or a tail end opportunity where the message should be treated the same as a CQ or QRZ message (WSJT-X QSYs to the frequency, generates messages and selects message one ready to call). This still leaves some potential ambiguous behaviors in this complex area but selecting "Clear DX call and grid after logging" should resolve most of them. Rig control trace messages have been cleaned up and are now more helpful, less verbose and, tidier in the source code. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx-1.5@5297 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
+52
-100
@@ -6,96 +6,48 @@
|
||||
#include <QString>
|
||||
#include <QTimer>
|
||||
|
||||
#include "pimpl_impl.hpp"
|
||||
|
||||
#include "moc_PollingTransceiver.cpp"
|
||||
|
||||
namespace
|
||||
{
|
||||
unsigned const polls_to_stabilize {3};
|
||||
}
|
||||
|
||||
// Internal implementation of the PollingTransceiver class.
|
||||
class PollingTransceiver::impl final
|
||||
: public QObject
|
||||
{
|
||||
Q_OBJECT;
|
||||
|
||||
public:
|
||||
impl (PollingTransceiver * self, int poll_interval)
|
||||
: QObject {self}
|
||||
, self_ {self}
|
||||
, interval_ {poll_interval}
|
||||
, poll_timer_ {nullptr}
|
||||
, retries_ {0}
|
||||
{
|
||||
}
|
||||
|
||||
private:
|
||||
impl (impl const&) = delete;
|
||||
impl& operator = (impl const&) = delete;
|
||||
|
||||
void start_timer ()
|
||||
{
|
||||
if (interval_)
|
||||
{
|
||||
if (!poll_timer_)
|
||||
{
|
||||
poll_timer_ = new QTimer {this}; // pass ownership to QObject which handles destruction for us
|
||||
|
||||
connect (poll_timer_, &QTimer::timeout, this, &PollingTransceiver::impl::handle_timeout);
|
||||
}
|
||||
poll_timer_->start (interval_);
|
||||
}
|
||||
}
|
||||
|
||||
void stop_timer ()
|
||||
{
|
||||
if (poll_timer_)
|
||||
{
|
||||
poll_timer_->stop ();
|
||||
}
|
||||
}
|
||||
|
||||
Q_SLOT void handle_timeout ();
|
||||
|
||||
PollingTransceiver * self_; // our owner so we can call methods
|
||||
int interval_; // polling interval in milliseconds
|
||||
QTimer * poll_timer_;
|
||||
|
||||
// keep a record of the last state signalled so we can elide
|
||||
// duplicate updates
|
||||
Transceiver::TransceiverState last_signalled_state_;
|
||||
|
||||
// keep a record of expected state so we can compare with actual
|
||||
// updates to determine when state changes have bubbled through
|
||||
Transceiver::TransceiverState next_state_;
|
||||
|
||||
unsigned retries_; // number of incorrect polls left
|
||||
|
||||
friend class PollingTransceiver;
|
||||
};
|
||||
|
||||
#include "PollingTransceiver.moc"
|
||||
|
||||
|
||||
PollingTransceiver::PollingTransceiver (int poll_interval)
|
||||
: m_ {this, poll_interval}
|
||||
: interval_ {poll_interval * 1000}
|
||||
, poll_timer_ {nullptr}
|
||||
, retries_ {0}
|
||||
{
|
||||
}
|
||||
|
||||
PollingTransceiver::~PollingTransceiver ()
|
||||
void PollingTransceiver::start_timer ()
|
||||
{
|
||||
if (interval_)
|
||||
{
|
||||
if (!poll_timer_)
|
||||
{
|
||||
poll_timer_ = new QTimer {this}; // pass ownership to QObject which handles destruction for us
|
||||
|
||||
connect (poll_timer_, &QTimer::timeout, this, &PollingTransceiver::handle_timeout);
|
||||
}
|
||||
poll_timer_->start (interval_);
|
||||
}
|
||||
}
|
||||
|
||||
void PollingTransceiver::stop_timer ()
|
||||
{
|
||||
if (poll_timer_)
|
||||
{
|
||||
poll_timer_->stop ();
|
||||
}
|
||||
}
|
||||
|
||||
void PollingTransceiver::do_post_start ()
|
||||
{
|
||||
m_->start_timer ();
|
||||
if (!m_->next_state_.online ())
|
||||
start_timer ();
|
||||
if (!next_state_.online ())
|
||||
{
|
||||
// remember that we are expecting to go online
|
||||
m_->next_state_.online (true);
|
||||
m_->retries_ = polls_to_stabilize;
|
||||
next_state_.online (true);
|
||||
retries_ = polls_to_stabilize;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,7 +55,7 @@ void PollingTransceiver::do_post_stop ()
|
||||
{
|
||||
// not much point waiting for rig to go offline since we are ceasing
|
||||
// polls
|
||||
m_->stop_timer ();
|
||||
stop_timer ();
|
||||
}
|
||||
|
||||
void PollingTransceiver::do_post_frequency (Frequency f, MODE m)
|
||||
@@ -111,55 +63,55 @@ void PollingTransceiver::do_post_frequency (Frequency f, 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))
|
||||
if (next_state_.frequency () != f || (m != UNK && next_state_.mode () != m))
|
||||
{
|
||||
// update expected state with new frequency and set poll count
|
||||
m_->next_state_.frequency (f);
|
||||
next_state_.frequency (f);
|
||||
if (m != UNK)
|
||||
{
|
||||
m_->next_state_.mode (m);
|
||||
next_state_.mode (m);
|
||||
}
|
||||
m_->retries_ = polls_to_stabilize;
|
||||
retries_ = polls_to_stabilize;
|
||||
}
|
||||
}
|
||||
|
||||
void PollingTransceiver::do_post_tx_frequency (Frequency f, bool /* rationalize */)
|
||||
{
|
||||
if (m_->next_state_.tx_frequency () != f)
|
||||
if (next_state_.tx_frequency () != f)
|
||||
{
|
||||
// update expected state with new TX frequency and set poll
|
||||
// count
|
||||
m_->next_state_.tx_frequency (f);
|
||||
m_->next_state_.split (f); // setting non-zero TX frequency means split
|
||||
m_->retries_ = polls_to_stabilize;
|
||||
next_state_.tx_frequency (f);
|
||||
next_state_.split (f); // setting non-zero TX frequency means split
|
||||
retries_ = polls_to_stabilize;
|
||||
}
|
||||
}
|
||||
|
||||
void PollingTransceiver::do_post_mode (MODE m, bool /*rationalize_mode*/)
|
||||
{
|
||||
// we don't ever expect mode to goto to unknown
|
||||
if (m != UNK && m_->next_state_.mode () != m)
|
||||
if (m != UNK && next_state_.mode () != m)
|
||||
{
|
||||
// update expected state with new mode and set poll count
|
||||
m_->next_state_.mode (m);
|
||||
m_->retries_ = polls_to_stabilize;
|
||||
next_state_.mode (m);
|
||||
retries_ = polls_to_stabilize;
|
||||
}
|
||||
}
|
||||
|
||||
void PollingTransceiver::do_post_ptt (bool p)
|
||||
{
|
||||
if (m_->next_state_.ptt () != p)
|
||||
if (next_state_.ptt () != p)
|
||||
{
|
||||
// update expected state with new PTT and set poll count
|
||||
m_->next_state_.ptt (p);
|
||||
m_->retries_ = polls_to_stabilize;
|
||||
next_state_.ptt (p);
|
||||
retries_ = 0; // fast feedback on PTT
|
||||
}
|
||||
}
|
||||
|
||||
bool PollingTransceiver::do_pre_update ()
|
||||
{
|
||||
// if we are holding off a change then withhold the signal
|
||||
if (m_->retries_ && state () != m_->next_state_)
|
||||
if (retries_ && state () != next_state_)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -175,10 +127,10 @@ void PollingTransceiver::do_sync (bool force_signal)
|
||||
// or, hasn't become what we expected after polls_to_stabilize
|
||||
// polls. Unsolicited changes will be signalled immediately unless
|
||||
// they intervene in a expected sequence where they will be delayed.
|
||||
if (m_->retries_)
|
||||
if (retries_)
|
||||
{
|
||||
--m_->retries_;
|
||||
if (force_signal || state () == m_->next_state_ || !m_->retries_)
|
||||
--retries_;
|
||||
if (force_signal || state () == next_state_ || !retries_)
|
||||
{
|
||||
// our client wants a signal regardless
|
||||
// or the expected state has arrived
|
||||
@@ -186,7 +138,7 @@ void PollingTransceiver::do_sync (bool force_signal)
|
||||
force_signal = true;
|
||||
}
|
||||
}
|
||||
else if (force_signal || state () != m_->last_signalled_state_)
|
||||
else if (force_signal || state () != last_signalled_state_)
|
||||
{
|
||||
// here is the normal passive polling path
|
||||
// either our client has requested a state update regardless of change
|
||||
@@ -197,14 +149,14 @@ void PollingTransceiver::do_sync (bool force_signal)
|
||||
if (force_signal)
|
||||
{
|
||||
// reset everything, record and signal the current state
|
||||
m_->retries_ = 0;
|
||||
m_->next_state_ = state ();
|
||||
m_->last_signalled_state_ = state ();
|
||||
retries_ = 0;
|
||||
next_state_ = state ();
|
||||
last_signalled_state_ = state ();
|
||||
update_complete ();
|
||||
}
|
||||
}
|
||||
|
||||
void PollingTransceiver::impl::handle_timeout ()
|
||||
void PollingTransceiver::handle_timeout ()
|
||||
{
|
||||
QString message;
|
||||
|
||||
@@ -212,7 +164,7 @@ void PollingTransceiver::impl::handle_timeout ()
|
||||
// inform our parent of the failure via the offline() message
|
||||
try
|
||||
{
|
||||
self_->do_sync (false);
|
||||
do_sync (false);
|
||||
}
|
||||
catch (std::exception const& e)
|
||||
{
|
||||
@@ -224,6 +176,6 @@ void PollingTransceiver::impl::handle_timeout ()
|
||||
}
|
||||
if (!message.isEmpty ())
|
||||
{
|
||||
self_->offline (message);
|
||||
offline (message);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user