Fix Fast Scanner and NCurses Display (again)

This commit is contained in:
lwvmobile 2023-03-05 05:54:23 -05:00
parent 1640b58ae4
commit be47075611
3 changed files with 57 additions and 15 deletions

View File

@ -325,7 +325,7 @@ typedef struct
int p25_trunk; //experimental P25 trunking with RIGCTL (or RTLFM)
int p25_is_tuned; //set to 1 if currently on VC, set back to 0 if on CC
int trunk_hangtime; //hangtime in seconds before tuning back to CC
float trunk_hangtime; //hangtime in seconds before tuning back to CC
int scanner_mode; //experimental -- use the channel map as a conventional scanner, quicker tuning, but no CC

View File

@ -52,7 +52,7 @@ char * FM_banner[9] = {
" ██║ ██║ ╚═══██╗██║ ██║   ██╔══╝ ██║╚██╔╝██║██╔══╝ ",
" ██████╔╝██████╔╝██████╔╝   ██║ ██║ ╚═╝ ██║███████╗",
" ╚═════╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝ ╚═╝╚══════╝",
" 'Lite' Edition v2.0.0-55-gc1ed3fe Windows 32-bit RC4c"
" 'Lite' Edition v2.0.0-56-gfe46420 Windows 32-bit RC420"
};
int comp (const void *a, const void *b)
@ -77,11 +77,41 @@ void
noCarrier (dsd_opts * opts, dsd_state * state)
{
// // experimental conventional frequency scanner mode
// if (opts->scanner_mode == 1)
// {
// if (state->lcn_freq_roll > state->lcn_freq_count) //with >= we were cutting one short
// {
// state->lcn_freq_roll = 0; //reset to zero
// }
// //check that we have a non zero value first, then tune next frequency
// if (state->trunk_lcn_freq[state->lcn_freq_roll] != 0)
// {
// //rigctl
// if (opts->use_rigctl == 1)
// {
// if (opts->setmod_bw != 0 ) SetModulation(opts->rigctl_sockfd, opts->setmod_bw);
// SetFreq(opts->rigctl_sockfd, state->trunk_lcn_freq[state->lcn_freq_roll]);
// }
// //rtludp
// if (opts->audio_in_type == 3)
// {
// rtl_udp_tune (opts, state, state->trunk_lcn_freq[state->lcn_freq_roll]);
// }
// if (state->lastsynctype != -1) fprintf (stderr, "Resume Scanning Mode\n");
// }
// state->lcn_freq_roll++;
// }
// //end experimental conventional frequency scanner mode
//experimental conventional frequency scanner mode
if (opts->scanner_mode == 1)
if (opts->scanner_mode == 1 && ( (time(NULL) - state->last_cc_sync_time) > opts->trunk_hangtime))
{
if (state->lcn_freq_roll > state->lcn_freq_count) //with >= we were cutting one short
if (state->lcn_freq_roll >= state->lcn_freq_count)
{
state->lcn_freq_roll = 0; //reset to zero
}
@ -104,6 +134,7 @@ noCarrier (dsd_opts * opts, dsd_state * state)
}
state->lcn_freq_roll++;
state->last_cc_sync_time = time(NULL);
}
//end experimental conventional frequency scanner mode
@ -531,7 +562,7 @@ initOpts (dsd_opts * opts)
opts->p25_trunk = 0; //0 disabled, 1 is enabled
opts->p25_is_tuned = 0; //set to 1 if currently on VC, set back to 0 on carrier drop
opts->trunk_hangtime = 1; //1 second hangtime by default before tuning back to CC
opts->trunk_hangtime = 1; //1 second hangtime by default before tuning back to CC, going sub 1 sec causes issues with cc slip
opts->scanner_mode = 0; //0 disabled, 1 is enabled
@ -1049,7 +1080,7 @@ usage ()
printf (" -B <Hertz> Set RIGCTL Setmod Bandwidth in Hertz (0 - default - OFF)\n");
printf (" P25 - 7000-12000; P25 (QPSK) - 12000; NXDN48 - 4000; DMR - 7000; EDACS/PV - 12500;\n");
printf (" May vary based on system stregnth, etc.\n");
printf (" -t <secs> Set Trunking VC/sync loss hangtime in seconds. (default = 1 second)\n");
printf (" -t <secs> Set Trunking or Fast Scan VC/sync loss hangtime in seconds. (default = 1 second) (decimal values permitted) \n");
printf ("\n");
printf (" Trunking Example TCP: dsd-fme-lite -fs -i tcp -U 4532 -T -C dmr_t3_chan.csv -G group.csv -N 2> log.ans\n");
printf (" Trunking Example RTL: dsd-fme-lite -fs -i rtl:0:450M:26:-2:8:0:6020 -T -C connect_plus_chan.csv -G group.csv -N 2> log.ans\n");
@ -1365,9 +1396,14 @@ main (int argc, char **argv)
if (opts.rigctlportno != 0) opts.use_rigctl = 1;
break;
//NOTE: I changed trunk_hangtime to a float, BUT! time(NULL) returns in second whole numbers
//so using anything but whole numbers won't affect the outcome (rounded up?), in the future though,
//may change to a different return on sync times and this will matter!
case 't': //New letter assignment for Trunk Hangtime, flow down to allow temp numbers
case '6': //hangtime in seconds, default is 1;
sscanf (optarg, "%d", &opts.trunk_hangtime);
case '6': //hangtime in seconds, default is 1;
sscanf (optarg, "%f", &opts.trunk_hangtime); //updated for float/decimal values
fprintf (stderr, "Trunking or Fast Scanner Hang Time set to: %.02lf sec\n", opts.trunk_hangtime);
break;
case 'q': //New letter assignment for Reverse Mute, flow down to allow temp numbers

