Merge branch 'sequence'

audioplugins
Roeland Jansen 2021-06-18 15:18:45 +02:00
commit 6749b5d695
7 zmienionych plików z 183 dodań i 28 usunięć

Wyświetl plik

@ -118,8 +118,16 @@ void commHandler::receiveDataIn()
}
}
if(inPortData.startsWith("\xFE\xFE"))
{
if(inPortData.contains("\xFC"))
{
//qInfo(logSerial()) << "Transaction contains collision data. Dumping.";
//printHex(inPortData, false, true);
port->commitTransaction();
return;
}
if(inPortData.endsWith("\xFD"))
{
// good!

Wyświetl plik

@ -1090,6 +1090,12 @@ void rigCommander::parseData(QByteArray dataInput)
// payload = getpayload(data); // or something
// parse (payload); // recursive ok?
payloadIn = data.right(data.length() - 4);
if(payloadIn.contains("\xFE"))
{
//qDebug(logRig()) << "Corrupted data contains FE within message body: ";
//printHex(payloadIn);
break;
}
parseCommand();
break;
case '\x00':
@ -1100,9 +1106,15 @@ void rigCommander::parseData(QByteArray dataInput)
// This is an echo of our own broadcast request.
// The data are "to 00" and "from E1"
// Don't use it!
qDebug(logRig()) << "Caught it! Found the echo'd broadcast request from us!";
qDebug(logRig()) << "Caught it! Found the echo'd broadcast request from us! Rig has not responded to broadcast query yet.";
} else {
payloadIn = data.right(data.length() - 4);
payloadIn = data.right(data.length() - 4); // Removes FE FE E0 94 part
if(payloadIn.contains("\xFE"))
{
//qDebug(logRig()) << "Corrupted data contains FE within message body: ";
//printHex(payloadIn);
break;
}
parseCommand();
}
break;
@ -1320,9 +1332,9 @@ void rigCommander::parseLevels()
break;
default:
qInfo(logRig()) << "Unknown control level (0x14) received at register " << payloadIn[1] << " with level " << level;
qInfo(logRig()) << "Unknown control level (0x14) received at register " << QString("0x%1").arg((int)payloadIn[1],2,16) << " with level " << QString("0x%1").arg((int)level,2,16) << ", int=" << (int)level;
printHex(payloadIn);
break;
}
return;
}
@ -2947,6 +2959,25 @@ void rigCommander::determineRigCaps()
rigCaps.modes = commonModes;
rigCaps.modes.insert(rigCaps.modes.end(), createMode(modeWFM, 0x06, "WFM"));
break;
case model718:
rigCaps.modelName = QString("IC-718");
rigCaps.hasSpectrum = false;
rigCaps.inputs.clear();
rigCaps.hasLan = false;
rigCaps.hasEthernet = false;
rigCaps.hasWiFi = false;
rigCaps.hasATU = false;
rigCaps.attenuators.push_back('\x20');
rigCaps.preamps.push_back('\x01');
rigCaps.bands = {band10m, band10m, band12m,
band15m, band17m, band20m, band30m,
band40m, band60m, band80m, band160m, bandGen};
rigCaps.modes = { createMode(modeLSB, 0x00, "LSB"), createMode(modeUSB, 0x01, "USB"),
createMode(modeAM, 0x02, "AM"),
createMode(modeCW, 0x03, "CW"), createMode(modeCW_R, 0x07, "CW-R"),
createMode(modeRTTY, 0x04, "RTTY"), createMode(modeRTTY_R, 0x08, "RTTY-R")
};
break;
case model756pro:
rigCaps.modelName = QString("IC-756 Pro");
rigCaps.hasSpectrum = false;

Wyświetl plik

@ -52,6 +52,9 @@ model_kind determineRadioModel(unsigned char rigID)
case model705:
rig = model705;
break;
case model718:
rig = model718;
break;
case model756proiii:
rig = model756proiii;
break;

Wyświetl plik

