mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-05-01 20:20:10 +00:00
use maxNum
git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@3424 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
97c0b787c3
commit
9f9ca5b085
@ -197,15 +197,6 @@ sub HUEDevice_Undefine($$)
|
|||||||
return undef;
|
return undef;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub
|
|
||||||
HUEDevice_max($@)
|
|
||||||
{
|
|
||||||
my ($max, @vars) = @_;
|
|
||||||
for (@vars) {
|
|
||||||
$max = $_ if $_ > $max;
|
|
||||||
}
|
|
||||||
return $max;
|
|
||||||
}
|
|
||||||
sub
|
sub
|
||||||
HUEDevice_SetParam($$@)
|
HUEDevice_SetParam($$@)
|
||||||
{
|
{
|
||||||
@ -282,7 +273,7 @@ HUEDevice_SetParam($$@)
|
|||||||
#$y = 1 if( $y > 1 );
|
#$y = 1 if( $y > 1 );
|
||||||
$Y = 1 if( $Y > 1 );
|
$Y = 1 if( $Y > 1 );
|
||||||
|
|
||||||
my $bri = HUEDevice_max($r,$g,$b);
|
my $bri = maxNum($r,$g,$b);
|
||||||
#my $bri = $Y;
|
#my $bri = $Y;
|
||||||
|
|
||||||
$obj->{'on'} = JSON::true;
|
$obj->{'on'} = JSON::true;
|
||||||
@ -411,7 +402,7 @@ xyYtorgb($$$)
|
|||||||
if( $X > 1
|
if( $X > 1
|
||||||
|| $Y > 1
|
|| $Y > 1
|
||||||
|| $Z > 1 ) {
|
|| $Z > 1 ) {
|
||||||
my $f = HUEDevice_max($X,$Y,$Z);
|
my $f = maxNum($X,$Y,$Z);
|
||||||
$X /= $f;
|
$X /= $f;
|
||||||
$Y /= $f;
|
$Y /= $f;
|
||||||
$Z /= $f;
|
$Z /= $f;
|
||||||
@ -425,7 +416,7 @@ xyYtorgb($$$)
|
|||||||
if( $r > 1
|
if( $r > 1
|
||||||
|| $g > 1
|
|| $g > 1
|
||||||
|| $b > 1 ) {
|
|| $b > 1 ) {
|
||||||
my $f = HUEDevice_max($r,$g,$b);
|
my $f = maxNum($r,$g,$b);
|
||||||
$r /= $f;
|
$r /= $f;
|
||||||
$g /= $f;
|
$g /= $f;
|
||||||
$b /= $f;
|
$b /= $f;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user