this->set_frequency(0.001);
this->set_reset_delay(100);
this->last_duration = 0;
+ //this->overruns= 0;
this->num_motors= nmotors;
this->active_motors= new StepperMotor*[num_motors];
for (int i = 0; i < num_motors; i++){
// That can happen typically when we change blocks, where more than usual computation is done
// This can be OK, if we take notice of it, which we do now
if( LPC_TIM0->TC > this->period ){ // TODO: remove the size condition
+ //overruns++;
uint32_t start_tc = LPC_TIM0->TC;
uint32_t bm;
for (i = 0, bm = 1; i < num_motors; i++, bm <<= 1)
{
- if( (this->active_motor_bm & bm) && (this->active_motors[i]->fx_ticks_per_step >= this->active_motors[i]->fx_counter) )
- ticks_we_actually_can_skip =
- min(ticks_we_actually_can_skip, (uint32_t)((active_motors[i]->fx_ticks_per_step - active_motors[i]->fx_counter) >> active_motors[i]->fx_shift));
+ if((this->active_motor_bm & bm) != 0) {
+ if(this->active_motors[i]->fx_ticks_per_step > this->active_motors[i]->fx_counter) {
+ ticks_we_actually_can_skip =
+ min(ticks_we_actually_can_skip, (uint32_t)((active_motors[i]->fx_ticks_per_step - active_motors[i]->fx_counter) >> active_motors[i]->fx_shift));
+ }else{
+ ticks_we_actually_can_skip= 0;
+ }
+ }
}
// Adding to MR0 for this time is not enough, we must also increment the counters ourself artificially
this->stepped = 0;
this->fx_ticks_per_step = 0;
this->steps_to_move = 0;
- this->remove_from_active_list_next_reset = false;
this->is_move_finished = false;
this->signal_step = false;
this->step_signal_hook = new Hook();
this->end_hook->call();
// We only need to do this if we were not instructed to move
- // NOTE this is always true
if( this->moving == false ) {
this->update_exit_tick();
}
{
if( !this->moving || this->paused || this->steps_to_move == 0 ) {
// We must exit tick() after setting the pins, no bresenham is done
- //this->remove_from_active_list_next_reset = true;
this->step_ticker->remove_motor_from_active_list(this);
} else {
// We must do the bresenham in tick()
#include "checksumm.h"
#include "PublicData.h"
#include "Gcode.h"
+//#include "StepTicker.h"
#include "modules/tools/temperaturecontrol/TemperatureControlPublicAccess.h"
#include "modules/robot/RobotPublicAccess.h"
AHB0.debug(stream);
AHB1.debug(stream);
}
+
+ //stream->printf("overruns: %lu\n", THEKERNEL->step_ticker->overruns);
}
static uint32_t getDeviceType()