From 11aa4c90dec0f966dad6de3ef8c5d62a9216063a Mon Sep 17 00:00:00 2001 From: Philipp Kramer Date: Mon, 26 May 2025 17:12:37 +0200 Subject: [PATCH] add robert juliat dalis 861 --- scenes/main.tscn | 15 ++++++- scripts/artnet.gd | 10 +++-- scripts/dmx_color.gd | 90 +++++++++++++++++++++++++++------------ scripts/dmx_direct.gd | 18 ++++++++ scripts/dmx_movinghead.gd | 69 ++++++++++++++++-------------- 5 files changed, 137 insertions(+), 65 deletions(-) create mode 100644 scripts/dmx_direct.gd diff --git a/scenes/main.tscn b/scenes/main.tscn index d7db3a5..fd3283e 100644 --- a/scenes/main.tscn +++ b/scenes/main.tscn @@ -1,10 +1,11 @@ -[gd_scene load_steps=6 format=3 uid="uid://dafh3tlcmos4p"] +[gd_scene load_steps=7 format=3 uid="uid://dafh3tlcmos4p"] [ext_resource type="Script" uid="uid://bgpsbsunf8fwf" path="res://scripts/artnet.gd" id="1_hsiae"] [ext_resource type="Texture2D" uid="uid://buuvoh3jf0f52" path="res://sprites/cross.png" id="2_vgkya"] [ext_resource type="Script" uid="uid://cpncgkw0ns8ry" path="res://scripts/dmx_movinghead.gd" id="3_he00n"] [ext_resource type="Texture2D" uid="uid://glyt8h1eag1u" path="res://sprites/pixel.png" id="3_qvw8c"] [ext_resource type="Script" uid="uid://b0qusiobeu8d4" path="res://scripts/dmx_color.gd" id="4_velje"] +[ext_resource type="Script" uid="uid://lkit8whq53i1" path="res://scripts/dmx_direct.gd" id="6_tefeu"] [node name="Node2D" type="Node2D"] @@ -17,12 +18,22 @@ update_frequency = 40 texture = ExtResource("2_vgkya") script = ExtResource("3_he00n") artnet = NodePath("../ArtNet") +output = false channel_offset = 100 [node name="ColorRect" type="Sprite2D" parent="." node_paths=PackedStringArray("artnet")] -modulate = Color(1, 0.760784, 0, 1) +modulate = Color(0, 0.12549, 1, 1) position = Vector2(162.125, 549.375) scale = Vector2(283.75, 328.75) texture = ExtResource("3_qvw8c") script = ExtResource("4_velje") artnet = NodePath("../ArtNet") +output = false +channel_offset = 93 +model = 1 + +[node name="Test" type="Node" parent="." node_paths=PackedStringArray("artnet")] +script = ExtResource("6_tefeu") +artnet = NodePath("../ArtNet") +channel_offset = 93 +values = Array[float]([255.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 255.0, 0.0, 0.0, 0.0, 0.0]) diff --git a/scripts/artnet.gd b/scripts/artnet.gd index 179479e..4a24108 100644 --- a/scripts/artnet.gd +++ b/scripts/artnet.gd @@ -29,19 +29,21 @@ func _process(delta: float) -> void: ''' sendDMX(data) -func setDMXChannel(ch,val,twobytes:bool=false): +func setDMXChannel(ch,val,size:int=8): if (ch-1>512): print("DMX Error: Channel out of bounds") return 0 - if (!twobytes): + if (size==8): if val>255: - print("DMX Error: Value too high") + print("DMX Error: Value too high. CH="+str(ch)+" val="+str(val) ) return 0 data[ch-1]=int(val) - else: + elif (size==16): data[ch-1]=int(val/256) data[ch-1+1]=int(val%256) + else: + print("Wrong size. Use 8 or 16 bit.") return 1 diff --git a/scripts/dmx_color.gd b/scripts/dmx_color.gd index 4387c31..f862a44 100644 --- a/scripts/dmx_color.gd +++ b/scripts/dmx_color.gd @@ -1,29 +1,64 @@ extends Node2D -@export var artnet:Node +# Direct control Colored Light. +# Only One color for whole device. +@export var artnet:Node +@export var output:bool=true @export_range(0,255,1) var master = 255 @export_range(1,512,1) var channel_offset=1 -var colormix=[ - [1.0,0,0], #red - [0,1.0,0], #green - [0,0,1.0], #blue - [1.0,1.0,1.0], #white - [1.0,0.8,0], #amber -] -var colorchannels=[3,4,5,6,7] #same order as colormix -var values=[] +enum Model {cameo_clp_flatpro_18, robtertjuliat_dalis_861_fullmode8b} +@export var model: Model + + + +var colormix=[] + +var colorchannels=[] +var colorvalues=[] + +var fixedchannels=[] +var fixedvalues=[] func _ready() -> void: - values.resize(colorchannels.size()) + if (model==Model.cameo_clp_flatpro_18): + colormix=[ + [1.0,0,0], #red + [0,1.0,0], #green + [0,0,1.0], #blue + [1.0,1.0,1.0], #white + [1.0,0.75,0], #amber + ] + colorchannels=[3,4,5,6,7] #same order as colormix + + fixedchannels=[2,8] + fixedvalues=[0,0] + elif (model==Model.robtertjuliat_dalis_861_fullmode8b): + #https://www.robertjuliat.com/PDF/Documents/DN41108200_m_DALIS_861.pdf + colormix=[ + [1.0,0,0], #red + [0,1.0,0], #green + [0,1.0,1.0], #blue (looks cyan) + [0.0,0.0,1.0], #royal blue (looks more blue) + [0,1.0,0.8], #cyan (looks more green) + [1.0,0.75,0], #amber + [1.0,1.0,1.0], #white + [1.0,0.9,0.8], #warm white + ] + colorchannels=[2,3,4,5,6,7,8,9] #same order as colormix + + fixedchannels=[10,11,12,13] + fixedvalues=[0,0,255,0] + + colorvalues.resize(colorchannels.size()) func _process(delta: float) -> void: var rgb=[modulate.r,modulate.g,modulate.b] - values.fill(0.0) + colorvalues.fill(0.0) var passes=0 while rgb[0]+rgb[1]+rgb[2]>0.01: @@ -37,29 +72,30 @@ func _process(delta: float) -> void: var cmixsums_min=matrixMinIndex(cmixsums) var colormix_min=matrixDivide(rgb,colormix[cmixsums_min]).min() rgb = matrixSubtract(rgb,matrixMult(colormix[cmixsums_min],colormix_min)) - values[cmixsums_min]+=colormix_min + colorvalues[cmixsums_min]+=colormix_min - #print("Result color mix:"+str(values)+" passes="+str(passes)+ " remaining error="+str(rgb[0]+rgb[1]+rgb[2])) - + #print("Result color mix:"+str(colorvalues)+" passes="+str(passes)+ " remaining error="+str(rgb[0]+rgb[1]+rgb[2])) + if output: + artnet.setDMXChannel(channel_offset-1+1,master) #master dimmer - artnet.setDMXChannel(channel_offset-1+1,master) #master dimmer - artnet.setDMXChannel(channel_offset-1+2,0) #strobo - artnet.setDMXChannel(channel_offset-1+8,0) #macros + #artnet.setDMXChannel(channel_offset-1+2,0) #strobo + #artnet.setDMXChannel(channel_offset-1+8,0) #macros var vi=0 - for v in values: - artnet.setDMXChannel(channel_offset-1+colorchannels[vi],v*255) + for v in colorvalues: + if output: + artnet.setDMXChannel(channel_offset-1+colorchannels[vi],v*255) vi+=1 + + + var fi=0 + for f in fixedvalues: + if output: + artnet.setDMXChannel(channel_offset-1+fixedchannels[fi],f) + fi+=1 - ''' - artnet.setDMXChannel(channel_offset-1+3,modulate.r*255) #red - artnet.setDMXChannel(channel_offset-1+4,modulate.g*255) #green - artnet.setDMXChannel(channel_offset-1+5,modulate.b*255) #blue - artnet.setDMXChannel(channel_offset-1+6,modulate.b*255) #white - artnet.setDMXChannel(channel_offset-1+7,modulate.b*255) #amber - ''' func matrixDivide(m1:Array,m2:Array) -> Array: var res=[] diff --git a/scripts/dmx_direct.gd b/scripts/dmx_direct.gd new file mode 100644 index 0000000..528cad5 --- /dev/null +++ b/scripts/dmx_direct.gd @@ -0,0 +1,18 @@ +extends Node + +@export var artnet:Node +@export var output:bool=true + +@export_range(1,512,1) var channel_offset=1 + +@export_range(0,255,1) var values: Array[float] + + +func _process(delta: float) -> void: + #https://www.martin.com/en/site_elements/martin-manuals-mac-encore-performance-bedienungsanleitung + + var vi=0 + for v in values: + if output: + artnet.setDMXChannel(channel_offset-1+ (vi+1),v,8) + vi+=1 diff --git a/scripts/dmx_movinghead.gd b/scripts/dmx_movinghead.gd index ebf85e9..eab3570 100644 --- a/scripts/dmx_movinghead.gd +++ b/scripts/dmx_movinghead.gd @@ -2,6 +2,9 @@ extends Node2D @export var artnet:Node + +@export var output:bool=true + @export_range(1,512,1) var channel_offset=1 @export_range(0,255,1) var master = 0 @export_range(0,255,1) var red = 0 @@ -16,38 +19,40 @@ func _ready() -> void: func _process(delta: float) -> void: #https://www.martin.com/en/site_elements/martin-manuals-mac-encore-performance-bedienungsanleitung - artnet.setDMXChannel(channel_offset-1+1,master,false) - artnet.setDMXChannel(channel_offset-1+2,0,true) #master dimmer - artnet.setDMXChannel(channel_offset-1+4,red,false) - artnet.setDMXChannel(channel_offset-1+5,green,false) - artnet.setDMXChannel(channel_offset-1+6,blue,false) - artnet.setDMXChannel(channel_offset-1+7,0,false) #ctc - artnet.setDMXChannel(channel_offset-1+8,0,false) #farbrad - artnet.setDMXChannel(channel_offset-1+9,0,false) #gobo - artnet.setDMXChannel(channel_offset-1+10,32768,true) #goborad index/ drehung - artnet.setDMXChannel(channel_offset-1+12,0,false) #animationsrad, pos und funktion - artnet.setDMXChannel(channel_offset-1+13,127,false) #animationsrad, index/ drehung - artnet.setDMXChannel(channel_offset-1+14,0,false) #frost - artnet.setDMXChannel(channel_offset-1+15,0,false) #iris - artnet.setDMXChannel(channel_offset-1+16,32768,true) #zoom - artnet.setDMXChannel(channel_offset-1+18,32768,true) #fokus - artnet.setDMXChannel(channel_offset-1+20,0,false) #blendenschieber 1 Pos - artnet.setDMXChannel(channel_offset-1+21,127,false) #blendenschieber 1 Winkel - artnet.setDMXChannel(channel_offset-1+22,0,false) #blendenschieber 2 Pos - artnet.setDMXChannel(channel_offset-1+23,127,false) #blendenschieber 2 Winkel - artnet.setDMXChannel(channel_offset-1+24,0,false) #blendenschieber 3 Pos - artnet.setDMXChannel(channel_offset-1+25,127,false) #blendenschieber 3 Winkel - artnet.setDMXChannel(channel_offset-1+26,0,false) #blendenschieber 4 Pos - artnet.setDMXChannel(channel_offset-1+27,127,false) #blendenschieber 4 Winkel - artnet.setDMXChannel(channel_offset-1+28,127,false) #Index blendenschiebermodul - artnet.setDMXChannel(channel_offset-1+29,pan,true) #Pan (default 32768) - artnet.setDMXChannel(channel_offset-1+31,tilt,true) #Tilt (default 32768) - artnet.setDMXChannel(channel_offset-1+33,0,false) #Gerätesteuerkanal - artnet.setDMXChannel(channel_offset-1+34,0,false) #Fx1 - artnet.setDMXChannel(channel_offset-1+35,128,false) #Fx1 geschw - artnet.setDMXChannel(channel_offset-1+36,0,false) #Fx2 - artnet.setDMXChannel(channel_offset-1+37,128,false) #Fx2 geschw - artnet.setDMXChannel(channel_offset-1+38,0,false) #FX Sync + + if output: + artnet.setDMXChannel(channel_offset-1+1,master,8) + artnet.setDMXChannel(channel_offset-1+2,0,16) #master dimmer + artnet.setDMXChannel(channel_offset-1+4,red,8) + artnet.setDMXChannel(channel_offset-1+5,green,8) + artnet.setDMXChannel(channel_offset-1+6,blue,8) + artnet.setDMXChannel(channel_offset-1+7,0,8) #ctc + artnet.setDMXChannel(channel_offset-1+8,0,8) #farbrad + artnet.setDMXChannel(channel_offset-1+9,0,8) #gobo + artnet.setDMXChannel(channel_offset-1+10,32768,16) #goborad index/ drehung + artnet.setDMXChannel(channel_offset-1+12,0,8) #animationsrad, pos und funktion + artnet.setDMXChannel(channel_offset-1+13,127,8) #animationsrad, index/ drehung + artnet.setDMXChannel(channel_offset-1+14,0,8) #frost + artnet.setDMXChannel(channel_offset-1+15,0,8) #iris + artnet.setDMXChannel(channel_offset-1+16,32768,16) #zoom + artnet.setDMXChannel(channel_offset-1+18,32768,16) #fokus + artnet.setDMXChannel(channel_offset-1+20,0,8) #blendenschieber 1 Pos + artnet.setDMXChannel(channel_offset-1+21,127,8) #blendenschieber 1 Winkel + artnet.setDMXChannel(channel_offset-1+22,0,8) #blendenschieber 2 Pos + artnet.setDMXChannel(channel_offset-1+23,127,8) #blendenschieber 2 Winkel + artnet.setDMXChannel(channel_offset-1+24,0,8) #blendenschieber 3 Pos + artnet.setDMXChannel(channel_offset-1+25,127,8) #blendenschieber 3 Winkel + artnet.setDMXChannel(channel_offset-1+26,0,8) #blendenschieber 4 Pos + artnet.setDMXChannel(channel_offset-1+27,127,8) #blendenschieber 4 Winkel + artnet.setDMXChannel(channel_offset-1+28,127,8) #Index blendenschiebermodul + artnet.setDMXChannel(channel_offset-1+29,pan,16) #Pan (default 32768) + artnet.setDMXChannel(channel_offset-1+31,tilt,16) #Tilt (default 32768) + artnet.setDMXChannel(channel_offset-1+33,0,8) #Gerätesteuerkanal + artnet.setDMXChannel(channel_offset-1+34,0,8) #Fx1 + artnet.setDMXChannel(channel_offset-1+35,128,8) #Fx1 geschw + artnet.setDMXChannel(channel_offset-1+36,0,8) #Fx2 + artnet.setDMXChannel(channel_offset-1+37,128,8) #Fx2 geschw + artnet.setDMXChannel(channel_offset-1+38,0,8) #FX Sync