A method for cleaning an endoscope during a surgical procedure performed with a surgical instrument. The method includes: measuring with a processor module an aggregate activation time of the surgical instrument during the surgical procedure; and activating an endoscope cleaning system with the processor module to clean a lens of the surgical instrument after the processor module determines that the measured aggregate activation time of the surgical instrument has reached a target duration.