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

data.nodescript.turnouts.DoubleSlip_Maerklin_Servo_iTrain.nodescript Maven / Gradle / Ivy

## Dieses Script erstellt Accessory, Macro und ServoPort für Weichen.
##
## Es wurde nur für die LightControl geschrieben
##
##  
## history: 2020-03-05 A.Kuhtz, V 1.0, changed for one servo with Märklin double slip
##
## -------------- 1. Select Target
##application(text:de="Doppelkreuzungsweiche (Märklin) mit 1 Servo an LightControl (iTrain)", text:en="Double slip (Maerklin) with 1 servo at LightControl (iTrain)", text:nl="Kruiswissel (Dubbele Engelsman) (Maerklin) met 1 Servo op de LightControl (iTrain)")
##instruction(text:de="Konfiguration für Doppelkreuzungsweiche mit 4 Aspekten für 1 Servo.", link="https://forum.opendcc.de/wiki/doku.php?id=konfigvorlagen:turnouts#doppelkreuzungsweiche_mit_servo_an_lightcontrol_itrain")
##instruction(text:en="Configuration of double slip with 4 aspects for 1 servo.", link="https://forum.opendcc.de/wiki/doku.php?id=konfigvorlagen:turnouts#doppelkreuzungsweiche_mit_servo_an_lightcontrol_itrain")
##author(A. Kuhtz)
##
##input($selectedAccessory:accessory, text:de="Nummer des verwendeten Accessory", text:en="Number of the accessory to use", default=0)
##input($macroStraight:macro, text:de="Nummer des ersten Macros (total 2)", text:en="Number of the first macro (total 2)", default=0)
##input($selectedServo:servo, text:de="Nummer des Servo", text:en="Number of the servo port", default=0)

##input($doubleSlipName:string, text:de="Bezeichnung der Kreuzung: ", text:en="Name of the double slip: ", text:nl="Naam van de Kruiswissel: ", default="DKW")

## -------------- 2. set Parameters for Ports

## Makro
#if ($node_macro_count - 2 - $macroStraight  < 0)
 $exceptionThrower.throwUserDefined("zu wenig Makros frei (benötigt: 2)")
#end

## Servo
#if ( ($node_servo_count - $selectedServo) < 1)
 $exceptionThrower.throwUserDefined("zu wenig ServoPorts frei (benötigt: 1)")
#end

#if ($user_lang == "de")
	#set($labelRight = "rechts")
	#set($labelStraight = "gerade")
	#set($labelServo = "Servo")
#elseif ($user_lang == "nl")
	#set($labelRight = "rechtsaf")
	#set($labelStraight = "rechtdoor")
	#set($labelServo = "Servo")
#else
	#set($labelRight = "right")
	#set($labelStraight = "straight")
	#set($labelServo = "Servo")
#end


## -------------- 3. execute part of the script
#set($macroCross = $macroStraight + 1)                ## need some additional macros

## Set label of the accessory
set accessory ${selectedAccessory} name="A$numberTool.format("#00", ${selectedAccessory})-iTr$numberTool.format("#00", ${selectedAccessory}) | M$numberTool.format("#00", ${macroStraight})$numberTool.format("#00", ${macroCross})-SP$numberTool.format("#00", ${selectedServo}) | ${doubleSlipName}"

set aspect 0 accessory=${selectedAccessory} name="A - C"
set aspect 1 accessory=${selectedAccessory} name="A - D"
set aspect 2 accessory=${selectedAccessory} name="B - D"
set aspect 3 accessory=${selectedAccessory} name="B - C"

## Set label of the macro
set macro ${macroStraight} name="M$numberTool.format("#00", ${macroStraight})-SP$numberTool.format("#00", ${selectedServo}) | A - C / B - D"
set macro ${macroCross} name="M$numberTool.format("#00", ${macroStraight})-SP$numberTool.format("#00", ${selectedServo}) | A - D / B - C"

### Set label of ServoPort
set servo ${selectedServo} name="SP$numberTool.format("#00", ${selectedServo}) | ${doubleSlipName}"

################################################
### configure macro
###


### macro A-C / B - D
select macro ${macroStraight}

config macro repeat=1 slowdown=1

add step ptype=macro action=stop number=${macroCross}
add step ptype=servo action=start number=${selectedServo} target=0
add step ptype=moveServoQuery number=${selectedServo}


### macro A-D / B - C
select macro ${macroCross}

config macro repeat=1 slowdown=1

add step ptype=macro action=stop number=${macroStraight}
add step ptype=servo action=start number=${selectedServo} target=100
add step ptype=moveServoQuery number=${selectedServo}

## Define Accessory

select accessory ${selectedAccessory}
add aspect 0 macronumber=$macroStraight
add aspect 1 macronumber=$macroCross
add aspect 2 macronumber=$macroStraight
add aspect 3 macronumber=$macroCross
config accessory startup restore ## restore; none; aspect=1




© 2015 - 2024 Weber Informatics LLC | Privacy Policy