spindle could not be stopped. Thanks again to Etienne for reporting
This commit is contained in:
parent
cd074bc590
commit
d914089e91
1 changed files with 8 additions and 4 deletions
|
|
@ -36,12 +36,16 @@ void spindle_run(int direction, uint32_t rpm)
|
||||||
{
|
{
|
||||||
if (direction != current_direction) {
|
if (direction != current_direction) {
|
||||||
st_synchronize();
|
st_synchronize();
|
||||||
if(direction >= 0) {
|
if(direction) {
|
||||||
|
if(direction > 0) {
|
||||||
SPINDLE_DIRECTION_PORT &= ~(1<<SPINDLE_DIRECTION_BIT);
|
SPINDLE_DIRECTION_PORT &= ~(1<<SPINDLE_DIRECTION_BIT);
|
||||||
} else {
|
} else {
|
||||||
SPINDLE_DIRECTION_PORT |= 1<<SPINDLE_DIRECTION_BIT;
|
SPINDLE_DIRECTION_PORT |= 1<<SPINDLE_DIRECTION_BIT;
|
||||||
}
|
}
|
||||||
SPINDLE_ENABLE_PORT |= 1<<SPINDLE_ENABLE_BIT;
|
SPINDLE_ENABLE_PORT |= 1<<SPINDLE_ENABLE_BIT;
|
||||||
|
} else {
|
||||||
|
SPINDLE_ENABLE_PORT &= ~(1<<SPINDLE_ENABLE_BIT);
|
||||||
|
}
|
||||||
current_direction = direction;
|
current_direction = direction;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue