Potential Stream Class Issue [Solved]


Been a while, but I wanted to open up a general discussion on the stream class, does anyone know of any issues with this class and the Photon? Or any differences existing between the stream class on Core and Photon?

The issue I’m running into is, that the Photon I have runs through my main loop twice hitting a function, func_X, at the end of the loop. After running through func_X the second time my Photon hangs; Serial is not broken, it doesn’t continue to run through the loop, it just stops.

func_X utilizes the stream class, Serial1, and does basic buffer handling, using functions like readBytesUntil() and setTimeout(). Commenting out all parts of func_X that use the stream class removes this hang up and the code functions as normal.

What really spooks me is that I have this same function, func_X, on a Core and experience no issues.The ONLY difference b/n both setups is that the Core’s func_X uses Serial2 and the Photon’s func_X uses Serial1 (hence the bold question above :stuck_out_tongue:)

Can’t post code just yet or I would have. As always , any insight is appreciated, even a point in the right direction. Thank you very much.

What firmware version are you running your Core with? (and the Photon too ;-))

Hey @ScruffR the Core is 4.7 , I also believe the Photon is the same.

Any ideas? I know it’s a long shot.

Not that I’d be aware of any difference in the StreamClass between the two platforms.
But you could always check for yourself as it’s all open source.

On the other hand there might be diferences in the timing and hardware that might contribute here, but it’s hard to tell without seeing your code.
Can you whip up some testcode to reproduce this behaviour?
Maybe it’s even only your personal device that behaves like this.

Yeah I’ll whip up something, hopefully I can get this figured out by the end of the weekend.