Update servo gain not for each microprocessor cycle, but after a certain displacement