SOLVED - Rocpro,srcpd and power

Richard-TX
Posts: 1320
Joined: 10.07.2012, 04:00
Location: Texas, USA
Contact:

SOLVED - Rocpro,srcpd and power

Post by Richard-TX » 13.05.2013, 11:16

Whenever Rocpro sends a POWEROFF to srcpd, it never sends a POWERON even when exiting Rocpro. This causes a out of sync condition with respect to the power indicator on the main Rocview panel.


Rocpro actions that cause a POWEROFF to be sent:

PT ON
PT OFF
Read or Write with POM unchecked.

I am not sure what the intended operation is but I feel that clicking PT OFF or PT ON should cause a POWERON command to be sent to srcpd.

I think that selecting POM should cause a POWERON command to be sent to srcpd on the next CV read or write..


I think that a POWERON should be sent to srcpd when exiting Rocpro assuming that the bus was on when starting Rocpro.
Attachments
plan.xml
(23.82 KiB) Downloaded 87 times
rocrail.ini
(2.53 KiB) Downloaded 86 times
rocrail.004.zip
(5.18 KiB) Downloaded 85 times
Last edited by Richard-TX on 15.05.2013, 16:52, edited 1 time in total.

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

Post by rjversluis » 13.05.2013, 11:35


Richard-TX
Posts: 1320
Joined: 10.07.2012, 04:00
Location: Texas, USA
Contact:

Post by Richard-TX » 13.05.2013, 11:43

Rob,

Can something be done about Rocpro sending poweroff commands to srcpd?

I think it would be perfectly acceptable if Rocpro didn't send any power commands to srcpd no matter what buttons were clicked.

Richard

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

Post by rjversluis » 13.05.2013, 11:49

Richard,

its not Rocpro sending a power off but the srcp library.
I just removed the offending line in revision 5200.

Richard-TX
Posts: 1320
Joined: 10.07.2012, 04:00
Location: Texas, USA
Contact:

Post by Richard-TX » 13.05.2013, 11:49

:well_done: :goodjob: Ver 5200....

You are good!

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

Post by rjversluis » 13.05.2013, 11:51

I think you are the first Rocrail user who is really using SRCP. 8)

Richard-TX
Posts: 1320
Joined: 10.07.2012, 04:00
Location: Texas, USA
Contact:

Post by Richard-TX » 13.05.2013, 17:22

I think I am the first person to really use and stress srcpd.

Uncovered another nasty bug in the srcpd code just last night. Programs don't like it when you stuff more data into memory than what has been malloc'd.

Rocrail is the only full featured software on the planet that does SRCP right.

I view SRCP as something that should have been widely adopted and embraced years ago. I remember when email was done over serial ports and used UUCP() as a transport. SMTP was just an oddity. Now UUCP is a fossil and SMTP is everywhere. Most model railroading systems are still in the UUCP() (RS-232) stage....except Rocrail.

Thanks again Rob for your support and patience.

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

Post by rjversluis » 13.05.2013, 17:27

Hi Richard,

you made it to the quips:
http://wiki.rocrail.net/doku.php?id=quips-all
:-)

Richard-TX
Posts: 1320
Joined: 10.07.2012, 04:00
Location: Texas, USA
Contact:

Post by Richard-TX » 14.05.2013, 02:19

Not sure what to say about that.


I do have one question, Why does Rocpro offset the CV number sent to srcpd by -1? If there is no real reason, then can we have it send the actual number in the dialog box?

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

Post by rjversluis » 14.05.2013, 05:57

Richard-TX wrote:Why does Rocpro offset the CV number sent to srcpd by -1? If there is no real reason, then can we have it send the actual number in the dialog box?
I already explained it in another thread.

Manual starts with CV1 but many Command Station are starting with CV0 which has the same meaning.
Not Rocpro is subtracting one but the CS support library when needed.

I'm not sure if SRCP requires this subtraction...

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

Post by rjversluis » 14.05.2013, 06:19

The valid range for SRCPD seems to be 0-255:

Code: Select all

20130514.071736.379 r9999c cmdrA800 OSRCP    0228 command written: GET 1 SM 3 CV 256 
20130514.071736.380 r9999c cmdrA800 OSRCP    0241 srcp response: 1368508656.380 412 ERROR wrong value 
NMRA range = 1-1024:
http://www.nmra.org/standards/sandrp/pd ... 012_10.pdf

I corrected the range in RocPro to 1-1024. (rev.5204)

Richard-TX
Posts: 1320
Joined: 10.07.2012, 04:00
Location: Texas, USA
Contact:

Post by Richard-TX » 14.05.2013, 15:38

I set the limits on the Rpi driver within srcpd to something a bit more flexible. Each device driver has it's own limits.

command written: SET 2 SM 2344 CV 1022 255
srcp response: 1368536211.547 200 OK


The original authors of srcpd were concerned about memory usage so various definitions are small. (This concern has caused some problems.) I am less concerned about memory usage so I raised the limits to meet most current standards and conventions.


What I may do is to add a new configuration option called cv_num_offset to srcpd. That may help take care of the issue.

Personally I feel that if srcpd is talking to a device and the device's CV numbers are offset by one, then it is up to the srcpd device driver to make that adjustment. It should not be up to the master controller (Rocrail) to make these adjustments or to place limits (within reason). If Rocrail (or any other controller/client) tries to set something out of bounds for any given srcpd device, srcpd will complain and then Rocrail's library will handle it and act accordingly.

For what it's worth.....

Richard

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

Post by rjversluis » 14.05.2013, 15:48

Hi Richard,

I can remove the subtraction in the srcp library; Its not documented that way so I think it should be removed.

Richard-TX
Posts: 1320
Joined: 10.07.2012, 04:00
Location: Texas, USA
Contact:

Post by Richard-TX » 14.05.2013, 16:14

I raised the CV limit on the Rpi driver to 2048.

manual session:
--------------
SET CONNECTIONMODE SRCP command
1368542534.417 202 OK CONNECTIONMODE
go
1368542537.307 200 OK GO 7
get 2 sm 5 cv 2048
1368542607.302 100 INFO 2 SM 5 CV 2048 0
--------------

While in the strict sense CV numbers higher that 1024 (and 0) are not defined at this time by the NMRA, that means nothing more than what it is - "undefined" One day those higher numbers will be defined.

I could certainly place a limit of 1024 on the Rpi driver CV numbers but since I am always have had a problem with limits (think USA speed limits vs the Autobahn) I wanted to see what would happen if I went to 2048. The result? Nothing happened. Srcpd just accepted it and was happy with it.

Having said all that, if Rocrail places a limit of 1024 (1023) on the CV numbers, that is OK by me.

Richard

Richard-TX
Posts: 1320
Joined: 10.07.2012, 04:00
Location: Texas, USA
Contact:

Post by Richard-TX » 14.05.2013, 16:16

rjversluis wrote:Hi Richard,

I can remove the subtraction in the srcp library; Its not documented that way so I think it should be removed.
I agree for two reasons.

1 - it reduces the mental gymnastics implementers have to go through.

2 - it allows for the programming of CV 1024.


Richard

Post Reply

Return to “srcp”