mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2024-11-27 14:09:11 -05:00
Propagate Constelattion setting to demodulator, not working properly yet.
This commit is contained in:
parent
b76eafe8df
commit
f71d04eb75
@ -504,8 +504,10 @@ void AppFrame::OnIdle(wxIdleEvent& event) {
|
|||||||
scopeCanvas->setDeviceName(outputDevices[outputDevice].name);
|
scopeCanvas->setDeviceName(outputDevices[outputDevice].name);
|
||||||
outputDeviceMenuItems[outputDevice]->Check(true);
|
outputDeviceMenuItems[outputDevice]->Check(true);
|
||||||
int dType = demod->getDemodulatorType();
|
int dType = demod->getDemodulatorType();
|
||||||
|
int dCons = demod->getDemodulatorCons();
|
||||||
demodModeSelector->setSelection(dType);
|
demodModeSelector->setSelection(dType);
|
||||||
demodModeSelectorAdv->setSelection(dType);
|
demodModeSelectorAdv->setSelection(dType);
|
||||||
|
demodModeSelectorCons->setSelection(dCons);
|
||||||
}
|
}
|
||||||
if (demodWaterfallCanvas->getDragState() == WaterfallCanvas::WF_DRAG_NONE) {
|
if (demodWaterfallCanvas->getDragState() == WaterfallCanvas::WF_DRAG_NONE) {
|
||||||
long long centerFreq = demod->getFrequency();
|
long long centerFreq = demod->getFrequency();
|
||||||
@ -534,12 +536,16 @@ void AppFrame::OnIdle(wxIdleEvent& event) {
|
|||||||
}
|
}
|
||||||
int dSelection = demodModeSelector->getSelection();
|
int dSelection = demodModeSelector->getSelection();
|
||||||
int dSelectionadv = demodModeSelectorAdv->getSelection();
|
int dSelectionadv = demodModeSelectorAdv->getSelection();
|
||||||
|
// basic demodulators
|
||||||
if (dSelection != -1 && dSelection != demod->getDemodulatorType()) {
|
if (dSelection != -1 && dSelection != demod->getDemodulatorType()) {
|
||||||
demod->setDemodulatorType(dSelection);
|
demod->setDemodulatorType(dSelection);
|
||||||
demodModeSelectorAdv->setSelection(-1);
|
demodModeSelectorAdv->setSelection(-1);
|
||||||
}
|
}
|
||||||
|
// advanced demodulators
|
||||||
else if(dSelectionadv != -1 && dSelectionadv != demod->getDemodulatorType()) {
|
else if(dSelectionadv != -1 && dSelectionadv != demod->getDemodulatorType()) {
|
||||||
demod->setDemodulatorType(dSelectionadv);
|
demod->setDemodulatorType(dSelectionadv);
|
||||||
|
demod->setDemodulatorCons(demodModeSelectorCons->getSelection());
|
||||||
|
// std::cout << "updating demodulator" << std::endl;
|
||||||
demodModeSelector->setSelection(-1);
|
demodModeSelector->setSelection(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -561,12 +567,15 @@ void AppFrame::OnIdle(wxIdleEvent& event) {
|
|||||||
|
|
||||||
int dSelection = demodModeSelector->getSelection();
|
int dSelection = demodModeSelector->getSelection();
|
||||||
int dSelectionadv = demodModeSelectorAdv->getSelection();
|
int dSelectionadv = demodModeSelectorAdv->getSelection();
|
||||||
|
// basic demodulators
|
||||||
if (dSelection != -1 && dSelection != mgr->getLastDemodulatorType()) {
|
if (dSelection != -1 && dSelection != mgr->getLastDemodulatorType()) {
|
||||||
mgr->setLastDemodulatorType(dSelection);
|
mgr->setLastDemodulatorType(dSelection);
|
||||||
demodModeSelectorAdv->setSelection(-1);
|
demodModeSelectorAdv->setSelection(-1);
|
||||||
}
|
}
|
||||||
|
// advanced demodulators
|
||||||
else if(dSelectionadv != -1 && dSelectionadv != mgr->getLastDemodulatorType()) {
|
else if(dSelectionadv != -1 && dSelectionadv != mgr->getLastDemodulatorType()) {
|
||||||
mgr->setLastDemodulatorType(dSelectionadv);
|
mgr->setLastDemodulatorType(dSelectionadv);
|
||||||
|
mgr->setLastDemodulatorCons(demodModeSelectorCons->getSelection());
|
||||||
demodModeSelector->setSelection(-1);
|
demodModeSelector->setSelection(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,6 +21,7 @@ DemodulatorInstance::DemodulatorInstance() :
|
|||||||
demodulatorThread->setAudioOutputQueue(audioInputQueue);
|
demodulatorThread->setAudioOutputQueue(audioInputQueue);
|
||||||
|
|
||||||
currentDemodType = demodulatorThread->getDemodulatorType();
|
currentDemodType = demodulatorThread->getDemodulatorType();
|
||||||
|
currentDemodCons = demodulatorThread->getDemodulatorCons();
|
||||||
}
|
}
|
||||||
|
|
||||||
DemodulatorInstance::~DemodulatorInstance() {
|
DemodulatorInstance::~DemodulatorInstance() {
|
||||||
@ -50,6 +51,7 @@ void DemodulatorInstance::run() {
|
|||||||
|
|
||||||
currentFrequency = demodulatorPreThread->getParams().frequency;
|
currentFrequency = demodulatorPreThread->getParams().frequency;
|
||||||
currentDemodType = demodulatorThread->getDemodulatorType();
|
currentDemodType = demodulatorThread->getDemodulatorType();
|
||||||
|
currentDemodCons = demodulatorThread->getDemodulatorCons();
|
||||||
currentAudioSampleRate = AudioThread::deviceSampleRate[getOutputDevice()];
|
currentAudioSampleRate = AudioThread::deviceSampleRate[getOutputDevice()];
|
||||||
demodulatorPreThread->getParams().audioSampleRate = currentAudioSampleRate;
|
demodulatorPreThread->getParams().audioSampleRate = currentAudioSampleRate;
|
||||||
|
|
||||||
@ -272,6 +274,14 @@ int DemodulatorInstance::getDemodulatorLock() {
|
|||||||
return demodulatorThread->getDemodulatorLock();
|
return demodulatorThread->getDemodulatorLock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DemodulatorInstance::setDemodulatorCons(int demod_cons_in) {
|
||||||
|
demodulatorThread->setDemodulatorCons(demod_cons_in);
|
||||||
|
}
|
||||||
|
|
||||||
|
int DemodulatorInstance::getDemodulatorCons() {
|
||||||
|
return demodulatorThread->getDemodulatorCons();
|
||||||
|
}
|
||||||
|
|
||||||
void DemodulatorInstance::setBandwidth(int bw) {
|
void DemodulatorInstance::setBandwidth(int bw) {
|
||||||
if (!active) {
|
if (!active) {
|
||||||
currentBandwidth = bw;
|
currentBandwidth = bw;
|
||||||
|
@ -67,6 +67,9 @@ public:
|
|||||||
|
|
||||||
void setDemodulatorLock(bool demod_lock_in);
|
void setDemodulatorLock(bool demod_lock_in);
|
||||||
int getDemodulatorLock();
|
int getDemodulatorLock();
|
||||||
|
|
||||||
|
void setDemodulatorCons(int demod_cons_in);
|
||||||
|
int getDemodulatorCons();
|
||||||
|
|
||||||
void setBandwidth(int bw);
|
void setBandwidth(int bw);
|
||||||
int getBandwidth();
|
int getBandwidth();
|
||||||
@ -101,6 +104,7 @@ private:
|
|||||||
long long currentFrequency;
|
long long currentFrequency;
|
||||||
int currentBandwidth;
|
int currentBandwidth;
|
||||||
int currentDemodType;
|
int currentDemodType;
|
||||||
|
int currentDemodCons;
|
||||||
int currentOutputDevice;
|
int currentOutputDevice;
|
||||||
int currentAudioSampleRate;
|
int currentAudioSampleRate;
|
||||||
bool follow, tracking;
|
bool follow, tracking;
|
||||||
|
@ -162,6 +162,8 @@ void DemodulatorMgr::updateLastState() {
|
|||||||
if (lastActiveDemodulator) {
|
if (lastActiveDemodulator) {
|
||||||
lastBandwidth = lastActiveDemodulator->getBandwidth();
|
lastBandwidth = lastActiveDemodulator->getBandwidth();
|
||||||
lastDemodType = lastActiveDemodulator->getDemodulatorType();
|
lastDemodType = lastActiveDemodulator->getDemodulatorType();
|
||||||
|
lastDemodLock = lastActiveDemodulator->getDemodulatorLock();
|
||||||
|
lastDemodCons = lastActiveDemodulator->getDemodulatorCons();
|
||||||
lastSquelchEnabled = lastActiveDemodulator->isSquelchEnabled();
|
lastSquelchEnabled = lastActiveDemodulator->isSquelchEnabled();
|
||||||
lastSquelch = lastActiveDemodulator->getSquelchLevel();
|
lastSquelch = lastActiveDemodulator->getSquelchLevel();
|
||||||
lastGain = lastActiveDemodulator->getGain();
|
lastGain = lastActiveDemodulator->getGain();
|
||||||
@ -191,6 +193,14 @@ void DemodulatorMgr::setLastDemodulatorType(int lastDemodType) {
|
|||||||
this->lastDemodType = lastDemodType;
|
this->lastDemodType = lastDemodType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int DemodulatorMgr::getLastDemodulatorCons() const {
|
||||||
|
return lastDemodCons;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DemodulatorMgr::setLastDemodulatorCons(int lastDemodCons) {
|
||||||
|
this->lastDemodCons = lastDemodCons;
|
||||||
|
}
|
||||||
|
|
||||||
float DemodulatorMgr::getLastGain() const {
|
float DemodulatorMgr::getLastGain() const {
|
||||||
return lastGain;
|
return lastGain;
|
||||||
}
|
}
|
||||||
|
@ -27,6 +27,9 @@ public:
|
|||||||
|
|
||||||
int getLastDemodulatorType() const;
|
int getLastDemodulatorType() const;
|
||||||
void setLastDemodulatorType(int lastDemodType);
|
void setLastDemodulatorType(int lastDemodType);
|
||||||
|
|
||||||
|
int getLastDemodulatorCons() const;
|
||||||
|
void setLastDemodulatorCons(int lastDemodCons);
|
||||||
|
|
||||||
float getLastGain() const;
|
float getLastGain() const;
|
||||||
void setLastGain(float lastGain);
|
void setLastGain(float lastGain);
|
||||||
@ -52,6 +55,8 @@ private:
|
|||||||
|
|
||||||
int lastBandwidth;
|
int lastBandwidth;
|
||||||
int lastDemodType;
|
int lastDemodType;
|
||||||
|
bool lastDemodLock;
|
||||||
|
int lastDemodCons;
|
||||||
bool lastSquelchEnabled;
|
bool lastSquelchEnabled;
|
||||||
float lastSquelch;
|
float lastSquelch;
|
||||||
float lastGain;
|
float lastGain;
|
||||||
|
@ -26,7 +26,20 @@ DemodulatorThread::DemodulatorThread(DemodulatorThreadPostInputQueue* iqInputQue
|
|||||||
demodAM = demodAM_DSB_CSP;
|
demodAM = demodAM_DSB_CSP;
|
||||||
|
|
||||||
// advanced demodulators
|
// advanced demodulators
|
||||||
demodASK = modem_create(LIQUID_MODEM_ASK256);
|
// This could properly be done easier.
|
||||||
|
|
||||||
|
demodulatorCons = 2;
|
||||||
|
|
||||||
|
demodASK = modem_create(LIQUID_MODEM_ASK2);
|
||||||
|
demodASK2 = modem_create(LIQUID_MODEM_ASK2);
|
||||||
|
demodASK4 = modem_create(LIQUID_MODEM_ASK4);
|
||||||
|
demodASK8 = modem_create(LIQUID_MODEM_ASK8);
|
||||||
|
demodASK16 = modem_create(LIQUID_MODEM_ASK16);
|
||||||
|
demodASK32 = modem_create(LIQUID_MODEM_ASK32);
|
||||||
|
demodASK64 = modem_create(LIQUID_MODEM_ASK64);
|
||||||
|
demodASK128 = modem_create(LIQUID_MODEM_ASK128);
|
||||||
|
demodASK256 = modem_create(LIQUID_MODEM_ASK256);
|
||||||
|
|
||||||
demodAPSK = modem_create(LIQUID_MODEM_APSK256);
|
demodAPSK = modem_create(LIQUID_MODEM_APSK256);
|
||||||
demodBPSK = modem_create(LIQUID_MODEM_BPSK);
|
demodBPSK = modem_create(LIQUID_MODEM_BPSK);
|
||||||
demodDPSK = modem_create(LIQUID_MODEM_DPSK256);
|
demodDPSK = modem_create(LIQUID_MODEM_DPSK256);
|
||||||
@ -200,11 +213,14 @@ void DemodulatorThread::threadMain() {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case DEMOD_TYPE_ASK:
|
case DEMOD_TYPE_ASK:
|
||||||
|
if(demodulatorCons == 2) {
|
||||||
|
demodASK = demodASK2;
|
||||||
|
}
|
||||||
for (int i = 0; i < bufSize; i++) {
|
for (int i = 0; i < bufSize; i++) {
|
||||||
modem_demodulate(demodASK, inp->data[i], &bitstream);
|
modem_demodulate(demodASK, inp->data[i], &bitstream);
|
||||||
// std::cout << bitstream << std::endl;
|
// std::cout << bitstream << std::endl;
|
||||||
}
|
}
|
||||||
updateDemodulatorLock(demodASK, 0.8f);
|
updateDemodulatorLock(demodASK, 0.5f);
|
||||||
break;
|
break;
|
||||||
case DEMOD_TYPE_BPSK:
|
case DEMOD_TYPE_BPSK:
|
||||||
for (int i = 0; i < bufSize; i++) {
|
for (int i = 0; i < bufSize; i++) {
|
||||||
@ -572,6 +588,15 @@ int DemodulatorThread::getDemodulatorLock() {
|
|||||||
return currentDemodLock;
|
return currentDemodLock;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DemodulatorThread::setDemodulatorCons(int demod_cons_in) {
|
||||||
|
std::cout << "Updating constellations" << std::endl;
|
||||||
|
demodulatorCons = demod_cons_in;
|
||||||
|
}
|
||||||
|
|
||||||
|
int DemodulatorThread::getDemodulatorCons() {
|
||||||
|
return demodulatorCons;
|
||||||
|
}
|
||||||
|
|
||||||
void DemodulatorThread::updateDemodulatorLock(modem demod, float sensitivity) {
|
void DemodulatorThread::updateDemodulatorLock(modem demod, float sensitivity) {
|
||||||
modem_get_demodulator_evm(demod) <= sensitivity ? setDemodulatorLock(true) : setDemodulatorLock(false);
|
modem_get_demodulator_evm(demod) <= sensitivity ? setDemodulatorLock(true) : setDemodulatorLock(false);
|
||||||
}
|
}
|
||||||
|
@ -40,6 +40,9 @@ public:
|
|||||||
|
|
||||||
void setDemodulatorLock(bool demod_lock_in);
|
void setDemodulatorLock(bool demod_lock_in);
|
||||||
int getDemodulatorLock();
|
int getDemodulatorLock();
|
||||||
|
|
||||||
|
void setDemodulatorCons(int demod_cons_in);
|
||||||
|
int getDemodulatorCons();
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
static void *pthread_helper(void *context) {
|
static void *pthread_helper(void *context) {
|
||||||
@ -68,7 +71,17 @@ protected:
|
|||||||
ampmodem demodAM_DSB;
|
ampmodem demodAM_DSB;
|
||||||
ampmodem demodAM_LSB;
|
ampmodem demodAM_LSB;
|
||||||
ampmodem demodAM_USB;
|
ampmodem demodAM_USB;
|
||||||
modem demodASK;
|
|
||||||
|
modem demodASK;
|
||||||
|
modem demodASK2;
|
||||||
|
modem demodASK4;
|
||||||
|
modem demodASK8;
|
||||||
|
modem demodASK16;
|
||||||
|
modem demodASK32;
|
||||||
|
modem demodASK64;
|
||||||
|
modem demodASK128;
|
||||||
|
modem demodASK256;
|
||||||
|
|
||||||
modem demodAPSK;
|
modem demodAPSK;
|
||||||
modem demodBPSK;
|
modem demodBPSK;
|
||||||
modem demodDPSK;
|
modem demodDPSK;
|
||||||
@ -88,6 +101,7 @@ protected:
|
|||||||
std::atomic<bool> stereo;
|
std::atomic<bool> stereo;
|
||||||
std::atomic<bool> terminated;
|
std::atomic<bool> terminated;
|
||||||
std::atomic<int> demodulatorType;
|
std::atomic<int> demodulatorType;
|
||||||
|
std::atomic<int> demodulatorCons;
|
||||||
int audioSampleRate;
|
int audioSampleRate;
|
||||||
|
|
||||||
DemodulatorThreadCommandQueue* threadQueueNotify;
|
DemodulatorThreadCommandQueue* threadQueueNotify;
|
||||||
|
@ -309,7 +309,10 @@ void PrimaryGLContext::DrawDemod(DemodulatorInstance *demod, RGBColor color, lon
|
|||||||
// add lock to string if we have an lock
|
// add lock to string if we have an lock
|
||||||
if(demod->getDemodulatorLock()) {
|
if(demod->getDemodulatorLock()) {
|
||||||
demodStr = demodStr + " Lock";
|
demodStr = demodStr + " Lock";
|
||||||
}
|
}
|
||||||
|
// else {
|
||||||
|
// demodStr = demodStr + " UnLock";
|
||||||
|
// }
|
||||||
|
|
||||||
glColor3f(0, 0, 0);
|
glColor3f(0, 0, 0);
|
||||||
getFont(PrimaryGLContext::GLFONT_SIZE16).drawString(demodStr, 2.0 * (uxPos - 0.5) + xOfs, -1.0 + hPos - yOfs, 16, demodAlign,
|
getFont(PrimaryGLContext::GLFONT_SIZE16).drawString(demodStr, 2.0 * (uxPos - 0.5) + xOfs, -1.0 + hPos - yOfs, 16, demodAlign,
|
||||||
|
Loading…
Reference in New Issue
Block a user