this->direction_bit = 0;
this->remove_from_active_list_next_reset = false;
this->is_move_finished = false;
+ this->signal_step = false;
+ this->step_signal_hook = new Hook();
}
StepperMotor::StepperMotor(Pin* step, Pin* dir, Pin* en) : step_pin(step), dir_pin(dir), en_pin(en) {
this->direction_bit = 0;
this->remove_from_active_list_next_reset = false;
this->is_move_finished = false;
+ this->signal_step = false;
+ this->step_signal_hook = new Hook();
}
// Called a great many times per second, to step if we have to now
// we have moved a step 9t
this->stepped++;
+ // Do we need to signal this step
+ if( this->stepped == this->signal_step_number && this->signal_step ){
+ this->step_signal_hook->call();
+ }
+
// is this move finished ? 11t
if( this->stepped == this->steps_to_move ){
this->is_move_finished = true;
this->fx_counter = 0; // Bresenheim counter
this->stepped = 0;
+ // Do not signal steps until we get instructed to
+ this->signal_step = false;
+
// Starting now we are moving
if( steps > 0 ){
this->moving = true;