2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-23 20:52:13 +00:00

bugs in reglist0 and conditional burst

git-svn-id: https://svn.fhem.de/fhem/trunk@4059 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
martinp876 2013-10-17 13:45:06 +00:00
parent 397f9ee314
commit 4327674aea

View File

@ -2261,6 +2261,7 @@ sub CUL_HM_Set($@) {
CUL_HM_PushCmdStack($hash,"++".$flag."11".$id.$dst."0400"); CUL_HM_PushCmdStack($hash,"++".$flag."11".$id.$dst."0400");
} }
elsif($cmd eq "burstXmit") { ################################################ elsif($cmd eq "burstXmit") { ################################################
$hash->{helper}{prt}{wakeup}=1;# start wakeup
CUL_HM_SndCmd($hash,"++B112$id$dst"); CUL_HM_SndCmd($hash,"++B112$id$dst");
} }
elsif($cmd eq "pair") { ##################################################### elsif($cmd eq "pair") { #####################################################
@ -2283,6 +2284,8 @@ sub CUL_HM_Set($@) {
$state = ""; $state = "";
} }
elsif($cmd eq "getConfig") { ################################################ elsif($cmd eq "getConfig") { ################################################
CUL_HM_unQEntity($name,$modules{CUL_HM}{helper}{qReqConfWu});
CUL_HM_unQEntity($name,$modules{CUL_HM}{helper}{qReqConf});
CUL_HM_getConfig($hash); CUL_HM_getConfig($hash);
$state = ""; $state = "";
} }
@ -2459,7 +2462,7 @@ sub CUL_HM_Set($@) {
$lChn = "00" if($list == 7);#face to send $lChn = "00" if($list == 7);#face to send
my $cHash = CUL_HM_id2Hash($dst.($chn eq '00'?"":$chn)); my $cHash = CUL_HM_id2Hash($dst.($lChn eq '00'?"":$lChn));
$cHash = $hash if (!$cHash); $cHash = $hash if (!$cHash);
CUL_HM_pushConfig($cHash,$id,$dst,$lChn,$peerId,hex($peerChn),$list CUL_HM_pushConfig($cHash,$id,$dst,$lChn,$peerId,hex($peerChn),$list
,$addrData,$prep); ,$addrData,$prep);
@ -3116,7 +3119,7 @@ sub CUL_HM_Set($@) {
$devHash->{cmdStack} && $devHash->{cmdStack} &&
$devHash->{helper}{prt}{sProc} != 1 # not pocessing $devHash->{helper}{prt}{sProc} != 1 # not pocessing
){ ){
$hash->{helper}{prt}{awake}=1;# start wakeup $hash->{helper}{prt}{wakeup}=1;# start wakeup
CUL_HM_SndCmd($devHash,"++B112$id$dst"); CUL_HM_SndCmd($devHash,"++B112$id$dst");
} }
return ("",1);# no not generate trigger outof command return ("",1);# no not generate trigger outof command
@ -3292,7 +3295,6 @@ sub CUL_HM_pushConfig($$$$$$$$@) {#generate messages to config data to register
} }
$chnhash->{helper}{shadowReg}{$regLN} = $regs; # update shadow $chnhash->{helper}{shadowReg}{$regLN} = $regs; # update shadow
my @changeList; my @changeList;
if ($prep eq "exec"){#update complete registerset if ($prep eq "exec"){#update complete registerset
@changeList = keys%{$chnhash->{helper}{shadowReg}}; @changeList = keys%{$chnhash->{helper}{shadowReg}};
} }
@ -3593,9 +3595,15 @@ sub CUL_HM_respPendTout($) {
my $name = $hash->{NAME}; my $name = $hash->{NAME};
$pHash->{awake} = 0 if (defined $pHash->{awake});# set to asleep $pHash->{awake} = 0 if (defined $pHash->{awake});# set to asleep
return if(!$pHash->{rspWait}{reSent}); # Double timer? return if(!$pHash->{rspWait}{reSent}); # Double timer?
if ($pHash->{rspWait}{wakeup}){
if ($pHash->{rspWait}{reSent} > AttrVal($hash->{NAME},"msgRepeat",3) # too much CUL_HM_respPendRm($hash);# do not count problems with wakeup try, just wait
||((CUL_HM_getRxType($hash) & 0x83) == 0)){ #to slow $hash->{protCondBurst} = "off";
$pHash->{wakeup} = 0;# finished
$pHash->{awake} = 0;# set to asleep
CUL_HM_protState($hash,"CMDs_pending");
}
elsif ($pHash->{rspWait}{reSent} > AttrVal($hash->{NAME},"msgRepeat",3) # too much
||((CUL_HM_getRxType($hash) & 0x83) == 0)){ #to slow
if ($hash->{IODev}->{STATE} ne "opened"){ if ($hash->{IODev}->{STATE} ne "opened"){
CUL_HM_eventP($hash,"IOerr"); CUL_HM_eventP($hash,"IOerr");
readingsSingleUpdate($hash,"state","IOerr",1); readingsSingleUpdate($hash,"state","IOerr",1);
@ -3610,30 +3618,23 @@ sub CUL_HM_respPendTout($) {
CUL_HM_ProcessCmdStack($hash); # continue processing commands if any CUL_HM_ProcessCmdStack($hash); # continue processing commands if any
} }
else{ else{
if ($pHash->{rspWait}{wakeup}){ if ($hash->{protCondBurst}&&$hash->{protCondBurst} eq "on" ){
CUL_HM_respPendRm($hash);# do not count problems with wakeup try, just wait #timeout while conditional burst was active. try re-wakeup
$hash->{protCondBurst} = "off"; $pHash->{rspWait}{reSent}++;
$hash->{helper}{prt}{awake} = 0;# set to asleep
CUL_HM_protState($hash,"CMDs_pending");
}
else{
if ($hash->{protCondBurst}&&$hash->{protCondBurst} eq "on" ){
#timeout while conditional burst was active. try re-wakeup
$pHash->{rspWait}{reSent}++;
my (undef,$addr,$msg) = unpack 'A10A12A*',$hash->{helper}{prt}{rspWait}{cmd}; my (undef,$addr,$msg) = unpack 'A10A12A*',$hash->{helper}{prt}{rspWait}{cmd};
$pHash->{rspWaitSec}{$_} = $pHash->{rspWait}{$_} foreach (keys%{$pHash->{rspWait}}); ; $pHash->{rspWaitSec}{$_} = $pHash->{rspWait}{$_} foreach (keys%{$pHash->{rspWait}}); ;
CUL_HM_SndCmd($hash,"++B112$addr"); CUL_HM_SndCmd($hash,"++B112$addr");
$hash->{helper}{prt}{awake}=4;# start re-wakeup $hash->{helper}{prt}{awake}=4;# start re-wakeup
}
else{# normal device resend
CUL_HM_eventP($hash,"Resnd");
IOWrite($hash, "", $pHash->{rspWait}{cmd});
$pHash->{rspWait}{reSent}++;
Log GetLogLevel($name,4),"CUL_HM_Resend: ".$name. " nr ".$pHash->{rspWait}{reSent};
InternalTimer(gettimeofday()+rand(20)/10+4,"CUL_HM_respPendTout","respPend:$hash->{DEF}", 0);
}
} }
else{# normal device resend
CUL_HM_eventP($hash,"Resnd");
IOWrite($hash, "", $pHash->{rspWait}{cmd});
$pHash->{rspWait}{reSent}++;
Log GetLogLevel($name,4),"CUL_HM_Resend: ".$name. " nr ".$pHash->{rspWait}{reSent};
InternalTimer(gettimeofday()+rand(20)/10+4,"CUL_HM_respPendTout","respPend:$hash->{DEF}", 0);
}
# }
} }
} }
} }
@ -4719,6 +4720,18 @@ sub CUL_HM_qAutoRead($$){
RemoveInternalTimer("CUL_HM_procQs"); RemoveInternalTimer("CUL_HM_procQs");
InternalTimer(gettimeofday()+ .5,"CUL_HM_procQs","CUL_HM_procQs", 0); InternalTimer(gettimeofday()+ .5,"CUL_HM_procQs","CUL_HM_procQs", 0);
} }
sub CUL_HM_unQEntity($$){
my ($name,$q) = @_;
return if (AttrVal($name,"subType","") eq "virtual");
if ($defs{$name}{helper}{role}{dev}){
foreach (grep /channel_/,keys %{$defs{$name}}){# remove potential chn
my $ch = $defs{$name}{$_};
@{$q} = grep !/^$ch$/,@{$q};
delete $defs{$ch}{autoRead};
}
}
@{$q} = grep !/^$name$/,@{$q};
}
sub CUL_HM_qEntity($$){ sub CUL_HM_qEntity($$){
my ($name,$q) = @_; my ($name,$q) = @_;
return if (AttrVal($name,"subType","") eq "virtual"); return if (AttrVal($name,"subType","") eq "virtual");