Better init checking.
"Serial.pm: undefined" bug fixed git-svn-id: https://svn.fhem.de/fhem/trunk@276 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
@@ -276,8 +276,12 @@ CUL_DoInit($)
|
|||||||
}
|
}
|
||||||
delete($hash->{RA_Timeout});
|
delete($hash->{RA_Timeout});
|
||||||
|
|
||||||
|
my ($ver, $try) = ("", 0);
|
||||||
|
while($try++ < 3 && $ver !~ m/^V/) {
|
||||||
$hash->{PortObj}->write("V\n");
|
$hash->{PortObj}->write("V\n");
|
||||||
my $ver = CUL_ReadAnswer($hash, "Version");
|
$ver = CUL_ReadAnswer($hash, "Version");
|
||||||
|
}
|
||||||
|
|
||||||
if($ver !~ m/^V/) {
|
if($ver !~ m/^V/) {
|
||||||
$attr{$name}{dummy} = 1;
|
$attr{$name}{dummy} = 1;
|
||||||
$hash->{PortObj}->close();
|
$hash->{PortObj}->close();
|
||||||
@@ -285,6 +289,7 @@ CUL_DoInit($)
|
|||||||
Log 1, $msg;
|
Log 1, $msg;
|
||||||
return $msg;
|
return $msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
CUL_SimpleWrite($hash, $initstr);
|
CUL_SimpleWrite($hash, $initstr);
|
||||||
$hash->{STATE} = "Initialized";
|
$hash->{STATE} = "Initialized";
|
||||||
|
|
||||||
@@ -405,7 +410,6 @@ CUL_Write($$$)
|
|||||||
|
|
||||||
if($fn eq "F") {
|
if($fn eq "F") {
|
||||||
if(!$hash->{QUEUECNT}) {
|
if(!$hash->{QUEUECNT}) {
|
||||||
|
|
||||||
CUL_XmitLimitCheck($hash, $bstring);
|
CUL_XmitLimitCheck($hash, $bstring);
|
||||||
$hash->{PortObj}->write($bstring);
|
$hash->{PortObj}->write($bstring);
|
||||||
|
|
||||||
@@ -437,11 +441,13 @@ CUL_HandleWriteQueue($)
|
|||||||
if($hash->{QUEUECNT} > 0) {
|
if($hash->{QUEUECNT} > 0) {
|
||||||
$hash->{QUEUECNT}--;
|
$hash->{QUEUECNT}--;
|
||||||
my $bstring = shift(@{$hash->{QUEUE}});
|
my $bstring = shift(@{$hash->{QUEUE}});
|
||||||
|
if(defined($bstring)) {
|
||||||
CUL_XmitLimitCheck($hash,$bstring);
|
CUL_XmitLimitCheck($hash,$bstring);
|
||||||
$hash->{PortObj}->write($bstring);
|
$hash->{PortObj}->write($bstring);
|
||||||
InternalTimer(gettimeofday()+0.25, "CUL_HandleWriteQueue", $hash, 1);
|
InternalTimer(gettimeofday()+0.25, "CUL_HandleWriteQueue", $hash, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#####################################
|
#####################################
|
||||||
sub
|
sub
|
||||||
|
|||||||
Reference in New Issue
Block a user