Fix Perpetual Sync Bug unless Squelch Break;

Add DCR MFID 30 F.C.R Data Preamble and Precoded Message PDU;

Misc Payload Tweaks;
This commit is contained in:
lwvmobile
2025-07-14 22:42:35 -04:00
parent 352bb98bc6
commit 698a991262
2 changed files with 63 additions and 31 deletions

View File

@@ -542,7 +542,7 @@ void nxdn_deperm_sacch2(dsd_opts * opts, dsd_state * state, uint8_t bits[60])
else if (crc != check)
{
fprintf (stderr, "%s", KRED);
fprintf (stderr, "(CRC ERR)");
fprintf (stderr, "SACCH (CRC ERR)");
fprintf (stderr, "%s", KNRM);
}
@@ -745,33 +745,58 @@ void nxdn_deperm_pich_tch(dsd_opts * opts, dsd_state * state, uint8_t bits[144])
}
}
//need more data points, but thinking this is probably similar to facch3
//or udch2 where we need to put two tch (facch1) messages together
// if (crc == check)
// {
// uint8_t opcode = (uint8_t)ConvertBitIntoBytes(&trellis_buf[0], 8);
// uint8_t gi = trellis_buf[16];
// uint16_t source = (uint16_t)ConvertBitIntoBytes(&trellis_buf[24], 16);
// uint16_t target = (uint16_t)ConvertBitIntoBytes(&trellis_buf[40], 16);
//STD-T98 DCR suggests TCH1 has data, and TCH2 will be zero fill
//could vary by PDU, but limited data points suggests the same
if (crc == check)
{
uint8_t opcode = (uint8_t)ConvertBitIntoBytes(&trellis_buf[0], 8);
uint8_t gi = trellis_buf[16];
uint16_t source = (uint16_t)ConvertBitIntoBytes(&trellis_buf[24], 16);
uint16_t target = (uint16_t)ConvertBitIntoBytes(&trellis_buf[40], 16);
// if (opcode != 0)
// {
// fprintf (stderr, "\n ");
// fprintf (stderr, "OP: %02X; ", opcode);
// fprintf (stderr, "Source: %d; Target: %d; ", source, target);
// if (gi)
// fprintf (stderr, "Private; ");
// else fprintf (stderr, "Group; ");
// }
//may only be relevant on MFID 0x30 "F.R.C." Radios
if (opcode == 0x0F)
{
fprintf (stderr, "\n ");
fprintf (stderr, "Source: %d; Target: %d; ", source, target);
if (gi)
fprintf (stderr, "Private; ");
else fprintf (stderr, "Group; ");
// }
// else
// {
// fprintf (stderr, "\n ");
// fprintf (stderr, "%s", KRED);
// fprintf (stderr, " (CRC ERR)");
// fprintf (stderr, "%s", KNRM);
// }
fprintf (stderr, "Data Preamble; ");
uint8_t countdown = (uint8_t)ConvertBitIntoBytes(&trellis_buf[64], 8);
fprintf (stderr, "Countdown: %d; ", countdown);
}
//may only be relevant on MFID 0x30 "F.R.C." Radios
if (opcode == 0x32)
{
fprintf (stderr, "\n ");
fprintf (stderr, "Source: %d; Target: %d; ", source, target);
if (gi)
fprintf (stderr, "Private; ");
else fprintf (stderr, "Group; ");
fprintf (stderr, "Precoded Message; ");
uint8_t idx = (uint8_t)ConvertBitIntoBytes(&trellis_buf[64], 8);
fprintf (stderr, "Index#: %d;", idx);
}
// if (opcode == 0x00)
// {
// fprintf (stderr, "\n NULL TCH; ");
// }
}
else if (opts->payload == 0)
{
fprintf (stderr, "\n ");
fprintf (stderr, "%s", KRED);
fprintf (stderr, "TCH (CRC ERR)");
fprintf (stderr, "%s", KNRM);
}
if (opts->payload == 1)
{

View File

@@ -117,7 +117,7 @@ void nxdn_frame (dsd_opts * opts, dsd_state * state)
if (opts->payload == 1)
fprintf(stderr, " Lich Off Bit Fill Error: %d / 8; \n", lich_off_hex);
#endif
// state->lastsynctype = -1; //set to -1 so we don't jump back here too quickly
state->lastsynctype = -1; //set to -1 so we don't jump back here too quickly
goto END;
}
#endif
@@ -137,7 +137,7 @@ void nxdn_frame (dsd_opts * opts, dsd_state * state)
if (opts->payload == 1)
fprintf(stderr, " Lich Parity Error %02X / %04X\n", lich_full, lich_bits_hex);
#endif
// state->lastsynctype = -1;
state->lastsynctype = -1;
goto END;
}
@@ -155,7 +155,7 @@ void nxdn_frame (dsd_opts * opts, dsd_state * state)
if (opts->payload == 1)
fprintf(stderr, " Simplex/Inbound NXDN lich on trunking system - type 0x%02X\n", lich);
#endif
// state->lastsynctype = -1; //set to -1 so we don't jump back here too quickly
state->lastsynctype = -1; //set to -1 so we don't jump back here too quickly
goto END;
}
@@ -290,7 +290,7 @@ void nxdn_frame (dsd_opts * opts, dsd_state * state)
//reset the sacch field, we probably got a false sync and need to wipe or give a bad crc
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));
// state->lastsynctype = -1; //set to -1 so we don't jump back here too quickly
state->lastsynctype = -1; //set to -1 so we don't jump back here too quickly
voice = 0;
goto END;
break;
@@ -623,5 +623,12 @@ void nxdn_frame (dsd_opts * opts, dsd_state * state)
if (opts->payload == 1 && !voice) fprintf (stderr, "\n");
else if (opts->payload == 0) fprintf (stderr, "\n");
END: ; //do nothing
END:
//if rejected sync, reset carrier and synctype as well
if (state->lastsynctype == -1)
{
state->carrier = 0;
state->synctype = -1;
}
}