Your Universal Remote Control Center
RemoteCentral.com
Philips Pronto Professional Forum - View Post
Previous section Next section Up level
Up level
The following page was printed from RemoteCentral.com:

Login:
Pass:
 
 

Topic:
Prontoscript RS232 Issue - ScheduleAfter
This thread has 7 replies. Displaying all posts.
Post 1 made on Saturday May 8, 2021 at 09:36
JohnL28
Long Time Member
Joined:
Posts:
July 2006
40
I have a very strange RS232 issue that I’m hoping someone can help me with. I have thousands of lines of code but I distilled the problem down to two lines:

[other code]
Result1 = Serial.M88.receive(CreateHEX("A5 5B 02 03 07 00 01 00 00 00 00 00 F3"), 50, 300);
[other code]
Result2 = Serial.M.match("VOLM20 \r", "\r", 250);

Serial.M88 is a reference to a Monoprice 8x8 Switch serial port. Serial.M is a reference to a Sharp TV serial port. Both lines work perfectly independently.
When I run this, the 1st line works fine. The volume on the TV does not change.
The only way to fix it is to enclose the 2nd line in a 3-second scheduleAfter and then it works fine.

Given the setup and how much video switching I actually do (5 TVs on a single wall for sports), the 3 seconds is a really long time. Is there a way to run the two lines without having to delay? Any help would be appreciated.
OP | Post 2 made on Monday May 10, 2021 at 18:05
JohnL28
Long Time Member
Joined:
Posts:
July 2006
40
The dreaded 'no responses' and this error is driving me crazy.

If I change the .match statement from an older Sharp TV (Serial.M) to a brand new LG TV (Serial.M2) it switches the volume perfectly without any delays. Very strange.
Post 3 made on Monday May 10, 2021 at 18:19
Lyndel McGee
RC Moderator
Joined:
Posts:
August 2001
12,992
What you have not told us is which Serial ports on the RFX 9600 extender you are using. A long, long time ago, I put up a post about Serial Ports 3 and 4 using a single UART.

The symptoms you are describing sound like exactly how the issue discussed below would appear to the user.

See the 2nd page of this thread.

[Link: remotecentral.com]

Result: You cannot do receives or sends on both at the same time. Note that when you send any data to the RFX for transmission, the receive buffer on the same port is cleared prior to the send. Any data that was there is gone. This can cause issues if you are expecting to do receive loops to capture an event stream coming from a piece of equipment.

Last edited by Lyndel McGee on May 10, 2021 18:32.
Lyndel McGee
Philips Pronto Addict/Beta Tester
OP | Post 4 made on Monday May 10, 2021 at 19:31
JohnL28
Long Time Member
Joined:
Posts:
July 2006
40
Thanks Lyndel. Unfortunately, Serial.M is on Extender 1, Port 4. Serial.M88 is on Extender 6, Port 1. The link you sent was very helpful though and I certainly plan to move a few things around this weekend (1-way stuff on ports 3 & 4 with 2-way on Ports 1 & 2). That is not the case today.

If you can think of anything else that may be causing the issue above, please let me know. Thanks again.
Post 5 made on Monday May 10, 2021 at 20:22
Lyndel McGee
RC Moderator
Joined:
Posts:
August 2001
12,992
Has this ever worked properly? Meaning that you recently upgraded equipment or firmware? Or, is this new development?

Are you using the serial port in asynchronous fashion?

ie.

MySerialPort.onData = function onData(data) {
}

If you are, make sure you also add an onError handler that can receive an error message. Also looking at the diagnostic log of the Pronto might point you in better direction.

Based on your code, I think you are using synchronous operations but need to confirm this.

I have not specifically tested when using multiple extenders but I know for sure on a single extender/pronto pair, this is the case. The cancellation of the operation occurs, i think, inside the TSU9X00.

Here are some more links to maybe help you isolate a bit more.

[Link: remotecentral.com]

[Link: remotecentral.com]

Last edited by Lyndel McGee on May 10, 2021 20:43.
Lyndel McGee
Philips Pronto Addict/Beta Tester
OP | Post 6 made on Tuesday May 11, 2021 at 10:31
JohnL28
Long Time Member
Joined:
Posts:
July 2006
40
I just recently rewrote the code to include the second step, the volume adjustment. Then I noticed it was not working properly.

Thanks for the guidance Lyndell. I'll look at the links and try to figure this out. One quick potentially stupid question -- I'm unclear if I'm using the serial port in asynchronous vs synchronous fashion. Most of the commands I use are straight from the pronto developer guide (eg s.match("MV?\r", "\r", 250)). Is one method preferable to the other?
Post 7 made on Tuesday May 11, 2021 at 15:10
Lyndel McGee
RC Moderator
Joined:
Posts:
August 2001
12,992
If you did not assign an onData and are relying on the return of the .match()/.receive() calls, then you are using synchronous/blocking mode. The advantage to using async mode is that you don't block the Pronto UI while waiting for 300ms for data to come in.


For a serial port, you can assign callback functions such as onData, onError, onTimeout. If you do this which activates asynchronous mode, then .match() and .receive() operations do not have a return value. Instead, the data is delivered to onData by invoking your callback. In cases where a timeout occurs, the onTimeout callback function is called.

See p. 42, Section 8.2.3 Asynchronous operation

of the 1.4 version of the Dev Guide.

Last edited by Lyndel McGee on May 12, 2021 12:44.
Lyndel McGee
Philips Pronto Addict/Beta Tester
OP | Post 8 made on Tuesday May 11, 2021 at 20:01
JohnL28
Long Time Member
Joined:
Posts:
July 2006
40
I did define the onError and onTimeout callback functions, but did not use onData at all. I've looked at that section of the developer's guide probably a hundred times over the years and never picked up on it. Thanks Lyndel for pointing it out.
I have some coding/testing to do over the weekend.


Jump to


Protected Feature Before you can reply to a message...
You must first register for a Remote Central user account - it's fast and free! Or, if you already have an account, please login now.

Please read the following: Unsolicited commercial advertisements are absolutely not permitted on this forum. Other private buy & sell messages should be posted to our Marketplace. For information on how to advertise your service or product click here. Remote Central reserves the right to remove or modify any post that is deemed inappropriate.

Hosting Services by ipHouse