ensure target speed is reached

- in case the motor profile table doesn't contain target speed, add it
  to have accurate scanning resolution
merge-requests/1/head
Stphane Voltz 2014-05-31 07:13:46 +02:00
rodzic 675285ef8d
commit fab55c629d
1 zmienionych plików z 9 dodań i 1 usunięć

Wyświetl plik

@ -1650,7 +1650,7 @@ Motor_Profile *profile;
i=0;
sum=0;
/* first step is used unmodified */
/* first step is always used unmodified */
current=profile->table[0];
/* loop on profile copying and apply step type */
@ -1662,6 +1662,14 @@ Motor_Profile *profile;
current=profile->table[i]>>step_type;
}
/* ensure last step is required speed in case profile doesn't contain it */
if(current!=0 && current<target)
{
slope[i]=target;
sum+=slope[i];
i++;
}
/* range checking */
if(profile->table[i]==0 && DBG_LEVEL >= DBG_warn && current>target)
{