Add check when resetting bRestoreOnStartup flag to only reset
if the UPS is OK. Otherwise during a power loss it is set and then reset before
getting to the end of the PLC cycle.
This was a result of moving some code that was previously in MAIN to an ACT
and the RETURN command does not work the same. I believe it only returns
from the current act and not the whole code. Originally it was supposed to
prevent the rest of the code from executing in the event of a power failure but
this is no longer the case.