Das Fading wird nur abgebrochen wenn es der gleiche Kanal ist?
IPS fühlt sich an wie stark beschäftigt. Das Webfront reagiert kaum noch.
Ein Timer startet alle 2 Sekunden ein Schritt welches dann 27 Kanäle (9x3 Kanäle RGB) auf eine neue Farbe fadet. Die Summe der Fadingzeiten ist aber grösser als 2 Sekunden.
<?php
//DMX Fill Wohnzimmer
$DMX_Instance_ID = 27219;
$LenghtSPIStripe = getvalueInteger(IPS_GetVariableIDByName("ANZAHL_SEGMENTE",$DMX_Instance_ID));
$ID_Helligkeit = 10406;
$ID_RGBSave = 30533;
$Colors = array (
1 => array(255,255,255), //weiss
2 => array(255,0,0), //rot
3 => array(0,0,255), //blau
4 => array(230,220,0), //gelb
5 => array(0,255,0), //grün
6 => array(255,0,255), //pink
7 => array(255,30,0), //orange
8 => array(0,209,213), //türkis
);
$OldRGB = GetValueInteger($ID_RGBSave);
do {
$RGB = random_int(1,count($Colors));
if ($RGB <> $OldRGB) break;
} while (true);
SetValueInteger($ID_RGBSave,$RGB);
$FadingTime = 0.5;
//DMX Werte setzen
$Helligkeit = getvaluefloat($ID_Helligkeit);
$R = intval($Colors[$RGB][0] * $Helligkeit);
$G = intval($Colors[$RGB][1] * $Helligkeit);
$B = intval($Colors[$RGB][2] * $Helligkeit);
for ($i = 0; $i < $LenghtSPIStripe; $i++) {
$Pos = ($i * 3) + 1;
DMX_FadeChannel($DMX_Instance_ID,$Pos,$R,$FadingTime);
DMX_FadeChannel($DMX_Instance_ID,$Pos + 1,$G,$FadingTime);
DMX_FadeChannel($DMX_Instance_ID,$Pos + 2 ,$B,$FadingTime);
ips_sleep(20);
}
$OldRGB = GetValueInteger($ID_RGBSave);
do {
$RGB = random_int(1,count($Colors));
if ($RGB <> $OldRGB) break;
} while (true);
SetValueInteger($ID_RGBSave,$RGB);
ips_sleep(1000);
$R = intval($Colors[$RGB][0] * $Helligkeit);
$G = intval($Colors[$RGB][1] * $Helligkeit);
$B = intval($Colors[$RGB][2] * $Helligkeit);
for ($i = $LenghtSPIStripe; $i >= 0; $i--) {
$Pos = ($i * 3) + 1;
DMX_FadeChannel($DMX_Instance_ID,$Pos,$R,$FadingTime);
DMX_FadeChannel($DMX_Instance_ID,$Pos + 1,$G,$FadingTime);
DMX_FadeChannel($DMX_Instance_ID,$Pos + 2,$B,$FadingTime);
ips_sleep(20);
}
?>