Support for modulated IR sensor

Add code to support sensors that allow the IR output to be modulated, to
reduce the sensitivity to ambient IR. Use M558 P2 command to enable
sensor modulation. Also changed the sensor reading averaging code to
give more consistent z-height seeking.