Add a setup checkbox "RTS/DTR Off", to enable proper CAT control of

Elecraft K2 (and possibly other rigs?).


git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@3209 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Joe Taylor 2013-04-24 19:41:58 +00:00
parent 4a7d5d38c7
commit 338f72bcc4
5 changed files with 50 additions and 6 deletions

View File

@ -139,6 +139,7 @@ void DevSetup::initDlg()
m_paInDevice=m_inDevList[m_nDevIn];
m_paOutDevice=m_outDevList[m_nDevOut];
ui.cbEnableCAT->setChecked(m_catEnabled);
ui.cbDTRoff->setChecked(m_bDTRoff);
ui.catPortComboBox->setEnabled(m_catEnabled);
ui.rigComboBox->setEnabled(m_catEnabled);
ui.serialRateComboBox->setEnabled(m_catEnabled);
@ -397,12 +398,16 @@ void DevSetup::on_testCATButton_clicked()
sprintf(buf,"%d",m_stopBits);
rig->setConf("stop_bits",buf);
rig->setConf("serial_handshake",m_handshake.toAscii().data());
if(m_bDTRoff) {
rig->setConf("rts_state","OFF");
rig->setConf("dtr_state","OFF");
}
rig->open();
m_bRigOpen=true;
}
catch (const RigException &Ex) {
m_bRigOpen=false;
msgBox("Failed to open rig (A)");
msgBox("Failed to open rig (devsetup)");
return;
}
double fMHz=rig->getFreq(RIG_VFO_CURR)/1000000.0;
@ -413,7 +418,6 @@ void DevSetup::on_testCATButton_clicked()
void DevSetup::on_testPTTButton_clicked()
{
int iret=0;
m_test=1-m_test;
if(m_pttMethodIndex==1 or m_pttMethodIndex==2) {
ptt(m_pttPort,m_test,&m_iptt,&m_COMportOpen);
@ -422,3 +426,8 @@ void DevSetup::on_testPTTButton_clicked()
rig->setPTT((ptt_t)m_iptt, RIG_VFO_CURR);
}
}
void DevSetup::on_cbDTRoff_toggled(bool checked)
{
m_bDTRoff=checked;
}

View File

@ -5,7 +5,7 @@
#include <QProcess>
#include <QMessageBox>
#include "ui_devsetup.h"
#include "mainwindow.h"
#include <hamlib/rigclass.h>
class DevSetup : public QDialog
{
@ -46,6 +46,7 @@ public:
bool m_catEnabled;
bool m_After73;
bool m_bRigOpen;
bool m_bDTRoff;
QString m_myCall;
QString m_myGrid;
@ -57,8 +58,6 @@ public:
QStringList m_macro;
QStringList m_dFreq;
Rig* rig;
QProcess p4;
QMessageBox msgBox0;
@ -85,9 +84,14 @@ private slots:
void on_testPTTButton_clicked();
void on_cbDTRoff_toggled(bool checked);
private:
Rig* rig;
void msgBox(QString t);
Ui::DialogSndCard ui;
};
extern int ptt(int nport, int ntx, int* iptt, int* nopen);
#endif // DEVSETUP_H

View File

@ -772,6 +772,26 @@
</item>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_13">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QCheckBox" name="cbDTRoff">
<property name="text">
<string>RTS/DTR OFF</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_5">
<property name="orientation">

View File

@ -17,6 +17,7 @@ static int nc1=1;
wchar_t buffer[256];
bool btxok; //True if OK to transmit
bool btxMute;
bool bDTRoff;
double outputLatency; //Latency in seconds
double dFreq[]={0.136,0.4742,1.838,3.578,5.357,7.078,10.130,14.078,
18.104,21.078,24.918,28.078,50.293,70.091,144.489,432.178};
@ -400,6 +401,7 @@ void MainWindow::writeSettings()
settings.setValue("Runaway",m_runaway);
settings.setValue("Tx2QSO",m_tx2QSO);
settings.setValue("MultipleOK",m_bMultipleOK);
settings.setValue("DTRoff",bDTRoff);
settings.endGroup();
}
@ -512,6 +514,7 @@ void MainWindow::readSettings()
ui->actionTx2QSO->setChecked(m_tx2QSO);
m_bMultipleOK=settings.value("MultipleOK",false).toBool();
ui->actionAllow_multiple_instances->setChecked(m_bMultipleOK);
bDTRoff=settings.value("DTRoff",false).toBool();
if(!ui->actionLinrad->isChecked() && !ui->actionCuteSDR->isChecked() &&
!ui->actionAFMHot->isChecked() && !ui->actionBlue->isChecked()) {
@ -619,6 +622,7 @@ 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=bDTRoff;
if(m_bRigOpen) {
rig->close();
@ -654,6 +658,7 @@ void MainWindow::on_actionDeviceSetup_triggered() //Setup Dialog
m_stopBitsIndex=dlg.m_stopBitsIndex;
m_handshake=dlg.m_handshake;
m_handshakeIndex=dlg.m_handshakeIndex;
bDTRoff=dlg.m_bDTRoff;
#ifdef WIN32
if(dlg.m_pskReporter!=m_pskReporter) {
@ -2621,13 +2626,17 @@ void MainWindow::rigOpen()
sprintf(buf,"%d",m_stopBits);
rig->setConf("stop_bits",buf);
rig->setConf("serial_handshake",m_handshake.toAscii().data());
if(bDTRoff) {
rig->setConf("rts_state","OFF");
rig->setConf("dtr_state","OFF");
}
rig->open();
m_bRigOpen=true;
}
catch (const RigException &Ex) {
m_catEnabled=false;
m_bRigOpen=false;
msgBox("Failed to open rig (B)");
msgBox("Failed to open rig (mainwindow)");
delete rig;
}
}

View File

@ -255,6 +255,8 @@ private:
bool m_tune;
bool m_bRigOpen;
bool m_bMultipleOK;
// bool junk999;
char m_decoded[80];
float m_pctZap;