Stability fixes for Omni-Rig and its clones

This commit is contained in:
Bill Somerville 2019-06-03 16:35:27 +01:00
parent ca41934b68
commit 248742a3c6
No known key found for this signature in database
GPG Key ID: D864B06D1E81618F
2 changed files with 53 additions and 28 deletions

View File

@ -192,13 +192,25 @@ int OmniRigTransceiver::do_start ()
.arg (readable_params_, 8, 16, QChar ('0'))
.arg (writable_params_, 8, 16, QChar ('0'))
.arg (rig_number_).toLocal8Bit ());
for (int i = 0; i < 5; ++i)
{
if (OmniRig::ST_ONLINE == rig_->Status ())
{
break;
}
await_notification_with_timeout (1000);
}
if (OmniRig::ST_ONLINE != rig_->Status ())
{
throw_qstring ("OmniRig: " + rig_->StatusStr ());
}
auto f = rig_->GetRxFrequency ();
for (int i = 0; (f == 0) && (i < 5); ++i)
{
await_notification_with_timeout (1000);
update_rx_frequency (rig_->GetRxFrequency ());
qDebug () << "Initial state:" << state ();
f = rig_->GetRxFrequency ();
}
update_rx_frequency (f);
int resolution {0};
if (OmniRig::PM_UNKNOWN == rig_->Vfo ()
&& (writable_params_ & (OmniRig::PM_VFOA | OmniRig::PM_VFOB))
@ -208,7 +220,7 @@ int OmniRigTransceiver::do_start ()
// can't query VFO but can set explicitly
rig_->SetVfo (OmniRig::PM_VFOA);
}
auto f = state ().frequency ();
f = state ().frequency ();
if (f % 10) return resolution; // 1Hz resolution
auto test_frequency = f - f % 100 + 55;
if (OmniRig::PM_FREQ & writable_params_)
@ -348,6 +360,10 @@ void OmniRigTransceiver::handle_status_change (int rig_number)
{
offline ("Rig went offline");
}
else
{
Q_EMIT notified ();
}
// else
// {
// update_rx_frequency (rig_->GetRxFrequency ());
@ -452,6 +468,8 @@ void OmniRigTransceiver::handle_params_change (int rig_number, int params)
if (readable_params_ & OmniRig::PM_FREQA)
{
auto f = rig_->FreqA ();
if (f)
{
TRACE_CAT ("OmniRigTransceiver", "FREQA = " << f);
if (reversed_)
{
@ -461,11 +479,13 @@ void OmniRigTransceiver::handle_params_change (int rig_number, int params)
{
update_rx_frequency (f);
}
need_frequency = false;
}
}
if (readable_params_ & OmniRig::PM_FREQB)
{
auto f = rig_->FreqB ();
if (f)
{
TRACE_CAT ("OmniRigTransceiver", "FREQB = " << f);
if (reversed_)
{
@ -475,16 +495,18 @@ void OmniRigTransceiver::handle_params_change (int rig_number, int params)
{
update_other_frequency (f);
}
need_frequency = false;
}
}
if (need_frequency && (readable_params_ & OmniRig::PM_FREQ)
&& !state ().ptt ())
if (readable_params_ & OmniRig::PM_FREQ && !state ().ptt ())
{
auto f = rig_->Freq ();
if (f)
{
TRACE_CAT ("OmniRigTransceiver", "FREQ = " << f);
update_rx_frequency (f);
}
}
}
if (params & OmniRig::PM_PITCH)
{
TRACE_CAT ("OmniRigTransceiver", "PITCH");

View File

@ -211,8 +211,11 @@ void TransceiverBase::stop () noexcept
void TransceiverBase::update_rx_frequency (Frequency rx)
{
if (rx)
{
actual_.frequency (rx);
requested_.frequency (rx); // track rig changes
}
}
void TransceiverBase::update_other_frequency (Frequency tx)