mirror of
https://github.com/lwvmobile/dsd-fme.git
synced 2026-11-13 17:27:21 -05:00
RTL: Add input gain adjustments during ncurses session using g/G and update example usage (credit: ki4hyf);
Group trunking shortcut key changed from g to T;
This commit is contained in:
@@ -689,6 +689,7 @@
|
||||
//all RTL user options -- enabled AGC by default due to weak signal related issues
|
||||
opts->rtl_dev_index = 0; //choose which device we want by index number
|
||||
opts->rtl_gain_value = 0; //mid value, 0 - AGC - 0 to 49 acceptable values
|
||||
opts->rtl_gain_actual = -100; //mirror dongle.gain actual values -100 is AUTO_GAIN, else nearest_gain(dongle.dev, dongle.gain);
|
||||
opts->rtl_squelch_level = 100; //100 by default, but only affects NXDN and dPMR during framesync test, compared to RMS value
|
||||
opts->rtl_volume_multiplier = 2; //sample multiplier; This multiplies the sample value to produce a higher 'inlvl' for the demodulator
|
||||
opts->rtl_udp_port = 0; //set UDP port for RTL remote -- 0 by default, will be making this optional for some external/legacy use cases (edacs-fm, etc)
|
||||
|
||||
@@ -594,7 +594,7 @@ uint8_t ncurses_input_handler(dsd_opts * opts, dsd_state * state, int c)
|
||||
else opts->trunk_tune_enc_calls = 1;
|
||||
}
|
||||
|
||||
if (opts->p25_trunk == 1 && c == 103) //'g' key, toggle tune group calls
|
||||
if (opts->p25_trunk == 1 && c == 84) //'T' key, toggle tune group calls
|
||||
{
|
||||
if (opts->trunk_tune_group_calls == 1) opts->trunk_tune_group_calls = 0;
|
||||
else opts->trunk_tune_group_calls = 1;
|
||||
@@ -918,6 +918,26 @@ uint8_t ncurses_input_handler(dsd_opts * opts, dsd_state * state, int c)
|
||||
if (c == 123)
|
||||
opts->rtlsdr_ppm_error--;
|
||||
|
||||
//RTL Gain Manual Adjustment
|
||||
if (c == 103)
|
||||
{
|
||||
if (opts->rtl_gain_value > 0)
|
||||
{
|
||||
opts->rtl_gain_value--;
|
||||
opts->rtl_gain_actual = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (c == 71)
|
||||
{
|
||||
if (opts->rtl_gain_value < 49)
|
||||
{
|
||||
opts->rtl_gain_value++;
|
||||
opts->rtl_gain_actual = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//anything with an entry box will need the inputs and outputs stopped first
|
||||
//so probably just write a function to handle c input, and when c = certain values
|
||||
//needing an entry box, then stop all of those
|
||||
|
||||
@@ -245,10 +245,10 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state)
|
||||
if (opts->audio_in_type == 3)
|
||||
{
|
||||
printw ("| RTL: %d;", opts->rtl_dev_index);
|
||||
if (opts->rtl_gain_value == 0)
|
||||
if (opts->rtl_gain_actual == -100)
|
||||
printw (" G: AGC;");
|
||||
else
|
||||
printw (" G: %idB;", opts->rtl_gain_value);
|
||||
printw (" G: %i/%i;", opts->rtl_gain_value, opts->rtl_gain_actual);
|
||||
printw (" V: %iX;", opts->rtl_volume_multiplier);
|
||||
printw (" PPM: %i;", opts->rtlsdr_ppm_error); //Adjust manually now with { and }
|
||||
printw (" SQ: %i;", opts->rtl_squelch_level);
|
||||
@@ -363,7 +363,7 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state)
|
||||
{
|
||||
printw ("| Trunking -");
|
||||
if (opts->trunk_tune_group_calls == 0) attron(COLOR_PAIR(2));
|
||||
printw (" Group(g)");
|
||||
printw (" Group(T)");
|
||||
attron(COLOR_PAIR(4));
|
||||
if (opts->trunk_tune_private_calls == 0) attron(COLOR_PAIR(2));
|
||||
printw (" Private(u)");
|
||||
@@ -382,8 +382,8 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state)
|
||||
if (opts->p25_trunk == 1 && (opts->use_rigctl == 1 || opts->audio_in_type == 3) )
|
||||
{
|
||||
printw ("| Trunking -");
|
||||
if (opts->trunk_tune_group_calls == 0) printw (" group(g)");
|
||||
else printw (" GROUP(g)");
|
||||
if (opts->trunk_tune_group_calls == 0) printw (" group(T)");
|
||||
else printw (" GROUP(T)");
|
||||
if (opts->trunk_tune_private_calls == 0) printw (" private(u)");
|
||||
else printw (" PRIVATE(u)");
|
||||
if (opts->trunk_tune_data_calls == 0) printw (" data(d)");
|
||||
|
||||
@@ -1031,6 +1031,7 @@ void open_rtlsdr_stream(dsd_opts *opts)
|
||||
|
||||
//this needs to be initted first, then we set the parameters
|
||||
dongle_init(&dongle);
|
||||
|
||||
//init with low pass if decoding P25 or EDACS/Provoice
|
||||
if (opts->frame_p25p1 == 1 || opts->frame_p25p2 == 1 || opts->frame_provoice == 1)
|
||||
demod_init_ro2(&demod);
|
||||
@@ -1089,7 +1090,7 @@ void open_rtlsdr_stream(dsd_opts *opts)
|
||||
verbose_auto_gain(dongle.dev);
|
||||
fprintf (stderr, "Setting RTL Autogain. \n");
|
||||
} else {
|
||||
dongle.gain = nearest_gain(dongle.dev, dongle.gain);
|
||||
opts->rtl_gain_actual = dongle.gain = nearest_gain(dongle.dev, dongle.gain);
|
||||
verbose_gain_set(dongle.dev, dongle.gain);
|
||||
// fprintf (stderr, "Setting RTL Nearest Gain to %d. \n", dongle.gain); //seems to be working now
|
||||
}
|
||||
@@ -1151,6 +1152,26 @@ int get_rtlsdr_sample(int16_t *sample, dsd_opts * opts, dsd_state * state)
|
||||
verbose_ppm_set(dongle.dev, dongle.ppm_error);
|
||||
}
|
||||
|
||||
//if Gain or AGC Value is Manually Changed, Change it here now
|
||||
if (opts->rtl_gain_actual != dongle.gain && opts->rtl_gain_value != 0)
|
||||
{
|
||||
dongle.gain = (opts->rtl_gain_value * 10);
|
||||
opts->rtl_gain_actual = dongle.gain = nearest_gain(dongle.dev, dongle.gain);
|
||||
verbose_gain_set(dongle.dev, dongle.gain);
|
||||
|
||||
//debug
|
||||
// fprintf (stderr, "\n Dongle Gain Set: %d; \n", dongle.gain);
|
||||
}
|
||||
|
||||
else if (opts->rtl_gain_value == 0 && dongle.gain != AUTO_GAIN)
|
||||
{
|
||||
opts->rtl_gain_actual = dongle.gain = AUTO_GAIN;
|
||||
verbose_auto_gain(dongle.dev);
|
||||
|
||||
//debug
|
||||
// fprintf (stderr, "\n AGC Set; \n");
|
||||
}
|
||||
|
||||
while (output.queue.empty())
|
||||
{
|
||||
struct timespec ts;
|
||||
|
||||
Reference in New Issue
Block a user