mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2024-11-23 20:28:40 -05:00
Fix lock UI update and start on constellation implementation
This commit is contained in:
parent
9e1601c446
commit
b76eafe8df
@ -61,20 +61,33 @@ AppFrame::AppFrame() :
|
||||
demodModeSelector->setHelpTip("Choose modulation type: Frequency Modulation, Amplitude Modulation and Lower, Upper or Double Side-Band.");
|
||||
demodTray->Add(demodModeSelector, 2, wxEXPAND | wxALL, 0);
|
||||
|
||||
demodModeSelectoradv = new ModeSelectorCanvas(this, attribList);
|
||||
demodModeSelectoradv->addChoice(DEMOD_TYPE_ASK, "ASK");
|
||||
demodModeSelectoradv->addChoice(DEMOD_TYPE_APSK, "APSK");
|
||||
demodModeSelectoradv->addChoice(DEMOD_TYPE_BPSK, "BPSK");
|
||||
demodModeSelectoradv->addChoice(DEMOD_TYPE_DPSK, "DPSK");
|
||||
demodModeSelectoradv->addChoice(DEMOD_TYPE_PSK, "PSK");
|
||||
demodModeSelectoradv->addChoice(DEMOD_TYPE_OOK, "OOK");
|
||||
demodModeSelectoradv->addChoice(DEMOD_TYPE_ST, "ST");
|
||||
demodModeSelectoradv->addChoice(DEMOD_TYPE_SQAM, "SQAM");
|
||||
demodModeSelectoradv->addChoice(DEMOD_TYPE_QAM, "QAM");
|
||||
demodModeSelectoradv->addChoice(DEMOD_TYPE_QPSK, "QPSK");
|
||||
demodModeSelectoradv->setSelection(DEMOD_TYPE_ASK);
|
||||
demodModeSelectoradv->setHelpTip("Choose advanced modulation types.");
|
||||
demodTray->Add(demodModeSelectoradv, 3, wxEXPAND | wxALL, 0);
|
||||
demodModeSelectorAdv = new ModeSelectorCanvas(this, attribList);
|
||||
demodModeSelectorAdv->addChoice(DEMOD_TYPE_ASK, "ASK");
|
||||
demodModeSelectorAdv->addChoice(DEMOD_TYPE_APSK, "APSK");
|
||||
demodModeSelectorAdv->addChoice(DEMOD_TYPE_BPSK, "BPSK");
|
||||
demodModeSelectorAdv->addChoice(DEMOD_TYPE_DPSK, "DPSK");
|
||||
demodModeSelectorAdv->addChoice(DEMOD_TYPE_PSK, "PSK");
|
||||
demodModeSelectorAdv->addChoice(DEMOD_TYPE_OOK, "OOK");
|
||||
demodModeSelectorAdv->addChoice(DEMOD_TYPE_ST, "ST");
|
||||
demodModeSelectorAdv->addChoice(DEMOD_TYPE_SQAM, "SQAM");
|
||||
demodModeSelectorAdv->addChoice(DEMOD_TYPE_QAM, "QAM");
|
||||
demodModeSelectorAdv->addChoice(DEMOD_TYPE_QPSK, "QPSK");
|
||||
demodModeSelectorAdv->setSelection(DEMOD_TYPE_ASK);
|
||||
demodModeSelectorAdv->setHelpTip("Choose advanced modulation types.");
|
||||
demodTray->Add(demodModeSelectorAdv, 3, wxEXPAND | wxALL, 0);
|
||||
|
||||
demodModeSelectorCons = new ModeSelectorCanvas(this, attribList);
|
||||
demodModeSelectorCons->addChoice(1, "auto");
|
||||
demodModeSelectorCons->addChoice(2, "2");
|
||||
demodModeSelectorCons->addChoice(4, "4");
|
||||
demodModeSelectorCons->addChoice(8, "8");
|
||||
demodModeSelectorCons->addChoice(16, "16");
|
||||
demodModeSelectorCons->addChoice(32, "32");
|
||||
demodModeSelectorCons->addChoice(64, "64");
|
||||
demodModeSelectorCons->addChoice(128, "128");
|
||||
demodModeSelectorCons->addChoice(256, "256");
|
||||
demodModeSelectorCons->setHelpTip("Choose number of constallations types.");
|
||||
demodTray->Add(demodModeSelectorCons, 2, wxEXPAND | wxALL, 0);
|
||||
|
||||
// demodTray->AddSpacer(2);
|
||||
|
||||
@ -492,7 +505,7 @@ void AppFrame::OnIdle(wxIdleEvent& event) {
|
||||
outputDeviceMenuItems[outputDevice]->Check(true);
|
||||
int dType = demod->getDemodulatorType();
|
||||
demodModeSelector->setSelection(dType);
|
||||
demodModeSelectoradv->setSelection(dType);
|
||||
demodModeSelectorAdv->setSelection(dType);
|
||||
}
|
||||
if (demodWaterfallCanvas->getDragState() == WaterfallCanvas::WF_DRAG_NONE) {
|
||||
long long centerFreq = demod->getFrequency();
|
||||
@ -520,10 +533,10 @@ void AppFrame::OnIdle(wxIdleEvent& event) {
|
||||
demodSpectrumCanvas->setCenterFrequency(centerFreq);
|
||||
}
|
||||
int dSelection = demodModeSelector->getSelection();
|
||||
int dSelectionadv = demodModeSelectoradv->getSelection();
|
||||
int dSelectionadv = demodModeSelectorAdv->getSelection();
|
||||
if (dSelection != -1 && dSelection != demod->getDemodulatorType()) {
|
||||
demod->setDemodulatorType(dSelection);
|
||||
demodModeSelectoradv->setSelection(-1);
|
||||
demodModeSelectorAdv->setSelection(-1);
|
||||
}
|
||||
else if(dSelectionadv != -1 && dSelectionadv != demod->getDemodulatorType()) {
|
||||
demod->setDemodulatorType(dSelectionadv);
|
||||
@ -547,10 +560,10 @@ void AppFrame::OnIdle(wxIdleEvent& event) {
|
||||
DemodulatorMgr *mgr = &wxGetApp().getDemodMgr();
|
||||
|
||||
int dSelection = demodModeSelector->getSelection();
|
||||
int dSelectionadv = demodModeSelectoradv->getSelection();
|
||||
int dSelectionadv = demodModeSelectorAdv->getSelection();
|
||||
if (dSelection != -1 && dSelection != mgr->getLastDemodulatorType()) {
|
||||
mgr->setLastDemodulatorType(dSelection);
|
||||
demodModeSelectoradv->setSelection(-1);
|
||||
demodModeSelectorAdv->setSelection(-1);
|
||||
}
|
||||
else if(dSelectionadv != -1 && dSelectionadv != mgr->getLastDemodulatorType()) {
|
||||
mgr->setLastDemodulatorType(dSelectionadv);
|
||||
|
@ -62,7 +62,8 @@ private:
|
||||
SpectrumCanvas *spectrumCanvas;
|
||||
WaterfallCanvas *waterfallCanvas;
|
||||
ModeSelectorCanvas *demodModeSelector;
|
||||
ModeSelectorCanvas *demodModeSelectoradv;
|
||||
ModeSelectorCanvas *demodModeSelectorAdv;
|
||||
ModeSelectorCanvas *demodModeSelectorCons;
|
||||
SpectrumCanvas *demodSpectrumCanvas;
|
||||
WaterfallCanvas *demodWaterfallCanvas;
|
||||
MeterCanvas *demodSignalMeter;
|
||||
|
@ -21,7 +21,6 @@ DemodulatorInstance::DemodulatorInstance() :
|
||||
demodulatorThread->setAudioOutputQueue(audioInputQueue);
|
||||
|
||||
currentDemodType = demodulatorThread->getDemodulatorType();
|
||||
currentDemodLock = demodulatorThread->getDemodulatorLock();
|
||||
}
|
||||
|
||||
DemodulatorInstance::~DemodulatorInstance() {
|
||||
@ -51,7 +50,6 @@ void DemodulatorInstance::run() {
|
||||
|
||||
currentFrequency = demodulatorPreThread->getParams().frequency;
|
||||
currentDemodType = demodulatorThread->getDemodulatorType();
|
||||
currentDemodLock = demodulatorThread->getDemodulatorLock();
|
||||
currentAudioSampleRate = AudioThread::deviceSampleRate[getOutputDevice()];
|
||||
demodulatorPreThread->getParams().audioSampleRate = currentAudioSampleRate;
|
||||
|
||||
@ -267,16 +265,11 @@ int DemodulatorInstance::getDemodulatorType() {
|
||||
}
|
||||
|
||||
void DemodulatorInstance::setDemodulatorLock(bool demod_lock_in) {
|
||||
if(demod_lock_in) {
|
||||
currentDemodLock = true;
|
||||
}
|
||||
else {
|
||||
currentDemodLock = false;
|
||||
}
|
||||
demodulatorThread->setDemodulatorLock(demod_lock_in);
|
||||
}
|
||||
|
||||
int DemodulatorInstance::getDemodulatorLock() {
|
||||
return currentDemodLock;
|
||||
return demodulatorThread->getDemodulatorLock();
|
||||
}
|
||||
|
||||
void DemodulatorInstance::setBandwidth(int bw) {
|
||||
|
@ -101,7 +101,6 @@ private:
|
||||
long long currentFrequency;
|
||||
int currentBandwidth;
|
||||
int currentDemodType;
|
||||
bool currentDemodLock = false;
|
||||
int currentOutputDevice;
|
||||
int currentAudioSampleRate;
|
||||
bool follow, tracking;
|
||||
|
@ -162,7 +162,6 @@ void DemodulatorMgr::updateLastState() {
|
||||
if (lastActiveDemodulator) {
|
||||
lastBandwidth = lastActiveDemodulator->getBandwidth();
|
||||
lastDemodType = lastActiveDemodulator->getDemodulatorType();
|
||||
lastDemodLock = lastActiveDemodulator->getDemodulatorLock();
|
||||
lastSquelchEnabled = lastActiveDemodulator->isSquelchEnabled();
|
||||
lastSquelch = lastActiveDemodulator->getSquelchLevel();
|
||||
lastGain = lastActiveDemodulator->getGain();
|
||||
@ -192,14 +191,6 @@ void DemodulatorMgr::setLastDemodulatorType(int lastDemodType) {
|
||||
this->lastDemodType = lastDemodType;
|
||||
}
|
||||
|
||||
bool DemodulatorMgr::getLastDemodulatorLock() const {
|
||||
return lastDemodLock;
|
||||
}
|
||||
|
||||
void DemodulatorMgr::setLastDemodulatorLock(bool lastDemodLock) {
|
||||
this->lastDemodLock = lastDemodLock;
|
||||
}
|
||||
|
||||
float DemodulatorMgr::getLastGain() const {
|
||||
return lastGain;
|
||||
}
|
||||
|
@ -28,9 +28,6 @@ public:
|
||||
int getLastDemodulatorType() const;
|
||||
void setLastDemodulatorType(int lastDemodType);
|
||||
|
||||
bool getLastDemodulatorLock() const;
|
||||
void setLastDemodulatorLock(bool lastDemodLock);
|
||||
|
||||
float getLastGain() const;
|
||||
void setLastGain(float lastGain);
|
||||
|
||||
@ -55,7 +52,6 @@ private:
|
||||
|
||||
int lastBandwidth;
|
||||
int lastDemodType;
|
||||
bool lastDemodLock;
|
||||
bool lastSquelchEnabled;
|
||||
float lastSquelch;
|
||||
float lastGain;
|
||||
|
@ -26,17 +26,19 @@ DemodulatorThread::DemodulatorThread(DemodulatorThreadPostInputQueue* iqInputQue
|
||||
demodAM = demodAM_DSB_CSP;
|
||||
|
||||
// advanced demodulators
|
||||
demodASK = modem_create(LIQUID_MODEM_ASK2);
|
||||
demodAPSK = modem_create(LIQUID_MODEM_APSK4);
|
||||
demodASK = modem_create(LIQUID_MODEM_ASK256);
|
||||
demodAPSK = modem_create(LIQUID_MODEM_APSK256);
|
||||
demodBPSK = modem_create(LIQUID_MODEM_BPSK);
|
||||
demodDPSK = modem_create(LIQUID_MODEM_DPSK4);
|
||||
demodPSK = modem_create(LIQUID_MODEM_PSK2);
|
||||
demodDPSK = modem_create(LIQUID_MODEM_DPSK256);
|
||||
demodPSK = modem_create(LIQUID_MODEM_PSK256);
|
||||
demodOOK = modem_create(LIQUID_MODEM_OOK);
|
||||
demodSQAM = modem_create(LIQUID_MODEM_SQAM32);
|
||||
demodSQAM = modem_create(LIQUID_MODEM_SQAM128);
|
||||
demodST = modem_create(LIQUID_MODEM_V29);
|
||||
demodQAM = modem_create(LIQUID_MODEM_QAM4);
|
||||
demodQAM = modem_create(LIQUID_MODEM_QAM256);
|
||||
demodQPSK = modem_create(LIQUID_MODEM_QPSK);
|
||||
|
||||
currentDemodLock = false;
|
||||
|
||||
}
|
||||
DemodulatorThread::~DemodulatorThread() {
|
||||
}
|
||||
@ -200,64 +202,65 @@ void DemodulatorThread::threadMain() {
|
||||
case DEMOD_TYPE_ASK:
|
||||
for (int i = 0; i < bufSize; i++) {
|
||||
modem_demodulate(demodASK, inp->data[i], &bitstream);
|
||||
std::cout << bitstream << std::endl;
|
||||
// std::cout << bitstream << std::endl;
|
||||
}
|
||||
updateDemodulatorLock(demodASK);
|
||||
updateDemodulatorLock(demodASK, 0.8f);
|
||||
break;
|
||||
case DEMOD_TYPE_BPSK:
|
||||
for (int i = 0; i < bufSize; i++) {
|
||||
modem_demodulate(demodBPSK, inp->data[i], &bitstream);
|
||||
std::cout << bitstream << std::endl;
|
||||
// std::cout << bitstream << std::endl;
|
||||
}
|
||||
updateDemodulatorLock(demodBPSK);
|
||||
updateDemodulatorLock(demodBPSK, 0.8f);
|
||||
break;
|
||||
case DEMOD_TYPE_DPSK:
|
||||
for (int i = 0; i < bufSize; i++) {
|
||||
modem_demodulate(demodDPSK, inp->data[i], &bitstream);
|
||||
std::cout << bitstream << std::endl;
|
||||
// std::cout << bitstream << std::endl;
|
||||
}
|
||||
updateDemodulatorLock(demodDPSK);
|
||||
updateDemodulatorLock(demodDPSK, 0.8f);
|
||||
break;
|
||||
case DEMOD_TYPE_PSK:
|
||||
for (int i = 0; i < bufSize; i++) {
|
||||
modem_demodulate(demodPSK, inp->data[i], &bitstream);
|
||||
std::cout << bitstream << std::endl;
|
||||
// std::cout << bitstream << std::endl;
|
||||
}
|
||||
updateDemodulatorLock(demodPSK);
|
||||
updateDemodulatorLock(demodPSK, 0.8f);
|
||||
break;
|
||||
case DEMOD_TYPE_OOK:
|
||||
for (int i = 0; i < bufSize; i++) {
|
||||
modem_demodulate(demodOOK, inp->data[i], &bitstream);
|
||||
std::cout << bitstream << std::endl;
|
||||
// std::cout << bitstream << std::endl;
|
||||
}
|
||||
updateDemodulatorLock(demodOOK);
|
||||
updateDemodulatorLock(demodOOK, 0.8f);
|
||||
break;
|
||||
case DEMOD_TYPE_SQAM:
|
||||
for (int i = 0; i < bufSize; i++) {
|
||||
modem_demodulate(demodSQAM, inp->data[i], &bitstream);
|
||||
std::cout << bitstream << std::endl;
|
||||
// std::cout << bitstream << std::endl;
|
||||
}
|
||||
updateDemodulatorLock(demodSQAM);
|
||||
updateDemodulatorLock(demodSQAM, 0.8f);
|
||||
break;
|
||||
case DEMOD_TYPE_ST:
|
||||
for (int i = 0; i < bufSize; i++) {
|
||||
modem_demodulate(demodST, inp->data[i], &bitstream);
|
||||
std::cout << bitstream << std::endl;
|
||||
// std::cout << bitstream << std::endl;
|
||||
}
|
||||
updateDemodulatorLock(demodST);
|
||||
updateDemodulatorLock(demodST, 0.8f);
|
||||
break;
|
||||
case DEMOD_TYPE_QAM:
|
||||
for (int i = 0; i < bufSize; i++) {
|
||||
modem_demodulate(demodQAM, inp->data[i], &bitstream);
|
||||
std::cout << bitstream << std::endl;
|
||||
// std::cout << bitstream << std::endl;
|
||||
}
|
||||
updateDemodulatorLock(demodQAM);
|
||||
updateDemodulatorLock(demodQAM, 0.5f);
|
||||
break;
|
||||
case DEMOD_TYPE_QPSK:
|
||||
for (int i = 0; i < bufSize; i++) {
|
||||
modem_demodulate(demodQPSK, inp->data[i], &bitstream);
|
||||
// std::cout << bitstream << std::endl;
|
||||
}
|
||||
updateDemodulatorLock(demodQPSK);
|
||||
updateDemodulatorLock(demodQPSK, 0.8f);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -462,10 +465,10 @@ void DemodulatorThread::threadMain() {
|
||||
demodAM = demodAM_DSB_CSP;
|
||||
ampmodem_reset(demodAM);
|
||||
break;
|
||||
case DEMOD_TYPE_QPSK:
|
||||
std::cout << "reset modem qpsk" << std::endl;
|
||||
modem_reset(demodQPSK);
|
||||
break;
|
||||
// case DEMOD_TYPE_QPSK:
|
||||
// std::cout << "reset modem qpsk" << std::endl;
|
||||
// modem_reset(demodQPSK);
|
||||
// break;
|
||||
}
|
||||
demodulatorType = newDemodType;
|
||||
}
|
||||
@ -562,19 +565,14 @@ int DemodulatorThread::getDemodulatorType() {
|
||||
}
|
||||
|
||||
void DemodulatorThread::setDemodulatorLock(bool demod_lock_in) {
|
||||
if(demod_lock_in) {
|
||||
currentDemodLock = true;
|
||||
}
|
||||
else {
|
||||
currentDemodLock = false;
|
||||
}
|
||||
demod_lock_in ? currentDemodLock = true : currentDemodLock = false;
|
||||
}
|
||||
|
||||
int DemodulatorThread::getDemodulatorLock() {
|
||||
return currentDemodLock;
|
||||
}
|
||||
|
||||
void DemodulatorThread::updateDemodulatorLock(modem demod) {
|
||||
modem_get_demodulator_evm(demod) <= 0.8f ? setDemodulatorLock(true) : setDemodulatorLock(false);
|
||||
void DemodulatorThread::updateDemodulatorLock(modem demod, float sensitivity) {
|
||||
modem_get_demodulator_evm(demod) <= sensitivity ? setDemodulatorLock(true) : setDemodulatorLock(false);
|
||||
}
|
||||
|
||||
|
@ -96,6 +96,6 @@ protected:
|
||||
std::atomic<float> signalLevel;
|
||||
bool squelchEnabled;
|
||||
|
||||
bool currentDemodLock = false;
|
||||
void updateDemodulatorLock(modem demod);
|
||||
bool currentDemodLock;
|
||||
void updateDemodulatorLock(modem demod, float sensitivity);
|
||||
};
|
||||
|
@ -306,7 +306,6 @@ void PrimaryGLContext::DrawDemod(DemodulatorInstance *demod, RGBColor color, lon
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
// add lock to string if we have an lock
|
||||
if(demod->getDemodulatorLock()) {
|
||||
demodStr = demodStr + " Lock";
|
||||
|
Loading…
Reference in New Issue
Block a user