NXDN: Add Cmake option (-DNOS=ON) to switch back to old NXDN sync with pos and inv polarity;

There is bound to be at least one person who will complain, or listens to the harmonic and not the signal, or has a mixed bag of things and doesn't want to specify polarity;
This commit is contained in:
lwvmobile
2026-02-05 16:53:44 -05:00
parent 53a256bee8
commit 12012a9eee
3 changed files with 63 additions and 42 deletions

View File

@@ -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)

View File

@@ -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

View File

@@ -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;