NXDN Switch to New FS; Payload Tweaks; #123

This commit is contained in:
lwvmobile
2023-06-04 18:45:05 -04:00
parent c6611eae9c
commit e9962a8923
4 changed files with 102 additions and 79 deletions

View File

@@ -1291,9 +1291,9 @@ getFrameSync (dsd_opts * opts, dsd_state * state)
}
#ifdef NXDNTESTSYNC //use experimental sync detection based on multiple factors
// #ifdef NXDNTESTSYNC //
//NXDN FSW sync and handling - testing with more exact syncs patterns
//NXDN FSW sync and handling - using more exact frame sync values
else if ((opts->frame_nxdn96 == 1) || (opts->frame_nxdn48 == 1))
{
strncpy (synctest10, (synctest_p - 9), 10); //FSW only
@@ -1408,79 +1408,79 @@ getFrameSync (dsd_opts * opts, dsd_state * state)
}
}
#else //use current 'more stable' NXDN Sync pattern detection
// #else //use previous 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))
{
strncpy (synctest10, (synctest_p - 9), 10); //FSW only
strncpy (synctest19, (synctest_p - 18), 19); //Preamble + FSW
// //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))
// {
// strncpy (synctest10, (synctest_p - 9), 10); //FSW only
// strncpy (synctest19, (synctest_p - 18), 19); //Preamble + FSW
//Preamble plus FSW, proceed right away
if ( (strncmperr (synctest19, NXDN_PANDFSW, 19, 1) == 0) )
{
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, "PANDF ");
// fprintf (stderr, " %s ", synctest19);
return (28);
}
// //Preamble plus FSW, proceed right away
// if ( (strncmperr (synctest19, NXDN_PANDFSW, 19, 1) == 0) )
// {
// 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, "PANDF ");
// // fprintf (stderr, " %s ", synctest19);
// return (28);
// }
else if ( (strncmperr (synctest19, INV_NXDN_PANDFSW, 19, 1) == 0) )
{
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, "PANDF ");
// fprintf (stderr, " %s ", synctest19);
return (29);
}
// else if ( (strncmperr (synctest19, INV_NXDN_PANDFSW, 19, 1) == 0) )
// {
// 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, "PANDF ");
// // fprintf (stderr, " %s ", synctest19);
// return (29);
// }
else if ( (strncmperr (synctest10, NXDN_FSW, 10, 1) == 0) )
{
state->carrier = 1;
state->offset = synctest_pos;
state->max = ((state->max) + lmax) / 2;
state->min = ((state->min) + lmin) / 2;
// else if ( (strncmperr (synctest10, NXDN_FSW, 10, 1) == 0) )
// {
// state->carrier = 1;
// state->offset = synctest_pos;
// state->max = ((state->max) + lmax) / 2;
// state->min = ((state->min) + lmin) / 2;
if (state->lastsynctype == 28)
{
state->last_cc_sync_time = time(NULL);
// if (opts->payload == 1) fprintf (stderr, "FSW ");
// fprintf (stderr, " %s ", synctest10);
return (28);
}
state->lastsynctype = 28; //need two consecutive patterns to continue
// if (state->lastsynctype == 28)
// {
// state->last_cc_sync_time = time(NULL);
// // if (opts->payload == 1) fprintf (stderr, "FSW ");
// // fprintf (stderr, " %s ", synctest10);
// return (28);
// }
// state->lastsynctype = 28; //need two consecutive patterns to continue
}
// }
else if ( (strncmperr (synctest10, INV_NXDN_FSW, 10, 1) == 0) )
{
state->carrier = 1;
state->offset = synctest_pos;
state->max = ((state->max) + lmax) / 2;
state->min = ((state->min) + lmin) / 2;
// else if ( (strncmperr (synctest10, INV_NXDN_FSW, 10, 1) == 0) )
// {
// state->carrier = 1;
// state->offset = synctest_pos;
// state->max = ((state->max) + lmax) / 2;
// state->min = ((state->min) + lmin) / 2;
if (state->lastsynctype == 29)
{
state->last_cc_sync_time = time(NULL);
// if (opts->payload == 1) fprintf (stderr, "FSW ");
// fprintf (stderr, " %s ", synctest10);
return (29);
}
state->lastsynctype = 29; //need two consecutive patterns to continue
// if (state->lastsynctype == 29)
// {
// state->last_cc_sync_time = time(NULL);
// // if (opts->payload == 1) fprintf (stderr, "FSW ");
// // fprintf (stderr, " %s ", synctest10);
// return (29);
// }
// state->lastsynctype = 29; //need two consecutive patterns to continue
}
}
// }
// }
#endif //NXDN Sync Type Selection
// #endif //NXDN Sync Type Selection
//Provoice Conventional -- Some False Positives due to shortened frame sync pattern, so use squelch if possible
#ifdef PVCONVENTIONAL

