Added ability to select ADC1 or ADC2 from the floating rcvr widget.

This commit is contained in:
mh
2018-01-13 08:07:56 -05:00
parent 7f760f11ed
commit efde2f1a1f
16 changed files with 328 additions and 49 deletions
+42 -8
View File
@@ -59,6 +59,8 @@
*/
static int firstTimeRxInit;
static quint8 adc_rx1_4, adc_rx5_8, adc_rx9_16;
static quint8 new_adc_rx1_4, new_adc_rx5_8, new_adc_rx9_16;
DataEngine::DataEngine(QObject *parent)
: QObject(parent)
@@ -532,7 +534,6 @@ bool DataEngine::getFirmwareVersions() {
if (!initReceivers(rcvrs)) return false;
if (!m_dataIO) createDataIO();
if (!m_dataProcessor) createDataProcessor();
@@ -3358,7 +3359,7 @@ void DataProcessor::encodeCCBytes() {
if (de->io.tx_freq_change >= 0) {
de->io.output_buffer[4] = de->RX.at(de->io.tx_freq_change)->getCtrFrequency() >> 24;
de->io.output_buffer[4] = de->RX.at(de->io.tx_freq_change)->getCtrFrequency() >> 24;
de->io.output_buffer[5] = de->RX.at(de->io.tx_freq_change)->getCtrFrequency() >> 16;
de->io.output_buffer[6] = de->RX.at(de->io.tx_freq_change)->getCtrFrequency() >> 8;
de->io.output_buffer[7] = de->RX.at(de->io.tx_freq_change)->getCtrFrequency();
@@ -3380,13 +3381,13 @@ void DataProcessor::encodeCCBytes() {
// C0 = 0 0 0 1 0 0 0 x C1, C2, C3, C4 NCO Frequency in Hz for Receiver _7
// C0 = 0 0 1 0 0 1 0 x C1, C2, C3, C4 NCO Frequency in Hz for Receiver _8 // Was 0 0 0 1 0 0 1 x
// C0 = 0 0 1 1 0 1 0 x C1, C2, C3, C4 NCO Frequency in Hz for Receiver _16
// C0 = 0 0 1 1 0 1 0 x C1, C2, C3, C4 NCO Frequency in Hz for Receiver _16
// C0 = 0 1 0 1 0 1 0 x C1, C2, C3, C4 NCO Frequency in Hz for Receiver _32
// RRK, workaround for gige timing bug, make sure all rx freq's are sent on init.
if (firstTimeRxInit) {
firstTimeRxInit -= 1;
de->io.rx_freq_change = firstTimeRxInit;
}
// RRK, workaround for gige timing bug, make sure all rx freq's are sent on init.
if (firstTimeRxInit) {
firstTimeRxInit -= 1;
de->io.rx_freq_change = firstTimeRxInit;
}
if (de->io.rx_freq_change >= 0) {
@@ -3526,9 +3527,42 @@ void DataProcessor::encodeCCBytes() {
for (int i = 0; i < 5; i++)
de->io.output_buffer[i+3] = de->io.control_out[i];
// check if we need to update ADC C&C's
new_adc_rx1_4 = new_adc_rx5_8 = new_adc_rx9_16 = 0;
for (int i = 0; i < set->getNumberOfReceivers(); i++) {
if (i < 4) new_adc_rx1_4 |= de->RX.at(i)->getADCMode() << (i * 2);
else if (i < 8) new_adc_rx5_8 |= de->RX.at(i)->getADCMode() << ((i-4) * 2);
else if (i < 16) new_adc_rx9_16 |= de->RX.at(i)->getADCMode() << (i-8);
}
if ((new_adc_rx1_4 != adc_rx1_4) || (new_adc_rx5_8 != adc_rx5_8) || (new_adc_rx9_16 != adc_rx9_16))
m_sendState = 4;
else
m_sendState = 0;
break;
case 4:
// setup data for ADC c&c's
adc_rx1_4 = new_adc_rx1_4;
adc_rx5_8 = new_adc_rx5_8;
adc_rx9_16 = new_adc_rx9_16;
de->io.control_out[0] = 0x1C; // 0 0 0 1 1 1 0 x
de->io.control_out[1] = adc_rx1_4; // C1
de->io.control_out[2] = adc_rx5_8; // C2
de->io.control_out[3] = 0x0; // C3, ADC Input Attenuator Tx (0-31dB) [4:0]
de->io.control_out[4] = adc_rx9_16; // C4
// fill the out buffer with the C&C bytes
for (int i = 0; i < 5; i++)
de->io.output_buffer[i+3] = de->io.control_out[i];
//DATA_PROCESSOR_DEBUG << "rx_adc_change rcvr: " << hex << new_adc_rx1_4 << "," << hex << new_adc_rx5_8 << "," << hex << new_adc_rx9_16;
// round finished
m_sendState = 0;
break;
}
de->io.mutex.unlock();
+19
View File
@@ -119,6 +119,12 @@ void Receiver::setupConnections() {
this,
SLOT(setHamBand(QObject *, int, bool, HamBand)));
CHECKED_CONNECT(
set,
SIGNAL(adcModeChanged(QObject *, int, ADCMode)),
this,
SLOT(setADCMode(QObject *, int, ADCMode)));
CHECKED_CONNECT(
set,
SIGNAL(agcModeChanged(QObject *, int, AGCMode, bool)),
@@ -220,6 +226,7 @@ void Receiver::setReceiverData(TReceiver data) {
m_hamBand = m_receiverData.hamBand;
m_dspMode = m_receiverData.dspMode;
m_dspModeList = m_receiverData.dspModeList;
m_adcMode = m_receiverData.adcMode;
m_agcMode = m_receiverData.agcMode;
m_agcGain = m_receiverData.acgGain;
m_agcFixedGain_dB = m_receiverData.agcFixedGain_dB;
@@ -478,6 +485,18 @@ void Receiver::setDspMode(QObject *sender, int rx, DSPMode mode) {
//emit messageEvent(msg.arg(rx).arg(set->getDSPModeString(m_dspMode)));
}
void Receiver::setADCMode(QObject *sender, int rx, ADCMode mode) {
Q_UNUSED(sender)
if (m_receiver != rx) return;
if (m_adcMode == mode) return;
m_adcMode = mode;
//RECEIVER_DEBUG << "RRK setADCMode = " << m_adcMode;
}
void Receiver::setAGCMode(QObject *sender, int rx, AGCMode mode, bool hang) {
Q_UNUSED(sender)
+3
View File
@@ -62,6 +62,7 @@ public:
QSDR::_DSPCore getDSPCoreMode() const;
QHostAddress getPeerAddress() { return m_peerAddress; }
HamBand getHamBand() { return m_hamBand; }
ADCMode getADCMode() { return m_adcMode; }
AGCMode getAGCMode() { return m_agcMode; }
QList<int> getMercuryAttenuators() { return m_mercuryAttenuators; }
QList<DSPMode> getDSPModeList() { return m_dspModeList; }
@@ -116,6 +117,7 @@ public slots:
void setSampleRate(int value);
void setHamBand(QObject* sender, int rx, bool byBtn, HamBand band);
void setDspMode(QObject* sender, int rx, DSPMode mode);
void setADCMode(QObject* sender, int rx, ADCMode mode);
void setAGCMode(QObject* sender, int rx, AGCMode mode, bool hang);
void setAGCGain(QObject* sender, int rx, int value);
void setAudioVolume(QObject* sender, int rx, float value);
@@ -171,6 +173,7 @@ private:
HamBand m_hamBand;
DSPMode m_dspMode;
AGCMode m_agcMode;
ADCMode m_adcMode;
TDefaultFilterMode m_filterMode;
QList<long> m_lastCtrFrequencyList;