Skip to content

Commit

Permalink
to 6.30
Browse files Browse the repository at this point in the history
  • Loading branch information
JvanKatwijk committed Nov 27, 2023
1 parent a0f51b3 commit a8fe2f5
Show file tree
Hide file tree
Showing 35 changed files with 218 additions and 270 deletions.
30 changes: 17 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ Since some time the Qt-DAB versions have a button labeled **http**, when touched

By default, on starting the server, the "standard" browser on the system will be invoked, listening to port 8080. The configuration (configuration/control) widget contains a selector for switching this off, so that one might choose his/hers own browser.

The feature will not work if
The feature will *not* work if

* handling the TII database is not installed on the system, and/or
* you did not provide your "home" coordinates.
Expand All @@ -222,7 +222,7 @@ Documentation

An extensive **user's guide** - in PDF format - for the 6.1 version can be found in the "docs" section of the source tree. The documentation contains a complete description of the widgets, of the values in the `.ini` file, on configuring for creating an executable (Linux), and even a complete description on how to add a device to the configuration.

![Qt-DAB documentation](/qt-dab-manual.png?raw=true)
![Qt-DAB documentation](/qt-dab-6-manual.png?raw=true)


Installation on Windows
Expand All @@ -237,42 +237,46 @@ Installation on Linux-x64
=================================================================

For Linux-x64 systems, an **appImage** can be found in the releases section, https://github.com/JvanKatwijk/qt-dab/releases. The appImage contains
next to the executable qt-dab program, the required libraries.

Of course it is possible to generate an executable, the manual contains a complete script for Ubuntu type Linux versions.
next to the executable qt-dab program, the required libraries **but not
the support libraries for the configured devices**


Building an executable for Qt-DAB: a few notes
=================================================================

While for Linux-x64 and Windows there are precompiled versions, there may be reasons to build an executable. Building an executable is not very complicated, it is described in detail in the manual. Since it is customary to avoid reading a manual, here are the basic steps for the build process.
Iy is strongly advised to use qmake/make in the process, since the
Of course it is possible to generate an executable, a separate document
is available that contains a complete script for Ubuntu type Linux versions.

Since it is common to avoid reading a manual, here are
the basic steps for the build process.
It is strongly advised to use qmake/make in the process, since the
number of configuration options is larger and selecting configuration
options is much easier.

Step 1
-----------------------------------------------------------------

- :information_source: Note that the sources for 4.4.x are now in the subdirectory `qt-dab-s4` and for qt-dab-5.x in the subdirectory `qt-dab-s5`
- Install required libraries, see section 5.5.3 (page 29) of the manual.
- :information_source: Note that the sources for 6.x are now in the subdirectory `qt-dab-s6` and for qt-dab-5.x in the subdirectory `qt-dab-s5`
- Install required libraries,
* :information: It turns out that in recent versions of Debian (and related) distributions the lib `qt5-default` does not exist as as separate library.
- It seems to be part of another of the qt5 packages that is installed.
- Be aware that different distributions store qt files on different locations, adapt the INCLUDEPATH setting in the `.pro` file if needed.

Step 2
-----------------------------------------------------------------

While there are dozens of configuration options, take note of the following ones:
While there are dozens of configuration options, take note
of the following ones:

* Note on configuring DABsticks (i.e. RTLSDR type devices).
The Windows support library does not seem to be vapable of closing
The Windows support library does not seem to be capable of closing
the library and reopening it on switching channels. Therefore
a special version of the library is made, that is used for both
Windows and Linux.

* For including "soapy" in the configuration, soapy software should have been installed, so leave them commented out when not available. iF

:information_source: Note that "pluto-2" can be compiled in: as the other support programs, when the device is selected, the support program will (try to) read in the functions of the device library.
:information_source: Note that "pluto" can be compiled in: as the other support programs, when the device is selected, the support program will (try to) read in the functions of the device library.

For X64 PC's one may choose the option `CONFIG+=PC` (for selecting SSE instructions). If unsure, use `CONFIG+=NO_SSE`.

Expand Down Expand Up @@ -360,7 +364,7 @@ The picture shows the reader when reading a file, generated from raw data emitte

A Note on previous versions
=================================================================
Previous versions V5.4 and V4.7 will be maintained.
Previous versions V5.X and V4.X will - for the time being - be maintained.
Note that the different versions use the same sourcetree, the - almost -
only difference being the GUI and its control.

Expand Down
Binary file modified docs/builder.pdf
Binary file not shown.
2 changes: 2 additions & 0 deletions includes/dab-constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ typedef float DABFLOAT;
#endif
typedef std::complex<DABFLOAT> Complex;

