Add default options for Hamlib CAT serial data bits, stop bits, and handshaking

Hamlib has  deafult values  for these options  that are  nearly always
correct so we  can offer a default  option in WSJT-X which  in turn is
the defaulty option.

Thanks to Mike, W9MDB, for the builk of this contribution.

git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@8568 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Bill Somerville 2018-03-16 22:00:33 +00:00
parent 1455d94f95
commit 181bc8cc7c
4 changed files with 81 additions and 29 deletions

View File

@ -955,12 +955,15 @@ Configuration::impl::impl (Configuration * self, QDir const& temp_directory,
//
// assign ids to radio buttons
//
ui_->CAT_data_bits_button_group->setId (ui_->CAT_default_bit_radio_button, TransceiverFactory::default_data_bits);
ui_->CAT_data_bits_button_group->setId (ui_->CAT_7_bit_radio_button, TransceiverFactory::seven_data_bits);
ui_->CAT_data_bits_button_group->setId (ui_->CAT_8_bit_radio_button, TransceiverFactory::eight_data_bits);
ui_->CAT_stop_bits_button_group->setId (ui_->CAT_default_stop_bit_radio_button, TransceiverFactory::default_stop_bits);
ui_->CAT_stop_bits_button_group->setId (ui_->CAT_one_stop_bit_radio_button, TransceiverFactory::one_stop_bit);
ui_->CAT_stop_bits_button_group->setId (ui_->CAT_two_stop_bit_radio_button, TransceiverFactory::two_stop_bits);
ui_->CAT_handshake_button_group->setId (ui_->CAT_handshake_default_radio_button, TransceiverFactory::handshake_default);
ui_->CAT_handshake_button_group->setId (ui_->CAT_handshake_none_radio_button, TransceiverFactory::handshake_none);
ui_->CAT_handshake_button_group->setId (ui_->CAT_handshake_xon_radio_button, TransceiverFactory::handshake_XonXoff);
ui_->CAT_handshake_button_group->setId (ui_->CAT_handshake_hardware_radio_button, TransceiverFactory::handshake_hardware);
@ -1367,9 +1370,9 @@ void Configuration::impl::read_settings ()
rig_params_.usb_port = settings_->value ("CATUSBPort").toString ();
rig_params_.serial_port = settings_->value ("CATSerialPort").toString ();
rig_params_.baud = settings_->value ("CATSerialRate", 4800).toInt ();
rig_params_.data_bits = settings_->value ("CATDataBits", QVariant::fromValue (TransceiverFactory::eight_data_bits)).value<TransceiverFactory::DataBits> ();
rig_params_.stop_bits = settings_->value ("CATStopBits", QVariant::fromValue (TransceiverFactory::two_stop_bits)).value<TransceiverFactory::StopBits> ();
rig_params_.handshake = settings_->value ("CATHandshake", QVariant::fromValue (TransceiverFactory::handshake_none)).value<TransceiverFactory::Handshake> ();
rig_params_.data_bits = settings_->value ("CATDataBits", QVariant::fromValue (TransceiverFactory::default_data_bits)).value<TransceiverFactory::DataBits> ();
rig_params_.stop_bits = settings_->value ("CATStopBits", QVariant::fromValue (TransceiverFactory::default_stop_bits)).value<TransceiverFactory::StopBits> ();
rig_params_.handshake = settings_->value ("CATHandshake", QVariant::fromValue (TransceiverFactory::handshake_default)).value<TransceiverFactory::Handshake> ();
rig_params_.force_dtr = settings_->value ("CATForceDTR", false).toBool ();
rig_params_.dtr_high = settings_->value ("DTR", false).toBool ();
rig_params_.force_rts = settings_->value ("CATForceRTS", false).toBool ();

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>534</width>
<height>530</height>
<width>530</width>
<height>550</height>
</rect>
</property>
<property name="windowTitle">
@ -644,11 +644,27 @@ text message.</string>
<string>Data Bits</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QRadioButton" name="CAT_default_bit_radio_button">
<property name="text">
<string>D&amp;efault</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
<attribute name="buttonGroup">
<string notr="true">CAT_data_bits_button_group</string>
</attribute>
</widget>
</item>
<item>
<widget class="QRadioButton" name="CAT_7_bit_radio_button">
<property name="text">
<string>Se&amp;ven</string>
</property>
<property name="autoExclusive">
<bool>true</bool>
</property>
<attribute name="buttonGroup">
<string notr="true">CAT_data_bits_button_group</string>
</attribute>
@ -660,7 +676,7 @@ text message.</string>
<string>E&amp;ight</string>
</property>
<property name="checked">
<bool>true</bool>
<bool>false</bool>
</property>
<attribute name="buttonGroup">
<string notr="true">CAT_data_bits_button_group</string>
@ -679,6 +695,19 @@ text message.</string>
<string>Stop Bits</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QRadioButton" name="CAT_default_stop_bit_radio_button">
<property name="text">
<string>Default</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
<attribute name="buttonGroup">
<string notr="true">CAT_stop_bits_button_group</string>
</attribute>
</widget>
</item>
<item>
<widget class="QRadioButton" name="CAT_one_stop_bit_radio_button">
<property name="text">
@ -695,7 +724,7 @@ text message.</string>
<string>T&amp;wo</string>
</property>
<property name="checked">
<bool>true</bool>
<bool>false</bool>
</property>
<attribute name="buttonGroup">
<string notr="true">CAT_stop_bits_button_group</string>
@ -715,9 +744,9 @@ text message.</string>
</property>
<layout class="QGridLayout" name="gridLayout_11">
<item row="0" column="0">
<widget class="QRadioButton" name="CAT_handshake_none_radio_button">
<widget class="QRadioButton" name="CAT_handshake_default_radio_button">
<property name="text">
<string>&amp;None</string>
<string>Default</string>
</property>
<property name="checked">
<bool>true</bool>
@ -728,6 +757,19 @@ text message.</string>
</widget>
</item>
<item row="0" column="1">
<widget class="QRadioButton" name="CAT_handshake_none_radio_button">
<property name="text">
<string>&amp;None</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
<attribute name="buttonGroup">
<string notr="true">CAT_handshake_button_group</string>
</attribute>
</widget>
</item>
<item row="1" column="0">
<widget class="QRadioButton" name="CAT_handshake_xon_radio_button">
<property name="toolTip">
<string>Software flow control (very rare on CAT interfaces).</string>
@ -740,7 +782,7 @@ text message.</string>
</attribute>
</widget>
</item>
<item row="0" column="2">
<item row="1" column="1">
<widget class="QRadioButton" name="CAT_handshake_hardware_radio_button">
<property name="toolTip">
<string>Flow control using the RTS and CTS RS-232 control lines
@ -772,16 +814,6 @@ a few, particularly some Kenwood rigs, require it).</string>
<layout class="QHBoxLayout" name="horizontalLayout_8">
<item>
<layout class="QFormLayout" name="formLayout_8">
<item row="0" column="0">
<widget class="QLabel" name="force_DTR_label">
<property name="text">
<string>DTR:</string>
</property>
<property name="buddy">
<cstring>force_DTR_combo_box</cstring>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="force_DTR_combo_box">
<item>
@ -801,6 +833,16 @@ a few, particularly some Kenwood rigs, require it).</string>
</item>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="force_DTR_label">
<property name="text">
<string>DTR:</string>
</property>
<property name="buddy">
<cstring>force_DTR_combo_box</cstring>
</property>
</widget>
</item>
</layout>
</item>
<item>
@ -2780,12 +2822,12 @@ soundcard changes</string>
</connection>
</connections>
<buttongroups>
<buttongroup name="CAT_data_bits_button_group"/>
<buttongroup name="split_mode_button_group"/>
<buttongroup name="TX_mode_button_group"/>
<buttongroup name="CAT_stop_bits_button_group"/>
<buttongroup name="PTT_method_button_group"/>
<buttongroup name="TX_audio_source_button_group"/>
<buttongroup name="CAT_handshake_button_group"/>
<buttongroup name="split_mode_button_group"/>
<buttongroup name="CAT_data_bits_button_group"/>
<buttongroup name="TX_mode_button_group"/>
<buttongroup name="CAT_stop_bits_button_group"/>
</buttongroups>
</ui>

