mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2025-05-29 21:02:26 -04:00
Another attempt to cope with spurious offline status from Omni-Rig
This commit is contained in:
parent
f192fdf3c1
commit
4a3551143f
@ -1,6 +1,5 @@
|
|||||||
#include "OmniRigTransceiver.hpp"
|
#include "OmniRigTransceiver.hpp"
|
||||||
|
|
||||||
#include <QTimer>
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <objbase.h>
|
#include <objbase.h>
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
@ -158,6 +157,12 @@ int OmniRigTransceiver::do_start ()
|
|||||||
Q_ASSERT (rig_);
|
Q_ASSERT (rig_);
|
||||||
Q_ASSERT (!rig_->isNull ());
|
Q_ASSERT (!rig_->isNull ());
|
||||||
|
|
||||||
|
offline_timer_.reset (new QTimer); // instantiate here as
|
||||||
|
// constructor runs in wrong
|
||||||
|
// thread
|
||||||
|
offline_timer_->setSingleShot (true);
|
||||||
|
connect (offline_timer_.data (), &QTimer::timeout, [this] () {offline ("Rig went offline");});
|
||||||
|
|
||||||
if (use_for_ptt_ && (TransceiverFactory::PTT_method_DTR == ptt_type_ || TransceiverFactory::PTT_method_RTS == ptt_type_))
|
if (use_for_ptt_ && (TransceiverFactory::PTT_method_DTR == ptt_type_ || TransceiverFactory::PTT_method_RTS == ptt_type_))
|
||||||
{
|
{
|
||||||
// fetch the interface for the serial port if we need it for PTT
|
// fetch the interface for the serial port if we need it for PTT
|
||||||
@ -204,6 +209,8 @@ int OmniRigTransceiver::do_start ()
|
|||||||
{
|
{
|
||||||
throw_qstring ("OmniRig: " + rig_->StatusStr ());
|
throw_qstring ("OmniRig: " + rig_->StatusStr ());
|
||||||
}
|
}
|
||||||
|
QThread::msleep (500); // leave some time for Omni-Rig to get
|
||||||
|
// the rig status for the 1st. time
|
||||||
auto f = rig_->GetRxFrequency ();
|
auto f = rig_->GetRxFrequency ();
|
||||||
for (int i = 0; (f == 0) && (i < 5); ++i)
|
for (int i = 0; (f == 0) && (i < 5); ++i)
|
||||||
{
|
{
|
||||||
@ -297,6 +304,11 @@ void OmniRigTransceiver::do_stop ()
|
|||||||
{
|
{
|
||||||
QThread::msleep (200); // leave some time for pending
|
QThread::msleep (200); // leave some time for pending
|
||||||
// commands at the server end
|
// commands at the server end
|
||||||
|
|
||||||
|
offline_timer_.reset (); // destroy here rather than in
|
||||||
|
// destructor as destructor runs in
|
||||||
|
// wrong thread
|
||||||
|
|
||||||
if (port_)
|
if (port_)
|
||||||
{
|
{
|
||||||
port_->Unlock (); // release serial port
|
port_->Unlock (); // release serial port
|
||||||
@ -358,10 +370,17 @@ void OmniRigTransceiver::handle_status_change (int rig_number)
|
|||||||
TRACE_CAT ("OmniRigTransceiver", "OmniRig status change: new status = " << status);
|
TRACE_CAT ("OmniRigTransceiver", "OmniRig status change: new status = " << status);
|
||||||
if (OmniRig::ST_ONLINE != rig_->Status ())
|
if (OmniRig::ST_ONLINE != rig_->Status ())
|
||||||
{
|
{
|
||||||
offline ("Rig went offline");
|
if (!offline_timer_->isActive ())
|
||||||
|
{
|
||||||
|
// Omni-Rig is prone to reporting the rig offline and
|
||||||
|
// then recovering autonomously, so we will give it a
|
||||||
|
// few seconds to make its mind up
|
||||||
|
offline_timer_->start (10000);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
offline_timer_->stop (); // good to go again
|
||||||
Q_EMIT notified ();
|
Q_EMIT notified ();
|
||||||
}
|
}
|
||||||
// else
|
// else
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
#include <QScopedPointer>
|
#include <QScopedPointer>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
#include <QTimer>
|
||||||
|
|
||||||
#include "TransceiverFactory.hpp"
|
#include "TransceiverFactory.hpp"
|
||||||
#include "TransceiverBase.hpp"
|
#include "TransceiverBase.hpp"
|
||||||
@ -63,7 +64,7 @@ private:
|
|||||||
QString rig_type_;
|
QString rig_type_;
|
||||||
int readable_params_;
|
int readable_params_;
|
||||||
int writable_params_;
|
int writable_params_;
|
||||||
// QScopedPointer<QTimer> offline_timer_;
|
QScopedPointer<QTimer> offline_timer_;
|
||||||
bool send_update_signal_;
|
bool send_update_signal_;
|
||||||
bool reversed_; // some rigs can reverse VFOs
|
bool reversed_; // some rigs can reverse VFOs
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user