#define DEFAULT_SWITCHVALUE 6

#ifndef M_PI
# define M_PI 3.14159265358979323846 /* pi */
#endif
Expand Down
58 changes: 8 additions & 50 deletions includes/scopes-qwt6/spectrogramdata.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,9 @@
//
// Qwt 6.2 is different from the 6.1 version, these mods
// seem to work
//#if defined QWT_VERSION && ((QWT_VERSION >> 8) < 0x0602)
# include <qwt_raster_data.h>
//#else
//# include <qwt_matrix_raster_data.h>
//#endif

//#if defined QWT_VERSION && ((QWT_VERSION >> 8) < 0x0602)
class SpectrogramData: public QwtRasterData {
//#else
//class SpectrogramData: public QwtMatrixRasterData {
//#endif
class spectrogramData: public QwtRasterData {
public:
double *data; // pointer to actual data
int left; // index of left most element in raster
Expand All @@ -50,50 +42,16 @@ class SpectrogramData: public QwtRasterData {
int dataheight; // for now == rasterheigth
double max;

SpectrogramData (double *data, int left, int width, int height,
int datawidth, double max):
//#if defined QWT_VERSION && ((QWT_VERSION >> 8) < 0x0602)
QwtRasterData () {
//#else
// QwtMatrixRasterData () {
//#endif
this -> data = data;
this -> left = left;
this -> width = width;
this -> height = height;
this -> datawidth = datawidth;
this -> dataheight = height;
this -> max = max;
#if defined QWT_VERSION && ((QWT_VERSION >> 8) < 0x0602)
setInterval (Qt::XAxis, QwtInterval (left, left + width));
setInterval (Qt::YAxis, QwtInterval (0, height));
setInterval (Qt::ZAxis, QwtInterval (0, max));
#endif
}
spectrogramData (double *data, int left,
int width, int height,
int datawidth, double max);

void initRaster (const QRectF &x, const QSize &raster) {
(void)x;
(void)raster;
}
~spectrogramData ();

QwtInterval interval (Qt::Axis x) const {
if (x == Qt::XAxis)
return QwtInterval (left, left + width);
if (x == Qt::YAxis)
return QwtInterval (0, height);
return QwtInterval (0, max);
}
void initRaster (const QRectF &x, const QSize &raster);

~SpectrogramData() {
}

double value (double x, double y) const {
//fprintf (stderr, "x = %f, y = %f\n", x, y);
x = x - left;
x = x / width * (datawidth - 1);
y = y / height * (dataheight - 1);
return data [(int)y * datawidth + (int)x];
}
QwtInterval interval (Qt::Axis x) const;

double value (double x, double y) const;
};

File renamed without changes.
131 changes: 71 additions & 60 deletions includes/support/ringbuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@
#include <cstdio>
#include <cstring>
#include <cstdint>
#include <vector>
#include <atomic>
/*
* a simple ringbuffer, lockfree, however only for a
* single reader and a single writer.
Expand Down Expand Up @@ -139,27 +141,22 @@ template <class elementtype>
class RingBuffer {
private:
uint32_t bufferSize;
volatile uint32_t writeIndex;
volatile uint32_t readIndex;
std::atomic<uint32_t> writeIndex;
std::atomic<uint32_t> readIndex;
uint32_t bigMask;
uint32_t smallMask;
char *buffer;
std::vector<char> buffer;
public:
RingBuffer (uint32_t elementCount) {
if (((elementCount - 1) & elementCount) != 0)
elementCount = 64 * 16384; /* default */

bufferSize = elementCount;
buffer = new char [2 * bufferSize * sizeof (elementtype)];
RingBuffer (uint32_t elementCount) {
bufferSize = checkSize (elementCount);
buffer. resize (2 * bufferSize * sizeof (elementtype));
writeIndex = 0;
readIndex = 0;
smallMask = (elementCount)- 1;
bigMask = (elementCount * 2) - 1;
smallMask = (bufferSize)- 1;
bigMask = (bufferSize << 1) - 1;
}

~RingBuffer() {
delete[] buffer;
}
~RingBuffer () { }

/*
* functions for checking available data for reading and space
Expand All @@ -169,24 +166,24 @@ int32_t GetRingBufferReadAvailable() {
return (writeIndex - readIndex) & bigMask;
}

int32_t ReadSpace(){
return GetRingBufferReadAvailable();
int32_t ReadSpace (){
return GetRingBufferReadAvailable();
}

int32_t GetRingBufferWriteAvailable() {
return bufferSize - GetRingBufferReadAvailable();
int32_t GetRingBufferWriteAvailable () {
return bufferSize - GetRingBufferReadAvailable();
}

int32_t WriteSpace() {
return GetRingBufferWriteAvailable();
int32_t WriteSpace () {
return GetRingBufferWriteAvailable();
}

void FlushRingBuffer() {
writeIndex = 0;
readIndex = 0;
}
/* ensure that previous writes are seen before we update the write index
(write after write)
/* ensure that previous writes are seen before we
* update the write index (write after write)
*/
int32_t AdvanceRingBufferWriteIndex (int32_t elementCount) {
PaUtil_WriteMemoryBarrier();
Expand Down Expand Up @@ -240,44 +237,6 @@ uint32_t available = GetRingBufferWriteAvailable();
return elementCount;
}

/***************************************************************************
** Get address of region(s) from which we can read data.
** If the region is contiguous, size2 will be zero.
** If non-contiguous, size2 will be the size of second region.
** Returns room available to be read or elementCount, whichever is smaller.
*/
int32_t GetRingBufferReadRegions (uint32_t elementCount,
void **dataPtr1, int32_t *sizePtr1,
void **dataPtr2, int32_t *sizePtr2) {
uint32_t index;
uint32_t available = GetRingBufferReadAvailable(); /* doesn't use memory barrier */

if (elementCount > available)
elementCount = available;

/* Check to see if read is not contiguous. */
index = readIndex & smallMask;
if ((index + elementCount) > bufferSize) {
/* Write data in two blocks that wrap the buffer. */
int32_t firstHalf = bufferSize - index;
*dataPtr1 = &buffer [index * sizeof(elementtype)];
*sizePtr1 = firstHalf;
*dataPtr2 = &buffer [0];
*sizePtr2 = elementCount - firstHalf;
}
else {
*dataPtr1 = &buffer [index * sizeof(elementtype)];
*sizePtr1 = elementCount;
*dataPtr2 = nullptr;
*sizePtr2 = 0;
}

if (available)
PaUtil_ReadMemoryBarrier(); /* (read-after-read) => read barrier */

return elementCount;
}

int32_t putDataIntoBuffer (const void *data, int32_t elementCount) {
int32_t size1, size2, numWritten;
void *data1;
Expand Down Expand Up @@ -318,6 +277,44 @@ void *data2;
return numRead;
}

/***************************************************************************
** Get address of region(s) from which we can read data.
** If the region is contiguous, size2 will be zero.
** If non-contiguous, size2 will be the size of second region.
** Returns room available to be read or elementCount, whichever is smaller.
*/
int32_t GetRingBufferReadRegions (uint32_t elementCount,
void **dataPtr1, int32_t *sizePtr1,
void **dataPtr2, int32_t *sizePtr2) {
uint32_t index;
uint32_t available = GetRingBufferReadAvailable(); /* doesn't use memory barrier */

if (elementCount > available)
elementCount = available;

/* Check to see if read is not contiguous. */
index = readIndex & smallMask;
if ((index + elementCount) > bufferSize) {
/* Write data in two blocks that wrap the buffer. */
int32_t firstHalf = bufferSize - index;
*dataPtr1 = &buffer [index * sizeof(elementtype)];
*sizePtr1 = firstHalf;
*dataPtr2 = &buffer [0];
*sizePtr2 = elementCount - firstHalf;
}
else {
*dataPtr1 = &buffer [index * sizeof(elementtype)];
*sizePtr1 = elementCount;
*dataPtr2 = nullptr;
*sizePtr2 = 0;
}

if (available)
PaUtil_ReadMemoryBarrier(); /* (read-after-read) => read barrier */

return elementCount;
}

int32_t skipDataInBuffer (uint32_t n_values) {
// ensure that we have the correct read and write indices
PaUtil_FullMemoryBarrier();
Expand All @@ -327,5 +324,19 @@ int32_t skipDataInBuffer (uint32_t n_values) {
return n_values;
}

uint32_t checkSize (uint32_t val) {
uint32_t a = 1;

if ((val & (val - 1)) == 0)
return val;
//
// assume a reasonable maximum for the buffer size
for (uint32_t i = 0; i < 22; i ++) {
if (a > val)
return a;
a <<= 1;
}
return 32768;
}
};

Binary file added qt-dab-6-manual.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed qt-dab-manual.png
Binary file not shown.
Loading

0 comments on commit a8fe2f5

Please sign in to comment.