@ -28,6 +28,7 @@ enum model_kind {
model9700 = 0xA2,
model705 = 0xA4,
model706 = 0x58,
model718 = 0x5E,
model756pro = 0x5C,
model756proii = 0x64,
model756proiii = 0x6E,

Wyświetl plik

@ -160,6 +160,7 @@ void wfmain::openRig()
if (prefs.enableLAN)
{
ui->lanEnableBtn->setChecked(true);
usingLAN = true;
// We need to setup the tx/rx audio:
emit sendCommSetup(prefs.radioCIVAddr, udpPrefs, rxSetup, txSetup, prefs.virtualSerialPort);
} else {
@ -176,10 +177,7 @@ void wfmain::openRig()
serialPortRig = serialPortCL;
}
}
// Here, the radioCIVAddr is being set from a default preference, which is for the 7300.
// However, we will not use it initially. OTOH, if it is set explicitedly to a value in the prefs,
// then we skip auto detection.
usingLAN = false;
emit sendCommSetup(prefs.radioCIVAddr, serialPortRig, prefs.serialPortBaud,prefs.virtualSerialPort);
}
@ -455,7 +453,13 @@ void wfmain::findSerialPort()
void wfmain::receiveCommReady()
{
qInfo(logSystem()) << "Received CommReady!! ";
// taken from above:
if(!usingLAN)
{
// usingLAN gets set when we emit the sendCommSetup signal.
// If we're not using the LAN, then we're on serial, and
// we already know the baud rate and can calculate the timing parameters.
calculateTimingParameters();
}
if(prefs.radioCIVAddr == 0)
{
// tell rigCommander to broadcast a request for all rig IDs.
@ -484,7 +488,6 @@ void wfmain::receiveFoundRigID(rigCapabilities rigCaps)
if(rig->usingLAN())
{
usingLAN = true;
//delayedCommand->setInterval(delayedCmdIntervalLAN_ms);
} else {
usingLAN = false;
}
@ -693,6 +696,54 @@ void wfmain::setupMainUI()
ui->tuneLockChk->setChecked(false);
freqLock = false;
connect(ui->tabWidget, SIGNAL(currentChanged(int)), this, SLOT(updateSizes(int)));
}
void wfmain::updateSizes(int tabIndex)
{
// This function does nothing unless you are using a rig without spectrum.
// This is a hack. It is not great, but it seems to work ok.
if(!rigCaps.hasSpectrum)
{
// Set "ignore" size policy for non-selected tabs:
for(int i=0;i<ui->tabWidget->count();i++)
if((i!=tabIndex) && tabIndex != 0)
ui->tabWidget->widget(i)->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored); // allows size to be any size that fits the tab bar
if(tabIndex==0 && !rigCaps.hasSpectrum)
{
ui->tabWidget->widget(0)->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
ui->tabWidget->widget(0)->setMaximumSize(ui->tabWidget->widget(0)->minimumSizeHint());
ui->tabWidget->widget(0)->adjustSize(); // tab
this->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
this->setMaximumSize(QSize(929, 270));
this->setMinimumSize(QSize(929, 270));
resize(minimumSize());
adjustSize(); // main window
adjustSize();
} else if(tabIndex==0 && rigCaps.hasSpectrum) {
// At main tab (0) and we have spectrum:
ui->tabWidget->widget(0)->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
resize(minimumSizeHint());
adjustSize(); // Without this call, the window retains the size of the previous tab.
} else {
// At some other tab, with or without spectrum:
ui->tabWidget->widget(tabIndex)->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
this->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
this->setMinimumSize(QSize(994, 455)); // not large enough for settings tab
this->setMaximumSize(QSize(65535,65535));
}
} else {
ui->tabWidget->widget(tabIndex)->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
ui->tabWidget->widget(tabIndex)->setMaximumSize(65535,65535);
//ui->tabWidget->widget(0)->setMinimumSize();
}
}
void wfmain::getSettingsFilePath(QString settingsFile)
@ -724,7 +775,7 @@ void wfmain::getSettingsFilePath(QString settingsFile)
void wfmain::setInitialTiming()
{
delayedCmdIntervalLAN_ms = 10; // interval for regular delayed commands, including initial rig/UI state queries
delayedCmdIntervalLAN_ms = 70; // interval for regular delayed commands, including initial rig/UI state queries
delayedCmdIntervalSerial_ms = 100; // interval for regular delayed commands, including initial rig/UI state queries
delayedCmdStartupInterval_ms = 250; // interval for rigID polling
delayedCommand = new QTimer(this);
@ -1036,6 +1087,10 @@ void wfmain::setupKeyShortcuts()
keyM = new QShortcut(this);
keyM->setKey(Qt::Key_M);
connect(keyM, SIGNAL(activated()), this, SLOT(shortcutM()));
keyDebug = new QShortcut(this);
keyDebug->setKey(Qt::CTRL + Qt::SHIFT + Qt::Key_D);
connect(keyDebug, SIGNAL(activated()), this, SLOT(on_debugBtn_clicked()));
}
void wfmain::setDefPrefs()
@ -1491,6 +1546,48 @@ void wfmain::saveSettings()
}
void wfmain::showHideSpectrum(bool show)
{
if(show)
{
wf->show();
plot->show();
} else {
wf->hide();
plot->hide();
}
// Controls:
ui->spectrumGroupBox->setVisible(show);
ui->spectrumModeCombo->setVisible(show);
ui->scopeBWCombo->setVisible(show);
ui->scopeEdgeCombo->setVisible(show);
ui->scopeEnableWFBtn->setVisible(show);
ui->scopeRefLevelSlider->setEnabled(show);
ui->wfLengthSlider->setEnabled(show);
ui->wfthemeCombo->setVisible(show);
ui->toFixedBtn->setVisible(show);
ui->clearPeakBtn->setVisible(show);
// And the labels:
ui->specEdgeLabel->setVisible(show);
ui->specModeLabel->setVisible(show);
ui->specSpanLabel->setVisible(show);
ui->specThemeLabel->setVisible(show);
// And the layout for space:
ui->specControlsHorizLayout->setEnabled(show);
ui->splitter->setVisible(show);
ui->plot->setVisible(show);
ui->waterfall->setVisible(show);
ui->spectrumGroupBox->setEnabled(show);
// Window resize:
updateSizes(ui->tabWidget->currentIndex());
}
void wfmain::prepareWf()
{
prepareWf(160);
@ -1502,10 +1599,17 @@ void wfmain::prepareWf(unsigned int wfLength)
if(haveRigCaps)
{
showHideSpectrum(rigCaps.hasSpectrum);
if(!rigCaps.hasSpectrum)
{
return;
}
// TODO: Lock the function that draws on the spectrum while we are updating.
spectrumDrawLock = true;
spectWidth = rigCaps.spectLenMax;
wfLengthMax = 1024;
this->wfLength = wfLength; // fixed for now, time-length of waterfall
// Initialize before use!
@ -1513,17 +1617,21 @@ void wfmain::prepareWf(unsigned int wfLength)
QByteArray empty((int)spectWidth, '\x01');
spectrumPeaks = QByteArray( (int)spectWidth, '\x01' );
if((unsigned int)wfimage.size() < wfLength)
//wfimage.resize(wfLengthMax);
if((unsigned int)wfimage.size() < wfLengthMax)
{
unsigned int i=0;
unsigned int oldSize = wfimage.size();
for(i=oldSize; i<(wfLength); i++)
for(i=oldSize; i<(wfLengthMax); i++)
{
wfimage.append(empty);
}
} else {
wfimage.remove(wfLength, wfimage.size()-wfLength);
// Keep wfimage, do not trim, no performance impact.
//wfimage.remove(wfLength, wfimage.size()-wfLength);
}
wfimage.squeeze();
//colorMap->clearData();
colorMap->data()->clear();
@ -1544,7 +1652,6 @@ void wfmain::prepareWf(unsigned int wfLength)
wf->yAxis->setRangeReversed(true);
wf->xAxis->setVisible(false);
rigName->setText(rigCaps.modelName);
spectrumDrawLock = false;
} else {
@ -2429,6 +2536,7 @@ void wfmain::receiveRigID(rigCapabilities rigCaps)
qDebug(logSystem()) << "Rig ID received into wfmain: hasSpectrum: " << rigCaps.hasSpectrum;
this->rigCaps = rigCaps;
rigName->setText(rigCaps.modelName);
this->spectWidth = rigCaps.spectLenMax; // used once haveRigCaps is true.
haveRigCaps = true;
// Added so that server receives rig capabilities.
@ -2687,10 +2795,8 @@ void wfmain::receiveSpectrumData(QByteArray spectrum, double startFreq, double e
if(specLen == spectWidth)
{
wfimage.prepend(spectrum);
if(wfimage.length() > wfLength)
{
wfimage.remove(wfLength);
}
wfimage.resize(wfLengthMax);
wfimage.squeeze();
// Waterfall:
for(int row = 0; row < wfLength; row++)
@ -3783,6 +3889,7 @@ void wfmain::on_connectBtn_clicked()
emit sendCloseComm();
ui->connectBtn->setText("Connect");
haveRigCaps = false;
rigName->setText("NONE");
}
else
{
@ -4350,7 +4457,7 @@ void wfmain::calculateTimingParameters()
msMinTiming = 35;
delayedCommand->setInterval( msMinTiming * 2); // 20 byte message
periodicPollingTimer->setInterval( msMinTiming ); // slower for s-meter poll
periodicPollingTimer->setInterval( msMinTiming ); // quicker for s-meter poll
qInfo(logSystem()) << "Delay command interval timing: " << msMinTiming * 2 << "ms";
qInfo(logSystem()) << "Periodic polling timer: " << msMinTiming << "ms";
@ -4605,6 +4712,6 @@ void wfmain::on_wfLengthSlider_valueChanged(int value)
void wfmain::on_debugBtn_clicked()
{
qInfo(logSystem()) << "Debug button pressed.";
prepareWf(160);
emit getFrequency();
}

Wyświetl plik

@ -144,6 +144,7 @@ signals:
void sendRigCaps(rigCapabilities caps);
private slots:
void updateSizes(int tabIndex);
void shortcutF1();
void shortcutF2();
void shortcutF3();
@ -462,6 +463,7 @@ private:
void setPlotTheme(QCustomPlot *plot, bool isDark);
void prepareWf();
void prepareWf(unsigned int wfLength);
void showHideSpectrum(bool show);
void getInitialRigState();
void setBandButtons();
void showButton(QPushButton *btn);
@ -509,6 +511,8 @@ private:
QShortcut *keyF;
QShortcut *keyM;
QShortcut *keyDebug;
rigCommander * rig=Q_NULLPTR;
QThread* rigThread = Q_NULLPTR;
@ -557,6 +561,7 @@ private:
int smeterPos=0;
QVector <QByteArray> wfimage;
unsigned int wfLengthMax;
bool onFullscreen;
bool drawPeaks;

Wyświetl plik

@ -26,7 +26,7 @@
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QGroupBox" name="groupBox">
<widget class="QGroupBox" name="spectrumGroupBox">
<property name="title">
<string>Spectrum</string>
</property>
@ -44,12 +44,12 @@
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_13">
<layout class="QHBoxLayout" name="specControlsHorizLayout">
<property name="topMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="label_26">
<widget class="QLabel" name="specModeLabel">
<property name="text">
<string>Spectrum Mode: </string>
</property>
@ -66,7 +66,7 @@
</widget>
</item>
<item>
<widget class="QLabel" name="label_6">
<widget class="QLabel" name="specSpanLabel">
<property name="text">
<string>Span:</string>
</property>
@ -86,7 +86,7 @@
</widget>
</item>
<item>
<widget class="QLabel" name="label_7">
<widget class="QLabel" name="specEdgeLabel">
<property name="text">
<string>Edge</string>
</property>
@ -133,7 +133,7 @@
</widget>
</item>
<item>
<widget class="QLabel" name="label_31">
<widget class="QLabel" name="specThemeLabel">
<property name="text">
<string>Theme:</string>
</property>
@ -150,7 +150,7 @@
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<spacer name="specHorizSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>