2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-22 08:11:44 +00:00

HMLAN issue with TC timing

git-svn-id: https://svn.fhem.de/fhem/trunk@3065 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
martinp876 2013-04-12 20:59:40 +00:00
parent 2ed3f3fba1
commit 9dba8443c0
3 changed files with 33 additions and 32 deletions

View File

@ -186,7 +186,7 @@ sub HMLAN_Write($$$) {#########################################################
# my $IDHM = '+'.$dst.',01,00,F1EF'; #used by HMconfig - meanning?? # my $IDHM = '+'.$dst.',01,00,F1EF'; #used by HMconfig - meanning??
# my $IDadd = '+'.$dst; # guess: add ID? # my $IDadd = '+'.$dst; # guess: add ID?
# my $IDack = '+'.$dst.',02,00,'; # guess: ID acknowledge # my $IDack = '+'.$dst.',02,00,'; # guess: ID acknowledge
# my $IDack = '+'.$dst.',FF,00,'; # guess: ID acknowledge General # my $IDack = '+'.$dst.',FF,00,'; # guess: ID acknowledge
# my $IDsub = '-'.$dst; # guess: ID remove? # my $IDsub = '-'.$dst; # guess: ID remove?
# my $IDnew = '+'.$dst.',00,01,'; # newChannel- trailing 01 to be sent if talk to neu channel # my $IDnew = '+'.$dst.',00,01,'; # newChannel- trailing 01 to be sent if talk to neu channel
my $IDadd = '+'.$dst.',00,00,'; # guess: add ID? my $IDadd = '+'.$dst.',00,00,'; # guess: add ID?
@ -301,8 +301,8 @@ sub HMLAN_Parse($$) {##########################################################
# HMLAN sends ACK for flag 'A0' but not for 'A4'(config mode)- # 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 # we ack ourself an long as logic is uncertain - also possible is 'A6' for RHS
if (hex($flg)&0x2){ if (hex($flg)&0x2){#General 4 oder 2 ?
$hash->{helper}{$src}{nextSend} = gettimeofday() + 0.130; $hash->{helper}{nextSend}{$src} = gettimeofday() + 0.100;
} }
if (hex($flg)&0xA4 == 0xA4 && $hash->{owner} eq $dst){ if (hex($flg)&0xA4 == 0xA4 && $hash->{owner} eq $dst){
Log $ll5, "HMLAN_Parse: $name ACK config"; Log $ll5, "HMLAN_Parse: $name ACK config";
@ -369,12 +369,11 @@ sub HMLAN_SimpleWrite(@) {#####################################################
if ($len>51){ if ($len>51){
my $dst = substr($msg,46,6); my $dst = substr($msg,46,6);
if ($dst && $hash->{helper}{$dst}{nextSend}){ if ($hash->{helper}{nextSend}{$dst}){
my $DevDelay=0; my $DevDelay = $hash->{helper}{nextSend}{$dst} - gettimeofday();
$DevDelay = $hash->{helper}{$dst}{nextSend} - gettimeofday(); select(undef, undef, undef, (($DevDelay > 0.1)?0.1:$DevDelay))
$DevDelay = ($DevDelay > 0.01)?( $DevDelay -= int($DevDelay)):0; if ($DevDelay > 0.01);
delete $hash->{helper}{$dst}{nextSend}; delete $hash->{helper}{nextSend}{$dst};
select(undef, undef, undef, $DevDelay)if ($DevDelay>0.01);
} }
$msg =~ m/(.{9}).(..).(.{8}).(..).(.{8}).(..)(....)(.{6})(.{6})(.*)/; $msg =~ m/(.{9}).(..).(.{8}).(..).(.{8}).(..)(....)(.{6})(.{6})(.*)/;
Log $ll5, 'HMLAN_Send: '.$name.' S:'.$1 Log $ll5, 'HMLAN_Send: '.$name.' S:'.$1
@ -387,8 +386,6 @@ sub HMLAN_SimpleWrite(@) {#####################################################
.' ' .$8 .' ' .$8
.' ' .$9 .' ' .$9
.' ' .$10; .' ' .$10;
if ($len > 52){#channel informatiion included
my ($flg,$chn) = (substr($msg,36,2),substr($msg,52,2));
if ( $hash->{helper}{$dst}{flg}){ #send not ack by HMLAN if ( $hash->{helper}{$dst}{flg}){ #send not ack by HMLAN
if($hash->{helper}{$dst}{to} > gettimeofday()){#will not wait forever! if($hash->{helper}{$dst}{to} > gettimeofday()){#will not wait forever!
$hash->{helper}{$dst}{msg} = $msg; #postpone message $hash->{helper}{$dst}{msg} = $msg; #postpone message
@ -399,9 +396,11 @@ sub HMLAN_SimpleWrite(@) {#####################################################
Log $ll5,"HMLAN_Delay: $name timed out"; Log $ll5,"HMLAN_Delay: $name timed out";
} }
} }
my $flg = substr($msg,36,2);
$hash->{helper}{$dst}{flg} = (hex($flg)&0x20)?1:0; $hash->{helper}{$dst}{flg} = (hex($flg)&0x20)?1:0;
$hash->{helper}{$dst}{to} = gettimeofday() + 2;# flag timeout after 2 sec $hash->{helper}{$dst}{to} = gettimeofday() + 2;# flag timeout after 2 sec
if ($len > 52){#channel information included
my $chn = substr($msg,52,2);
if ($hash->{helper}{$dst}{chn} && $hash->{helper}{$dst}{chn} ne $chn){ if ($hash->{helper}{$dst}{chn} && $hash->{helper}{$dst}{chn} ne $chn){
my $updt = $hash->{helper}{$dst}{newChn}; my $updt = $hash->{helper}{$dst}{newChn};
Log $ll5, 'HMLAN_Send: '.$name.' S:'.$updt; Log $ll5, 'HMLAN_Send: '.$name.' S:'.$updt;

View File

@ -2783,6 +2783,7 @@ sub CUL_HM_eventP($$) {#handle protocol events
sub CUL_HM_protState($$){ sub CUL_HM_protState($$){
my ($hash,$state) = @_; my ($hash,$state) = @_;
$hash->{protState} = $state; $hash->{protState} = $state;
delete $hash->{helper}{burstEvtCnt} if ($state =~ m/^CMDs_done/);
readingsSingleUpdate($hash,"state",$state,1)if (!$hash->{helper}{role}{chn}); readingsSingleUpdate($hash,"state",$state,1)if (!$hash->{helper}{role}{chn});
DoTrigger($hash->{NAME}, undef) if ($state eq "CMDs_done"); DoTrigger($hash->{NAME}, undef) if ($state eq "CMDs_done");
} }

View File

@ -492,7 +492,7 @@ my %culHmRegGeneral = (
intKeyVisib=>1,pairCentral=>1, intKeyVisib=>1,pairCentral=>1,
); );
my %culHmRegType = ( my %culHmRegType = (
remote =>{expectAES =>1,peerNeedsBurst =>1,dblPress =>1,longPress =>1, remote =>{peerNeedsBurst =>1,expectAES =>1,dblPress =>1,longPress =>1,
sign =>1, sign =>1,
}, },
blindActuator =>{driveUp =>1,driveDown =>1,driveTurn =>1,refRunCounter =>1, blindActuator =>{driveUp =>1,driveDown =>1,driveTurn =>1,refRunCounter =>1,
@ -544,6 +544,7 @@ my %culHmRegType = (
}, },
motionDetector =>{evtFltrPeriod =>1,evtFltrNum =>1,minInterval =>1, motionDetector =>{evtFltrPeriod =>1,evtFltrNum =>1,minInterval =>1,
captInInterval =>1,brightFilter =>1,ledOnTime =>1, captInInterval =>1,brightFilter =>1,ledOnTime =>1,
peerNeedsBurst =>1,
}, },
threeStateSensor =>{cyclicInfoMsg =>1, transmDevTryMax =>1, threeStateSensor =>{cyclicInfoMsg =>1, transmDevTryMax =>1,
,transmitTryMax =>1, ,transmitTryMax =>1,