Made on-battery check more important than percent check

There was a problem with the original code, where I accidentally
made it always check for percent the battery was at until it
reached the threshold, and only then checked if it's still on
battery power. This made it so that if power was restored to the
UPS before it reached the threshold, the script would keep running,
waiting until it reached the threshold. This fixes the problem.