Trouble with JMRI/DCC++ Configuration of Lights/Turnouts

Greg Privette Nov 27, 2016

Tags:
  1. Greg Privette

    Greg Privette TrainBoard Member

    12
    11
    8
    I’m exploring JMRI / DCC++ for control of a future layout. To date all I have are an Arduino Mega with motor shield and a Mac. I’ve plugged in LEDs with current limiting resistors to digital outputs 5, 6 and 7 and a jumper from digital 4 to digital pin 13 (per the DCC++ video). All power is from USB at this point.

    My first Tsunami decoder is back-ordered so only using Panel Pro at this point.

    PROBLEMS:

    1) Seems there should be some way to define and store output configurations without manually sending Arduino packets/commands.

    The only way I’ve been able to turn on Arduino Mega LEDs on output pins 5 6 7 is with raw commanding through JMRI/DCC++ :
    1) Z 5 5 1
    2) Z 6 6 1
    3) Z 7 7 1

    Then if I setup the Light table to have 5 6 7 outputs configured, and setup the Turnout table for outputs 5 6 7 (edited to have FEEDBACK = EXACT), I can flip LEDs with clicks on the Cmd Column of the turnout table.

    2) I do a PanelPro File/store/store configuration.. but after a quit/restart, all my previously defined lights and turnouts are gone. I also did an E command to the Arduino to store settings to EPROM in case there was a handshake upon restart before the outputs/turnouts would be displayed – no luck.

    3) Clicking on the invert button in the turnout table doesn’t change the state commanded or the LED illumination for the corresponding output pin.

    I keep re-reading JMRI/DCC++ documentation but can’t make much progress. Either I’m getting old faster than I thought or maybe I should consider a JMRI alternative to commanding DCC++ outputs – hope I’m missing something basic.
     
    Scott Eric Catalano likes this.
  2. Suzie

    Suzie TrainBoard Member

    68
    20
    11
    To save the data you put in the JMRI tables you need to do 'Save Panel', and load the panel back in when you restart JMRI.
     
    Scott Eric Catalano likes this.
  3. Greg Privette

    Greg Privette TrainBoard Member

    12
    11
    8
    Suzie,
    I tried saving as both File/Store/Store Configuration Only To File.... and File/Store/Store Configuration and Panels to File...
    When I start the PanelPro it prompts me for "Use Configuration Profile" and I select the file that I saved in the File/Store... above.

    Is there something else I'm supposed to do?
     
    Scott Eric Catalano likes this.
  4. Suzie

    Suzie TrainBoard Member

    68
    20
    11
    Yes!

    What you have saved is the settings for the connection to your DCC system etc.

    In the PanelPro main screen you get when you start PanelPro from the 'Panels' menu choose 'Save Panels...' which will save all your work. When you restart you can go to the 'Panels' menu and load your saved panel. Just remember to save it whenever you make any changes - there is no prompt to save it when you close PanelPro! You can automatically load a panel as part of the profile if you are keen, but probably not much point yet.

    Suzie x
     
  5. Greg Privette

    Greg Privette TrainBoard Member

    12
    11
    8
    Ahhhh.
    Frustration averted!
    Learn a little more every day.

    I had thought a "panel" was the 2D graphic I drew up and the "configuration" was my table settings.

    Thanks!
     
    Scott Eric Catalano likes this.
  6. Suzie

    Suzie TrainBoard Member

    68
    20
    11
    A 'Panel' is the 2D graphics, but a Panel file holds a whole lot more, and does not have to include an actual panel.
     
  7. Greg Privette

    Greg Privette TrainBoard Member

    12
    11
    8
    New topic (I can't find the "make new thread" button).

    I have the following JMRI PanelPro script (on Mac) that I run on my DCC++ Arduino Mega with 3 LEDs on Digital pins 5,6,7

    import jmri
    from time import sleep

    # loop thru all defined turnouts turning LEDs on
    for toName in turnouts.getSystemNameList().toArray() :
    to = turnouts.getTurnout(toName)
    to.setState(CLOSED)
    print toName + " ON"
    sleep(0.1) #pause for 1/10 second between commands


    sleep(3) #pause for 3 second before switching

    # loop thru all defined turnouts turning LEDs off
    for toName in turnouts.getSystemNameList().toArray() :
    to = turnouts.getTurnout(toName)
    to.setState(THROWN)
    print toName + " OFF"
    sleep(0.1) #pause for 1/10 second between commands

    I expected all 3 LEDs to go ON, a 3 sec wait, and then all go OFF.
    (Initially, I expected them to go OFF then ON since a 1 (+) should turn them ON but will tackle that discrepancy later.)

    What I see (visually) is DCCPPT5 LED going ON, a 3 sec wait and then all flash on for 0.1 sec and go OFF.
    And what I get in the DCC++ Traffic Monitor window is different still:

    12:56:32.577: [packet: Z 5 0] Output Cmd:
    Output ID:
    State: LOW
    12:56:32.578: [Y5 0] Output Command Reply:
    Output Number: 5
    OutputState: CLOSED
    12:56:32.578: [packet: Z 6 0] Output Cmd:
    Output ID:
    State: LOW
    12:56:32.584: [Y6 0] Output Command Reply:
    Output Number: 6
    OutputState: CLOSED
    12:56:32.585: [packet: Z 7 0] Output Cmd:
    Output ID:
    State: LOW
    12:56:32.588: [Y7 0] Output Command Reply:
    Output Number: 7
    OutputState: CLOSED
    12:56:32.590: [packet: Z 5 1] Output Cmd:
    Output ID:
    State: LOW
    12:56:32.594: [Y5 1] Output Command Reply:
    Output Number: 5
    OutputState: THROWN
    12:56:32.598: [packet: Z 6 1] Output Cmd:
    Output ID:
    State: LOW
    12:56:32.601: [Y6 1] Output Command Reply:
    Output Number: 6
    OutputState: THROWN
    12:56:32.608: [packet: Z 7 1] Output Cmd:
    Output ID:
    State: LOW
    12:56:32.608: [Y7 1] Output Command Reply:
    Output Number: 7
    OutputState: THROWN

    This shows all commands going out as fast as they can with no delays - which is also what I see in the Script Output window:
    DCCPPT5 ON
    DCCPPT6 ON
    DCCPPT7 ON
    DCCPPT5 OFF
    DCCPPT6 OFF
    DCCPPT7 OFF

    Where all the text is displayed at the very end of execution. How can all these timing discrepancies be occurring? Have searched online but can't find any similar experience from others.

    Thanks!

    Greg
     
    Scott Eric Catalano likes this.
  8. alexisahmc

    alexisahmc TrainBoard Member

    29
    27
    7
    Sorry, I can't help you. I just wanted to get on record with all of the participants in this forum, that I know nothing about JMRI and I have no intention (for now anyway) to learn it. In the past I used CMRI for a while ( actually I converted CMRI from Visual basic 6.0 to VB.NET. However, only the code which pertains to the SMINI borads)
    Please don't think of me as not willing to participate and only ask for help when I need it.
    Cheers!
    Alexis
     
    Scott Eric Catalano likes this.
  9. Greg Privette

    Greg Privette TrainBoard Member

    12
    11
    8
    I don't know why python sleep doesn't work either (at least on my Mac). But I did find a work-around that functions:

    class setStartup(jmri.jmrit.automat.AbstractAutomaton) :
    def init(self):
    return
    def handle(self):
    self.waitMsec(1000) # time is in milliseconds
    print "Starting... "
    for i in [1, 3, 5]:
    print "i is now " + str(i)
    for j in [1, 2, 3, 4, 5, 6]:
    turnouts.provideTurnout("5").setState(CLOSED)
    self.waitMsec(40)
    turnouts.provideTurnout("6").setState(CLOSED)
    self.waitMsec(40)
    turnouts.provideTurnout("7").setState(CLOSED)
    self.waitMsec(40)
    self.waitMsec(i*100)
    turnouts.provideTurnout("5").setState(THROWN)
    self.waitMsec(40)
    turnouts.provideTurnout("6").setState(THROWN)
    self.waitMsec(40)
    turnouts.provideTurnout("7").setState(THROWN)
    self.waitMsec(40)
    self.waitMsec(i*100)

    print "Done"
    return False # all done, don't repeat again

    setStartup().start() # create one of these, and start it running

    This uses waitMsec() calls from within a class instead of sleep(). I don't know why sleep didn't work. It was in the JMRI distribution - might want to remove files using sleep if it doesn't work on all platforms.

    Thanks for JMRI!
    Greg
     
    Scott Eric Catalano likes this.
  10. lnxlnx

    lnxlnx TrainBoard Member

    24
    20
    7
    Greg
    The button to start a new thread is called "Post New Thread" and on my web browser is just below the search box
     
    Scott Eric Catalano likes this.
  11. alexisahmc

    alexisahmc TrainBoard Member

    29
    27
    7
    You know, I have noticed that when you are viewing the part with all of the available comment pages ( around 78 of them I believe) the 'Post New Thread" option is not there. It shows up when you are in the DCC++ New.
     
  12. Greg Privette

    Greg Privette TrainBoard Member

    12
    11
    8
    Thanks alexisahmc! Whoda thunk. Now I see it.
     
    Scott Eric Catalano likes this.

Share This Page