RTL Verbosity Tweaks and Thread Safety; #125

This commit is contained in:
lwvmobile
2023-05-24 09:17:50 -04:00
parent 94166b493c
commit 96faff7711
3 changed files with 15 additions and 6 deletions

View File

@@ -1357,7 +1357,7 @@ main (int argc, char **argv)
} }
#ifdef AERO_BUILD #ifdef AERO_BUILD
fprintf (stderr, "Build Version: v2.0.1-15 Win32 \n"); fprintf (stderr, "Build Version: v2.0.1-16 Win32 \n");
#else #else
fprintf (stderr, "Build Version: %s \n", GIT_TAG); fprintf (stderr, "Build Version: %s \n", GIT_TAG);
#endif #endif

View File

@@ -2072,7 +2072,7 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state)
if (opts->ncurses_compact == 1) if (opts->ncurses_compact == 1)
{ {
printw ("------------------------------------------------------------------------------\n"); printw ("------------------------------------------------------------------------------\n");
printw ("| Digital Speech Decoder: Florida Man Edition - Aero \n", "v2.0.1-15 Win32"); printw ("| Digital Speech Decoder: Florida Man Edition - Aero \n", "v2.0.1-16 Win32");
printw ("------------------------------------------------------------------------------\n"); printw ("------------------------------------------------------------------------------\n");
} }
#elif LIMAZULUTWEAKS #elif LIMAZULUTWEAKS
@@ -2101,7 +2101,7 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state)
if (i == 4) printw (" MBElib %s", versionstr); if (i == 4) printw (" MBElib %s", versionstr);
#ifdef AERO_BUILD #ifdef AERO_BUILD
if (i == 5) printw (" %s ", "Aero Win32"); if (i == 5) printw (" %s ", "Aero Win32");
if (i == 6) printw (" v2.0.1-15 Win32 \n"); if (i == 6) printw (" v2.0.1-16 Win32 \n");
#else #else
if (i == 5) printw (" %s ", "zDEV BUILD"); if (i == 5) printw (" %s ", "zDEV BUILD");
if (i == 6) printw (" %s \n", GIT_TAG); if (i == 6) printw (" %s \n", GIT_TAG);

View File

@@ -628,9 +628,9 @@ int verbose_set_frequency(rtlsdr_dev_t *dev, uint32_t frequency)
int r; int r;
r = rtlsdr_set_center_freq(dev, frequency); r = rtlsdr_set_center_freq(dev, frequency);
if (r < 0) { if (r < 0) {
fprintf (stderr, " WARNING: Failed to set center freq.\n"); fprintf (stderr, " (WARNING: Failed to set Center Frequency). \n");
} else { } else {
fprintf (stderr, " Tuned to %u Hz.\n", frequency); //consider disabling this fprintf (stderr, " (Center Frequency: %u Hz.) \n", frequency);
} }
return r; return r;
} }
@@ -1091,10 +1091,19 @@ void get_rtlsdr_sample(int16_t *sample, dsd_opts * opts, dsd_state * state)
void rtl_dev_tune(dsd_opts * opts, long int frequency) void rtl_dev_tune(dsd_opts * opts, long int frequency)
{ {
int r; int r;
if (opts->payload == 1)
fprintf (stderr, "\nTuning to %lu Hz.", frequency);
dongle.freq = opts->rtlsdr_center_freq = frequency; dongle.freq = opts->rtlsdr_center_freq = frequency;
optimal_settings(dongle.freq, demod.rate_in); optimal_settings(dongle.freq, demod.rate_in);
r = verbose_set_frequency(dongle.dev, dongle.freq); if (opts->payload == 1)
fprintf (stderr, " (Center Frequency: %u Hz.) \n", dongle.freq);
r = rtlsdr_set_center_freq(dongle.dev, dongle.freq);
if (r < 0)
fprintf (stderr, " (WARNING: Failed to set Center Frequency %u). \n", dongle.freq);
pthread_rwlock_wrlock(&output.rw); //prevent possible segfault when cleaning the queue
rtl_clean_queue(); rtl_clean_queue();
pthread_rwlock_unlock(&output.rw); //resume
} }