mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2025-05-23 18:02:29 -04:00
Add minimum support for one way CAT control rigs
Older rigs like the Yaesu FT-736R only support set commands and extremely limited query commands (like squelch and S-meter levels). This change allows them to be supported via Hamlib albeit in a very minimal way. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@7556 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
parent
cf97a23379
commit
b4fc646455
@ -189,6 +189,7 @@ HamlibTransceiver::HamlibTransceiver (TransceiverFactory::PTTMethod ptt_type, QS
|
|||||||
, one_VFO_ {false}
|
, one_VFO_ {false}
|
||||||
, is_dummy_ {true}
|
, is_dummy_ {true}
|
||||||
, reversed_ {false}
|
, reversed_ {false}
|
||||||
|
, freq_query_works_ {true}
|
||||||
, mode_query_works_ {true}
|
, mode_query_works_ {true}
|
||||||
, split_query_works_ {true}
|
, split_query_works_ {true}
|
||||||
, tickle_hamlib_ {false}
|
, tickle_hamlib_ {false}
|
||||||
@ -240,6 +241,7 @@ HamlibTransceiver::HamlibTransceiver (int model_number, TransceiverFactory::Para
|
|||||||
, one_VFO_ {false}
|
, one_VFO_ {false}
|
||||||
, is_dummy_ {RIG_MODEL_DUMMY == model_number}
|
, is_dummy_ {RIG_MODEL_DUMMY == model_number}
|
||||||
, reversed_ {false}
|
, reversed_ {false}
|
||||||
|
, freq_query_works_ {rig_ && rig_->caps->get_freq}
|
||||||
, mode_query_works_ {rig_ && rig_->caps->get_mode}
|
, mode_query_works_ {rig_ && rig_->caps->get_mode}
|
||||||
, split_query_works_ {rig_ && rig_->caps->get_split_vfo}
|
, split_query_works_ {rig_ && rig_->caps->get_split_vfo}
|
||||||
, tickle_hamlib_ {false}
|
, tickle_hamlib_ {false}
|
||||||
@ -441,7 +443,8 @@ int HamlibTransceiver::do_start ()
|
|||||||
rmode_t mb;
|
rmode_t mb;
|
||||||
pbwidth_t w {RIG_PASSBAND_NORMAL};
|
pbwidth_t w {RIG_PASSBAND_NORMAL};
|
||||||
pbwidth_t wb;
|
pbwidth_t wb;
|
||||||
if ((!get_vfo_works_ || !rig_->caps->get_vfo)
|
if (freq_query_works_
|
||||||
|
&& (!get_vfo_works_ || !rig_->caps->get_vfo)
|
||||||
&& (rig_->caps->set_vfo || rig_has_vfo_op (rig_.data (), RIG_OP_TOGGLE)))
|
&& (rig_->caps->set_vfo || rig_has_vfo_op (rig_.data (), RIG_OP_TOGGLE)))
|
||||||
{
|
{
|
||||||
// Icom have deficient CAT protocol with no way of reading which
|
// Icom have deficient CAT protocol with no way of reading which
|
||||||
@ -553,36 +556,43 @@ int HamlibTransceiver::do_start ()
|
|||||||
}
|
}
|
||||||
|
|
||||||
int resolution {0};
|
int resolution {0};
|
||||||
freq_t current_frequency;
|
if (freq_query_works_)
|
||||||
error_check (rig_get_freq (rig_.data (), RIG_VFO_CURR, ¤t_frequency), tr ("getting current VFO frequency"));
|
|
||||||
current_frequency = std::round (current_frequency);
|
|
||||||
Frequency f = current_frequency;
|
|
||||||
if (f && !(f % 10))
|
|
||||||
{
|
{
|
||||||
auto test_frequency = f - f % 100 + 55;
|
freq_t current_frequency;
|
||||||
error_check (rig_set_freq (rig_.data (), RIG_VFO_CURR, test_frequency), tr ("setting frequency"));
|
error_check (rig_get_freq (rig_.data (), RIG_VFO_CURR, ¤t_frequency), tr ("getting current VFO frequency"));
|
||||||
freq_t new_frequency;
|
current_frequency = std::round (current_frequency);
|
||||||
error_check (rig_get_freq (rig_.data (), RIG_VFO_CURR, &new_frequency), tr ("getting current VFO frequency"));
|
Frequency f = current_frequency;
|
||||||
new_frequency = std::round (new_frequency);
|
if (f && !(f % 10))
|
||||||
switch (static_cast<Radio::FrequencyDelta> (new_frequency - test_frequency))
|
|
||||||
{
|
{
|
||||||
case -5: resolution = -1; break; // 10Hz truncated
|
auto test_frequency = f - f % 100 + 55;
|
||||||
case 5: resolution = 1; break; // 10Hz rounded
|
|
||||||
case -15: resolution = -2; break; // 20Hz truncated
|
|
||||||
case -55: resolution = -3; break; // 100Hz truncated
|
|
||||||
case 45: resolution = 3; break; // 100Hz rounded
|
|
||||||
}
|
|
||||||
if (1 == resolution) // may be 20Hz rounded
|
|
||||||
{
|
|
||||||
test_frequency = f - f % 100 + 51;
|
|
||||||
error_check (rig_set_freq (rig_.data (), RIG_VFO_CURR, test_frequency), tr ("setting frequency"));
|
error_check (rig_set_freq (rig_.data (), RIG_VFO_CURR, test_frequency), tr ("setting frequency"));
|
||||||
|
freq_t new_frequency;
|
||||||
error_check (rig_get_freq (rig_.data (), RIG_VFO_CURR, &new_frequency), tr ("getting current VFO frequency"));
|
error_check (rig_get_freq (rig_.data (), RIG_VFO_CURR, &new_frequency), tr ("getting current VFO frequency"));
|
||||||
if (9 == static_cast<Radio::FrequencyDelta> (new_frequency - test_frequency))
|
new_frequency = std::round (new_frequency);
|
||||||
|
switch (static_cast<Radio::FrequencyDelta> (new_frequency - test_frequency))
|
||||||
{
|
{
|
||||||
resolution = 2; // 20Hz rounded
|
case -5: resolution = -1; break; // 10Hz truncated
|
||||||
|
case 5: resolution = 1; break; // 10Hz rounded
|
||||||
|
case -15: resolution = -2; break; // 20Hz truncated
|
||||||
|
case -55: resolution = -3; break; // 100Hz truncated
|
||||||
|
case 45: resolution = 3; break; // 100Hz rounded
|
||||||
}
|
}
|
||||||
|
if (1 == resolution) // may be 20Hz rounded
|
||||||
|
{
|
||||||
|
test_frequency = f - f % 100 + 51;
|
||||||
|
error_check (rig_set_freq (rig_.data (), RIG_VFO_CURR, test_frequency), tr ("setting frequency"));
|
||||||
|
error_check (rig_get_freq (rig_.data (), RIG_VFO_CURR, &new_frequency), tr ("getting current VFO frequency"));
|
||||||
|
if (9 == static_cast<Radio::FrequencyDelta> (new_frequency - test_frequency))
|
||||||
|
{
|
||||||
|
resolution = 2; // 20Hz rounded
|
||||||
|
}
|
||||||
|
}
|
||||||
|
error_check (rig_set_freq (rig_.data (), RIG_VFO_CURR, current_frequency), tr ("setting frequency"));
|
||||||
}
|
}
|
||||||
error_check (rig_set_freq (rig_.data (), RIG_VFO_CURR, current_frequency), tr ("setting frequency"));
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
resolution = -1; // best guess
|
||||||
}
|
}
|
||||||
|
|
||||||
poll ();
|
poll ();
|
||||||
@ -874,34 +884,37 @@ void HamlibTransceiver::poll ()
|
|||||||
reversed_ = RIG_VFO_B == v;
|
reversed_ = RIG_VFO_B == v;
|
||||||
}
|
}
|
||||||
|
|
||||||
// only read when receiving or simplex
|
if (freq_query_works_)
|
||||||
if (!state ().ptt () || !state ().split ())
|
|
||||||
{
|
{
|
||||||
error_check (rig_get_freq (rig_.data (), RIG_VFO_CURR, &f), tr ("getting current VFO frequency"));
|
// only read if possible and when receiving or simplex
|
||||||
f = std::round (f);
|
if (!state ().ptt () || !state ().split ())
|
||||||
TRACE_CAT_POLL ("HamlibTransceiver", "rig_get_freq frequency =" << f);
|
{
|
||||||
update_rx_frequency (f);
|
error_check (rig_get_freq (rig_.data (), RIG_VFO_CURR, &f), tr ("getting current VFO frequency"));
|
||||||
}
|
f = std::round (f);
|
||||||
|
TRACE_CAT_POLL ("HamlibTransceiver", "rig_get_freq frequency =" << f);
|
||||||
|
update_rx_frequency (f);
|
||||||
|
}
|
||||||
|
|
||||||
if ((WSJT_RIG_NONE_CAN_SPLIT || !is_dummy_)
|
if ((WSJT_RIG_NONE_CAN_SPLIT || !is_dummy_)
|
||||||
&& state ().split ()
|
&& state ().split ()
|
||||||
&& (rig_->caps->targetable_vfo & (RIG_TARGETABLE_FREQ | RIG_TARGETABLE_PURE))
|
&& (rig_->caps->targetable_vfo & (RIG_TARGETABLE_FREQ | RIG_TARGETABLE_PURE))
|
||||||
&& !one_VFO_)
|
&& !one_VFO_)
|
||||||
{
|
{
|
||||||
// only read "other" VFO if in split, this allows rigs like
|
// only read "other" VFO if in split, this allows rigs like
|
||||||
// FlexRadio to work in Kenwood TS-2000 mode despite them
|
// FlexRadio to work in Kenwood TS-2000 mode despite them
|
||||||
// not having a FB; command
|
// not having a FB; command
|
||||||
|
|
||||||
// we can only probe current VFO unless rig supports reading
|
// we can only probe current VFO unless rig supports reading
|
||||||
// the other one directly because we can't glitch the Rx
|
// the other one directly because we can't glitch the Rx
|
||||||
error_check (rig_get_freq (rig_.data ()
|
error_check (rig_get_freq (rig_.data ()
|
||||||
, reversed_
|
, reversed_
|
||||||
? (rig_->state.vfo_list & RIG_VFO_A ? RIG_VFO_A : RIG_VFO_MAIN)
|
? (rig_->state.vfo_list & RIG_VFO_A ? RIG_VFO_A : RIG_VFO_MAIN)
|
||||||
: (rig_->state.vfo_list & RIG_VFO_B ? RIG_VFO_B : RIG_VFO_SUB)
|
: (rig_->state.vfo_list & RIG_VFO_B ? RIG_VFO_B : RIG_VFO_SUB)
|
||||||
, &f), tr ("getting other VFO frequency"));
|
, &f), tr ("getting other VFO frequency"));
|
||||||
f = std::round (f);
|
f = std::round (f);
|
||||||
TRACE_CAT_POLL ("HamlibTransceiver", "rig_get_freq other VFO =" << f);
|
TRACE_CAT_POLL ("HamlibTransceiver", "rig_get_freq other VFO =" << f);
|
||||||
update_other_frequency (f);
|
update_other_frequency (f);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// only read when receiving or simplex if direct VFO addressing unavailable
|
// only read when receiving or simplex if direct VFO addressing unavailable
|
||||||
|
@ -63,6 +63,7 @@ class HamlibTransceiver final
|
|||||||
|
|
||||||
bool mutable reversed_;
|
bool mutable reversed_;
|
||||||
|
|
||||||
|
bool freq_query_works_;
|
||||||
bool mode_query_works_;
|
bool mode_query_works_;
|
||||||
bool split_query_works_;
|
bool split_query_works_;
|
||||||
bool tickle_hamlib_; // Hamlib requires a
|
bool tickle_hamlib_; // Hamlib requires a
|
||||||
|
Loading…
x
Reference in New Issue
Block a user