All Downloads are FREE. Search and download functionalities are using the official Maven repository.

data.nodescript.lighteffects.NeoControlEWS_groups_mode11_tv.nodescript Maven / Gradle / Ivy

## Script only for NeoControl EWS!
## This script defines a group of LEDs 
## Mode: TV effect for 4 LEDs
##
## Hardware: Neocontrol with NeoControl EWS firmware
## Software:
##
## history: 2017-01-04 V.Dierkes, first version
##          2017-01-10 V.Dierkes, add relative addressing for stripe positions 2-8
##          2017-02-18 V.Dierkes, use predefined variables to calculate CV addresses
##          2017-02-18 V.Dierkes, check VID and PID
##          2017-02-18 V.Dierkes, predefined variable light_count was renamed
##          2017-03-18 V.Dierkes, replaced tabs by spaces
##          2020-04-07 V.Dierkes, Fix size of 20 instead of ${node_accessory_count} for accessory CV area
##
## how to use:
## A) configure
##    Not needed
## B) load and run this script
##    what will happen?
##    1. the led group will be configured with the given parameters
## C) have fun
##    Switching on/off the SPORT will control the group of light elements accordingly
##

##require(vid="13", pid="129")

##instruction(text:de="NeoEWS: Konfiguration einer Lichtgruppe für Modus 11 - TV-Simulation", text:en="NeoEWS: Configuration of a light group for mode 11 - TV simulation")
##
##input($my_group:int, text:de="Nummer der Lichtgruppe (0-15)", text:en="Number of the group", default=0)
##input($start_led:light, text:de="Nummer des ersten Lightports der Gruppe
| Größe der Gruppe: 4", text:en="Number of the first Lightport of the group
| Size of the group: 4", default=0) ## ##input($group_size:int, text:de="Anzahl der Lightports der Gruppe
| >=1", text:en="Number of Lightports of the group
| >=1", default=2) ## ##input($last_led:light, text:de="Nummer des letzten Lightports der Gruppe", text:en="Number of the last Lightport of the group", default=0) ## ##input($speed_factor:int, text:de="Geschwindigkeitsfaktor der Gruppe
| 0=10ms, 99=1s, 189=10s, 215=1min, 249=10min", text:en="Speed factor of the group
| 0=10ms, 99=1s, 189=10s, 215=1min, 249=10min", default=0) ## ##input($speed_min:int, text:de="Zeit pro Schritt: Minuten
| Min: 0,01s - Max: 10min 55sec", text:en="Time per step: Minutes
Min: 0.01s - Max: 10min 55sec", default=0) ## ##input($speed_sec:int, text:de="Zeit pro Schritt: Sekunden", text:en="Time per step: Seconds", default=0) ## ##input($speed_hun:int, text:de="Zeit pro Schritt: Hundertstel", text:en="Time per step: Hundredths", default=50) ## ##input($group_on:int, text:de="Einschaltverhalten der LEDs in dieser Gruppe
| 1=An,3=Dimm,4=Neon,5=BlinkA,6=BlinkB,7=FlashA,8=FlashB,9=Double", text:en="Turn on behavior of the group
1=On,3=Dimm,4=Neon,5=BlinkA,6=BlinkB,7=FlashA,8=FlashB,9=Double", default=1) ## ##input($group_off:int, text:de="Ausschaltverhalten der LEDs in dieser Gruppe
| 0=Aus,2=Dimm", text:en="Turn off behavior of the group
0=Off,2=Dimm", default=0) ##input($use_rgb:boolean, text:de="Benutze RGB-LEDs
| Farbe #31 wird mit Weiß belegt", text:en="Use RGB LEDs
| Color #31 will be used for white", default = false) ##input($group_endless:boolean, text:de="Endloser Lauf der Gruppe", text:en="Endless running of the group", default=true) ##input($led_tabval1:int, text:de="Stripe-Pos der 1. LED (rot)", text:en="Stripe position of 1st LED (red)", default=0) ##input($led_tab2:string, text:de="Stripe-Pos der 2. LED (grün)
| Nummer oder +Offset oder -Offset", text:en="Stripe position of 2nd LED (green)
| Number or +Offset or -Offset", default="+1") ##input($led_tab3:string, text:de="Stripe-Pos der 3. LED (blau)
| Nummer oder +Offset oder -Offset", text:en="Stripe position of 3rd LED (blue)
| Number or +Offset or -Offset", default="+1") ##input($led_tab4:string, text:de="Stripe-Pos der 4. LED (weiß)
| Nummer oder +Offset oder -Offset", text:en="Stripe position of 4th LED (white)
| Number or +Offset or -Offset", default="+1") ## -------------- 1. Select Target #if((${vid} == 13) && (${pid} == 129)) ## Only for Neo_EWS ## -------------- 2. Define default values #set($group_mode = 11) #set($group_option = 0) #set($speed_min = 0) #set($speed_sec = 0) #set($speed_hun = 0) #set($group_on = 1) #set($group_off = 0) #set($Integer = 0) #set($cv_base_lights = 81) #set($cv_base_accessory = $cv_base_lights + ( 5 * ${node_light_count}) ) ## Fix size of 20 instead of ${node_accessory_count} for accessory CV area #set($cv_base_colors = $cv_base_accessory + ( 10 * 20) ) #set($cv_base_groups = $cv_base_colors + ( 3 * 32 ) ) #set($cv_base_mapping = $cv_base_groups + ( 6 * 16 ) ) #set($cv_base_config = $cv_base_mapping + ( 1 * 256 ) ) #set($cv_base_acc_cfg = $cv_base_config + ( 6 ) ) ## -------------- 3. execute part of the script #set($led_tabval2 = -1) #set($led_tabval3 = -1) #set($led_tabval4 = -1) #if($led_tab2.matches("\d+")) #set($led_tabval2 = $Integer.parseInt($led_tab2)) #elseif($led_tab2.matches("[\+\-]\d+")) #if($led_tabval1 != -1) #if($led_tab2.substring(0,1) == "+") #set($led_tabval2 = $led_tabval1 + $Integer.parseInt($led_tab2.substring(1))) #else #set($led_tabval2 = $led_tabval1 - $Integer.parseInt($led_tab2.substring(1))) #end #end #end #if($led_tab3.matches("\d+")) #set($led_tabval3 = $Integer.parseInt($led_tab3)) #elseif($led_tab3.matches("[\+\-]\d+")) #if($led_tabval2 != -1) #if($led_tab3.substring(0,1) == "+") #set($led_tabval3 = $led_tabval2 + $Integer.parseInt($led_tab3.substring(1))) #else #set($led_tabval3 = $led_tabval2 - $Integer.parseInt($led_tab3.substring(1))) #end #end #end #if($led_tab4.matches("\d+")) #set($led_tabval4 = $Integer.parseInt($led_tab4)) #elseif($led_tab4.matches("[\+\-]\d+")) #if($led_tabval3 != -1) #if($led_tab4.substring(0,1) == "+") #set($led_tabval4 = $led_tabval3 + $Integer.parseInt($led_tab4.substring(1))) #else #set($led_tabval4 = $led_tabval3 - $Integer.parseInt($led_tab4.substring(1))) #end #end #end #set($last_led = $start_led + 3) #if(($my_group>=0) && ($my_group<=15) && ($last_led >= $start_led) && ($led_tabval1 >= 0) && ($led_tabval2 >= 0) && ($led_tabval3 >= 0) && ($led_tabval4 >= 0)) ## do it only in case the group number is in the allowed range ## do some naming stuff set switch $my_group name="Group${my_group}_TV_LP${start_led}-${last_led}" #set($i = $start_led) set light $i name="Group${my_group}_TV_Light0_red" #set($i = $i + 1) set light $i name="Group${my_group}_TV_Light1_green" #set($i = $i + 1) set light $i name="Group${my_group}_TV_Light2_blue" #set($i = $i + 1) set light $i name="Group${my_group}_TV_Light3_white" ## Set mode ## Set endless mode in group value #if ($group_endless) #set($group_mode = $group_mode + 128) #end ## Set on/off value #set($group_onoff = (16 * $group_on) + $group_off) ## calculate speed_faktor #set($speed_factor = 0) #set($speed_time = (6000*$speed_min) + (100*$speed_sec) + $speed_hun) #if($speed_time > 65500) #set($speed_factor=251) #elseif($speed_time > 33000) #set($speed_factor=($speed_time - 33000) / 3000 + 240) #elseif($speed_time > 6000) #set($speed_factor=($speed_time - 7000) / 1000 + 216) #elseif($speed_time > 3000) #set($speed_factor = ($speed_time - 3500) / 500 + 210) #elseif($speed_time > 1000) #set($speed_factor=$speed_time / 100 + 179) #elseif($speed_time > 100) #set($speed_factor=($speed_time - 110) / 10 + 100) #elseif($speed_time > 0) #set($speed_factor=$speed_time - 1) #end ## --------------- 4. Write the data to the node #set($cv_base = $cv_base_groups + (6 * $my_group)) #set($cv_addr = $cv_base) set CV ${cv_addr} ${group_mode} #set($cv_addr = $cv_addr + 1) set CV ${cv_addr} ${start_led} #set($cv_addr = $cv_addr + 1) set CV ${cv_addr} ${last_led} #set($cv_addr = $cv_addr + 1) set CV ${cv_addr} ${speed_factor} #set($cv_addr = $cv_addr + 1) set CV ${cv_addr} ${group_onoff} #set($cv_addr = $cv_addr + 1) set CV ${cv_addr} ${group_option} ## RGB mode #if($use_rgb) #set($cv_addr = $cv_base_lights + (5 * ${start_led}) ) set CV ${cv_addr} 32 ## Red #set($cv_addr = $cv_addr + 1) set CV ${cv_addr} 0 ## Off value #set($cv_addr = $cv_addr + 1) set CV ${cv_addr} 255 ## On value #set($cv_addr = $cv_addr + 1) set CV ${cv_addr} 255 ## Dimm off #set($cv_addr = $cv_addr + 1) set CV ${cv_addr} 255 ## Dimm on #set($cv_addr = $cv_addr + 1) set CV ${cv_addr} 107 ## Green #set($cv_addr = $cv_addr + 1) set CV ${cv_addr} 0 ## Off value #set($cv_addr = $cv_addr + 1) set CV ${cv_addr} 255 ## On value #set($cv_addr = $cv_addr + 1) set CV ${cv_addr} 255 ## Dimm off #set($cv_addr = $cv_addr + 1) set CV ${cv_addr} 255 ## Dimm on #set($cv_addr = $cv_addr + 1) set CV ${cv_addr} 181 ## Blue #set($cv_addr = $cv_addr + 1) set CV ${cv_addr} 0 ## Off value #set($cv_addr = $cv_addr + 1) set CV ${cv_addr} 255 ## On value #set($cv_addr = $cv_addr + 1) set CV ${cv_addr} 255 ## Dimm off #set($cv_addr = $cv_addr + 1) set CV ${cv_addr} 255 ## Dimm on #set($cv_addr = $cv_addr + 1) set CV ${cv_addr} 31 ## White #set($cv_addr = $cv_addr + 1) set CV ${cv_addr} 0 ## Off value #set($cv_addr = $cv_addr + 1) set CV ${cv_addr} 255 ## On value #set($cv_addr = $cv_addr + 1) set CV ${cv_addr} 255 ## Dimm off #set($cv_addr = $cv_addr + 1) set CV ${cv_addr} 255 ## Dimm on #set($cv_addr = $cv_base_colors + (3 * 31 ) ) set CV ${cv_addr} 255 ## Whte #set($cv_addr = $cv_addr + 1) set CV ${cv_addr} 255 ## White #set($cv_addr = $cv_addr + 1) set CV ${cv_addr} 255 ## White #end ## Stripe position #set($cv_base = $cv_base_mapping) #set($cv_addr = $cv_base + $led_tabval1) set CV ${cv_addr} ${start_led} #if($start_led<$last_led) #set($cv_addr = $cv_base + $led_tabval2) #set($start_led = $start_led + 1) set CV ${cv_addr} ${start_led} #end #if($start_led<$last_led) #set($cv_addr = $cv_base + $led_tabval3) #set($start_led = $start_led + 1) set CV ${cv_addr} ${start_led} #end #if($start_led<$last_led) #set($cv_addr = $cv_base + $led_tabval4) #set($start_led = $start_led + 1) set CV ${cv_addr} ${start_led} #end #end #end #######################################




© 2015 - 2024 Weber Informatics LLC | Privacy Policy