DanNixon / NeoNextion

Arduino library for the Nextion displays
https://dannixon.github.io/NeoNextion
GNU General Public License v2.0
48 stars 34 forks source link

Protect against messages being read out of sync #9

Open DanNixon opened 9 years ago

DanNixon commented 9 years ago

Currently it is possible doe to serial bus issues that messages may start being read out of sync (i.e. FF 66 01 FF FF which should be 66 01 FF FF FF).

Anything the reads from the serial port directly should instead read through poll() which will look for the required header and read ahead to the end of message marker (FF FF FF), since all the serial reading will be done in a single buffer this should eliminate this issue.

(of course the first message to fail will still fail, but subsequent messages should not)

DanNixon commented 9 years ago

The code in the mentioned branch now works on the Teensy (the platform I first noticed this issue) but broke support on Arduino.