2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-03 23:06:37 +00:00

fix endless loop

git-svn-id: https://svn.fhem.de/fhem/trunk@4815 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
martinp876 2014-02-05 19:04:50 +00:00
parent 870fc9c98d
commit 593e29e48b
2 changed files with 15 additions and 8 deletions

View File

@ -3582,11 +3582,17 @@ sub CUL_HM_valvePosUpdt(@) {#update valve position periodically to please valve
my $msgCnt = $hash->{helper}{vd}{msgCnt};
my ($idl,$lo,$hi,$nextTimer);
my $tn = gettimeofday();
$hash->{helper}{vd}{next} = ReadingsVal($name,".next",$tn)
if (!defined $hash->{helper}{vd}{next});
$hash->{helper}{vd}{nextF} = $hash->{helper}{vd}{next};
# int32_t result = (((_address << 8) | messageCounter) * 1103515245 + 12345) >> 16;
# 4e6d = 20077 12996205 = C64E6D
# return (result & 0xFF) + 480;
if ($tn > ($hash->{helper}{vd}{nextF} + 3000)){# mised 20 periods;
Log3 $name,3,"CUL_HM $name virtualTC timer off by:".int($tn - $hash->{helper}{vd}{nextF});
$hash->{helper}{vd}{nextF} = $tn;
}
do {
$msgCnt = ($msgCnt + 1)%255;
$idl = $hash->{helper}{vd}{idl}+$msgCnt;
@ -3595,6 +3601,7 @@ sub CUL_HM_valvePosUpdt(@) {#update valve position periodically to please valve
$nextTimer = (($lo+$hi)&0xff)/4 + 120;
$hash->{helper}{vd}{nextF} += $nextTimer;
} until ($hash->{helper}{vd}{nextF} > $tn);
$hash->{helper}{vd}{nextM} = $tn+$nextTimer;
$hash->{helper}{vd}{msgCnt} = $msgCnt;
if ($hash->{helper}{vd}{cmd}){
@ -5720,7 +5727,7 @@ sub CUL_HM_peerUsed($) {# are peers expected?
my $mId = CUL_HM_getMId($hash);
my $cNo = hex(substr($hash->{DEF}."01",6,2))."p"; #default to channel 01
0 if (!$mId || !$culHmModel->{$mId});
return 0 if (!$mId || !$culHmModel->{$mId});
foreach my $ls (split ",",$culHmModel->{$mId}{lst}){
my ($l,$c) = split":",$ls;
if ( ($l =~ m/^(p|3|4)$/ && !$c ) # 3,4,p without chanspec

View File

@ -115,9 +115,9 @@ sub HMinfo_autoUpdate($){#in:name, send status-request
my $name = shift;
(undef,$name)=split":",$name,2;
HMinfo_SetFn($defs{$name},$name,"update") if ($name);
HMinfo_archConfig($defs{$name},$name,"","")
if (AttrVal($name,"autoArchieve",undef) &&
scalar(@{$modules{CUL_HM}{helper}{confUpdt}}));
# HMinfo_archConfig($defs{$name},$name,"","")
# if (AttrVal($name,"autoArchieve",undef) &&
# scalar(@{$modules{CUL_HM}{helper}{confUpdt}}));
InternalTimer(gettimeofday()+$defs{$name}{helper}{autoUpdate},
"HMinfo_autoUpdate","sUpdt:".$name,0)
if (defined $defs{$name}{helper}{autoUpdate});
@ -914,7 +914,7 @@ sub HMinfo_SetFn($@) {#########################################################
,"configCheck","param","peerCheck","peerXref"
,"protoEvents","msgStat:view,clear","rssi"
,"models"
,"regCheck","register","saveConfig","loadConfig","purgeConfig","update"
,"regCheck","register","archConfig:-0,-a","saveConfig","loadConfig","purgeConfig","update"
,"cpRegs"
,"tempList"
,"templateChk","templateDef","templateList","templateSet");
@ -1045,8 +1045,8 @@ sub HMinfo_archConfig($$$$) {###################################################
# save config only if register are complete
my ($hash,$name,$opt,$fn) = @_;
my @eN;
if ($opt eq "a"){@eN = HMinfo_getEntities("d","");}
else {@eN = @{$modules{CUL_HM}{helper}{confUpdt}}}
if ($opt eq "-a"){@eN = HMinfo_getEntities("d","");}
else {@eN = @{$modules{CUL_HM}{helper}{confUpdt}}}
my @names;
push @names,CUL_HM_getAssChnNames($_) foreach(@eN);
@{$modules{CUL_HM}{helper}{confUpdt}} = ();