add cmdline options to set the intercharacter delays.
This commit is contained in:
parent
fb8c08ca7c
commit
0445a4f78f
1 changed files with 8 additions and 2 deletions
|
@ -14,6 +14,8 @@ my $baud = '115200';
|
||||||
my $verbose;
|
my $verbose;
|
||||||
my $rts = 'rts';
|
my $rts = 'rts';
|
||||||
my $command = '';
|
my $command = '';
|
||||||
|
my $first_delay = 50;
|
||||||
|
my $second_delay = 100;
|
||||||
my $do_exit;
|
my $do_exit;
|
||||||
my $zerolen;
|
my $zerolen;
|
||||||
|
|
||||||
|
@ -25,6 +27,8 @@ GetOptions ('file=s' => \$filename,
|
||||||
'baud=s' => \$baud,
|
'baud=s' => \$baud,
|
||||||
'rts=s' => \$rts,
|
'rts=s' => \$rts,
|
||||||
'command=s' => \$command,
|
'command=s' => \$command,
|
||||||
|
'a=s' => \$first_delay,
|
||||||
|
'b=s' => \$second_delay,
|
||||||
'exit' => \$do_exit,
|
'exit' => \$do_exit,
|
||||||
) or die 'bad options';
|
) or die 'bad options';
|
||||||
|
|
||||||
|
@ -43,6 +47,8 @@ if($filename eq '') {
|
||||||
print " -c command to run for autoreset: \n";
|
print " -c command to run for autoreset: \n";
|
||||||
print " e.g. -c 'bbmc -l redbee-econotag -i 0 reset'\n";
|
print " e.g. -c 'bbmc -l redbee-econotag -i 0 reset'\n";
|
||||||
print " -e exit instead of dropping to terminal display\n";
|
print " -e exit instead of dropping to terminal display\n";
|
||||||
|
print " -a first intercharacter delay, passed to usleep\n";
|
||||||
|
print " -b second intercharacter delay, passed to usleep\n";
|
||||||
print "\n";
|
print "\n";
|
||||||
print "anything on the command line is sent\n";
|
print "anything on the command line is sent\n";
|
||||||
print "after all of the files.\n\n";
|
print "after all of the files.\n\n";
|
||||||
|
@ -121,8 +127,8 @@ while(1) {
|
||||||
my $i = 1;
|
my $i = 1;
|
||||||
while(read(FILE, $c, 1)) {
|
while(read(FILE, $c, 1)) {
|
||||||
$i++;
|
$i++;
|
||||||
usleep(50); # this is as fast is it can go...
|
usleep($first_delay) if ( $s == 0 );
|
||||||
usleep(50) if ($s==1);
|
usleep($second_delay) if ( $s == 1 );
|
||||||
$ob->write($c);
|
$ob->write($c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue