Improved reiiability and energy use of proximity sensor