From 4a83c1beae3250ab046e68de9bb7ddbaa9ffa7ee Mon Sep 17 00:00:00 2001 From: lwvmobile Date: Wed, 5 Oct 2022 12:51:33 -0400 Subject: [PATCH] Permit MAC_SIGNAL on bad CRC with -F option --- src/dsd_main.c | 8 +++++--- src/p25p2_xcch.c | 28 +++++++++++++++------------- 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/src/dsd_main.c b/src/dsd_main.c index 364b170..3ea8ee3 100644 --- a/src/dsd_main.c +++ b/src/dsd_main.c @@ -703,9 +703,11 @@ usage () printf (" -mg Use only GFSK modulation optimizations\n"); printf (" -mq Use only QPSK modulation optimizations\n"); printf (" -m2 Use Phase 2 6000 sps CQPSK modulation optimizations (testing, not fully implemented) \n"); - // printf (" -F Enable DMR TDMA Stereo Passive Frame Sync\n"); - // printf (" This feature will attempt to resync less often due to excessive voice errors\n"); - // printf (" Use if skipping occurs, but may cause wonky audio due to loss of good sync\n"); + printf (" -F Relax P25 Phase 2 MAC_SIGNAL CRC Checksum Pass/Fail\n"); + printf (" Use this feature to allow MAC_SIGNAL even if bad CRC errors.\n"); + printf (" -F Enable DMR BS Stereo Passive Frame Sync\n"); + printf (" This feature will attempt to resync less often due to excessive voice errors\n"); + printf (" Use if skipping occurs, but may cause wonky audio due to loss of good sync\n"); printf (" -Z Log MBE/Frame Payloads to console\n"); printf ("\n"); printf (" -K Manually Enter DMRA Privacy Key (Decimal Value of Key Number)\n"); diff --git a/src/p25p2_xcch.c b/src/p25p2_xcch.c index b24d999..51f91d3 100644 --- a/src/p25p2_xcch.c +++ b/src/p25p2_xcch.c @@ -76,18 +76,20 @@ void process_SACCH_MAC_PDU (dsd_opts * opts, dsd_state * state, int payload[180] { //fprintf (stderr, " NULL "); } - else //permit MAC_SIGNAL on CRC ERR for now until demodulator is working better? tests show tons of falsing, so leave on + else //permit MAC_SIGNAL on CRC ERR if -F option called { - fprintf (stderr, " CRC16 ERR L"); - state->p2_is_lcch = 0; //turn flag off here - // if (state->currentslot == 0) state->dmrburstL = 14; - // else state->dmrburstR = 14; - goto END_SMAC; + if (opts->aggressive_framesync == 1) + { + fprintf (stderr, " CRC16 ERR L"); + state->p2_is_lcch = 0; //turn flag off here + if (state->currentslot == 0) state->dmrburstL = 14; + else state->dmrburstR = 14; + goto END_SMAC; + } } } } - //remember, slots are inverted here, so set the opposite ones //monitor, test, and remove these if they cause issues due to inversion if (opcode == 0x0) @@ -217,7 +219,7 @@ void process_SACCH_MAC_PDU (dsd_opts * opts, dsd_state * state, int payload[180] } fprintf (stderr, "%s", KNRM); } - if (opcode == 0x3) + if (opcode == 0x3 && err == 0) { if (state->currentslot == 1) state->dmrburstL = 24; else state->dmrburstR = 24; @@ -226,7 +228,7 @@ void process_SACCH_MAC_PDU (dsd_opts * opts, dsd_state * state, int payload[180] process_MAC_VPDU(opts, state, 1, SMAC); fprintf (stderr, "%s", KNRM); } - if (opcode == 0x4) + if (opcode == 0x4 && err == 0) { if (state->currentslot == 1) state->dmrburstL = 21; else state->dmrburstR = 21; @@ -235,7 +237,7 @@ void process_SACCH_MAC_PDU (dsd_opts * opts, dsd_state * state, int payload[180] process_MAC_VPDU(opts, state, 1, SMAC); fprintf (stderr, "%s", KNRM); } - if (opcode == 0x6) + if (opcode == 0x6 && err == 0) { if (state->currentslot == 1) state->dmrburstL = 22; else state->dmrburstR = 22; @@ -427,7 +429,7 @@ void process_FACCH_MAC_PDU (dsd_opts * opts, dsd_state * state, int payload[156] } fprintf (stderr, "%s", KNRM); } - if (opcode == 0x3) + if (opcode == 0x3 && err == 0) { //what else should we zero out here? //disable any of the lines below if issues are observed @@ -456,7 +458,7 @@ void process_FACCH_MAC_PDU (dsd_opts * opts, dsd_state * state, int payload[156] process_MAC_VPDU(opts, state, 0, FMAC); fprintf (stderr, "%s", KNRM); } - if (opcode == 0x4) + if (opcode == 0x4 && err == 0) { if (state->currentslot == 0) state->dmrburstL = 21; else state->dmrburstR = 21; @@ -465,7 +467,7 @@ void process_FACCH_MAC_PDU (dsd_opts * opts, dsd_state * state, int payload[156] process_MAC_VPDU(opts, state, 0, FMAC); fprintf (stderr, "%s", KNRM); } - if (opcode == 0x6) + if (opcode == 0x6 && err == 0) { if (state->currentslot == 0) state->dmrburstL = 22; else state->dmrburstR = 22;