Implement a watchdog timer that resets the device if the program gets into a weird state. Also main loop should never exit.