diff --git a/include/dsd.h b/include/dsd.h index 3e70d55..58d271e 100644 --- a/include/dsd.h +++ b/include/dsd.h @@ -784,8 +784,8 @@ typedef struct unsigned long long int m17_dst; unsigned long long int m17_src; - uint8_t m17_can; //can value that was decoded from signal - uint8_t m17_can_en; //can value supplied to the encoding side + uint8_t m17_can; //can value that was decoded from signal + int m17_can_en; //can value supplied to the encoding side char m17_dst_csd[20]; char m17_src_csd[20]; @@ -802,6 +802,7 @@ typedef struct //misc str storage char str50a[50]; char str50b[50]; + char str50c[50]; char m17dat[50]; //user supplied m17 data input string char m17sms[800]; //user supplied sms text string diff --git a/src/dsd_main.c b/src/dsd_main.c index 6240eb7..cf59a40 100644 --- a/src/dsd_main.c +++ b/src/dsd_main.c @@ -502,8 +502,7 @@ noCarrier (dsd_opts * opts, dsd_state * state) state->m17_dst = 0; state->m17_src = 0; - state->m17_can = 0; //can value that was decoded from signal - state->m17_can_en = 0; //can value supplied to the encoding side + state->m17_can = 0; memset(state->m17_dst_csd, 0, sizeof(state->m17_dst_csd)); memset(state->m17_src_csd, 0, sizeof(state->m17_src_csd)); sprintf (state->m17_dst_str, "%s", ""); @@ -514,10 +513,11 @@ noCarrier (dsd_opts * opts, dsd_state * state) memset(state->m17_meta, 0, sizeof(state->m17_meta)); //misc str storage - memset (state->str50a, 0, 50*sizeof(char)); - memset (state->str50b, 0, 50*sizeof(char)); - memset (state->m17sms, 0, 800*sizeof(char)); - sprintf (state->m17dat, "%s", ""); + sprintf (state->str50a, "%s", ""); + // memset (state->str50b, 0, 50*sizeof(char)); + // memset (state->str50c, 0, 50*sizeof(char)); + // memset (state->m17sms, 0, 800*sizeof(char)); + // sprintf (state->m17dat, "%s", ""); //set float temp buffer to baseline memset (state->audio_out_temp_buf, 0.0f, sizeof(state->audio_out_temp_buf)); @@ -1179,9 +1179,17 @@ initState (dsd_state * state) state->m17_pbc_ct = 0; state->m17_str_dt = 9; + //misc str storage + sprintf (state->str50a, "%s", ""); + memset (state->str50b, 0, 50*sizeof(char)); + memset (state->str50c, 0, 50*sizeof(char)); + memset (state->m17sms, 0, 800*sizeof(char)); + sprintf (state->m17dat, "%s", ""); + state->m17_dst = 0; state->m17_src = 0; - state->m17_can = 0; + state->m17_can = 0; //can value that was decoded from signal + state->m17_can_en = -1; //can value supplied to the encoding side memset(state->m17_dst_csd, 0, sizeof(state->m17_dst_csd)); memset(state->m17_src_csd, 0, sizeof(state->m17_src_csd)); sprintf (state->m17_dst_str, "%s", ""); @@ -3006,8 +3014,8 @@ main (int argc, char **argv) curr = strtok(NULL, ":"); //m17 src address if (curr != NULL) { - strncpy (state.str50a, curr, 9); //only read first 9 - state.str50a[9] = '\0'; + strncpy (state.str50c, curr, 9); //only read first 9 + state.str50c[9] = '\0'; } curr = strtok(NULL, ":"); //m17 dst address @@ -3027,7 +3035,7 @@ main (int argc, char **argv) // fprintf (stderr, " %s;", state.m17dat); //debug print - fprintf (stderr, " M17:%d:%s:%s; \n ", state.m17_can_en, state.str50a, state.str50b); + fprintf (stderr, " M17:%d:%s:%s; \n ", state.m17_can_en, state.str50c, state.str50b); } if (opts.playfiles == 1) diff --git a/src/dsd_ncurses.c b/src/dsd_ncurses.c index f8539f0..436a720 100644 --- a/src/dsd_ncurses.c +++ b/src/dsd_ncurses.c @@ -1684,7 +1684,7 @@ void ncursesMenu (dsd_opts * opts, dsd_state * state) state->nxdn_last_rid = 0; state->nxdn_last_tg = 0; sprintf (state->str50a, "%s", ""); - sprintf (state->str50b, "%s", ""); + memset (state->str50b, 0, 50*sizeof(char)); } if (choice == 16) //toggle payload printing diff --git a/src/m17.c b/src/m17.c index ab5f89e..741df58 100644 --- a/src/m17.c +++ b/src/m17.c @@ -1299,11 +1299,11 @@ void encodeM17STR(dsd_opts * opts, dsd_state * state) //end User Defined Variables //configure User Defined Variables, if defined at CLI - if (state->m17_can_en != 0) //is 0 a valid number? + if (state->m17_can_en != -1) //has a set value can = state->m17_can_en; - if (state->str50a[0] != 0) - sprintf (s40, "%s", state->str50a); + if (state->str50c[0] != 0) + sprintf (s40, "%s", state->str50c); if (state->str50b[0] != 0) sprintf (d40, "%s", state->str50b); @@ -2288,11 +2288,11 @@ void encodeM17PKT(dsd_opts * opts, dsd_state * state) //end User Defined Variables //configure User Defined Variables, if defined at CLI - if (state->m17_can_en != 0) //is 0 a valid number? + if (state->m17_can_en != -1) //has a set value can = state->m17_can_en; - if (state->str50a[0] != 0) - sprintf (s40, "%s", state->str50a); + if (state->str50c[0] != 0) + sprintf (s40, "%s", state->str50c); if (state->str50b[0] != 0) sprintf (d40, "%s", state->str50b); @@ -2301,7 +2301,7 @@ void encodeM17PKT(dsd_opts * opts, dsd_state * state) sprintf (text, "%s", state->m17sms); // switch to this if issues crop up (cygwin, etc) - // strncpy (s40, state->str50a, 9); + // strncpy (s40, state->str50c, 9); // strncpy (d40, state->str50b, 9); // s40[10] = '\0'; // d40[10] = '\0';