mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-05-05 08:20:23 +00:00
Merge branch 'owx_ser_timeout'
git-svn-id: https://svn.fhem.de/fhem/trunk@6398 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
367072b9a0
commit
1e8ed25996
@ -219,10 +219,6 @@ sub response_ready() {
|
|||||||
main::Log3($serial->{name},5, "OWX_DS2480 read: After loop no. $serial->{num_reads} received: ".unpack("H*",$serial->{string_in}));
|
main::Log3($serial->{name},5, "OWX_DS2480 read: After loop no. $serial->{num_reads} received: ".unpack("H*",$serial->{string_in}));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if (($serial->{num_reads} > 1) and (tv_interval($serial->{starttime}) > $serial->{timeout})) {
|
|
||||||
main::Log3($serial->{name},5, "OWX_DS2480 read: After loop no. $serial->{num_reads} received: ".unpack("H*",$serial->{string_in}). " -> TIMEOUT");
|
|
||||||
die "OWX_DS2480 read timeout, bytes read: $serial->{retcount}, expected: $serial->{retlen}" ;
|
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -235,7 +231,6 @@ sub start_query() {
|
|||||||
$serial->{num_reads} = 0;
|
$serial->{num_reads} = 0;
|
||||||
$serial->{retlen} = 0;
|
$serial->{retlen} = 0;
|
||||||
$serial->{retcount} = 0;
|
$serial->{retcount} = 0;
|
||||||
$serial->{starttime} = [gettimeofday];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
########################################################################################
|
########################################################################################
|
||||||
|
@ -51,7 +51,6 @@ sub new() {
|
|||||||
alarmdevs => [],
|
alarmdevs => [],
|
||||||
devs => [],
|
devs => [],
|
||||||
fams => [],
|
fams => [],
|
||||||
timeout => 1.0, #default timeout 1 sec.
|
|
||||||
};
|
};
|
||||||
return bless $self,$class;
|
return bless $self,$class;
|
||||||
}
|
}
|
||||||
@ -236,10 +235,11 @@ sub initialize() {
|
|||||||
#-- write 1-Wire bus (Fig. 2 of Maxim AN192)
|
#-- write 1-Wire bus (Fig. 2 of Maxim AN192)
|
||||||
$ds2480->start_query();
|
$ds2480->start_query();
|
||||||
$ds2480->query("\x17\x45\x5B\x0F\x91",5);
|
$ds2480->query("\x17\x45\x5B\x0F\x91",5);
|
||||||
eval { #ignore timeout
|
my $until = gettimeofday + main::AttrVal($hash->{NAME},"timeout",1);
|
||||||
|
eval {
|
||||||
do {
|
do {
|
||||||
$ds2480->read();
|
$ds2480->poll();
|
||||||
} while (!$ds2480->response_ready());
|
} until ($ds2480->response_ready() or gettimeofday >= $until);
|
||||||
};
|
};
|
||||||
$res = $ds2480->{string_in};
|
$res = $ds2480->{string_in};
|
||||||
#-- process 4/5-byte string for detection
|
#-- process 4/5-byte string for detection
|
||||||
|
Loading…
x
Reference in New Issue
Block a user