RCP Protocol question  [✔]

Dagnall
Posts: 237
Joined: 15.05.2015, 14:41

Re: RCP Protocol question

Post by Dagnall » 10.01.2019, 21:41

Rob, thanks.
I do monitor <funcmd, and can see when states are changed, but you are incorrect when you say
rjversluis wrote:
10.01.2019, 19:03
You do not need it because you get informed in case something did change.
I hope that this reasoning translates ok :
  • When a RCP throttle (or other tool) is turned on and Rocrail has been running some time, Loco function states may have been previously changed by other throttles or actions.
  • So, When my wifi throttle selects a specific loco to control,
    • I get all the <lcprops data , which include data on the fn=='f0'=="lights" toggled state
    • I can look for <fn fnchanged messages to track any subsequent function changes
    • --- But I have to assume all other function states are "false"
    • ---This is OK for 'Momentary' functions
    • But the throttle cannot see if something else had been previously changed before the throttle was turned on (or can you supply a Crystal Ball?? -o . )
  • Of course, once a loco is selected, the throttle watches it and can monitor any subsequent changes and synchronize its knowledge of that function state.
  • But I miss any function states that were changed BEFORE I started looking at that particular loco

What I have seen is a message that explicitly included all the function states, although I am unsure of exactly how I got it. I suspect it was in response to a badly commanded message, back before I tried to avoid getting "exception messages". From what you said just now there is no way to deliberately (legally??) get this message, so I may have to try and discover how I managed to get it back when I used "illegal" commands...

I will let you know if I make any progress!

Cheers
D

Dagnall
Posts: 237
Joined: 15.05.2015, 14:41

Re: RCP Protocol question

Post by Dagnall » 12.01.2019, 10:59

Rob - Quick question about the Clock and the '<clock ' Message: Typical example below:

Code: Select all

<clock divider="1" hour="9" minute="51" wday="6" mday="12" month="1" year="2019" time="1547286671" temp="20" bri="255" cmd="sync"/>
My question is: In relation to the seconds on the (SUPER) "Swiss style" Clock on Rocview, WHEN do you send this message?
:?: I had assumed that it would be sent when the Seconds hand reached 60. -( to 'Synch', like the Swiss clocks) But I have seen it sent many seconds after that.
:?: If it is sent at semi random times, How can I extract the "RocRail" Seconds from the long 'time' number so I can synchronize to the second with the RocRail Clock?

As usual, many thanks
Dagnall

rjversluis
Site Admin
Posts: 38688
Joined: 10.04.2006, 08:48
Location: Speyer, Germany
Contact:

Re: RCP Protocol question

Post by rjversluis » 12.01.2019, 11:09

this event is broadcasted every model minute.

Dagnall
Posts: 237
Joined: 15.05.2015, 14:41

Re: RCP Protocol question

Post by Dagnall » 12.01.2019, 11:29

Thanks, That is logical and what I expected.
I will explore why it takes so long on my MQTT system to actually get to the node!
(Or I can just show Hrs and Minutes :) )

rjversluis
Site Admin
Posts: 38688
Joined: 10.04.2006, 08:48
Location: Speyer, Germany
Contact:

Re: RCP Protocol question

Post by rjversluis » 12.01.2019, 11:38

Schedules do not need seconds.
Even minutes are too fine scale for most scheduled trains... 8) ("Komme nicht zu spät! Sei punktlich!" (Tom Waits sings 'pünktlich' not correct.))

Dagnall
Posts: 237
Joined: 15.05.2015, 14:41

Re: RCP Protocol question

Post by Dagnall » 12.01.2019, 11:50

I agree, I was just trying to sort a minor issue I had noticed!.. You must be aware by now I do not give up easily :)
What I have found since sending is that if using Real time, the <clock sync can be a few seconds after the clock face seconds reaches 60, but in Fast clock, its always sent right on the minute..

Dagnall
Posts: 237
Joined: 15.05.2015, 14:41

Re: RCP Protocol question

Post by Dagnall » 13.01.2019, 19:55

Rob, what is the definition of the time="1547418526" variable used in Clock, and does it have any direct relationship to the Displayed RocView clock,
Is there a simple way to extract hrs mins and seconds from it? It looks like a seconds count, but from when??
(I am trying to get my clock to work nicely with clock freeze etc..)


Thanks
Dagnall

rjversluis
Site Admin
Posts: 38688
Joined: 10.04.2006, 08:48
Location: Speyer, Germany
Contact:

Re: RCP Protocol question

Post by rjversluis » 13.01.2019, 20:03

Hi Dagnall,

this number is standardised; The C time() function.
The C library function time_t time(time_t *seconds) returns the time since the Epoch (00:00:00 UTC, January 1, 1970), measured in seconds.

Dagnall
Posts: 237
Joined: 15.05.2015, 14:41

Re: RCP Protocol question

Post by Dagnall » 14.01.2019, 18:13

Rob, Hi,
This is a couple of very Trivial points, but may help if anyone else sees a similar issues.

:!: First, I have found that Rocrail runs slightly slower than my PC clock, so it eventually gets quite a long way out of time. I appreciate that Rocrail runs "rocrail time", but it would be nice to have a "synch" with real time option. (Unless I have simply not found it yet :?: )

:!: Second and more important: I have also found that the Rocnet Synch time message is not sending "seconds" in data[7] but is sending Temperature. (Easily tested by changing the temperature in the Clock Service window tool).

I will not bore you with how I found this, but now I know why my Rocnet node seconds were always setting to "20", and not "0" :!:
Assuming this is what you meant to have and not a mistake, it would be nice to have the https://wiki.rocrail.net/doku.php?id=ro ... et-prot-en clock description corrected to save anyone else being equally confused. :) The Rocnet clock message also appears to have a data[9] byte, (seen as 255 on my system), what is that?

Cheers

Dagnall

rjversluis
Site Admin
Posts: 38688
Joined: 10.04.2006, 08:48
Location: Speyer, Germany
Contact:

Re: RCP Protocol question

Post by rjversluis » 14.01.2019, 18:16

thats the clock brightness:

Code: Select all

      rn[RN_PACKET_DATA + 2] = mon+1;
      rn[RN_PACKET_DATA + 3] = mday;
      rn[RN_PACKET_DATA + 4] = hours;
      rn[RN_PACKET_DATA + 5] = mins;
      rn[RN_PACKET_DATA + 6] = temp;
      rn[RN_PACKET_DATA + 7] = wClock.getdivider(node);
      rn[RN_PACKET_DATA + 8] = wClock.getbri(node);

Dagnall
Posts: 237
Joined: 15.05.2015, 14:41

Re: RCP Protocol question  [✔]

Post by Dagnall » 14.01.2019, 18:37

Thanks, and I saw you have updated https://wiki.rocrail.net/doku.php?id=ro ... et-prot-en
Brilliant. :beer: :rr_for_ever: :beer:

Post Reply

Return to “DIY Hardware”