mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2024-12-24 11:40:31 -05:00
1. Removed all vestiges of rigctl use. Now using calls to hamlib
functions. 2. Restored "Test CAT Control" and "Test PTT" buttons on the Setup | Configuration screen. These features need thorough testing! git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@3204 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
parent
d845a108db
commit
d53a40aeae
58
devsetup.cpp
58
devsetup.cpp
@ -1,5 +1,4 @@
|
||||
#include "devsetup.h"
|
||||
#include "mainwindow.h"
|
||||
#include <QDebug>
|
||||
#include <portaudio.h>
|
||||
|
||||
@ -14,13 +13,14 @@ DevSetup::DevSetup(QWidget *parent) : QDialog(parent)
|
||||
m_restartSoundIn=false;
|
||||
m_restartSoundOut=false;
|
||||
m_firstCall=true;
|
||||
m_iptt=0;
|
||||
m_bRigOpen=false;
|
||||
}
|
||||
|
||||
DevSetup::~DevSetup()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void DevSetup::initDlg()
|
||||
{
|
||||
int k,id;
|
||||
@ -47,7 +47,6 @@ void DevSetup::initDlg()
|
||||
}
|
||||
|
||||
k=0;
|
||||
// Needs work to compile for Linux
|
||||
for(id=0; id<numDevices; id++ ) {
|
||||
pdi=Pa_GetDeviceInfo(id);
|
||||
nchin=pdi->maxInputChannels;
|
||||
@ -257,6 +256,12 @@ void DevSetup::accept()
|
||||
m_dFreq.append(ui.f15->text());
|
||||
m_dFreq.append(ui.f16->text());
|
||||
|
||||
if(m_bRigOpen) {
|
||||
rig->close();
|
||||
delete rig;
|
||||
m_bRigOpen=false;
|
||||
}
|
||||
|
||||
QDialog::accept();
|
||||
}
|
||||
|
||||
@ -369,3 +374,50 @@ void DevSetup::on_cbID73_toggled(bool checked)
|
||||
{
|
||||
m_After73=checked;
|
||||
}
|
||||
|
||||
void DevSetup::on_testCATButton_clicked()
|
||||
{
|
||||
|
||||
if(!m_catEnabled) return;
|
||||
if(m_bRigOpen) {
|
||||
rig->close();
|
||||
delete rig;
|
||||
m_bRigOpen=false;
|
||||
}
|
||||
rig = new Rig(m_rig);
|
||||
try {
|
||||
rig->setConf("rig_pathname", m_catPort.toAscii().data());
|
||||
char buf[80];
|
||||
sprintf(buf,"%d",m_serialRate);
|
||||
rig->setConf("serial_speed",buf);
|
||||
sprintf(buf,"%d",m_dataBits);
|
||||
rig->setConf("data_bits",buf);
|
||||
sprintf(buf,"%d",m_stopBits);
|
||||
rig->setConf("stop_bits",buf);
|
||||
rig->setConf("serial_handshake",m_handshake.toAscii().data());
|
||||
rig->open();
|
||||
m_bRigOpen=true;
|
||||
}
|
||||
catch (const RigException &Ex) {
|
||||
m_bRigOpen=false;
|
||||
msgBox("Failed to open rig (A)");
|
||||
return;
|
||||
}
|
||||
double fMHz=rig->getFreq(RIG_VFO_CURR)/1000000.0;
|
||||
QString t;
|
||||
t.sprintf("Rig control working.\nDial Frequency: %.6f",fMHz);
|
||||
msgBox(t);
|
||||
}
|
||||
|
||||
void DevSetup::on_testPTTButton_clicked()
|
||||
{
|
||||
int iret=0;
|
||||
m_iptt=1-m_iptt;
|
||||
if(m_pttMethodIndex==1 or m_pttMethodIndex==2) {
|
||||
int iptt=m_iptt;
|
||||
ptt(m_pttPort,iptt,&m_iptt,&m_COMportOpen);
|
||||
}
|
||||
if(m_pttMethodIndex==0 and m_bRigOpen) {
|
||||
rig->setPTT((ptt_t)m_iptt, RIG_VFO_CURR);
|
||||
}
|
||||
}
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include <QProcess>
|
||||
#include <QMessageBox>
|
||||
#include "ui_devsetup.h"
|
||||
#include "mainwindow.h"
|
||||
|
||||
class DevSetup : public QDialog
|
||||
{
|
||||
@ -34,6 +35,8 @@ public:
|
||||
qint32 m_stopBits;
|
||||
qint32 m_stopBitsIndex;
|
||||
qint32 m_handshakeIndex;
|
||||
qint32 m_iptt;
|
||||
qint32 m_COMportOpen;
|
||||
|
||||
bool m_restartSoundIn;
|
||||
bool m_restartSoundOut;
|
||||
@ -41,6 +44,7 @@ public:
|
||||
bool m_firstCall;
|
||||
bool m_catEnabled;
|
||||
bool m_After73;
|
||||
bool m_bRigOpen;
|
||||
|
||||
QString m_myCall;
|
||||
QString m_myGrid;
|
||||
@ -52,6 +56,8 @@ public:
|
||||
QStringList m_macro;
|
||||
QStringList m_dFreq;
|
||||
|
||||
Rig* rig;
|
||||
|
||||
QProcess p4;
|
||||
QMessageBox msgBox0;
|
||||
|
||||
@ -74,6 +80,9 @@ private slots:
|
||||
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();
|
||||
|
||||
private:
|
||||
void msgBox(QString t);
|
||||
|
75
devsetup.ui
75
devsetup.ui
@ -35,8 +35,6 @@
|
||||
<attribute name="title">
|
||||
<string>Station</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||
@ -485,7 +483,7 @@
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>15</height>
|
||||
<height>13</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
@ -931,6 +929,73 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_11">
|
||||
<item>
|
||||
<widget class="QPushButton" name="testCATButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Test CAT Control</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="testPTTButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>90</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>90</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Test PTT</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_12">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_1">
|
||||
<property name="orientation">
|
||||
@ -939,7 +1004,7 @@
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>15</height>
|
||||
<height>13</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
@ -1074,8 +1139,6 @@
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_2">
|
||||
<attribute name="title">
|
||||
|
@ -616,6 +616,13 @@ void MainWindow::on_actionDeviceSetup_triggered() //Setup Dialog
|
||||
dlg.m_handshake=m_handshake;
|
||||
dlg.m_handshakeIndex=m_handshakeIndex;
|
||||
|
||||
if(m_bRigOpen) {
|
||||
rig->close();
|
||||
delete rig;
|
||||
m_bRigOpen=false;
|
||||
m_catEnabled=false;
|
||||
}
|
||||
|
||||
dlg.initDlg();
|
||||
if(dlg.exec() == QDialog::Accepted) {
|
||||
m_myCall=dlg.m_myCall;
|
||||
@ -682,6 +689,10 @@ void MainWindow::on_actionDeviceSetup_triggered() //Setup Dialog
|
||||
soundOutThread.setOutputDevice(m_paOutDevice);
|
||||
}
|
||||
}
|
||||
m_catEnabled=dlg.m_catEnabled;
|
||||
if(m_catEnabled) {
|
||||
rigOpen();
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::on_monitorButton_clicked() //Monitor
|
||||
@ -1428,11 +1439,9 @@ void MainWindow::guiUpdate()
|
||||
icw[0]=m_ncw;
|
||||
|
||||
//Raise PTT
|
||||
if(m_pttMethodIndex==0) { //CAT control for PTT=1
|
||||
m_cmnd=rig_command() + " T 1";
|
||||
p3.start(m_cmnd);
|
||||
p3.waitForFinished();
|
||||
if(m_catEnabled and m_bRigOpen and m_pttMethodIndex==0) {
|
||||
m_iptt=1;
|
||||
rig->setPTT((ptt_t)m_iptt, RIG_VFO_CURR); //CAT control for PTT=1
|
||||
}
|
||||
if(m_pttMethodIndex==1 or m_pttMethodIndex==2) { //DTR or RTS
|
||||
ptt(m_pttPort,1,&m_iptt,&m_COMportOpen);
|
||||
@ -1556,13 +1565,12 @@ void MainWindow::guiUpdate()
|
||||
if(nc0 <= 0) {
|
||||
nc0++;
|
||||
}
|
||||
if(nc0 == 0) {
|
||||
|
||||
if(nc0 == 0) {
|
||||
//Lower PTT
|
||||
if(m_pttMethodIndex==0) { //CAT for PTT=0
|
||||
m_cmnd=rig_command() + " T 0";
|
||||
p3.start(m_cmnd);
|
||||
p3.waitForFinished();
|
||||
if(m_catEnabled and m_bRigOpen and m_pttMethodIndex==0) {
|
||||
m_iptt=0;
|
||||
rig->setPTT((ptt_t)m_iptt, RIG_VFO_CURR); //CAT control for PTT=1
|
||||
}
|
||||
if(m_pttMethodIndex==1 or m_pttMethodIndex==2) { //DTR-RTS
|
||||
ptt(m_pttPort,0,&m_iptt,&m_COMportOpen);
|
||||
@ -1656,20 +1664,6 @@ void MainWindow::displayTxMsg(QString t)
|
||||
ui->decodedTextBrowser->setTextCursor(cursor);
|
||||
}
|
||||
|
||||
QString MainWindow::rig_command()
|
||||
{
|
||||
QString cmnd1,cmnd2;
|
||||
cmnd1.sprintf("rigctl -m %d -r ",m_rig);
|
||||
cmnd1+=m_catPort;
|
||||
// For K2:
|
||||
// cmnd2.sprintf(" -s %d -C rts_state=OFF -C dtr_state=OFF -C data_bits=%d -C stop_bits=%d -C serial_handshake=",
|
||||
// m_serialRate,m_dataBits,m_stopBits);
|
||||
cmnd2.sprintf(" -s %d -C data_bits=%d -C stop_bits=%d -C serial_handshake=",
|
||||
m_serialRate,m_dataBits,m_stopBits);
|
||||
cmnd2+=m_handshake;
|
||||
return cmnd1+cmnd2;
|
||||
}
|
||||
|
||||
void MainWindow::startTx2()
|
||||
{
|
||||
if(!soundOutThread.isRunning()) {
|
||||
@ -1704,10 +1698,8 @@ void MainWindow::stopTx()
|
||||
void MainWindow::stopTx2()
|
||||
{
|
||||
//Lower PTT
|
||||
if(m_pttMethodIndex==0) {
|
||||
m_cmnd=rig_command() + " T 0"; //CAT for PTT=0
|
||||
p3.start(m_cmnd);
|
||||
p3.waitForFinished();
|
||||
if(m_catEnabled and m_bRigOpen and m_pttMethodIndex==0) {
|
||||
rig->setPTT((ptt_t)m_iptt, RIG_VFO_CURR); //CAT control for PTT=0
|
||||
}
|
||||
if(m_pttMethodIndex==1 or m_pttMethodIndex==2) {
|
||||
ptt(m_pttPort,0,&m_iptt,&m_COMportOpen);
|
||||
@ -2621,6 +2613,7 @@ void MainWindow::rigOpen()
|
||||
catch (const RigException &Ex) {
|
||||
m_catEnabled=false;
|
||||
m_bRigOpen=false;
|
||||
msgBox("Failed to open rig");
|
||||
msgBox("Failed to open rig (B)");
|
||||
delete rig;
|
||||
}
|
||||
}
|
||||
|
@ -336,7 +336,6 @@ private:
|
||||
void displayTxMsg(QString t);
|
||||
void rigOpen();
|
||||
bool gridOK(QString g);
|
||||
QString rig_command();
|
||||
QString baseCall(QString t);
|
||||
};
|
||||
|
||||
@ -346,9 +345,7 @@ extern int killbyname(const char* progName);
|
||||
extern void getDev(int* numDevices,char hostAPI_DeviceName[][50],
|
||||
int minChan[], int maxChan[],
|
||||
int minSpeed[], int maxSpeed[]);
|
||||
extern int ptt(int nport, int itx, int* iptt);
|
||||
//extern int ReporterInitialize(char* hostname, char* port);
|
||||
|
||||
extern int ptt(int nport, int ntx, int* iptt, int* nopen);
|
||||
|
||||
extern "C" {
|
||||
//----------------------------------------------------- C and Fortran routines
|
||||
|
@ -24,7 +24,7 @@
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>900</width>
|
||||
<width>936</width>
|
||||
<height>1028</height>
|
||||
</size>
|
||||
</property>
|
||||
@ -1389,7 +1389,7 @@ p, li { white-space: pre-wrap; }
|
||||
<string/>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">buttonGroup</string>
|
||||
<string>buttonGroup</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
@ -1420,7 +1420,7 @@ p, li { white-space: pre-wrap; }
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">buttonGroup</string>
|
||||
<string>buttonGroup</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
@ -1448,7 +1448,7 @@ p, li { white-space: pre-wrap; }
|
||||
<string/>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">buttonGroup</string>
|
||||
<string>buttonGroup</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
@ -1598,7 +1598,7 @@ p, li { white-space: pre-wrap; }
|
||||
<string/>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">buttonGroup</string>
|
||||
<string>buttonGroup</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
@ -1731,7 +1731,7 @@ p, li { white-space: pre-wrap; }
|
||||
<string/>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">buttonGroup</string>
|
||||
<string>buttonGroup</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
@ -1759,7 +1759,7 @@ p, li { white-space: pre-wrap; }
|
||||
<string/>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">buttonGroup</string>
|
||||
<string>buttonGroup</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
@ -1995,7 +1995,7 @@ p, li { white-space: pre-wrap; }
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" rowspan="5">
|
||||
<widget class="QwtThermo" name="xThermo">
|
||||
<widget class="QwtThermo" name="xThermo" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
@ -2008,19 +2008,19 @@ p, li { white-space: pre-wrap; }
|
||||
<height>180</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="borderWidth">
|
||||
<property name="borderWidth" stdset="0">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="maxValue">
|
||||
<property name="maxValue" stdset="0">
|
||||
<double>60.000000000000000</double>
|
||||
</property>
|
||||
<property name="minValue">
|
||||
<property name="minValue" stdset="0">
|
||||
<double>0.000000000000000</double>
|
||||
</property>
|
||||
<property name="pipeWidth">
|
||||
<property name="pipeWidth" stdset="0">
|
||||
<number>8</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<property name="value" stdset="0">
|
||||
<double>0.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
@ -2037,7 +2037,7 @@ p, li { white-space: pre-wrap; }
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>711</width>
|
||||
<height>25</height>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuFile">
|
||||
@ -2144,7 +2144,7 @@ p, li { white-space: pre-wrap; }
|
||||
</action>
|
||||
<action name="actionDeviceSetup">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Configuration</string>
|
||||
|
Loading…
Reference in New Issue
Block a user