Skip to content

patch for direwolf.c adding audio channel choice to option menu -x #200

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 17 additions & 5 deletions direwolf.c
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ int main (int argc, char *argv[])
char input_file[80];
char T_opt_timestamp[40];

int chan = 0; /* default audio chanel */
int t_opt = 1; /* Text color option. */
int a_opt = 0; /* "-a n" interval, in seconds, for audio statistics report. 0 for none. */

Expand Down Expand Up @@ -352,7 +353,7 @@ int main (int argc, char *argv[])

/* ':' following option character means arg is required. */

c = getopt_long(argc, argv, "P:B:D:c:pxr:b:n:d:q:t:Ul:L:Sa:E:T:",
c = getopt_long(argc, argv, "P:B:D:c:pr:b:n:d:q:t:x:Ul:L:Sa:E:T:",
long_options, &option_index);
if (c == -1)
break;
Expand Down Expand Up @@ -422,7 +423,14 @@ int main (int argc, char *argv[])

case 'x': /* -x for transmit calibration tones. */

xmit_calibrate_option = 1;
chan = atoi(optarg);
if ( chan > 1) {
text_color_set(DW_COLOR_ERROR);
dw_printf("-x option, audio chanel, is out of range.\n");
exit (EXIT_FAILURE);
}
else
xmit_calibrate_option = 1;
break;

case 'r': /* -r audio samples/sec. e.g. 44100 */
Expand Down Expand Up @@ -760,13 +768,17 @@ int main (int argc, char *argv[])
*/

if (xmit_calibrate_option) {
if (chan > audio_config.adev[0].num_channels - 1) {
text_color_set(DW_COLOR_ERROR);
dw_printf("-x option, audio chanel %d, is out of range.\n", chan);
exit (EXIT_FAILURE);
}

int max_duration = 60; /* seconds */
int n = audio_config.achan[0].baud * max_duration;
int chan = 0;

text_color_set(DW_COLOR_INFO);
dw_printf ("\nSending transmit calibration tones. Press control-C to terminate.\n");
dw_printf ("\nSending transmit calibration tones to channel %d. Press control-C to terminate.\n", chan);

ptt_set (OCTYPE_PTT, chan, 1);
while (n-- > 0) {
Expand Down Expand Up @@ -1280,7 +1292,7 @@ static void usage (char **argv)
#else
dw_printf (" -p Enable pseudo terminal for KISS protocol.\n");
#endif
dw_printf (" -x Send Xmit level calibration tones.\n");
dw_printf (" -x n Send Xmit level calibration tones. Channel 1 or 0\n");
dw_printf (" -U Print UTF-8 test string and exit.\n");
dw_printf (" -S Print symbol tables and exit.\n");
dw_printf (" -T fmt Time stamp format for sent and received frames.\n");
Expand Down