2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-25 22:09:21 +00:00

improve postEvent for burst devices

git-svn-id: https://svn.fhem.de/fhem/trunk@4005 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
martinp876 2013-10-04 14:28:11 +00:00
parent bfa4fb2313
commit 19c85d47fd
2 changed files with 14 additions and 25 deletions

View File

@ -522,7 +522,8 @@ sub HMLAN_SimpleWrite(@) {#####################################################
return if ($HMcnd == 4 || $HMcnd == 253);# no send if overload or disconnect
}
my $dst = substr($msg,46,6);
my ($src,$dst) = (substr($msg,40,6),substr($msg,46,6));
my $hmId = $attr{$name}{hmId};
my $hDst = $hash->{helper}{$dst};# shortcut
if ($hDst->{nextSend}){
my $DevDelay = $hDst->{nextSend} - gettimeofday();
@ -530,21 +531,18 @@ sub HMLAN_SimpleWrite(@) {#####################################################
if ($DevDelay > 0.01);
delete $hDst->{nextSend};
}
if ($dst ne $attr{$name}{hmId}){ #delay send if answer is pending
if ($dst ne $hmId){ #delay send if answer is pending
if ( $hDst->{flg} && #HMLAN's ack pending
($hDst->{to} > gettimeofday())){#won't wait forever!
($hDst->{to} > gettimeofday())){#won't wait forever! check timeout
$hDst->{msg} = $msg; #postpone message
Log $ll5,"HMLAN_Delay: $name $dst";
return;
}
my $flg = substr($msg,36,2);
$hDst->{flg} = (hex($flg)&0x20)?1:0;# answer expected?
$hDst->{to} = gettimeofday() + 2;# flag timeout after 2 sec
$hDst->{msg} = "";
if ($hDst->{flg} == 1 &&
substr($msg,40,6) eq $attr{$name}{hmId}){
HMLAN_qResp($hash,$dst,1);
if ($src eq $hmId){
$hDst->{flg} = (hex(substr($msg,36,2))&0x20)?1:0;# answer expected?
$hDst->{to} = gettimeofday() + 2;# flag timeout after 2 sec
$hDst->{msg} = "";
HMLAN_qResp($hash,$dst,1) if ($hDst->{flg} == 1);
}
}
if ($len > 52){#channel information included, send sone kind of clearance
@ -675,13 +673,6 @@ sub HMLAN_qResp($$$) {#response-waiting queue##################################
$hashQ->{HMcndN} == 253)
);
}
# Log 1,"General max:$hashQ->{hmLanQlen} cmd:$cmd"
# ."/".$hash->{XmitOpen}
# ." :".$hashQ->{answerPend}
# ."/".@{$hashQ->{apIDs}}
# .":".join("-",@{$hashQ->{apIDs}})
# .":$debug" ;
}
sub HMLAN_relOvrLd($) {########################################################
my(undef,$name) = split(':',$_[0]);

View File

@ -120,7 +120,7 @@ my $IOpoll = 0.2;# poll speed to scan IO device out of order
my $IOpolltout = 60; # poll timeout - stop poll and discard if to late
my $maxPendCmds = 10; #number of parallel requests
my $autoConfDly = 15; # delay autoConf readings
my $autoConfDly = 12; # delay autoConf readings
# need to take care that ACK is first
#+++++++++++++++++ startup, init, definition+++++++++++++++++++++++++++++++++++
@ -1625,9 +1625,6 @@ sub CUL_HM_parseCommon(@){#####################################################
$shash->{helper}{prt}{awake}=2;#awake
}
else{
if ($shash->{helper}{prt}{awake}==4){#re-wakeup
#General handle rspWaitSec
}
$shash->{protCondBurst} = "off";
$shash->{helper}{prt}{awake}=3;#reject
return "done";
@ -3039,9 +3036,9 @@ sub CUL_HM_Set($@) {
my $pHash = CUL_HM_id2Hash($peer);
my $peerFlag = $peer eq '00000000'?'A4':CUL_HM_getFlag($pHash);
$peerFlag =~ s/0/4/;# either 'A4' or 'B4'
CUL_HM_SndCmd($hash, "++B112$dst".substr($peer,0,6))
CUL_HM_SndCmd($pHash, "++B112$id".substr($peer,0,6))
if (CUL_HM_getRxType($pHash) & 0x80);
CUL_HM_SndCmd($hash, sprintf("++%s41%s%s%02X%02X%02X"
CUL_HM_SndCmd($pHash, sprintf("++%s41%s%s%02X%02X%02X"
,$peerFlag,$dst,$peer
,$chn
,$pressCnt
@ -3699,7 +3696,8 @@ sub CUL_HM_eventP($$) {#handle protocol events
if ( (CUL_HM_getRxType($hash) & 0x03) == 0 #to slow for wakeup and config
|| $evntType eq "IOerr"){ #IO problem
$nAttr->{protCmdDel} = 0 if(!$nAttr->{protCmdDel});
$nAttr->{protCmdDel} += scalar @{$hash->{cmdStack}} if ($hash->{cmdStack});
$nAttr->{protCmdDel} += scalar @{$hash->{cmdStack}} + 1
if ($hash->{cmdStack});
delete($hash->{cmdStack});
delete($nAttr->{protCmdPend});
CUL_HM_protState($hash,"CMDs_done".($hash->{helper}{burstEvtCnt}?