modified the algorithm of changing motorDuty