#include <math.h>
// in steps/sec the default minimum speed (was 20steps/sec hardcoded)
-#define DEFAULT_MINIMUM_ACTUATOR_RATE 20.0F
+float StepperMotor::default_minimum_actuator_rate= 20.0F;
// A StepperMotor represents an actual stepper motor. It is used to generate steps that move the actual motor at a given speed
// TODO : Abstract this into Actuator
steps_per_mm = 1.0F;
max_rate = 50.0F;
- minimum_step_rate = DEFAULT_MINIMUM_ACTUATOR_RATE;
+ minimum_step_rate = default_minimum_actuator_rate;
last_milestone_steps = 0;
last_milestone_mm = 0.0F;
// work is done ! 8t
this->moving = false;
this->steps_to_move = 0;
- this->minimum_step_rate = DEFAULT_MINIMUM_ACTUATOR_RATE;
+ this->minimum_step_rate = default_minimum_actuator_rate;
// signal it to whatever cares 41t 411t
this->end_hook->call();
float steps_per_mm;
float max_rate; // this is not really rate it is in mm/sec, misnamed used in Robot and Extruder
float minimum_step_rate; // this is the minimum step_rate in steps/sec for this motor for this block
+ static float default_minimum_actuator_rate;
volatile int32_t current_position_steps;
int32_t last_milestone_steps;
return;
// The planner passes us factors, we need to transform them in rates
- this->initial_rate = ceil(this->nominal_rate * entryspeed / this->nominal_speed); // (step/s)
- this->final_rate = ceil(this->nominal_rate * exitspeed / this->nominal_speed); // (step/s)
+ this->initial_rate = ceilf(this->nominal_rate * entryspeed / this->nominal_speed); // (step/s)
+ this->final_rate = ceilf(this->nominal_rate * exitspeed / this->nominal_speed); // (step/s)
// How many steps to accelerate and decelerate
float acceleration_per_second = this->rate_delta * THEKERNEL->stepper->get_acceleration_ticks_per_second(); // ( step/s^2)
- int accelerate_steps = ceil( this->estimate_acceleration_distance( this->initial_rate, this->nominal_rate, acceleration_per_second ) );
+ int accelerate_steps = ceilf( this->estimate_acceleration_distance( this->initial_rate, this->nominal_rate, acceleration_per_second ) );
int decelerate_steps = floor( this->estimate_acceleration_distance( this->nominal_rate, this->final_rate, -acceleration_per_second ) );
// Calculate the size of Plateau of Nominal Rate ( during which we don't accelerate nor decelerate, but just cruise )
// have to use intersection_distance() to calculate when to abort acceleration and start braking
// in order to reach the final_rate exactly at the end of this block.
if (plateau_steps < 0) {
- accelerate_steps = ceil(this->intersection_distance(this->initial_rate, this->final_rate, acceleration_per_second, this->steps_event_count));
+ accelerate_steps = ceilf(this->intersection_distance(this->initial_rate, this->final_rate, acceleration_per_second, this->steps_event_count));
accelerate_steps = max( accelerate_steps, 0 ); // Check limits due to numerical round-off
accelerate_steps = min( accelerate_steps, int(this->steps_event_count) );
plateau_steps = 0;
// NOTE: Minimum stepper speed is limited by MINIMUM_STEPS_PER_MINUTE in stepper.c
if( distance > 0.0F ){
block->nominal_speed = rate_mm_s; // (mm/s) Always > 0
- block->nominal_rate = ceil(block->steps_event_count * rate_mm_s / distance); // (step/s) Always > 0
+ block->nominal_rate = ceilf(block->steps_event_count * rate_mm_s / distance); // (step/s) Always > 0
}else{
block->nominal_speed = 0.0F;
block->nominal_rate = 0;
// The Robot converts GCodes into actual movements, and then adds them to the Planner, which passes them to the Conveyor so they can be added to the queue
// It takes care of cutting arcs into segments, same thing for line that are too long
-#define max(a,b) (((a) > (b)) ? (a) : (b))
Robot::Robot()
{
}
break;
- case 205: // M205 Xnnn - set junction deviation, Z - set Z junction deviation, Snnn - Set minimum planner speed
+ case 205: // M205 Xnnn - set junction deviation, Z - set Z junction deviation, Snnn - Set minimum planner speed, Ynnn - set minimum step rate
gcode->mark_as_taken();
if (gcode->has_letter('X')) {
float jd = gcode->get_value('X');
mps = 0.0F;
THEKERNEL->planner->minimum_planner_speed = mps;
}
+ if (gcode->has_letter('Y')) {
+ alpha_stepper_motor->default_minimum_actuator_rate = gcode->get_value('Y');
+ }
break;
case 220: // M220 - speed override percentage
// the faster the travel speed the fewer segments needed
// NOTE rate is mm/sec and we take into account any speed override
float seconds = gcode->millimeters_of_travel / rate_mm_s;
- segments = max(1, ceil(this->delta_segments_per_second * seconds));
+ segments = max(1.0F, ceilf(this->delta_segments_per_second * seconds));
// TODO if we are only moving in Z on a delta we don't really need to segment at all
} else {
if(this->mm_per_line_segment == 0.0F) {
segments = 1; // don't split it up
} else {
- segments = ceil( gcode->millimeters_of_travel / this->mm_per_line_segment);
+ segments = ceilf( gcode->millimeters_of_travel / this->mm_per_line_segment);
}
}
#define STEPPER THEKERNEL->robot->actuators
#define STEPS_PER_MM(a) (STEPPER[a]->get_steps_per_mm())
-#define max(a,b) (((a) > (b)) ? (a) : (b))
-#define min(a,b) (((a) <= (b)) ? (a) : (b))
// Homing States
enum{
#define PI 3.14159265358979F
-#define max(a,b) (((a) > (b)) ? (a) : (b))
/* The extruder module controls a filament extruder for 3D printing: http://en.wikipedia.org/wiki/Fused_deposition_modeling
* It can work in two modes : either the head does not move, and the extruder moves the filament at a specified speed ( SOLO mode here )
}
}
-#define max(a,b) (((a) > (b)) ? (a) : (b))
// Called periodically to change the speed to match acceleration
uint32_t ZProbe::acceleration_tick(uint32_t dummy)
{
#include <string>
#include <math.h>
-#define max(a,b) (((a) > (b)) ? (a) : (b))
-
class AD5206 : public DigipotBase {
public:
AD5206(){
currents[channel]= -1;
return;
}
- current = min( max( current, 0.0L ), 2.0L );
+ current = min( max( current, 0.0F ), 2.0F );
char adresses[6] = { 0x05, 0x03, 0x01, 0x00, 0x02, 0x04 };
currents[channel] = current;
cs.set(0);
}
char current_to_wiper( float current ){
- return char(ceil(float((this->factor*current))));
+ return char(ceilf(float((this->factor*current))));
}
mbed::I2C* i2c;