a sensor for an optical device includes an array of pixels in rows and columns which detect and process illumination falling thereon so as to identify inputs generated by a user on a surface of the optical device . a second reset period of variable length between a black calibration phase and an integration phase occurs in a processing cycle of a frame for each pixel , wherein the length of the second reset period is adjusted based on the ambient light conditions .