Merge pull request #112 from FarmBot/scaling_overflow_bug_fix
fix encoder scaling overflow bugpull/119/head
commit
b52b0e4c68
|
@ -106,9 +106,11 @@ long StepperControlEncoder::currentPosition()
|
|||
else
|
||||
{
|
||||
#if defined(FARMDUINO_V14)
|
||||
return position * scalingFactor / 40000 * encoderInvert;
|
||||
floatScalingFactor = scalingFactor / 40000.0;
|
||||
return position * floatScalingFactor * encoderInvert;
|
||||
#endif
|
||||
return position * scalingFactor / 10000 * encoderInvert;
|
||||
floatScalingFactor = scalingFactor / 10000.0;
|
||||
return position * floatScalingFactor * encoderInvert;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -61,6 +61,7 @@ private:
|
|||
// encoder
|
||||
long position;
|
||||
long scalingFactor;
|
||||
float floatScalingFactor;
|
||||
int encoderType;
|
||||
int encoderInvert;
|
||||
|
||||
|
|
Loading…
Reference in New Issue