mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2024-11-27 14:48:46 -05:00
1. Full control of DTR and RTS on serial port used for CAT control -- patch
submitted by G4WJS. 2. Improved(???) means of multiple tries when polling radio for frequency. 3. Minor tweaks to widget sizes on devsetup screen. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@3500 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
parent
cc1c17cd64
commit
cbed84e0c7
26
devsetup.cpp
26
devsetup.cpp
@ -489,6 +489,11 @@ void DevSetup::on_handshakeComboBox_activated(int index)
|
||||
m_handshake=ui.handshakeComboBox->itemText(index);
|
||||
}
|
||||
|
||||
void DevSetup::on_handshakeComboBox_currentIndexChanged(int index)
|
||||
{
|
||||
ui.RTSCheckBox->setEnabled(index != 2);
|
||||
}
|
||||
|
||||
void DevSetup::on_dataBitsComboBox_activated(int index)
|
||||
{
|
||||
m_dataBitsIndex=index;
|
||||
@ -567,9 +572,9 @@ void DevSetup::openRig()
|
||||
sprintf(buf,"%d",m_stopBits);
|
||||
rig->setConf("stop_bits",buf);
|
||||
rig->setConf("serial_handshake",m_handshake.toLatin1().data());
|
||||
if(m_bDTRoff) {
|
||||
rig->setConf("rts_state","OFF");
|
||||
rig->setConf("dtr_state","OFF");
|
||||
rig->setConf("dtr_state",m_bDTR ? "ON" : "OFF");
|
||||
if(ui.RTSCheckBox->isEnabled()) {
|
||||
rig->setConf("rts_state",m_bRTS ? "ON" : "OFF");
|
||||
}
|
||||
}
|
||||
|
||||
@ -604,9 +609,14 @@ void DevSetup::on_testPTTButton_clicked()
|
||||
}
|
||||
}
|
||||
|
||||
void DevSetup::on_cbDTRoff_toggled(bool checked)
|
||||
void DevSetup::on_DTRCheckBox_toggled(bool checked)
|
||||
{
|
||||
m_bDTRoff=checked;
|
||||
m_bDTR=checked;
|
||||
}
|
||||
|
||||
void DevSetup::on_RTSCheckBox_toggled(bool checked)
|
||||
{
|
||||
m_bRTS=checked;
|
||||
}
|
||||
|
||||
void DevSetup::on_rbData_toggled(bool checked)
|
||||
@ -635,7 +645,6 @@ void DevSetup::on_pttMethodComboBox_currentIndexChanged(int index)
|
||||
void DevSetup::enableWidgets()
|
||||
{
|
||||
ui.cbEnableCAT->setChecked(m_catEnabled);
|
||||
ui.cbDTRoff->setChecked(m_bDTRoff);
|
||||
ui.rigComboBox->setEnabled(m_catEnabled);
|
||||
ui.testCATButton->setEnabled(m_catEnabled);
|
||||
ui.label_4->setEnabled(m_catEnabled);
|
||||
@ -653,7 +662,10 @@ void DevSetup::enableWidgets()
|
||||
ui.dataBitsComboBox->setEnabled(bSerial);
|
||||
ui.stopBitsComboBox->setEnabled(bSerial);
|
||||
ui.handshakeComboBox->setEnabled(bSerial);
|
||||
ui.cbDTRoff->setEnabled(bSerial);
|
||||
ui.DTRCheckBox->setEnabled(bSerial);
|
||||
ui.DTRCheckBox->setChecked(m_bDTR);
|
||||
ui.RTSCheckBox->setEnabled(bSerial && m_handshakeIndex != 2);
|
||||
ui.RTSCheckBox->setChecked(m_bRTS);
|
||||
ui.rbData->setEnabled(bSerial);
|
||||
ui.rbMic->setEnabled(bSerial);
|
||||
ui.label_21->setEnabled(bSerial);
|
||||
|
@ -46,7 +46,8 @@ public:
|
||||
bool m_catEnabled;
|
||||
bool m_After73;
|
||||
bool m_bRigOpen;
|
||||
bool m_bDTRoff;
|
||||
bool m_bDTR;
|
||||
bool m_bRTS;
|
||||
bool m_pttData;
|
||||
bool m_bSplit;
|
||||
bool m_bXIT;
|
||||
@ -82,13 +83,15 @@ private slots:
|
||||
void on_cbEnableCAT_toggled(bool checked);
|
||||
void on_serialRateComboBox_activated(int index);
|
||||
void on_handshakeComboBox_activated(int index);
|
||||
void on_handshakeComboBox_currentIndexChanged(int index);
|
||||
void on_dataBitsComboBox_activated(int index);
|
||||
void on_stopBitsComboBox_activated(int index);
|
||||
void on_rigComboBox_activated(int index);
|
||||
void on_cbID73_toggled(bool checked);
|
||||
void on_testCATButton_clicked();
|
||||
void on_testPTTButton_clicked();
|
||||
void on_cbDTRoff_toggled(bool checked);
|
||||
void on_DTRCheckBox_toggled(bool checked);
|
||||
void on_RTSCheckBox_toggled(bool checked);
|
||||
void on_rbData_toggled(bool checked);
|
||||
void on_pollSpinBox_valueChanged(int n);
|
||||
void on_pttComboBox_currentIndexChanged(int index);
|
||||
|
113
devsetup.ui
113
devsetup.ui
@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>588</width>
|
||||
<height>557</height>
|
||||
<width>570</width>
|
||||
<height>465</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
@ -594,9 +594,22 @@
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="cbDTRoff">
|
||||
<widget class="QCheckBox" name="DTRCheckBox">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>RTS/DTR OFF</string>
|
||||
<string>DTR</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="RTSCheckBox">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>RTS</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -931,7 +944,7 @@
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>XonXoff</string>
|
||||
<string>XONXOFF</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
@ -1839,8 +1852,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>527</width>
|
||||
<height>554</height>
|
||||
<width>308</width>
|
||||
<height>505</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_14">
|
||||
@ -1863,13 +1876,13 @@
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>90</width>
|
||||
<height>27</height>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>90</width>
|
||||
<height>16777215</height>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
@ -1885,7 +1898,7 @@
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>90</width>
|
||||
<height>27</height>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
@ -1898,7 +1911,7 @@
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>90</width>
|
||||
<height>27</height>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
@ -1917,7 +1930,7 @@
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>90</width>
|
||||
<height>16777215</height>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
@ -1939,13 +1952,13 @@
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>90</width>
|
||||
<height>27</height>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>90</width>
|
||||
<height>16777215</height>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
@ -1961,7 +1974,7 @@
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>90</width>
|
||||
<height>27</height>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
@ -1977,7 +1990,7 @@
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>90</width>
|
||||
<height>27</height>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
@ -2006,13 +2019,13 @@
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>90</width>
|
||||
<height>27</height>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>90</width>
|
||||
<height>16777215</height>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
@ -2034,13 +2047,13 @@
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>90</width>
|
||||
<height>27</height>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>90</width>
|
||||
<height>16777215</height>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
@ -2062,13 +2075,13 @@
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>90</width>
|
||||
<height>27</height>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>90</width>
|
||||
<height>16777215</height>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
@ -2081,10 +2094,16 @@
|
||||
</item>
|
||||
<item row="9" column="1">
|
||||
<widget class="QLineEdit" name="f9">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>90</width>
|
||||
<height>27</height>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
@ -2097,7 +2116,7 @@
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>90</width>
|
||||
<height>16777215</height>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
@ -2110,7 +2129,7 @@
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>90</width>
|
||||
<height>16777215</height>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
@ -2123,7 +2142,7 @@
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>90</width>
|
||||
<height>16777215</height>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
@ -2139,7 +2158,7 @@
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>90</width>
|
||||
<height>16777215</height>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
@ -2155,7 +2174,7 @@
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>90</width>
|
||||
<height>27</height>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
@ -2174,13 +2193,13 @@
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>90</width>
|
||||
<height>27</height>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>90</width>
|
||||
<height>16777215</height>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
@ -2205,13 +2224,13 @@
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>90</width>
|
||||
<height>27</height>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>90</width>
|
||||
<height>16777215</height>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
@ -2230,7 +2249,7 @@
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>90</width>
|
||||
<height>27</height>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
@ -2243,7 +2262,7 @@
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>90</width>
|
||||
<height>27</height>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
@ -2256,7 +2275,7 @@
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>90</width>
|
||||
<height>16777215</height>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
@ -2275,13 +2294,13 @@
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>90</width>
|
||||
<height>27</height>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>90</width>
|
||||
<height>16777215</height>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
@ -2300,7 +2319,7 @@
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>90</width>
|
||||
<height>16777215</height>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
@ -2343,7 +2362,7 @@
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>90</width>
|
||||
<height>27</height>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
@ -2356,7 +2375,7 @@
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>90</width>
|
||||
<height>16777215</height>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
@ -2369,7 +2388,7 @@
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>90</width>
|
||||
<height>16777215</height>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
@ -2382,7 +2401,7 @@
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>90</width>
|
||||
<height>16777215</height>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
@ -2395,7 +2414,7 @@
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>90</width>
|
||||
<height>16777215</height>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
@ -2408,7 +2427,7 @@
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>90</width>
|
||||
<height>16777215</height>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
@ -2421,7 +2440,7 @@
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>90</width>
|
||||
<height>16777215</height>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
@ -2434,7 +2453,7 @@
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>90</width>
|
||||
<height>16777215</height>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
@ -2447,7 +2466,7 @@
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>90</width>
|
||||
<height>16777215</height>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
|
@ -32,7 +32,7 @@ WideGraph* g_pWideGraph = NULL;
|
||||
LogQSO* logDlg = NULL;
|
||||
Rig* rig = NULL;
|
||||
QTextEdit* pShortcuts;
|
||||
QTcpSocket* socket = new QTcpSocket(0);
|
||||
QTcpSocket* commanderSocket = new QTcpSocket(0);
|
||||
|
||||
QString rev="$Rev$";
|
||||
QString Program_Title_Version=" WSJT-X v1.1, r" + rev.mid(6,4) +
|
||||
@ -466,8 +466,8 @@ void MainWindow::writeSettings()
|
||||
settings.setValue("Runaway",m_runaway);
|
||||
settings.setValue("Tx2QSO",m_tx2QSO);
|
||||
settings.setValue("MultipleOK",m_bMultipleOK);
|
||||
settings.setValue("DTRoff",m_bDTRoff);
|
||||
settings.setValue("pttData",m_pttData);
|
||||
settings.setValue("DTR",m_bDTR);
|
||||
settings.setValue("RTS",m_bRTS); settings.setValue("pttData",m_pttData);
|
||||
settings.setValue("LogQSOgeom",m_logQSOgeom);
|
||||
settings.setValue("Polling",m_poll);
|
||||
settings.setValue("OutBufSize",outBufSize);
|
||||
@ -615,8 +615,8 @@ void MainWindow::readSettings()
|
||||
ui->actionTx2QSO->setChecked(m_tx2QSO);
|
||||
m_bMultipleOK=settings.value("MultipleOK",false).toBool();
|
||||
ui->actionAllow_multiple_instances->setChecked(m_bMultipleOK);
|
||||
m_bDTRoff=settings.value("DTRoff",false).toBool();
|
||||
m_pttData=settings.value("pttData",false).toBool();
|
||||
m_bDTR=settings.value("DTR",false).toBool();
|
||||
m_bRTS=settings.value("RTS",false).toBool(); m_pttData=settings.value("pttData",false).toBool();
|
||||
m_poll=settings.value("Polling",0).toInt();
|
||||
m_logQSOgeom=settings.value("LogQSOgeom",QRect(500,400,424,283)).toRect();
|
||||
outBufSize=settings.value("OutBufSize",4096).toInt();
|
||||
@ -737,8 +737,8 @@ void MainWindow::on_actionDeviceSetup_triggered() //Setup Dialog
|
||||
dlg.m_stopBitsIndex=m_stopBitsIndex;
|
||||
dlg.m_handshake=m_handshake;
|
||||
dlg.m_handshakeIndex=m_handshakeIndex;
|
||||
dlg.m_bDTRoff=m_bDTRoff;
|
||||
dlg.m_pttData=m_pttData;
|
||||
dlg.m_bDTR=m_bDTR;
|
||||
dlg.m_bRTS=m_bRTS; dlg.m_pttData=m_pttData;
|
||||
dlg.m_poll=m_poll;
|
||||
dlg.m_bSplit=m_bSplit;
|
||||
dlg.m_bXIT=m_bXIT;
|
||||
@ -780,7 +780,8 @@ void MainWindow::on_actionDeviceSetup_triggered() //Setup Dialog
|
||||
m_stopBitsIndex=dlg.m_stopBitsIndex;
|
||||
m_handshake=dlg.m_handshake;
|
||||
m_handshakeIndex=dlg.m_handshakeIndex;
|
||||
m_bDTRoff=dlg.m_bDTRoff;
|
||||
m_bDTR=dlg.m_bDTR;
|
||||
m_bRTS=dlg.m_bRTS;
|
||||
m_pttData=dlg.m_pttData;
|
||||
m_poll=dlg.m_poll;
|
||||
|
||||
@ -1841,27 +1842,8 @@ void MainWindow::guiUpdate()
|
||||
signalMeter->setValue(0);
|
||||
}
|
||||
|
||||
if(m_catEnabled and m_poll>0 and (nsec%m_poll)==0 and !m_decoderBusy) {
|
||||
double fMHz;
|
||||
if(m_dontReadFreq) {
|
||||
m_dontReadFreq=false;
|
||||
} else if(!m_transmitting) {
|
||||
for(int iter=0; iter<3; iter++) {
|
||||
fMHz=rig->getFreq(RIG_VFO_CURR)/1000000.0;
|
||||
if(fMHz<0.0 and iter>=2) {
|
||||
rt.sprintf("Rig control error %d\nFailed to read frequency.",
|
||||
int(1000000.0*fMHz));
|
||||
msgBox(rt);
|
||||
m_catEnabled=false;
|
||||
ui->readFreq->setStyleSheet("QPushButton{background-color: red; \
|
||||
border-width: 0px; border-radius: 5px;}");
|
||||
}
|
||||
}
|
||||
int ndiff=1000000.0*(fMHz-m_dialFreq);
|
||||
if(ndiff!=0) dialFreqChanged2(fMHz);
|
||||
}
|
||||
}
|
||||
|
||||
if(m_catEnabled and m_poll>0 and (nsec%m_poll)==0 and
|
||||
!m_decoderBusy) pollRigFreq();
|
||||
m_sec0=nsec;
|
||||
}
|
||||
|
||||
@ -2952,15 +2934,16 @@ void MainWindow::rigOpen()
|
||||
sprintf(buf,"%d",m_stopBits);
|
||||
rig->setConf("stop_bits",buf);
|
||||
rig->setConf("serial_handshake",m_handshake.toLatin1().data());
|
||||
if(m_bDTRoff) {
|
||||
rig->setConf("rts_state","OFF");
|
||||
rig->setConf("dtr_state","OFF");
|
||||
if(m_handshakeIndex != 2) {
|
||||
rig->setConf("rts_state",m_bRTS ? "ON" : "OFF");
|
||||
rig->setConf("dtr_state",m_bDTR ? "ON" : "OFF");
|
||||
}
|
||||
}
|
||||
|
||||
ret=rig->open(m_rig);
|
||||
if(ret==RIG_OK) {
|
||||
m_bRigOpen=true;
|
||||
m_bad=0;
|
||||
if(m_poll==0) ui->readFreq->setEnabled(true);
|
||||
m_CATerror=false;
|
||||
} else {
|
||||
@ -3084,3 +3067,28 @@ void MainWindow::on_cbPlus2kHz_toggled(bool checked)
|
||||
m_plus2kHz=checked;
|
||||
on_bandComboBox_activated(m_band);
|
||||
}
|
||||
|
||||
void MainWindow::pollRigFreq()
|
||||
{
|
||||
double fMHz;
|
||||
if(m_dontReadFreq) {
|
||||
m_dontReadFreq=false;
|
||||
} else if(!m_transmitting) {
|
||||
fMHz=rig->getFreq(RIG_VFO_CURR)/1000000.0;
|
||||
if(fMHz<0.0) {
|
||||
m_bad++;
|
||||
if(m_bad>=20) {
|
||||
QString rt;
|
||||
rt.sprintf("Rig control error %d\nFailed to read frequency.",
|
||||
int(1000000.0*fMHz));
|
||||
msgBox(rt);
|
||||
m_catEnabled=false;
|
||||
ui->readFreq->setStyleSheet("QPushButton{background-color: red; \
|
||||
border-width: 0px; border-radius: 5px;}");
|
||||
}
|
||||
} else {
|
||||
int ndiff=1000000.0*(fMHz-m_dialFreq);
|
||||
if(ndiff!=0) dialFreqChanged2(fMHz);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -210,6 +210,7 @@ private:
|
||||
qint32 m_poll;
|
||||
qint32 m_fMin;
|
||||
qint32 m_fMax;
|
||||
qint32 m_bad;
|
||||
|
||||
bool m_monitoring;
|
||||
bool m_transmitting;
|
||||
@ -249,7 +250,8 @@ private:
|
||||
bool m_tune;
|
||||
bool m_bRigOpen;
|
||||
bool m_bMultipleOK;
|
||||
bool m_bDTRoff;
|
||||
bool m_bDTR;
|
||||
bool m_bRTS;
|
||||
bool m_pttData;
|
||||
bool m_dontReadFreq;
|
||||
bool m_lockTxFreq;
|
||||
@ -355,6 +357,7 @@ private:
|
||||
void freeText();
|
||||
void displayTxMsg(QString t);
|
||||
void rigOpen();
|
||||
void pollRigFreq();
|
||||
bool gridOK(QString g);
|
||||
QString baseCall(QString t);
|
||||
};
|
||||
|
46
rigclass.cpp
46
rigclass.cpp
@ -38,6 +38,8 @@
|
||||
#include <QDebug>
|
||||
#include <QHostAddress>
|
||||
|
||||
#define NUMTRIES 5
|
||||
|
||||
static int hamlibpp_freq_event(RIG *rig, vfo_t vfo, freq_t freq, rig_ptr_t arg);
|
||||
|
||||
static int hamlibpp_freq_event(RIG *rig, vfo_t vfo, freq_t freq, rig_ptr_t arg)
|
||||
@ -101,13 +103,13 @@ int Rig::open(int n) {
|
||||
}
|
||||
}
|
||||
if(n==9998) {
|
||||
if(socket->state()==QAbstractSocket::ConnectedState) {
|
||||
socket->abort();
|
||||
if(commanderSocket->state()==QAbstractSocket::ConnectedState) {
|
||||
commanderSocket->abort();
|
||||
}
|
||||
|
||||
if(socket->state()==QAbstractSocket::UnconnectedState) {
|
||||
socket->connectToHost(QHostAddress::LocalHost, 52002);
|
||||
if(!socket->waitForConnected(1000)) {
|
||||
if(commanderSocket->state()==QAbstractSocket::UnconnectedState) {
|
||||
commanderSocket->connectToHost(QHostAddress::LocalHost, 52002);
|
||||
if(!commanderSocket->waitForConnected(1000)) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -115,9 +117,9 @@ int Rig::open(int n) {
|
||||
t="<command:10>CmdGetFreq<parameters:0>";
|
||||
QByteArray ba = t.toLocal8Bit();
|
||||
const char* buf=ba.data();
|
||||
socket->write(buf);
|
||||
socket->waitForReadyRead(1000);
|
||||
QByteArray reply=socket->read(128);
|
||||
commanderSocket->write(buf);
|
||||
commanderSocket->waitForReadyRead(1000);
|
||||
QByteArray reply=commanderSocket->read(128);
|
||||
if(reply.indexOf("<CmdFreq:")==0) {
|
||||
m_cmndr=true;
|
||||
return 0;
|
||||
@ -133,7 +135,7 @@ int Rig::close(void) {
|
||||
HRDInterfaceDisconnect();
|
||||
return 0;
|
||||
} else if(m_cmndr) {
|
||||
socket->close();
|
||||
commanderSocket->close();
|
||||
return 0;
|
||||
} else
|
||||
#endif
|
||||
@ -168,8 +170,8 @@ int Rig::setFreq(freq_t freq, vfo_t vfo) {
|
||||
t.sprintf("<command:10>CmdSetFreq<parameters:23><xcvrfreq:10>%10.3f",f);
|
||||
QByteArray ba = t.toLocal8Bit();
|
||||
const char* buf=ba.data();
|
||||
socket->write(buf);
|
||||
socket->waitForBytesWritten(1000);
|
||||
commanderSocket->write(buf);
|
||||
commanderSocket->waitForBytesWritten(1000);
|
||||
return 0;
|
||||
} else
|
||||
#endif
|
||||
@ -216,8 +218,8 @@ int Rig::setSplitFreq(freq_t tx_freq, vfo_t vfo) {
|
||||
t.sprintf("<command:12>CmdSetTxFreq<parameters:23><xcvrfreq:10>%10.3f",f);
|
||||
QByteArray ba = t.toLocal8Bit();
|
||||
const char* buf=ba.data();
|
||||
socket->write(buf);
|
||||
socket->waitForBytesWritten(1000);
|
||||
commanderSocket->write(buf);
|
||||
commanderSocket->waitForBytesWritten(1000);
|
||||
return 0;
|
||||
} else
|
||||
#endif
|
||||
@ -242,9 +244,9 @@ freq_t Rig::getFreq(vfo_t vfo)
|
||||
t="<command:10>CmdGetFreq<parameters:0>";
|
||||
QByteArray ba = t.toLocal8Bit();
|
||||
const char* buf=ba.data();
|
||||
socket->write(buf);
|
||||
socket->waitForReadyRead(1000);
|
||||
QByteArray reply=socket->read(128);
|
||||
commanderSocket->write(buf);
|
||||
commanderSocket->waitForReadyRead(1000);
|
||||
QByteArray reply=commanderSocket->read(128);
|
||||
QString t2(reply);
|
||||
if(t2.indexOf("<CmdFreq:")==0) {
|
||||
int i1=t2.indexOf(">");
|
||||
@ -257,9 +259,11 @@ freq_t Rig::getFreq(vfo_t vfo)
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
int iret=rig_get_freq(theRig, vfo, &freq);
|
||||
// iret should be 0. Negative values mean rig_get_freq() failed.
|
||||
if(iret<0) freq=-1.0;
|
||||
freq=-1.0;
|
||||
for(int i=0; i<NUMTRIES; i++) {
|
||||
int iret=rig_get_freq(theRig, vfo, &freq);
|
||||
if(iret==RIG_OK) break;
|
||||
}
|
||||
return freq;
|
||||
}
|
||||
}
|
||||
@ -301,8 +305,8 @@ int Rig::setPTT(ptt_t ptt, vfo_t vfo)
|
||||
if(ptt>0) t="<command:5>CmdTX<parameters:0>";
|
||||
QByteArray ba = t.toLocal8Bit();
|
||||
const char* buf=ba.data();
|
||||
socket->write(buf);
|
||||
socket->waitForBytesWritten(1000);
|
||||
commanderSocket->write(buf);
|
||||
commanderSocket->waitForBytesWritten(1000);
|
||||
return 0;
|
||||
} else
|
||||
#endif
|
||||
|
@ -27,7 +27,7 @@
|
||||
#include <QString>
|
||||
#include <QTcpSocket>
|
||||
|
||||
extern QTcpSocket* socket;
|
||||
extern QTcpSocket* commanderSocket;
|
||||
|
||||
class BACKEND_IMPEXP Rig {
|
||||
private:
|
||||
|
Loading…
Reference in New Issue
Block a user