Skip to content

Commit

Permalink
showing the working segment of the TII data
Browse files Browse the repository at this point in the history
  • Loading branch information
JvanKatwijk committed Jan 3, 2025
1 parent e649c86 commit 926eef4
Show file tree
Hide file tree
Showing 11 changed files with 1,761 additions and 528 deletions.
944 changes: 466 additions & 478 deletions qt-dab-6.9/forms-v7/config-helper.ui

Large diffs are not rendered by default.

624 changes: 624 additions & 0 deletions qt-dab-6.9/forms-v7/config-helper.ui-vertical

Large diffs are not rendered by default.

7 changes: 5 additions & 2 deletions qt-dab-6.9/forms-v7/dabradio-6.ui
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>612</width>
<height>329</height>
<height>267</height>
</rect>
</property>
<property name="sizePolicy">
Expand Down Expand Up @@ -63,7 +63,7 @@
<x>0</x>
<y>0</y>
<width>224</width>
<height>153</height>
<height>91</height>
</rect>
</property>
</widget>
Expand Down Expand Up @@ -498,6 +498,9 @@
</item>
<item>
<widget class="smallPushButton" name="tiiButton">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;This button controls the visibility of the so-called &amp;quot;dxDisplay&amp;quot;. If the dxScope is enabled - and the tii database is loaded (and your location is set), the dxDisplay shows the tii data, decoded in the current channel. This data encompasses not only the mainId and the subId, but also the name of the transmitter, and the distance from your specified location to that transmitter.&lt;/p&gt;&lt;p&gt;If the dxDisplay is NOT enabled, and the tii database is loaded, then the data on the transmitter whose data you are currently receiving is shown on the line to the left.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>tii disply</string>
</property>
Expand Down
612 changes: 612 additions & 0 deletions qt-dab-6.9/forms-v7/new-config-helper.ui

Large diffs are not rendered by default.

60 changes: 30 additions & 30 deletions qt-dab-6.9/forms-v7/new-display/display-widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
theFFT (4 * 512, false),
dabSettings_p (dabSettings) {
(void)mr;
int sliderValue;
QString settingsHeader = DISPLAY_WIDGET_SETTINGS;
setupUi (&myFrame);
set_position_and_size (dabSettings_p, &myFrame,
Expand All @@ -64,7 +63,7 @@ int sliderValue;
correlationScope_p = new correlationScope (correlationDisplay,
256, dabSettings_p);
TII_Scope_p = new spectrumScope (tiiDisplay,
512, dabSettings_p);
192, dabSettings_p);
channelScope_p = new channelScope (channelPlot,
NR_TAPS,
dabSettings_p);
Expand All @@ -75,7 +74,7 @@ int sliderValue;
512, 50);
//
// and the settings for the sliders:
sliderValue = value_i (dabSettings_p,
int sliderValue = value_i (dabSettings_p,
DISPLAY_WIDGET_SETTINGS,
"spectrumSlider", 30);
spectrumSlider -> setValue (sliderValue);
Expand Down Expand Up @@ -117,9 +116,9 @@ int sliderValue;
setMarkers = value_i (dabSettings_p,
DISPLAY_WIDGET_SETTINGS,
"setMarkers", 0) != 0;
show_marksButton -> setStyleSheet ("color:yellow");
QString qss = QString ("background-color: QColor (Qt::yellow), QColor(Qt::black)");
show_marksButton -> setStyleSheet (qss);
show_marksButton ->
setStyleSheet (
"background-color : green; color: white");
if (setMarkers)
show_marksButton -> setText ("no markers");
else
Expand Down Expand Up @@ -214,11 +213,6 @@ static floatQwt avg [4 * 512];
freq / 1000);
}

std::vector<corrElement> sort (std::vector<corrElement> in) {
std::vector<corrElement> res;
return res;
}

// for "corr" we get a segment of 1024 float values,
// with as second parameter a list of indices with maximum values
// and a list of transmitters
Expand All @@ -230,6 +224,7 @@ std::vector<corrElement> showData;
if (currentTab != SHOW_CORRELATION)
return;

(void)maxVals;