View File

@ -2061,7 +2061,7 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state)
if (opts->ncurses_compact == 1)
{
printw ("------------------------------------------------------------------------------\n");
printw ("| Digital Speech Decoder: Florida Man Edition - Win32 %s \n", "v2.0.0-55-gc1ed3fe RC4c");
printw ("| Digital Speech Decoder: Florida Man Edition - Win32 %s \n", "v2.0.0-56-gfe46420 RC420");
}
if (opts->ncurses_compact == 0)
{
@ -2072,8 +2072,8 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state)
if (i == 1) printw (" ESC to Menu");
if (i == 2) printw (" 'q' to Quit ");
if (i == 4) printw (" MBElib %s", versionstr);
if (i == 5) printw (" %s ", "Win32 RC4c"); //printw (" %s \n", GIT_TAG);
if (i == 6) printw (" %s \n", "v2.0.0-55-gc1ed3fe"); //printw (" %s \n", GIT_TAG);
if (i == 5) printw (" %s ", "Win32 RC420"); //printw (" %s \n", GIT_TAG);
if (i == 6) printw (" %s \n", "v2.0.0-56-gfe46420"); //printw (" %s \n", GIT_TAG);
else printw ("\n");
}
attroff(COLOR_PAIR(6)); //6
@ -2179,13 +2179,19 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state)
printw ("| Reverse Mute - Muting Unencrypted Voice\n");
}
if (opts->aggressive_framesync == 0) printw ("| Selective CRC ERR Bypass Enabled (RAS) \n");
if (state->M == 1) printw ("| Forcing Key Priority -- Key: %lld \n", state->R);
if (state->M == 1)
{
if (state->R != 0) printw ("| Forcing Key Priority -- NXDN Sc Key: %05lld \n", state->R);
if (state->K != 0) printw ("| Forcing Key Priority -- Moto BP Key: %03lld \n", state->K);
if (state->K1 != 0) printw ("| Forcing Key Priority -- tera BP Key: %016llX \n", state->K1);
if (state->K != 0 && state->K1 != 0) printw ("| Warning! Multiple DMR Key Types Loaded! \n"); //warning may not be required
}
if (opts->scanner_mode == 1)
{
printw ("| Fast Scan Mode Enabled ");
if (state->trunk_lcn_freq[state->lcn_freq_roll]) //this is a workaround to fix freq of 0 during roll reset
printw (" - Frequency: [%.06lf] Mhz \n", (double)state->trunk_lcn_freq[state->lcn_freq_roll]/1000000);
else printw (" - Frequency: [%.06lf] Mhz \n", (double)state->trunk_lcn_freq[0]/1000000);
if (state->lcn_freq_roll != 0)
printw (" - Frequency: [%.06lf] Mhz \n", (double)state->trunk_lcn_freq[state->lcn_freq_roll-1]/1000000);
printw (" Speed: %.02lf sec \n", opts->trunk_hangtime); //not sure values less than 1 make a difference, may be system/environment dependent
}
printw ("------------------------------------------------------------------------------\n");