minimodem: --confidence param

This commit is contained in:
Kamal Mostafa 2011-07-08 13:16:06 -07:00
parent 7a5aea88df
commit 633153916b
2 changed files with 11 additions and 3 deletions

View File

@ -45,6 +45,9 @@ transmit mode: generate audio tones
receive mode: decode audio tones receive mode: decode audio tones
.SH OPTIONS .SH OPTIONS
.TP .TP
.B \-c, \-\-confidence threshold
set receive confidence threshold (0.0 to 1.0, default 0.6)
.TP
.B \-8, \-\-ascii .B \-8, \-\-ascii
ASCII 8\-N\-1 ASCII 8\-N\-1
.TP .TP

View File

@ -220,6 +220,8 @@ main( int argc, char*argv[] )
char *filename = NULL; char *filename = NULL;
char *program_name; char *program_name;
float bfsk_confidence_threshold = 0.6;
program_name = strrchr(argv[0], '/'); program_name = strrchr(argv[0], '/');
if ( program_name ) if ( program_name )
program_name++; program_name++;
@ -238,6 +240,7 @@ main( int argc, char*argv[] )
{ "rx", 0, 0, 'r' }, { "rx", 0, 0, 'r' },
{ "receive", 0, 0, 'r' }, { "receive", 0, 0, 'r' },
{ "read", 0, 0, 'r' }, { "read", 0, 0, 'r' },
{ "confidence", 1, 0, 'c' },
{ "ascii", 0, 0, '8' }, { "ascii", 0, 0, '8' },
{ "baudot", 0, 0, '5' }, { "baudot", 0, 0, '5' },
{ "file", 1, 0, 'f' }, { "file", 1, 0, 'f' },
@ -247,7 +250,7 @@ main( int argc, char*argv[] )
{ "txstopbits", 1, 0, 'T' }, { "txstopbits", 1, 0, 'T' },
{ 0 } { 0 }
}; };
c = getopt_long(argc, argv, "Vtr85f:b:M:S:T:", c = getopt_long(argc, argv, "Vtrc:85f:b:M:S:T:",
long_options, &option_index); long_options, &option_index);
if ( c == -1 ) if ( c == -1 )
break; break;
@ -265,6 +268,9 @@ main( int argc, char*argv[] )
usage(); usage();
TX_mode = 0; TX_mode = 0;
break; break;
case 'c':
bfsk_confidence_threshold = atof(optarg);
break;
case 'f': case 'f':
filename = optarg; filename = optarg;
break; break;
@ -615,12 +621,11 @@ main( int argc, char*argv[] )
else else
bits = ( bits >> 2 ) & 0xFF; bits = ( bits >> 2 ) & 0xFF;
#define FSK_MIN_CONFIDENCE 0.60
#define FSK_MAX_NOCONFIDENCE_BITS 20 #define FSK_MAX_NOCONFIDENCE_BITS 20
#define FSK_SCAN_LAG 0.2 #define FSK_SCAN_LAG 0.2
if ( confidence <= FSK_MIN_CONFIDENCE ) { if ( confidence <= bfsk_confidence_threshold ) {
// FIXME: explain // FIXME: explain
if ( ++noconfidence > FSK_MAX_NOCONFIDENCE_BITS ) if ( ++noconfidence > FSK_MAX_NOCONFIDENCE_BITS )
{ {