Mobile RCP Rocmouse

Dagnall
Posts: 278
Joined: 15.05.2015, 14:41

Re: Mobile Rocmouse

Post by Dagnall » 18.11.2018, 20:09

Still away from home....
But not sure what you mean by rocrail is sending but esp is not receiving.
To get the throttle to find what locos are present, it first sends a command to rocrail, which then sends back lots of data telling the throttle what locos the layout has. The throttle the can display the lock names to let you select one to control.

You must have rocrail set up with a rocnet controller with sub library set to use mqtt transmission. You must have a mqtt broker and set its address in the mqtt settings, with port set to 1883 the esp will need to have the same broker address settings so it can communicate with rocrail, and searches ( or did in early versions, I need to check this). addresses xxx.xxx.xxx.3-49 in sequence looking for the broker. If your broker has an address outside this range you will need to modify the code to allow the esp to find the broker. If you have the arduino serial monitor active when the esp is switched on you should see the search for the broker and then it finding the broker. I have modified some later code to explicitly look for a specific broker address as this speeds up reconnection if there is connection loss. Obviously if you are using this version ( sorry to be vague here) then you must explicitly program the esp with the broker address. I probably need to add some comments about this in my user pages. There are some illustrations in my user pages about the system. If they are not clear enough I will try to improve them when I get back home.
Dagnall

drblack
Posts: 81
Joined: 10.05.2008, 13:02
Location: Quickborn, S-H

Re: Mobile Rocmouse

Post by drblack » 19.11.2018, 21:16

Hi Dagnall,

thanks for all your help.
It was simple and the mistake on my side. I didn't see your comment in MQTT.cpp:

Code: Select all

// put these in pubsubclient.h
#define MQTT_VERSION MQTT_VERSION_3_1 //Rocrail needs to use V 3_1 not 3_1_1 (??)
#define MQTT_MAX_PACKET_SIZE 25000   // lclist is LONG...!
Especially the hint in the first line :shock:
There is a saying in German: "Wer lesen kann, ist klar im Vorteil"
Would tranlsate into something like: Who can read clearly got an advantage. :wink:

Now I can control the locos.

Dagnall
Posts: 278
Joined: 15.05.2015, 14:41

Re: Mobile Rocmouse

Post by Dagnall » 20.11.2018, 20:05

I am super glad that you niw have it working.
Its sometimes very difficult to find why someone has problems, but hopefully people reading these forums can see 'typical' issues and it will help them.

I had forgotten that the pubsubclient needed modification! But I did remember that inhad problems with long messages, and that Rob modified the rocrail code to send each loco separately to help.. Originally he sent All (!) the loco data as a single message, so you were limited to only a very few locos.

I hope you have fun with the throttle!
If you design a case that allows you to hold the board so you do not cover the antenna, let me know!

Dagnall

Dagnall
Posts: 278
Joined: 15.05.2015, 14:41

Re: Mobile Rocmouse

Post by Dagnall » 21.12.2018, 11:29

Rob, +janvanderborden
I have updated my Mobile Rocmouse code so it senses when someone dispatches a loco. (Like a "Proper Throttle").
This works well for me with my April 2018 version of rocrail, but Jan Vanderborden is also testing it, and his rocrail sends a different message over the service info mqtt link.
i see a message as follows:

Code: Select all

<exception text="dispatch loco V200:25" level="16384" id="9999"/>
Jan sees a message

Code: Select all

<exception text="id=NS1200: addr=2, protocol=default, calculated speed=0, command=dispatch V=0, dir=rev, lights=off, throttleid=" level="16384" id="9999"/>
When I "release" I see the "release message",

Code: Select all

<lc id="V200" cmd="release" controlcode="" slavecode="" server="infw03A69B64" dir="true" addr="25" secaddr="0" V="10" placing="true" blockenterside="true" blockenterid="" mode="idle" modereason="" resumeauto="false" manual="false" blockid="" destblockid="" fn="true" runtime="317140" mtime="0" rdate="1545387113" mint="0" throttleid="" active="true" waittime="0" scidx="-1" scheduleid="" tourid="" scheduleinithour="0" train="" trainlen="0" trainweight="0" V_realkmh="0" fifotop="false" image="v200-1.png" imagenr="0" energypercentage="0" lookupschedule="false"/>


Jan seems to see a "<lc id="message similar to mine..

