Skip to content

Commit

Permalink
Use console formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
johanhedin committed Jan 28, 2024
1 parent f733853 commit ff973bc
Show file tree
Hide file tree
Showing 2 changed files with 90 additions and 62 deletions.
64 changes: 39 additions & 25 deletions doc/BUILD.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,17 @@ installed on your machine in order to build and run `sdrx`:

On Fedora they can be installed with:

$ sudo dnf install git gcc-c++ cmake popt-devel libsigc++20-devel libusb1-devel fftw-devel \
fftw-libs-single alsa-lib-devel rtl-sdr-devel airspyone_host-devel
```console
$ sudo dnf install git gcc-c++ cmake popt-devel libsigc++20-devel libusb1-devel fftw-devel \
fftw-libs-single alsa-lib-devel rtl-sdr-devel airspyone_host-devel
```

On Raspberry Pi OS/Debian/Ubuntu they can be installed with:

$ sudo apt-get install git g++ cmake build-essential libpopt-dev libsigc++-2.0-dev \
libusb-1.0-0-dev libfftw3-dev libfftw3-single3 libasound2-dev librtlsdr-dev libairspy-dev
```console
$ sudo apt-get install git g++ cmake build-essential libpopt-dev libsigc++-2.0-dev \
libusb-1.0-0-dev libfftw3-dev libfftw3-single3 libasound2-dev librtlsdr-dev libairspy-dev
```


Clone the repo and build
Expand Down Expand Up @@ -55,22 +59,26 @@ $ cd sdrx

and then build with cmake:

$ mkdir build
$ cd build
$ cmake ..
$ make
```console
$ mkdir build
$ cd build
$ cmake ..
$ make
```


Keep up to date with changes
----
To keep up to date with changes and updates to `sdrx`, simply run:

$ cd sdrx
$ git pull --ff-only
$ git submodule update --init --recursive
$ cd build
$ cmake ..
$ make
```console
$ cd sdrx
$ git pull --ff-only
$ git submodule update --init --recursive
$ cd build
$ cmake ..
$ make
```

Please always run the `git submodule update`-part as stated above since it is
required for the submodule linking to work as indended. The `--init` and
Expand All @@ -80,10 +88,12 @@ properly. For existing submodules, they are a no-op.
If the build for some reason fails after a update, try to remove all files
inside the build directory and start over:

$ cd build
$ rm -rf *
$ cmake ..
$ make
```console
$ cd build
$ rm -rf *
$ cmake ..
$ make
```

Make sure to `git pull` according to the instruction above regularly to keep up
with the changes. And always read the README to see how the program changes
Expand All @@ -96,18 +106,22 @@ If you like, you can install the `sdrx` executable on your system. Install
directory defaults to `/usr/local/bin`. It can be set to a different
location with `-DCMAKE_INSTALL_PREFIX=<your_custom_dir>`:

$ cd build
$ rm -rf *
$ cmake .. -DCMAKE_INSTALL_PREFIX=/usr
$ make
$ sudo make install
```console
$ cd build
$ rm -rf *
$ cmake .. -DCMAKE_INSTALL_PREFIX=/usr
$ make
$ sudo make install
```

To uninstall, you need to install like above first and have the build directory
available as it was after the install (the files installed are written to
a file in the build directory and then used in the uninstall stage):

$ cd build
$ sudo make uninstall
```console
$ cd build
$ sudo make uninstall
```

`sudo` is only needed if your install directory is owned by root.

Expand Down
88 changes: 51 additions & 37 deletions doc/USING.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ channel, options are available and can be listed with `--help` (his page
does not always cover all available options so use this page together with
`--help` to get the full picture):

$ cd sdrx/build
$ ./sdrx --help
$ ./sdrx --gain 30 122.455
```console
$ cd sdrx/build
$ ./sdrx --help
$ ./sdrx --gain 30 122.455
```

To stop the program, just press Crtl-C in the terminal and wait. This will stop
`sdr` cleanly as Ctrl-C is handled properly. If you have multiple devices
Expand All @@ -30,7 +32,9 @@ librtlsdr library (look in the source code for the details). As an alternative,
it is also possible to set the three gain stages directly with stage values
like this (LNA = 5, MIX = 8 and VGA = 10):

$ ./sdrx --gain 5:8:10 122.455
```console
$ ./sdrx --gain 5:8:10 122.455
```

This gives very good control over how the total gain is distributed in the R820
tuner and is the preferred way of setting gain when you run a external LNA in
Expand All @@ -44,7 +48,9 @@ all and any `--fq-corr` given is silently ignored.
If you have multiple devices connected, use `--list` to list what devices that
`sdrx` recognize on your system and what sample rates they support:

$ ./sdrx --list
```console
$ ./sdrx --list
```

