EDACS Dotting Sequence FS Detection and CC Jump;

This commit is contained in:
lwvmobile
2023-09-04 17:26:11 -04:00
parent 57629cefe4
commit 2e098d52bc
3 changed files with 101 additions and 40 deletions

View File

@@ -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);

View File

@@ -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);
}
}

View File

@@ -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
}
}
}