trapezoid_adjusted_rate -= current_block->rate_delta;
} else if (trapezoid_adjusted_rate == current_block->rate_delta * 0.5F) {
- for (auto i : THEKERNEL->robot->actuators)
- i->move(i->direction, 0);
- if (current_block)
- current_block->release();
+ for (auto i : THEKERNEL->robot->actuators) i->move(i->direction, 0); // stop motors
+ if (current_block) current_block->release();
+ THEKERNEL->call_event(ON_SPEED_CHANGE, 0); // tell others we stopped
return 0;
+
} else {
trapezoid_adjusted_rate = current_block->rate_delta * 0.5F;
}
return;
}
- // if we are flushing the queue we need to stop the motor when it has decelerated to zero
+ // if we are flushing the queue we need to stop the motor when it has decelerated to zero, we get this call with argumnet == 0 when this happens
// this is what steppermotor does
- if(THEKERNEL->conveyor->is_flushing() && THEKERNEL->stepper->get_trapezoid_adjusted_rate() == this->current_block->rate_delta * 0.5F) {
+ if(argument == 0) {
this->stepper_motor->move(0, 0);
this->current_block->release();
this->current_block = NULL;