Skip to content

Commit

Permalink
minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
JvanKatwijk committed Apr 19, 2024
1 parent 81e1d7b commit d26d314
Show file tree
Hide file tree
Showing 12 changed files with 76 additions and 32 deletions.
Binary file removed docs/builder.pdf
Binary file not shown.
Binary file modified docs/manual-6.pdf
Binary file not shown.
4 changes: 3 additions & 1 deletion includes/ofdm/tii-detector.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,19 @@
#include <complex>
#include <vector>
#include "fft-handler.h"
class QSettings;

class TII_Detector {
public:
TII_Detector (uint8_t dabMode, int16_t);
TII_Detector (uint8_t dabMode, QSettings *, int16_t);
~TII_Detector ();
void reset ();
void setMode (bool);
void addBuffer (std::vector<Complex>);
std::vector<int16_t> processNULL (bool);

private:
QSettings *dabSettings;
dabParams params;
int16_t T_u;
int16_t carriers;
Expand Down
3 changes: 2 additions & 1 deletion ofdm-handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@
theEtiGenerator (p -> dabMode,
&theFicHandler),
theTIIDetector (p -> dabMode,
p -> tii_depth),
dabSettings,
p -> tii_depth),
theOfdmDecoder (mr,
p -> dabMode,
inputDevice -> bitDepth(),
Expand Down
1 change: 0 additions & 1 deletion qt-dab-RC/qt-dab-RC.pro
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ RESOURCES += resources.qrc

TRANSLATIONS = ../i18n/de_DE.ts
DEFINES += __HAS_CHANNEL__
#DEFINES += __ESTIMATOR__
#
# For more parallel processing, uncomment the following
# defines
Expand Down
1 change: 0 additions & 1 deletion qt-dab-RC/qt-dab-RC.pro-32
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ RESOURCES += resources.qrc

TRANSLATIONS = ../i18n/de_DE.ts
DEFINES += __HAS_CHANNEL__
#DEFINES += __ESTIMATOR__
#
# For more parallel processing, uncomment the following
# defines
Expand Down
73 changes: 51 additions & 22 deletions qt-dab-RC/radio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -620,6 +620,21 @@ void RadioInterface::doStart_direct () {
// after the preset timer signals, the service will be started
}
startChannel (channelSelector -> currentText ());
int auto_http = dabSettings_p -> value ("auto_http", 0). toInt ();
#ifdef __TRACE__
fprintf (stderr, "auto_http = %d\n", auto_http);
#endif
if ((auto_http != 0) && (localPos. latitude != 0)) {
#ifdef __TRACE__
fprintf (stderr, "Going to work on autostart http\n");
#endif
bool succ = autoStart_http ();
#ifdef __TRACE__
fprintf (stderr, "autostart ? %d\n", succ? 1 : 0);
#endif
if (succ)
httpButton -> setText ("http-on");
}
running. store (true);
}

Expand Down Expand Up @@ -2964,23 +2979,18 @@ QColor color;
///////////////////////////////////////////////////////////////////////////
// Handling schedule

static
char *scheduleList[] = {"nothing", "exit", "framedump", "dltext", "ficDump"};

void RadioInterface::handle_scheduleButton () {
QStringList candidates;
scheduleSelector theSelector;
QString scheduleService;

theSelector. addtoList ("nothing");
theSelector. addtoList ("exit");
theSelector. addtoList ("framedump");
theSelector. addtoList ("audiodump");
theSelector. addtoList ("dlText");
theSelector. addtoList ("ficDump");
candidates += "nothing";
candidates += "exit";
candidates += "framedump";
candidates += "audiodump";
candidates += "dlText";
candidates += "ficDump";
for (int i = 0; i < 5; i ++) {
theSelector. addtoList (QString (scheduleList [i]));
candidates += QString (scheduleList [i]);
}

QStringList selectables = the_ensembleHandler -> getSelectables ();
for (auto &candidate: selectables) {
Expand Down Expand Up @@ -3335,7 +3345,30 @@ QString theTime;
theTime. toUtf8 (). data (),
a1. toUtf8 (). data (), a2. toUtf8 (). data ());
}
//

bool RadioInterface::autoStart_http () {
if (localPos. latitude == 0)
return false;
if (mapHandler != nullptr)
return false;
QString browserAddress =
dabSettings_p -> value (BROWSER_ADDRESS,
"http://localhost"). toString ();
QString mapPort =
dabSettings_p -> value (MAP_PORT_SETTING,
8080). toString ();

mapHandler = new httpHandler (this,
mapPort,
browserAddress,
localPos,
"",
configHandler_p -> localBrowserSelector_active (), dabSettings_p);
maxDistance = -1;
return mapHandler != nullptr;
}


