From ade7c0477f43f85f3733a18df0ef4fb2530c67ec Mon Sep 17 00:00:00 2001 From: lwvmobile Date: Mon, 5 Jun 2023 02:17:38 -0400 Subject: [PATCH] Late Nite FS Testing; #123 --- src/dsd_frame_sync.c | 170 +++++++++++++++++++++++-------------------- src/dsd_main.c | 2 +- src/dsd_ncurses.c | 6 +- 3 files changed, 95 insertions(+), 83 deletions(-) diff --git a/src/dsd_frame_sync.c b/src/dsd_frame_sync.c index 92009c0..cfb24e5 100644 --- a/src/dsd_frame_sync.c +++ b/src/dsd_frame_sync.c @@ -448,15 +448,23 @@ getFrameSync (dsd_opts * opts, dsd_state * state) state->minref = state->min; } + //Test Using this as an improvement to framesync and good initial decodes + //better initial decodes observed on NXDN when using this, and also on P25 + //test on other system types as well + state->max = ((state->max) + lmax) / 2; + state->min = ((state->min) + lmin) / 2; + //if using an rtl input method, do not look for sync patterns if the rms value is lower than our 'soft squelch' level if (opts->audio_in_type == 3 && opts->rtl_rms < opts->rtl_squelch_level) //tests show floor level around 40, and signal breaking 100, default is 100 for level { if (opts->frame_nxdn48 == 1 || opts->frame_nxdn96 == 1 || opts->frame_dpmr == 1) { //should we update min/max here? yes or no? + //NOTE: Startup on Sync seems to respond much faster with this on, perhaps this needs to move to always occur on every sync type + // state->max = ((state->max) + lmax) / 2; // state->min = ((state->min) + lmin) / 2; - + goto SYNC_TEST_END; } } @@ -1292,8 +1300,9 @@ getFrameSync (dsd_opts * opts, dsd_state * state) } - #ifdef NXDNTESTSYNC // - + #ifdef NXDNTESTSYNC //Use Experimental FS + + //NOTE: Current Issue with Syncing when using RTL Input on some NXDN48 Type-C Trunking System //NXDN FSW sync and handling - using more exact frame sync values else if ((opts->frame_nxdn96 == 1) || (opts->frame_nxdn48 == 1)) { @@ -1303,113 +1312,116 @@ getFrameSync (dsd_opts * opts, dsd_state * state) //Using Hard Coded Sync Strings with variations for the areas where the symbol //error will occur due to the demodulation issues internally + //Disabling the Preamble+FSW version for now + //its nearly impossible to catch it + //Preamble plus FSW, proceed right away - if ( + // if ( - (strcmp (synctest19, "3131133313131331131") == 0 ) - || (strcmp (synctest19, "3131133313331331131") == 0 ) - || (strcmp (synctest19, "3131133313131331111") == 0 ) - || (strcmp (synctest19, "3131133313331331111") == 0 ) + // (strcmp (synctest19, "3131133313131331131") == 0 ) + // || (strcmp (synctest19, "3131133313331331131") == 0 ) + // || (strcmp (synctest19, "3131133313131331111") == 0 ) + // || (strcmp (synctest19, "3131133313331331111") == 0 ) - ) - { - // state->carrier = 1; - state->lastsynctype = 28; - state->last_cc_sync_time = time(NULL); - - state->offset = synctest_pos; - state->max = ((state->max) + lmax) / 2; - state->min = ((state->min) + lmin) / 2; + // ) + // { + // state->carrier = 1; + // state->offset = synctest_pos; + // state->max = ((state->max) + lmax) / 2; + // state->min = ((state->min) + lmin) / 2; + // state->lastsynctype = 28; + // state->last_cc_sync_time = time(NULL); - // if (opts->payload == 1) - // fprintf (stderr, "\n +PANDF "); - // if (opts->payload == 1) - // fprintf (stderr, " %s \n", synctest19); - return (28); - } - else if ( + // // if (opts->payload == 1) + // // fprintf (stderr, "\n +PANDF "); + // // if (opts->payload == 1) + // // fprintf (stderr, " %s \n", synctest19); + // return (28); + // } + // else if ( - (strcmp (synctest19, "1313311133131331131") == 0 ) - || (strcmp (synctest19, "1313311133331331131") == 0 ) - || (strcmp (synctest19, "1313311133131331111") == 0 ) - || (strcmp (synctest19, "1313311133331331111") == 0 ) + // (strcmp (synctest19, "1313311133131331131") == 0 ) + // || (strcmp (synctest19, "1313311133331331131") == 0 ) + // || (strcmp (synctest19, "1313311133131331111") == 0 ) + // || (strcmp (synctest19, "1313311133331331111") == 0 ) - ) - { - // state->carrier = 1; - state->lastsynctype = 29; - state->last_cc_sync_time = time(NULL); - - state->offset = synctest_pos; - state->max = ((state->max) + lmax) / 2; - state->min = ((state->min) + lmin) / 2; + // ) + // { + // // state->carrier = 1; + // state->carrier = 1; + // state->offset = synctest_pos; + // state->max = ((state->max) + lmax) / 2; + // state->min = ((state->min) + lmin) / 2; + // state->lastsynctype = 29; + // state->last_cc_sync_time = time(NULL); - // if (opts->payload == 1) - // fprintf (stderr, "\n -PANDF "); - // if (opts->payload == 1) - // fprintf (stderr, " %s \n", synctest19); - return (29); - } + // // if (opts->payload == 1) + // // fprintf (stderr, "\n -PANDF "); + // // if (opts->payload == 1) + // // fprintf (stderr, " %s \n", synctest19); + // return (29); + // } - else if ( - (strcmp (synctest10, "3131331131") == 0 ) - || (strcmp (synctest10, "3331331131") == 0 ) + if ( + (strcmp (synctest10, "3131331131") == 0 ) //this seems to be the most common 'correct' pattern on Type-C + || (strcmp (synctest10, "3331331131") == 0 ) //this one hits on new sync but gives a bad lich code || (strcmp (synctest10, "3131331111") == 0 ) || (strcmp (synctest10, "3331331111") == 0 ) + || (strcmp (synctest10, "3131311131") == 0 ) //First few FSW on NXDN48 Type-C seems to hit this for some reason ) { - // state->carrier = 1; + state->carrier = 1; state->offset = synctest_pos; state->max = ((state->max) + lmax) / 2; state->min = ((state->min) + lmin) / 2; + // state->last_cc_sync_time = time(NULL); if (state->lastsynctype == 28) { - state->lastsynctype = 28; state->last_cc_sync_time = time(NULL); // if (opts->payload == 1) - // fprintf (stderr, "\n +FSW "); + // fprintf (stderr, "\n +FSW "); // if (opts->payload == 1) - // fprintf (stderr, " %s \n", synctest10); + // fprintf (stderr, " %s \n", synctest10); return (28); } - state->lastsynctype = 28; - - } - else if ( - - (strcmp (synctest10, "1313113313") == 0 ) - || (strcmp (synctest10, "1113113313") == 0 ) - || (strcmp (synctest10, "1313113333") == 0 ) - || (strcmp (synctest10, "1113113333") == 0 ) - - ) - { - // state->carrier = 1; - state->offset = synctest_pos; - state->max = ((state->max) + lmax) / 2; - state->min = ((state->min) + lmin) / 2; + //Disabling Inverted Sync for testing -- using SDR++ or RTL Input, I only ever see positive sync pattern + //This will also further reduce any FSW false positives, but at the cost of inverted sync - if (state->lastsynctype == 29) - { - state->lastsynctype = 29; - state->last_cc_sync_time = time(NULL); - // if (opts->payload == 1) - // fprintf (stderr, "\n -FSW "); - // if (opts->payload == 1) - // fprintf (stderr, " %s \n", synctest10); - return (29); - } - state->lastsynctype = 29; + // else if ( + + // (strcmp (synctest10, "1313113313") == 0 ) + // || (strcmp (synctest10, "1113113313") == 0 ) + // || (strcmp (synctest10, "1313113333") == 0 ) + // || (strcmp (synctest10, "1113113333") == 0 ) + // || (strcmp (synctest10, "1313133313") == 0 ) // + + // ) + // { + // // state->carrier = 1; + // state->offset = synctest_pos; + // state->max = ((state->max) + lmax) / 2; + // state->min = ((state->min) + lmin) / 2; + // // state->last_cc_sync_time = time(NULL); - } + // if (state->lastsynctype == 29) + // { + // state->last_cc_sync_time = time(NULL); + // // if (opts->payload == 1) + // // fprintf (stderr, "\n -FSW "); + // // if (opts->payload == 1) + // // fprintf (stderr, " %s \n", synctest10); + // return (29); + // } + // state->lastsynctype = 29; + // } } - #else //use previous NXDN Sync pattern detection + #else //use previously 'stable' NXDN Sync pattern detection //NXDN FSW sync and handling - moved to very bottom of sync stack for falsing sanity else if ((opts->frame_nxdn96 == 1) || (opts->frame_nxdn48 == 1)) diff --git a/src/dsd_main.c b/src/dsd_main.c index 1e0ca68..7691990 100644 --- a/src/dsd_main.c +++ b/src/dsd_main.c @@ -1358,7 +1358,7 @@ main (int argc, char **argv) } #ifdef AERO_BUILD - fprintf (stderr, "Build Version: v2.0.1-23 Win32 \n"); + fprintf (stderr, "Build Version: v2.0.1-24 Win32 \n"); #else fprintf (stderr, "Build Version: %s \n", GIT_TAG); #endif diff --git a/src/dsd_ncurses.c b/src/dsd_ncurses.c index d5dfff3..ffab6ff 100644 --- a/src/dsd_ncurses.c +++ b/src/dsd_ncurses.c @@ -2072,14 +2072,14 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state) if (opts->ncurses_compact == 1) { printw ("------------------------------------------------------------------------------\n"); - printw ("| Digital Speech Decoder: Florida Man Edition - Aero %s \n", "v2.0.1-23 Win32"); + printw ("| Digital Speech Decoder: Florida Man Edition - Aero %s \n", "v2.0.1-24 Win32"); printw ("------------------------------------------------------------------------------\n"); } #elif LIMAZULUTWEAKS if (opts->ncurses_compact == 1) { printw ("------------------------------------------------------------------------------\n"); - printw ("| Digital Speech Decoder: LimaZulu Edition IV: The Voyage Home \n"); + printw ("| Digital Speech Decoder: LimaZulu Edition V: The Empire Strikes Back \n"); printw ("------------------------------------------------------------------------------\n"); } #else @@ -2101,7 +2101,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-23 Win32 \n"); + if (i == 6) printw (" v2.0.1-24 Win32 \n"); #else if (i == 5) printw (" %s ", "zDEV BUILD"); // if (i == 5) printw (" %s ", "MAIN BUILD");