Merge remote-tracking branch 'origin/ui-enhance' into lan-alpha

merge-requests/2/head
Phil Taylor 2021-02-11 19:47:29 +00:00
commit 20e681dc91
17 zmienionych plików z 847 dodań i 29 usunięć

27
CHANGELOG 100644
Wyświetl plik

@ -0,0 +1,27 @@
# CHANGELOG
- 20210210 added control over LAN for rigs that support it
has been tested on the 705, 7610, 785x, 9700.
should work on 7700, 7800, other rigs.
added different sampling rates for rx
added different codecs
added scope data for 7610, 785x.
several cosmetic changes in the UI
fixed a slew of bugs
builds on MAC-OS, Linux, Windows
added ToFixed
implemented connect/disconnect rig
improved USB serial code
fixed memory leak
redesigned rx audio path for better performance
added round trip time for network connected devices
added detection code of rigtype
automatic detection of CIV control address
added logfile capability
works on a raspberry pi (USB and ethernet)

Wyświetl plik

@ -53,6 +53,8 @@ sudo chown $USER /dev/ttyUSB*
- most linux systems just need to have you added to the dialout group as that's persistent and more secure.
sudo usermod -aG dialout $USER
(don't forget to log out and log in)
### opensuse install ###

Wyświetl plik

@ -0,0 +1,76 @@
#include "calibrationwindow.h"
#include "ui_calibrationwindow.h"
calibrationWindow::calibrationWindow(QWidget *parent) :
QDialog(parent),
ui(new Ui::calibrationWindow)
{
ui->setupUi(this);
ui->calCourseSlider->setDisabled(true);
ui->calCourseSpinbox->setDisabled(true);
ui->calFineSlider->setDisabled(true);
ui->calFineSpinbox->setDisabled(true);
}
calibrationWindow::~calibrationWindow()
{
delete ui;
}
void calibrationWindow::handleCurrentFreq(double tunedFreq)
{
(void)tunedFreq;
}
void calibrationWindow::handleSpectrumPeak(double peakFreq)
{
(void)peakFreq;
}
void calibrationWindow::handleRefAdjustCourse(unsigned char value)
{
ui->calCourseSlider->setDisabled(false);
ui->calCourseSpinbox->setDisabled(false);
ui->calCourseSlider->blockSignals(true);
ui->calCourseSpinbox->blockSignals(true);
ui->calCourseSlider->setValue((int) value);
ui->calCourseSpinbox->setValue((int) value);
ui->calCourseSlider->blockSignals(false);
ui->calCourseSpinbox->blockSignals(false);
}
void calibrationWindow::handleRefAdjustFine(unsigned char value)
{
ui->calFineSlider->setDisabled(false);
ui->calFineSpinbox->setDisabled(false);
ui->calFineSlider->blockSignals(true);
ui->calFineSpinbox->blockSignals(true);
ui->calFineSlider->setValue((int) value);
ui->calFineSpinbox->setValue((int) value);
ui->calFineSlider->blockSignals(false);
ui->calFineSpinbox->blockSignals(false);
}
void calibrationWindow::on_calReadRigCalBtn_clicked()
{
emit requestRefAdjustCourse();
emit requestRefAdjustFine();
}
void calibrationWindow::on_calCourseSlider_valueChanged(int value)
{
emit setRefAdjustCourse((unsigned char) value);
}
void calibrationWindow::on_calFineSlider_valueChanged(int value)
{
emit setRefAdjustFine((unsigned char) value);
}

Wyświetl plik

@ -0,0 +1,43 @@
#ifndef CALIBRATIONWINDOW_H
#define CALIBRATIONWINDOW_H
#include <QDialog>
namespace Ui {
class calibrationWindow;
}
class calibrationWindow : public QDialog
{
Q_OBJECT
public:
explicit calibrationWindow(QWidget *parent = 0);
~calibrationWindow();
public slots:
void handleSpectrumPeak(double peakFreq);
void handleCurrentFreq(double tunedFreq);
void handleRefAdjustCourse(unsigned char);
void handleRefAdjustFine(unsigned char);
signals:
void requestSpectrumPeak(double peakFreq);
void requestCurrentFreq(double tunedFreq);
void requestRefAdjustCourse();
void requestRefAdjustFine();
void setRefAdjustCourse(unsigned char);
void setRefAdjustFine(unsigned char);
private slots:
void on_calReadRigCalBtn_clicked();
void on_calCourseSlider_valueChanged(int value);
void on_calFineSlider_valueChanged(int value);
private:
Ui::calibrationWindow *ui;
};
#endif // CALIBRATIONWINDOW_H

Wyświetl plik

@ -0,0 +1,280 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>calibrationWindow</class>
<widget class="QDialog" name="calibrationWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<widget class="QWidget" name="verticalLayoutWidget">
<property name="geometry">
<rect>
<x>9</x>
<y>9</y>
<width>381</width>
<height>281</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLabel" name="label_3">
<property name="text">
<string>IC-9700</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_4">
<property name="text">
<string>Reference Adjustment</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QLabel" name="label_7">
<property name="text">
<string>Peak</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="calPeakFreqLabel">
<property name="text">
<string>446.000125</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QLabel" name="label_6">
<property name="text">
<string>Tune</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="calTuneFreqLabel">
<property name="text">
<string>446.00000</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<widget class="QLabel" name="label_5">
<property name="text">
<string>Delta</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="calDeltaFreqLabel">
<property name="text">
<string>-0.125</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<layout class="QVBoxLayout" name="verticalLayout_5">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Course</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>Fine</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_8">
<property name="rightMargin">
<number>10</number>
</property>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_6">
<item>
<widget class="QSlider" name="calCourseSlider">
<property name="maximum">
<number>255</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="QSlider" name="calFineSlider">
<property name="maximum">
<number>255</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_9">
<property name="leftMargin">
<number>10</number>
</property>
<property name="rightMargin">
<number>10</number>
</property>
<item>
<widget class="QSpinBox" name="calCourseSpinbox">
<property name="maximum">
<number>255</number>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="calFineSpinbox">
<property name="maximum">
<number>255</number>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="topMargin">
<number>0</number>
</property>
<item>
<widget class="QPushButton" name="calSaveSlotBtn">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Save the calibration data to the indicated slot in the preference file. &lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Save</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="calLoadSlotBtn">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Load the calibration data fromthe indicated slot in the preference file. &lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Load</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_11">
<property name="text">
<string>Slot:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBox">
<item>
<property name="text">
<string>1</string>
</property>
</item>
<item>
<property name="text">
<string>2</string>
</property>
</item>
<item>
<property name="text">
<string>3</string>
</property>
</item>
<item>
<property name="text">
<string>4</string>
</property>
</item>
<item>
<property name="text">
<string>5</string>
</property>
</item>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<widget class="QPushButton" name="calReadRigCalBtn">
<property name="text">
<string>Read Current Rig Calibration</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
<resources/>
<connections/>
</ui>

Wyświetl plik

@ -28,7 +28,8 @@ int main(int argc, char *argv[])
QString currentArg;
const QString helpText = QString("Usage: -p --port /dev/port, -h --host remotehostname, -c --civ 0xAddr, -l --logfile filename.log"); // TODO...
const QString helpText = QString("\nUsage: -p --port /dev/port, -h --host remotehostname, -c --civ 0xAddr, -l --logfile filename.log\n"); // TODO...
for(int c=1; c<argc; c++)
{
@ -72,7 +73,8 @@ int main(int argc, char *argv[])
} else {
std::cout << "Unrecognized option: " << currentArg.toStdString();
std::cout << helpText.toStdString();
return -1;
return -1;
}
}

