data.nodescript.lighteffects.warntafel.nodescript Maven / Gradle / Ivy
### Dieses Script definiert ein Asseccory,
### um die fuenf LED einer Baustellen_Warntafel
### anzusteuern.
###
### Hardware: 5 Lightport (z.B LPORT 5 - 9)
### Software: 1 accessory
### 3 macros, 3/2 Wechsel, 5 blinken, off
###
### history: 2016-11-19 A.Tillner, erste Version
###
### how to use:
### A) configure
### In section 1, define your ports and the desired accessory number
### In section 2, define your settings (like brightness and speed)
### B) load and run this script
### what will happen?
### 1. the ports will be configured with the given parameters
### 2. three new macros for the aspects will be defined
### 3. these macros will be assigned to the accessory
### C) have fun
###
### -------------- 1. Select Target
### #var(int macro0, int this_accessory)
### <-- # set ( $my_accessory = 1)
### <-- # set ( $my_macro = 10) ### wir verwenden drei Macros, Nr. 10 und die folgenden zwei
### <-- # set ( $start_led = 2) ### bei ws2811, die erste LED ist an Lightport 2 angeschlossen
##application(text:de="Baustellen-Warntafel mit fünf LED", text:en="Traffic sign at road construction with five LED")
##instruction(text:de="Baustellen-Warntafel mit fünf LED", text:en="Traffic sign at road construction with five LED", link="http://wiki.fichtelbahn.de/doku.php?id=konfigvorlagen:lichteffekte" )
//
##input($my_accessory:accessory, text:de="Nummer des zu erzeugenden Accessory", text:en="Nummber of the Accessory", default=1)
##input($my_macro:macro, text:de="Nummer des ersten Macros (von drei)", text:en="Number of the first macro", default=10)
##input($start_led:light, text:de="Nummer des ersten Lightport (von fuenf)", text:en="Number of the first Lightport", default=2)
##input($AccessoryName:string, text:de="Name des Accessory", text:en="Name of the accessory", default="Baustellen_Warntafel")
#set($led_gap = 1) ### die anderen vier LED sind an den folgenden vier Lightports angeschlossen
###set($AccessoryName = "Baustellen_Warntafel")
### -------------- 2. set Parameters for Ports
#set($WertbeiOff = 0)
#set($WertbeiOn = 120)
#set($DimmzeitOff = 120)
#set($DimmzeitOn = 120)
#set($Ueberblenden = 25)
#set($OnTime = 0)
### -------------- 3. execute part of the script
#set($macro0 = $my_macro) ### need some additional macros
#set($macro1 = $macro0 + 1) ### need some additional macros
#set($macro2 = $macro0 + 2) ### need some additional macros
#set($led0 = $start_led)
#set($led1 = 1 * $led_gap + $start_led)
#set($led2 = 2 * $led_gap + $start_led)
#set($led3 = 3 * $led_gap + $start_led)
#set($led4 = 4 * $led_gap + $start_led)
###
### Ports: (set Parameters)
set light ${led0} name="${AccessoryName}_${led0}"
set light ${led1} name="${AccessoryName}_${led1}"
set light ${led2} name="${AccessoryName}_${led2}"
set light ${led3} name="${AccessoryName}_${led3}"
set light ${led4} name="${AccessoryName}_${led4}"
config port ptype=light ValueOff=${WertbeiOff} ValueOn=${WertbeiOn} DimmOff=${DimmzeitOff} DimmOn=${DimmzeitOn} number=${led0}
config port ptype=light ValueOff=${WertbeiOff} ValueOn=${WertbeiOn} DimmOff=${DimmzeitOff} DimmOn=${DimmzeitOn} number=${led1}
config port ptype=light ValueOff=${WertbeiOff} ValueOn=${WertbeiOn} DimmOff=${DimmzeitOff} DimmOn=${DimmzeitOn} number=${led2}
config port ptype=light ValueOff=${WertbeiOff} ValueOn=${WertbeiOn} DimmOff=${DimmzeitOff} DimmOn=${DimmzeitOn} number=${led3}
config port ptype=light ValueOff=${WertbeiOff} ValueOn=${WertbeiOn} DimmOff=${DimmzeitOff} DimmOn=${DimmzeitOn} number=${led4}
### Macro
set macro ${macro0} name="${AccessoryName}${my_accessory}_off"
set macro ${macro1} name="${AccessoryName}${my_accessory}_Wechsel"
set macro ${macro2} name="${AccessoryName}${my_accessory}_Blinker"
### Fill Macros
select macro ${macro0}
config macro repeat=1 slowdown=1
add step ptype=macro action=stop name="${AccessoryName}${my_accessory}_Wechsel"
add step ptype=macro action=stop name="${AccessoryName}${my_accessory}_Blinker"
add step ptype=light action=down number=${led0}
add step ptype=light action=down number=${led1}
add step ptype=light action=down number=${led2}
add step ptype=light action=down number=${led3}
add step ptype=light action=down number=${led4}
## add step macro end
select macro ${macro1}
config macro repeat=0 slowdown=1 ### 0 = forever
add step ptype=macro action=stop name="${AccessoryName}${my_accessory}_Blinker"
add step delay=${Ueberblenden} ptype=light action=down number=${led1}
add step delay=${OnTime} ptype=light action=down number=${led3}
add step delay=${OnTime} ptype=light action=up number=${led0}
add step delay=${OnTime} ptype=light action=up number=${led2}
add step delay=${OnTime} ptype=light action=up number=${led4}
add step delay=${Ueberblenden} ptype=light action=up number=${led1}
add step delay=${OnTime} ptype=light action=up number=${led3}
add step delay=${OnTime} ptype=light action=down number=${led0}
add step delay=${OnTime} ptype=light action=down number=${led2}
add step delay=${OnTime} ptype=light action=down number=${led4}
## add step macro end
select macro ${macro2}
config macro repeat=0 slowdown=1 ### 0 = forever
add step ptype=macro action=stop name="${AccessoryName}${my_accessory}_Wechsel"
add step delay=${Ueberblenden} ptype=light action=down number=${led1}
add step delay=${OnTime} ptype=light action=down number=${led3}
add step delay=${OnTime} ptype=light action=down number=${led0}
add step delay=${OnTime} ptype=light action=down number=${led2}
add step delay=${OnTime} ptype=light action=down number=${led4}
add step delay=${Ueberblenden} ptype=light action=up number=${led1}
add step delay=${OnTime} ptype=light action=up number=${led3}
add step delay=${OnTime} ptype=light action=up number=${led0}
add step delay=${OnTime} ptype=light action=up number=${led2}
add step delay=${OnTime} ptype=light action=up number=${led4}
## add step macro end
### Define Accessory
set accessory ${my_accessory} name="${AccessoryName}${my_accessory}"
select accessory ${my_accessory}
add aspect 0 macroname="${AccessoryName}${my_accessory}_off"
add aspect 1 macroname="${AccessoryName}${my_accessory}_Wechsel"
add aspect 2 macroname="${AccessoryName}${my_accessory}_Blinker"