All Downloads are FREE. Search and download functionalities are using the official Maven repository.
Please wait. This can take some minutes ...
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.
data.nodescript.turnouts.ServoTurnout_with_frog_ST4.nodescript Maven / Gradle / Ivy
## Dieses Script erstellt Accessory, Macro um einen ServoPort mit 2 Schaltern zu steuern.
##
## history: 2020-08-19 A. Kuhtz, erste Version
##
##
## -------------- 1. Select Target
##application(text:de="Weichenantrieb mit Servo mit Herzstückpolarisierung für ST4", text:en="Turnout (servo) with frog polarization for ST4", text:nl="Wisselaandrijving met Servo met frog polarization op de ST4")
##instruction(text:de="Konfiguration von Servo für Weichensteuerung mit Herzstückpolarisierung für ST4", text:en="Configuration of servo for turnouts with frog polarization for ST4")
##
##input($AccessoryName:string, text:de="Name des Accessory: ", text:en="Name of the Accessory: ", default="ST4 Servo")
##input($selectedAccessory:accessory, text:de="Nummer des verwendeten Accessory", text:en="Number of the used Accessory", default=0)
##input($MacroNumber:macro, text:de="Nummer des ersten Macros (Total: 2)", text:en="Number of the first macro (total: 2)", default=0)
##input($ServoPortNumber:servo, text:de="Nummer des ServoPort", text:en="Number of the servo port", default=0)
##input($ServoName:string, text:de="Name des Servo: ", text:en="Name of the servo: ", tooltip:de="Bezeichnung für den Servoport eingeben", tooltip:en="Enter the name of the servo port", default="ST4 Servo")
##input($SwitchPortNumber:switch, text:de="Nummer des Schaltausgang", text:en="Number of the switch port", default=0)
##input($SwitchName:string, text:de="Name des Schaltausgang: ", text:en="Name of the switch port: ", default="Polarisation")
##input($FlipServoPositions:boolean, text:de="Servopositionen invertieren", text:en="Flip the servo positions", tooltip:de="Statt 0% für gerade wird 100% verwendet", tooltip:en="Use 100% for straight instead of 0%", default=false)
##Prüfung auf ST4 von Opendcc
##require(vid="13", pid="130,107")
### -------------- 2. configure variables
#set($targetPosition0 = 0)
#set($targetPosition1 = 100)
#set($macroCount = 2)
#set($macroNumber0 = $MacroNumber)
#set($macroNumber1 = $MacroNumber + 1)
#set($switchPortNumber0 = $SwitchPortNumber)
### -------------- 3. execute part of the script
### Set label of Accessories
set accessory ${selectedAccessory} name="${AccessoryName}"
### Set label of Macro
set macro ${macroNumber0} name="${AccessoryName}_gerade"
set macro ${macroNumber1} name="${AccessoryName}_abzweig"
### Set label of ServoPort
set servo ${ServoPortNumber} name="${ServoName}"
### Set label of SwitchPort
set switch ${switchPortNumber0} name="${SwitchName}"
### Set label of aspect
set aspect 0 accessory=${selectedAccessory} name="${AccessoryName}_gerade"
set aspect 1 accessory=${selectedAccessory} name="${AccessoryName}_abzweig"
################################################
### configure macro
###
### macro straight ###
select macro ${macroNumber0}
wait 30
config macro repeat=1 slowdown=1
add step ptype=macro action=stop number=${macroNumber1}
#if ($FlipServoPositions)
add step ptype=servo action=start target=$targetPosition1 number=$ServoPortNumber
add step ptype=switch delay=60 action=off number=${switchPortNumber0}
#else
add step ptype=servo action=start target=$targetPosition0 number=$ServoPortNumber
add step ptype=switch delay=60 action=on number=${switchPortNumber0}
#end
add step ptype=moveServoQuery number=$ServoPortNumber
wait 50
### macro round ###
select macro ${macroNumber1}
wait 30
config macro repeat=1 slowdown=1
add step ptype=macro action=stop number=${macroNumber0}
#if ($FlipServoPositions)
add step ptype=servo action=start target=$targetPosition0 number=$ServoPortNumber
add step ptype=switch delay=60 action=on number=${switchPortNumber0}
#else
add step ptype=servo action=start target=$targetPosition1 number=$ServoPortNumber
add step ptype=switch delay=60 action=off number=${switchPortNumber0}
#end
add step ptype=moveServoQuery number=$ServoPortNumber
wait 50
### Define Accessory
select accessory ${selectedAccessory}
config accessory startup restore
#set($maxMacroIndex = $macroCount - 1)
#foreach ($currentMacroIndex in [0..$maxMacroIndex])
#set($currentMacroNum = $currentMacroIndex + $MacroNumber)
add aspect $currentMacroIndex macronumber=$currentMacroNum
#end