To use a specific device, it's serial is used and you must ensure that all
devices have unique serials. Use `rtl_eeprom -s MYSERIAL` from the standard
Expand All @@ -71,7 +77,9 @@ Support for multiple channels is available as well. Just specify the channels as
arguments. The channels must fit inside 80% of the sampling frequency used (see
below for explanation):

$ ./sdrx --gain 40 118.105 118.280 118.405 118.505
```console
$ ./sdrx --gain 40 118.105 118.280 118.405 118.505
```

The more channels you specify, the more loaded the channelization thread will be.
Please monitor your system load when running `sdrx` with many channels to get an
Expand All @@ -88,7 +96,9 @@ USB connectors and a device easily disconnects by just moving it sligthly.
Sample rate defaults to 1.44MS/s for RTL devices and 6MS/s for Airspy devices
if not set explicitly. Change to your liking with the `--sample-rate` option:

$ ./sdrx --sample-rate 2.56 118.280 118.405 118.505
```console
$ ./sdrx --sample-rate 2.56 118.280 118.405 118.505
```

As stated earlier, the sample rate dictates the RF bandwidth that can be
used. If, for example, a sample rate of 2.56 MS/s is used, the available RF
Expand All @@ -112,15 +122,17 @@ second.

A typical output look like this:

$ ./sdrx -g 45 118.105
...
10:57:00: Level[X -37.2] 118.105[ 0.0] [-22.5|-22.6|-23.4] [ 0.00] [SNR][low|mid|hig][imbalance]
10:57:01: Level[X -39.6] 118.105[ 0.0] [-22.1|-22.9|-22.2] [ 0.00] [SNR][low|mid|hig][imbalance]
10:57:01: Level[X -39.5] 118.105[ 0.0] [-21.1|-22.3|-22.8] [ 0.00] [SNR][low|mid|hig][imbalance]
10:57:01: Level[XXX -27.5] 118.105[38.0] [-21.4| 16.5|-21.7] [-12.28] [SNR][low|mid|hig][imbalance]
10:57:02: Level[XXX -27.5] 118.105[38.7] [-22.7| 16.6|-21.6] [-30.74] [SNR][low|mid|hig][imbalance]
10:57:02: Level[XXX -27.5] 118.105[39.7] [-21.8| 16.9|-24.2] [-30.66] [SNR][low|mid|hig][imbalance]
...
```console
$ ./sdrx -g 45 118.105
...
10:57:00: Level[X -37.2] 118.105[ 0.0] [-22.5|-22.6|-23.4] [ 0.00] [SNR][low|mid|hig][imbalance]
10:57:01: Level[X -39.6] 118.105[ 0.0] [-22.1|-22.9|-22.2] [ 0.00] [SNR][low|mid|hig][imbalance]
10:57:01: Level[X -39.5] 118.105[ 0.0] [-21.1|-22.3|-22.8] [ 0.00] [SNR][low|mid|hig][imbalance]
10:57:01: Level[XXX -27.5] 118.105[38.0] [-21.4| 16.5|-21.7] [-12.28] [SNR][low|mid|hig][imbalance]
10:57:02: Level[XXX -27.5] 118.105[38.7] [-22.7| 16.6|-21.6] [-30.74] [SNR][low|mid|hig][imbalance]
10:57:02: Level[XXX -27.5] 118.105[39.7] [-21.8| 16.9|-24.2] [-30.66] [SNR][low|mid|hig][imbalance]
...
```

Open squelch is indicated by the channel name getting a yellow background.
**Level** is a measurement of the signal level before the ADC in dB (dBFS) and
Expand Down Expand Up @@ -158,24 +170,26 @@ panorma based on their order on the command line.
Output in the terminal looks about the same as for single channel but only the
SNR is shown for each individual channel:

