if (newCmd>oldCmd+rateLimit) newCmd = oldCmd+rateLimit; else if (newCmd<oldCmd-rateLimit) newCmd = oldCmd-rateLimit; oldCmd = newCmd;