Working on Rig Control... Not complete yet, but psogram should compile

and run with PTT control via DTR/RTS.

Will need to replace a "labAzDist" label in mainwindow.ui.



git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@3080 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Joe Taylor 2013-03-24 14:13:37 +00:00
parent a571077996
commit ee01b0b544
4 changed files with 74 additions and 45 deletions

View File

@ -121,6 +121,7 @@ float gran()
return v2*fac;
}
/*
int ptt(int nport, int ntx, int *iptt)
{
#ifdef WIN32
@ -159,14 +160,49 @@ int ptt(int nport, int ntx, int *iptt)
*iptt=0;
open=0;
}
/*
if(i3==0) return -(SETRTS);
if(i4==0) return -(CLRRTS);
if(i5==0) return -(SETDTR);
if(i6==0) return -(CLRDTR);
if(i9==0) return -(CLRBREAK);
if(i00==0) return -10;
*/
return 0;
#endif
}
*/
int ptt(int nport, int ntx, int* iptt, int* nopen)
{
#ifdef WIN32
static HANDLE hFile;
char s[10];
int i3=1,i4=1,i5=1,i6=1,i9=1,i00=1;
if(nport==0) {
*iptt=ntx;
return(0);
}
if(ntx && (!(*nopen))) {
sprintf(s,"\\\\.\\COM%d",nport);
hFile=CreateFile(TEXT(s),GENERIC_WRITE,0,NULL,OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,NULL);
if(hFile==INVALID_HANDLE_VALUE) {
QString t;
t.sprintf("Cannot open COM port %d for PTT\n",nport);
return 1;
}
*nopen=1;
}
if(ntx && *nopen) {
i3=EscapeCommFunction(hFile,SETRTS);
i5=EscapeCommFunction(hFile,SETDTR);
*iptt=1;
}
else {
i4=EscapeCommFunction(hFile,CLRRTS);
i6=EscapeCommFunction(hFile,CLRDTR);
i9=EscapeCommFunction(hFile,CLRBREAK);
i00=CloseHandle(hFile);
*iptt=0;
*nopen=0;
}
return 0;
#endif
}

View File

@ -7,6 +7,8 @@
void getfile(QString fname, int ntrperiod);
float gran();
int ptt(int* nport, int* ntx, int* iptt);
//int ptt(int* nport, int* ntx, int* iptt);
int ptt(int nport, int ntx, int* iptt, int* nopen);
#endif // GETFILE_H

View File

@ -100,6 +100,7 @@ MainWindow::MainWindow(QWidget *parent) :
QTimer *guiTimer = new QTimer(this);
connect(guiTimer, SIGNAL(timeout()), this, SLOT(guiUpdate()));
guiTimer->start(100); //Don't change the 100 ms!
m_auto=false;
m_waterfallAvg = 1;
m_txFirst=false;
@ -130,6 +131,8 @@ MainWindow::MainWindow(QWidget *parent) :
m_TRperiod=60;
m_inGain=0;
m_dataAvailable=false;
m_iptt=0;
m_COMportOpen=0;
decodeBusy(false);
ui->xThermo->setFillBrush(Qt::green);
@ -1228,23 +1231,24 @@ void MainWindow::guiUpdate()
if(f.exists() and fmod(tsec,m_TRperiod)<1.0 + 85.0*m_nsps/12000.0)
bTxTime=true;
if(bTxTime and iptt==0 and !btxMute) {
if(bTxTime and iptt==0 and !btxMute) {
/*
//Raise PTT
if(m_pttMethodIndex==0) {
m_cmnd=rig_command() + " T 1";
p3.start(m_cmnd);
p3.waitForFinished();
}
if(m_pttMethodIndex==1 or m_pttMethodIndex==2) {
ptt(m_pttPort,1,&m_iptt,&m_COMportOpen);
// ptt(m_pttPort,1,&m_iptt);
}
qDebug() << "ptt1Timer A";
ptt1Timer->start(200); //Sequencer delay
*/
int itx=1;
int ierr = ptt(m_pttPort,itx,&iptt); // Raise PTT
/*
//Raise PTT
if(m_pttMethodIndex==0) {
m_cmnd=rig_command() + " T 1";
p3.start(m_cmnd);
p3.waitForFinished();
}
if(m_pttMethodIndex==1 or m_pttMethodIndex==2) {
// ptt(m_pttPort,1,&m_iptt,&m_COMportOpen);
ptt(m_pttPort,1,&m_iptt);
}
*/
ptt(m_pttPort,itx,&iptt,&m_COMportOpen); // Raise PTT
if(!soundOutThread.isRunning()) {
QString t=ui->tx6->text();
double snr=t.mid(1,5).toDouble();
@ -1252,6 +1256,7 @@ void MainWindow::guiUpdate()
soundOutThread.setTxSNR(snr);
soundOutThread.start(QThread::HighPriority);
}
}
if(!bTxTime || btxMute) {
btxok=false;
@ -1332,10 +1337,8 @@ void MainWindow::guiUpdate()
nc0++;
}
if(nc0 == 0) {
int itx=0;
int ierr=ptt(m_pttPort,itx,&iptt); // Lower PTT
/*
/*
//Lower PTT
if(m_pttMethodIndex==0) {
m_cmnd=rig_command() + " T 0";
@ -1343,10 +1346,13 @@ void MainWindow::guiUpdate()
p3.waitForFinished();
}
if(m_pttMethodIndex==1 or m_pttMethodIndex==2) {
// ptt(m_pttPort,0,&m_iptt,&m_COMportOpen);
ptt(m_pttPort,0,&m_iptt);
ptt(m_pttPort,0,&m_iptt,&m_COMportOpen);
// ptt(m_pttPort,0,&m_iptt);
}
*/
*/
int itx=0;
ptt(m_pttPort,itx,&iptt,&m_COMportOpen); // Lower PTT
if(!btxMute) soundOutThread.quitExecution=true;
m_transmitting=false;
@ -1405,19 +1411,6 @@ void MainWindow::guiUpdate()
m_hsym0=khsym;
m_sec0=nsec;
/*
if(m_myCall=="K1JT") {
char s[20];
double t1=1.0;
//Better: use signals from sound threads?
if(soundInThread.isRunning()) t1=soundInThread.samFacIn();
double t2=1.0;
if(soundOutThread.isRunning()) t2=soundOutThread.samFacOut();
sprintf(s,"%6.4f %6.4f",t1,t2);
lab5->setText(s);
}
*/
}
iptt0=iptt;
btxok0=btxok;

View File

@ -113,7 +113,6 @@ private slots:
void dialFreqChanged2(double f);
void on_actionErase_ALL_TXT_triggered();
void on_actionErase_wsjtx_log_adi_triggered();
void showMacros(const QPoint& pos);
void onPopup1();
void onPopup2();
@ -127,7 +126,6 @@ private slots:
void onPopup10();
void on_actionConvert_JT9_x_to_RTTY_triggered(bool checked);
void on_actionLog_JT9_without_submode_triggered(bool checked);
void on_actionLog_dB_reports_to_Comments_triggered(bool checked);
private: