Ncurses Tweaks; Revert RTL BW changes; #125

This commit is contained in:
lwvmobile 2023-05-21 13:39:49 -04:00
parent 4c91588af6
commit 5c8e3d95a7
3 changed files with 56 additions and 45 deletions

View File

@ -536,9 +536,9 @@ initOpts (dsd_opts * opts)
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_squelch_level = 100; //100 by default, but only affects NXDN and dPMR during framesync test, compared to RMS value
opts->rtl_volume_multiplier = 1; //sample multiplier; This multiplies the sample value to produce a higher 'inlvl'
opts->rtl_volume_multiplier = 1; //sample multiplier; This multiplies the sample value to produce a higher 'inlvl' (probably best left unused)
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)
opts->rtl_bandwidth = 6; //default was 12, but changed to 6 due to newer handling of rtl_bandwidth
opts->rtl_bandwidth = 12; //default is 12, reverted back to normal on this (no inherent benefit)
opts->rtlsdr_ppm_error = 0; //initialize ppm with 0 value;
opts->rtlsdr_center_freq = 850000000; //set to an initial value (if user is using a channel map, then they won't need to specify anything other than -i rtl if desired)
opts->rtl_started = 0;
@ -1077,7 +1077,7 @@ usage ()
printf (" freq <num> RTL-SDR Frequency (851800000 or 851.8M) \n");
printf (" gain <num> RTL-SDR Device Gain (0-49)(default = 0; Hardware AGC recommended)\n");
printf (" ppm <num> RTL-SDR PPM Error (default = 0)\n");
printf (" bw <num> RTL-SDR Bandwidth kHz (default = 6)(4, 6, 8, 12, 16, 24) \n");
printf (" bw <num> RTL-SDR Bandwidth kHz (default = 12)(4, 6, 8, 12, 16, 24) \n");
printf (" sq <num> RTL-SDR Squelch Level (Optional)\n");
printf (" udp <num> RTL-SDR UDP Remote Port (Optional -- External Use Only)\n");
printf (" Example: dsd-fme-zdev -fs -i rtl -C cap_plus_channel.csv -T\n"); //put a good example here, probably trunking so user doesn't have to enter the 'optional' arguments
@ -1204,9 +1204,9 @@ if (opts->audio_in_type == 1)
{
opts->pulse_digi_rate_out = 24000; //rtl needs 24000 by 2 channel for DMR TDMA Stereo output
opts->pulse_digi_out_channels = 2; //minimal crackling 'may' be observed, not sure, can't test to see on DMR with RTL
fprintf (stderr, "RTL Audio Rate Out set to 24000 Khz/2 Channel \n");
// fprintf (stderr, "RTL Audio Rate Out set to 24000 Khz/2 Channel \n");
}
else fprintf (stderr, "RTL Audio Rate Out set to 48000 Khz/1 Channel \n");
// else fprintf (stderr, "RTL Audio Rate Out set to 48000 Khz/1 Channel \n");
opts->pulse_raw_rate_out = 48000;
opts->pulse_raw_out_channels = 1;
@ -1357,7 +1357,7 @@ main (int argc, char **argv)
}
#ifdef AERO_BUILD
fprintf (stderr, "Build Version: v2.0.1-12 Win32 \n");
fprintf (stderr, "Build Version: v2.0.1-13 Win32 \n");
#else
fprintf (stderr, "Build Version: %s \n", GIT_TAG);
#endif
@ -2268,7 +2268,7 @@ main (int argc, char **argv)
opts.rtl_bandwidth = bw;
}
else
opts.rtl_bandwidth = 6; //new safe default
opts.rtl_bandwidth = 12; //safe default -- provides best performance on most systems
}
else goto RTLEND;

View File

@ -599,10 +599,6 @@ void ncursesMenu (dsd_opts * opts, dsd_state * state)
#ifdef USE_RTLSDR
//could also benefit from having some control aside from UDP remote
//BUG: When squelch enabled, all processing halts, no more ncursesprinter until squelch broken
//make another submenu to control these values if tests go well
entry_win = newwin(6, WIDTH+6, starty+10, startx+10);
box (entry_win, 0, 0);
mvwprintw(entry_win, 2, 2, " Enter RTL Device Index Number");
@ -612,7 +608,6 @@ void ncursesMenu (dsd_opts * opts, dsd_state * state)
wscanw(entry_win, "%d", &opts->rtl_dev_index);
noecho();
//this is NOT scanning (or printing) in the variable for some reason...why?
entry_win = newwin(6, WIDTH+6, starty+10, startx+10);
box (entry_win, 0, 0);
mvwprintw(entry_win, 2, 2, " Enter RTL Device PPM Error");
@ -621,21 +616,19 @@ void ncursesMenu (dsd_opts * opts, dsd_state * state)
refresh();
wscanw(entry_win, "%d", &opts->rtlsdr_ppm_error);
noecho();
//opts->rtlsdr_ppm_error = -1; //hard set override for testing
//apparently, scanning in an lld nukes later box entries for some reason
entry_win = newwin(6, WIDTH+18, starty+10, startx+10);
box (entry_win, 0, 0);
mvwprintw(entry_win, 2, 2, " Enter Frequency in Hz (851.8 MHz is 851800000 Hz) ");
mvwprintw(entry_win, 3, 3, " ");
echo();
refresh();
wscanw(entry_win, "%d", &opts->rtlsdr_center_freq); //ld, or lld?
wscanw(entry_win, "%d", &opts->rtlsdr_center_freq);
noecho();
entry_win = newwin(6, WIDTH+18, starty+10, startx+10);
box (entry_win, 0, 0);
mvwprintw(entry_win, 2, 2, " Enter VFO Bandwidth (6, 8, 12, 16, 24, 48)");
mvwprintw(entry_win, 2, 2, " Enter BW (8, 12, 24, 48)(12 Recommended)");
mvwprintw(entry_win, 3, 3, " ");
echo();
refresh();
@ -644,7 +637,7 @@ void ncursesMenu (dsd_opts * opts, dsd_state * state)
entry_win = newwin(6, WIDTH+18, starty+10, startx+10);
box (entry_win, 0, 0);
mvwprintw(entry_win, 2, 2, " Enter RTL Gain Value (0-49) (0 = Auto Gain)");
mvwprintw(entry_win, 2, 2, " Enter RTL Gain Value (0-49) (0 = AGC)");
mvwprintw(entry_win, 3, 3, " ");
echo();
refresh();
@ -662,9 +655,8 @@ void ncursesMenu (dsd_opts * opts, dsd_state * state)
entry_win = newwin(8, WIDTH+22, starty+10, startx+10);
box (entry_win, 0, 0);
mvwprintw(entry_win, 2, 2, " Enter RTL Device Squelch Level or Enter 0");
mvwprintw(entry_win, 3, 2, " WARNING! Renders Terminal Unresponsive When No Signal!");
mvwprintw(entry_win, 4, 3, " ");
mvwprintw(entry_win, 2, 2, " Enter RTL RMS Squelch Level (NXDN/dPMR only)");
mvwprintw(entry_win, 3, 3, " ");
echo();
refresh();
wscanw(entry_win, "%d", &opts->rtl_squelch_level);
@ -675,11 +667,11 @@ void ncursesMenu (dsd_opts * opts, dsd_state * state)
mvwprintw(entry_win, 2, 2, " Starting RTL Input. Cannot Release/Stop Until Exit.");
mvwprintw(entry_win, 4, 2, " RTL Frequency: %d Hz", opts->rtlsdr_center_freq);
mvwprintw(entry_win, 5, 2, " RTL Device Index Number: %d", opts->rtl_dev_index);
mvwprintw(entry_win, 6, 2, " RTL Device VFO Bandwidth: %d kHz", opts->rtl_bandwidth);
mvwprintw(entry_win, 6, 2, " RTL Device Bandwidth: %d kHz", opts->rtl_bandwidth);
mvwprintw(entry_win, 7, 2, " RTL Device Gain: %d", opts->rtl_gain_value);
mvwprintw(entry_win, 8, 2, " RTL Device UDP Port: %d", opts->rtl_udp_port);
mvwprintw(entry_win, 9, 2, " RTL Device PPM: %d", opts->rtlsdr_ppm_error);
mvwprintw(entry_win, 10, 2, " RTL Device Squelch: %d", opts->rtl_squelch_level);
mvwprintw(entry_win, 10, 2, " RTL RMS Squelch: %d", opts->rtl_squelch_level);
mvwprintw(entry_win, 12, 2, " Are You Sure?");
mvwprintw(entry_win, 13, 2, " 1 = Yes, 2 = No ");
mvwprintw(entry_win, 14, 3, " ");
@ -691,6 +683,7 @@ void ncursesMenu (dsd_opts * opts, dsd_state * state)
refresh();
//works well, but can't release dongle later, so its a one way trip until exit
//TODO: Write function to release the dongle -- call cleanup_rtlsdr_stream()
if (confirm == 1)
{
opts->audio_in_type = 3; //RTL input, only set this on confirm
@ -2070,7 +2063,7 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state)
if (opts->ncurses_compact == 1)
{
printw ("------------------------------------------------------------------------------\n");
printw ("| Digital Speech Decoder: Florida Man Edition - Aero \n", "v2.0.1-12 Win32");
printw ("| Digital Speech Decoder: Florida Man Edition - Aero \n", "v2.0.1-13 Win32");
printw ("------------------------------------------------------------------------------\n");
}
#elif LIMAZULUTWEAKS
@ -2099,7 +2092,7 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state)
if (i == 4) printw (" MBElib %s", versionstr);
#ifdef AERO_BUILD
if (i == 5) printw (" %s ", "Aero Win32");
if (i == 6) printw (" v2.0.1-12 Win32 \n");
if (i == 6) printw (" v2.0.1-13 Win32 \n");
#else
if (i == 5) printw (" %s ", "zDEV BUILD");
if (i == 6) printw (" %s \n", GIT_TAG);
@ -2150,9 +2143,9 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state)
printw (" Gain: %idB;", opts->rtl_gain_value);
printw (" PPM: %i;", opts->rtlsdr_ppm_error);
printw (" SQ: %i;", opts->rtl_squelch_level);
printw (" RMS: %03i;", opts->rtl_rms);
printw (" RMS: %04i;", opts->rtl_rms);
printw (" BW: %i kHz;", opts->rtl_bandwidth);
printw (" FREQ: %i;", opts->rtlsdr_center_freq);
printw (" FRQ: %i;", opts->rtlsdr_center_freq);
if (opts->rtl_udp_port != 0) printw ("\n| External Tuning on UDP Port: %i", opts->rtl_udp_port);
printw ("\n");
}
@ -3083,7 +3076,12 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state)
//only print if a valid time was assigned to the matrix, and not EDACS/PV, and source is not zero
if ( ((time(NULL) - call_matrix[9-j][5]) < 999999) && call_matrix[9-j][0] != 14 && call_matrix[9-j][0] != 15 && call_matrix[9-j][0] != 37 && call_matrix[9-j][0] != 38 && call_matrix[9-j][2] != 0) //
{
printw ("| %s ", SyncTypes[call_matrix[9-j][0]]);
// printw ("| %s ", SyncTypes[call_matrix[9-j][0]]); //sync type
printw ("| ");
printw ("%s ", getDateC(call_matrix[9-j][5]) );
printw ("%s ", getTimeC(call_matrix[9-j][5]) );
if (lls == 28 || lls == 29)
{
if (idas == 0) printw ("RAN [%02lld] ", call_matrix[9-j][1]);
@ -3108,7 +3106,7 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state)
//DMR BS Types
if (call_matrix[9-j][0] == 12 || call_matrix[9-j][0] == 13 || call_matrix[9-j][0] == 10 || call_matrix[9-j][0] == 11 )
{
printw ("S[%lld] ", call_matrix[9-j][3]); //%d
// printw ("S[%lld] ", call_matrix[9-j][3]); //%d
printw ("TGT [%8lld] ", call_matrix[9-j][1]);
printw ("SRC [%8lld] ", call_matrix[9-j][2]);
printw ("DCC [%02lld] ", call_matrix[9-j][4]);
@ -3116,13 +3114,13 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state)
//DMR MS Types
if (call_matrix[9-j][0] == 32 || call_matrix[9-j][0] == 33 || call_matrix[9-j][0] == 34 )
{
printw ("S[%lld] ", call_matrix[9-j][3]);
// printw ("S[%lld] ", call_matrix[9-j][3]);
printw ("TGT [%8lld] ", call_matrix[9-j][1]);
printw ("SRC [%8lld] ", call_matrix[9-j][2]);
printw ("DCC [%02lld] ", call_matrix[9-j][4]);
}
#ifdef LIMAZULUTWEAKS
// #ifdef LIMAZULUTWEAKS
//Group Name Labels from CSV import
for (int k = 0; k < state->group_tally; k++)
{
@ -3139,10 +3137,8 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state)
printw ("[%s] ", state->group_array[k].groupMode);
}
}
#endif
printw ("%s ", getDateC(call_matrix[9-j][5]) ); //You're welcome
printw ("%s \n", getTimeC(call_matrix[9-j][5]) ); //Remus
// #endif
printw ("\n");
}
//EDACS and ProVoice, outside of timestamp loop
@ -3150,12 +3146,28 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state)
{
if (call_matrix[j][3] != 0)
{
printw ("| %s ", SyncTypes[call_matrix[j][0]]);
printw ("| ");
printw ("%s ", getDateC(call_matrix[j][5]) );
printw ("%s ", getTimeC(call_matrix[j][5]) );
printw ("LCN [%2lld] ", call_matrix[j][1]);
printw ("Group [%8lld] ", call_matrix[j][2]);
printw ("Source [%8lld] ", call_matrix[j][3]);
printw ("%s ", getDateC(call_matrix[j][5]) );
printw ("%s \n", getTimeC(call_matrix[j][5]) );
//test
for (int k = 0; k < state->group_tally; k++)
{
if (state->group_array[k].groupNumber == call_matrix[j][2])
{
attron(COLOR_PAIR(4));
printw ("[%s] ", state->group_array[k].groupName);
}
else if (state->group_array[k].groupNumber == call_matrix[j][3])
{
attron(COLOR_PAIR(4));
printw ("[%s] ", state->group_array[k].groupName);
}
}
//end test
printw ("\n");
}
}

