Change mode selection code to use the command queue (as it should have).

Beginnings of automatic sideband options.
merge-requests/13/merge
Elliott Liggett 2023-01-18 22:27:06 -08:00
rodzic 0c27bf7208
commit e9e042fad8
7 zmienionych plików z 84 dodań i 34 usunięć

Wyświetl plik

@ -2,37 +2,7 @@
#define FREQMEMORY_H
#include <QString>
#include <QDebug>
// 0 1 2 3 4
//modes << "LSB" << "USB" << "AM" << "CW" << "RTTY";
// 5 6 7 8 9
// modes << "FM" << "CW-R" << "RTTY-R" << "LSB-D" << "USB-D";
enum mode_kind {
modeLSB=0x00,
modeUSB=0x01,
modeAM=0x02,
modeCW=0x03,
modeRTTY=0x04,
modeFM=0x05,
modeCW_R=0x07,
modeRTTY_R=0x08,
modePSK = 0x12,
modePSK_R = 0x13,
modeLSB_D=0x80,
modeUSB_D=0x81,
modeDV=0x17,
modeDD=0x27,
modeWFM,
modeS_AMD,
modeS_AML,
modeS_AMU,
modeP25,
modedPMR,
modeNXDN_VN,
modeNXDN_N,
modeDCR
};
#include "wfviewtypes.h"
struct mode_info {
mode_kind mk;

Wyświetl plik

39
sidebandchooser.h 100644
Wyświetl plik

@ -0,0 +1,39 @@
#ifndef SIDEBANDCHOOSER_H
#define SIDEBANDCHOOSER_H
#include "wfviewtypes.h"
class sidebandChooser
{
public:
sidebandChooser();
static inline mode_kind getMode(freqt f, mode_kind currentMode = modeUSB) {
if((currentMode == modeLSB) || (currentMode == modeUSB) )
{
if(f.Hz < 5000000)
{
return modeLSB;
}
if( (f.Hz >= 5000000) || (f.Hz < 5600000) )
{
return modeUSB;
}
if( (f.Hz >= 5600000) || (f.Hz < 10000000) )
{
return modeLSB;
}
return modeUSB;
} else {
return currentMode;
}
}
private:
};
#endif // SIDEBANDCHOOSER_H

Wyświetl plik

@ -4885,18 +4885,23 @@ void wfmain::on_goFreqBtn_clicked()
if(ok)
{
f.Hz = freqDbl*1E6;
issueCmd(cmdSetFreq, f);
}
} else {
KHz = ui->freqMhzLineEdit->text().toInt(&ok);
if(ok)
{
f.Hz = KHz*1E3;
issueCmd(cmdSetFreq, f);
}
}
if(ok)
{
mode_info m;
issueCmd(cmdSetFreq, f);
m.mk = sidebandChooser::getMode(f, currentMode);
qDebug(logSystem()) << "current mode: " << currentMode << "new mode:" << m.mk;
if(m.mk != currentMode)
issueCmd(cmdSetMode, m);
f.MHzDouble = (float)f.Hz / 1E6;
freq = f;
setUIFreq();
@ -5055,7 +5060,11 @@ void wfmain::changeMode(mode_kind mode)
void wfmain::changeMode(mode_kind mode, bool dataOn)
{
int filter = ui->modeFilterCombo->currentData().toInt();
emit setMode((unsigned char)mode, (unsigned char)filter);
mode_info m;
m.filter = (unsigned char) filter;
m.reg = (unsigned char) mode;
issueCmd(cmdSetMode, m);
//emit setMode((unsigned char)mode, (unsigned char)filter);
currentMode = mode;

Wyświetl plik

@ -44,6 +44,7 @@
#include "loggingwindow.h"
#include "cluster.h"
#include "audiodevices.h"
#include "sidebandchooser.h"
#include <qcustomplot.h>
#include <qserialportinfo.h>

Wyświetl plik

@ -237,6 +237,7 @@ HEADERS += wfmain.h \
rigcommander.h \
freqmemory.h \
rigidentities.h \
sidebandchooser.h \
udpbase.h \
udphandler.h \
udpcivdata.h \

Wyświetl plik

@ -1,6 +1,10 @@
#ifndef WFVIEWTYPES_H
#define WFVIEWTYPES_H
#include <QString>
#include <QtGlobal>
#include <stdint.h>
enum underlay_t { underlayNone, underlayPeakHold, underlayPeakBuffer, underlayAverageBuffer };
enum meterKind {
@ -28,6 +32,32 @@ enum spectrumMode {
spectModeUnknown=0xff
};
enum mode_kind {
modeLSB=0x00,
modeUSB=0x01,
modeAM=0x02,
modeCW=0x03,
modeRTTY=0x04,
modeFM=0x05,
modeCW_R=0x07,
modeRTTY_R=0x08,
modePSK = 0x12,
modePSK_R = 0x13,
modeLSB_D=0x80,
modeUSB_D=0x81,
modeDV=0x17,
modeDD=0x27,
modeWFM,
modeS_AMD,
modeS_AML,
modeS_AMU,
modeP25,
modedPMR,
modeNXDN_VN,
modeNXDN_N,
modeDCR
};
struct freqt {
quint64 Hz;
double MHzDouble;