View File

@ -316,14 +316,21 @@ HamlibTransceiver::HamlibTransceiver (int model_number, TransceiverFactory::Para
set_conf ("rig_pathname", params.serial_port.toLatin1 ().data ());
}
set_conf ("serial_speed", QByteArray::number (params.baud).data ());
set_conf ("data_bits", TransceiverFactory::seven_data_bits == params.data_bits ? "7" : "8");
set_conf ("stop_bits", TransceiverFactory::one_stop_bit == params.stop_bits ? "1" : "2");
if (params.data_bits != TransceiverFactory::default_data_bits)
{
set_conf ("data_bits", TransceiverFactory::seven_data_bits == params.data_bits ? "7" : "8");
}
if (params.stop_bits != TransceiverFactory::default_stop_bits)
{
set_conf ("stop_bits", TransceiverFactory::one_stop_bit == params.stop_bits ? "1" : "2");
}
switch (params.handshake)
{
case TransceiverFactory::handshake_none: set_conf ("serial_handshake", "None"); break;
case TransceiverFactory::handshake_XonXoff: set_conf ("serial_handshake", "XONXOFF"); break;
case TransceiverFactory::handshake_hardware: set_conf ("serial_handshake", "Hardware"); break;
default: break;
}
if (params.force_dtr)

View File

@ -64,11 +64,11 @@ public:
//
// various Transceiver parameters
//
enum DataBits {seven_data_bits = 7, eight_data_bits};
enum DataBits {seven_data_bits = 7, eight_data_bits, default_data_bits};
Q_ENUM (DataBits)
enum StopBits {one_stop_bit = 1, two_stop_bits};
enum StopBits {one_stop_bit = 1, two_stop_bits, default_stop_bits};
Q_ENUM (StopBits)
enum Handshake {handshake_none, handshake_XonXoff, handshake_hardware};
enum Handshake {handshake_default, handshake_none, handshake_XonXoff, handshake_hardware};
Q_ENUM (Handshake)
enum PTTMethod {PTT_method_VOX, PTT_method_CAT, PTT_method_DTR, PTT_method_RTS};
Q_ENUM (PTTMethod)