// This is in highest priority interrupt so cannot be pre-empted
void StepperMotor::step()
{
+ // ignore if we are still processing the end of a block
+ if(this->is_move_finished) return;
+
// output to pins 37t
this->step_pin.set( 1 );
// if an axis stops too soon then we can get a huge number of ticks here which causes problems, so if the number of ticks is too great we ignore them
// example of when this happens is when one axis is going very slow an the min 20steps/sec kicks in, the axis will reach its target much sooner leaving a long gap
// until the end of the block.
- if(ts > 15) ts= 0;
+ // TODO we may need to set this based on the current step rate, trouble is we don't know what that is yet
+ if(ts > 5) ts= 5; // limit to 50us catch up around 1-2 steps
+ else if(ts > 15) ts= 0; // no way to know what the delay was
this->fx_counter= ts*fx_increment;
}else{
this->fx_counter = 0; // set to zero as there was no step last block