Fixed sleep/switch bug #2

Program now returns from sleep mode once switch is off and resumes when
switch is turned on again.
Merge branch 'Sleepfix'