= 2) { // Farbwerte senden USCK_SendText($id_rgb, $GruppeAN."\x00\x55"); // Sende Gruppe xyz AN ips_sleep(110); $Output = "\x40".chr($Hue)."\x55"; USCK_SendText($id_rgb, $Output); // Sende Farbwert an Gruppe xyz ips_sleep(110); // Helligkeit senden // Anpassung an den zul„ssigen Wertebereich 2-27 Dezimal $Luminance2 = round(($Luminance / 9.44), 0); if ($Luminance2 < 2) $Luminance2 = 2; if ($Luminance2 > 27) $Luminance2 = 27; USCK_SendText($id_rgb, $GruppeAN."\x00\x55"); // Sende Gruppe xyz AN ips_sleep(110); $Output = "\x4e".chr($Luminance2)."\x55"; USCK_SendText($id_rgb, $Output); // Sende Helligkeit an Gruppe xyz // Wert in Variable Helligkeit schreiben SetValue($LuminanceID, $Luminance); return; } // "Weisse" Einstellungen bertragen if ($_IPS['VARIABLE'] == $LuminanceID and $Luminance >= 2) { // Gruppe auf Modus "Weiss" schalten USCK_SendText($id_rgb, $GruppeAN."\x00\x55"); // Sende Gruppe xyz AN ips_sleep(110); USCK_SendText($id_rgb, $GruppeWeiss."\x00\x55"); // Sende "Weiss" an Gruppe xyz ips_sleep(110); // Helligkeit senden // Anpassung an den zul„ssigen Wertebereich 2-27 Dezimal $Luminance2 = round(($Luminance / 9.44), 0); if ($Luminance2 < 2) $Luminance2 = 2; if ($Luminance2 > 27) $Luminance2 = 27; $Output = "\x4e".chr($Luminance2)."\x55"; USCK_SendText($id_rgb, $GruppeAN."\x00\x55"); // Sende Gruppe xyz AN ips_sleep(110); USCK_SendText($id_rgb, $Output); // Sende Helligkeit an Gruppe xyz // Wert in Variable HexColor schreiben SetValue($HexColorID, "000000"); return; } // Gruppe ausschalten if ($Luminance < 2) { USCK_SendText($id_rgb, $GruppeAUS."\x00\x55"); // Sende Gruppe xyz AUS // Wert in Variable Helligkeit schreiben SetValue($LuminanceID, $Luminance); // Wert in Variable HexColor schreiben SetValue($HexColorID, "000000"); } //UDP RGP Socket wieder schlieáen //CSCK_SetOpen($id_rgb, false); //IPS_ApplyChanges($id_rgb); // Funktion bernommen von www.php.net und an eigene Bedrfnisse angepasst // Convert RGB colors array into HSL array // @param array $ RGB colors set, each color component with range 0 to 255 // @return array HSL set, each color component with range 0 to 1 function rgb2hsl($rgb){ $clrR = ($rgb[0]); $clrG = ($rgb[1]); $clrB = ($rgb[2]); $clrMin = min($clrR, $clrG, $clrB); $clrMax = max($clrR, $clrG, $clrB); $deltaMax = $clrMax - $clrMin; $L = ($clrMax + $clrMin) / 510; if (0 == $deltaMax){ $H = 0; $S = 0; } else{ if (0.5 > $L){ $S = $deltaMax / ($clrMax + $clrMin); } else{ $S = $deltaMax / (510 - $clrMax - $clrMin); } if ($clrMax == $clrR) { $H = ($clrG - $clrB) / (6.0 * $deltaMax); } else if ($clrMax == $clrG) { $H = 1/3 + ($clrB - $clrR) / (6.0 * $deltaMax); } else { $H = 2 / 3 + ($clrR - $clrG) / (6.0 * $deltaMax); } if (0 > $H) $H += 1; if (1 < $H) $H -= 1; } $H = round(($H * 255), 0); $S = round(($S * 255), 0); $L = round(($L * 255), 0); $HSLColor = array( 'Hue' => $H, 'Saturation' => $S, 'Luminance' => $L ); return $HSLColor; } // Funktion Ende ?>