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

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

## Dieses Script erstellt Accessory, Macro und ServoPort mit mehr als 2 Positionen.
##  
## history: 2018-08-14 A.Kuhtz, erste Version
##
##
## -------------- 1. Select Target
##application(text:de="Weichenantrieb mit Servo mit mehr als 2 Positionen", text:en="Turnout (servo) for more than 2 positions", text:nl="Wisselaandrijving met Servo met meer dan twee posities", text:fr="Entraînement de point avec servo avec plus de 2 positions")
##instruction(text:de="Konfiguration von Servo für Weichensteuerung mit mehr als 2 Positionen", text:en="Configuration of servo for turnouts with more than 2 positions", text:fr="Configuration du servo pour commande d'interrupteur à plus de 2 positions")
##
##input($AccessoryName:string, text:de="Name des Accessory", text:en="Name of the Accessory", text:fr="Nom de l'accessoire", default="Multipos-Servo")
##input($AccessoryNumber:accessory, text:de="Nummer des verwendeten Accessory", text:en="Number of the used Accessory", text:fr="Numéro de l'accessoire utilisé", default=0)
##input($MacroNumber:macro, text:de="Nummer des ersten Macros (Benötigt = Anzahl Positionen)", text:en="Number of the first macro (total = number of positions)", text:fr="Numéro de la première macro (obligatoire = nombre de positions)", default=0)
##input($ServoPortNumber:servo, text:de="Nummer des ServoPort", text:en="Number of the servo port", text:fr="Numéro de servoport", default=0)
##input($ServoPositionCount:int, text:de="Anzahl der ServoPositionen", text:en="Number of servo positions", text:fr="Nombre de positions de servos", default=2)
##input($ServoName:string, text:de="Name des Servo", text:en="Name of the servo", text:fr="Nom du servo", default="Multipos-Servo")

### -------------- 3. execute part of the script

## calculate the number of macros that are required
#set($macroCount  = $ServoPositionCount - 1)

### Set label of Accessories
set accessory ${AccessoryNumber} name="${AccessoryName}"

### Set label of ServoPort
set servo ${ServoPortNumber} name="${ServoName}"

########################################

#foreach ($currentMacroIndex in [0..$macroCount])

#set($currentMacroNum = $currentMacroIndex + $MacroNumber)

## calculate the target position
#set($targetPosition = $currentMacroIndex *10)
#if ($currentMacroIndex == $macroCount)
#set($targetPosition = 100)
#end

### Set label of Macro
set macro ${currentMacroNum} name="${AccessoryName}_Pos_${currentMacroIndex}"

################################################
### configure macro
###
select macro ${currentMacroNum}
config macro repeat=1 slowdown=1

### stop all macro
#foreach ($macroNum in [0..$macroCount])
#set($stopMacroNum = $macroNum + $MacroNumber)
#if ($stopMacroNum != $currentMacroNum)
add step ptype=macro action=stop number=${stopMacroNum}
#end ## #if
#end ## #foreach
add step ptype=servo action=start target=$targetPosition number=$ServoPortNumber
add step ptype=moveServoQuery number=$ServoPortNumber

#end

### Define Accessory
select accessory ${AccessoryNumber}
#foreach ($currentMacroIndex in [0..$macroCount])

#set($currentMacroNum = $currentMacroIndex + $MacroNumber)

add aspect $currentMacroIndex macronumber=$currentMacroNum
#end




© 2015 - 2024 Weber Informatics LLC | Privacy Policy