Fix another bug in setting frequencies through Commander.

git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@3474 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Joe Taylor 2013-07-09 22:41:15 +00:00
parent 75291ca4d6
commit 10d83aeeb1
2 changed files with 16 additions and 11 deletions

View File

@ -2988,7 +2988,9 @@ void MainWindow::setXIT(int n)
msgBox(rt); msgBox(rt);
} }
} }
if(m_bSplit) ret=rig->setSplitFreq(MHz(m_dialFreq)+xit,RIG_VFO_B); if(m_bSplit) {
ret=rig->setSplitFreq(MHz(m_dialFreq)+xit,RIG_VFO_B);
}
} }
if(m_bSplit) soundOutThread.setXIT(xit); if(m_bSplit) soundOutThread.setXIT(xit);
if(!m_bSplit) soundOutThread.setXIT(0); if(!m_bSplit) soundOutThread.setXIT(0);

View File

@ -101,23 +101,26 @@ int Rig::open(int n) {
} }
} }
if(n==9998) { if(n==9998) {
// qDebug() << "A" << socket->state(); if(socket->state()==QAbstractSocket::ConnectedState) {
socket->abort();
}
if(socket->state()==QAbstractSocket::UnconnectedState) {
socket->connectToHost(QHostAddress::LocalHost, 52002); socket->connectToHost(QHostAddress::LocalHost, 52002);
if(!socket->waitForConnected(1000)) { if(!socket->waitForConnected(1000)) {
return -1; return -1;
} }
}
QString t; QString t;
// qint32 nkHz=14076; // qint32 nkHz=14076;
// t.sprintf("<command:10>CmdSetFreq<parameters:17><xcvrfreq:5>%5d",nkHz); // t.sprintf("<command:10>CmdSetFreq<parameters:17><xcvrfreq:5>%5d",nkHz);
t="<command:10>CmdGetFreq<parameters:0>"; t="<command:10>CmdGetFreq<parameters:0>";
QByteArray ba = t.toLocal8Bit(); QByteArray ba = t.toLocal8Bit();
const char* buf=ba.data(); const char* buf=ba.data();
socket->write(buf); int n=socket->write(buf);
socket->waitForReadyRead(1000); bool bret=socket->waitForReadyRead(1000);
QByteArray reply=socket->read(128); QByteArray reply=socket->read(128);
if(reply.indexOf("<CmdFreq:10>")==0) { if(reply.indexOf("<CmdFreq:")==0) {
// qDebug() << "Freq:" << reply;
// qDebug() << "Connected to Commander";
m_cmndr=true; m_cmndr=true;
return 0; return 0;
} }
@ -212,7 +215,7 @@ int Rig::setSplitFreq(freq_t tx_freq, vfo_t vfo) {
} else if(m_cmndr) { } else if(m_cmndr) {
QString t; QString t;
qint32 nkHz=int(0.001*tx_freq); qint32 nkHz=int(0.001*tx_freq);
t.sprintf("<command:12>CmdSetTxFreq<parameters:17><xcvrfreq:5>%5d",nkHz); t.sprintf("<command:12>CmdSetTxFreq<parameters:18><xcvrfreq:6>%6d",nkHz);
QByteArray ba = t.toLocal8Bit(); QByteArray ba = t.toLocal8Bit();
const char* buf=ba.data(); const char* buf=ba.data();
socket->write(buf); socket->write(buf);