2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 12:49:34 +00:00

90_at type, 15_CUL byteswapping

git-svn-id: https://svn.fhem.de/fhem/trunk@235 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2008-09-02 19:35:15 +00:00
parent 9365b0238b
commit 5863f4445f
3 changed files with 17 additions and 8 deletions

View File

@ -31,12 +31,18 @@ CUL_EM_Define($$)
return "wrong syntax: define <name> CUL_EM <code> [corr]" return "wrong syntax: define <name> CUL_EM <code> [corr]"
if(int(@a) < 3 || int(@a) > 4); if(int(@a) < 3 || int(@a) > 4);
$a[2] = lc($a[2]);
return "Define $a[0]: wrong CODE format: valid is 1-12" return "Define $a[0]: wrong CODE format: valid is 1-12"
if($a[2] !~ m/^\d$/ || $a[2] < 1 || $a[2] > 12); if($a[2] !~ m/^\d$/ || $a[2] < 1 || $a[2] > 12);
$hash->{CODE} = $a[2]; $hash->{CODE} = $a[2];
$hash->{corr} = ((int(@a) > 3) ? $a[3] : 1); if($a[2] >= 1 && $a[2] <= 4) { # EMWZ: nRotation in 5 minutes
my $c = (int(@a) > 3 ? 150 : $a[3]);
$hash->{corr} = (12/$c);
} elsif($a[2] >= 5 && $a[2] <= 8) { # EMEM: 0.01
$hash->{corr} = (int(@a) > 3 ? 0.01 : $a[3]);
} else {
$hash->{corr} = 1;
}
$defptr{$a[2]} = $hash; $defptr{$a[2]} = $hash;
return undef; return undef;
} }
@ -63,10 +69,11 @@ CUL_EM_Parse($$)
my $tpe = ($a[1].$a[2])+0; my $tpe = ($a[1].$a[2])+0;
my $cde = ($a[3].$a[4])+0; my $cde = ($a[3].$a[4])+0;
my $cnt = hex($a[5].$a[6]); my $cnt = hex($a[5].$a[6]);
my $cum = hex($a[ 7].$a[ 8].$a[ 9].$a[10]); my $cum = hex($a[ 9].$a[10].$a[ 7].$a[ 8]);
my $lst = hex($a[11].$a[12].$a[13].$a[14]); my $lst = hex($a[13].$a[14].$a[11].$a[12]);
my $top = hex($a[15].$a[16].$a[17].$a[18]); my $top = hex($a[17].$a[18].$a[15].$a[16]);
my $val = sprintf("CUM: %d 5MIN: %d TOP: %d", $cum, $lst, $top); my $val = sprintf("CNT %d CUM: %d 5MIN: %d TOP: %d",
$cnt, $cum, $lst, $top);
if($defptr{$cde}) { if($defptr{$cde}) {
$hash = $defptr{$cde}; $hash = $defptr{$cde};
@ -74,7 +81,8 @@ CUL_EM_Parse($$)
$cum *= $corr; $cum *= $corr;
$lst *= $corr; $lst *= $corr;
$top *= $corr; $top *= $corr;
$val = sprintf("CUM: %d 5MIN: %d TOP: %d", $cum, $lst, $top); $val = sprintf("CND %d CUM: %0.3f 5MIN: %0.3f TOP: %0.3f",
$cnt, $cum, $lst, $top);
my $n = $hash->{NAME}; my $n = $hash->{NAME};
Log GetLogLevel($n,1), "CUL_EM $n: $val"; Log GetLogLevel($n,1), "CUL_EM $n: $val";
$hash->{STATE} = $val; $hash->{STATE} = $val;

View File

@ -67,7 +67,7 @@ at_Define($$)
$hash->{TRIGGERTIME} = $nt; $hash->{TRIGGERTIME} = $nt;
InternalTimer($nt, "at_Exec", $name, 0); InternalTimer($nt, "at_Exec", $name, 0);
$hash->{STATE} = "Next: " . FmtTime($nt); $hash->{STATE} = ("Next: " . FmtTime($nt))
if(!($attr{$name} && $attr{$name}{disable})); if(!($attr{$name} && $attr{$name}{disable}));
return undef; return undef;

View File

@ -11,6 +11,7 @@ dummy_Initialize($)
$hash->{SetFn} = "dummy_Set"; $hash->{SetFn} = "dummy_Set";
$hash->{DefFn} = "dummy_Define"; $hash->{DefFn} = "dummy_Define";
$hash->{AttrList} = "loglevel:0,1,2,3,4,5,6";
} }
################################### ###################################