mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2024-11-25 21:58:38 -05:00
Avoid some bound to fail Hamlib API calls
This commit is contained in:
parent
837e542991
commit
8458df1137
@ -195,6 +195,7 @@ HamlibTransceiver::HamlibTransceiver (TransceiverFactory::PTTMethod ptt_type, QS
|
|||||||
QObject * parent)
|
QObject * parent)
|
||||||
: PollingTransceiver {0, parent}
|
: PollingTransceiver {0, parent}
|
||||||
, rig_ {rig_init (RIG_MODEL_DUMMY)}
|
, rig_ {rig_init (RIG_MODEL_DUMMY)}
|
||||||
|
, ptt_only_ {true}
|
||||||
, back_ptt_port_ {false}
|
, back_ptt_port_ {false}
|
||||||
, one_VFO_ {false}
|
, one_VFO_ {false}
|
||||||
, is_dummy_ {true}
|
, is_dummy_ {true}
|
||||||
@ -248,6 +249,7 @@ HamlibTransceiver::HamlibTransceiver (int model_number, TransceiverFactory::Para
|
|||||||
QObject * parent)
|
QObject * parent)
|
||||||
: PollingTransceiver {params.poll_interval, parent}
|
: PollingTransceiver {params.poll_interval, parent}
|
||||||
, rig_ {rig_init (model_number)}
|
, rig_ {rig_init (model_number)}
|
||||||
|
, ptt_only_ {false}
|
||||||
, back_ptt_port_ {TransceiverFactory::TX_audio_source_rear == params.audio_source}
|
, back_ptt_port_ {TransceiverFactory::TX_audio_source_rear == params.audio_source}
|
||||||
, one_VFO_ {false}
|
, one_VFO_ {false}
|
||||||
, is_dummy_ {RIG_MODEL_DUMMY == model_number}
|
, is_dummy_ {RIG_MODEL_DUMMY == model_number}
|
||||||
@ -591,7 +593,7 @@ int HamlibTransceiver::do_start ()
|
|||||||
|
|
||||||
tickle_hamlib_ = true;
|
tickle_hamlib_ = true;
|
||||||
|
|
||||||
if (is_dummy_ && dummy_frequency_)
|
if (is_dummy_ && !ptt_only_ && dummy_frequency_)
|
||||||
{
|
{
|
||||||
// return to where last dummy instance was
|
// return to where last dummy instance was
|
||||||
// TODO: this is going to break down if multiple dummy rigs are used
|
// TODO: this is going to break down if multiple dummy rigs are used
|
||||||
@ -652,7 +654,7 @@ int HamlibTransceiver::do_start ()
|
|||||||
|
|
||||||
void HamlibTransceiver::do_stop ()
|
void HamlibTransceiver::do_stop ()
|
||||||
{
|
{
|
||||||
if (is_dummy_)
|
if (is_dummy_ && !ptt_only_)
|
||||||
{
|
{
|
||||||
rig_get_freq (rig_.data (), RIG_VFO_CURR, &dummy_frequency_);
|
rig_get_freq (rig_.data (), RIG_VFO_CURR, &dummy_frequency_);
|
||||||
dummy_frequency_ = std::round (dummy_frequency_);
|
dummy_frequency_ = std::round (dummy_frequency_);
|
||||||
|
@ -45,6 +45,7 @@ public:
|
|||||||
struct RIGDeleter {static void cleanup (RIG *);};
|
struct RIGDeleter {static void cleanup (RIG *);};
|
||||||
QScopedPointer<RIG, RIGDeleter> rig_;
|
QScopedPointer<RIG, RIGDeleter> rig_;
|
||||||
|
|
||||||
|
bool ptt_only_; // we can use a dummy device for PTT
|
||||||
bool back_ptt_port_;
|
bool back_ptt_port_;
|
||||||
bool one_VFO_;
|
bool one_VFO_;
|
||||||
bool is_dummy_;
|
bool is_dummy_;
|
||||||
|
@ -172,14 +172,14 @@ void TransceiverBase::shutdown ()
|
|||||||
do_tx_frequency (0, UNK, true);
|
do_tx_frequency (0, UNK, true);
|
||||||
do_post_tx_frequency (0, UNK);
|
do_post_tx_frequency (0, UNK);
|
||||||
}
|
}
|
||||||
|
do_stop ();
|
||||||
|
do_post_stop ();
|
||||||
}
|
}
|
||||||
catch (...)
|
catch (...)
|
||||||
{
|
{
|
||||||
// don't care about exceptions
|
// don't care about exceptions
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
do_stop ();
|
|
||||||
do_post_stop ();
|
|
||||||
actual_ = TransceiverState {};
|
actual_ = TransceiverState {};
|
||||||
requested_ = TransceiverState {};
|
requested_ = TransceiverState {};
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user