for (auto &theTransm : theTr) {
corrElement t;
Expand All @@ -244,7 +239,7 @@ std::vector<corrElement> showData;
}
float max = 0;
int maxInd = -1;
for (int i = 0; i < showData. size (); i ++) {
for (uint16_t i = 0; i < showData. size (); i ++) {
if (showData [i]. strength > max) {
maxInd = i;
max = showData [i]. strength;
Expand Down Expand Up @@ -282,7 +277,7 @@ std::vector<corrElement> showData;
Y_value [i] *= 50.0 / MMax;

waterfallScope_p -> display (X_axis, Y_value,
waterfallSlider -> value (),
0.1 * waterfallSlider -> value (),
v. size () / 2);
}
// for "null" we get a segment of 1024 timedomain samples
Expand Down Expand Up @@ -316,35 +311,40 @@ void displayWidget::show_null (Complex *v, int amount,
// for "tii" we get a segment of 2048 time domain samples,
// we take an FFT, do some averaging and display
void displayWidget::show_tii (std::vector<Complex> v, int freq) {
int l = v. size ();
floatQwt X_axis [512];
floatQwt Y_value [512];
floatQwt Y_value [512];

static floatQwt avg [4 * 512];
if (currentTab != SHOW_TII)
return;

theFFT. fft (v);
for (int i = 0; i < (int)(v. size ()) / 2; i ++) {
avg [i] = 0.5 * avg [i] + 0.5 * abs (v [l / 2 + i]);
avg [l / 2 + i] = 0.5 * avg [l / 2 + i] + 0.5 * abs (v [i]);
//
// in the regular scope we just show the data the tii decoder will
// be working on
floatQwt resVec [192];
for (int i = 0; i < 192; i ++) {
resVec [i] = 0;
for (int j = 0; j < 4; j ++) {
int index = (1024 + 2 * i + j * 384) % 1024;
resVec [i] += abs (v [index] + v [index + 1]);
}
X_axis [i] = i;
}

TII_Scope_p -> display (X_axis, resVec, 96,
tiiSlider -> value ());

for (int i = 0; i < 512; i ++) {
X_axis [i] = (freq - 1536000 / 2 + i * 1536000.0 / 512) / 1000000.0;
Y_value [i] = 0;
for (int j = 0; j < 4; j ++)
Y_value [i] += avg [4 * i + j];
Y_value [i] = get_db (Y_value [i]);
int index = (int)((float)i / 512 * 192);
Y_value [i] = resVec [index];
X_axis [i] = index;
}

TII_Scope_p -> display (X_axis, Y_value, freq / 1000,
tiiSlider -> value ());
for (int i = 0; i < 512; i ++)
Y_value [i] = (Y_value [i] - get_db (0)) / 6;
Y_value [i] = 4 * (Y_value [i] - get_db (0)) / 8;
waterfallScope_p -> display (X_axis, Y_value,
waterfallSlider -> value (),
freq / 1000);
1.5 * waterfallSlider -> value (),
96);
}

void displayWidget::show_channel (const std::vector<Complex> Values) {
Expand Down Expand Up @@ -483,7 +483,7 @@ void displayWidget::show_cpuLoad (float use) {

void displayWidget::show_transmitters (std::vector<transmitterDesc> &tr) {
QString textList;
for (int i = 0; i < tr. size (); i ++) {
for (uint16_t i = 0; i < tr. size (); i ++) {
uint16_t mainId = tr [i]. theTransmitter. mainId;
uint16_t subId = tr [i]. theTransmitter. subId;
QString trId = QString ("(") + QString::number (mainId) +
Expand Down
16 changes: 8 additions & 8 deletions qt-dab-6.9/forms-v7/new-display/scopes/spectrum-scope.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,26 +97,26 @@ bool brush;
}
spectrumCurve. attach (plotgrid);

Marker = new QwtPlotMarker();
Marker -> setLineStyle (QwtPlotMarker::VLine);
Marker -> setLinePen (QPen (Qt::red));
Marker -> attach (plotgrid);
// Marker = new QwtPlotMarker();
// Marker -> setLineStyle (QwtPlotMarker::VLine);
// Marker -> setLinePen (QPen (Qt::red));
// Marker -> attach (plotgrid);
plotgrid -> enableAxis (QwtPlot::yLeft);
bitDepth = 12;
normalizer = valueFor (bitDepth);
}

spectrumScope::~spectrumScope () {

delete Marker;
// delete Marker;
delete grid;
}

void spectrumScope::display (floatQwt *X_axis,
floatQwt *Y_value,
int freq, int Amp) {
(void)freq;
float Max = Amp / 100.0 * (-get_db (0));
float Max = Amp / 50.0 * (-get_db (0));
plotgrid -> setAxisScale (QwtPlot::xBottom,
(floatQwt)X_axis [0],
X_axis [displaySize - 1]);
Expand All @@ -128,8 +128,8 @@ void spectrumScope::display (floatQwt *X_axis,
Y_value [0] = get_db (0);
Y_value [displaySize - 1] = get_db (0);

spectrumCurve. setSamples (X_axis, Y_value, 512);
Marker -> setXValue (0);
spectrumCurve. setSamples (X_axis, Y_value, displaySize);
// Marker -> setXValue (0);
plotgrid -> replot ();
}

Expand Down
14 changes: 9 additions & 5 deletions qt-dab-6.9/forms-v7/new-display/scopes/waterfall-scope.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,18 @@
displaySize (displaySize_i),
rasterSize (rasterSize_i) {
colorMap = new QwtLinearColorMap (Qt::darkCyan, Qt::red);
colorMap -> addColorStop (0.1, Qt::cyan);
colorMap -> addColorStop (0.0, Qt::cyan);
// colorMap -> addColorStop (0.1, Qt::cyan);
colorMap -> addColorStop (0.4, Qt::green);
colorMap -> addColorStop (0.7, Qt::yellow);
colorMap -> addColorStop (0.6, Qt::yellow);
colorMap -> addColorStop (0.8, Qt::red);
rightAxis = plotgrid -> axisWidget (QwtPlot::yRight);
axisMap = new QwtLinearColorMap (Qt::darkCyan, Qt::red);
axisMap -> addColorStop (0.1, Qt::cyan);
axisMap -> addColorStop (0.0, Qt::cyan);
// axisMap -> addColorStop (0.1, Qt::cyan);
axisMap -> addColorStop (0.4, Qt::green);
axisMap -> addColorStop (0.7, Qt::yellow);
axisMap -> addColorStop (0.6, Qt::yellow);
axisMap -> addColorStop (0.8, Qt::red);
this -> setColorMap (colorMap);

this -> setDisplayMode (QwtPlotSpectrogram::ImageMode, true);
Expand Down Expand Up @@ -96,7 +100,7 @@ int width = (int)(X_axis [displaySize - 1] - orig);
width,
rasterSize,
displaySize,
amp / 2);
amp);

this -> setData (WaterfallData);
plotgrid -> setAxisScale (QwtPlot::xBottom,
Expand Down
6 changes: 3 additions & 3 deletions qt-dab-6.9/forms-v7/new-display/scopewidget.ui
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>774</width>
<width>780</width>
<height>607</height>
</rect>
</property>
Expand Down Expand Up @@ -36,7 +36,7 @@
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;The tabwidget here contains the tabs for the different scopes, supported by this Qt-DAB implementation&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="currentIndex">
<number>1</number>
<number>3</number>
</property>
<widget class="QWidget" name="spectr">
<attribute name="title">
Expand Down Expand Up @@ -167,7 +167,7 @@
<item>
<widget class="QwtPlot" name="tiiDisplay">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;The TII is encoded in the NULL period of a DAB frame. The scope shows the spectrum, the small vertical hair-like projections are the &amp;quot;bins&amp;quot;. Their position in the spectrum and their mutial ditances define the TII value. With a database the TII can be mapped onto a transmittername and location.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;The TII is encoded in the NULL period of a DAB frame. The NULL part is transformed into 1536 carriers, where the data is repeated 4 times, each time in a segment of 384 carriers. The data elements of the TII value are build up in 4 rods, each consisting on two subsequent carriers.&lt;/p&gt;&lt;p&gt;The scope shows the 192 elements of the collapsed data. The TII values are (in some cases) recognizable as 4 rods. The 4 rods are forming a 4 out of 8 code.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
Expand Down
2 changes: 1 addition & 1 deletion qt-devices/rtlsdr-handler-linux/rtlsdr-handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ char manufac [256], product [256], serial [256];
}

if (rtlsdr_set_tuner_bandwidth != nullptr)
rtlsdr_set_tuner_bandwidth (theDevice, KHz (1536));
rtlsdr_set_tuner_bandwidth (theDevice, KHz (1575));
rtlsdr_set_tuner_gain_mode (theDevice, 1);
//
// See what the saved values are and restore the GUI settings
Expand Down
2 changes: 1 addition & 1 deletion qt-devices/rtlsdr-handler-win/rtlsdr-handler-win.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ char manufac [256], product [256], serial [256];
}

rtlsdr_set_center_freq (theDevice, 220000000);
rtlsdr_set_tuner_bandwidth (theDevice, KHz (1536));
rtlsdr_set_tuner_bandwidth (theDevice, KHz (1575));
rtlsdr_set_tuner_gain_mode (theDevice, 1);
//
// See what the saved values are and restore the GUI settings
Expand Down
2 changes: 2 additions & 0 deletions src/ofdm/tii-detector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,8 @@ QVector<tiiData> theResult; // results
float threshold = pow (10, (float)threshold_db / 10); // threshold above noise
int Teller = 0;

if (selected_subId > 0) // handling collisions
tiiFilter = false;
for (int32_t idx = -carriers / 2; idx < carriers / 2; idx += 2) {
const int32_t fftIdx = idx < 0 ? idx + T_u : idx + 1;
decodedBuffer [Teller++] +=
Expand Down

0 comments on commit 926eef4

Please sign in to comment.