From 2e098d52bc9a2174ea694b02ec1c8c5442396de2 Mon Sep 17 00:00:00 2001 From: lwvmobile Date: Mon, 4 Sep 2023 17:26:11 -0400 Subject: [PATCH] EDACS Dotting Sequence FS Detection and CC Jump; --- include/dsd.h | 7 +++- src/dsd_frame_sync.c | 83 +++++++++++++++++++++++--------------------- src/edacs-fme.c | 51 +++++++++++++++++++++++++++ 3 files changed, 101 insertions(+), 40 deletions(-) diff --git a/include/dsd.h b/include/dsd.h index 8f2042c..49c3f52 100644 --- a/include/dsd.h +++ b/include/dsd.h @@ -824,6 +824,10 @@ typedef struct #define INV_PROVOICE_EA_SYNC "13313133113113333311313133133311" #define PROVOICE_EA_SYNC "31131311331331111133131311311133" +//EDACS/PV dotting sequence +#define DOTTING_SEQUENCE_A "11111111111111111111111111111111" //0x5555 +#define DOTTING_SEQUENCE_B "33333333333333333333333333333333" //0xAAAA + //define the provoice conventional string pattern to default 85/85 if not enabled, else mute it so we won't double sync on accident in frame_sync #ifdef PVCONVENTIONAL #define PROVOICE_CONV "00000000000000000000000000000000" //all zeroes should be unobtainable string in the frame_sync synctests @@ -1167,7 +1171,8 @@ int UDPBind (char *hostname, int portno); //EDACS void edacs(dsd_opts * opts, dsd_state * state); -unsigned long long int edacs_bch (unsigned long long int message); +unsigned long long int edacs_bch (unsigned long long int message); +void eot_cc(dsd_opts * opts, dsd_state * state); //end of TX return to CC //csv imports int csvGroupImport(dsd_opts * opts, dsd_state * state); diff --git a/src/dsd_frame_sync.c b/src/dsd_frame_sync.c index 81ea748..dd10d35 100644 --- a/src/dsd_frame_sync.c +++ b/src/dsd_frame_sync.c @@ -1142,56 +1142,61 @@ getFrameSync (dsd_opts * opts, dsd_state * state) //ProVoice and EDACS sync if (opts->frame_provoice == 1) + { + strncpy (synctest32, (synctest_p - 31), 32); + strncpy (synctest48, (synctest_p - 47), 48); + if ((strcmp (synctest32, PROVOICE_SYNC) == 0) || (strcmp (synctest32, PROVOICE_EA_SYNC) == 0)) { - strncpy (synctest32, (synctest_p - 31), 32); - strncpy (synctest48, (synctest_p - 47), 48); - if ((strcmp (synctest32, PROVOICE_SYNC) == 0) || (strcmp (synctest32, PROVOICE_EA_SYNC) == 0)) - { - state->last_cc_sync_time = time(NULL); - state->carrier = 1; - state->offset = synctest_pos; - state->max = ((state->max) + lmax) / 2; - state->min = ((state->min) + lmin) / 2; - sprintf (state->ftype, "ProVoice "); - if (opts->errorbars == 1) - printFrameSync (opts, state, "+PV ", synctest_pos + 1, modulation); - state->lastsynctype = 14; - return (14); - } - else if ((strcmp (synctest32, INV_PROVOICE_SYNC) == 0) || (strcmp (synctest32, INV_PROVOICE_EA_SYNC) == 0)) - { - state->last_cc_sync_time = time(NULL); - state->carrier = 1; - state->offset = synctest_pos; - state->max = ((state->max) + lmax) / 2; - state->min = ((state->min) + lmin) / 2; - sprintf (state->ftype, "ProVoice "); - printFrameSync (opts, state, "-PV ", synctest_pos + 1, modulation); - state->lastsynctype = 15; - return (15); - } - else if ( strcmp (synctest48, EDACS_SYNC) == 0) - { state->last_cc_sync_time = time(NULL); state->carrier = 1; state->offset = synctest_pos; state->max = ((state->max) + lmax) / 2; state->min = ((state->min) + lmin) / 2; - printFrameSync (opts, state, "-EDACS", synctest_pos + 1, modulation); - state->lastsynctype = 38; - return (38); - } - else if ( strcmp (synctest48, INV_EDACS_SYNC) == 0) - { + sprintf (state->ftype, "ProVoice "); + if (opts->errorbars == 1) + printFrameSync (opts, state, "+PV ", synctest_pos + 1, modulation); + state->lastsynctype = 14; + return (14); + } + else if ((strcmp (synctest32, INV_PROVOICE_SYNC) == 0) || (strcmp (synctest32, INV_PROVOICE_EA_SYNC) == 0)) + { state->last_cc_sync_time = time(NULL); state->carrier = 1; state->offset = synctest_pos; state->max = ((state->max) + lmax) / 2; state->min = ((state->min) + lmin) / 2; - printFrameSync (opts, state, "+EDACS", synctest_pos + 1, modulation); - state->lastsynctype = 37; - return (37); - } + sprintf (state->ftype, "ProVoice "); + printFrameSync (opts, state, "-PV ", synctest_pos + 1, modulation); + state->lastsynctype = 15; + return (15); + } + else if ( strcmp (synctest48, EDACS_SYNC) == 0) + { + state->last_cc_sync_time = time(NULL); + state->carrier = 1; + state->offset = synctest_pos; + state->max = ((state->max) + lmax) / 2; + state->min = ((state->min) + lmin) / 2; + printFrameSync (opts, state, "-EDACS", synctest_pos + 1, modulation); + state->lastsynctype = 38; + return (38); + } + else if ( strcmp (synctest48, INV_EDACS_SYNC) == 0) + { + state->last_cc_sync_time = time(NULL); + state->carrier = 1; + state->offset = synctest_pos; + state->max = ((state->max) + lmax) / 2; + state->min = ((state->min) + lmin) / 2; + printFrameSync (opts, state, "+EDACS", synctest_pos + 1, modulation); + state->lastsynctype = 37; + return (37); + } + else if ((strcmp (synctest32, DOTTING_SEQUENCE_A) == 0) || (strcmp (synctest32, DOTTING_SEQUENCE_B) == 0)) + { + printFrameSync (opts, state, " EDACS DOTTING SEQUENCE; ", synctest_pos + 1, modulation); + eot_cc (opts, state); + } } diff --git a/src/edacs-fme.c b/src/edacs-fme.c index 3d2bd87..602b87a 100644 --- a/src/edacs-fme.c +++ b/src/edacs-fme.c @@ -671,4 +671,55 @@ void edacs(dsd_opts * opts, dsd_state * state) } +void eot_cc(dsd_opts * opts, dsd_state * state) +{ + + fprintf (stderr, "EOT; \n"); + + //jump back to CC here + if (opts->p25_trunk == 1 && state->p25_cc_freq != 0 && opts->p25_is_tuned == 1) + { + + //rigctl + if (opts->use_rigctl == 1) + { + state->lasttg = 0; + state->lastsrc = 0; + state->payload_algid = 0; + state->payload_keyid = 0; + state->payload_miP = 0; + //reset some strings + sprintf (state->call_string[0], "%s", " "); //21 spaces + sprintf (state->call_string[1], "%s", " "); //21 spaces + sprintf (state->active_channel[0], "%s", ""); + sprintf (state->active_channel[1], "%s", ""); + opts->p25_is_tuned = 0; + state->p25_vc_freq[0] = state->p25_vc_freq[1] = 0; + if (opts->setmod_bw != 0 ) SetModulation(opts->rigctl_sockfd, opts->setmod_bw); + SetFreq(opts->rigctl_sockfd, state->p25_cc_freq); + } + + //rtl + else if (opts->audio_in_type == 3) + { + #ifdef USE_RTLSDR + state->lasttg = 0; + state->lastsrc = 0; + state->payload_algid = 0; + state->payload_keyid = 0; + state->payload_miP = 0; + //reset some strings + sprintf (state->call_string[0], "%s", " "); //21 spaces + sprintf (state->call_string[1], "%s", " "); //21 spaces + sprintf (state->active_channel[0], "%s", ""); + sprintf (state->active_channel[1], "%s", ""); + opts->p25_is_tuned = 0; + state->p25_vc_freq[0] = state->p25_vc_freq[1] = 0; + rtl_dev_tune (opts, state->p25_cc_freq); + #endif + } + + } +} + \ No newline at end of file