HAL_PX4: fixed a scheduler bug that affects UART IO

we need to detect if we are in a timer task using a PID, not a
flag. This is the same type of bug I fixed last week, but now fixed
properly.

The bug could well be the "USB bug" that Craig has been chasing