dPMR Smooth Sync and Playback

dPMR Smooth Sync and Playback
--fix sync and playback issues with dPMR
General Code Cleanup
This commit is contained in:
lwvmobile
2022-04-08 16:22:08 -04:00
committed by GitHub
parent 2339cee016
commit 12dbd90509
10 changed files with 244 additions and 1080 deletions

View File

@@ -163,13 +163,13 @@ initOpts (dsd_opts * opts)
opts->serial_baud = 115200;
sprintf (opts->serial_dev, "/dev/ttyUSB0");
opts->resume = 0;
opts->frame_dstar = 1; //was disabled for some reason, make sure there are no false positives
opts->frame_dstar = 1;
opts->frame_x2tdma = 1;
opts->frame_p25p1 = 1;
opts->frame_nxdn48 = 0;
opts->frame_nxdn96 = 0;
opts->frame_dmr = 1;
opts->frame_dpmr = 0; //borrow from LEH
opts->frame_dpmr = 0;
opts->frame_provoice = 0;
opts->mod_c4fm = 1;
opts->mod_qpsk = 1;
@@ -658,12 +658,10 @@ main (int argc, char **argv)
for (short int i = 0; i < 7; i++) {
fprintf (stderr,"%s%s \n", FM_banner[i], KCYN);
fprintf (stderr,"%s%s \n", FM_banner[i], KCYN); //cyan/blue text
}
fprintf (stderr,"%s", KNRM); //change back to normal
fprintf (stderr, "%s \n", FM_banner[7]);
//pretty_colors();
//fprintf (stderr,"Digital Speech Decoder 1.7.0-dev (build:%s)\n", GIT_TAG);
fprintf (stderr,"Digital Speech Decoder: Florida Man Edition\n");
fprintf (stderr, "Github Build Version: %s \n", GIT_TAG);
fprintf (stderr,"mbelib version %s\n", versionstr);
@@ -835,8 +833,6 @@ main (int argc, char **argv)
}
break;
case 'n':
//opts.audio_out = 0;
//fprintf (stderr,"Disabling audio output to soundcard.\n");
opts.reset_state = 1;
fprintf (stderr,"Enabling Automatic Reset of P25 states\n");
fprintf (stderr," -Helps with multiple signal type decoding\n");
@@ -865,16 +861,11 @@ main (int argc, char **argv)
opts.frame_dstar = 1;
opts.frame_x2tdma = 1;
opts.frame_p25p1 = 1;
opts.frame_nxdn48 = 0; //turn it on, doesn't work due to symbol rate difference
opts.frame_nxdn48 = 0;
opts.frame_nxdn96 = 0; //causes false positives, leave on 0
opts.frame_dmr = 1;
opts.frame_dpmr = 0; //borrow from LEH
opts.frame_provoice = 0; //turn it on, doesn't work due to symbol rate difference
//adding stereo for DMR so we don't accidentally segfault
//opts.pulse_raw_rate_out = 24000; //doing tests with 2 channels at 24000 for 48000 audio default in pulse
//opts.pulse_digi_rate_out = 24000; //need to copy this to rtl type in and change rate out to 8000
//opts.pulse_raw_out_channels = 2;
//opts.pulse_digi_out_channels = 2; //2
opts.frame_dpmr = 0;
opts.frame_provoice = 0;
sprintf (opts.output_name, "Default Channel");
}
else if (optarg[0] == 'd')
@@ -885,7 +876,7 @@ main (int argc, char **argv)
opts.frame_nxdn48 = 0;
opts.frame_nxdn96 = 0;
opts.frame_dmr = 0;
opts.frame_dpmr = 0; //borrow from LEH
opts.frame_dpmr = 0;
opts.frame_provoice = 0;
sprintf (opts.output_name, "D-STAR");
fprintf (stderr,"Decoding only D-STAR frames.\n");
@@ -920,8 +911,8 @@ main (int argc, char **argv)
opts.mod_gfsk = 1;
state.rf_mod = 2;
sprintf (opts.output_name, "ProVoice");
fprintf (stderr,"Setting symbol rate to 9600 / second\n");
fprintf (stderr,"Enabling only GFSK modulation optimizations.\n");
//fprintf (stderr,"Setting symbol rate to 9600 / second\n");
//fprintf (stderr,"Enabling only GFSK modulation optimizations.\n");
fprintf (stderr,"Decoding only ProVoice frames.\n");
}
else if (optarg[0] == '1')
@@ -932,10 +923,10 @@ main (int argc, char **argv)
opts.frame_nxdn48 = 0;
opts.frame_nxdn96 = 0;
opts.frame_dmr = 0;
opts.frame_dpmr = 0; //borrow from LEH
opts.frame_dpmr = 0;
opts.frame_provoice = 0;
opts.mod_gfsk = 0;
opts.mod_c4fm = 1; //Phase 1 only uses C4FM, right?
opts.mod_c4fm = 1;
opts.mod_qpsk = 0;
state.rf_mod = 0; //
sprintf (opts.output_name, "P25P1");
@@ -949,19 +940,18 @@ main (int argc, char **argv)
opts.frame_nxdn48 = 1;
opts.frame_nxdn96 = 0;
opts.frame_dmr = 0;
opts.frame_dpmr = 0; //borrow from LEH
opts.frame_dpmr = 0;
opts.frame_provoice = 0;
//I think I've got it to decode on proper modulation now c4fm, not really sure what the difference is in DSD, seems to work either way for some reason
state.samplesPerSymbol = 20;
state.symbolCenter = 10;
opts.mod_c4fm = 1; // was 0
opts.mod_c4fm = 1;
opts.mod_qpsk = 0;
opts.mod_gfsk = 0; //was 1 with others on zero
state.rf_mod = 0; //was 2
opts.mod_gfsk = 0;
state.rf_mod = 0;
sprintf (opts.output_name, "NXDN48");
//opts.symboltiming = 2400; //NXDN48 uses 2400 symbol rate
fprintf (stderr,"Setting symbol rate to 2400 / second\n");
fprintf (stderr,"Enabling only C4FM modulation optimizations.\n");
//fprintf (stderr,"Enabling only C4FM modulation optimizations.\n");
fprintf (stderr,"Decoding only NXDN 4800 baud frames.\n");
}
else if (optarg[0] == 'n')
@@ -972,14 +962,14 @@ main (int argc, char **argv)
opts.frame_nxdn48 = 0;
opts.frame_nxdn96 = 1;
opts.frame_dmr = 0;
opts.frame_dpmr = 0; //borrow from LEH
opts.frame_dpmr = 0;
opts.frame_provoice = 0;
opts.mod_c4fm = 1; //was 0
opts.mod_c4fm = 1;
opts.mod_qpsk = 0;
opts.mod_gfsk = 0; //was 1
state.rf_mod = 0; //was 2
opts.mod_gfsk = 0;
state.rf_mod = 0;
sprintf (opts.output_name, "NXDN96");
fprintf (stderr,"Enabling only C4FM modulation optimizations.\n");
//fprintf (stderr,"Enabling only C4FM modulation optimizations.\n");
fprintf (stderr,"Decoding only NXDN 9600 baud frames.\n");
}
else if (optarg[0] == 'r')
@@ -990,9 +980,9 @@ main (int argc, char **argv)
opts.frame_nxdn48 = 0;
opts.frame_nxdn96 = 0;
opts.frame_dmr = 1;
opts.frame_dpmr = 0; //borrow from LEH
opts.frame_dpmr = 0;
opts.frame_provoice = 0;
opts.mod_c4fm = 1; //just a test
opts.mod_c4fm = 1;
opts.mod_qpsk = 0;
opts.mod_gfsk = 0; //
state.rf_mod = 0; //
@@ -1002,6 +992,7 @@ main (int argc, char **argv)
//opts.pulse_digi_out_channels = 2; //2
sprintf (opts.output_name, "DMR/MOTOTRBO");
//sprintf (opts.output_name, "DMR/MOTOTRBO Left");
fprintf(stderr, "Notice: DMR cannot autodetect polarity. \n Use -xr option if Inverted Signal expected.\n");
fprintf (stderr,"Decoding only DMR/MOTOTRBO frames.\n");
}
else if (optarg[0] == 'm')
@@ -1019,50 +1010,45 @@ main (int argc, char **argv)
opts.mod_c4fm = 1;
opts.mod_qpsk = 0;
opts.mod_gfsk = 0;
state.rf_mod = 0; //garbage value to keep jitter in check?
state.rf_mod = 0;
sprintf (opts.output_name, "dPMR");
//opts.pulse_digi_rate_in = 48000;
//opts.pulse_digi_rate_out = 48000; //need to copy this to rtl type in and change rate out to 8000
//opts.pulse_digi_in_channels = 1;
//opts.pulse_digi_out_channels = 1;
//opts.inverted_dpmr = 1;
fprintf(stderr, "Setting symbol rate to 2400 / second\n");
//fprintf(stderr, "Enabling only GFSK modulation optimizations.\n");
fprintf(stderr, "Enabling only C4FM modulation optimizations.\n");
fprintf(stderr, "Decoding only dPMR (4800 baud frames).\n");
fprintf(stderr, "Notice: dPMR cannot autodetect polarity. \n Use -xd option if Inverted Signal expected.\n");
//fprintf(stderr, "Enabling only C4FM modulation optimizations.\n");
fprintf(stderr, "Decoding only dPMR frames.\n");
}
break;
//don't mess with the modulations, doesn't really do anything anyways
case 'm':
if (optarg[0] == 'a')
{
opts.mod_c4fm = 1;
opts.mod_qpsk = 1;
opts.mod_gfsk = 1;
state.rf_mod = 0;
//opts.mod_c4fm = 1;
//opts.mod_qpsk = 1;
//opts.mod_gfsk = 1;
//state.rf_mod = 0;
}
else if (optarg[0] == 'c')
{
opts.mod_c4fm = 1;
opts.mod_qpsk = 0;
opts.mod_gfsk = 0;
state.rf_mod = 0;
fprintf (stderr,"Enabling only C4FM modulation optimizations.\n");
//opts.mod_c4fm = 1;
//opts.mod_qpsk = 0;
//opts.mod_gfsk = 0;
//state.rf_mod = 0;
//fprintf (stderr,"Enabling only C4FM modulation optimizations.\n");
}
else if (optarg[0] == 'g')
{
opts.mod_c4fm = 0;
opts.mod_qpsk = 0;
opts.mod_gfsk = 1;
state.rf_mod = 2;
fprintf (stderr,"Enabling only GFSK modulation optimizations.\n");
//opts.mod_c4fm = 0;
//opts.mod_qpsk = 0;
//opts.mod_gfsk = 1;
//state.rf_mod = 2;
//fprintf (stderr,"Enabling only GFSK modulation optimizations.\n");
}
else if (optarg[0] == 'q')
{
opts.mod_c4fm = 0;
opts.mod_qpsk = 1;
opts.mod_gfsk = 0;
state.rf_mod = 1;
fprintf (stderr,"Enabling only QPSK modulation optimizations.\n");
//opts.mod_c4fm = 0;
//opts.mod_qpsk = 1;
//opts.mod_gfsk = 0;
//state.rf_mod = 1;
//fprintf (stderr,"Enabling only QPSK modulation optimizations.\n");
}
break;
case 'u':