DCC++ Software - JMRI

TwinDad Jan 25, 2016

  1. hoyden

    hoyden TrainBoard Supporter

    815
    778
    30
    At power up some sensors actively post their state and other sensors only report when they change state. JMRI won't know the state of the latter sensor until it changes state. I have both on my layout. Same with turnouts. The controller has no prior knowledge of turnout state. I have a single turnout icon that sets all my turnouts to normal.
     
    Scott Eric Catalano likes this.
  2. Gregg

    Gregg TrainBoard Member

    237
    311
    18
    Note that DCC++ Base Station does keep track of the turnouts and sensor settings so it is possible that JMRI could read this upon startup. These settings are reported as part of the <s> command and can be requested at any time during the session.
     
    Scott Eric Catalano and HVT like this.
  3. Ken VanPelt

    Ken VanPelt New Member

    9
    16
    1
    I found a way. In the serial.cpp sketch I added a line (Sensor::status...) to send the current status of the sensors when you power on. It works just fine.

    case '1': // <1>
    /*
    * enables power from the motor shield to the main operations and programming tracks
    *
    * returns: <p1>
    */
    digitalWrite(SIGNAL_ENABLE_PIN_PROG,HIGH);
    digitalWrite(SIGNAL_ENABLE_PIN_MAIN,HIGH);
    INTERFACE.print("<p1>");
    Sensor::status();
    break;
     
  4. TwinDad

    TwinDad TrainBoard Member

    1,844
    551
    34
    Yeah, that's pretty much it... I hadn't set up JMRI to actively query sensor states (or handle the responses to the <s> command explicitly) ... yet ...

    But Ken's modification to the Base Station's power on code will do the trick, too.
     
    sboyer2, Scott Eric Catalano and HVT like this.
  5. Kim Olsen

    Kim Olsen TrainBoard Member

    34
    33
    6
    How can I map arduino output pins in JMRI? I can easily map sensors connected directly to i/o pins and i can assisgn a pin as output in the DCC++ options tab in JMRI, but i can't implement the outputs in the layout planner, they don't show up as either turnouts, lights or signals.
    I would like the output pins to drive some leds (signal) when activated by the occupancy sensor I have connected to the arduino.
     
    Scott Eric Catalano likes this.
  6. Ken VanPelt

    Ken VanPelt New Member

    9
    16
    1
    When you add a sensor using the DCC++ tab it should create an entry in the sensor table in JMRI. Use that sensor to trigger the icon in layout.
     
    Scott Eric Catalano likes this.
  7. Kim Olsen

    Kim Olsen TrainBoard Member

    34
    33
    6
    Yes I got the sensor part working, but i want to assign an output pin on the arduino, so it can light an led, instead of using a signal/accessory decoder. But when i set an output in the DCC++ tab to for example pin 4, it doesnt show up anywhere else in JMRI, so it can't be controlled via JMRI.
    Do I have to link them with a turnout somehow?
     
    Scott Eric Catalano likes this.
  8. TwinDad

    TwinDad TrainBoard Member

    1,844
    551
    34
    I'm sorry... I don't have this very well documented at all, but there is a way.

    In the Turnouts table in JMRI, create a turnout that will correspond to your Arduino's IO pin. Set the hardware address equal to the pin number. Then Edit the turnout. In the Turnout Editing dialog, click on the Feedback tab and set the Feedback mode to EXACT.

    When the Turnout is in EXACT mode, the DCC++ logic in JMRI will use the Output commands to the base station to trigger them, which should do what you want.

    For the record, if you use MONITORING mode, it will use the "predefined Turnout" commands, and in DIRECT mode, it will use the "Stationary Decoder" commands.
     
  9. Kim Olsen

    Kim Olsen TrainBoard Member

    34
    33
    6
    Thank you so much, this was exactly what I was looking for, it works like a charm!

    Kim
     
    Scott Eric Catalano likes this.
  10. TwinDad

    TwinDad TrainBoard Member

    1,844
    551
    34
    Good to hear!
     
    Scott Eric Catalano likes this.
  11. conrailandrew

    conrailandrew TrainBoard Member

    18
    29
    11
    Any progress on the bug where JMRI won't start unless the Base Station is connected?

    Thanks,
    Andrew
     
    Scott Eric Catalano likes this.
  12. TwinDad

    TwinDad TrainBoard Member

    1,844
    551
    34
    No, sorry... we've had some family medical stuff to deal with (everything is fine now) and I haven't been able to work on JMRI lately. It's still on my to-do list.
     
  13. TwinDad

    TwinDad TrainBoard Member

    1,844
    551
    34
    It appears that the disconnected-start-up bug is fixed, though not by me. The fix should be in the next development release, and will be in 4.4 this summer.

    I will also take the opportunity to remind folks there is a simulator interface available if you want to run JMRI disconnected on purpose...
     
  14. sboyer2

    sboyer2 TrainBoard Member

    35
    41
    6
    i cannot get the current meter to work in JMRI ( both 4.3.4 and 4.3.5 haven't tested earlier versions) the window does't even popup, i have to select it in the window list menu, and when it shows up, it is blank.

    not a problem on the DCC++ Hardware, as i can get readings with commands in the serial window of Arduino IDE(1.6.8).

    also i'm in Linux,if this makes a difference.

    just to add here's le console log from JMRI if it helps

    2016-05-03 01:23:54,777 util.Log4JUtil INFO - ****** JMRI log ******* [main]
    2016-05-03 01:23:54,854 util.Log4JUtil INFO - This log is appended to file: /home/sboyer2/.jmri/log/messages.log [main]
    2016-05-03 01:23:54,855 util.Log4JUtil INFO - This log is stored in file: /home/sboyer2/.jmri/log/session.log [main]
    2016-05-03 01:23:54,864 apps.AppsBase INFO - DecoderPro version 4.3.5-R305598e starts under Java 1.8.0_91 at Tue May 03 01:23:54 EDT 2016 [main]
    2016-05-03 01:23:57,074 gui3.Apps3 INFO - Starting with profile SBoyer2NRail.3ea12415 [main]
    2016-05-03 01:23:57,139 node.NodeIdentity INFO - Using jmri-0010C6B0CAB5-3ea12415 as the JMRI Node identity [main]
    2016-05-03 01:23:57,480 serial.DCCppAdapter INFO - /dev/ttyUSB0 port opened at 115200 baud with DTR: true RTS: true DSR: false CTS: false CD: false [main]
    2016-05-03 01:24:00,577 util.FileUtilSupport INFO - File path program: is /home/sboyer2/Desktop/JMRI/ [main]
    2016-05-03 01:24:00,577 util.FileUtilSupport INFO - File path preference: is /home/sboyer2/.jmri/SBoyer2NRail/ [main]
    2016-05-03 01:24:00,578 util.FileUtilSupport INFO - File path profile: is /home/sboyer2/.jmri/SBoyer2NRail/ [main]
    2016-05-03 01:24:00,578 util.FileUtilSupport INFO - File path settings: is /home/sboyer2/.jmri/ [main]
    2016-05-03 01:24:00,579 util.FileUtilSupport INFO - File path home: is /home/sboyer2/ [main]
    2016-05-03 01:24:00,579 util.FileUtilSupport INFO - File path scripts: is /home/sboyer2/Desktop/JMRI/jython/ [main]
    2016-05-03 01:24:07,749 withrottle.UserInterface INFO - Creating new WiThrottle DeviceServer(socket) on port 12090, waiting for incoming connection... [WiThrottleGUIServer]
    2016-05-03 01:24:24,278 ptionhandler.UncaughtExceptionHandler ERROR - Uncaught Exception caught by jmri.util.exceptionhandler.UncaughtExceptionHandler [AWT-EventQueue-0]
    java.lang.NullPointerException
    at javax.swing.ImageIcon.<init>(ImageIcon.java:217)
    at jmri.jmrit.catalog.NamedIcon.<init>(NamedIcon.java:70)
    at jmri.jmrit.ampmeter.AmpMeterFrame.<init>(AmpMeterFrame.java:66)
    at jmri.jmrit.ampmeter.AmpMeterAction.actionPerformed(AmpMeterAction.java:30)
    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
    at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348)
    at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
    at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
    at javax.swing.AbstractButton.doClick(AbstractButton.java:376)
    at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:833)
    at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:877)
    at java.awt.Component.processMouseEvent(Component.java:6535)
    at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
    at java.awt.Component.processEvent(Component.java:6300)
    at java.awt.Container.processEvent(Container.java:2236)
    at java.awt.Component.dispatchEventImpl(Component.java:4891)
    at java.awt.Container.dispatchEventImpl(Container.java:2294)
    at java.awt.Component.dispatchEvent(Component.java:4713)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4888)
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4525)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4466)
    at java.awt.Container.dispatchEventImpl(Container.java:2280)
    at java.awt.Window.dispatchEventImpl(Window.java:2750)
    at java.awt.Component.dispatchEvent(Component.java:4713)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
    at java.awt.EventQueue.access$500(EventQueue.java:97)
    at java.awt.EventQueue$3.run(EventQueue.java:709)
    at java.awt.EventQueue$3.run(EventQueue.java:703)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
    at java.awt.EventQueue$4.run(EventQueue.java:731)
    at java.awt.EventQueue$4.run(EventQueue.java:729)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
     
    Scott Eric Catalano likes this.
  15. esfeld

    esfeld TrainBoard Member

    442
    382
    17
    Twin Dad
    Maybe off topic, but since you are the JMRI expert ......... is there a way to export a Roster to Excel ....... for sorting etc etc?
    Thanks
    Steve F
     
    Scott Eric Catalano likes this.
  16. TwinDad

    TwinDad TrainBoard Member

    1,844
    551
    34
    Hmm... it doesn't appear so, but that would be an interesting feature to add.

    You can sort the roster window in DecoderPro by clicking the labels at the top of the columns.

    But the Roster Export/Import feature is currently designed for sharing rosters between instances of JMRI, not for exporting for other application types.
     
    Scott Eric Catalano likes this.
  17. TwinDad

    TwinDad TrainBoard Member

    1,844
    551
    34
    JMRI 4.4 has just been released.

    FTR, I was not able to fix the current-monitor crash prior to lockdown for the release, due to family and work issues. I hope to have time to get the fix into an early 4.5.x release.

    I apologize for any inconvenience.
     
    HVT, Scott Eric Catalano and sboyer2 like this.
  18. sboyer2

    sboyer2 TrainBoard Member

    35
    41
    6
    i get this under Linux, i don't know if the bug also happens with Winblows or OSX, could this be a "Font" problem? ie: the one selected, might simply not be available on Linux by default?

    Steph!
     
    Scott Eric Catalano likes this.
  19. TwinDad

    TwinDad TrainBoard Member

    1,844
    551
    34
    Something rather like.. the "Font" involved is actually a set of images that is (supposed to be) included in the JMRI package, but the concept is the same. The code is looking for a particular image file in the resources folder and is crashing when it can't find the file. The problem might be as simple as "I forgot to merge the changeset that added the new image file set into the resources path" ... I just haven't had time to look into it.
     
    sboyer2 and Scott Eric Catalano like this.
  20. Kencom

    Kencom TrainBoard Member

    11
    13
    2
    Hi I'm a new member seeking help, hopefully I'm in the right thread. I've been reading the DCC++ and JMRI posts for a few months now and just got my system partially working today but having problems with turnout activation.

    I have latest version of Base Station software on Ardunio Mega with Ardunio Motor board, USB connection to JMRI (4.4-R1ccf76b) running on Win7 laptop. I have my loco running well (sticking with address 3 for now). My turnout motors are all Cobalt IP with built in DCC decoders. I have successfully programmed and operated them all using <a ..> and <T..> string commands to the Base station. I followed TwinDad's instructions to setup for "predefined Turnouts in Base Station" from JMRI PanelPro (TD post #21 of 29Jan16) steps (1)-(8a). I constructed a layout panel using Layout manager and using the turnouts previously defined in the Turnout table.
    I can throw and close turnouts from JMRI using the DCC++ string commands; I can throw and close them using the Turnout control window where you specify the turnout system name and have the two buttons "Throw" and "Close" - that all works OK.

    The problems: (a) when I click on the panel diagram turnout circle to "throw" a turnout that is closed, the corresponding turnout tries to close harder ie move opposite to "throw" direction. (b) when I open the Turnout table and click on the Command button, the turnouts respond with the same symptom. The turnouts have all been set to "Monitoring". I have no sensors or signals set, just trying to get the turnouts responding to the panel diagram. Note that all other functions of DCC++ seem to work ok such as current monitor and power switch. There must be a step in setting up JMRI that I have missed. Any ideas?

    Thanks, GK.
     
    Last edited: Jul 21, 2016
    sboyer2 and Scott Eric Catalano like this.

Share This Page