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
.SH OPTIONS
.TP
.B \-c, \-\-confidence threshold
set receive confidence threshold (0.0 to 1.0, default 0.6)
.TP
.B \-8, \-\-ascii
ASCII 8\-N\-1
.TP

View File

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