Code complete! But...
Your diagram is wrong. Tsk tsk tsk. Please leave the old diagram online, provide a new one with red whereever black/blue occur, and post it below this and I'll link your original as EDIT: Wrong: http... and replace the old one with the new one. Okay? :-)
Basically, the two sequences of unknowns are absolutely identical in sequential state, so it's not possible to determine sync from either of them except by recording primary unknowns seen and on the fourth declaring sync. BUT, that is of SUPER minor benefit as the next positive sync is just after it. I won't bother. Or will I? Not today, anyway. Proof:
Code pushed! Notes:
Combined your two UI commits and gave them a decent comment, ish.
Fixed the logic up.
Added some infrastructure to allow easy build of it.
Tested build works okay on my box (it compiles, it must be okay... ;-))
do this:
git remote add fred-github
git@github.com:fredcooke/freeems-vanilla.git
git fetch fred-github
git checkout mazda-backwards
profit
:-)
Sorry for the delay...