// ensure that we only get a handler if we have a start location
void RadioInterface::handle_httpButton () {
if (localPos. latitude == 0) {
Expand Down Expand Up @@ -3532,6 +3565,7 @@ bool listChanged = false;

bool dxMode = configHandler_p -> get_dxSelector ();

// fprintf (stderr, "entered show_tii with values %d %d\n", tiiValue, index);
if (!dxMode)
channel. transmitters. resize (0);
if (!running. load () ||(mainId == 0xFF)) // shouldn't be
Expand All @@ -3558,7 +3592,8 @@ bool listChanged = false;

if (!tiiProcessor. has_tiiFile ())
return;
//

// fprintf (stderr, "Passed tests for %d %d\n", tiiValue, index);
// OK, here we really start
bool inList = false;
for (uint16_t i = 0; i < channel. transmitters. size (); i ++) {
Expand Down Expand Up @@ -3772,7 +3807,7 @@ void RadioInterface::show_rsCorrections (int c, int ec) {
techWindow_p -> show_rsCorrections (c, ec);
}
//
// called from the DAB processor
// called from the ofdm handler
void RadioInterface::show_clock_error (int d) {
if (!running. load ())
return;
Expand Down Expand Up @@ -3819,15 +3854,11 @@ void RadioInterface::handle_presetButton () {
}
mode = mode == SHOW_ENSEMBLE ? SHOW_PRESETS : SHOW_ENSEMBLE;
the_ensembleHandler -> set_showMode (mode);
if (mode == SHOW_ENSEMBLE)
presetButton -> setText ("favorites");
else
presetButton -> setText ("ensemble");
presetButton -> setText (mode == SHOW_ENSEMBLE ? "favorites" : "ensemble");
}

void RadioInterface::set_soundLabel (bool f) {
QPixmap p;

if (f)
p. load (":res/volume_on.png", "png");
else
Expand Down Expand Up @@ -3968,8 +3999,6 @@ void RadioInterface::handle_dxSelector (int d) {
}

void RadioInterface::channelSignal (const QString &channel) {
fprintf (stderr, "we gaan channelen naar %s\n",
channel. toLatin1 (). data ());
stopChannel ();
startChannel (channel);
}
Expand Down
1 change: 1 addition & 0 deletions qt-dab-RC/radio.h
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ Q_OBJECT

// end of variables that are initalized

bool autoStart_http ();
dabService checkPresets ();
int int_configValue (const QString &, int);

Expand Down
4 changes: 2 additions & 2 deletions src/backend/data/journaline-screen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@
this, &journalineScreen::handle_upButton);
connect (subContent, &QListView::clicked,
this, &journalineScreen::select_sub);
#ifdef __USE_JOURNALINE__
//#ifdef __USE_JOURNALINE__
myFrame. show ();
#endif
//#endif
}

journalineScreen::~journalineScreen () {
Expand Down
11 changes: 7 additions & 4 deletions src/ofdm/tii-detector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#include <cstdio>
#include <cinttypes>
#include <cstring>
//
#include <QSettings>

#ifndef M_PI
# define M_PI 3.14159265358979323846 /* pi */
Expand Down Expand Up @@ -111,15 +111,15 @@ uint8_t table [] = {
0360 // 1 1 1 1 0 0 0 0 69
};

#define MIN_TERM 4
TII_Detector::TII_Detector (uint8_t dabMode,
QSettings *dabSettings,
int16_t depth):
params (dabMode),
T_u (params. get_T_u ()),
carriers (params. get_carriers ()),
my_fftHandler (params. get_T_u (),
false) {

this -> dabSettings = dabSettings;
this -> depth = depth;
theBuffer. resize (T_u);
window. resize (T_u);
Expand All @@ -130,6 +130,7 @@ uint8_t table [] = {
for (int i = 0; i < 70; ++i)
invTable [table [i]] = i;
detectMode_new = false;

}

TII_Detector::~TII_Detector () {
Expand Down Expand Up @@ -194,6 +195,8 @@ int D_table [GROUPSIZE]; // count of indices in C_table with data
float avgTable [NUM_GROUPS];
std::vector<int16_t> theResult;

int tiiThreshold
= dabSettings -> value ("tii-threashold", 4). toInt ();
// we map the "carriers" carriers (complex values) onto
// a collapsed vector of "carriers / 8" length,
// considered to consist of 8 segments of 24 values
Expand Down Expand Up @@ -236,7 +239,7 @@ std::vector<int16_t> theResult;
// We only use the C and D table to locate the start offset
for (int i = 0; i < GROUPSIZE; i ++) {
for (int j = 0; j < NUM_GROUPS; j ++) {
if (hulpTable [j * GROUPSIZE + i] > MIN_TERM * avgTable [j]) {
if (hulpTable [j * GROUPSIZE + i] > tiiThreshold * avgTable [j]) {
C_table [i] += hulpTable [j * GROUPSIZE + i];
D_table [i] ++;
}
Expand Down
3 changes: 3 additions & 0 deletions src/support/http-handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,9 @@ int params = 0;

int mapChoice = dabSettings == nullptr ? 0 :
dabSettings -> value ("mapChoice", 0). toInt ();
#ifdef __TRACE__
fprintf (stderr, "We found for mapChoice %d\n", mapChoice);
#endif
// read map file from resource file
QFile file (mapChoice == 0 ? ":res/qt-map.html" :
":res/qt-map-6X.html");
Expand Down
7 changes: 7 additions & 0 deletions src/support/tii-library/tii-reader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,15 @@ std::vector<cacheElement> res;

res. resize (0);
FILE *f = fopen (s. toUtf8 (). data (), "r+b");
#ifdef __TRACE__
if (f == nullptr)
fprintf (stderr, "Cannot open %s\n", s. toUtf8 (). data ());
#endif
if (f == nullptr)
return res;
#ifdef __TRACE__
fprintf (stderr, "File %s is opened\n", s. toUtf8 (). data ());
#endif
int count = 0;
char buffer [1024];
std::vector<QString> columnVector;
Expand Down

0 comments on commit d26d314

Please sign in to comment.