mirror of
https://github.com/eclipse/upm.git
synced 2025-03-15 04:57:30 +03:00
l298: fix a potential divied-by-zero
Signed-off-by: Jon Trulson <jtrulson@ics.com>
This commit is contained in:
parent
d4b536b593
commit
b314f56c00
@ -238,6 +238,9 @@ void L298::setSpeed(int speed)
|
|||||||
|
|
||||||
if (m_stepper)
|
if (m_stepper)
|
||||||
{
|
{
|
||||||
|
// prevent a possible divide by 0
|
||||||
|
if (!speed)
|
||||||
|
speed = 1;
|
||||||
m_stepDelay = 60 * 1000 / m_stepsPerRev / speed;
|
m_stepDelay = 60 * 1000 / m_stepsPerRev / speed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user