Fixed a bug in mode swithcing

- Increased idle signal duration to 100 periods (maybe it could be
less, have to be tested, but 25 periods is not enough)
- Modified switchToMode method implementation (could not figure out why
a simple for loop with modulus calculation do not work)