aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--AT91SAM7S256/Source/d_output.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/AT91SAM7S256/Source/d_output.c b/AT91SAM7S256/Source/d_output.c
index 536e3cc..9d1ed6d 100644
--- a/AT91SAM7S256/Source/d_output.c
+++ b/AT91SAM7S256/Source/d_output.c
@@ -876,16 +876,16 @@ SLONG dOutputFractionalChange(SLONG Value, SWORD *FracError)
/* Apply fractional change in case RegulationTime is different from
* SPEED_TIME. In this case, fractional part is accumulated until it reach
- * one (with "one" being SPEED_TIME). This is use the same principle as the
- * Bresenham algorithm. */
+ * one half (with "one" being SPEED_TIME). This is use the same principle
+ * as the Bresenham algorithm. */
IntegerChange = Value * RegulationTime / SPEED_TIME;
*FracError += Value * RegulationTime % SPEED_TIME;
- if (*FracError > SPEED_TIME)
+ if (*FracError > SPEED_TIME / 2)
{
*FracError -= SPEED_TIME;
IntegerChange++;
}
- else if (*FracError < -SPEED_TIME)
+ else if (*FracError < -SPEED_TIME / 2)
{
*FracError += SPEED_TIME;
IntegerChange--;