Code: Select all

<lc id="NS1200" cmd="release" controlcode="" slavecode="" server="infw01DBC264" dir="false" addr="2" secaddr="0" V="0" placing="true" blockenterside="true" blockenterid="" mode="stop" modereason="" resumeauto="false" manual="false" standalone="false" blockid="" destblockid="" fn="false" runtime="86118" mtime="0" rdate="1545261622" mint="0" throttleid="" active="true" waittime="0" scidx="-1" scheduleid="" tourid="" scheduleinithour="0" len="0" weight="0" train="" trainlen="0" trainweight="0" V_realkmh="0" fifotop="false" image="" imagenr="0" energypercentage="0" lookupschedule="false" pause="false" consist=""/>
- So,- please- why are the "dispatch commands" different ? :?
Are there different versions of the messages that I should look for?? Are there different language versions?
I am going to update my RR today, but did you change the message formats??

Many thanks
Dagnall
Last edited by Dagnall on 21.12.2018, 11:44, edited 1 time in total.

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

Re: Mobile Rocmouse

Post by rjversluis » 21.12.2018, 11:38

Hi Dagnall,

<exceptions/>
are traces and NO information to use for control.
In your firmware you should ignore them all.

Dagnall
Posts: 278
Joined: 15.05.2015, 14:41

Re: Mobile Rocmouse

Post by Dagnall » 21.12.2018, 12:00

OK, But what message will you send on the service info channel to inform the world of throttle dispatches and releases??

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

Re: Mobile Rocmouse

Post by rjversluis » 21.12.2018, 12:04

this can only be a message which starts with <lc.

Dagnall
Posts: 278
Joined: 15.05.2015, 14:41

Re: Mobile Rocmouse

Post by Dagnall » 21.12.2018, 12:12

Is a "Proper" <lc ...throttle dispatch" message something you could add?

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

Re: Mobile Rocmouse

Post by rjversluis » 21.12.2018, 13:03

Hi Dagnall,

a dispatch command is initiated by a client like Rocview.
Rocrail translate this command for the connected CS.
A client cannot handle a dispatch command.

janvanderborden
Posts: 584
Joined: 06.09.2014, 16:23
Location: Heiloo

Re: Mobile Rocmouse

Post by janvanderborden » 21.12.2018, 13:37

Hi Rob



On the client we give the command Dispatch and search in the MQTT file for the command dispatch.

We are not allowed to use <exception ..... but where can we find the client(rocview) command

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

Re: Mobile Rocmouse

Post by rjversluis » 21.12.2018, 13:55

Hi Jan,

just lurk at the client topic:
https://wiki.rocrail.net/doku.php?id=ro ... tt_service

janvanderborden
Posts: 584
Joined: 06.09.2014, 16:23
Location: Heiloo

Re: Mobile Rocmouse

Post by janvanderborden » 21.12.2018, 14:43

Hi Rob

Rocview is toch ook een client. Als we vanuit rocview een dispatch commando geven verschijnt dat niet in rocrail/service/client we zien het alleen onder rocrail/service/info in de regel <exception en die mogen we niet gebruiken.

Dagnall
Posts: 278
Joined: 15.05.2015, 14:41

Re: Mobile Rocmouse

Post by Dagnall » 21.12.2018, 15:20

rjversluis wrote:
21.12.2018, 13:55
Hi Jan,

just lurk at the client topic:
https://wiki.rocrail.net/doku.php?id=ro ... tt_service
I have been monitoring the service/client mqtt messages, and I see nothing for "dispatch" or "release".

Dagnall

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

Re: Mobile Rocmouse

Post by rjversluis » 21.12.2018, 16:09

I have been monitoring the service/client mqtt messages, and I see nothing for "dispatch" or "release".
If you do not see any, none of the clients have send such a command.

If in Rocview a dispatch command has been issued, the following command ist send:

Code: Select all

<lc id="E03" cmd="dispatch" controlcode="" slavecode="" server="infwFF2946F0"/>

janvanderborden
Posts: 584
Joined: 06.09.2014, 16:23
Location: Heiloo

Re: Mobile Rocmouse

Post by janvanderborden » 21.12.2018, 16:25

Ja Rob

dat is wat we nodig hebben

zou je de MQTT opdracht hier ook kunnen laten zien ?

Post Reply

Return to “DIY Hardware”