Adaptive control of the scanning light beam