2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-02-01 01:09:47 +00:00

repair timeout for set comamnds

git-svn-id: https://svn.fhem.de/fhem/trunk@4257 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
martinp876 2013-11-21 18:17:30 +00:00
parent 10b51edbe3
commit 7db654a716
2 changed files with 40 additions and 29 deletions

View File

@ -530,6 +530,7 @@ sub HMLAN_Parse($$) {##########################################################
# parameter 'cond'- condition of the IO device
# Cond text
# 0 ok
# 1 comes with AES, also seen with wakeup long-sleep devices
# 2 Warning-HighLoad
# 4 Overload condition - no send anymore
#
@ -551,7 +552,6 @@ sub HMLAN_Parse($$) {##########################################################
:2)) #ACK=1 unit *2
if (($stat & 0x48) == 8);# reject - but not from repeater
$hash->{helper}{$dst}{flg} = 0;#got response => unblock sending
if ($stat & 0x0A){#08 and 02 dont need to go to CUL, internal ack only
Log3 $hash, HMLAN_getVerbLvl ($hash,$src,$dst,"5")
@ -601,7 +601,7 @@ sub HMLAN_Parse($$) {##########################################################
# HMLAN sends ACK for flag 'A0' but not for 'A4'(config mode)-
# we ack ourself an long as logic is uncertain - also possible is 'A6' for RHS
if (hex($flg)&0x2){#not sure: 4 oder 2 ? 02 works for VD!
if (hex($flg)&0x02){#not sure: 4 oder 2 ? 02 works for VD!
my $wait = 0.100 - $dly/1000;
$hash->{helper}{$src}{nextSend} = gettimeofday() + $wait if ($wait > 0);
}

View File

@ -1531,7 +1531,6 @@ sub CUL_HM_Parse($$) {##############################
CUL_HM_SndCmd($ack[$i++],$ack[$i++])while ($i<@ack);
Log3 $name,6,"CUL_HM $name sent ACK:".(int(@ack));
}
CUL_HM_ProcessCmdStack($shash) if ($respRemoved); # cont if complete
#------------ process events ------------------
push @event, "noReceiver:src:$src ".$mFlg.$mTp." $p" if(!@event && !@entities);
@ -3456,10 +3455,12 @@ sub CUL_HM_ProcessCmdStack($) {
}
elsif(!@{$hash->{cmdStack}}) {
#-- update info ---
CUL_HM_protState($hash,"CMDs_done".($hash->{helper}{prt}{bErr}?
("_Errors:".$hash->{helper}{prt}{bErr}):""));
CUL_HM_protState($hash,"CMDs_done");
}
}
elsif($hash->{helper}{prt}{sProc} != 0){
CUL_HM_protState($hash,"CMDs_done");
}
return;
}
@ -3486,6 +3487,7 @@ sub CUL_HM_respWaitSu($@){ #setup response for multi-message response
my $mHsh = $hash->{helper}{prt};
$modules{CUL_HM}{prot}{rspPend}++ if(!$mHsh->{rspWait}{cmd});
foreach (@a){
next if (!$_);
my ($f,$d)=split ":=",$_;
$mHsh->{rspWait}{$f}=$d;
}
@ -3548,11 +3550,12 @@ sub CUL_HM_responseSetup($$) {#store all we need to handle the response
}
elsif($mTp eq '11' && $chn =~ m/^(02|81)$/){#!!! chn is subtype!!!
# CUL_HM_qStateUpdatIfEnab($dst.$subType);# subtype actually is channel
my $to = "";
if ($p =~ m/02..(..)....(....)/){#lvl ne 0 and timer on
$hash->{helper}{tmdOn} = $2 if ($1 ne "00" && $2 !~ m/(0000|FFFF)/);
CUL_HM_respWaitSu ($hash,"cmd:=$cmd","mNo:=$mNo"
,"reSent:=1","timedOn:=1");
$to = "timedOn:=1";
}
CUL_HM_respWaitSu ($hash,"cmd:=$cmd","mNo:=$mNo","reSent:=1",$to);
}
elsif($mTp eq '12' && $mFlg & 0x10){#wakeup with burst
# response setup - do not repeat, set counter to 250
@ -3570,8 +3573,7 @@ sub CUL_HM_responseSetup($$) {#store all we need to handle the response
InternalTimer(gettimeofday()+.5, "CUL_HM_ProcessCmdStack", $hash, 0);
}
elsif(!$hash->{helper}{prt}{rspWait}{cmd}){
CUL_HM_protState($hash,"CMDs_done".($hash->{helper}{prt}{bErr}?
("_Errors:".$hash->{helper}{prt}{bErr}):""));
CUL_HM_protState($hash,"CMDs_done");
}
}
@ -3854,8 +3856,7 @@ sub CUL_HM_eventP($$) {#handle protocol events
$nAttr->{protCmdDel} = 0 if(!$nAttr->{protCmdDel});
$nAttr->{protCmdDel} += scalar @{$hash->{cmdStack}} + 1
if ($hash->{cmdStack});
CUL_HM_protState($hash,"CMDs_done".($hash->{helper}{prt}{bErr}?
("_Errors:".$hash->{helper}{prt}{bErr}):""));
CUL_HM_protState($hash,"CMDs_done");
CUL_HM_respPendRm($hash);
}
elsif($evntType eq "IOdly"){ # IO problem - will see whether it recovers
@ -3873,24 +3874,34 @@ sub CUL_HM_eventP($$) {#handle protocol events
}
sub CUL_HM_protState($$){
my ($hash,$state) = @_;
$hash->{protState} = $state;
my $name = $hash->{NAME};
readingsSingleUpdate($hash,"state",$state,0) if (!$hash->{helper}{role}{chn});
Log3 $name,6,"CUL_HM $name protEvent:$state".
($hash->{cmdStack}?" pending:".scalar @{$hash->{cmdStack}}:"");
if ($state =~ m/processing/) {$hash->{helper}{prt}{sProc} = 1;
if ($state =~ m/processing/) {
$hash->{helper}{prt}{sProc} = 1;
}
elsif($state =~ m/^CMDs_done/) {DoTrigger($name, undef);
elsif($state =~ m/^CMDs_done/) {
$state .= ($hash->{helper}{prt}{bErr}?
("_Errors:".$hash->{helper}{prt}{bErr})
:"");
delete($hash->{cmdStack});
delete($hash->{protCmdPend});
$hash->{helper}{prt}{bErr} = 0;
$hash->{helper}{prt}{sProc} = 0;
$hash->{helper}{prt}{awake} = 0 if (defined$hash->{helper}{prt}{awake}); # asleep
$hash->{helper}{prt}{awake} = 0 if (defined $hash->{helper}{prt}{awake});
}
elsif($state eq "Info_Cleared"){$hash->{helper}{prt}{sProc} = 0;
$hash->{helper}{prt}{awake} = 0 if (defined$hash->{helper}{prt}{awake}); # asleep
elsif($state eq "Info_Cleared"){
$hash->{helper}{prt}{sProc} = 0;
$hash->{helper}{prt}{awake} = 0 if (defined $hash->{helper}{prt}{awake});
}
elsif($state eq "CMDs_pending"){$hash->{helper}{prt}{sProc} = 2;
elsif($state eq "CMDs_pending"){
$hash->{helper}{prt}{sProc} = 2;
}
$hash->{protState} = $state;
if (!$hash->{helper}{role}{chn}){
readingsSingleUpdate($hash,"state",$state,0);
DoTrigger($name, undef);
}
Log3 $name,6,"CUL_HM $name protEvent:$state".
($hash->{cmdStack}?" pending:".scalar @{$hash->{cmdStack}}:"");
}
###################-----------helper and shortcuts--------#####################
@ -5075,7 +5086,7 @@ sub CUL_HM_autoReadReady($){# capacity for autoread available?
return 0 if ($defs{$mHlp->{autoRdActive}}{helper}{prt}{sProc} == 1); # predecessor still on
}
if ( !$ioName
|| ReadingsVal($ioName,"cond","") !~ m /^(ok|Overload-released|init)$/
|| ReadingsVal($ioName,"cond","init") !~ m /^(ok|Overload-released|init)$/#default init for CUL
|| ( $defs{$ioName}{helper}{q}
&& ($defs{$ioName}{helper}{q}{cap}{sum}/16.8)>
AttrVal($ioName,"hmMsgLowLimit",40))){