CB-100
Stairville
Kevin Jonas
LED-Colorwheel
PCD-DDF-in-WPF
unit Stairville_CB_100;
interface
procedure InitDevice(Device: String);
procedure FormClose();
procedure FormShow();
procedure FormRefresh(channel: Integer);
function getfadetime: Integer;
procedure ColorBoxChange();
procedure ColorBoxChange2();
procedure dimmer_slider_changed();
procedure shutter_slider_changed();
implementation
var
dontRefresh: Boolean;
procedure InitDevice(Device: String);
begin
end;
procedure FormClose();
begin
end;
procedure FormShow();
begin
dontRefresh := false;
end;
procedure FormRefresh(channel: Integer);
var
value: Integer;
begin
if dontRefresh then begin
dontRefresh := false;
exit;
end;
case channel of
0: begin // Dimmer
value := get_channel('dimmer');
dimmer_slider.Position := value;
end;
1: begin // Farbrad
value := get_channel('color1');
case value of
0..7: begin // Weiß
colorbox.ItemIndex := 0;
end;
8..15: begin // Dunkelblau
colorbox.ItemIndex := 1;
end;
16..23: begin // Gelb
colorbox.ItemIndex := 2;
end;
24..31: begin // Pink
colorbox.ItemIndex := 3;
end;
32..39: begin // Grün
colorbox.ItemIndex := 4;
end;
40..47: begin // Rot
colorbox.ItemIndex := 5;
end;
48..55: begin // Hellblau
colorbox.ItemIndex := 6;
end;
56..63: begin // Orange
colorbox.ItemIndex := 7;
end;
64..71: begin // Weiß/Dunkelblau
colorbox.ItemIndex := 8;
end;
72..79: begin // Dunkelblau/Gelb
colorbox.ItemIndex := 9;
end;
80..87: begin // Gelb/Pink
colorbox.ItemIndex := 10;
end;
88..95: begin // Pink/Grün
colorbox.ItemIndex := 11;
end;
96..103: begin // Grün/Rot
colorbox.ItemIndex := 12;
end;
104..111: begin // Rot/Hellblau
colorbox.ItemIndex := 13;
end;
112..119: begin // Hellblau/Orange
colorbox.ItemIndex := 14;
end;
120..127: begin // Orange/Weiß
colorbox.ItemIndex := 15;
end;
128..191: begin // Rainbow+ Speed+
colorbox.ItemIndex := 16;
end;
192..255: begin // Rainbow- Speed+
colorbox.ItemIndex := 17;
end;
end;
end;
2: begin // Shutter
value := get_channel('shutter');
case value of
0: begin // Aus
try
shutter_slider.Min := 0;
except end;
shutter_slider.Max := 0;
shutter_slider.Min := 0;
shutter_slider.Position := value;
shutter_slider.Enabled := false;
end;
3: begin // Geschlossen
try
shutter_slider.Min := 3;
except end;
shutter_slider.Max := 3;
shutter_slider.Min := 3;
shutter_slider.Position := value;
shutter_slider.Enabled := false;
end;
8..215: begin // Bereich Min-Max
try
shutter_slider.Min := 8;
except end;
shutter_slider.Max := 215;
shutter_slider.Min := 8;
shutter_slider.Position := value;
shutter_slider.Enabled := true;
end;
216: begin // Offen
try
shutter_slider.Min := 216;
except end;
shutter_slider.Max := 216;
shutter_slider.Min := 216;
shutter_slider.Position := value;
shutter_slider.Enabled := false;
end;
end;
end;
3: begin // Funktion
value := get_channel('color2');
case value of
0..10: begin // n.A.
colorbox2.ItemIndex := 0;
end;
11..60: begin // Blackout/Farbrad
colorbox2.ItemIndex := 1;
end;
61..110: begin // Musiksteuerung
colorbox2.ItemIndex := 2;
end;
111..160: begin // Blackout/Musiksteuerung
colorbox2.ItemIndex := 3;
end;
161..210: begin // Farbrad reset
colorbox2.ItemIndex := 4;
end;
211..255: begin // Reset
colorbox2.ItemIndex := 5;
end;
end;
end;
end;
dontRefresh := false;
end;
function getfadetime: Integer;
begin
result := 0;
end;
procedure ColorBoxChange();
begin
case colorbox.ItemIndex of
0: // Weiß
set_channel('color1', -1, 0, 0);
1: // Dunkelblau
set_channel('color1', -1, 8, 0);
2: // Gelb
set_channel('color1', -1, 16, 0);
3: // Pink
set_channel('color1', -1, 24, 0);
4: // Grün
set_channel('color1', -1, 32, 0);
5: // Rot
set_channel('color1', -1, 40, 0);
6: // Hellblau
set_channel('color1', -1, 48, 0);
7: // Orange
set_channel('color1', -1, 56, 0);
8: // Weiß/Dunkelblau
set_channel('color1', -1, 64, 0);
9: // Dunkelblau/Gelb
set_channel('color1', -1, 72, 0);
10: // Gelb/Pink
set_channel('color1', -1, 80, 0);
11: // Pink/Grün
set_channel('color1', -1, 88, 0);
12: // Grün/Rot
set_channel('color1', -1, 96, 0);
13: // Rot/Hellblau
set_channel('color1', -1, 104, 0);
14: // Hellblau/Orange
set_channel('color1', -1, 112, 0);
15: // Orange/Weiß
set_channel('color1', -1, 120, 0);
16: // Rainbow+ Speed+
set_channel('color1', -1, 128, 0);
17: // Rainbow- Speed+
set_channel('color1', -1, 192, 0);
end;
end;
procedure ColorBoxChange2();
begin
case colorbox2.ItemIndex of
0: // n.A.
set_channel('color2', -1, 0, 0);
1: // Blackout/Farbrad
set_channel('color2', -1, 11, 0);
2: // Musiksteuerung
set_channel('color2', -1, 61, 0);
3: // Blackout/Musiksteuerung
set_channel('color2', -1, 111, 0);
4: // Farbrad reset
set_channel('color2', -1, 161, 0);
5: // Reset
set_channel('color2', -1, 211, 0);
end;
end;
procedure dimmer_slider_changed();
begin
dontRefresh := true;
set_channel('dimmer', -1, dimmer_slider.Position, 0);
end;
procedure shutter_slider_changed();
begin
dontRefresh := true;
set_channel('shutter', -1, shutter_slider.Position, 0);
end;
end.