Wyświetl plik

@ -843,6 +843,11 @@ void rigCommander::getSql()
prepDataAndSend(payload);
}
void rigCommander::setSquelch(unsigned char level)
{
sendLevelCmd(0x03, level);
}
void rigCommander::setRfGain(unsigned char level)
{
sendLevelCmd(0x02, level);
@ -853,6 +858,26 @@ void rigCommander::setAfGain(unsigned char level)
sendLevelCmd(0x01, level);
}
void rigCommander::setRefAdjustCourse(unsigned char level)
{
// 1A 05 00 72 0000-0255
QByteArray payload;
payload.setRawData("\x1A\x05\x00\x72", 4);
payload.append(bcdEncodeInt((unsigned int)level));
prepDataAndSend(payload);
}
void rigCommander::setRefAdjustFine(unsigned char level)
{
qDebug() << __FUNCTION__ << " level: " << level;
// 1A 05 00 73 0000-0255
QByteArray payload;
payload.setRawData("\x1A\x05\x00\x73", 4);
payload.append(bcdEncodeInt((unsigned int)level));
prepDataAndSend(payload);
}
void rigCommander::sendLevelCmd(unsigned char levAddr, unsigned char level)
{
QByteArray payload("\x14");
@ -871,6 +896,22 @@ void rigCommander::sendLevelCmd(unsigned char levAddr, unsigned char level)
prepDataAndSend(payload);
}
void rigCommander::getRefAdjustCourse()
{
// 1A 05 00 72
QByteArray payload;
payload.setRawData("\x1A\x05\x00\x72", 4);
prepDataAndSend(payload);
}
void rigCommander::getRefAdjustFine()
{
// 1A 05 00 73
QByteArray payload;
payload.setRawData("\x1A\x05\x00\x73", 4);
prepDataAndSend(payload);
}
void rigCommander::parseRegisters1C()
{
// PTT lives here
@ -991,6 +1032,28 @@ void rigCommander::parseBandStackReg()
void rigCommander::parseDetailedRegisters1A05()
{
// It seems a lot of misc stuff is under this command and subcommand.
// 1A 05 ...
// 00 01 02 03 04 ...
// 02 and 03 make up a BCD'd number:
// 0001, 0002, 0003, ... 0101, 0102, 0103...
int subcmd = bcdHexToDecimal(payloadIn[3]) + (10*bcdHexToDecimal(payloadIn[2]));
switch(subcmd)
{
case 72:
// course reference
emit haveRefAdjustCourse( bcdHexToDecimal(payloadIn[5]) + (10*bcdHexToDecimal(payloadIn[6])) );
break;
case 73:
// fine reference
emit haveRefAdjustFine( bcdHexToDecimal(payloadIn[5]) + (10*bcdHexToDecimal(payloadIn[6])) );
break;
default:
break;
}
}
void rigCommander::parseWFData()
@ -1055,6 +1118,7 @@ void rigCommander::parseWFData()
void rigCommander::determineRigCaps()
{
//TODO: Add if(usingNativeLAN) condition
//TODO: Add "hasDD", "hasDV" for d-star (705 and 9700)
//TODO: Determine available bands (low priority, rig will reject out of band requests anyway)
@ -1062,6 +1126,9 @@ void rigCommander::determineRigCaps()
rigCaps.modelID = model; // may delete later
rigCaps.civ = incomingCIVAddr;
rigCaps.hasDD = false;
rigCaps.hasDV = false;
switch(model){
case model7300:
rigCaps.modelName = QString("IC-7300");
@ -1082,6 +1149,8 @@ void rigCommander::determineRigCaps()
rigCaps.hasLan = true;
rigCaps.hasEthernet = true;
rigCaps.hasWiFi = false;
rigCaps.hasDD = true;
rigCaps.hasDV = true;
break;
case model7610:
rigCaps.modelName = QString("IC-7610");
@ -1112,9 +1181,11 @@ void rigCommander::determineRigCaps()
rigCaps.hasLan = true;
rigCaps.hasEthernet = false;
rigCaps.hasWiFi = true;
rigCaps.hasDD = true;
rigCaps.hasDV = true;
break;
default:
rigCaps.modelName = QString("IC-unknown");
rigCaps.modelName = QString("IC-RigID: 0x%1").arg(rigCaps.model, 0, 16);
rigCaps.hasSpectrum = false;
rigCaps.spectSeqMax = 0;
rigCaps.spectAmpMax = 0;
@ -1122,6 +1193,7 @@ void rigCommander::determineRigCaps()
rigCaps.hasLan = false;
rigCaps.hasEthernet = false;
rigCaps.hasWiFi = false;
qDebug() << "Found unknown rig: " << rigCaps.modelName;
break;
}
@ -1252,14 +1324,6 @@ void rigCommander::parseSpectrum()
//qDebug() << "sequence: " << sequence << " spec index: " << (sequence-2)*55 << " payloadPosition: " << payloadIn.length() - 5 << " payload length: " << payloadIn.length();
emit haveSpectrumData(spectrumLine, spectrumStartFreq, spectrumEndFreq);
}
/*
if(spectrumLine.length() != 475)
{
qDebug() << "Unusual length spectrum: " << spectrumLine.length();
printHex(spectrumLine, false, true);
}
*/
}
unsigned char rigCommander::bcdHexToDecimal(unsigned char in)
@ -1270,6 +1334,49 @@ unsigned char rigCommander::bcdHexToDecimal(unsigned char in)
return out;
}
unsigned char rigCommander::bcdHexToDecimal(unsigned char hundreds, unsigned char tensunits)
{
// convert:
// hex data: 0x01 0x23
// convert to uchar:
// uchar: 123
// unsigned char thousands = hundreds / 100;
unsigned char rtnVal;
rtnVal = (hundreds & 0x0f)*100;
rtnVal += ((tensunits & 0xf0)>>4)*10;
rtnVal += (tensunits & 0x0f);
return rtnVal;
}
QByteArray rigCommander::bcdEncodeInt(unsigned int num)
{
if(num > 9999)
{
qDebug() << __FUNCTION__ << "Error, number is too big for four-digit conversion: " << num;
return QByteArray();
}
char thousands = num / 1000;
char hundreds = (num - (1000*thousands)) / 100;
char tens = (num - (1000*thousands) - (100*hundreds)) / 10;
char units = (num - (1000*thousands) - (100*hundreds) - (10*tens));
char b0 = hundreds | (thousands << 4);
char b1 = units | (tens << 4);
qDebug() << __FUNCTION__ << " encoding value " << num << " as hex:";
//printHex(QByteArray(b0), false, true);
//printHex(QByteArray(b1), false, true);
QByteArray result;
result.append(b0).append(b1);
qDebug() << "Result: " << result;
return result;
}
void rigCommander::parseFrequency()
{
// process payloadIn, which is stripped.
@ -1375,6 +1482,12 @@ void rigCommander::parseMode()
case '\x08':
mode = "RTTY-R";
break;
case '\x17':
mode = "DV";
break;
case '\x22':
mode = "DD";
break;
default:
qDebug() << "Mode: Unknown: " << payloadIn[01];
printHex(payloadIn, false, true);

Wyświetl plik

@ -55,6 +55,7 @@ public slots:
void getRfGain();
void getAfGain();
void getSql();
void setSquelch(unsigned char level);
void setRfGain(unsigned char level);
void setAfGain(unsigned char level);
void startATU();
@ -63,6 +64,10 @@ public slots:
void getRigID();
void findRigs();
void setCIVAddr(unsigned char civAddr);
void getRefAdjustCourse();
void getRefAdjustFine();
void setRefAdjustCourse(unsigned char level);
void setRefAdjustFine(unsigned char level);
void handleNewData(const QByteArray &data);
void handleSerialPortError(const QString port, const QString errorText);
void handleStatusUpdate(const QString text);
@ -91,6 +96,9 @@ signals:
void haveAfGain(unsigned char level);
void haveSql(unsigned char level);
void haveTxPower(unsigned char level);
void thing();
void haveRefAdjustCourse(unsigned char level);
void haveRefAdjustFine(unsigned char level);
void dataForComm(const QByteArray &outData);
void getMoreDebug();
void finished();
@ -105,6 +113,8 @@ private:
void parseData(QByteArray data); // new data come here
void parseCommand();
unsigned char bcdHexToDecimal(unsigned char in);
unsigned char bcdHexToDecimal(unsigned char hundreds, unsigned char tensunits);
QByteArray bcdEncodeInt(unsigned int);
void parseFrequency();
float parseFrequency(QByteArray data, unsigned char lastPosition); // supply index where Mhz is found
QByteArray makeFreqPayload(double frequency);

Wyświetl plik

@ -43,6 +43,9 @@ struct rigCapabilities {
quint16 spectAmpMax;
quint16 spectLenMax;
bool hasDD;
bool hasDV;
};

104
rxaudiohandler.cpp 100644
Wyświetl plik

@ -0,0 +1,104 @@
#include "rxaudiohandler.h"
rxAudioHandler::rxAudioHandler()
{
}
rxAudioHandler::~rxAudioHandler()
{
audio->stop();
delete audio;
}
void rxAudioHandler::process()
{
qDebug() << "rxAudio Handler created.";
}
void rxAudioHandler::setup(const QAudioFormat format, const quint16 bufferSize, const bool isUlaw)
{
this->format = format;
this->bufferSize = bufferSize;
this->isUlaw = isUlaw;
audio = new QAudioOutput(format);
audio->setBufferSize(bufferSize);
device = audio->start();
}
void rxAudioHandler::incomingAudio(const QByteArray data)
{
QMutexLocker locker(&mutex);
if (isUlaw) {
device->write(uLawDecode(data));
}
else {
device->write(data, data.length());
}
}
void rxAudioHandler::changeBufferSize(const quint16 newSize)
{
QMutexLocker locker(&mutex);
qDebug() << "Changing buffer size to: " << newSize << " from " << audio->bufferSize();
audio->stop();
audio->setBufferSize(newSize);
device = audio->start();
}
void rxAudioHandler::getBufferSize()
{
emit sendBufferSize(audio->bufferSize());
}
QByteArray rxAudioHandler::uLawDecode(const QByteArray in)
{
static const qint16 ulaw_decode[256] = {
-32124, -31100, -30076, -29052, -28028, -27004, -25980, -24956,
-23932, -22908, -21884, -20860, -19836, -18812, -17788, -16764,
-15996, -15484, -14972, -14460, -13948, -13436, -12924, -12412,
-11900, -11388, -10876, -10364, -9852, -9340, -8828, -8316,
-7932, -7676, -7420, -7164, -6908, -6652, -6396, -6140,
-5884, -5628, -5372, -5116, -4860, -4604, -4348, -4092,
-3900, -3772, -3644, -3516, -3388, -3260, -3132, -3004,
-2876, -2748, -2620, -2492, -2364, -2236, -2108, -1980,
-1884, -1820, -1756, -1692, -1628, -1564, -1500, -1436,
-1372, -1308, -1244, -1180, -1116, -1052, -988, -924,
-876, -844, -812, -780, -748, -716, -684, -652,
-620, -588, -556, -524, -492, -460, -428, -396,
-372, -356, -340, -324, -308, -292, -276, -260,
-244, -228, -212, -196, -180, -164, -148, -132,
-120, -112, -104, -96, -88, -80, -72, -64,
-56, -48, -40, -32, -24, -16, -8, 0,
32124, 31100, 30076, 29052, 28028, 27004, 25980, 24956,
23932, 22908, 21884, 20860, 19836, 18812, 17788, 16764,
15996, 15484, 14972, 14460, 13948, 13436, 12924, 12412,
11900, 11388, 10876, 10364, 9852, 9340, 8828, 8316,
7932, 7676, 7420, 7164, 6908, 6652, 6396, 6140,
5884, 5628, 5372, 5116, 4860, 4604, 4348, 4092,
3900, 3772, 3644, 3516, 3388, 3260, 3132, 3004,
2876, 2748, 2620, 2492, 2364, 2236, 2108, 1980,
1884, 1820, 1756, 1692, 1628, 1564, 1500, 1436,
1372, 1308, 1244, 1180, 1116, 1052, 988, 924,
876, 844, 812, 780, 748, 716, 684, 652,
620, 588, 556, 524, 492, 460, 428, 396,
372, 356, 340, 324, 308, 292, 276, 260,
244, 228, 212, 196, 180, 164, 148, 132,
120, 112, 104, 96, 88, 80, 72, 64,
56, 48, 40, 32, 24, 16, 8, 0 };
QByteArray out;
foreach(qint8 const temp, in)
{
qint16 decoded = ulaw_decode[0];
if (temp != 0) {
decoded = ulaw_decode[static_cast<quint8>(temp)];
}
out.append(static_cast<qint8>(decoded & 0xff));
out.append(static_cast<qint8>(decoded >> 8 & 0xff));
}
return out;
}

47
rxaudiohandler.h 100644
Wyświetl plik

@ -0,0 +1,47 @@
#ifndef RXAUDIOHANDLER_H
#define RXAUDIOHANDLER_H
#include <QObject>
#include <QtMultimedia/QAudioOutput>
#include <QMutexLocker>
#include <QIODevice>
#include <QDebug>
class rxAudioHandler : public QObject
{
Q_OBJECT
public:
rxAudioHandler();
~rxAudioHandler();
public slots:
void process();
void setup(const QAudioFormat format, const quint16 bufferSize, const bool isulaw);
void incomingAudio(const QByteArray data);
void changeBufferSize(const quint16 newSize);
void getBufferSize();
signals:
void audioMessage(QString message);
void sendBufferSize(quint16 newSize);
private:
QByteArray uLawDecode(const QByteArray in);
QAudioOutput* audio;
QAudioFormat format;
QIODevice* device;
int bufferSize;
QMutex mutex;
bool isUlaw;
};
#endif // RXAUDIOHANDLER_H

Wyświetl plik

@ -312,6 +312,7 @@ qint64 udpHandler::SendRequestSerialAndAudio()
quint8* usernameEncoded = Passcode(username);
int txSeqBufLengthMs = 50;
const quint8 p[] = {
0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
static_cast<quint8>(localSID >> 24 & 0xff), static_cast<quint8>(localSID >> 16 & 0xff), static_cast<quint8>(localSID >> 8 & 0xff), static_cast<quint8>(localSID & 0xff),
@ -575,12 +576,6 @@ udpAudio::udpAudio(QHostAddress local, QHostAddress ip, quint16 aport, quint16 b
if (rxCodec == 0x02 || rxCodec == 0x8)
rxNumSamples = 8; // uLaw is actually 16bit.
if (txCodec == 0x01)
txIsUlawCodec = true;
else if (txCodec == 0x02)
txNumSamples = 8; // uLaw is actually 16bit.
rxaudio = new audioHandler();
rxAudioThread = new QThread(this);
@ -623,6 +618,7 @@ udpAudio::~udpAudio()
rxAudioThread->quit();
rxAudioThread->wait();
}
if (txAudioThread) {
txAudioThread->quit();
txAudioThread->wait();
@ -652,6 +648,7 @@ void udpAudio::sendTxAudio(QByteArray audio)
SendTrackedPacket(tx);
sendAudioSeq++;
}
}
void udpAudio::changeBufferSize(quint16 value)

Wyświetl plik

@ -18,7 +18,6 @@
#include <QBuffer>
#include <QThread>
#include <QDebug>
#include "audiohandler.h"
@ -125,15 +124,16 @@ public:
signals:
void haveAudioData(QByteArray data);
void setupTxAudio(const quint8 samples, const quint8 channels, const quint16 samplerate, const quint16 bufferSize, const bool isUlaw, const bool isInput);
void setupRxAudio(const quint8 samples, const quint8 channels, const quint16 samplerate, const quint16 bufferSize, const bool isUlaw, const bool isInput);
void haveChangeBufferSize(quint16 value);
public slots:
void changeBufferSize(quint16 value);
void sendTxAudio(QByteArray d);
private:
void DataReceived();
@ -158,6 +158,7 @@ private:
audioHandler* txaudio;
QThread* txAudioThread;
};

