Massimo replied to the topic 'SX Filterwheel one-way rotation' in the forum. 4 months ago

Hi, thanks a lot for the info.

I wrote to Terry Platt of SX asking for the source code of the Windows program, his answer was: "I don’t have the source to hand but the rotation direction is easily changed. All you need to do is to send the filter position numbers with 128 added for reverse rotation, so if you never do this, the wheel will always rotate anti-clockwise."

So I checked the sxwheel.cpp code and at line 149 I found the instance: "SendWheelMessage(f + 0x80, 0);"
I naively removed the "+ 0x80" which should be + 128 in HEX, recompiled and installed the driver.
And it magically works, rotation is always anti-clockwise.

There is a but, though. For whatever reason, at start-up, after the wheel finishes indexing (i.e. after it completes a full rotation at power on) the first filter switching is random, clockwise or anti-clockwise following the shortest route. Only the initial connection after indexing experiences this. If I disconnect and reconnect from the INDI Control Panel the rotation is always anti-clockwise, but if I disconnect, power down the wheel, power up it, wait for indexing, then the first movement is random... I'm not a coder, I tried a few random things (add + or - 0x80 here and there... but it didn't work.

My solution is that, since after indexing the wheel always (at least for as much as I tried) start at position number 1, I try to always disconnect the wheel with the filter set at position number 1. Then on connection the filter wheel doesn't move and if I then I make the first movement to position 2, it turns anti-clockwise and from there it keeps going that direction.

Surely a INDI wide implementation would remove all this hassle.