From 86d50422e2fd3509bc6b13f35666a21cbf95656c Mon Sep 17 00:00:00 2001 From: rudolfkoenig <> Date: Thu, 10 Dec 2015 10:17:42 +0000 Subject: [PATCH] 00_CUL.pm: add ITClock patch, remove tabs (Forum #45449) git-svn-id: https://svn.fhem.de/fhem/trunk@10146 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/00_CUL.pm | 49 +++++++++++++++++++++++++++++---------------- 1 file changed, 32 insertions(+), 17 deletions(-) diff --git a/fhem/FHEM/00_CUL.pm b/fhem/FHEM/00_CUL.pm index e44e2c78e..392483d94 100755 --- a/fhem/FHEM/00_CUL.pm +++ b/fhem/FHEM/00_CUL.pm @@ -40,6 +40,7 @@ my %sets = ( "sens" => "SlowRF", "led" => "", "patable" => "", + "ITClock" => "SlowRF" ); my @ampllist = (24, 27, 30, 33, 36, 38, 40, 42); # rAmpl(dB) @@ -244,7 +245,7 @@ CUL_Set($@) return "\"set CUL\" needs at least one parameter" if(@a < 2); return "Unknown argument $a[1], choose one of " . join(" ", sort keys %sets) - if(!defined($sets{$a[1]})); + if(!defined($sets{$a[1]})); my $name = shift @a; my $type = shift @a; @@ -253,16 +254,16 @@ CUL_Set($@) return "This command is not valid in the current rfmode" if($sets{$type} && $sets{$type} ne AttrVal($name, "rfmode", "SlowRF")); - if($type eq "reopen") { #################################### + if($type eq "reopen") { CUL_Reopen($hash); - } elsif($type eq "hmPairForSec") { #################################### + } elsif($type eq "hmPairForSec") { return "Usage: set $name hmPairForSec " if(!$arg || $arg !~ m/^\d+$/); $hash->{hmPair} = 1; InternalTimer(gettimeofday()+$arg, "CUL_RemoveHMPair", $hash, 1); - } elsif($type eq "hmPairSerial") { ################################ + } elsif($type eq "hmPairSerial") { return "Usage: set $name hmPairSerial <10-character-serialnumber>" if(!$arg || $arg !~ m/^.{10}$/); @@ -272,7 +273,7 @@ CUL_Set($@) $hash->{HM_CMDNR}, $id, unpack('H*', $arg))); $hash->{hmPairSerial} = $arg; - } elsif($type eq "freq") { ######################################## MHz + } elsif($type eq "freq") { my $f = $arg/26*65536; @@ -286,7 +287,7 @@ CUL_Set($@) CUL_SimpleWrite($hash, "W11$f0"); CUL_WriteInit($hash); # Will reprogram the CC1101 - } elsif($type eq "bWidth") { ###################################### KHz + } elsif($type eq "bWidth") { my ($err, $ob); if(!IsDummy($hash->{NAME})) { CUL_SimpleWrite($hash, "C10"); @@ -310,8 +311,7 @@ GOTBW: CUL_SimpleWrite($hash, "W12$ob"); CUL_WriteInit($hash); - } elsif($type eq "rAmpl") { ####################################### dB - + } elsif($type eq "rAmpl") { return "a numerical value between 24 and 42 is expected" if($arg !~ m/^\d+$/ || $arg < 24 || $arg > 42); my ($v, $w); @@ -324,8 +324,7 @@ GOTBW: CUL_SimpleWrite($hash, "W1D$v"); CUL_WriteInit($hash); - } elsif($type eq "sens") { ######################################## dB - + } elsif($type eq "sens") { return "a numerical value between 4 and 16 is expected" if($arg !~ m/^\d+$/ || $arg < 4 || $arg > 16); my $w = int($arg/4)*4; @@ -334,8 +333,15 @@ GOTBW: CUL_SimpleWrite($hash, "W1F$v"); CUL_WriteInit($hash); - } else { ############################################### raw,led,patable + } elsif( $type eq "ITClock" ) { + my $clock = shift @a; + $clock=250 if($clock eq ""); + return "argument $arg is not numeric" if($clock !~ /^\d+$/); + Log3 $name, 3, "set $name $type $clock"; + $arg="ic$clock"; + CUL_SimpleWrite($hash, $arg); + } else { return "Expecting a 0-padded hex number" if((length($arg)&1) == 1 && $type ne "raw"); Log3 $name, 3, "set $name $type $arg"; @@ -1070,11 +1076,12 @@ CUL_Attr(@) Log3 $name, 2, "Switched $name rfmode to $aVal"; delete $hash->{".clientArray"}; + } elsif($aName eq "hmId"){ - if ($cmd eq "set"){ - return "wrong syntax: hmId must be 6-digit-hex-code (3 byte)" - if ($aVal !~ m/^[A-F0-9]{6}$/i); - } + if($cmd eq "set") { + return "wrong syntax: hmId must be 6-digit-hex-code (3 byte)" + if($aVal !~ m/^[A-F0-9]{6}$/i); + } } return undef; @@ -1180,7 +1187,8 @@ CUL_prefix($$$) Set @@ -1464,7 +1475,8 @@ CUL_prefix($$$) Set