kopia lustrzana https://gitlab.com/eliggett/wfview
Removed extra debug calls and status text updates.
rodzic
d6e5fdb362
commit
3414ef46ae
|
@ -11,6 +11,7 @@ commHandler::commHandler()
|
||||||
|
|
||||||
port = new QSerialPort();
|
port = new QSerialPort();
|
||||||
|
|
||||||
|
|
||||||
// TODO: The following should become arguments and/or functions
|
// TODO: The following should become arguments and/or functions
|
||||||
// Add signal/slot everywhere for comm port setup.
|
// Add signal/slot everywhere for comm port setup.
|
||||||
// Consider how to "re-setup" and how to save the state for next time.
|
// Consider how to "re-setup" and how to save the state for next time.
|
||||||
|
@ -56,7 +57,7 @@ commHandler::commHandler(QString portName)
|
||||||
initializePt();
|
initializePt();
|
||||||
|
|
||||||
connect(port, SIGNAL(readyRead()), this, SLOT(receiveDataIn()));
|
connect(port, SIGNAL(readyRead()), this, SLOT(receiveDataIn()));
|
||||||
connect(pseudoterm, SIGNAL(readyRead()), this, SLOT(receiveDataInPt()));
|
connect(pseudoterm, SIGNAL(readyRead()), this, SLOT(receiveDataInPt())); // sometimes it seems the connection fails.
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,7 +71,7 @@ void commHandler::initializePt()
|
||||||
|
|
||||||
void commHandler::setupPtComm()
|
void commHandler::setupPtComm()
|
||||||
{
|
{
|
||||||
// qDebug() << "Setting up pt";
|
qDebug() << "Setting up Pseudo Term";
|
||||||
pseudoterm->setPortName("/dev/ptmx");
|
pseudoterm->setPortName("/dev/ptmx");
|
||||||
// pseudoterm->setBaudRate(baudrate);
|
// pseudoterm->setBaudRate(baudrate);
|
||||||
// pseudoterm->setStopBits(QSerialPort::OneStop);
|
// pseudoterm->setStopBits(QSerialPort::OneStop);
|
||||||
|
@ -84,9 +85,9 @@ void commHandler::openPtPort()
|
||||||
success = pseudoterm->open(QIODevice::ReadWrite);
|
success = pseudoterm->open(QIODevice::ReadWrite);
|
||||||
if(success)
|
if(success)
|
||||||
{
|
{
|
||||||
// qDebug() << "Opened pt device, attempting to grant pt status";
|
qDebug() << "Opened pt device, attempting to grant pt status";
|
||||||
ptfd = pseudoterm->handle();
|
ptfd = pseudoterm->handle();
|
||||||
// qDebug() << "ptfd: " << ptfd;
|
qDebug() << "ptfd: " << ptfd;
|
||||||
if(grantpt(ptfd))
|
if(grantpt(ptfd))
|
||||||
{
|
{
|
||||||
qDebug() << "Failed to grantpt";
|
qDebug() << "Failed to grantpt";
|
||||||
|
@ -131,31 +132,37 @@ void commHandler::sendDataOut(const QByteArray &writeData)
|
||||||
{
|
{
|
||||||
|
|
||||||
mutex.lock();
|
mutex.lock();
|
||||||
// quint64 bytesWritten;
|
|
||||||
|
|
||||||
// sned out data
|
#ifdef QT_DEBUG
|
||||||
//port.send() or whatever
|
|
||||||
// bytesWritten = port->write(writeData);
|
qint64 bytesWritten;
|
||||||
|
|
||||||
|
bytesWritten = port->write(writeData);
|
||||||
|
qDebug() << "bytesWritten: " << bytesWritten << " length of byte array: " << writeData.length()\
|
||||||
|
<< " size of byte array: " << writeData.size()\
|
||||||
|
<< " Wrote all bytes? " << (bool) (bytesWritten == (qint64)writeData.size());
|
||||||
|
|
||||||
|
#else
|
||||||
port->write(writeData);
|
port->write(writeData);
|
||||||
|
|
||||||
//qDebug() << "bytesWritten: " << bytesWritten << " length of byte array: " << writeData.length() << " size of byte array: " << writeData.size();
|
#endif
|
||||||
|
|
||||||
mutex.unlock();
|
mutex.unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
void commHandler::sendDataOutPt(const QByteArray &writeData)
|
void commHandler::sendDataOutPt(const QByteArray &writeData)
|
||||||
{
|
{
|
||||||
ptMutex.lock();
|
ptMutex.lock();
|
||||||
// quint64 bytesWritten;
|
|
||||||
|
|
||||||
// sned out data
|
|
||||||
//port.send() or whatever
|
|
||||||
// bytesWritten = port->write(writeData);
|
|
||||||
//printHex(writeData, false, true);
|
//printHex(writeData, false, true);
|
||||||
|
|
||||||
|
#ifdef QT_DEBUG
|
||||||
|
qint64 bytesWritten;
|
||||||
|
bytesWritten = port->write(writeData);
|
||||||
|
qDebug() << "pseudo-term bytesWritten: " << bytesWritten << " length of byte array: " << \
|
||||||
|
writeData.length() << " size of byte array: " << writeData.size()\
|
||||||
|
<< ", wrote all: " << (bool)(bytesWritten == (qint64)writeData.size());
|
||||||
|
#else
|
||||||
pseudoterm->write(writeData);
|
pseudoterm->write(writeData);
|
||||||
|
#endif
|
||||||
//qDebug() << "bytesWritten: " << bytesWritten << " length of byte array: " << writeData.length() << " size of byte array: " << writeData.size();
|
|
||||||
|
|
||||||
ptMutex.unlock();
|
ptMutex.unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -163,13 +170,14 @@ void commHandler::sendDataOutPt(const QByteArray &writeData)
|
||||||
void commHandler::receiveDataInPt()
|
void commHandler::receiveDataInPt()
|
||||||
{
|
{
|
||||||
// We received data from the pseudo-term.
|
// We received data from the pseudo-term.
|
||||||
// qDebug() << "Sending data from pseudo-terminal to radio";
|
//qDebug() << "Sending data from pseudo-terminal to radio";
|
||||||
// Send this data to the radio:
|
// Send this data to the radio:
|
||||||
//QByteArray ptdata = pseudoterm->readAll();
|
//QByteArray ptdata = pseudoterm->readAll();
|
||||||
// should check the data and rollback
|
// should check the data and rollback
|
||||||
// for now though...
|
// for now though...
|
||||||
//sendDataOut(ptdata);
|
//sendDataOut(ptdata);
|
||||||
sendDataOut(pseudoterm->readAll());
|
sendDataOut(pseudoterm->readAll());
|
||||||
|
//qDebug() << "Returned from sendDataOut with pseudo-terminal send data.";
|
||||||
}
|
}
|
||||||
|
|
||||||
void commHandler::receiveDataIn()
|
void commHandler::receiveDataIn()
|
||||||
|
|
|
@ -566,8 +566,10 @@ void rigCommander::parseCommand()
|
||||||
break;
|
break;
|
||||||
case '\xFA':
|
case '\xFA':
|
||||||
// error
|
// error
|
||||||
|
#ifdef QT_DEBUG
|
||||||
qDebug() << "Error (FA) received from rig.";
|
qDebug() << "Error (FA) received from rig.";
|
||||||
printHex(payloadIn, false ,true);
|
printHex(payloadIn, false ,true);
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
10
wfmain.cpp
10
wfmain.cpp
|
@ -912,7 +912,7 @@ void wfmain::receiveFreq(double freqMhz)
|
||||||
ui->freqLabel->setText(QString("%1").arg(freqMhz, 0, 'f'));
|
ui->freqLabel->setText(QString("%1").arg(freqMhz, 0, 'f'));
|
||||||
this->freqMhz = freqMhz;
|
this->freqMhz = freqMhz;
|
||||||
this->knobFreqMhz = freqMhz;
|
this->knobFreqMhz = freqMhz;
|
||||||
showStatusBarText(QString("Frequency: %1").arg(freqMhz));
|
//showStatusBarText(QString("Frequency: %1").arg(freqMhz));
|
||||||
}
|
}
|
||||||
|
|
||||||
void wfmain::receivePTTstatus(bool pttOn)
|
void wfmain::receivePTTstatus(bool pttOn)
|
||||||
|
@ -1730,8 +1730,8 @@ void wfmain::on_pttEnableChk_clicked(bool checked)
|
||||||
// --- DEBUG FUNCTION ---
|
// --- DEBUG FUNCTION ---
|
||||||
void wfmain::on_debugBtn_clicked()
|
void wfmain::on_debugBtn_clicked()
|
||||||
{
|
{
|
||||||
// TODO: Remove function on release build
|
// TODO: Why don't these commands work?!
|
||||||
// emit getScopeMode();
|
//emit getScopeMode();
|
||||||
// emit getScopeEdge(); // 1,2,3 only in "fixed" mode
|
//emit getScopeEdge(); // 1,2,3 only in "fixed" mode
|
||||||
// emit getScopeSpan(); // in khz, only in "center" mode
|
//emit getScopeSpan(); // in khz, only in "center" mode
|
||||||
}
|
}
|
||||||
|
|
Ładowanie…
Reference in New Issue