Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
## Script only for NeoControl EWS!
## This script defines a group of LEDs
## Mode: Switch all together on and off
##
## Hardware: Neocontrol with NeoControl EWS firmware
## Software:
##
## history: 2017-01-04 VDi, first version
## 2017-01-09 VDi, add relative addressing for stripe positions 2-8
## 2017-02-17 VDi, use predefined variables to calculate CV addresses
## 2017-02-17 VDi, check VID and PID
## 2017-02-18 VDi, predefined variable light_count was renamed
## 2017-03-10 VDi, add option for RGB LEDs, Naming of elements corrected
## 2017-03-18 VDi, replaced tabs by spaces
## 2017-04-26 VDi, Modify option in case of stop port usage to be aligned with V1.0.2 of NeoEWS
## Add require command to ensure usage on Neo EWS only
## Add range checks
## Improve instruction text, use application
## Add second light for each walking light for both sides of the street
## 2019-11-25 V.Dierkes, merge GIT with local version
## 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")
##application(text:de="NeoEWS: Konfiguration einer Lichtgruppe für Modus 5ff - Ampel", text:en="NeoEWS: Configuration of a light group for mode 5... - Traffic lights")
##instruction(text:de="Für die NeoEWS! Mit diesem Skript kann eine Ampel definiert werden. Die Ampel kann Fußgängersignale enthalten, sie kann Stoppstellen für automatisch fahrende Autos steuern, sie kann auch nur gelb blinken, etc.", text:en="For NeoEWS! This script defines a traffic light. The traffic light could include signals for walking, could include stop signals for autonomous driving cars, could blink yellow only, etc.", link="https://forum.opendcc.de/wiki/doku.php?id=onews:examples_onewsi#ampel")
##
##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 | Anzahl 6, bei Fußgänger 10 Lightports", text:en="Number of the first Lightport of the group | Quantity 6 light ports, in case of walking 10 light ports", default=0)
## ##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=1)
##input($speed_hun:int, text:de="Zeit pro Schritt: Hundertstel", text:en="Time per step: Hundredths", default=0)
##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($group_option:int, text:de="Dauer Grünphase", text:en="Length of green phase", default=5)
##input($group_tl_stop:boolean, text:de="Mit Stoppstelle", text:en="With stop location", default=0)
##input($group_stop_port:int, text:de="Port der Stoppstellen (Port, Port+1) | Nur gerade Portnummern (0,2,4,6)", text:en="Port of stop locations (port, port+1) | even port number only (0,2,4,6)", default=0)
##input($group_tl_walk:boolean, text:de="Mit Fußgängerampel", text:en="With walking lights", default=0)
##input($group_tl_yellow:boolean, text:de="Gelb blinkend", text:en="Yellow blinking", default=0)
##input($group_endless:boolean, text:de="Endloser Lauf der Gruppe", text:en="Endless running of the group", default=true)
##input($group_color:boolean, text:de="Benutze RGB-LEDs", text:en="Use RGB-LEDs", default=false)
##input($led_tabval1:int, text:de="Stripe-Pos Ampel Nord Rot", text:en="Stripe position traffic light north red", default=0)
##input($led_tab2:string, text:de="Stripe-Pos Ampel Nord Gelb | Nummer oder +Offset oder -Offset", text:en="Stripe position traffic light north yellow | Number or +Offset or -Offset", default="+1")
##input($led_tab3:string, text:de="Stripe-Pos Ampel Nord Grün | Nummer oder +Offset oder -Offset", text:en="Stripe position traffic light north green | Number or +Offset or -Offset", default="+1")
##input($led_tab4:string, text:de="Stripe-Pos Ampel Ost Rot | Nummer oder +Offset oder -Offset", text:en="Stripe position traffic light east red | Number or +Offset or -Offset", default="+1")
##input($led_tab5:string, text:de="Stripe-Pos Ampel Ost Gelb | Nummer oder +Offset oder -Offset", text:en="Stripe position traffic light east yellow | Number or +Offset or -Offset", default="+1")
##input($led_tab6:string, text:de="Stripe-Pos Ampel Ost Grün | Nummer oder +Offset oder -Offset", text:en="Stripe position traffic light east green | Number or +Offset or -Offset", default="+1")
##input($led_tab7:string, text:de="Stripe-Pos Ampel Süd Rot | Nummer oder +Offset oder -Offset", text:en="Stripe position traffic light south red | Number or +Offset or -Offset", default="+1")
##input($led_tab8:string, text:de="Stripe-Pos Ampel Süd Gelb | Nummer oder +Offset oder -Offset", text:en="Stripe position traffic light south yellow" | Number or +Offset or -Offset, default="+1")
##input($led_tab9:string, text:de="Stripe-Pos Ampel Süd Grün | Nummer oder +Offset oder -Offset", text:en="Stripe position traffic light south green | Number or +Offset or -Offset", default="+1")
##input($led_tab10:string, text:de="Stripe-Pos Ampel West Rot | Nummer oder +Offset oder -Offset", text:en="Stripe position traffic light west red | Number or +Offset or -Offset", default="+1")
##input($led_tab11:string, text:de="Stripe-Pos Ampel West Gelb | Nummer oder +Offset oder -Offset", text:en="Stripe position traffic light west yellow | Number or +Offset or -Offset", default="+1")
##input($led_tab12:string, text:de="Stripe-Pos Ampel West Grün | Nummer oder +Offset oder -Offset", text:en="Stripe position traffic light west green | Number or +Offset or -Offset", default="+1")
##input($led_tab13:string, text:de="Stripe-Pos Fußgänger Nord1 Rot | Nur mit Fußgängerampel | Nummer oder +Offset oder -Offset", text:en="Stripe position walking light north red | Only with walking lights | Number or +Offset or -Offset", default="+1")
##input($led_tab14:string, text:de="Stripe-Pos Fußgänger Nord1 Grün | Nur mit Fußgängerampel | Nummer oder +Offset oder -Offset", text:en="Stripe position walking light north green | Only with walking lights | Number or +Offset or -Offset", default="+1")
##input($led_tab15:string, text:de="Stripe-Pos Fußgänger Nord2 Rot | Nur mit Fußgängerampel | Nummer oder +Offset oder -Offset", text:en="Stripe position walking light north red | Only with walking lights | Number or +Offset or -Offset", default="+1")
##input($led_tab16:string, text:de="Stripe-Pos Fußgänger Nord2 Grün | Nur mit Fußgängerampel | Nummer oder +Offset oder -Offset", text:en="Stripe position walking light north green | Only with walking lights | Number or +Offset or -Offset", default="+1")
##input($led_tab17:string, text:de="Stripe-Pos Fußgänger Ost1 Rot | Nur mit Fußgängerampel | Nummer oder +Offset oder -Offset", text:en="Stripe position walking light east red | Only with walking lights | Number or +Offset or -Offset", default="+1")
##input($led_tab18:string, text:de="Stripe-Pos Fußgänger Ost1 Grün | Nur mit Fußgängerampel | Nummer oder +Offset oder -Offset", text:en="Stripe position walking light east green | Only with walking lights | Number or +Offset or -Offset", default="+1")
##input($led_tab19:string, text:de="Stripe-Pos Fußgänger Ost2 Rot | Nur mit Fußgängerampel | Nummer oder +Offset oder -Offset", text:en="Stripe position walking light east red | Only with walking lights | Number or +Offset or -Offset", default="+1")
##input($led_tab20:string, text:de="Stripe-Pos Fußgänger Ost2 Grün | Nur mit Fußgängerampel | Nummer oder +Offset oder -Offset", text:en="Stripe position walking light east green | Only with walking lights | Number or +Offset or -Offset", default="+1")
##input($led_tab21:string, text:de="Stripe-Pos Fußgänger Süd1 Rot | Nur mit Fußgängerampel | Nummer oder +Offset oder -Offset", text:en="Stripe position walking light south red | Only with walking lights | Number or +Offset or -Offset", default="+1")
##input($led_tab22:string, text:de="Stripe-Pos Fußgänger Süd1 Grün | Nur mit Fußgängerampel | Nummer oder +Offset oder -Offset", text:en="Stripe position walking light south green | Only with walking lights | Number or +Offset or -Offset", default="+1")
##input($led_tab23:string, text:de="Stripe-Pos Fußgänger Süd2 Rot | Nur mit Fußgängerampel | Nummer oder +Offset oder -Offset", text:en="Stripe position walking light south red | Only with walking lights | Number or +Offset or -Offset", default="+1")
##input($led_tab24:string, text:de="Stripe-Pos Fußgänger Süd2 Grün | Nur mit Fußgängerampel | Nummer oder +Offset oder -Offset", text:en="Stripe position walking light south green | Only with walking lights | Number or +Offset or -Offset", default="+1")
##input($led_tab25:string, text:de="Stripe-Pos Fußgänger West1 Rot | Nur mit Fußgängerampel | Nummer oder +Offset oder -Offset", text:en="Stripe position walking light west red | Only with walking lights | Number or +Offset or -Offset", default="+1")
##input($led_tab26:string, text:de="Stripe-Pos Fußgänger West1 Grün | Nur mit Fußgängerampel | Nummer oder +Offset oder -Offset", text:en="Stripe position walking light west green | Only with walking lights | Number or +Offset or -Offset", default="+1")
##input($led_tab27:string, text:de="Stripe-Pos Fußgänger West2 Rot | Nur mit Fußgängerampel | Nummer oder +Offset oder -Offset", text:en="Stripe position walking light west red | Only with walking lights | Number or +Offset or -Offset", default="+1")
##input($led_tab28:string, text:de="Stripe-Pos Fußgänger West2 Grün | Nur mit Fußgängerampel | Nummer oder +Offset oder -Offset", text:en="Stripe position walking light west green | Only with walking lights | Number or +Offset or -Offset", default="+1")
## -------------- 1. Select Target
#if((${vid} == 13) && (${pid} == 129))
## Only for Neo_EWS
#if (($my_group < 0) || ($my_group > 15))
$exceptionThrower.throwUserDefined("Group number must be in the range [0..15]")
#end
#if ($group_tl_stop)
#if (($group_stop_port < 0) || ($group_stop_port > 7))
$exceptionThrower.throwUserDefined("Stop port must be in the range 0,2,4,6")
#end
#if (($group_option < 0) || ($group_option > 63))
$exceptionThrower.throwUserDefined("The length of the green phase must be in the range [0..63]")
#end
#else
#if (($group_option < 0) || ($group_option > 255))
$exceptionThrower.throwUserDefined("The length of the green phase must be in the range [0..255]")
#end
#end
#if (($group_on < 0) || ($group_on > 15))
$exceptionThrower.throwUserDefined("Turn on behavior must be in the range [0..15]")
#end
#if (($group_off < 0) || ($group_off > 15))
$exceptionThrower.throwUserDefined("Turn off behavior must be in the range [0..15]")
#end
## -------------- 2. Define default values
#set($group_mode = 5)
#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)
#set($led_tabval5 = -1)
#set($led_tabval6 = -1)
#set($led_tabval7 = -1)
#set($led_tabval8 = -1)
#set($led_tabval9 = -1)
#set($led_tabval10 = -1)
#set($led_tabval11 = -1)
#set($led_tabval12 = -1)
#set($led_tabval13 = -1)
#set($led_tabval14 = -1)
#set($led_tabval15 = -1)
#set($led_tabval16 = -1)
#set($led_tabval17 = -1)
#set($led_tabval18 = -1)
#set($led_tabval19 = -1)
#set($led_tabval20 = -1)
#set($led_tabval21 = -1)
#set($led_tabval22 = -1)
#set($led_tabval23 = -1)
#set($led_tabval24 = -1)
#set($led_tabval25 = -1)
#set($led_tabval26 = -1)
#set($led_tabval27 = -1)
#set($led_tabval28 = -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
#if($led_tab5.matches("\d+"))
#set($led_tabval5 = $Integer.parseInt($led_tab5))
#elseif($led_tab5.matches("[\+\-]\d+"))
#if($led_tabval4 != -1)
#if($led_tab5.substring(0,1) == "+")
#set($led_tabval5 = $led_tabval4 + $Integer.parseInt($led_tab5.substring(1)))
#else
#set($led_tabval5 = $led_tabval4 - $Integer.parseInt($led_tab5.substring(1)))
#end
#end
#end
#if($led_tab6.matches("\d+"))
#set($led_tabval6 = $Integer.parseInt($led_tab6))
#elseif($led_tab6.matches("[\+\-]\d+"))
#if($led_tabval5 != -1)
#if($led_tab6.substring(0,1) == "+")
#set($led_tabval6 = $led_tabval5 + $Integer.parseInt($led_tab6.substring(1)))
#else
#set($led_tabval6 = $led_tabval5 - $Integer.parseInt($led_tab6.substring(1)))
#end
#end
#end
#if($led_tab7.matches("\d+"))
#set($led_tabval7 = $Integer.parseInt($led_tab7))
#elseif($led_tab7.matches("[\+\-]\d+"))
#if($led_tabval6 != -1)
#if($led_tab7.substring(0,1) == "+")
#set($led_tabval7 = $led_tabval6 + $Integer.parseInt($led_tab7.substring(1)))
#else
#set($led_tabval7 = $led_tabval6 - $Integer.parseInt($led_tab7.substring(1)))
#end
#end
#end
#if($led_tab8.matches("\d+"))
#set($led_tabval8 = $Integer.parseInt($led_tab8))
#elseif($led_tab8.matches("[\+\-]\d+"))
#if($led_tabval7 != -1)
#if($led_tab8.substring(0,1) == "+")
#set($led_tabval8 = $led_tabval7 + $Integer.parseInt($led_tab8.substring(1)))
#else
#set($led_tabval8 = $led_tabval7 - $Integer.parseInt($led_tab8.substring(1)))
#end
#end
#end
#if($led_tab9.matches("\d+"))
#set($led_tabval9 = $Integer.parseInt($led_tab9))
#elseif($led_tab9.matches("[\+\-]\d+"))
#if($led_tabval8 != -1)
#if($led_tab9.substring(0,1) == "+")
#set($led_tabval9 = $led_tabval8 + $Integer.parseInt($led_tab9.substring(1)))
#else
#set($led_tabval9 = $led_tabval8 - $Integer.parseInt($led_tab9.substring(1)))
#end
#end
#end
#if($led_tab10.matches("\d+"))
#set($led_tabval10 = $Integer.parseInt($led_tab10))
#elseif($led_tab10.matches("[\+\-]\d+"))
#if($led_tabval9 != -1)
#if($led_tab10.substring(0,1) == "+")
#set($led_tabval10 = $led_tabval9 + $Integer.parseInt($led_tab10.substring(1)))
#else
#set($led_tabval10 = $led_tabval9 - $Integer.parseInt($led_tab10.substring(1)))
#end
#end
#end
#if($led_tab11.matches("\d+"))
#set($led_tabval11 = $Integer.parseInt($led_tab11))
#elseif($led_tab11.matches("[\+\-]\d+"))
#if($led_tabval10 != -1)
#if($led_tab11.substring(0,1) == "+")
#set($led_tabval11 = $led_tabval10 + $Integer.parseInt($led_tab11.substring(1)))
#else
#set($led_tabval11 = $led_tabval10 - $Integer.parseInt($led_tab11.substring(1)))
#end
#end
#end
#if($led_tab12.matches("\d+"))
#set($led_tabval12 = $Integer.parseInt($led_tab12))
#elseif($led_tab12.matches("[\+\-]\d+"))
#if($led_tabval11 != -1)
#if($led_tab12.substring(0,1) == "+")
#set($led_tabval12 = $led_tabval11 + $Integer.parseInt($led_tab12.substring(1)))
#else
#set($led_tabval12 = $led_tabval11 - $Integer.parseInt($led_tab12.substring(1)))
#end
#end
#end
#if($led_tab13.matches("\d+"))
#set($led_tabval13 = $Integer.parseInt($led_tab13))
#elseif($led_tab13.matches("[\+\-]\d+"))
#if($led_tabval12 != -1)
#if($led_tab13.substring(0,1) == "+")
#set($led_tabval13 = $led_tabval12 + $Integer.parseInt($led_tab13.substring(1)))
#else
#set($led_tabval13 = $led_tabval12 - $Integer.parseInt($led_tab13.substring(1)))
#end
#end
#end
#if($led_tab14.matches("\d+"))
#set($led_tabval14 = $Integer.parseInt($led_tab14))
#elseif($led_tab14.matches("[\+\-]\d+"))
#if($led_tabval13 != -1)
#if($led_tab14.substring(0,1) == "+")
#set($led_tabval14 = $led_tabval13 + $Integer.parseInt($led_tab14.substring(1)))
#else
#set($led_tabval14 = $led_tabval13 - $Integer.parseInt($led_tab14.substring(1)))
#end
#end
#end
#if($led_tab15.matches("\d+"))
#set($led_tabval15 = $Integer.parseInt($led_tab15))
#elseif($led_tab15.matches("[\+\-]\d+"))
#if($led_tabval14 != -1)
#if($led_tab15.substring(0,1) == "+")
#set($led_tabval15 = $led_tabval14 + $Integer.parseInt($led_tab15.substring(1)))
#else
#set($led_tabval15 = $led_tabval14 - $Integer.parseInt($led_tab15.substring(1)))
#end
#end
#end
#if($led_tab16.matches("\d+"))
#set($led_tabval16 = $Integer.parseInt($led_tab16))
#elseif($led_tab16.matches("[\+\-]\d+"))
#if($led_tabval15 != -1)
#if($led_tab16.substring(0,1) == "+")
#set($led_tabval16 = $led_tabval15 + $Integer.parseInt($led_tab16.substring(1)))
#else
#set($led_tabval16 = $led_tabval15 - $Integer.parseInt($led_tab16.substring(1)))
#end
#end
#end
#if($led_tab17.matches("\d+"))
#set($led_tabval17 = $Integer.parseInt($led_tab17))
#elseif($led_tab17.matches("[\+\-]\d+"))
#if($led_tabval16 != -1)
#if($led_tab17.substring(0,1) == "+")
#set($led_tabval17 = $led_tabval16 + $Integer.parseInt($led_tab17.substring(1)))
#else
#set($led_tabval17 = $led_tabval16 - $Integer.parseInt($led_tab17.substring(1)))
#end
#end
#end
#if($led_tab18.matches("\d+"))
#set($led_tabval18 = $Integer.parseInt($led_tab18))
#elseif($led_tab18.matches("[\+\-]\d+"))
#if($led_tabval17 != -1)
#if($led_tab18.substring(0,1) == "+")
#set($led_tabval18 = $led_tabval17 + $Integer.parseInt($led_tab18.substring(1)))
#else
#set($led_tabval18 = $led_tabval17 - $Integer.parseInt($led_tab18.substring(1)))
#end
#end
#end
#if($led_tab19.matches("\d+"))
#set($led_tabval19 = $Integer.parseInt($led_tab19))
#elseif($led_tab19.matches("[\+\-]\d+"))
#if($led_tabval18 != -1)
#if($led_tab19.substring(0,1) == "+")
#set($led_tabval19 = $led_tabval18 + $Integer.parseInt($led_tab19.substring(1)))
#else
#set($led_tabval19 = $led_tabval18 - $Integer.parseInt($led_tab19.substring(1)))
#end
#end
#end
#if($led_tab20.matches("\d+"))
#set($led_tabval20 = $Integer.parseInt($led_tab20))
#elseif($led_tab20.matches("[\+\-]\d+"))
#if($led_tabval19 != -1)
#if($led_tab20.substring(0,1) == "+")
#set($led_tabval20 = $led_tabval19 + $Integer.parseInt($led_tab20.substring(1)))
#else
#set($led_tabval20 = $led_tabval19 - $Integer.parseInt($led_tab20.substring(1)))
#end
#end
#end
#if($led_tab21.matches("\d+"))
#set($led_tabval21 = $Integer.parseInt($led_tab21))
#elseif($led_tab21.matches("[\+\-]\d+"))
#if($led_tabval20 != -1)
#if($led_tab21.substring(0,1) == "+")
#set($led_tabval21 = $led_tabval20 + $Integer.parseInt($led_tab21.substring(1)))
#else
#set($led_tabval21 = $led_tabval20 - $Integer.parseInt($led_tab21.substring(1)))
#end
#end
#end
#if($led_tab22.matches("\d+"))
#set($led_tabval22 = $Integer.parseInt($led_tab22))
#elseif($led_tab22.matches("[\+\-]\d+"))
#if($led_tabval21 != -1)
#if($led_tab22.substring(0,1) == "+")
#set($led_tabval22 = $led_tabval21 + $Integer.parseInt($led_tab22.substring(1)))
#else
#set($led_tabval22 = $led_tabval21 - $Integer.parseInt($led_tab22.substring(1)))
#end
#end
#end
#if($led_tab23.matches("\d+"))
#set($led_tabval23 = $Integer.parseInt($led_tab23))
#elseif($led_tab23.matches("[\+\-]\d+"))
#if($led_tabval22 != -1)
#if($led_tab23.substring(0,1) == "+")
#set($led_tabval23 = $led_tabval22 + $Integer.parseInt($led_tab23.substring(1)))
#else
#set($led_tabval23 = $led_tabval22 - $Integer.parseInt($led_tab23.substring(1)))
#end
#end
#end
#if($led_tab24.matches("\d+"))
#set($led_tabval24 = $Integer.parseInt($led_tab24))
#elseif($led_tab24.matches("[\+\-]\d+"))
#if($led_tabval23 != -1)
#if($led_tab24.substring(0,1) == "+")
#set($led_tabval24 = $led_tabval23 + $Integer.parseInt($led_tab24.substring(1)))
#else
#set($led_tabval24 = $led_tabval23 - $Integer.parseInt($led_tab24.substring(1)))
#end
#end
#end
#if($led_tab25.matches("\d+"))
#set($led_tabval25 = $Integer.parseInt($led_tab25))
#elseif($led_tab25.matches("[\+\-]\d+"))
#if($led_tabval24 != -1)
#if($led_tab25.substring(0,1) == "+")
#set($led_tabval25 = $led_tabval24 + $Integer.parseInt($led_tab25.substring(1)))
#else
#set($led_tabval25 = $led_tabval24 - $Integer.parseInt($led_tab25.substring(1)))
#end
#end
#end
#if($led_tab26.matches("\d+"))
#set($led_tabval26 = $Integer.parseInt($led_tab26))
#elseif($led_tab26.matches("[\+\-]\d+"))
#if($led_tabval25 != -1)
#if($led_tab26.substring(0,1) == "+")
#set($led_tabval26 = $led_tabval25 + $Integer.parseInt($led_tab26.substring(1)))
#else
#set($led_tabval26 = $led_tabval25 - $Integer.parseInt($led_tab26.substring(1)))
#end
#end
#end
#if($led_tab27.matches("\d+"))
#set($led_tabval27 = $Integer.parseInt($led_tab27))
#elseif($led_tab27.matches("[\+\-]\d+"))
#if($led_tabval26 != -1)
#if($led_tab27.substring(0,1) == "+")
#set($led_tabval27 = $led_tabval26 + $Integer.parseInt($led_tab27.substring(1)))
#else
#set($led_tabval27 = $led_tabval26 - $Integer.parseInt($led_tab27.substring(1)))
#end
#end
#end
#if($led_tab28.matches("\d+"))
#set($led_tabval28 = $Integer.parseInt($led_tab28))
#elseif($led_tab28.matches("[\+\-]\d+"))
#if($led_tabval27 != -1)
#if($led_tab28.substring(0,1) == "+")
#set($led_tabval28 = $led_tabval27 + $Integer.parseInt($led_tab28.substring(1)))
#else
#set($led_tabval28 = $led_tabval27 - $Integer.parseInt($led_tab28.substring(1)))
#end
#end
#end
#if(($my_group>=0) && ($my_group<=15) && ($group_stop_port < 7) && ($led_tabval1 >= 0) && ($led_tabval2 >= 0) && ($led_tabval3 >= 0) && ($led_tabval4 >= 0) && ($led_tabval5 >= 0) && ($led_tabval6 >= 0) && ($led_tabval7 >= 0) && ($led_tabval8 >= 0))
## do it only in case the group number is in the allowed range
## Set mode
#if ($group_tl_stop)
#if ($group_tl_walk)
#set($last_led = $start_led + 9)
#if ($group_yellow)
#set($group_mode = 8)
#else
#set($group_mode = 13)
#end
#else
#set($last_led = $start_led + 5)
#if ($group_yellow)
#set($group_mode = 6)
#else
#set($group_mode = 12)
#end
#end
#else
#if ($group_tl_walk)
#set($last_led = $start_led + 9)
#if ($group_yellow)
#set($group_mode = 8)
#else
#set($group_mode = 7)
#end
#else
#set($last_led = $start_led + 5)
#if ($group_yellow)
#set($group_mode = 6)
#else
#set($group_mode = 5)
#end
#end
#end
#if ($last_led >= ${node_light_count})
$exceptionThrower.throwUserDefined("Block of Lightports exceed available quantity, use a lower number for the first light port.")
#end
## do some naming stuff
set switch $my_group name="Group${my_group}_TrafficLight_LP${start_led}-${last_led}"
#set ($i = $start_led)
set light $i name="Group${my_group}_TrafficLight_Light0_N_S_Red"
#set ($i = $i + 1)
set light $i name="Group${my_group}_TrafficLight_Light1_N_S_Yellow"
#set ($i = $i + 1)
set light $i name="Group${my_group}_TrafficLight_Light2_N_S_Green"
#set ($i = $i + 1)
set light $i name="Group${my_group}_TrafficLight_Light3_W_E_Red"
#set ($i = $i + 1)
set light $i name="Group${my_group}_TrafficLight_Light4_W_E_Yellow"
#set ($i = $i + 1)
set light $i name="Group${my_group}_TrafficLight_Light5_W_E_Green"
#set ($i = $i + 1)
#if($group_tl_walk)
set light $i name="Group${my_group}_TrafficLight_Light6_Walk_N_S_Red"
#set ($i = $i + 1)
set light $i name="Group${my_group}_TrafficLight_Light7_Walk_N_S_Green"
#set ($i = $i + 1)
set light $i name="Group${my_group}_TrafficLight_Light8_Walk_W_E_Red"
#set ($i = $i + 1)
set light $i name="Group${my_group}_TrafficLight_Light9_Walk_W_E_Green"
#set ($i = $i + 1)
#end
#if ($group_tl_stop)
#set($group_option = (4*$group_option) + ($group_stop_port/2))
#set($group_stop_port = (2*$group_stop_port) + 16)
set switch $group_stop_port name="Group${my_group}_TrafficLight_Stop_NorthSouth"
#set($group_stop_port = $group_stop_port + 1)
set switch $group_stop_port name="Group${my_group}_TrafficLight_Stop_EastWest"
#end
## 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}
## do color setting if needd
#if ($group_color)
#set($cv_base = $cv_base_lights)
#set($cv_addr = $cv_base + (5 * $start_led))
set CV ${cv_addr} 32
#set($cv_addr = $cv_addr + 5)
set CV ${cv_addr} 69
#set($cv_addr = $cv_addr + 5)
set CV ${cv_addr} 107
#set($cv_addr = $cv_addr + 5)
set CV ${cv_addr} 32
#set($cv_addr = $cv_addr + 5)
set CV ${cv_addr} 69
#set($cv_addr = $cv_addr + 5)
set CV ${cv_addr} 107
#set($cv_addr = $cv_addr + 5)
#if($group_tl_walk)
set CV ${cv_addr} 32
#set($cv_addr = $cv_addr + 5)
set CV ${cv_addr} 107
#set($cv_addr = $cv_addr + 5)
set CV ${cv_addr} 32
#set($cv_addr = $cv_addr + 5)
set CV ${cv_addr} 107
#set($cv_addr = $cv_addr + 5)
#end
#end
## set Stripe position
#if (($led_tabval1 < 0) || ($led_tabval1 > 255))
$exceptionThrower.throwUserDefined("Stripe position must be in the range [0..255]")
#end
#if (($led_tabval7 < 0) || ($led_tabval7 > 255))
$exceptionThrower.throwUserDefined("Stripe position must be in the range [0..255]")
#end
#set($cv_base = $cv_base_mapping)
#set($cv_addr = $cv_base + $led_tabval1)
set CV ${cv_addr} ${start_led}
#set($cv_addr = $cv_base + $led_tabval7)
set CV ${cv_addr} ${start_led}
#if (($led_tabval2 < 0) || ($led_tabval2 > 255))
$exceptionThrower.throwUserDefined("Stripe position must be in the range [0..255]")
#end
#if (($led_tabval8 < 0) || ($led_tabval8 > 255))
$exceptionThrower.throwUserDefined("Stripe position must be in the range [0..255]")
#end
#set($start_led = $start_led + 1)
#set($cv_addr = $cv_base + $led_tabval2)
set CV ${cv_addr} ${start_led}
#set($cv_addr = $cv_base + $led_tabval8)
set CV ${cv_addr} ${start_led}
#if (($led_tabval3 < 0) || ($led_tabval3 > 255))
$exceptionThrower.throwUserDefined("Stripe position must be in the range [0..255]")
#end
#if (($led_tabval9 < 0) || ($led_tabval9 > 255))
$exceptionThrower.throwUserDefined("Stripe position must be in the range [0..255]")
#end
#set($start_led = $start_led + 1)
#set($cv_addr = $cv_base + $led_tabval3)
set CV ${cv_addr} ${start_led}
#set($cv_addr = $cv_base + $led_tabval9)
set CV ${cv_addr} ${start_led}
#if (($led_tabval4 < 0) || ($led_tabval4 > 255))
$exceptionThrower.throwUserDefined("Stripe position must be in the range [0..255]")
#end
#if (($led_tabval10 < 0) || ($led_tabval10 > 255))
$exceptionThrower.throwUserDefined("Stripe position must be in the range [0..255]")
#end
#set($start_led = $start_led + 1)
#set($cv_addr = $cv_base + $led_tabval4)
set CV ${cv_addr} ${start_led}
#set($cv_addr = $cv_base + $led_tabval10)
set CV ${cv_addr} ${start_led}
#if (($led_tabval5 < 0) || ($led_tabval5 > 255))
$exceptionThrower.throwUserDefined("Stripe position must be in the range [0..255]")
#end
#if (($led_tabval11 < 0) || ($led_tabval11 > 255))
$exceptionThrower.throwUserDefined("Stripe position must be in the range [0..255]")
#end
#set($start_led = $start_led + 1)
#set($cv_addr = $cv_base + $led_tabval5)
set CV ${cv_addr} ${start_led}
#set($cv_addr = $cv_base + $led_tabval11)
set CV ${cv_addr} ${start_led}
#if (($led_tabval6 < 0) || ($led_tabval6 > 255))
$exceptionThrower.throwUserDefined("Stripe position must be in the range [0..255]")
#end
#if (($led_tabval12 < 0) || ($led_tabval12 > 255))
$exceptionThrower.throwUserDefined("Stripe position must be in the range [0..255]")
#end
#set($start_led = $start_led + 1)
#set($cv_addr = $cv_base + $led_tabval6)
set CV ${cv_addr} ${start_led}
#set($cv_addr = $cv_base + $led_tabval12)
set CV ${cv_addr} ${start_led}
#if($group_tl_walk)
#if (($led_tabval13 < 0) || ($led_tabval13 > 255))
$exceptionThrower.throwUserDefined("Stripe position must be in the range [0..255]")
#end
#if (($led_tabval21 < 0) || ($led_tabval21 > 255))
$exceptionThrower.throwUserDefined("Stripe position must be in the range [0..255]")
#end
#set($start_led = $start_led + 1)
#set($cv_addr = $cv_base + $led_tabval13)
set CV ${cv_addr} ${start_led}
#set($cv_addr = $cv_base + $led_tabval21)
set CV ${cv_addr} ${start_led}
#if (($led_tabval14 < 0) || ($led_tabval14 > 255))
$exceptionThrower.throwUserDefined("Stripe position must be in the range [0..255]")
#end
#if (($led_tabval22 < 0) || ($led_tabval22 > 255))
$exceptionThrower.throwUserDefined("Stripe position must be in the range [0..255]")
#end
#set($start_led = $start_led + 1)
#set($cv_addr = $cv_base + $led_tabval14)
set CV ${cv_addr} ${start_led}
#set($cv_addr = $cv_base + $led_tabval22)
set CV ${cv_addr} ${start_led}
#if (($led_tabval15 < 0) || ($led_tabval15 > 255))
$exceptionThrower.throwUserDefined("Stripe position must be in the range [0..255]")
#end
#if (($led_tabval23 < 0) || ($led_tabval23 > 255))
$exceptionThrower.throwUserDefined("Stripe position must be in the range [0..255]")
#end
#set($start_led = $start_led + 1)
#set($cv_addr = $cv_base + $led_tabval15)
set CV ${cv_addr} ${start_led}
#set($cv_addr = $cv_base + $led_tabval23)
set CV ${cv_addr} ${start_led}
#if (($led_tabval16 < 0) || ($led_tabval16 > 255))
$exceptionThrower.throwUserDefined("Stripe position must be in the range [0..255]")
#end
#if (($led_tabval24 < 0) || ($led_tabval24 > 255))
$exceptionThrower.throwUserDefined("Stripe position must be in the range [0..255]")
#end
#set($start_led = $start_led + 1)
#set($cv_addr = $cv_base + $led_tabval16)
set CV ${cv_addr} ${start_led}
#set($cv_addr = $cv_base + $led_tabval24)
set CV ${cv_addr} ${start_led}
#if (($led_tabval17 < 0) || ($led_tabval17 > 255))
$exceptionThrower.throwUserDefined("Stripe position must be in the range [0..255]")
#end
#if (($led_tabval25 < 0) || ($led_tabval25 > 255))
$exceptionThrower.throwUserDefined("Stripe position must be in the range [0..255]")
#end
#set($start_led = $start_led + 1)
#set($cv_addr = $cv_base + $led_tabval17)
set CV ${cv_addr} ${start_led}
#set($cv_addr = $cv_base + $led_tabval25)
set CV ${cv_addr} ${start_led}
#if (($led_tabval18 < 0) || ($led_tabval18 > 255))
$exceptionThrower.throwUserDefined("Stripe position must be in the range [0..255]")
#end
#if (($led_tabval26 < 0) || ($led_tabval26 > 255))
$exceptionThrower.throwUserDefined("Stripe position must be in the range [0..255]")
#end
#set($start_led = $start_led + 1)
#set($cv_addr = $cv_base + $led_tabval18)
set CV ${cv_addr} ${start_led}
#set($cv_addr = $cv_base + $led_tabval26)
set CV ${cv_addr} ${start_led}
#if (($led_tabval19 < 0) || ($led_tabval19 > 255))
$exceptionThrower.throwUserDefined("Stripe position must be in the range [0..255]")
#end
#if (($led_tabval27 < 0) || ($led_tabval27 > 255))
$exceptionThrower.throwUserDefined("Stripe position must be in the range [0..255]")
#end
#set($start_led = $start_led + 1)
#set($cv_addr = $cv_base + $led_tabval19)
set CV ${cv_addr} ${start_led}
#set($cv_addr = $cv_base + $led_tabval27)
set CV ${cv_addr} ${start_led}
#if (($led_tabval20 < 0) || ($led_tabval20 > 255))
$exceptionThrower.throwUserDefined("Stripe position must be in the range [0..255]")
#end
#if (($led_tabval28 < 0) || ($led_tabval28 > 255))
$exceptionThrower.throwUserDefined("Stripe position must be in the range [0..255]")
#end
#set($start_led = $start_led + 1)
#set($cv_addr = $cv_base + $led_tabval20)
set CV ${cv_addr} ${start_led}
#set($cv_addr = $cv_base + $led_tabval28)
set CV ${cv_addr} ${start_led}
#end
#end
#end
#######################################