Skip to content

Overlapping messages #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
ghost opened this issue Jun 2, 2018 · 3 comments
Open

Overlapping messages #6

ghost opened this issue Jun 2, 2018 · 3 comments

Comments

@ghost
Copy link

ghost commented Jun 2, 2018

On occasion the Serial.read() on my network arduino would get overlapping messages from the Alarm Panel arduino on the Serial.println() when the display message and the status message were really close together on an event change like arming system. The Serial.read() would start getting the Display message and then the Status message would cut in and would get a mixed string of display and status. A quick fix to that was to add Serial.flush(); to the end of each Display and Status message. So far that seems to be working great with no issues. Just thought I would pass that along.

@ghost
Copy link
Author

ghost commented Jun 4, 2018

Stand corrected, the serial.flush() reduced the problem but still getting a random few overlapping messages on the network arduino. Serial console on the first alarm panel aruino is showing just fine so the problem is with the timing on the serial connection to the second arduino when the incoming alarm panel message come in too close together. Seems to only happen on the display message but the overlapping message that cuts in could be a status message or a display message which I think is due to the display message being significantly longer. Still researching this problem.

@markkimsal
Copy link
Contributor

Is the message that cuts in complete and then the original message finishes or do they intertwine?

{F7...}{F2}{...F7}

or

{F7...}{F2...}{...F7}{...F2}{...F7}

@ghost
Copy link
Author

ghost commented Jun 4, 2018

I changed the Json into a much smaller packet so it fits in the 64bit serial limit and to keep it small as possible. Your core structure is the same, just different message format in your Json section.
Here is what proper messages look like.
Display message: LEN: 42 MSG: DFFFFTFTF: DISARMED CHIME Hit * for faults
Status message: LEN: 6 MSG: SFTTTF

Here are some sample collisions.
LEN: 61 MSG: DTFFFTFTT:ARMED ***DTFFFTFTT:ARMED AWAYMay Exit Now 44
LEN: 25 MSG: DTFFFTFTT:ARMED ***SFTTTF
LEN: 61 MSG: DTFFFTFTT:ARMED ***DFFFFTFTF: DISARMED CHIME Hit * for faults
LEN: 61 MSG: DTFFFTFTT:ARMED ***DTFFFTFTT:ARMED AWAYMay Exit Now 42
LEN: 61 MSG: DTFFFTFTT:ARMED ***DTFFFTFTT:ARMED AWAYMay Exit Now 29
LEN: 25 MSG: DTFFFTFTT:ARMED ***SFTTTF

In all cases, the second message cuts into the first message and the first message never completes and the second message takes over and prints in full.
Also interesting to note that it seems to cut in at the same 20th char and we get the first 19 chars of the first message. On the alarm panel arduino, the serial console never ever shows these collisions and the Serial.print is clean and never see any problems. It only happens on the second arduino that is doing the serial1.read() where the collisions happen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant