¿ªÔÆÌåÓý

Locked Re: Arduino CMRI turnout feedback not working properly


 

Bob -

[Sorry for the long post, but I answer your question and I believe find another problem]

First, answering your question:? last message didn't show enough of the monitor output:

Turnout set up as 2-bit PULSED:
12:46:25.269: Transmit ua=1 OB=10 2 0 0 0 0 0? (transmission when I clicked turnout so turnout table now says THROWN)
12:46:25.371: Receive ua=1 IB=0 0 0? (Arduino code sets sensor to INACTIVE based on seeing CMRI bit 1 = 1 from JMRI)
12:46:25.462: Receive ua=1 IB=0 0 0?
12:46:25.535: Receive ua=1 IB=0 0 0?
12:46:25.626: Receive ua=1 IB=0 0 0?
12:46:25.735: Receive ua=1 IB=0 0 0?
12:46:25.775: Transmit ua=1 OB=0 0 0 0 0 0 (second transmission from JMRI - end of "pulse")
12:46:25.868: Receive ua=1 IB=0 0 0? (Arduino code smart enough to make no change)
12:46:25.953: Receive ua=1 IB=0 0 0?
12:46:25.984: Transmit ua=1 OB=1 0 0 0 0 0? (clicked again and turnout table now says CLOSED)
12:46:26.069: Receive ua=1 IB=1 0 0? (Arduino code sets sensor to ACTIVE based on seeing CMRI bit 0 = 1 from JMRI)?
12:46:26.138: Receive ua=1 IB=1 0 0?
12:46:26.209: Receive ua=1 IB=1 0 0?
12:46:26.301: Receive ua=1 IB=1 0 0?
12:46:26.380: Receive ua=1 IB=1 0 0?
12:46:26.470: Receive ua=1 IB=1 0 0?
12:46:26.501: Transmit ua=1 OB=0 0 0 0 0 0 (second transmission from JMRI - end of "pulse")
12:46:26.584: Receive ua=1 IB=1 0 0 (Arduino code smart enough to make no change)
12:46:26.671: Receive ua=1 IB=1 0 0?

so the sensor does change, but to opposite of what would be expected given what the turnout table state shows.? At first I thought this was a bug in s.brackstone's Arduino code (and there still might be - but that is irrelevant to the issue I now find), BUT you prompted me to review the output of the two turnout setups more carefully:? I now see that? when a turnout is set up as pulsed, JMRI uses the opposite bits from when it is set up as steady state..? It seems as if it is using the two bits in the opposite order (although I might have found a different reason below):?
- turnout set up as 2-bit pulsed: when JMRI sends CMRI bit 0=1, tt (turnout table) displays Closed; when sends CMRI bit 1=1, tt displays Thrown??
- turnout set up as 2-bit steady state: when JMRI sends CMRI bit 0=1, tt displays Thrown; when sends CMRI bit 1=1, tt displays Closed.? [This way doesn't make sense to me, but I'll let the monitor speak for itself...]

Here is what the CMRI monitor looks like for a turnout set up as steady state to compare with output above:

Turnout set up as 2-bit STEADY STATE::
12:51:24.786: Transmit ua=1 OB=1 0 0 0 0 0? ?(tt shows THROWN)?
12:51:24.870: Receive ua=1 IB=1 0 0? ?(Arduino code based on CMRI bit 0=1 sets sensor to ACTIVE)
12:51:24.949: Receive ua=1 IB=1 0 0?
...
12:51:25.788: Receive ua=1 IB=1 0 0?
12:51:25.819: Transmit ua=1 OB=10 2 0 0 0 0 0? (tt shows CLOSED)
12:51:25.904: Receive ua=1 IB=0 0 0? (Arduino code based on CMRI bit 1=1 sets sensor to INACTIVE)
12:51:25.988: Receive ua=1 IB=0 0 0?
12:51:26.073: Receive ua=1 IB=0 0 0?

So s.brackstone's Arduino code is behaving consistently (sets sensor Active when CMRI bit 0=1) but the turnout table is showing Thrown in the steady-state output case and Closed in the pulsed output case!

Here is another difference in operation that may give a clue as to what is happening:? regardless of how I set up the turnout, the turnout table shows Unknown when I load it (as expected).? When I first click on the "pulsed" turnout, the table entry changes to Closed but no CMRI transmission happens.? From then on, you see the output as shown in my first example above.? However, when I first click on the "steady state" turnout, the table entry changes to Closed AND a CMRI transmission happens (CMRI bit 1 = 1).? From then on, you see the output as shown in my second example above.? is this possibly what is causing the difference, i.e. sending or not sending that "closed" transmission but changing the tt regardless?

So what s.brackstone's Arduino code does is not really the issue, but rather it is the CMRI transmissions from JMRI that don't seem to correspond to the the entries in the turnout table, at least according to my testing.? Perhaps this is also related to the turnout feedback problem s.brackstone first reported, but I'll leave that investigation to another day...

As for my own layout, I set up my turnouts under CMRI with one-bit (as you had earlier suggested) steady state output?and that works just fine with my Arduino-based turnout control.? But it does seem that there might indeed be an issue with 2-bit turnout setup with JMRI and its CMRI output.

Jerry

P.S.? For my test, I used two different panel files and closed JMRI in between to be sure there was no interaction between the tests.??
___________________________________
jerryg2003@...

Join [email protected] to automatically receive all group messages.