mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-05-01 20:20:10 +00:00
36_PrecipitationSensor: connect non blocking
git-svn-id: https://svn.fhem.de/fhem/trunk@18151 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
8d0e2192b4
commit
78ef8f3ff2
@ -268,15 +268,7 @@ sub PrecipitationSensor_Ready($) {
|
|||||||
my ($hash) = @_;
|
my ($hash) = @_;
|
||||||
my $name = $hash->{NAME};
|
my $name = $hash->{NAME};
|
||||||
|
|
||||||
PrecipitationSensor_Connect($hash, 1);
|
return PrecipitationSensor_Connect($hash, 1);
|
||||||
|
|
||||||
# This is relevant for windows/USB only
|
|
||||||
my $po = $hash->{USBDev};
|
|
||||||
my ($BlockingFlags, $InBytes, $OutBytes, $ErrorFlags);
|
|
||||||
if($po) {
|
|
||||||
($BlockingFlags, $InBytes, $OutBytes, $ErrorFlags) = $po->status;
|
|
||||||
}
|
|
||||||
return ($InBytes && $InBytes>0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#=======================================================================================
|
#=======================================================================================
|
||||||
@ -409,8 +401,12 @@ sub PrecipitationSensor_Connect($;$) {
|
|||||||
my $enabled = AttrVal($name, "disable", "0") != "1" && !defined($hash->{helper}{FLASHING});
|
my $enabled = AttrVal($name, "disable", "0") != "1" && !defined($hash->{helper}{FLASHING});
|
||||||
if($enabled) {
|
if($enabled) {
|
||||||
$hash->{nextOpenDelay} = 2;
|
$hash->{nextOpenDelay} = 2;
|
||||||
my $ret = DevIo_OpenDev($hash, $mode, "PrecipitationSensor_DoInit");
|
my $ret = DevIo_OpenDev($hash, $mode, "PrecipitationSensor_DoInit", sub($$){
|
||||||
|
my ($hash, $error) = @_;
|
||||||
|
####Log 3, $hash->{NAME} . " " . $error;
|
||||||
|
});
|
||||||
return $ret;
|
return $ret;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return undef;
|
return undef;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user