extruder: Check the step pin directly.

Flag could get out of sync, with undefined results.
This commit is contained in:
Markus Amsler 2011-02-21 15:52:15 +11:00 committed by Michael Moon
parent 5cf550733d
commit e3672da1cf
1 changed files with 2 additions and 5 deletions

View File

@ -65,13 +65,10 @@ void motor_init(void) {
} }
ISR(PCINT0_vect) { ISR(PCINT0_vect) {
static uint8_t coil_pos, pwm, flag; static uint8_t coil_pos, pwm;
if (flag == 1) flag = 0;
else flag = 1;
//if the step pin is high, we advance the motor //if the step pin is high, we advance the motor
if (flag) { if (READ(E_STEP_PIN)) {
//Turn on motors only on first tick to save power I guess //Turn on motors only on first tick to save power I guess
enable_motors(); enable_motors();