spindle could not be stopped. Thanks again to Etienne for reporting

pull/1/head
Simen Svale Skogsrud 2011-02-25 15:00:47 +01:00
rodzic cd074bc590
commit d914089e91
1 zmienionych plików z 8 dodań i 4 usunięć

Wyświetl plik

@ -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) {
SPINDLE_DIRECTION_PORT &= ~(1<<SPINDLE_DIRECTION_BIT); if(direction > 0) {
SPINDLE_DIRECTION_PORT &= ~(1<<SPINDLE_DIRECTION_BIT);
} else {
SPINDLE_DIRECTION_PORT |= 1<<SPINDLE_DIRECTION_BIT;
}
SPINDLE_ENABLE_PORT |= 1<<SPINDLE_ENABLE_BIT;
} else { } else {
SPINDLE_DIRECTION_PORT |= 1<<SPINDLE_DIRECTION_BIT; SPINDLE_ENABLE_PORT &= ~(1<<SPINDLE_ENABLE_BIT);
} }
SPINDLE_ENABLE_PORT |= 1<<SPINDLE_ENABLE_BIT;
current_direction = direction; current_direction = direction;
} }
} }