diff --git a/CMakeLists.txt b/CMakeLists.txt index d0a2816..9b79036 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -88,6 +88,13 @@ if (DCR) add_definitions(-DJPNDCR_DECODE) endif () +#use cmake option -DNOS=ON to enable older NXDN sync w/ pos and inv polarity, disable newer seperated (disabled by default) +option(NOS + "Build with Old NXDN Sync (pos and inv polarity) Enabled" OFF) +if (NOS) + add_definitions(-DNXDN_OLD_SYNC) +endif () + #use cmake option -DSID=ON to enable P25p1 Soft ID decoding -- Experimental option(SID "Build with P25p1 LSD/Soft ID Enabled" OFF) diff --git a/src/dsd_frame_sync.c b/src/dsd_frame_sync.c index efc19b5..9d29836 100644 --- a/src/dsd_frame_sync.c +++ b/src/dsd_frame_sync.c @@ -1140,55 +1140,56 @@ getFrameSync (dsd_opts * opts, dsd_state * state) } } + #ifdef NXDN_OLD_SYNC + //NXDN (previous sync, now a cmake option -DNOS=ON ..) + else if ((opts->frame_nxdn96 == 1) || (opts->frame_nxdn48 == 1)) + { + strncpy (synctest10, (synctest_p - 9), 10); //FSW only + 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 - // //NXDN (previous sync, revert if issues / complaints arise) - // else if ((opts->frame_nxdn96 == 1) || (opts->frame_nxdn48 == 1)) - // { - // strncpy (synctest10, (synctest_p - 9), 10); //FSW only - // 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 + ) + { - // ) - // { + if (state->lastsynctype == 28) + { + state->offset = synctest_pos; + state->max = ((state->max) + lmax) / 2; + state->min = ((state->min) + lmin) / 2; + state->last_cc_sync_time = time(NULL); + return (28); + } + state->lastsynctype = 28; + } - // if (state->lastsynctype == 28) - // { - // state->offset = synctest_pos; - // state->max = ((state->max) + lmax) / 2; - // state->min = ((state->min) + lmin) / 2; - // state->last_cc_sync_time = time(NULL); - // return (28); - // } - // state->lastsynctype = 28; - // } + else if ( - // else if ( + (strcmp (synctest10, "1313113313") == 0 ) + || (strcmp (synctest10, "1113113313") == 0 ) + || (strcmp (synctest10, "1313113333") == 0 ) + || (strcmp (synctest10, "1113113333") == 0 ) + || (strcmp (synctest10, "1313133313") == 0 ) - // (strcmp (synctest10, "1313113313") == 0 ) - // || (strcmp (synctest10, "1113113313") == 0 ) - // || (strcmp (synctest10, "1313113333") == 0 ) - // || (strcmp (synctest10, "1113113333") == 0 ) - // || (strcmp (synctest10, "1313133313") == 0 ) + ) + { - // ) - // { - - // if (state->lastsynctype == 29) - // { - // state->offset = synctest_pos; - // state->max = ((state->max) + lmax) / 2; - // state->min = ((state->min) + lmin) / 2; - // state->last_cc_sync_time = time(NULL); - // return (29); - // } - // state->lastsynctype = 29; - // } - // } + if (state->lastsynctype == 29) + { + state->offset = synctest_pos; + state->max = ((state->max) + lmax) / 2; + state->min = ((state->min) + lmin) / 2; + state->last_cc_sync_time = time(NULL); + return (29); + } + state->lastsynctype = 29; + } + } + #else //new sync //NXDN (positive sync only) else if (opts->inverted_nxdn == 0 && ((opts->frame_nxdn96 == 1) || (opts->frame_nxdn48 == 1)) ) { @@ -1242,6 +1243,7 @@ getFrameSync (dsd_opts * opts, dsd_state * state) } } + #endif //Provoice Conventional -- Some False Positives due to shortened frame sync pattern, so use squelch if possible #ifdef PVCONVENTIONAL diff --git a/src/dsd_main.c b/src/dsd_main.c index c16bc02..7ffc2d4 100644 --- a/src/dsd_main.c +++ b/src/dsd_main.c @@ -1490,7 +1490,11 @@ printf (" -xx Expect non-inverted X2-TDMA signal\n"); printf (" -xr Expect inverted DMR signal\n"); printf (" -xd Expect inverted ICOM dPMR signal\n"); + #ifdef NXDN_OLD_SYNC + // + #else printf (" -xn Expect inverted NXDN/DCR/IDAS signal\n"); + #endif printf ("\n"); printf (" * denotes frame types that cannot be auto-detected.\n"); printf (" ** Phase 2 Single Frequency may require user to manually set WACN/SYSID/CC parameters if MAC_SIGNAL not present.\n"); @@ -2759,7 +2763,11 @@ sprintf (opts.output_name, "NXDN48"); fprintf (stderr,"Setting symbol rate to 2400 / second\n"); fprintf (stderr,"Decoding only NXDN 4800 baud frames.\n"); + #ifdef NXDN_OLD_SYNC + // + #else fprintf(stderr, "Notice: NXDN autodetect polarity disabled. \n Use -xn option if Inverted Signal expected.\n"); + #endif } else if (optarg[0] == 'y') { @@ -3084,7 +3092,11 @@ else if (optarg[0] == 'n') { opts.inverted_nxdn = 1; + #ifdef NXDN_OLD_SYNC + // + #else fprintf (stderr, "Expecting inverted NXDN/DCR/IDAS signals.\n"); + #endif } break;