From 2670c17f6ab4bb63ee36627d5db9c707a92007e3 Mon Sep 17 00:00:00 2001 From: f4exb Date: Sun, 8 Jul 2018 18:59:09 +0200 Subject: [PATCH] Scope: fixed vertical scale display and extended amp range --- Readme.md | 24 ++++++++++++------------ sdrgui/gui/glscopeng.cpp | 24 ++++++++++++++++-------- sdrgui/gui/glscopenggui.cpp | 24 ++++++++++++++++++------ sdrgui/gui/glscopenggui.h | 2 +- sdrgui/gui/glscopenggui.ui | 2 +- sdrgui/gui/scaleengine.cpp | 33 +++++++++++++++++---------------- sdrgui/gui/scaleengine.h | 2 ++ 7 files changed, 67 insertions(+), 44 deletions(-) diff --git a/Readme.md b/Readme.md index e7827ac93..e0d7fa8b5 100644 --- a/Readme.md +++ b/Readme.md @@ -1,10 +1,10 @@ ![SDR Angel banner](doc/img/sdrangel_banner.png) -**SDRangel** is an Open Source Qt5 / OpenGL 3.0+ (Linux) SDR and signal analyzer frontend to various hardware. +**SDRangel** is an Open Source Qt5 / OpenGL 3.0+ SDR and signal analyzer frontend to various hardware. **Check the discussion group** [here](https://groups.io/g/sdrangel) -**⚠ Warning**: Windows distribution is provided as a by product of the Qt toolchain. The platform of choice to run SDRangel is definitely Linux. You are encouraged to use the group to seek help from other Windows users but the author cannot give help or any support for problems related to running the software on Windows. Issues specific to Windows problems opened on Github will be closed systematically. Windows distribution may be discontinued in the future. +**⚠ Warning**: Windows distribution is discontinued at version 4.0.0. This is the last version with a Windows build.

Source code

@@ -39,7 +39,7 @@ From version 2 SDRangel can integrate more than one hardware device running conc From version 3 transmission or signal generation is supported for BladeRF, HackRF (since version 3.1), LimeSDR (since version 3.4) and PlutoSDR (since version 3.7.8) using a sample sink plugin. These plugins are: - - [BladeRF output plugin](https://github.com/f4exb/sdrangel/tree/dev/plugins/samplesink/bladerfoutput) limited support in Windows + - [BladeRF output plugin](https://github.com/f4exb/sdrangel/tree/dev/plugins/samplesink/bladerfoutput) - [HackRF output plugin](https://github.com/f4exb/sdrangel/tree/dev/plugins/samplesink/hackrfoutput) - [LimeSDR output plugin](https://github.com/f4exb/sdrangel/tree/dev/plugins/samplesink/limesdroutput) - [PlutoSDR output plugin](https://github.com/f4exb/sdrangel/tree/dev/plugins/samplesink/plutosdroutput) @@ -252,8 +252,6 @@ If you have one or more serial devices interfacing the AMBE3000 chip in packet m Although such serial devices work with a serial interface at 400 kb in practice maybe for other reasons they are capable of handling only one conversation at a time. The software will allocate the device dynamically to a conversation with an inactivity timeout of 1 second so that conversations do not get interrupted constantly making the audio output too choppy. In practice you will have to have as many devices connected to your system as the number of conversations you would like to be handled in parallel. -Note that this is not supported in Windows because of trouble with COM port support (contributors welcome!). - Alternatively you can use [mbelib](https://github.com/szechyjs/mbelib) but mbelib comes with some copyright issues (see next). If you have mbelib installed in a custom location, say `/opt/install/mbelib` you will need to add these defines to the cmake command: `-DLIBMBE_INCLUDE_DIR=/opt/install/mbelib/include -DLIBMBE_LIBRARY=/opt/install/mbelib/lib/libmbe.so` Possible copyright issues apart (see next) the audio quality with the DVSI AMBE chip is much better. @@ -269,10 +267,11 @@ If you are not comfortable with this just do not install DSDcc and/or mbelib and

Software distributions

-In the [releases](https://github.com/f4exb/sdrangel/releases) section one can find binary distributions for some common systems: +In the [releases](https://github.com/f4exb/sdrangel/releases) section one can find binary distributions for some Debian based distributions: - - Debian x86_64 (Ubuntu 16.04, Ubuntu 17.10, Debian Stretch) - - Windows 32 bit (runs also in 64 bit Windows) + - Ubuntu 18.04 (Bionic) + - Ubuntu 16.04 (Xenial) + - Debian Stretch

Debian distributions

@@ -306,9 +305,11 @@ The default CPU governor is now `powersave` which exhibits excessive CPU usage w

Windows distribution

+The last Windows distribution is for 4.0.0. + This is the archive of the complete binary distribution that expands to the `sdrangel` directory. You can install it anywhere you like and click on `sdrangel.exe` to start. -⚠ Windows distribution is provided as a by product thanks to the Qt toolchain. The platform of choice to run SDRangel is definitely Linux and very little support can be given for the Windows distribution. +⚠ Windows distribution was provided as a by product thanks to the Qt toolchain. The platform of choice to run SDRangel is definitely Linux and very little support can be given for this Windows distribution.

Software build

@@ -317,7 +318,7 @@ This is the archive of the complete binary distribution that expands to the `sdr To be sure you will need at least Qt version 5.5. It definitely does not work with versions earlier than 5.3 but neither 5.3 nor 5.4 were tested. - Linux builds are made with 5.5.1 (Xenial) and 5.9 (Artful, Stretch) - - Windows build is made with 5.10.1 in 32 bit mode and has Qt ANGLE support (OpenGL emulation with DirectX) + - Windows build was made with 5.10.1 in 32 bit mode and has Qt ANGLE support (OpenGL emulation with DirectX)

24 bit DSP

@@ -446,8 +447,7 @@ You can uninstall the software with `make uninstall` or `sudo make uninstall` fr

Limitations

- Your hardware. Still SDRangel is relatively conservative on computer resources. - - OpenGL 3+ (Linux) - - OpenGL 4.3+ (Windows) for OpenGL native support however the Qt Angle framework may be able to make it work on systems supporting Direct-X only. + - OpenGL 3+

Features

diff --git a/sdrgui/gui/glscopeng.cpp b/sdrgui/gui/glscopeng.cpp index 0941738cd..d8d7b9ba3 100644 --- a/sdrgui/gui/glscopeng.cpp +++ b/sdrgui/gui/glscopeng.cpp @@ -1866,10 +1866,10 @@ void GLScopeNG::setPolarDisplays() void GLScopeNG::setYScale(ScaleEngine& scale, uint32_t highlightedTraceIndex) { ScopeVisNG::TraceData& traceData = (*m_tracesData)[highlightedTraceIndex]; - float amp_range = 2.0 / traceData.m_amp; - float amp_ofs = traceData.m_ofs; - float pow_floor = -100.0 + traceData.m_ofs * 100.0; - float pow_range = 100.0 / traceData.m_amp; + double amp_range = 2.0 / traceData.m_amp; + double amp_ofs = traceData.m_ofs; + double pow_floor = -100.0 + traceData.m_ofs * 100.0; + double pow_range = 100.0 / traceData.m_amp; switch (traceData.m_projectionType) { @@ -1878,8 +1878,12 @@ void GLScopeNG::setYScale(ScaleEngine& scale, uint32_t highlightedTraceIndex) break; case Projector::ProjectionMagLin: case Projector::ProjectionMagSq: - if (amp_range < 2.0) { - scale.setRange(Unit::None, amp_ofs * 1000.0, amp_range * 1000.0 + amp_ofs * 1000.0); + if (amp_range < 1e-6) { + scale.setRange(Unit::None, amp_ofs * 1e9, amp_range * 1e9 + amp_ofs * 1e9); + } else if (amp_range < 1e-3) { + scale.setRange(Unit::None, amp_ofs * 1e6, amp_range * 1e6 + amp_ofs * 1e6); + } else if (amp_range < 1.0) { + scale.setRange(Unit::None, amp_ofs * 1e3, amp_range * 1e3 + amp_ofs * 1e3); } else { scale.setRange(Unit::None, amp_ofs, amp_range + amp_ofs); } @@ -1891,8 +1895,12 @@ void GLScopeNG::setYScale(ScaleEngine& scale, uint32_t highlightedTraceIndex) case Projector::ProjectionReal: // Linear generic case Projector::ProjectionImag: default: - if (amp_range < 2.0) { - scale.setRange(Unit::None, - amp_range * 500.0 + amp_ofs * 1000.0, amp_range * 500.0 + amp_ofs * 1000.0); + if (amp_range < 1e-6) { + scale.setRange(Unit::None, - amp_range * 5e8 + amp_ofs * 1e9, amp_range * 5e8 + amp_ofs * 1e9); + } else if (amp_range < 1e-3) { + scale.setRange(Unit::None, - amp_range * 5e5 + amp_ofs * 1e6, amp_range * 5e5 + amp_ofs * 1e6); + } else if (amp_range < 1.0) { + scale.setRange(Unit::None, - amp_range * 5e2 + amp_ofs * 1e3, amp_range * 5e2 + amp_ofs * 1e3); } else { scale.setRange(Unit::None, - amp_range * 0.5 + amp_ofs, amp_range * 0.5 + amp_ofs); } diff --git a/sdrgui/gui/glscopenggui.cpp b/sdrgui/gui/glscopenggui.cpp index b03e29f9b..8ebdadc8d 100644 --- a/sdrgui/gui/glscopenggui.cpp +++ b/sdrgui/gui/glscopenggui.cpp @@ -22,7 +22,17 @@ #include "ui_glscopenggui.h" #include "util/simpleserializer.h" -const double GLScopeNGGUI::amps[14] = { 0.2, 0.1, 0.05, 0.02, 0.01, 0.005, 0.002, 0.001, 0.0005, 0.0002, 0.0001, 0.00005, 0.00002, 0.00001 }; +const double GLScopeNGGUI::amps[27] = { + 2e-1, 1e-1, 5e-2, + 2e-2, 1e-2, 5e-3, + 2e-3, 1e-3, 5e-4, + 2e-4, 1e-4, 5e-5, + 2e-5, 1e-5, 5e-6, + 2e-6, 1e-6, 5e-7, + 2e-7, 1e-7, 5e-8, + 2e-8, 1e-8, 5e-9, + 2e-9, 1e-9, 5e-10, +}; GLScopeNGGUI::GLScopeNGGUI(QWidget* parent) : QWidget(parent), @@ -1030,12 +1040,14 @@ void GLScopeNGGUI::setAmpOfsDisplay() a = o/1000.0f; } - if(fabs(a) < 0.000001f) - ui->ofsText->setText(tr("%1\nn").arg(a * 1000000000.0)); - else if(fabs(a) < 0.001f) - ui->ofsText->setText(tr("%1\nµ").arg(a * 1000000.0)); + if(fabs(a) < 1e-9) + ui->ofsText->setText(tr("%1\np").arg(a * 1e12)); + else if(fabs(a) < 1e-6) + ui->ofsText->setText(tr("%1\nn").arg(a * 1e9)); + else if(fabs(a) < 1e-3) + ui->ofsText->setText(tr("%1\nµ").arg(a * 1e6)); else if(fabs(a) < 1.0f) - ui->ofsText->setText(tr("%1\nm").arg(a * 1000.0)); + ui->ofsText->setText(tr("%1\nm").arg(a * 1e3)); else ui->ofsText->setText(tr("%1").arg(a * 1.0)); } diff --git a/sdrgui/gui/glscopenggui.h b/sdrgui/gui/glscopenggui.h index e9c1e4cb8..3eae59aea 100644 --- a/sdrgui/gui/glscopenggui.h +++ b/sdrgui/gui/glscopenggui.h @@ -153,7 +153,7 @@ private: QColor m_focusedTraceColor; QColor m_focusedTriggerColor; - static const double amps[14]; + static const double amps[27]; void applySettings(); // First row diff --git a/sdrgui/gui/glscopenggui.ui b/sdrgui/gui/glscopenggui.ui index fd9583f90..a0e071382 100644 --- a/sdrgui/gui/glscopenggui.ui +++ b/sdrgui/gui/glscopenggui.ui @@ -859,7 +859,7 @@ kS/s Vertical range - 13 + 26 1 diff --git a/sdrgui/gui/scaleengine.cpp b/sdrgui/gui/scaleengine.cpp index a46e2b813..06fe67aa7 100644 --- a/sdrgui/gui/scaleengine.cpp +++ b/sdrgui/gui/scaleengine.cpp @@ -32,7 +32,7 @@ QString ScaleEngine::formatTick(double value, int decimalPlaces) if (m_physicalUnit != Unit::TimeHMS) { if (m_physicalUnit == Unit::Scientific) { - return QString("%1").arg(m_makeOpposite ? -value : value, 0, 'e', 2); + return QString("%1").arg(m_makeOpposite ? -value : value, 0, 'e', m_fixedDecimalPlaces); } else { return QString("%1").arg(m_makeOpposite ? -value : value, 0, 'f', decimalPlaces); } @@ -270,21 +270,21 @@ double ScaleEngine::calcMajorTickUnits(double distance, int* retDecimalPlaces) else if(distance < 30.0 * 86000.0) return 30.0 * 86000.0; else return 90.0 * 86000.0; - } else {*/ - if(base <= 1.0) { - base = 1.0; - } else if(base <= 2.0) { - base = 2.0; - } else if(base <= 2.5) { - base = 2.5; - if(decimalPlaces >= 0) - decimalPlaces++; - } else if(base <= 5.0) { - base = 5.0; - } else { - base = 10.0; - }/* - }*/ + } */ + + if(base <= 1.0) { + base = 1.0; + } else if(base <= 2.0) { + base = 2.0; + } else if(base <= 2.5) { + base = 2.5; + if(decimalPlaces >= 0) + decimalPlaces++; + } else if(base <= 5.0) { + base = 5.0; + } else { + base = 10.0; + } if(retDecimalPlaces != 0) { if(decimalPlaces < 0) @@ -522,6 +522,7 @@ ScaleEngine::ScaleEngine() : m_firstMajorTickValue(1.0), m_numMinorTicks(1), m_decimalPlaces(1), + m_fixedDecimalPlaces(2), m_makeOpposite(false) { } diff --git a/sdrgui/gui/scaleengine.h b/sdrgui/gui/scaleengine.h index 1a09bd2b8..a7e70f065 100644 --- a/sdrgui/gui/scaleengine.h +++ b/sdrgui/gui/scaleengine.h @@ -56,6 +56,7 @@ private: double m_firstMajorTickValue; int m_numMinorTicks; int m_decimalPlaces; + int m_fixedDecimalPlaces; bool m_makeOpposite; // will show -value instead of value QString formatTick(double value, int decimalPlaces); @@ -78,6 +79,7 @@ public: float getSize() { return m_size; } void setRange(Unit::Physical physicalUnit, float rangeMin, float rangeMax); void setMakeOpposite(bool makeOpposite) { m_makeOpposite = makeOpposite; } + void setFixedDecimalPlaces(int decimalPlaces) { m_fixedDecimalPlaces =decimalPlaces; } float getPosFromValue(double value); float getValueFromPos(double pos);