Wyświetl plik

@ -23,6 +23,8 @@ wfmain::wfmain(const QString serialPortCL, const QString hostCL, QWidget *parent
this->serialPortCL = serialPortCL;
this->hostCL = hostCL;
cal = new calibrationWindow();
haveRigCaps = false;
ui->bandStkLastUsedBtn->setVisible(false);
@ -210,9 +212,14 @@ wfmain::wfmain(const QString serialPortCL, const QString hostCL, QWidget *parent
modes << "LSB" << "USB" << "AM" << "CW" << "RTTY";
// 5 6 7 8 9
modes << "FM" << "CW-R" << "RTTY-R" << "LSB-D" << "USB-D";
// TODO: Add FM-D and AM-D which seem to exist
// TODO: Add FM-D and AM-D and where applicable D-Star hich seem to exist
ui->modeSelectCombo->insertItems(0, modes);
QStringList filters;
filters << "1" << "2" << "3" << "Setup...";
ui->modeFilterCombo->addItems(filters);
spans << "2.5k" << "5.0k" << "10k" << "25k";
spans << "50k" << "100k" << "250k" << "500k";
ui->scopeBWCombo->insertItems(0, spans);
@ -277,6 +284,7 @@ wfmain::wfmain(const QString serialPortCL, const QString hostCL, QWidget *parent
connect(rig, SIGNAL(haveAfGain(unsigned char)), this, SLOT(receiveAfGain(unsigned char)));
connect(this, SIGNAL(getSql()), rig, SLOT(getSql()));
connect(rig, SIGNAL(haveSql(unsigned char)), this, SLOT(receiveSql(unsigned char)));
connect(this, SIGNAL(setSql(unsigned char)), rig, SLOT(setSquelch(unsigned char)));
connect(this, SIGNAL(startATU()), rig, SLOT(startATU()));
connect(this, SIGNAL(setATU(bool)), rig, SLOT(setATU(bool)));
connect(this, SIGNAL(getATUStatus()), rig, SLOT(getATUStatus()));
@ -289,6 +297,15 @@ wfmain::wfmain(const QString serialPortCL, const QString hostCL, QWidget *parent
connect(this, SIGNAL(sayFrequency()), rig, SLOT(sayFrequency()));
connect(this, SIGNAL(sayMode()), rig, SLOT(sayMode()));
// calibration window:
connect(cal, SIGNAL(requestRefAdjustCourse()), rig, SLOT(getRefAdjustCourse()));
connect(cal, SIGNAL(requestRefAdjustFine()), rig, SLOT(getRefAdjustFine()));
connect(rig, SIGNAL(haveRefAdjustCourse(unsigned char)), cal, SLOT(handleRefAdjustCourse(unsigned char)));
connect(rig, SIGNAL(haveRefAdjustFine(unsigned char)), cal, SLOT(handleRefAdjustFine(unsigned char)));
connect(cal, SIGNAL(setRefAdjustCourse(unsigned char)), rig, SLOT(setRefAdjustCourse(unsigned char)));
connect(cal, SIGNAL(setRefAdjustFine(unsigned char)), rig, SLOT(setRefAdjustFine(unsigned char)));
// Plot user interaction
connect(plot, SIGNAL(mouseDoubleClick(QMouseEvent*)), this, SLOT(handlePlotDoubleClick(QMouseEvent*)));
connect(wf, SIGNAL(mouseDoubleClick(QMouseEvent*)), this, SLOT(handleWFDoubleClick(QMouseEvent*)));
@ -535,6 +552,22 @@ void wfmain::receiveFoundRigID(rigCapabilities rigCaps)
// Entry point for unknown rig being identified at the start of the program.
//now we know what the rig ID is:
//qDebug() << "In wfview, we now have a reply to our request for rig identity sent to CIV BROADCAST.";
// We have to be careful here:
// If we enter this a second time, we will get two sets of DV and DD modes
// Also, if ever there is a rig with DV but without DV, we'll be off by one.
// A better solution is to translate the combo selection to a shared type
// such as an enum or even the actual CIV mode byte.
if(rigCaps.hasDV)
{
ui->modeSelectCombo->addItem("DV");
}
if(rigCaps.hasDD)
{
ui->modeSelectCombo->addItem("DD");
}
delayedCommand->setInterval(100); // faster polling is ok now.
receiveRigID(rigCaps);
getInitialRigState();
@ -1099,7 +1132,7 @@ void wfmain:: getInitialRigState()
cmdOutQue.append(cmdGetRxGain);
cmdOutQue.append(cmdGetAfGain);
// cmdOutQue.append(cmdGetSql); // implimented but not used
cmdOutQue.append(cmdGetSql); // implimented but not used
// TODO:
// get TX level
// get Scope reference Level
@ -2148,9 +2181,8 @@ void wfmain::receiveAfGain(unsigned char level)
void wfmain::receiveSql(unsigned char level)
{
// TODO: Maybe add squelch control
// qDebug() << "Receive SQL level of " << (int)level << " = " << 100*level/255.0 << "%";
// ui->sqlSlider->setValue(level); // No SQL control so far
qDebug() << "Receive SQL level of " << (int)level << " = " << 100*level/255.0 << "%";
ui->sqlSlider->setValue(level);
(void)level;
}
@ -2367,6 +2399,22 @@ void wfmain::on_connectBtn_clicked()
}
}
void wfmain::on_sqlSlider_valueChanged(int value)
{
emit setSql((unsigned char)value);
}
void wfmain::on_modeFilterCombo_activated(int index)
{
//TODO:
if(index >2)
{
//filterSetup->show();
}
// emit setFilterSel((unsigned char)index);
}
// --- DEBUG FUNCTION ---
void wfmain::on_debugBtn_clicked()
{
@ -2378,7 +2426,7 @@ void wfmain::on_debugBtn_clicked()
//emit getScopeSpan(); // in khz, only in "center" mode
//qDebug() << "Debug: finding rigs attached. Let's see if this works. ";
//rig->findRigs();
cal->show();
}

Wyświetl plik

@ -16,6 +16,8 @@
#include "freqmemory.h"
#include "rigidentities.h"
#include "calibrationwindow.h"
#include <qcustomplot.h>
#include <qserialportinfo.h>
@ -49,6 +51,7 @@ signals:
void getDebug();
void setRfGain(unsigned char level);
void setAfGain(unsigned char level);
void setSql(unsigned char level);
void startATU();
void setATU(bool atuEnabled);
void getATUStatus();
@ -277,6 +280,10 @@ private slots:
void on_scopeEnableWFBtn_clicked(bool checked);
void on_sqlSlider_valueChanged(int value);
void on_modeFilterCombo_activated(int index);
private:
Ui::wfmain *ui;
QSettings settings;
@ -433,6 +440,8 @@ private:
rigCapabilities rigCaps;
bool haveRigCaps;
calibrationWindow *cal;
void bandStackBtnClick();
bool waitingForBandStackRtn;
char bandStkBand;

Wyświetl plik

@ -213,6 +213,23 @@
</property>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_11">
<property name="rightMargin">
<number>10</number>
</property>
<item>
<widget class="QLabel" name="label_22">
<property name="text">
<string>Receive Filter</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="modeFilterCombo"/>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_8">
<property name="rightMargin">
@ -291,6 +308,42 @@
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_10">
<property name="leftMargin">
<number>0</number>
</property>
<item>
<widget class="QSlider" name="sqlSlider">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>60</height>
</size>
</property>
<property name="maximum">
<number>255</number>
</property>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_21">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>15</height>
</size>
</property>
<property name="text">
<string>SQ</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">

Wyświetl plik

@ -81,7 +81,8 @@ SOURCES += main.cpp\
rigidentities.cpp \
udphandler.cpp \
logcategories.cpp \
rxaudiohandler.cpp
rxaudiohandler.cpp \
calibrationwindow.cpp
HEADERS += wfmain.h \
commhandler.h \
@ -90,8 +91,10 @@ HEADERS += wfmain.h \
rigidentities.h \
udphandler.h \
logcategories.h \
rxaudiohandler.h
FORMS += wfmain.ui
FORMS += wfmain.ui \
calibrationwindow.ui