Wow, you have been busy, nice! just reviewing your code now, it is looking good.
I will do some testing in next couple of days, when the moon overwhelms my data collection efforts.
As an aside, we may need to keep PEC playback in the driver, because the firmware clashes with guiding.
Something more testing may prove to fix, but i have seen a lot of reports of this happening with all iOptron mounts on the cloudy nights forum.
i.e As an solution i was thinking something like this.
Driver does playback of PEC file in a loop, based on the wormcycle.
If guide pluses come in a negotiation happens to see if it is a double count, so ignore the PEC pulse.
This way we completely bypass the chip on the mount. (until iOptron sorts it out the firmware)
This is what EQmod does PEC on the windows driver.
For this to work we should always park the mount and never disengage the cogs.
(I know this is a real pain, unless we can work out a way of finding the start position of the worm gear.)
This must be possible, because GPG guiding works it out. So if we can somehow grab it from there?
Another Option is we as iOptron for a firmware update, which signals the worm gear start.
This should be a small change for them, but it will take some time before it is released.