diff --git a/plugins/samplesource/testsource/readme.md b/plugins/samplesource/testsource/readme.md
index 8ddcb39df..6b198eaa1 100644
--- a/plugins/samplesource/testsource/readme.md
+++ b/plugins/samplesource/testsource/readme.md
@@ -2,7 +2,7 @@
Introduction
-This input sample source plugin is an internal continuous wave generator that can be used to carry out test of software internals.
+This input sample source plugin is an internal continuous wave generator that can be used to carry out test of software internals.
Build
@@ -22,19 +22,19 @@ This is the center frequency of reception in kHz.
1.2: Start/Stop
-Device start / stop button.
+Device start / stop button.
- Blue triangle icon: device is ready and can be started
- Green square icon: device is running and can be stopped
- Magenta (or pink) square icon: an error occurred. In the case the device was accidentally disconnected you may click on the icon, plug back in and start again.
-
+
1.3: Record
Record baseband I/Q stream toggle button
1.4: Stream sample rate
-Baseband I/Q sample rate in kS/s. This is the device to host sample rate (3) divided by the decimation factor (4).
+Baseband I/Q sample rate in kS/s. This is the device to host sample rate (3) divided by the decimation factor (4).
2: Various options
@@ -57,10 +57,10 @@ This exercises the decimation chain.
2.3: Baseband center frequency position relative the center frequency
- **Cen**: the decimation operation takes place around the center frequency Fs
- - **Inf**: the decimation operation takes place around Fs - Fc.
+ - **Inf**: the decimation operation takes place around Fs - Fc.
- **Sup**: the decimation operation takes place around Fs + Fc.
-
-With SR as the sample rate before decimation Fc is calculated as:
+
+With SR as the sample rate before decimation Fc is calculated as:
- if decimation n is 4 or lower: Fc = SR/2^(log2(n)-1). The device center frequency is on the side of the baseband. You need a RF filter bandwidth at least twice the baseband.
- if decimation n is 8 or higher: Fc = SR/n. The device center frequency is half the baseband away from the side of the baseband. You need a RF filter bandwidth at least 3 times the baseband.
@@ -89,7 +89,10 @@ This controls the generator sample rate in samples per second.
- **P1**: Pattern 1 is a sawtooth pattern
- Pulse width: 1000 samples
- Starts at full amplitude then amplitude decreases linearly down to zero
-
+ - **P2**: Pattern 2 is a 50% duty cycle square pattern
+ - Pulse width: 1000 samples
+ - Starts with a full amplitude pulse then down to zero for the duration of one pulse
+
5: Modulating tone frequency
This controls the modulating tone frequency in kHz in 10 Hz steps.
@@ -97,23 +100,23 @@ This controls the modulating tone frequency in kHz in 10 Hz steps.
6: Carrier shift from center frequency
Use this control to set the offset of the carrier from the center frequency of reception.
-
+
7: AM modulation factor
This controls the AM modulation factor from 0 to 99%
8: FM deviation
-This controls the frequency modulation deviation in kHz in 100 Hz steps. It cannot exceed the sample rate.
-
+This controls the frequency modulation deviation in kHz in 100 Hz steps. It cannot exceed the sample rate.
+
9: Amplitude coarse control
This slider controls the number of amplitude bits by steps of 100 bits. The total number of amplitude bits appear on the right.
-
+
10: Amplitude fine control
This slider controls the number of amplitude bits by steps of 1 bit. The signal power in dB relative to the maximum power (full bit range) appear on the right.
-
+
11: DC bias
Use this slider to give a DC component in percentage of maximum amplitude.
diff --git a/plugins/samplesource/testsource/testsourcegui.ui b/plugins/samplesource/testsource/testsourcegui.ui
index 2abaa5717..0706fc67e 100644
--- a/plugins/samplesource/testsource/testsourcegui.ui
+++ b/plugins/samplesource/testsource/testsourcegui.ui
@@ -490,6 +490,11 @@
P1
+ -
+
+ P2
+
+
-
diff --git a/plugins/samplesource/testsource/testsourceinput.cpp b/plugins/samplesource/testsource/testsourceinput.cpp
index 6a5509481..3d230b2d6 100644
--- a/plugins/samplesource/testsource/testsourceinput.cpp
+++ b/plugins/samplesource/testsource/testsourceinput.cpp
@@ -362,6 +362,8 @@ bool TestSourceInput::applySettings(const TestSourceSettings& settings, bool for
m_testSourceThread->setPattern0();
} else if (settings.m_modulation == TestSourceSettings::ModulationPattern1) {
m_testSourceThread->setPattern1();
+ } else if (settings.m_modulation == TestSourceSettings::ModulationPattern2) {
+ m_testSourceThread->setPattern2();
}
}
}
diff --git a/plugins/samplesource/testsource/testsourcesettings.h b/plugins/samplesource/testsource/testsourcesettings.h
index 9c1c8f3fe..60c7d055f 100644
--- a/plugins/samplesource/testsource/testsourcesettings.h
+++ b/plugins/samplesource/testsource/testsourcesettings.h
@@ -39,6 +39,7 @@ struct TestSourceSettings {
ModulationFM,
ModulationPattern0,
ModulationPattern1,
+ ModulationPattern2,
ModulationLast
} Modulation;
diff --git a/plugins/samplesource/testsource/testsourcethread.cpp b/plugins/samplesource/testsource/testsourcethread.cpp
index 5f37d726f..0e972b776 100644
--- a/plugins/samplesource/testsource/testsourcethread.cpp
+++ b/plugins/samplesource/testsource/testsourcethread.cpp
@@ -324,6 +324,24 @@ void TestSourceThread::generate(quint32 chunksize)
}
}
break;
+ case TestSourceSettings::ModulationPattern2: // 50% duty cycle square pattern
+ {
+ if (m_pulseSampleCount < m_pulseWidth) // 1
+ {
+ m_buf[i++] = (int16_t) (m_amplitudeBitsI + m_amplitudeBitsDC);
+ m_buf[i++] = (int16_t) (m_phaseImbalance * (float) m_amplitudeBitsQ);
+ } else { // 0
+ m_buf[i++] = m_amplitudeBitsDC;
+ m_buf[i++] = 0;
+ }
+
+ if (m_pulseSampleCount < 2*m_pulseWidth - 1) {
+ m_pulseSampleCount++;
+ } else {
+ m_pulseSampleCount = 0;
+ }
+ }
+ break;
case TestSourceSettings::ModulationNone:
default:
{
@@ -419,3 +437,9 @@ void TestSourceThread::setPattern1()
m_pulseWidth = 1000;
m_pulseSampleCount = 0;
}
+
+void TestSourceThread::setPattern2()
+{
+ m_pulseWidth = 1000;
+ m_pulseSampleCount = 0;
+}
diff --git a/plugins/samplesource/testsource/testsourcethread.h b/plugins/samplesource/testsource/testsourcethread.h
index 7667eddf8..0944c603e 100644
--- a/plugins/samplesource/testsource/testsourcethread.h
+++ b/plugins/samplesource/testsource/testsourcethread.h
@@ -77,6 +77,7 @@ public:
void setFMDeviation(float deviation);
void setPattern0();
void setPattern1();
+ void setPattern2();
private:
QMutex m_startWaitMutex;