mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2024-10-31 15:47:10 -04:00
Add support for HRD control of rigs with an HRD Data drop down
Rigs like the Icom IC-7100 have a Data drop down on the HRD UI to switch the rig in and out and query the data modes. This change supports that by using the On and Off selections to set and query data mode for suitable modes (USB/LSB/FM as DIG_U/DIG_L/DIG_FM). git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@6599 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
parent
da098e4a76
commit
700cc37c88
@ -89,6 +89,9 @@ HRDTransceiver::HRDTransceiver (std::unique_ptr<TransceiverBase> wrapped
|
|||||||
, vfo_toggle_button_ {-1}
|
, vfo_toggle_button_ {-1}
|
||||||
, mode_A_dropdown_ {-1}
|
, mode_A_dropdown_ {-1}
|
||||||
, mode_B_dropdown_ {-1}
|
, mode_B_dropdown_ {-1}
|
||||||
|
, data_mode_dropdown_ {-1}
|
||||||
|
, data_mode_dropdown_selection_on_ {-1}
|
||||||
|
, data_mode_dropdown_selection_off_ {-1}
|
||||||
, split_mode_button_ {-1}
|
, split_mode_button_ {-1}
|
||||||
, split_mode_dropdown_ {-1}
|
, split_mode_dropdown_ {-1}
|
||||||
, split_mode_dropdown_write_only_ {false}
|
, split_mode_dropdown_write_only_ {false}
|
||||||
@ -266,6 +269,13 @@ int HRDTransceiver::do_start ()
|
|||||||
map_modes (mode_B_dropdown_, &mode_B_map_);
|
map_modes (mode_B_dropdown_, &mode_B_map_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Some newer Icoms have a Data drop down with (Off, On, D1, D2, D3)
|
||||||
|
if ((data_mode_dropdown_ = find_dropdown (QRegExp ("^(Data)$"))) >= 0)
|
||||||
|
{
|
||||||
|
data_mode_dropdown_selection_on_ = find_dropdown_selection (data_mode_dropdown_, QRegExp ("^(On)$"));
|
||||||
|
data_mode_dropdown_selection_off_ = find_dropdown_selection (data_mode_dropdown_, QRegExp ("^(Off)$"));
|
||||||
|
}
|
||||||
|
|
||||||
ptt_button_ = find_button (QRegExp ("^(TX)$"));
|
ptt_button_ = find_button (QRegExp ("^(TX)$"));
|
||||||
|
|
||||||
if (vfo_count_ == 1 && ((vfo_B_button_ >= 0 && vfo_A_button_ >= 0) || vfo_toggle_button_ >= 0))
|
if (vfo_count_ == 1 && ((vfo_B_button_ >= 0 && vfo_A_button_ >= 0) || vfo_toggle_button_ >= 0))
|
||||||
@ -273,11 +283,11 @@ int HRDTransceiver::do_start ()
|
|||||||
// put the rig into a known state for tricky cases like Icoms
|
// put the rig into a known state for tricky cases like Icoms
|
||||||
|
|
||||||
auto f = send_command ("get frequency").toUInt ();
|
auto f = send_command ("get frequency").toUInt ();
|
||||||
auto m = lookup_mode (get_dropdown (mode_A_dropdown_), mode_A_map_);
|
auto m = get_data_mode (lookup_mode (get_dropdown (mode_A_dropdown_), mode_A_map_));
|
||||||
set_button (vfo_B_button_ >= 0 ? vfo_B_button_ : vfo_toggle_button_);
|
set_button (vfo_B_button_ >= 0 ? vfo_B_button_ : vfo_toggle_button_);
|
||||||
auto fo = send_command ("get frequency").toUInt ();
|
auto fo = send_command ("get frequency").toUInt ();
|
||||||
update_other_frequency (fo);
|
update_other_frequency (fo);
|
||||||
auto mo = lookup_mode (get_dropdown (mode_A_dropdown_), mode_A_map_);
|
auto mo = get_data_mode (lookup_mode (get_dropdown (mode_A_dropdown_), mode_A_map_));
|
||||||
set_button (vfo_A_button_ >= 0 ? vfo_A_button_ : vfo_toggle_button_);
|
set_button (vfo_A_button_ >= 0 ? vfo_A_button_ : vfo_toggle_button_);
|
||||||
if (f != fo || m != mo)
|
if (f != fo || m != mo)
|
||||||
{
|
{
|
||||||
@ -288,7 +298,7 @@ int HRDTransceiver::do_start ()
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
update_rx_frequency (send_command ("get frequency").toUInt ());
|
update_rx_frequency (send_command ("get frequency").toUInt ());
|
||||||
update_mode (lookup_mode (get_dropdown (mode_A_dropdown_), mode_A_map_));
|
update_mode (get_data_mode (lookup_mode (get_dropdown (mode_A_dropdown_), mode_A_map_)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -478,6 +488,43 @@ void HRDTransceiver::set_button (int button_index, bool checked)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void HRDTransceiver::set_data_mode (MODE m)
|
||||||
|
{
|
||||||
|
if (data_mode_dropdown_ >= 0)
|
||||||
|
{
|
||||||
|
switch (m)
|
||||||
|
{
|
||||||
|
case DIG_U:
|
||||||
|
case DIG_L:
|
||||||
|
case DIG_FM:
|
||||||
|
set_dropdown (data_mode_dropdown_, data_mode_dropdown_selection_on_.front ());
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
set_dropdown (data_mode_dropdown_, data_mode_dropdown_selection_off_.front ());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
auto HRDTransceiver::get_data_mode (MODE m, bool quiet) -> MODE
|
||||||
|
{
|
||||||
|
if (data_mode_dropdown_ >= 0)
|
||||||
|
{
|
||||||
|
auto selection = get_dropdown (data_mode_dropdown_, quiet);
|
||||||
|
if (selection >= 0 && selection != data_mode_dropdown_selection_off_.front ())
|
||||||
|
{
|
||||||
|
switch (m)
|
||||||
|
{
|
||||||
|
case USB: m = DIG_U; break;
|
||||||
|
case LSB: m = DIG_L; break;
|
||||||
|
case FM: m = DIG_FM; break;
|
||||||
|
default: break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return m;
|
||||||
|
}
|
||||||
|
|
||||||
void HRDTransceiver::do_frequency (Frequency f, MODE m, bool /*no_ignore*/)
|
void HRDTransceiver::do_frequency (Frequency f, MODE m, bool /*no_ignore*/)
|
||||||
{
|
{
|
||||||
TRACE_CAT ("HRDTransceiver", f << "reversed" << reversed_);
|
TRACE_CAT ("HRDTransceiver", f << "reversed" << reversed_);
|
||||||
@ -545,18 +592,21 @@ void HRDTransceiver::do_tx_frequency (Frequency tx, bool /*no_ignore*/)
|
|||||||
{
|
{
|
||||||
set_button (reversed_ ? rx_A_button_ : rx_B_button_);
|
set_button (reversed_ ? rx_A_button_ : rx_B_button_);
|
||||||
set_dropdown (mode_A_dropdown_, lookup_mode (state ().mode (), mode_A_map_));
|
set_dropdown (mode_A_dropdown_, lookup_mode (state ().mode (), mode_A_map_));
|
||||||
|
set_data_mode (state ().mode ());
|
||||||
set_button (reversed_ ? rx_B_button_ : rx_A_button_);
|
set_button (reversed_ ? rx_B_button_ : rx_A_button_);
|
||||||
}
|
}
|
||||||
else if (receiver_dropdown_ >= 0)
|
else if (receiver_dropdown_ >= 0)
|
||||||
{
|
{
|
||||||
set_dropdown (receiver_dropdown_, (reversed_ ? rx_A_selection_ : rx_B_selection_).front ());
|
set_dropdown (receiver_dropdown_, (reversed_ ? rx_A_selection_ : rx_B_selection_).front ());
|
||||||
set_dropdown (mode_A_dropdown_, lookup_mode (state ().mode (), mode_A_map_));
|
set_dropdown (mode_A_dropdown_, lookup_mode (state ().mode (), mode_A_map_));
|
||||||
|
set_data_mode (state ().mode ());
|
||||||
set_dropdown (receiver_dropdown_, (reversed_ ? rx_B_selection_ : rx_A_selection_).front ());
|
set_dropdown (receiver_dropdown_, (reversed_ ? rx_B_selection_ : rx_A_selection_).front ());
|
||||||
}
|
}
|
||||||
else if (vfo_count_ > 1)
|
else if (vfo_count_ > 1)
|
||||||
{
|
{
|
||||||
set_button (vfo_A_button_ >= 0 ? (reversed_ ? vfo_A_button_ : vfo_B_button_) : vfo_toggle_button_);
|
set_button (vfo_A_button_ >= 0 ? (reversed_ ? vfo_A_button_ : vfo_B_button_) : vfo_toggle_button_);
|
||||||
set_dropdown (mode_A_dropdown_, lookup_mode (state ().mode (), mode_A_map_));
|
set_dropdown (mode_A_dropdown_, lookup_mode (state ().mode (), mode_A_map_));
|
||||||
|
set_data_mode (state ().mode ());
|
||||||
set_button (vfo_A_button_ >= 0 ? (reversed_ ? vfo_B_button_ : vfo_A_button_) : vfo_toggle_button_);
|
set_button (vfo_A_button_ >= 0 ? (reversed_ ? vfo_B_button_ : vfo_A_button_) : vfo_toggle_button_);
|
||||||
}
|
}
|
||||||
// else Tx VFO mode gets set with frequency below
|
// else Tx VFO mode gets set with frequency below
|
||||||
@ -588,6 +638,7 @@ void HRDTransceiver::do_tx_frequency (Frequency tx, bool /*no_ignore*/)
|
|||||||
// do this here rather than later so we only
|
// do this here rather than later so we only
|
||||||
// toggle/switch VFOs once
|
// toggle/switch VFOs once
|
||||||
set_dropdown (mode_A_dropdown_, lookup_mode (state ().mode (), mode_A_map_));
|
set_dropdown (mode_A_dropdown_, lookup_mode (state ().mode (), mode_A_map_));
|
||||||
|
set_data_mode (state ().mode ());
|
||||||
}
|
}
|
||||||
set_button (vfo_A_button_ >= 0 ? vfo_A_button_ : vfo_toggle_button_);
|
set_button (vfo_A_button_ >= 0 ? vfo_A_button_ : vfo_toggle_button_);
|
||||||
}
|
}
|
||||||
@ -742,6 +793,7 @@ void HRDTransceiver::do_mode (MODE mode)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
set_data_mode (mode);
|
||||||
update_mode (mode);
|
update_mode (mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -780,6 +832,7 @@ void HRDTransceiver::poll ()
|
|||||||
is_button_checked (ptt_button_);
|
is_button_checked (ptt_button_);
|
||||||
get_dropdown (mode_A_dropdown_);
|
get_dropdown (mode_A_dropdown_);
|
||||||
get_dropdown (mode_B_dropdown_);
|
get_dropdown (mode_B_dropdown_);
|
||||||
|
get_dropdown (data_mode_dropdown_);
|
||||||
if (!split_mode_dropdown_write_only_)
|
if (!split_mode_dropdown_write_only_)
|
||||||
{
|
{
|
||||||
get_dropdown (split_mode_dropdown_);
|
get_dropdown (split_mode_dropdown_);
|
||||||
@ -853,11 +906,21 @@ void HRDTransceiver::poll ()
|
|||||||
update_other_frequency (frequencies[reversed_ ? 0 : 1].toUInt ());
|
update_other_frequency (frequencies[reversed_ ? 0 : 1].toUInt ());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
// read frequency is unreliable on single VFO addressing rigs
|
||||||
|
// while transmitting
|
||||||
|
if (!state ().ptt ())
|
||||||
{
|
{
|
||||||
update_rx_frequency (send_command ("get frequency", quiet).toUInt ());
|
update_rx_frequency (send_command ("get frequency", quiet).toUInt ());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
update_mode (lookup_mode (get_dropdown (mode_A_dropdown_, quiet), mode_A_map_));
|
// read mode is unreliable on single VFO addressing rigs while
|
||||||
|
// transmitting
|
||||||
|
if (vfo_count_ > 1 || !state ().ptt ())
|
||||||
|
{
|
||||||
|
update_mode (get_data_mode (lookup_mode (get_dropdown (mode_A_dropdown_, quiet), mode_A_map_), quiet));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QString HRDTransceiver::send_command (QString const& cmd, bool no_debug, bool prepend_context, bool recurse)
|
QString HRDTransceiver::send_command (QString const& cmd, bool no_debug, bool prepend_context, bool recurse)
|
||||||
|
@ -72,6 +72,8 @@ private:
|
|||||||
void map_modes (int dropdown, ModeMap *);
|
void map_modes (int dropdown, ModeMap *);
|
||||||
int lookup_mode (MODE, ModeMap const&) const;
|
int lookup_mode (MODE, ModeMap const&) const;
|
||||||
MODE lookup_mode (int, ModeMap const&) const;
|
MODE lookup_mode (int, ModeMap const&) const;
|
||||||
|
void set_data_mode (MODE);
|
||||||
|
MODE get_data_mode (MODE, bool no_debug = false);
|
||||||
|
|
||||||
// An alternate TransceiverBase instance that can be used to drive
|
// An alternate TransceiverBase instance that can be used to drive
|
||||||
// PTT if required.
|
// PTT if required.
|
||||||
@ -133,6 +135,15 @@ private:
|
|||||||
|
|
||||||
ModeMap mode_B_map_; // The map of modes for VFO B.
|
ModeMap mode_B_map_; // The map of modes for VFO B.
|
||||||
|
|
||||||
|
int data_mode_dropdown_; // Index of data mode drop down, may
|
||||||
|
// be -1 if no such drop down exists
|
||||||
|
|
||||||
|
std::vector<int> data_mode_dropdown_selection_on_; // The drop down
|
||||||
|
// selection to turn on data mode.
|
||||||
|
|
||||||
|
std::vector<int> data_mode_dropdown_selection_off_; // The drop
|
||||||
|
// down selection to disable data mode.
|
||||||
|
|
||||||
int split_mode_button_; // Button to use to select split
|
int split_mode_button_; // Button to use to select split
|
||||||
// operation. May be -1 if no button
|
// operation. May be -1 if no button
|
||||||
// is available.
|
// is available.
|
||||||
|
Loading…
Reference in New Issue
Block a user