From 136ed753422db503d3dfb1d24bdc49639de23716 Mon Sep 17 00:00:00 2001 From: lwvmobile Date: Sun, 20 Nov 2022 07:31:02 -0500 Subject: [PATCH] NCurses Display Group Labels in P25 and DMR; Tweak --- .gitignore | 2 ++ src/dsd_main.c | 4 ++-- src/dsd_ncurses.c | 46 ++++++++++++++++++++++++++++++++++++++++++++-- src/p25p2_frame.c | 12 ++++++------ src/p25p2_xcch.c | 12 ++++++------ 5 files changed, 60 insertions(+), 16 deletions(-) diff --git a/.gitignore b/.gitignore index e83ed1c..2a09268 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,5 @@ *.so* *.dylib build +*.sh +*.csv \ No newline at end of file diff --git a/src/dsd_main.c b/src/dsd_main.c index f1bb740..d6df834 100644 --- a/src/dsd_main.c +++ b/src/dsd_main.c @@ -77,7 +77,7 @@ void noCarrier (dsd_opts * opts, dsd_state * state) { - //tune back to last knwon CC when using trunking after x second hangtime + //tune back to last known CC when using trunking after x second hangtime if (opts->p25_trunk == 1 && opts->p25_is_tuned == 1 && time(NULL) - state->last_cc_sync_time > opts->trunk_hangtime) { if (state->p25_cc_freq != 0) @@ -147,7 +147,7 @@ noCarrier (dsd_opts * opts, dsd_state * state) } //zero out after x second hangtime when trunking to prevent premature zeroing on these variables - //mainly bugfix for ncurses and per call wavs (edacs) + //mainly bugfix for ncurses and per call wavs (edacs) and also signal fade, etc if (opts->p25_trunk == 1 && opts->p25_is_tuned == 1 && time(NULL) - state->last_cc_sync_time > opts->trunk_hangtime) { state->lasttg = 0; diff --git a/src/dsd_ncurses.c b/src/dsd_ncurses.c index b90254f..cd10197 100644 --- a/src/dsd_ncurses.c +++ b/src/dsd_ncurses.c @@ -2441,7 +2441,8 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state) attron(COLOR_PAIR(3)); } } - + + //Frequency Display if (state->p25_vc_freq[0] != 0) { attron(COLOR_PAIR(5)); @@ -2451,6 +2452,25 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state) attron(COLOR_PAIR(3)); } } + + //Group Name Labels from CSV import + if (state->dmrburstL == 16 || state->dmrburstL > 19) + { + for (int k = 0; k < state->group_tally; k++) + { + if (state->group_array[k].groupNumber == state->lasttg) + { + attron(COLOR_PAIR(5)); + printw (" [%s]", state->group_array[k].groupName); + printw ("[%s] ", state->group_array[k].groupMode); + if (state->carrier == 1) + { + attron(COLOR_PAIR(3)); + } + } + } + } + printw ("\n"); //Slot 2 [1] @@ -2587,6 +2607,7 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state) attron(COLOR_PAIR(3)); } } + //LRRP if(state->dmrburstR != 16) //only during data { @@ -2601,6 +2622,8 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state) attron(COLOR_PAIR(3)); } } + + //Frequency Display if (state->p25_vc_freq[0] != 0) { attron(COLOR_PAIR(5)); @@ -2610,6 +2633,25 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state) attron(COLOR_PAIR(3)); } } + + //Group Name Labels from CSV import + if (state->dmrburstR == 16 || state->dmrburstR > 19) + { + for (int k = 0; k < state->group_tally; k++) + { + if (state->group_array[k].groupNumber == state->lasttgR) + { + attron(COLOR_PAIR(5)); + printw (" [%s]", state->group_array[k].groupName); + printw ("[%s] ", state->group_array[k].groupMode); + } + if (state->carrier == 1) + { + attron(COLOR_PAIR(3)); + } + } + } + printw ("\n"); } // end if not MS } //end DMR BS Types @@ -2656,7 +2698,7 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state) //shim 443 afs in here for display purposes int a = (call_matrix[i][3] >> 7) & 0xF; int fs = call_matrix[i][3] & 0x7F; - printw ("| - LCN [%02d][%.06lf]", i, (double)state->trunk_lcn_freq[i-1]/1000000); + printw ("| - LCN [%02d][%.06lf] MHz", i, (double)state->trunk_lcn_freq[i-1]/1000000); //print Control Channel on LCN line with the current Control Channel if ( (i) == state->edacs_cc_lcn) diff --git a/src/p25p2_frame.c b/src/p25p2_frame.c index 4cd7658..c8d115d 100644 --- a/src/p25p2_frame.c +++ b/src/p25p2_frame.c @@ -193,8 +193,8 @@ void process_FACCHc (dsd_opts * opts, dsd_state * state) else { fprintf (stderr, " R-S ERR Fc"); - if (state->currentslot == 0) state->dmrburstL = 13; - else state->dmrburstR = 13; + //if (state->currentslot == 0) state->dmrburstL = 13; + //else state->dmrburstR = 13; } } @@ -247,8 +247,8 @@ void process_FACCHs (dsd_opts * opts, dsd_state * state) else { fprintf (stderr, " R-S ERR Fs"); - if (state->currentslot == 0) state->dmrburstL = 13; - else state->dmrburstR = 13; + //if (state->currentslot == 0) state->dmrburstL = 13; + //else state->dmrburstR = 13; } } @@ -752,8 +752,8 @@ void process_P2_DUID (dsd_opts * opts, dsd_state * state) else { fprintf (stderr, " DUID ERR %d", duid_decoded); - if (state->currentslot == 0) state->dmrburstL = 12; - else state->dmrburstR = 12; + //if (state->currentslot == 0) state->dmrburstL = 12; + //else state->dmrburstR = 12; err_counter++; } if (err_counter > 1) //&& opts->aggressive_framesync == 1 diff --git a/src/p25p2_xcch.c b/src/p25p2_xcch.c index 693262b..e85350f 100644 --- a/src/p25p2_xcch.c +++ b/src/p25p2_xcch.c @@ -57,8 +57,8 @@ void process_SACCH_MAC_PDU (dsd_opts * opts, dsd_state * state, int payload[180] else { fprintf (stderr, " CRC12 ERR S"); - if (state->currentslot == 0) state->dmrburstL = 14; - else state->dmrburstR = 14; + //if (state->currentslot == 0) state->dmrburstL = 14; + //else state->dmrburstR = 14; goto END_SMAC; } } @@ -84,8 +84,8 @@ void process_SACCH_MAC_PDU (dsd_opts * opts, dsd_state * state, int payload[180] { fprintf (stderr, " CRC16 ERR L"); state->p2_is_lcch = 0; //turn flag off here - if (state->currentslot == 0) state->dmrburstL = 14; - else state->dmrburstR = 14; + //if (state->currentslot == 0) state->dmrburstL = 14; + //else state->dmrburstR = 14; goto END_SMAC; } } @@ -303,8 +303,8 @@ void process_FACCH_MAC_PDU (dsd_opts * opts, dsd_state * state, int payload[156] else { fprintf (stderr, " CRC12 ERR F"); - if (state->currentslot == 0) state->dmrburstL = 14; - else state->dmrburstR = 14; + //if (state->currentslot == 0) state->dmrburstL = 14; + //else state->dmrburstR = 14; goto END_FMAC; } }