Skip to content

Commit 41c154b

Browse files
author
root
committed
This patch for direwolf.c adds the choice of audio channel 0 or 1 for
sending calibration signal (menu -x n)
1 parent a1e2d1c commit 41c154b

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

Diff for: direwolf.c

+17-5
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ int main (int argc, char *argv[])
197197
char input_file[80];
198198
char T_opt_timestamp[40];
199199

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

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

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

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

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

425-
xmit_calibrate_option = 1;
426+
chan = atoi(optarg);
427+
if ( chan > 1) {
428+
text_color_set(DW_COLOR_ERROR);
429+
dw_printf("-x option, audio chanel, is out of range.\n");
430+
exit (EXIT_FAILURE);
431+
}
432+
else
433+
xmit_calibrate_option = 1;
426434
break;
427435

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

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

764777
int max_duration = 60; /* seconds */
765778
int n = audio_config.achan[0].baud * max_duration;
766-
int chan = 0;
767779

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

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

0 commit comments

Comments
 (0)