Closed pdw-mb closed 3 years ago
Hi, I don't really get why this change is for. Could you explain a little bit in detail?
Have a look at this video and watch the turn signal on the right. Notice the slight flash on the right when the signal on the left turns off. The video only caught it twice, but it actually happens every time.
The signal on the right is activated by +1 on the SBrick output, and the one on the left is activated by -1. This is running a sequence that alternates between -1 and 0. The transition from -1 to 0 causes a brief +ve blip.
BC2 always sets direction = forwards when setting an output to off. Obviously the direction shouldn't make a difference when you're turning an output off, but it does. This patch sets the direction to the last used direction when turning an output off.
I suspect that using "brake" mode on the SBrick would also fix it, but that would change how motors behave.
Fixes #51.
I did a bit of refactoring as using separate variables for the channels was getting a bit unwieldy by the time we have to remember the last output direction.