mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2024-11-23 20:58:55 -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
91d1958a60
commit
d95e900636
58
devsetup.cpp
58
devsetup.cpp
@ -1,5 +1,4 @@
|
|||||||
#include "devsetup.h"
|
#include "devsetup.h"
|
||||||
#include "mainwindow.h"
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <portaudio.h>
|
#include <portaudio.h>
|
||||||
|
|
||||||
@ -14,13 +13,14 @@ DevSetup::DevSetup(QWidget *parent) : QDialog(parent)
|
|||||||
m_restartSoundIn=false;
|
m_restartSoundIn=false;
|
||||||
m_restartSoundOut=false;
|
m_restartSoundOut=false;
|
||||||
m_firstCall=true;
|
m_firstCall=true;
|
||||||
|
m_iptt=0;
|
||||||
|
m_bRigOpen=false;
|
||||||
}
|
}
|
||||||
|
|
||||||
DevSetup::~DevSetup()
|
DevSetup::~DevSetup()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void DevSetup::initDlg()
|
void DevSetup::initDlg()
|
||||||
{
|
{
|
||||||
int k,id;
|
int k,id;
|
||||||
@ -47,7 +47,6 @@ void DevSetup::initDlg()
|
|||||||
}
|
}
|
||||||
|
|
||||||
k=0;
|
k=0;
|
||||||
// Needs work to compile for Linux
|
|
||||||
for(id=0; id<numDevices; id++ ) {
|
for(id=0; id<numDevices; id++ ) {
|
||||||
pdi=Pa_GetDeviceInfo(id);
|
pdi=Pa_GetDeviceInfo(id);
|
||||||
nchin=pdi->maxInputChannels;
|
nchin=pdi->maxInputChannels;
|
||||||
@ -257,6 +256,12 @@ void DevSetup::accept()
|
|||||||
m_dFreq.append(ui.f15->text());
|
m_dFreq.append(ui.f15->text());
|
||||||
m_dFreq.append(ui.f16->text());
|
m_dFreq.append(ui.f16->text());
|
||||||
|
|
||||||
|
if(m_bRigOpen) {
|
||||||
|
rig->close();
|
||||||
|
delete rig;
|
||||||
|
m_bRigOpen=false;
|
||||||
|
}
|
||||||
|
|
||||||
QDialog::accept();
|
QDialog::accept();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -369,3 +374,50 @@ void DevSetup::on_cbID73_toggled(bool checked)
|
|||||||
{
|
{
|
||||||
m_After73=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 <QProcess>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include "ui_devsetup.h"
|
#include "ui_devsetup.h"
|
||||||
|
#include "mainwindow.h"
|
||||||
|
|
||||||
class DevSetup : public QDialog
|
class DevSetup : public QDialog
|
||||||
{
|
{
|
||||||
@ -34,6 +35,8 @@ public:
|
|||||||
qint32 m_stopBits;
|
qint32 m_stopBits;
|
||||||
qint32 m_stopBitsIndex;
|
qint32 m_stopBitsIndex;
|
||||||
qint32 m_handshakeIndex;
|
qint32 m_handshakeIndex;
|
||||||
|
qint32 m_iptt;
|
||||||
|
qint32 m_COMportOpen;
|
||||||
|
|
||||||
bool m_restartSoundIn;
|
bool m_restartSoundIn;
|
||||||
bool m_restartSoundOut;
|
bool m_restartSoundOut;
|
||||||
@ -41,6 +44,7 @@ public:
|
|||||||
bool m_firstCall;
|
bool m_firstCall;
|
||||||
bool m_catEnabled;
|
bool m_catEnabled;
|
||||||
bool m_After73;
|
bool m_After73;
|
||||||
|
bool m_bRigOpen;
|
||||||
|
|
||||||
QString m_myCall;
|
QString m_myCall;
|
||||||
QString m_myGrid;
|
QString m_myGrid;
|
||||||
@ -52,6 +56,8 @@ public:
|
|||||||
QStringList m_macro;
|
QStringList m_macro;
|
||||||
QStringList m_dFreq;
|
QStringList m_dFreq;
|
||||||
|
|
||||||
|
Rig* rig;
|
||||||
|
|
||||||
QProcess p4;
|
QProcess p4;
|
||||||
QMessageBox msgBox0;
|
QMessageBox msgBox0;
|
||||||
|
|
||||||
@ -74,6 +80,9 @@ private slots:
|
|||||||
void on_stopBitsComboBox_activated(int index);
|
void on_stopBitsComboBox_activated(int index);
|
||||||
void on_rigComboBox_activated(int index);
|
void on_rigComboBox_activated(int index);
|
||||||
void on_cbID73_toggled(bool checked);
|
void on_cbID73_toggled(bool checked);
|
||||||
|
void on_testCATButton_clicked();
|
||||||
|
|
||||||
|
void on_testPTTButton_clicked();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void msgBox(QString t);
|
void msgBox(QString t);
|
||||||
|
2051
devsetup.ui
2051
devsetup.ui
File diff suppressed because it is too large
Load Diff
@ -616,6 +616,13 @@ void MainWindow::on_actionDeviceSetup_triggered() //Setup Dialog
|
|||||||
dlg.m_handshake=m_handshake;
|
dlg.m_handshake=m_handshake;
|
||||||
dlg.m_handshakeIndex=m_handshakeIndex;
|
dlg.m_handshakeIndex=m_handshakeIndex;
|
||||||
|
|
||||||
|
if(m_bRigOpen) {
|
||||||
|
rig->close();
|
||||||
|
delete rig;
|
||||||
|
m_bRigOpen=false;
|
||||||
|
m_catEnabled=false;
|
||||||
|
}
|
||||||
|
|
||||||
dlg.initDlg();
|
dlg.initDlg();
|
||||||
if(dlg.exec() == QDialog::Accepted) {
|
if(dlg.exec() == QDialog::Accepted) {
|
||||||
m_myCall=dlg.m_myCall;
|
m_myCall=dlg.m_myCall;
|
||||||
@ -682,6 +689,10 @@ void MainWindow::on_actionDeviceSetup_triggered() //Setup Dialog
|
|||||||
soundOutThread.setOutputDevice(m_paOutDevice);
|
soundOutThread.setOutputDevice(m_paOutDevice);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
m_catEnabled=dlg.m_catEnabled;
|
||||||
|
if(m_catEnabled) {
|
||||||
|
rigOpen();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_monitorButton_clicked() //Monitor
|
void MainWindow::on_monitorButton_clicked() //Monitor
|
||||||
@ -1428,16 +1439,14 @@ void MainWindow::guiUpdate()
|
|||||||
icw[0]=m_ncw;
|
icw[0]=m_ncw;
|
||||||
|
|
||||||
//Raise PTT
|
//Raise PTT
|
||||||
if(m_pttMethodIndex==0) { //CAT control for PTT=1
|
if(m_catEnabled and m_bRigOpen and m_pttMethodIndex==0) {
|
||||||
m_cmnd=rig_command() + " T 1";
|
|
||||||
p3.start(m_cmnd);
|
|
||||||
p3.waitForFinished();
|
|
||||||
m_iptt=1;
|
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
|
if(m_pttMethodIndex==1 or m_pttMethodIndex==2) { //DTR or RTS
|
||||||
ptt(m_pttPort,1,&m_iptt,&m_COMportOpen);
|
ptt(m_pttPort,1,&m_iptt,&m_COMportOpen);
|
||||||
}
|
}
|
||||||
if(m_pttMethodIndex==3) { //VOX
|
if(m_pttMethodIndex==3) { //VOX
|
||||||
m_iptt=1;
|
m_iptt=1;
|
||||||
}
|
}
|
||||||
ptt1Timer->start(200); //Sequencer delay
|
ptt1Timer->start(200); //Sequencer delay
|
||||||
@ -1556,20 +1565,19 @@ void MainWindow::guiUpdate()
|
|||||||
if(nc0 <= 0) {
|
if(nc0 <= 0) {
|
||||||
nc0++;
|
nc0++;
|
||||||
}
|
}
|
||||||
if(nc0 == 0) {
|
|
||||||
|
|
||||||
|
if(nc0 == 0) {
|
||||||
//Lower PTT
|
//Lower PTT
|
||||||
if(m_pttMethodIndex==0) { //CAT for PTT=0
|
if(m_catEnabled and m_bRigOpen and m_pttMethodIndex==0) {
|
||||||
m_cmnd=rig_command() + " T 0";
|
m_iptt=0;
|
||||||
p3.start(m_cmnd);
|
rig->setPTT((ptt_t)m_iptt, RIG_VFO_CURR); //CAT control for PTT=1
|
||||||
p3.waitForFinished();
|
}
|
||||||
}
|
if(m_pttMethodIndex==1 or m_pttMethodIndex==2) { //DTR-RTS
|
||||||
if(m_pttMethodIndex==1 or m_pttMethodIndex==2) { //DTR-RTS
|
ptt(m_pttPort,0,&m_iptt,&m_COMportOpen);
|
||||||
ptt(m_pttPort,0,&m_iptt,&m_COMportOpen);
|
}
|
||||||
}
|
if(m_pttMethodIndex==3) { //VOX
|
||||||
if(m_pttMethodIndex==3) { //VOX
|
m_iptt=0;
|
||||||
m_iptt=0;
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(m_iptt == 0 && !btxok) {
|
if(m_iptt == 0 && !btxok) {
|
||||||
@ -1656,20 +1664,6 @@ void MainWindow::displayTxMsg(QString t)
|
|||||||
ui->decodedTextBrowser->setTextCursor(cursor);
|
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()
|
void MainWindow::startTx2()
|
||||||
{
|
{
|
||||||
if(!soundOutThread.isRunning()) {
|
if(!soundOutThread.isRunning()) {
|
||||||
@ -1704,10 +1698,8 @@ void MainWindow::stopTx()
|
|||||||
void MainWindow::stopTx2()
|
void MainWindow::stopTx2()
|
||||||
{
|
{
|
||||||
//Lower PTT
|
//Lower PTT
|
||||||
if(m_pttMethodIndex==0) {
|
if(m_catEnabled and m_bRigOpen and m_pttMethodIndex==0) {
|
||||||
m_cmnd=rig_command() + " T 0"; //CAT for PTT=0
|
rig->setPTT((ptt_t)m_iptt, RIG_VFO_CURR); //CAT control for PTT=0
|
||||||
p3.start(m_cmnd);
|
|
||||||
p3.waitForFinished();
|
|
||||||
}
|
}
|
||||||
if(m_pttMethodIndex==1 or m_pttMethodIndex==2) {
|
if(m_pttMethodIndex==1 or m_pttMethodIndex==2) {
|
||||||
ptt(m_pttPort,0,&m_iptt,&m_COMportOpen);
|
ptt(m_pttPort,0,&m_iptt,&m_COMportOpen);
|
||||||
@ -2621,6 +2613,7 @@ void MainWindow::rigOpen()
|
|||||||
catch (const RigException &Ex) {
|
catch (const RigException &Ex) {
|
||||||
m_catEnabled=false;
|
m_catEnabled=false;
|
||||||
m_bRigOpen=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 displayTxMsg(QString t);
|
||||||
void rigOpen();
|
void rigOpen();
|
||||||
bool gridOK(QString g);
|
bool gridOK(QString g);
|
||||||
QString rig_command();
|
|
||||||
QString baseCall(QString t);
|
QString baseCall(QString t);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -346,9 +345,7 @@ extern int killbyname(const char* progName);
|
|||||||
extern void getDev(int* numDevices,char hostAPI_DeviceName[][50],
|
extern void getDev(int* numDevices,char hostAPI_DeviceName[][50],
|
||||||
int minChan[], int maxChan[],
|
int minChan[], int maxChan[],
|
||||||
int minSpeed[], int maxSpeed[]);
|
int minSpeed[], int maxSpeed[]);
|
||||||
extern int ptt(int nport, int itx, int* iptt);
|
extern int ptt(int nport, int ntx, int* iptt, int* nopen);
|
||||||
//extern int ReporterInitialize(char* hostname, char* port);
|
|
||||||
|
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
//----------------------------------------------------- C and Fortran routines
|
//----------------------------------------------------- C and Fortran routines
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
</property>
|
</property>
|
||||||
<property name="maximumSize">
|
<property name="maximumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>900</width>
|
<width>936</width>
|
||||||
<height>1028</height>
|
<height>1028</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
@ -1389,7 +1389,7 @@ p, li { white-space: pre-wrap; }
|
|||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
<attribute name="buttonGroup">
|
<attribute name="buttonGroup">
|
||||||
<string notr="true">buttonGroup</string>
|
<string>buttonGroup</string>
|
||||||
</attribute>
|
</attribute>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@ -1420,7 +1420,7 @@ p, li { white-space: pre-wrap; }
|
|||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<attribute name="buttonGroup">
|
<attribute name="buttonGroup">
|
||||||
<string notr="true">buttonGroup</string>
|
<string>buttonGroup</string>
|
||||||
</attribute>
|
</attribute>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@ -1448,7 +1448,7 @@ p, li { white-space: pre-wrap; }
|
|||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
<attribute name="buttonGroup">
|
<attribute name="buttonGroup">
|
||||||
<string notr="true">buttonGroup</string>
|
<string>buttonGroup</string>
|
||||||
</attribute>
|
</attribute>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@ -1598,7 +1598,7 @@ p, li { white-space: pre-wrap; }
|
|||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
<attribute name="buttonGroup">
|
<attribute name="buttonGroup">
|
||||||
<string notr="true">buttonGroup</string>
|
<string>buttonGroup</string>
|
||||||
</attribute>
|
</attribute>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@ -1731,7 +1731,7 @@ p, li { white-space: pre-wrap; }
|
|||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
<attribute name="buttonGroup">
|
<attribute name="buttonGroup">
|
||||||
<string notr="true">buttonGroup</string>
|
<string>buttonGroup</string>
|
||||||
</attribute>
|
</attribute>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@ -1759,7 +1759,7 @@ p, li { white-space: pre-wrap; }
|
|||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
<attribute name="buttonGroup">
|
<attribute name="buttonGroup">
|
||||||
<string notr="true">buttonGroup</string>
|
<string>buttonGroup</string>
|
||||||
</attribute>
|
</attribute>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@ -1995,7 +1995,7 @@ p, li { white-space: pre-wrap; }
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="1" rowspan="5">
|
<item row="1" column="1" rowspan="5">
|
||||||
<widget class="QwtThermo" name="xThermo">
|
<widget class="QwtThermo" name="xThermo" native="true">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
@ -2008,19 +2008,19 @@ p, li { white-space: pre-wrap; }
|
|||||||
<height>180</height>
|
<height>180</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="borderWidth">
|
<property name="borderWidth" stdset="0">
|
||||||
<number>1</number>
|
<number>1</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="maxValue">
|
<property name="maxValue" stdset="0">
|
||||||
<double>60.000000000000000</double>
|
<double>60.000000000000000</double>
|
||||||
</property>
|
</property>
|
||||||
<property name="minValue">
|
<property name="minValue" stdset="0">
|
||||||
<double>0.000000000000000</double>
|
<double>0.000000000000000</double>
|
||||||
</property>
|
</property>
|
||||||
<property name="pipeWidth">
|
<property name="pipeWidth" stdset="0">
|
||||||
<number>8</number>
|
<number>8</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="value">
|
<property name="value" stdset="0">
|
||||||
<double>0.000000000000000</double>
|
<double>0.000000000000000</double>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
@ -2037,7 +2037,7 @@ p, li { white-space: pre-wrap; }
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>711</width>
|
<width>711</width>
|
||||||
<height>25</height>
|
<height>21</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QMenu" name="menuFile">
|
<widget class="QMenu" name="menuFile">
|
||||||
@ -2144,7 +2144,7 @@ p, li { white-space: pre-wrap; }
|
|||||||
</action>
|
</action>
|
||||||
<action name="actionDeviceSetup">
|
<action name="actionDeviceSetup">
|
||||||
<property name="checkable">
|
<property name="checkable">
|
||||||
<bool>true</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Configuration</string>
|
<string>Configuration</string>
|
||||||
|
Loading…
Reference in New Issue
Block a user