From 67a78d8be00813e9afd3c229aeaae7d979c36b5d Mon Sep 17 00:00:00 2001 From: lwvmobile Date: Wed, 5 Oct 2022 12:07:00 -0400 Subject: [PATCH] Symbol Capture Read Tweaks and Fixes --- src/dsd_dibit.c | 25 +++++++------------------ src/dsd_symbol.c | 34 ++++++++-------------------------- src/p25_p2.c | 25 +++---------------------- src/p25p2_vpdu.c | 4 ++-- 4 files changed, 20 insertions(+), 68 deletions(-) diff --git a/src/dsd_dibit.c b/src/dsd_dibit.c index f6e2b82..a11b44b 100644 --- a/src/dsd_dibit.c +++ b/src/dsd_dibit.c @@ -263,7 +263,7 @@ static int digitize (dsd_opts* opts, dsd_state* state, int symbol) else if ((state->synctype == 1) || (state->synctype == 3) || (state->synctype == 5) || (state->synctype == 9) || (state->synctype == 11) || (state->synctype == 13) || - (state->synctype == 17) ) + (state->synctype == 17) || (state->synctype == 36) ) { // 1 -P25p1 @@ -394,19 +394,6 @@ get_dibit_and_analog_signal (dsd_opts* opts, dsd_state* state, int* out_analog_s int symbol; int dibit; - // if (opts->audio_in_type == 4 && opts->frame_provoice == 1) // - // { - // //skip processing symbol as dibit and use it as is - // if (state->symbolc == 0) - // { - // symbol = 1; - // } - // if (state->symbolc == 1) - // { - // symbol = 3; - // } - // } - #ifdef TRACE_DSD unsigned int l, r; #endif @@ -435,15 +422,17 @@ get_dibit_and_analog_signal (dsd_opts* opts, dsd_state* state, int* out_analog_s dibit = digitize (opts, state, symbol); - //don't think this is quite right still, but should work, don't know why it doesn't - if (opts->audio_in_type == 4 && opts->frame_provoice == 1) // + if (opts->audio_in_type == 4) { - //skip processing symbol as dibit and use it as is + //assign dibit from last symbol/dibit read from capture bin dibit = state->symbolc; + if (state->use_throttle == 1) + { + usleep(0); + } } //symbol/dibit file capture/writing - //need this bit here to capture dibits once sync starts if (opts->symbol_out == 1) { //fprintf (stderr, "%d", dibit); diff --git a/src/dsd_symbol.c b/src/dsd_symbol.c index 029df2b..463e1f0 100644 --- a/src/dsd_symbol.c +++ b/src/dsd_symbol.c @@ -140,11 +140,6 @@ getSymbol (dsd_opts * opts, dsd_state * state, int have_sync) #endif } - // //test reading symbol bin files - // else if (opts->audio_in_type == 4) - // { - // //use fopen and read in a sample, check boatbod op25 for clues - // } #ifdef TRACE_DSD state->debug_sample_index++; @@ -378,32 +373,20 @@ getSymbol (dsd_opts * opts, dsd_state * state, int have_sync) openPulseInput(opts); } - //flip dibit values when p25-p1, has issues when read in positive polarity - if (state->synctype == 0 || state->synctype == 1 ) + //assign symbol/dibit values based on modulation type + if (state->rf_mod == 1) //GFSK { - if (state->symbolc == 0) + symbol = state->symbolc; + if (state->symbolc == 0 && state->synctype >= 0) { - symbol = -1; //-1 + symbol = -3; //-1 } - if (state->symbolc == 1) + if (state->symbolc == 1 && state->synctype >= 0) { - symbol = -3; //-3 - } - if (state->symbolc == 2) - { - symbol = 1; //1 - } - if (state->symbolc == 3) - { - symbol = 3; //3 + symbol = -1; //-3 } } - else if (opts->frame_provoice == 1) //syncs fine, but issues with dibit reading - { - //provoice has issue where sync is okay, but decode isn't working after sync - //symbol = state->symbolc; - } - else + else //everything else { if (state->symbolc == 0) { @@ -425,7 +408,6 @@ getSymbol (dsd_opts * opts, dsd_state * state, int have_sync) } - state->symbolcnt++; return (symbol); } diff --git a/src/p25_p2.c b/src/p25_p2.c index 90df908..2919630 100644 --- a/src/p25_p2.c +++ b/src/p25_p2.c @@ -95,26 +95,9 @@ void p2_dibit_buffer (dsd_opts * opts, dsd_state * state) for (int i = 0; i < 2140; i++) //2160 for an entire superframe of dibits - 20 sync dibits { - //rip dibits directly from the capture bin file instead of getDibit - if (opts->audio_in_type == 4) //4 - { - dibit = fgetc(opts->symbolfile); - //experimental throttle - useconds_t stime = state->symbol_throttle; - if (state->use_throttle == 1) - { - usleep(stime); - } - } - else - { - dibit = getDibit(opts, state); - if (opts->inverted_p2 == 1) - { - dibit = (dibit ^ 2); //invert dibit here since we are reading it upside down - } - } - + //symbol capture reading now handled directly by getSymbol and getDibit + dibit = getDibit(opts, state); + //dibit inversion handled internally by getDibit if sync type is inverted p2bit[i*2] = (dibit >> 1) & 1; p2bit[i*2+1] = (dibit & 1); @@ -765,8 +748,6 @@ void process_P2_DUID (dsd_opts * opts, dsd_state * state) else if (duid_decoded == 4) { fprintf (stderr, " LCCH Sc"); //w/ scrambling - // if (state->currentslot == 0) state->dmrburstL = 31; - // else state->dmrburstR = 31; if (state->p2_wacn != 0 && state->p2_cc != 0 && state->p2_sysid != 0 && state->p2_wacn != 0xFFFFF && state->p2_cc != 0xFFF && state->p2_sysid != 0xFFF) { diff --git a/src/p25p2_vpdu.c b/src/p25p2_vpdu.c index b7988e3..1b7022b 100644 --- a/src/p25p2_vpdu.c +++ b/src/p25p2_vpdu.c @@ -120,13 +120,13 @@ void process_MAC_VPDU(dsd_opts * opts, dsd_state * state, int type, unsigned lon //Telephone Interconnect Voice Channel Grant (TELE_INT_CH_GRANT) if (MAC[1+len_a] == 0x48) { - fprintf (stderr, "\n Telephone Interconnect Voice Channel Grant (TELE_INT_CH_GRANT)"); + fprintf (stderr, "\n Telephone Interconnect Voice Channel Grant "); } //Telephone Interconnect Voice Channel Grant Update (TELE_INT_CH_GRANT_UPDT) if (MAC[1+len_a] == 0x49) { - fprintf (stderr, "\n Telephone Interconnect Voice Channel Grant Update (TELE_INT_CH_GRANT_UPDT)"); + fprintf (stderr, "\n Telephone Interconnect Voice Channel Grant Update "); } //Synchronization Broadcast (SYNC_BCST)