kopia lustrzana https://gitlab.com/eliggett/wfview
Squashed a number of bugs and added the band stacking register
functions.merge-requests/1/merge
rodzic
208e2017eb
commit
54881ddd51
|
@ -28,6 +28,33 @@ commHandler::commHandler()
|
|||
connect(port, SIGNAL(readyRead()), this, SLOT(receiveDataIn()));
|
||||
}
|
||||
|
||||
commHandler::commHandler(QString portName)
|
||||
{
|
||||
//constructor
|
||||
// grab baud rate and other comm port details
|
||||
// if they need to be changed later, please
|
||||
// destroy this and create a new one.
|
||||
|
||||
port = new QSerialPort();
|
||||
|
||||
// TODO: The following should become arguments and/or functions
|
||||
// Add signal/slot everywhere for comm port setup.
|
||||
// Consider how to "re-setup" and how to save the state for next time.
|
||||
baudrate = 115200;
|
||||
stopbits = 1;
|
||||
this->portName = portName;
|
||||
|
||||
setupComm(); // basic parameters
|
||||
openPort();
|
||||
qDebug() << "Serial buffer size: " << port->readBufferSize();
|
||||
//port->setReadBufferSize(1024); // manually. 256 never saw any return from the radio. why...
|
||||
//qDebug() << "Serial buffer size: " << port->readBufferSize();
|
||||
|
||||
|
||||
connect(port, SIGNAL(readyRead()), this, SLOT(receiveDataIn()));
|
||||
}
|
||||
|
||||
|
||||
commHandler::~commHandler()
|
||||
{
|
||||
this->closePort();
|
||||
|
|
|
@ -16,6 +16,8 @@ class commHandler : public QObject
|
|||
|
||||
public:
|
||||
commHandler();
|
||||
commHandler(QString portName);
|
||||
|
||||
~commHandler();
|
||||
|
||||
private slots:
|
||||
|
|
132
rigcommander.cpp
132
rigcommander.cpp
|
@ -1,6 +1,17 @@
|
|||
#include "rigcommander.h"
|
||||
#include <QDebug>
|
||||
|
||||
// Copytight 2017,2018 Elliott H. Liggett
|
||||
|
||||
// This file parses data from the radio and also forms commands to the radio.
|
||||
// The radio physical interface is handled by the commHandler() instance "comm"
|
||||
|
||||
// TODO:
|
||||
// + Allow parameters to pass to the commHandler indicating which serial port to use
|
||||
// + Impliment additional commands (of course)
|
||||
// + Impliment external serial port "pass through"
|
||||
// + Impliment XML RPC server?
|
||||
//
|
||||
|
||||
//
|
||||
// See here for a wonderful CI-V overview:
|
||||
|
@ -21,10 +32,13 @@ rigCommander::rigCommander()
|
|||
civAddr = 0x94; // address of the radio. Decimal is 148.
|
||||
|
||||
setCIVAddr(civAddr);
|
||||
//compCivAddr = 0xE1;
|
||||
//payloadPrefix = QByteArray("\xFE\xFE\x94\xE0");
|
||||
payloadPrefix = QByteArray("\xFE\xFE");
|
||||
payloadPrefix.append(civAddr);
|
||||
payloadPrefix.append("\xE0");
|
||||
payloadPrefix.append(compCivAddr);
|
||||
|
||||
// payloadPrefix.append("\xE0");
|
||||
|
||||
payloadSuffix = QByteArray("\xFD");
|
||||
comm = new commHandler();
|
||||
|
@ -54,8 +68,10 @@ void rigCommander::prepDataAndSend(QByteArray data)
|
|||
data.prepend(payloadPrefix);
|
||||
//printHex(data, false, true);
|
||||
data.append(payloadSuffix);
|
||||
//qDebug() << "Final payload in rig commander to be sent to rig: ";
|
||||
//printHex(data, false, true);
|
||||
#ifdef QT_DEBUG
|
||||
qDebug() << "Final payload in rig commander to be sent to rig: ";
|
||||
printHex(data, false, true);
|
||||
#endif
|
||||
emit dataForComm(data);
|
||||
}
|
||||
|
||||
|
@ -266,6 +282,14 @@ void rigCommander::getPTT()
|
|||
prepDataAndSend(payload);
|
||||
}
|
||||
|
||||
void rigCommander::getBandStackReg(char band, char regCode)
|
||||
{
|
||||
QByteArray payload("\x1A\x01");
|
||||
payload.append(band); // [01 through 11]
|
||||
payload.append(regCode); // [01...03]. 01 = latest, 03 = oldest
|
||||
prepDataAndSend(payload);
|
||||
}
|
||||
|
||||
void rigCommander::setPTT(bool pttOn)
|
||||
{
|
||||
//bool pttAllowed = false;
|
||||
|
@ -281,6 +305,8 @@ void rigCommander::setPTT(bool pttOn)
|
|||
|
||||
void rigCommander::setCIVAddr(unsigned char civAddr)
|
||||
{
|
||||
// Note: This is the radio's CIV address
|
||||
// the computer's CIV address is defined in the header file.
|
||||
this->civAddr = civAddr;
|
||||
}
|
||||
|
||||
|
@ -383,7 +409,9 @@ void rigCommander::parseData(QByteArray dataInput)
|
|||
// //printHex(payloadIn, false, true);
|
||||
// parseData(payloadIn);
|
||||
// break;
|
||||
case '\xE0':
|
||||
// case '\xE0':
|
||||
|
||||
case (char)compCivAddr:
|
||||
// data is a reply to some query we sent
|
||||
// extract the payload out and parse.
|
||||
// payload = getpayload(data); // or something
|
||||
|
@ -415,8 +443,14 @@ void rigCommander::parseCommand()
|
|||
{
|
||||
// note: data already is trimmed of the beginning FE FE E0 94 stuff.
|
||||
|
||||
// printHex(data, false, true);
|
||||
//payloadIn = data;
|
||||
#ifdef QT_DEBUG
|
||||
if(payloadIn[00] != '\x27')
|
||||
{
|
||||
// debug only
|
||||
printHex(payloadIn, false, true);
|
||||
}
|
||||
#endif
|
||||
|
||||
switch(payloadIn[00])
|
||||
{
|
||||
|
||||
|
@ -435,6 +469,10 @@ void rigCommander::parseCommand()
|
|||
//qDebug() << "Have mode data";
|
||||
this->parseMode();
|
||||
break;
|
||||
case '\x14':
|
||||
// read levels
|
||||
parseLevels();
|
||||
break;
|
||||
case '\x27':
|
||||
// scope data
|
||||
//qDebug() << "Have scope data";
|
||||
|
@ -448,6 +486,7 @@ void rigCommander::parseCommand()
|
|||
} else {
|
||||
parseRegisters1A();
|
||||
}
|
||||
break;
|
||||
case '\x1C':
|
||||
parseRegisters1C();
|
||||
break;
|
||||
|
@ -469,6 +508,41 @@ void rigCommander::parseCommand()
|
|||
|
||||
}
|
||||
|
||||
void rigCommander::parseLevels()
|
||||
{
|
||||
qDebug() << "Received a level status readout: ";
|
||||
// printHex(payloadIn, false, true);
|
||||
|
||||
char level = (payloadIn[2] * 100) + payloadIn[03];
|
||||
qDebug() << "Level is: " << (int)level << " or " << 100.0*level/255.0 << "%";
|
||||
|
||||
// Typical RF gain response (rather low setting):
|
||||
// "INDEX: 00 01 02 03 04 "
|
||||
// "DATA: 14 02 00 78 fd "
|
||||
|
||||
switch(payloadIn[1])
|
||||
{
|
||||
case '\x01':
|
||||
// AF level
|
||||
break;
|
||||
case '\x02':
|
||||
// RX RF Gain
|
||||
break;
|
||||
case '\x03':
|
||||
// Squelch level
|
||||
break;
|
||||
case '\x0A':
|
||||
// TX RF level
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void rigCommander::getRfGain()
|
||||
{
|
||||
QByteArray payload("\x14\x02");
|
||||
prepDataAndSend(payload);
|
||||
}
|
||||
|
||||
void rigCommander::parseRegisters1C()
|
||||
{
|
||||
// PTT lives here
|
||||
|
@ -486,6 +560,9 @@ void rigCommander::parsePTT()
|
|||
{
|
||||
// read after payloadIn[02]
|
||||
|
||||
// Because I'm not sure about this:
|
||||
qDebug() << "PTT status received, here is the hex dump:";
|
||||
printHex(payloadIn, false, true);
|
||||
if(payloadIn[03] == (char)0)
|
||||
{
|
||||
// PTT off
|
||||
|
@ -507,8 +584,21 @@ void rigCommander::parseRegisters1A()
|
|||
// 01: band stacking memory contents (last freq used is stored here per-band)
|
||||
// 03: filter width
|
||||
// 04: AGC rate
|
||||
switch(payloadIn[02])
|
||||
qDebug() << "Looking at register 1A :";
|
||||
printHex(payloadIn, false, true);
|
||||
|
||||
// "INDEX: 00 01 02 03 04 "
|
||||
// "DATA: 1a 06 01 03 fd " (data mode enabled, filter width 3 selected)
|
||||
|
||||
switch(payloadIn[01])
|
||||
{
|
||||
case '\x00':
|
||||
// Memory contents
|
||||
break;
|
||||
case '\x01':
|
||||
// band stacking register
|
||||
parseBandStackReg();
|
||||
break;
|
||||
case '\x06':
|
||||
// data mode
|
||||
// emit havedataMode( (bool) payloadIn[somebit])
|
||||
|
@ -521,13 +611,39 @@ void rigCommander::parseRegisters1A()
|
|||
emit haveDataMode((bool)payloadIn[03]);
|
||||
break;
|
||||
case '\x07':
|
||||
// IP+
|
||||
// IP+ status
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void rigCommander::parseBandStackReg()
|
||||
{
|
||||
// qDebug() << "Band stacking register response received: ";
|
||||
// printHex(payloadIn, false, true);
|
||||
// Reference output, 20 meters, regCode 01 (latest):
|
||||
// "INDEX: 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 "
|
||||
// "DATA: 1a 01 05 01 60 03 23 14 00 00 03 10 00 08 85 00 08 85 fd "
|
||||
// char band = payloadIn[2];
|
||||
// char regCode = payloadIn[3];
|
||||
float freq = parseFrequency(payloadIn, 7);
|
||||
bool dataOn = (payloadIn[11] & 0x10) >> 4; // not sure...
|
||||
char mode = payloadIn[9];
|
||||
|
||||
// 09, 10 mode
|
||||
// 11 digit RH: data mode on (1) or off (0)
|
||||
// 11 digit LH: CTCSS 0 = off, 1 = TONE, 2 = TSQL
|
||||
|
||||
// 12, 13 : tone freq setting
|
||||
// 14, 15 tone squelch freq setting
|
||||
// if more, memory name (label) ascii
|
||||
|
||||
// qDebug() << "band: " << QString("%1").arg(band) << " regCode: " << (QString)regCode << " freq: " << freq;
|
||||
// qDebug() << "mode: " << (QString)mode << " dataOn: " << dataOn;
|
||||
emit haveBandStackReg(freq, mode, dataOn);
|
||||
}
|
||||
|
||||
void rigCommander::parseDetailedRegisters1A05()
|
||||
{
|
||||
// It seems a lot of misc stuff is under this command and subcommand.
|
||||
|
|
|
@ -8,6 +8,11 @@
|
|||
// This file figures out what to send to the comm and also
|
||||
// parses returns into useful things.
|
||||
|
||||
// 0xE1 is new default, 0xE0 was before.
|
||||
// note: using a define because switch case doesn't even work with const unsigned char. Surprised me.
|
||||
#define compCivAddr 0xE1
|
||||
|
||||
|
||||
class rigCommander : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
@ -30,11 +35,13 @@ public slots:
|
|||
void setFrequency(double freq);
|
||||
void setMode(char mode);
|
||||
void getFrequency();
|
||||
void getBandStackReg(char band, char regCode);
|
||||
void getMode();
|
||||
void getPTT();
|
||||
void setPTT(bool pttOn);
|
||||
void setDataMode(bool dataOn);
|
||||
void getDataMode();
|
||||
void getRfGain();
|
||||
void setCIVAddr(unsigned char civAddr);
|
||||
void handleNewData(const QByteArray &data);
|
||||
void getDebug();
|
||||
|
@ -44,6 +51,7 @@ signals:
|
|||
void haveFrequency(double frequencyMhz);
|
||||
void haveMode(QString mode);
|
||||
void haveDataMode(bool dataModeEnabled);
|
||||
void haveBandStackReg(float freq, char mode, bool dataOn);
|
||||
void haveSpectrumBounds();
|
||||
void dataForComm(const QByteArray &outData);
|
||||
void getMoreDebug();
|
||||
|
@ -63,8 +71,10 @@ private:
|
|||
void parseSpectrum();
|
||||
void parseDetailedRegisters1A05();
|
||||
void parseRegisters1A();
|
||||
void parseBandStackReg();
|
||||
void parseRegisters1C();
|
||||
void parsePTT();
|
||||
void parseLevels(); // register 0x14
|
||||
void sendDataOut();
|
||||
void prepDataAndSend(QByteArray data);
|
||||
void debugMe();
|
||||
|
@ -87,6 +97,7 @@ private:
|
|||
|
||||
double frequencyMhz;
|
||||
unsigned char civAddr; // 0x94 is default = 148decimal
|
||||
//const unsigned char compCivAddr = 0xE1; // 0xE1 is new default, 0xE0 was before.
|
||||
bool pttAllowed;
|
||||
|
||||
|
||||
|
|
229
wfmain.cpp
229
wfmain.cpp
|
@ -63,21 +63,23 @@ wfmain::wfmain(QWidget *parent) :
|
|||
connect(this, SIGNAL(getMode()), rig, SLOT(getMode()));
|
||||
connect(this, SIGNAL(getDataMode()), rig, SLOT(getDataMode()));
|
||||
connect(this, SIGNAL(setDataMode(bool)), rig, SLOT(setDataMode(bool)));
|
||||
connect(this, SIGNAL(getBandStackReg(char,char)), rig, SLOT(getBandStackReg(char,char)));
|
||||
connect(rig, SIGNAL(havePTTStatus(bool)), this, SLOT(receivePTTstatus(bool)));
|
||||
|
||||
connect(rig, SIGNAL(haveBandStackReg(float,char,bool)), this, SLOT(receiveBandStackReg(float,char,bool)));
|
||||
connect(this, SIGNAL(getDebug()), rig, SLOT(getDebug()));
|
||||
connect(this, SIGNAL(spectOutputDisable()), rig, SLOT(disableSpectOutput()));
|
||||
connect(this, SIGNAL(spectOutputEnable()), rig, SLOT(enableSpectOutput()));
|
||||
connect(this, SIGNAL(scopeDisplayDisable()), rig, SLOT(disableSpectrumDisplay()));
|
||||
connect(this, SIGNAL(scopeDisplayEnable()), rig, SLOT(enableSpectrumDisplay()));
|
||||
connect(rig, SIGNAL(haveMode(QString)), this, SLOT(receiveMode(QString)));
|
||||
connect(rig, SIGNAL(haveDataMode(bool)), this, SLOT(receiveDataModeStatus(bool)));
|
||||
connect(rig, SIGNAL(haveSpectrumData(QByteArray, double, double)), this, SLOT(receiveSpectrumData(QByteArray, double, double)));
|
||||
connect(this, SIGNAL(setFrequency(double)), rig, SLOT(setFrequency(double)));
|
||||
connect(this, SIGNAL(setScopeCenterMode(bool)), rig, SLOT(setSpectrumCenteredMode(bool)));
|
||||
connect(this, SIGNAL(setScopeEdge(char)), rig, SLOT(setScopeEdge(char)));
|
||||
connect(this, SIGNAL(setScopeSpan(char)), rig, SLOT(setScopeSpan(char)));
|
||||
connect(this, SIGNAL(setMode(char)), rig, SLOT(setMode(char)));
|
||||
|
||||
connect(this, SIGNAL(getRfGain()), rig, SLOT(getRfGain()));
|
||||
|
||||
// Plot user interaction
|
||||
connect(plot, SIGNAL(mouseDoubleClick(QMouseEvent*)), this, SLOT(handlePlotDoubleClick(QMouseEvent*)));
|
||||
|
@ -131,6 +133,7 @@ wfmain::wfmain(QWidget *parent) :
|
|||
getInitialRigState();
|
||||
oldFreqDialVal = ui->freqDial->value();
|
||||
|
||||
|
||||
}
|
||||
|
||||
wfmain::~wfmain()
|
||||
|
@ -148,6 +151,9 @@ void wfmain::getInitialRigState()
|
|||
cmdOutQue.append(cmdGetFreq);
|
||||
cmdOutQue.append(cmdGetMode);
|
||||
|
||||
cmdOutQue.append(cmdDispEnable);
|
||||
cmdOutQue.append(cmdSpecOn);
|
||||
|
||||
cmdOutQue.append(cmdGetFreq);
|
||||
cmdOutQue.append(cmdGetMode);
|
||||
|
||||
|
@ -273,6 +279,7 @@ void wfmain::runDelayedCommand()
|
|||
emit getMode();
|
||||
break;
|
||||
case cmdGetDataMode:
|
||||
qDebug() << "Sending query for data mode";
|
||||
emit getDataMode();
|
||||
break;
|
||||
case cmdSetDataModeOff:
|
||||
|
@ -281,6 +288,18 @@ void wfmain::runDelayedCommand()
|
|||
case cmdSetDataModeOn:
|
||||
emit setDataMode(true);
|
||||
break;
|
||||
case cmdDispEnable:
|
||||
emit scopeDisplayEnable();
|
||||
break;
|
||||
case cmdDispDisable:
|
||||
emit scopeDisplayDisable();
|
||||
break;
|
||||
case cmdSpecOn:
|
||||
emit spectOutputEnable();
|
||||
break;
|
||||
case cmdSpecOff:
|
||||
emit spectOutputDisable();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -306,6 +325,7 @@ void wfmain::receiveFreq(double freqMhz)
|
|||
|
||||
void wfmain::receivePTTstatus(bool pttOn)
|
||||
{
|
||||
// NOTE: This will only show up if we actually receive a PTT status
|
||||
qDebug() << "PTT status: " << pttOn;
|
||||
}
|
||||
|
||||
|
@ -465,7 +485,10 @@ void wfmain::on_getModeBtn_clicked()
|
|||
|
||||
void wfmain::on_debugBtn_clicked()
|
||||
{
|
||||
emit getDebug();
|
||||
// Temporary place to try code
|
||||
// emit getDebug();
|
||||
// emit getBandStackReg(0x11,1); // 20M, latest
|
||||
emit getRfGain();
|
||||
}
|
||||
|
||||
void wfmain::on_stopBtn_clicked()
|
||||
|
@ -492,10 +515,30 @@ void wfmain::receiveMode(QString mode)
|
|||
}
|
||||
// Note: we need to know if the DATA mode is active to reach mode-D
|
||||
// some kind of queued query:
|
||||
cmdOut = cmdGetDataMode;
|
||||
//delayedCommand->start();
|
||||
cmdOutQue.append(cmdGetDataMode);
|
||||
delayedCommand->start(); // why was that commented out?
|
||||
}
|
||||
|
||||
void wfmain::receiveDataModeStatus(bool dataEnabled)
|
||||
{
|
||||
qDebug() << "Received data mode " << dataEnabled << "\n";
|
||||
if(dataEnabled)
|
||||
{
|
||||
if(currentModeIndex == 0)
|
||||
{
|
||||
// USB
|
||||
ui->modeSelectCombo->setCurrentIndex(8);
|
||||
} else if (currentModeIndex == 1)
|
||||
{
|
||||
// LSB
|
||||
ui->modeSelectCombo->setCurrentIndex(9);
|
||||
}
|
||||
ui->modeLabel->setText( ui->modeLabel->text() + "-D" );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
void wfmain::on_clearPeakBtn_clicked()
|
||||
{
|
||||
spectrumPeaks = QByteArray( (int)spectWidth, '\x01' );
|
||||
|
@ -538,7 +581,7 @@ void wfmain::on_goFreqBtn_clicked()
|
|||
}
|
||||
ui->freqMhzLineEdit->selectAll();
|
||||
freqTextSelected = true;
|
||||
|
||||
ui->tabWidget->setCurrentIndex(0);
|
||||
}
|
||||
|
||||
void wfmain::checkFreqSel()
|
||||
|
@ -651,10 +694,10 @@ void wfmain::on_scopeEdgeCombo_currentIndexChanged(int index)
|
|||
emit setScopeEdge((char)index+1);
|
||||
}
|
||||
|
||||
void wfmain::on_modeSelectCombo_currentIndexChanged(int index)
|
||||
{
|
||||
//void wfmain::on_modeSelectCombo_currentIndexChanged(int index)
|
||||
//{
|
||||
// do nothing. The change may be from receiving a mode status update or the user. Can't tell which is which here.
|
||||
}
|
||||
//}
|
||||
|
||||
|
||||
|
||||
|
@ -690,11 +733,11 @@ void wfmain::on_modeSelectCombo_activated(int index)
|
|||
|
||||
}
|
||||
|
||||
void wfmain::on_freqDial_actionTriggered(int action)
|
||||
{
|
||||
//void wfmain::on_freqDial_actionTriggered(int action)
|
||||
//{
|
||||
//qDebug() << "Action: " << action; // "7" == changed?
|
||||
// TODO: remove this
|
||||
}
|
||||
//}
|
||||
|
||||
void wfmain::on_freqDial_valueChanged(int value)
|
||||
{
|
||||
|
@ -761,6 +804,10 @@ void wfmain::on_freqDial_valueChanged(int value)
|
|||
|
||||
// qDebug() << "old freq: " << knobFreqMhz << " new freq: " << newFreqMhz << "knobDelta: " << delta << " freq delta: " << newFreqMhz - knobFreqMhz;
|
||||
|
||||
if(ui->tuningFloorZerosChk->isChecked())
|
||||
{
|
||||
newFreqMhz = (double)round(newFreqMhz*10000) / 10000.0;
|
||||
}
|
||||
|
||||
this->knobFreqMhz = newFreqMhz; // the frequency we think we should be on.
|
||||
|
||||
|
@ -772,3 +819,161 @@ void wfmain::on_freqDial_valueChanged(int value)
|
|||
//emit getFrequency();
|
||||
|
||||
}
|
||||
|
||||
void wfmain::receiveBandStackReg(float freq, char mode, bool dataOn)
|
||||
{
|
||||
// read the band stack and apply by sending out commands
|
||||
|
||||
setFrequency(freq);
|
||||
setMode(mode); // make sure this is what you think it is
|
||||
|
||||
// setDataMode(dataOn); // signal out
|
||||
if(dataOn)
|
||||
{
|
||||
cmdOutQue.append(cmdSetDataModeOn);
|
||||
} else {
|
||||
cmdOutQue.append(cmdSetDataModeOff);
|
||||
}
|
||||
cmdOutQue.append(cmdGetFreq);
|
||||
cmdOutQue.append(cmdGetMode);
|
||||
ui->tabWidget->setCurrentIndex(0);
|
||||
|
||||
delayedCommand->start();
|
||||
}
|
||||
|
||||
void wfmain::bandStackBtnClick()
|
||||
{
|
||||
bandStkRegCode = ui->bandStkPopdown->currentIndex() + 1;
|
||||
waitingForBandStackRtn = true; // so that when the return is parsed we jump to this frequency/mode info
|
||||
emit getBandStackReg(bandStkBand, bandStkRegCode);
|
||||
}
|
||||
|
||||
void wfmain::on_band6mbtn_clicked()
|
||||
{
|
||||
bandStkBand = 0x10; // 6 meters
|
||||
bandStackBtnClick();
|
||||
}
|
||||
|
||||
void wfmain::on_band10mbtn_clicked()
|
||||
{
|
||||
bandStkBand = 0x09; // 10 meters
|
||||
bandStackBtnClick();
|
||||
}
|
||||
|
||||
void wfmain::on_band12mbtn_clicked()
|
||||
{
|
||||
bandStkBand = 0x08; // 12 meters
|
||||
bandStackBtnClick();
|
||||
}
|
||||
|
||||
void wfmain::on_band15mbtn_clicked()
|
||||
{
|
||||
bandStkBand = 0x07; // 15 meters
|
||||
bandStackBtnClick();
|
||||
}
|
||||
|
||||
void wfmain::on_band17mbtn_clicked()
|
||||
{
|
||||
bandStkBand = 0x06; // 17 meters
|
||||
bandStackBtnClick();
|
||||
}
|
||||
|
||||
void wfmain::on_band20mbtn_clicked()
|
||||
{
|
||||
bandStkBand = 0x05; // 20 meters
|
||||
bandStackBtnClick();
|
||||
}
|
||||
|
||||
void wfmain::on_band30mbtn_clicked()
|
||||
{
|
||||
bandStkBand = 0x04; // 30 meters
|
||||
bandStackBtnClick();
|
||||
}
|
||||
|
||||
void wfmain::on_band40mbtn_clicked()
|
||||
{
|
||||
bandStkBand = 0x03; // 40 meters
|
||||
bandStackBtnClick();
|
||||
}
|
||||
|
||||
void wfmain::on_band60mbtn_clicked()
|
||||
{
|
||||
// This one is tricky. There isn't a band stack register on the
|
||||
// 7300 for 60 meters, so we just drop to the middle of the band:
|
||||
// Channel 1: 5330.5 kHz
|
||||
// Channel 2: 5346.5 kHz
|
||||
// Channel 3: 5357.0 kHz
|
||||
// Channel 4: 5371.5 kHz
|
||||
// Channel 5: 5403.5 kHz
|
||||
// Really not sure what the best strategy here is, don't want to
|
||||
// clutter the UI with 60M channel buttons...
|
||||
setFrequency(5.3305);
|
||||
}
|
||||
|
||||
void wfmain::on_band80mbtn_clicked()
|
||||
{
|
||||
bandStkBand = 0x02; // 80 meters
|
||||
bandStackBtnClick();
|
||||
}
|
||||
|
||||
void wfmain::on_band160mbtn_clicked()
|
||||
{
|
||||
bandStkBand = 0x01; // 160 meters
|
||||
bandStackBtnClick();
|
||||
}
|
||||
|
||||
void wfmain::on_bandGenbtn_clicked()
|
||||
{
|
||||
// "GENE" general coverage frequency outside the ham bands
|
||||
// which does probably include any 60 meter frequencies used.
|
||||
bandStkBand = 0x11; // GEN
|
||||
bandStackBtnClick();
|
||||
}
|
||||
|
||||
void wfmain::on_aboutBtn_clicked()
|
||||
{
|
||||
// Show.....
|
||||
// Build date, time, git checksum (short)
|
||||
// QT library version
|
||||
// stylesheet credit
|
||||
// contact information
|
||||
QString copyright = QString("Copyright 2017, 2018 Elliott H. Liggett. All rights reserved.");
|
||||
QString ssCredit = QString("Stylesheet qdarkstyle used under MIT license, stored in application directory.");
|
||||
QString contact = QString("email the author: kilocharlie8@gmail.com or W6EL on the air!");
|
||||
QString buildInfo = QString("Build XXXX on YYYY-MM-DD at HH:MM by user UUUU");
|
||||
|
||||
QString aboutText = copyright + "\n" + ssCredit + "\n";
|
||||
aboutText.append(contact + "\n" + buildInfo);
|
||||
|
||||
QMessageBox::about(this, "RigView", aboutText);
|
||||
|
||||
// note: should set parent->Icon() and window titles
|
||||
}
|
||||
|
||||
void wfmain::on_aboutQtBtn_clicked()
|
||||
{
|
||||
QMessageBox::aboutQt(this, "Rig View");
|
||||
}
|
||||
|
||||
void wfmain::on_fStoBtn_clicked()
|
||||
{
|
||||
// sequence:
|
||||
// type frequency
|
||||
// press Enter or Go
|
||||
// change mode if desired
|
||||
// press STO
|
||||
// type memory location 0 through 99
|
||||
// press Enter
|
||||
}
|
||||
|
||||
void wfmain::on_fRclBtn_clicked()
|
||||
{
|
||||
// Sequence:
|
||||
// type memory location 0 through 99
|
||||
// press RCL
|
||||
|
||||
// Program recalls data stored in vector at position specified
|
||||
// drop contents into text box, press go button
|
||||
// add delayed command for mode and data mode
|
||||
|
||||
}
|
||||
|
|
43
wfmain.h
43
wfmain.h
|
@ -34,6 +34,8 @@ signals:
|
|||
void getDataMode();
|
||||
void getPTT();
|
||||
void setPTT(bool pttOn);
|
||||
void getBandStackReg(char band, char regCode);
|
||||
void getRfGain();
|
||||
void getDebug();
|
||||
void spectOutputEnable();
|
||||
void spectOutputDisable();
|
||||
|
@ -49,6 +51,8 @@ private slots:
|
|||
void receiveMode(QString);
|
||||
void receiveSpectrumData(QByteArray spectrum, double startFreq, double endFreq);
|
||||
void receivePTTstatus(bool pttOn);
|
||||
void receiveDataModeStatus(bool dataOn);
|
||||
void receiveBandStackReg(float freq, char mode, bool dataOn); // freq, mode, (filter,) datamode
|
||||
void handlePlotClick(QMouseEvent *);
|
||||
void handlePlotDoubleClick(QMouseEvent *);
|
||||
void handleWFClick(QMouseEvent *);
|
||||
|
@ -99,16 +103,44 @@ private slots:
|
|||
|
||||
void on_scopeEdgeCombo_currentIndexChanged(int index);
|
||||
|
||||
void on_modeSelectCombo_currentIndexChanged(int index);
|
||||
// void on_modeSelectCombo_currentIndexChanged(int index);
|
||||
|
||||
void on_useDarkThemeChk_clicked(bool checked);
|
||||
|
||||
void on_modeSelectCombo_activated(int index);
|
||||
|
||||
void on_freqDial_actionTriggered(int action);
|
||||
// void on_freqDial_actionTriggered(int action);
|
||||
|
||||
void on_freqDial_valueChanged(int value);
|
||||
|
||||
void on_band6mbtn_clicked();
|
||||
|
||||
void on_band10mbtn_clicked();
|
||||
|
||||
void on_band12mbtn_clicked();
|
||||
|
||||
void on_band15mbtn_clicked();
|
||||
|
||||
void on_band17mbtn_clicked();
|
||||
|
||||
void on_band20mbtn_clicked();
|
||||
|
||||
void on_band30mbtn_clicked();
|
||||
|
||||
void on_band40mbtn_clicked();
|
||||
|
||||
void on_band60mbtn_clicked();
|
||||
|
||||
void on_band80mbtn_clicked();
|
||||
|
||||
void on_band160mbtn_clicked();
|
||||
|
||||
void on_bandGenbtn_clicked();
|
||||
|
||||
void on_aboutBtn_clicked();
|
||||
|
||||
void on_aboutQtBtn_clicked();
|
||||
|
||||
private:
|
||||
Ui::wfmain *ui;
|
||||
QCustomPlot *plot; // line plot
|
||||
|
@ -151,11 +183,16 @@ private:
|
|||
double oldUpperFreq;
|
||||
double freqMhz;
|
||||
double knobFreqMhz;
|
||||
enum cmds {cmdNone, cmdGetFreq, cmdGetMode, cmdGetDataMode, cmdSetDataModeOn, cmdSetDataModeOff};
|
||||
enum cmds {cmdNone, cmdGetFreq, cmdGetMode, cmdGetDataMode, cmdSetDataModeOn, cmdSetDataModeOff,
|
||||
cmdSpecOn, cmdSpecOff, cmdDispEnable, cmdDispDisable};
|
||||
cmds cmdOut;
|
||||
QVector <cmds> cmdOutQue;
|
||||
int oldFreqDialVal;
|
||||
|
||||
void bandStackBtnClick();
|
||||
bool waitingForBandStackRtn;
|
||||
char bandStkBand;
|
||||
char bandStkRegCode;
|
||||
};
|
||||
|
||||
#endif // WFMAIN_H
|
||||
|
|
100
wfmain.ui
100
wfmain.ui
|
@ -6,7 +6,7 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>583</width>
|
||||
<width>589</width>
|
||||
<height>582</height>
|
||||
</rect>
|
||||
</property>
|
||||
|
@ -18,7 +18,7 @@
|
|||
<item>
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
<number>1</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="mainTab">
|
||||
<attribute name="title">
|
||||
|
@ -305,7 +305,7 @@
|
|||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_8">
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_3">
|
||||
<widget class="QPushButton" name="band6mbtn">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
|
||||
<horstretch>0</horstretch>
|
||||
|
@ -315,10 +315,13 @@
|
|||
<property name="text">
|
||||
<string>6M</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>6</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_5">
|
||||
<widget class="QPushButton" name="band10mbtn">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
|
||||
<horstretch>0</horstretch>
|
||||
|
@ -328,10 +331,13 @@
|
|||
<property name="text">
|
||||
<string>10M</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>1</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_20">
|
||||
<widget class="QPushButton" name="band12mbtn">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
|
||||
<horstretch>0</horstretch>
|
||||
|
@ -341,6 +347,9 @@
|
|||
<property name="text">
|
||||
<string>12M</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>T</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
|
@ -348,7 +357,7 @@
|
|||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_9">
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_21">
|
||||
<widget class="QPushButton" name="band15mbtn">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
|
||||
<horstretch>0</horstretch>
|
||||
|
@ -358,10 +367,13 @@
|
|||
<property name="text">
|
||||
<string>15M</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>5</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_23">
|
||||
<widget class="QPushButton" name="band17mbtn">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
|
||||
<horstretch>0</horstretch>
|
||||
|
@ -371,10 +383,13 @@
|
|||
<property name="text">
|
||||
<string>17M</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>7</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_22">
|
||||
<widget class="QPushButton" name="band20mbtn">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
|
||||
<horstretch>0</horstretch>
|
||||
|
@ -384,6 +399,9 @@
|
|||
<property name="text">
|
||||
<string>20M</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>2</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
|
@ -391,7 +409,7 @@
|
|||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_10">
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_24">
|
||||
<widget class="QPushButton" name="band30mbtn">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
|
||||
<horstretch>0</horstretch>
|
||||
|
@ -404,7 +422,7 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_25">
|
||||
<widget class="QPushButton" name="band40mbtn">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
|
||||
<horstretch>0</horstretch>
|
||||
|
@ -414,10 +432,13 @@
|
|||
<property name="text">
|
||||
<string>40M</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>4</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_26">
|
||||
<widget class="QPushButton" name="band60mbtn">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
|
||||
<horstretch>0</horstretch>
|
||||
|
@ -427,6 +448,9 @@
|
|||
<property name="text">
|
||||
<string>60M</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>S</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
|
@ -434,7 +458,7 @@
|
|||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_11">
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_27">
|
||||
<widget class="QPushButton" name="band80mbtn">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
|
||||
<horstretch>0</horstretch>
|
||||
|
@ -444,10 +468,13 @@
|
|||
<property name="text">
|
||||
<string>80M</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>8</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_28">
|
||||
<widget class="QPushButton" name="band160mbtn">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
|
||||
<horstretch>0</horstretch>
|
||||
|
@ -457,10 +484,13 @@
|
|||
<property name="text">
|
||||
<string>160M</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>L</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_29">
|
||||
<widget class="QPushButton" name="bandGenbtn">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
|
||||
<horstretch>0</horstretch>
|
||||
|
@ -468,7 +498,10 @@
|
|||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Broadcast</string>
|
||||
<string>Gen</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>G</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -505,6 +538,25 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="bandStkPopdown">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>0 - Latest Used</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>1 - Older</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>2 - Oldest Used</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="radioButton_3">
|
||||
<property name="text">
|
||||
|
@ -986,7 +1038,7 @@
|
|||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>CIV Address (decimal)</string>
|
||||
<string>Radio CIV Address (decimal)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -1084,6 +1136,20 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="aboutBtn">
|
||||
<property name="text">
|
||||
<string>About</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="aboutQtBtn">
|
||||
<property name="text">
|
||||
<string>About Qt</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_5">
|
||||
<property name="orientation">
|
||||
|
@ -1123,7 +1189,7 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>583</width>
|
||||
<width>589</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
|
|
Ładowanie…
Reference in New Issue