From 54b6fd67e7a93fa9393995eba37c050408327e66 Mon Sep 17 00:00:00 2001 From: lwvmobile Date: Tue, 1 Aug 2023 16:03:38 -0400 Subject: [PATCH] Change Defaults; Reorder Ncurses Menu; Fix X2; --- src/dsd_main.c | 23 +++++++++-------- src/dsd_mbe2.c | 43 +++++++++++++++++++++++++++++--- src/dsd_ncurses.c | 62 ++++++++++++++++++++++++++++++---------------- src/x2tdma_voice.c | 6 ++--- 4 files changed, 95 insertions(+), 39 deletions(-) diff --git a/src/dsd_main.c b/src/dsd_main.c index fe41b22..39d7129 100644 --- a/src/dsd_main.c +++ b/src/dsd_main.c @@ -582,8 +582,8 @@ initOpts (dsd_opts * opts) opts->serial_baud = 115200; sprintf (opts->serial_dev, "/dev/ttyUSB0"); opts->resume = 0; - opts->frame_dstar = 0; - opts->frame_x2tdma = 0; + opts->frame_dstar = 1; + opts->frame_x2tdma = 1; opts->frame_p25p1 = 1; opts->frame_p25p2 = 1; opts->frame_nxdn48 = 0; @@ -1236,7 +1236,7 @@ usage () printf ("\n"); printf ("Decoder options:\n"); printf (" -fa Auto Detection\n"); - printf (" -ft AUTO P25, YSF, and DMR BS/MS frame types (new default)\n"); + printf (" -ft TDMA Trunking P25p1 Control and Voice, P25p2 Trunked Channels, and DMR\n"); printf (" -fs DMR Stereo BS and MS Simplex\n"); printf (" -f1 Decode only P25 Phase 1\n"); printf (" -f2 Decode only P25 Phase 2 (6000 sps) **\n"); @@ -1912,7 +1912,7 @@ main (int argc, char **argv) case 'f': if (optarg[0] == 'a') // { - opts.frame_dstar = 0; + opts.frame_dstar = 1; opts.frame_x2tdma = 1; opts.frame_p25p1 = 1; opts.frame_p25p2 = 1; @@ -1933,7 +1933,7 @@ main (int argc, char **argv) opts.pulse_digi_rate_out = 8000; opts.pulse_digi_out_channels = 2; sprintf (opts.output_name, "AUTO"); - fprintf (stderr,"Decoding AUTO P25, YSF, and DMR\n"); + fprintf (stderr,"Decoding AUTO P25, YSF, DSTAR, X2-TDMA, and DMR\n"); } else if (optarg[0] == 'd') { @@ -1971,7 +1971,7 @@ main (int argc, char **argv) opts.frame_ysf = 0; opts.frame_m17 = 0; opts.pulse_digi_rate_out = 8000; - opts.pulse_digi_out_channels = 1; + opts.pulse_digi_out_channels = 2; opts.dmr_stereo = 0; opts.dmr_mono = 0; state.dmr_stereo = 0; @@ -2144,14 +2144,15 @@ main (int argc, char **argv) // opts.setmod_bw = 7000; opts.pulse_digi_rate_out = 8000; opts.pulse_digi_out_channels = 2; - sprintf (opts.output_name, "DMR Stereo"); + sprintf (opts.output_name, "DMR"); fprintf (stderr,"Decoding DMR Stereo BS/MS Simplex\n"); } + //change ft to only do P25 and DMR (TDMA trunking modes) else if (optarg[0] == 't') { opts.frame_dstar = 0; - opts.frame_x2tdma = 1; + opts.frame_x2tdma = 0; opts.frame_p25p1 = 1; opts.frame_p25p2 = 1; opts.inverted_p2 = 0; @@ -2160,7 +2161,7 @@ main (int argc, char **argv) opts.frame_dmr = 1; opts.frame_dpmr = 0; opts.frame_provoice = 0; - opts.frame_ysf = 1; + opts.frame_ysf = 0; opts.frame_m17 = 0; opts.mod_c4fm = 1; opts.mod_qpsk = 0; @@ -2173,8 +2174,8 @@ main (int argc, char **argv) // opts.setmod_bw = 12000; //safe default on both DMR and P25 opts.pulse_digi_rate_out = 8000; opts.pulse_digi_out_channels = 2; - sprintf (opts.output_name, "AUTO"); - fprintf (stderr,"Decoding AUTO P25, YSF, and DMR\n"); + sprintf (opts.output_name, "TDMA"); + fprintf (stderr,"Decoding P25 and DMR\n"); } else if (optarg[0] == 'n') { diff --git a/src/dsd_mbe2.c b/src/dsd_mbe2.c index da75c49..3cb72df 100644 --- a/src/dsd_mbe2.c +++ b/src/dsd_mbe2.c @@ -48,7 +48,7 @@ void soft_demod_ambe2_ehr(dsd_state * state, char ambe2_ehr[4][24], char ambe_d[ } -//AMBE DSTAR -- break down to smaller components later on (no real point to do it right now) +//AMBE One Shot (DSTAR) void soft_demod_ambe_dstar(dsd_opts * opts, dsd_state * state, char ambe_fr[4][24], char ambe_d[49]) { mbe_processAmbe3600x2400Framef (state->audio_out_temp_buf, &state->errs, &state->errs2, @@ -58,6 +58,16 @@ void soft_demod_ambe_dstar(dsd_opts * opts, dsd_state * state, char ambe_fr[4][2 else processAudio(opts, state); } +//AMBE+2 One Shot (X2-TDMA) +void soft_demod_ambe_x2(dsd_opts * opts, dsd_state * state, char ambe_fr[4][24], char ambe_d[49]) +{ + mbe_processAmbe3600x2450Framef (state->audio_out_temp_buf, &state->errs, &state->errs2, + state->err_str, ambe_fr, ambe_d, state->cur_mp, state->prev_mp, state->prev_mp_enhanced, opts->uvquality); + if (opts->floating_point == 1) + memcpy (state->f_l, state->audio_out_temp_buf, sizeof(state->f_l)); + else processAudio(opts, state); +} + void soft_mbe (dsd_opts * opts, dsd_state * state, char imbe_fr[8][23], char ambe_fr[4][24], char imbe7100_fr[7][24]) { int i; @@ -101,10 +111,37 @@ void soft_mbe (dsd_opts * opts, dsd_state * state, char imbe_fr[8][23], char amb if(opts->payload == 1) PrintAMBEData (opts, state, ambe_d); - if (opts->floating_point == 0) + if (opts->floating_point == 0 && opts->pulse_digi_out_channels == 1) playSynthesizedVoice(opts, state); - if (opts->floating_point == 1) + if (opts->floating_point == 1 && opts->pulse_digi_out_channels == 1) playSynthesizedVoiceFM(opts, state); + if (opts->floating_point == 0 && opts->pulse_digi_out_channels == 2) + playSynthesizedVoiceSS(opts, state); + if (opts->floating_point == 1 && opts->pulse_digi_out_channels == 2) + playSynthesizedVoiceFS(opts, state); + + if (opts->wav_out_f != NULL) + writeSynthesizedVoice (opts, state); + + if (opts->mbe_out_f != NULL) + saveAmbe2450Data (opts, state, ambe_d); + } + + //X2-TDMA AMBE + else if (state->synctype >= 2 && state->synctype <= 5) + { + soft_demod_ambe_x2(opts, state, ambe_fr, ambe_d); + if(opts->payload == 1) + PrintAMBEData (opts, state, ambe_d); + + if (opts->floating_point == 0 && opts->pulse_digi_out_channels == 1) + playSynthesizedVoice(opts, state); + if (opts->floating_point == 1 && opts->pulse_digi_out_channels == 1) + playSynthesizedVoiceFM(opts, state); + if (opts->floating_point == 0 && opts->pulse_digi_out_channels == 2) + playSynthesizedVoiceSS(opts, state); + if (opts->floating_point == 1 && opts->pulse_digi_out_channels == 2) + playSynthesizedVoiceFS(opts, state); if (opts->wav_out_f != NULL) writeSynthesizedVoice (opts, state); diff --git a/src/dsd_ncurses.c b/src/dsd_ncurses.c index 457f454..7daadcd 100644 --- a/src/dsd_ncurses.c +++ b/src/dsd_ncurses.c @@ -302,7 +302,7 @@ char *choicesc[] = { "Save Decoded Audio WAV (Legacy Mode)", "Save Signal to Symbol Capture Bin", "Toggle Muting Encrypted Traffic ", - "Save Per Call Decoded WAV (AUTO and NXDN)", + "Save Per Call Decoded WAV (AUTO/TDMA and NXDN)", "Setup and Start RTL Input ", "Retune RTL Dongle ", "Toggle C4FM/QPSK (P2 TDMA CC)", @@ -317,25 +317,25 @@ char *choicesc[] = { "Toggle Call Alert Beep ", "Resume Decoding" }; - +//make tweaks for TDMA and AUTO? char *choices[] = { "Resume Decoding", "Decode AUTO", - "Decode M17", + "Decode TDMA", "Decode DSTAR", - "Decode P25p1", + "Decode M17", "Decode EDACS/PV", - "Decode P25p2 ", + "Decode P25p2", "Decode dPMR", "Decode NXDN48", "Decode NXDN96", - "Decode DMR TDMA", - "Decode YSF FUSION", + "Decode DMR", + "Decode YSF", "Toggle Signal Inversion", "Key Entry", "Reset Call History", "Toggle Payloads to Console", - "Manually Set P2 Parameters", //16 + "Manually Set p2 Parameters", //16 "Input & Output Options", "LRRP Data to File", "Exit DSD-FME", @@ -519,8 +519,28 @@ void ncursesMenu (dsd_opts * opts, dsd_state * state) info_win = newwin(7, WIDTH+18, starty, startx+20); box (info_win, 0, 0); mvwprintw(info_win, 2, 2, " AUTO Decoding Class Supports the following:"); - mvwprintw(info_win, 3, 2, " P25p1, P25p2, YSF, and DMR BS/MS"); - mvwprintw(info_win, 4, 2, " C4FM, FSK4, QPSK only (no H8D-QPSK)"); + mvwprintw(info_win, 3, 2, " P25p1, YSF, DSTAR, X2-TDMA and DMR"); + mvwprintw(info_win, 4, 2, " C4FM or QPSK @ 4800bps (no H8D-QPSK)"); + wrefresh(info_win); + } + + if (highlight == 3) + { + info_win = newwin(7, WIDTH+18, starty, startx+20); + box (info_win, 0, 0); + mvwprintw(info_win, 2, 2, " TDMA Trunking Class Supports the following:"); + mvwprintw(info_win, 3, 2, " P25p1 Voice/Control, P25p2 Traffic, and DMR"); + mvwprintw(info_win, 4, 2, " C4FM or QPSK @ 4800 or 6000 (no H8D-QPSK)"); + wrefresh(info_win); + } + + if (highlight == 7) + { + info_win = newwin(7, WIDTH+18, starty, startx+20); + box (info_win, 0, 0); + mvwprintw(info_win, 2, 2, " P25p2 Control (MAC_SIGNAL) or Single Voice Freq."); + mvwprintw(info_win, 3, 2, " NOTE: Manually set WACN/SYSID/CC on Voice Only"); + mvwprintw(info_win, 4, 2, " C4FM or QPSK @ 6000 (no H8D-QPSK)"); wrefresh(info_win); } @@ -1195,7 +1215,7 @@ void ncursesMenu (dsd_opts * opts, dsd_state * state) break; } - if (choice == 99) + if (choice == 99) //UNUSED { //setup Auto parameters--default ones // resetState (state); //use sparingly, may cause memory leak @@ -1286,9 +1306,9 @@ void ncursesMenu (dsd_opts * opts, dsd_state * state) opts->unmute_encrypted_p25 = 0; break; } - if (choice == 5) + if (choice == 3) //was 5, changed to 3 and also made it the TDMA class { - //P25 P1 + //TDMA -- was P25p1 only // resetState (state); //use sparingly, may cause memory leak opts->use_heuristics = 1; if (opts->use_heuristics == 1) @@ -1297,22 +1317,21 @@ void ncursesMenu (dsd_opts * opts, dsd_state * state) initialize_p25_heuristics(&state->inv_p25_heuristics); } opts->frame_p25p1 = 1; - opts->frame_p25p2 = 0; + opts->frame_p25p2 = 1; + opts->frame_dmr = 1; state->samplesPerSymbol = 10; state->symbolCenter = 4; state->rf_mod = 0; - sprintf (opts->output_name, "P25p1"); + sprintf (opts->output_name, "TDMA"); opts->dmr_mono = 0; - opts->dmr_stereo = 0; //this value is the end user option + opts->dmr_stereo = 1; //this value is the end user option state->dmr_stereo = 0; //this values toggles on and off depending on voice or data handling opts->pulse_digi_rate_out = 8000; - opts->pulse_digi_out_channels = 1; + opts->pulse_digi_out_channels = 2; opts->frame_dstar = 0; opts->frame_x2tdma = 0; - //opts->frame_p25p1 = 0; opts->frame_nxdn48 = 0; opts->frame_nxdn96 = 0; - opts->frame_dmr = 0; opts->frame_dpmr = 0; opts->frame_provoice = 0; opts->frame_ysf = 0; @@ -1320,7 +1339,6 @@ void ncursesMenu (dsd_opts * opts, dsd_state * state) opts->mod_c4fm = 1; opts->mod_qpsk = 0; opts->mod_gfsk = 0; - // state->rf_mod = 0; opts->unmute_encrypted_p25 = 0; break; } @@ -1483,7 +1501,7 @@ void ncursesMenu (dsd_opts * opts, dsd_state * state) state->samplesPerSymbol = 10; state->symbolCenter = 4; // sprintf (opts->output_name, "X2-TDMA"); - sprintf (opts->output_name, "DMR Stereo"); + sprintf (opts->output_name, "DMR"); opts->dmr_mono = 0; opts->dmr_stereo = 1; //this value is the end user option state->dmr_stereo = 0; //this values toggles on and off depending on voice or data handling @@ -1532,7 +1550,7 @@ void ncursesMenu (dsd_opts * opts, dsd_state * state) opts->mod_gfsk = 0; state->rf_mod = 0; } - if (choice == 3) + if (choice == 5) //was 3 { //Decode M17 // resetState (state); //use sparingly, may cause memory leak diff --git a/src/x2tdma_voice.c b/src/x2tdma_voice.c index eaa0364..69fbc3d 100644 --- a/src/x2tdma_voice.c +++ b/src/x2tdma_voice.c @@ -511,8 +511,8 @@ processX2TDMAvoice (dsd_opts * opts, dsd_state * state) } else { - processMbeFrame (opts, state, NULL, ambe_fr, NULL); - processMbeFrame (opts, state, NULL, ambe_fr2, NULL); + soft_mbe (opts, state, NULL, ambe_fr, NULL); + soft_mbe (opts, state, NULL, ambe_fr2, NULL); } } @@ -533,7 +533,7 @@ processX2TDMAvoice (dsd_opts * opts, dsd_state * state) } if (mutecurrentslot == 0) { - processMbeFrame (opts, state, NULL, ambe_fr3, NULL); + soft_mbe (opts, state, NULL, ambe_fr3, NULL); } // CACH