View File

@@ -123,7 +123,7 @@ void nxdn_deperm_facch(dsd_opts * opts, dsd_state * state, uint8_t bits[144])
if (crc != check)
{
fprintf (stderr, " FACCH");
fprintf (stderr, " FACCH1");
fprintf (stderr, "%s", KRED);
fprintf (stderr, " (CRC ERR)");
fprintf (stderr, "%s", KNRM);
@@ -135,7 +135,7 @@ void nxdn_deperm_facch(dsd_opts * opts, dsd_state * state, uint8_t bits[144])
if (opts->payload == 1)
{
fprintf (stderr, "\n");
fprintf (stderr, " FACCH Payload ");
fprintf (stderr, " FACCH1 Payload ");
for (int i = 0; i < 12; i++)
{
fprintf (stderr, "[%02X]", m_data[i]);
@@ -332,16 +332,17 @@ void nxdn_deperm_sacch(dsd_opts * opts, dsd_state * state, uint8_t bits[60])
NXDN_SACCH_Full_decode (opts, state);
}
if (opts->payload == 1)
{
fprintf (stderr, "\n");
fprintf (stderr, " SACCH SF Segment #%d ", part_of_frame+1);
for (int i = 0; i < 4; i++)
{
fprintf (stderr, "[%02X]", m_data[i]);
}
// if (crc != check) fprintf (stderr, " CRC ERR - %02X %02X", crc, check);
}
// if (opts->payload == 1)
// {
// fprintf (stderr, "\n");
// fprintf (stderr, " SACCH SF Segment #%d ", part_of_frame+1);
// for (int i = 0; i < 4; i++)
// {
// fprintf (stderr, "[%02X]", m_data[i]);
// }
// // if (crc != check) fprintf (stderr, " CRC ERR - %02X %02X", crc, check);
// }
}
}

View File

@@ -15,10 +15,13 @@
void NXDN_SACCH_Full_decode(dsd_opts * opts, dsd_state * state)
{
uint8_t SACCH[400]; //72
uint8_t sacch_bytes[10];
uint32_t i;
uint8_t CrcCorrect = 1;
memset (SACCH, 0, sizeof (SACCH));
memset (sacch_bytes, 0, sizeof (sacch_bytes));
/* Consider all SACCH CRC parts as correct */
CrcCorrect = 1;
@@ -41,6 +44,17 @@ void NXDN_SACCH_Full_decode(dsd_opts * opts, dsd_state * state)
memset (state->nxdn_sacch_frame_segment, 1, sizeof(state->nxdn_sacch_frame_segment));
memset (state->nxdn_sacch_frame_segcrc, 1, sizeof(state->nxdn_sacch_frame_segcrc));
if (opts->payload == 1)
{
fprintf (stderr, "\n");
fprintf (stderr, " Full SACCH Payload ");
for (i = 0; i < 9; i++)
{
sacch_bytes[i] = (uint8_t)ConvertBitIntoBytes(&SACCH[i*8], 8);
fprintf (stderr, "[%02X]", sacch_bytes[i]);
}
}
} /* End NXDN_SACCH_Full_decode() */

View File

@@ -464,9 +464,17 @@ if (opts->scanner_mode == 1)
if (facch2) nxdn_deperm_facch2_udch(opts, state, facch2_bits, 1);
//SHOULD be okay to run facch1's again on steal frames, will need testing
// if (facch & 1) nxdn_deperm_facch(opts, state, facch_bits_a);
// if (facch & 2) nxdn_deperm_facch(opts, state, facch_bits_b);
//only run facch in second slot if its not equal to the first one
if (facch & 1) nxdn_deperm_facch(opts, state, facch_bits_a);
if (facch & 2) nxdn_deperm_facch(opts, state, facch_bits_b);
if (facch & 2)
{
if (memcmp (facch_bits_a, facch_bits_b, 144) != 0)
nxdn_deperm_facch(opts, state, facch_bits_b);
}
if (voice)
{
//restore MBE file open here