An endoscope includes a light source coupled to emit light, and a lens disposed proximate to a distal tip of the endoscope tube and structured to absorb at least some of the light. A controller is coupled to the light source, and the controller includes logic that when executed by the controller causes the endoscope to perform operations, including adjusting an emission profile of the light source to heat the lens with the light, and heating the lens mitigates formation of fog on the lens.