View File

@ -630,7 +630,7 @@ int verbose_set_frequency(rtlsdr_dev_t *dev, uint32_t frequency)
if (r < 0) {
fprintf (stderr, " WARNING: Failed to set center freq.\n");
} else {
fprintf (stderr, " Tuned to %u Hz.\n", frequency);
fprintf (stderr, " Tuned to %u Hz.\n", frequency); //consider disabling this
}
return r;
}
@ -964,7 +964,7 @@ void open_rtlsdr_stream(dsd_opts *opts)
{
struct sigaction sigact;
int r;
rtl_bandwidth = opts->rtl_bandwidth * 1000 * 2; //going to double the value -- may clear up issue with user specified BW not what it seems
rtl_bandwidth = opts->rtl_bandwidth * 1000; //reverted back to straight value
bandwidth_multiplier = (bandwidth_divisor / rtl_bandwidth);
//this needs to be initted first, then we set the parameters
@ -985,15 +985,15 @@ void open_rtlsdr_stream(dsd_opts *opts)
dongle.dev_index = opts->rtl_dev_index;
// demod.squelch_level = opts->rtl_squelch_level; //no longer used here, used in framesync vc rms value under select conditions
fprintf (stderr, "Setting RTL VFO Bandwidth to %d Hz\n", rtl_bandwidth);
fprintf (stderr, "Setting RTL Sample Multiplier to %d\n", bandwidth_multiplier);
fprintf (stderr, "Setting RTL Squelch Level to %d\n", demod.squelch_level);
fprintf (stderr, "Setting RTL Bandwidth to %d Hz\n", rtl_bandwidth);
// fprintf (stderr, "Setting RTL Sample Multiplier to %d\n", bandwidth_multiplier);
fprintf (stderr, "Setting RTL RMS Squelch Level to %d\n", opts->rtl_squelch_level);
if (opts->rtl_udp_port != 0) port = opts->rtl_udp_port; //set this here, only open socket thread if set
if (opts->rtl_gain_value > 0) {
dongle.gain = opts->rtl_gain_value * 10; //multiple by ten to make it consitent with the way rtl_fm works
}
volume_multiplier = opts->rtl_volume_multiplier;
fprintf (stderr, "Setting RTL Volume Multiplier to %d\n", volume_multiplier);
// fprintf (stderr, "Setting RTL Volume Multiplier to %d\n", volume_multiplier);
/* quadruple sample_rate to limit to Δθ to ±π/2 */
demod.rate_in *= demod.post_downsample;
@ -1026,7 +1026,7 @@ void open_rtlsdr_stream(dsd_opts *opts)
} else {
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
// fprintf (stderr, "Setting RTL Nearest Gain to %d. \n", dongle.gain); //seems to be working now
}
verbose_ppm_set(dongle.dev, dongle.ppm_error);
@ -1094,7 +1094,6 @@ void rtl_dev_tune(dsd_opts * opts, long int frequency)
dongle.freq = opts->rtlsdr_center_freq = frequency;
optimal_settings(dongle.freq, demod.rate_in);
r = verbose_set_frequency(dongle.dev, dongle.freq);
// dongle.mute = BUFFER_DUMP; //test this here -- unsure if this does anything beneficial or anything at all, perceived 'lag' could be RMS related on NXDN48, DMR doesn't have the same symptoms.
}
//return RMS value (root means square) power level -- used as soft squelch inside of framesync