Fixed a bug in the calibration state detect

When the PID controller is in calibration mode the output was still
running. It was caused by a local variable being global and being
misused.
Changed the hal for the pic32 path detect

It no longer works like a switch, but rather now works like an activity
checker.