$ ./sdrx -g 40 118.105 118.280 118.405
...
10:57:00: Level[XX -39.6] 118.105[ 0.0] 118.205[ 0.0] 118.280[ 0.0] 118.405[ 0.0]
10:57:01: Level[XX -39.6] 118.105[ 0.0] 118.205[ 0.0] 118.280[ 0.0] 118.405[ 0.0]
10:57:01: Level[XX -39.6] 118.105[ 0.0] 118.205[ 1.0] 118.280[ 0.0] 118.405[ 0.0]
10:57:01: Level[XXXX -27.5] 118.105[ 1.3] 118.205[ 0.0] 118.280[27.0] 118.405[ 0.0]
10:57:02: Level[XXXX -27.5] 118.105[ 0.0] 118.205[ 0.0] 118.280[28.5] 118.405[ 0.0]
10:57:02: Level[XXXX -27.5] 118.105[ 0.0] 118.205[ 0.0] 118.280[28.9] 118.405[ 0.0]
10:57:02: Level[XXXX -27.5] 118.105[ 0.0] 118.205[ 0.0] 118.280[29.0] 118.405[ 0.0]
10:57:03: Level[XXXX -27.5] 118.105[ 0.0] 118.205[ 0.0] 118.280[29.4] 118.405[ 0.0]
10:57:03: Level[XXXX -27.5] 118.105[ 0.0] 118.205[ 0.0] 118.280[28.2] 118.405[ 0.0]
10:57:03: Level[XXXX -27.5] 118.105[ 0.0] 118.205[ 0.0] 118.280[28.4] 118.405[ 0.0]
10:57:04: Level[XXXX -27.5] 118.105[ 1.1] 118.205[ 0.0] 118.280[29.8] 118.405[ 0.0]
10:57:04: Level[XXXX -27.5] 118.105[ 0.0] 118.205[ 0.0] 118.280[28.9] 118.405[ 0.0]
10:57:04: Level[XXXX -27.5] 118.105[ 0.0] 118.205[ 0.0] 118.280[28.5] 118.405[ 0.0]
10:57:05: Level[XXXX -27.5] 118.105[ 0.0] 118.205[ 0.0] 118.280[27.9] 118.405[ 0.0]
10:57:05: Level[XXXX -27.5] 118.105[ 0.0] 118.205[ 0.0] 118.280[28.8] 118.405[ 0.0]
10:57:05: Level[XX -39.6] 118.105[ 1.0] 118.205[ 0.0] 118.280[ 0.0] 118.405[ 0.0]
10:57:06: Level[XX -39.6] 118.105[ 1.8] 118.205[ 0.0] 118.280[ 1.2] 118.405[ 0.0]
10:57:06: Level[XX -39.6] 118.105[ 0.0] 118.205[ 0.0] 118.280[ 0.0] 118.405[ 0.0]
...
```console
$ ./sdrx -g 40 118.105 118.280 118.405
...
10:57:00: Level[XX -39.6] 118.105[ 0.0] 118.205[ 0.0] 118.280[ 0.0] 118.405[ 0.0]
10:57:01: Level[XX -39.6] 118.105[ 0.0] 118.205[ 0.0] 118.280[ 0.0] 118.405[ 0.0]
10:57:01: Level[XX -39.6] 118.105[ 0.0] 118.205[ 1.0] 118.280[ 0.0] 118.405[ 0.0]
10:57:01: Level[XXXX -27.5] 118.105[ 1.3] 118.205[ 0.0] 118.280[27.0] 118.405[ 0.0]
10:57:02: Level[XXXX -27.5] 118.105[ 0.0] 118.205[ 0.0] 118.280[28.5] 118.405[ 0.0]
10:57:02: Level[XXXX -27.5] 118.105[ 0.0] 118.205[ 0.0] 118.280[28.9] 118.405[ 0.0]
10:57:02: Level[XXXX -27.5] 118.105[ 0.0] 118.205[ 0.0] 118.280[29.0] 118.405[ 0.0]
10:57:03: Level[XXXX -27.5] 118.105[ 0.0] 118.205[ 0.0] 118.280[29.4] 118.405[ 0.0]
10:57:03: Level[XXXX -27.5] 118.105[ 0.0] 118.205[ 0.0] 118.280[28.2] 118.405[ 0.0]
10:57:03: Level[XXXX -27.5] 118.105[ 0.0] 118.205[ 0.0] 118.280[28.4] 118.405[ 0.0]
10:57:04: Level[XXXX -27.5] 118.105[ 1.1] 118.205[ 0.0] 118.280[29.8] 118.405[ 0.0]
10:57:04: Level[XXXX -27.5] 118.105[ 0.0] 118.205[ 0.0] 118.280[28.9] 118.405[ 0.0]
10:57:04: Level[XXXX -27.5] 118.105[ 0.0] 118.205[ 0.0] 118.280[28.5] 118.405[ 0.0]
10:57:05: Level[XXXX -27.5] 118.105[ 0.0] 118.205[ 0.0] 118.280[27.9] 118.405[ 0.0]
10:57:05: Level[XXXX -27.5] 118.105[ 0.0] 118.205[ 0.0] 118.280[28.8] 118.405[ 0.0]
10:57:05: Level[XX -39.6] 118.105[ 1.0] 118.205[ 0.0] 118.280[ 0.0] 118.405[ 0.0]
10:57:06: Level[XX -39.6] 118.105[ 1.8] 118.205[ 0.0] 118.280[ 1.2] 118.405[ 0.0]
10:57:06: Level[XX -39.6] 118.105[ 0.0] 118.205[ 0.0] 118.280[ 0.0] 118.405[ 0.0]
...
```

0 comments on commit ff973bc

Please sign in to comment.