Merged the relevant changes from the TimedSwitching Branch.
Added a calibration option and updated the setup algorithm to use this calibration option.
Fixed small errors preventing it from compiling
Added a step function and changed the calibration and startup algorithms a bit.
Rewrote the logic function to also take care of small intervals for the
last state before rolling over to 0.
Complete rewrite of the logic and supporting code.
The encoder is no longer the absolute position. Instead, we calculate on
the fly what the next position to switch should be.
Revolving encoder which seems to work. Sometimes.
Added debug statements to track the system.
Added more debug statements.

Seen problem: The encoder does not correctly give the position
Removed some debug statements and changed startup
Added a method to get the current state for debugging