Revert "revert: changed if statements to switch. Reverted 'Fixed endless restart bug' hardware problem not software"

This reverts commit 25bbb00c3568260a24a2f64a31fdb3b4c3395367.