Cleaned up and many code fixes

Code fixes include:
-Preset voltage levels for cutout was calculated for 8-bit ADC. Now
correct for 10-bit ADC
-Some Initilisation fixes
- State machine ensures output pins are correct on each iteration