Re: Servos, Ardunios, and JMRI #arduino

Bob Jacobsen
 

If you have a panel file loaded (before the script is run) that has created internal Turnouts with the appropriate user names, then all is well.

However, it’s good to have scripts like this (which can be distributed to others) be more general. When the script calls provideTurnout(..) that will create the turnout if it doesn’t already exist, using the argument as a system name. (It could call getTurnout(..), which will find an existing turnout with that user name or system name, and return None / null if it doesn’t exist already).

So to make the script general, I think it would be best to either use getTurnout and document then should already exist, or use valid system names.

(Some people might want to give _other_ user names, so valid system names might be best, but either is pretty good)

Bob

On Jul 24, 2019, at 1:21 PM, Geoffb <@Geoffb> wrote:

also Bob, your comment:
This script creates internal Turnout objects with names at start with AT and ST. Although it woks for you now, there’s no guarantee that always will. Better would be names like ITAT or ITST, which are the standard form and won’t (possibly) break in the future.
Uses ATxx and STxx as the User names for the internal Turnout objects or they could refer to hardware objects. I would think that User names as an independent alias for internal or hardware references would be "protected" as a system design feature of JMRI in the future, as it seems to be "advertised" as such (as consistent in future releases)?
No? Did I misunderstand?
--
Bob Jacobsen
@BobJacobsen

Join jmriusers@groups.io to automatically receive all group messages.