Using axis constants

master
Scott Lahteine 10 years ago
parent 39b47ef5b0
commit 07c6b5ab71

@ -116,38 +116,38 @@ void Config_PrintSettings()
SERIAL_ECHO_START; SERIAL_ECHO_START;
SERIAL_ECHOLNPGM("Steps per unit:"); SERIAL_ECHOLNPGM("Steps per unit:");
SERIAL_ECHO_START; SERIAL_ECHO_START;
SERIAL_ECHOPAIR(" M92 X",axis_steps_per_unit[0]); SERIAL_ECHOPAIR(" M92 X",axis_steps_per_unit[X_AXIS]);
SERIAL_ECHOPAIR(" Y",axis_steps_per_unit[1]); SERIAL_ECHOPAIR(" Y",axis_steps_per_unit[Y_AXIS]);
SERIAL_ECHOPAIR(" Z",axis_steps_per_unit[2]); SERIAL_ECHOPAIR(" Z",axis_steps_per_unit[Z_AXIS]);
SERIAL_ECHOPAIR(" E",axis_steps_per_unit[3]); SERIAL_ECHOPAIR(" E",axis_steps_per_unit[E_AXIS]);
SERIAL_ECHOLN(""); SERIAL_ECHOLN("");
SERIAL_ECHO_START; SERIAL_ECHO_START;
#ifdef SCARA #ifdef SCARA
SERIAL_ECHOLNPGM("Scaling factors:"); SERIAL_ECHOLNPGM("Scaling factors:");
SERIAL_ECHO_START; SERIAL_ECHO_START;
SERIAL_ECHOPAIR(" M365 X",axis_scaling[0]); SERIAL_ECHOPAIR(" M365 X",axis_scaling[X_AXIS]);
SERIAL_ECHOPAIR(" Y",axis_scaling[1]); SERIAL_ECHOPAIR(" Y",axis_scaling[Y_AXIS]);
SERIAL_ECHOPAIR(" Z",axis_scaling[2]); SERIAL_ECHOPAIR(" Z",axis_scaling[Z_AXIS]);
SERIAL_ECHOLN(""); SERIAL_ECHOLN("");
SERIAL_ECHO_START; SERIAL_ECHO_START;
#endif #endif
SERIAL_ECHOLNPGM("Maximum feedrates (mm/s):"); SERIAL_ECHOLNPGM("Maximum feedrates (mm/s):");
SERIAL_ECHO_START; SERIAL_ECHO_START;
SERIAL_ECHOPAIR(" M203 X",max_feedrate[0]); SERIAL_ECHOPAIR(" M203 X", max_feedrate[X_AXIS]);
SERIAL_ECHOPAIR(" Y",max_feedrate[1] ); SERIAL_ECHOPAIR(" Y", max_feedrate[Y_AXIS]);
SERIAL_ECHOPAIR(" Z", max_feedrate[2] ); SERIAL_ECHOPAIR(" Z", max_feedrate[Z_AXIS]);
SERIAL_ECHOPAIR(" E", max_feedrate[3]); SERIAL_ECHOPAIR(" E", max_feedrate[E_AXIS]);
SERIAL_ECHOLN(""); SERIAL_ECHOLN("");
SERIAL_ECHO_START; SERIAL_ECHO_START;
SERIAL_ECHOLNPGM("Maximum Acceleration (mm/s2):"); SERIAL_ECHOLNPGM("Maximum Acceleration (mm/s2):");
SERIAL_ECHO_START; SERIAL_ECHO_START;
SERIAL_ECHOPAIR(" M201 X" ,max_acceleration_units_per_sq_second[0] ); SERIAL_ECHOPAIR(" M201 X" ,max_acceleration_units_per_sq_second[X_AXIS] );
SERIAL_ECHOPAIR(" Y" , max_acceleration_units_per_sq_second[1] ); SERIAL_ECHOPAIR(" Y" , max_acceleration_units_per_sq_second[Y_AXIS] );
SERIAL_ECHOPAIR(" Z" ,max_acceleration_units_per_sq_second[2] ); SERIAL_ECHOPAIR(" Z" ,max_acceleration_units_per_sq_second[Z_AXIS] );
SERIAL_ECHOPAIR(" E" ,max_acceleration_units_per_sq_second[3]); SERIAL_ECHOPAIR(" E" ,max_acceleration_units_per_sq_second[E_AXIS]);
SERIAL_ECHOLN(""); SERIAL_ECHOLN("");
SERIAL_ECHO_START; SERIAL_ECHO_START;
SERIAL_ECHOLNPGM("Acceleration: S=acceleration, T=retract acceleration"); SERIAL_ECHOLNPGM("Acceleration: S=acceleration, T=retract acceleration");
@ -170,17 +170,17 @@ SERIAL_ECHOLNPGM("Scaling factors:");
SERIAL_ECHO_START; SERIAL_ECHO_START;
SERIAL_ECHOLNPGM("Home offset (mm):"); SERIAL_ECHOLNPGM("Home offset (mm):");
SERIAL_ECHO_START; SERIAL_ECHO_START;
SERIAL_ECHOPAIR(" M206 X",add_homing[0] ); SERIAL_ECHOPAIR(" M206 X",add_homing[X_AXIS] );
SERIAL_ECHOPAIR(" Y" ,add_homing[1] ); SERIAL_ECHOPAIR(" Y" ,add_homing[Y_AXIS] );
SERIAL_ECHOPAIR(" Z" ,add_homing[2] ); SERIAL_ECHOPAIR(" Z" ,add_homing[Z_AXIS] );
SERIAL_ECHOLN(""); SERIAL_ECHOLN("");
#ifdef DELTA #ifdef DELTA
SERIAL_ECHO_START; SERIAL_ECHO_START;
SERIAL_ECHOLNPGM("Endstop adjustement (mm):"); SERIAL_ECHOLNPGM("Endstop adjustement (mm):");
SERIAL_ECHO_START; SERIAL_ECHO_START;
SERIAL_ECHOPAIR(" M666 X",endstop_adj[0] ); SERIAL_ECHOPAIR(" M666 X",endstop_adj[X_AXIS] );
SERIAL_ECHOPAIR(" Y" ,endstop_adj[1] ); SERIAL_ECHOPAIR(" Y" ,endstop_adj[Y_AXIS] );
SERIAL_ECHOPAIR(" Z" ,endstop_adj[2] ); SERIAL_ECHOPAIR(" Z" ,endstop_adj[Z_AXIS] );
SERIAL_ECHOLN(""); SERIAL_ECHOLN("");
SERIAL_ECHO_START; SERIAL_ECHO_START;
SERIAL_ECHOLNPGM("Delta settings: L=delta_diagonal_rod, R=delta_radius, S=delta_segments_per_second"); SERIAL_ECHOLNPGM("Delta settings: L=delta_diagonal_rod, R=delta_radius, S=delta_segments_per_second");
@ -303,9 +303,9 @@ void Config_ResetDefault()
max_xy_jerk=DEFAULT_XYJERK; max_xy_jerk=DEFAULT_XYJERK;
max_z_jerk=DEFAULT_ZJERK; max_z_jerk=DEFAULT_ZJERK;
max_e_jerk=DEFAULT_EJERK; max_e_jerk=DEFAULT_EJERK;
add_homing[0] = add_homing[1] = add_homing[2] = 0; add_homing[X_AXIS] = add_homing[Y_AXIS] = add_homing[Z_AXIS] = 0;
#ifdef DELTA #ifdef DELTA
endstop_adj[0] = endstop_adj[1] = endstop_adj[2] = 0; endstop_adj[X_AXIS] = endstop_adj[Y_AXIS] = endstop_adj[Z_AXIS] = 0;
delta_radius= DELTA_RADIUS; delta_radius= DELTA_RADIUS;
delta_diagonal_rod= DELTA_DIAGONAL_ROD; delta_diagonal_rod= DELTA_DIAGONAL_ROD;
delta_segments_per_second= DELTA_SEGMENTS_PER_SECOND; delta_segments_per_second= DELTA_SEGMENTS_PER_SECOND;

@ -345,8 +345,8 @@
#define D_FILAMENT 2.85 #define D_FILAMENT 2.85
#define STEPS_MM_E 836 #define STEPS_MM_E 836
#define EXTRUTION_AREA (0.25 * D_FILAMENT * D_FILAMENT * 3.14159) #define EXTRUSION_AREA (0.25 * D_FILAMENT * D_FILAMENT * 3.14159)
#define STEPS_PER_CUBIC_MM_E (axis_steps_per_unit[E_AXIS]/ EXTRUTION_AREA) #define STEPS_PER_CUBIC_MM_E (axis_steps_per_unit[E_AXIS]/ EXTRUSION_AREA)
#endif // ADVANCE #endif // ADVANCE

@ -1537,7 +1537,7 @@ void process_commands()
#ifdef SCARA #ifdef SCARA
current_position[X_AXIS]=code_value(); current_position[X_AXIS]=code_value();
#else #else
current_position[X_AXIS]=code_value()+add_homing[0]; current_position[X_AXIS]=code_value()+add_homing[X_AXIS];
#endif #endif
} }
} }
@ -1547,7 +1547,7 @@ void process_commands()
#ifdef SCARA #ifdef SCARA
current_position[Y_AXIS]=code_value(); current_position[Y_AXIS]=code_value();
#else #else
current_position[Y_AXIS]=code_value()+add_homing[1]; current_position[Y_AXIS]=code_value()+add_homing[Y_AXIS];
#endif #endif
} }
} }
@ -1612,7 +1612,7 @@ void process_commands()
if(code_seen(axis_codes[Z_AXIS])) { if(code_seen(axis_codes[Z_AXIS])) {
if(code_value_long() != 0) { if(code_value_long() != 0) {
current_position[Z_AXIS]=code_value()+add_homing[2]; current_position[Z_AXIS]=code_value()+add_homing[Z_AXIS];
} }
} }
#ifdef ENABLE_AUTO_BED_LEVELING #ifdef ENABLE_AUTO_BED_LEVELING
@ -2745,9 +2745,9 @@ Sigma_Exit:
SERIAL_PROTOCOLLN(""); SERIAL_PROTOCOLLN("");
SERIAL_PROTOCOLPGM("SCARA Cal - Theta:"); SERIAL_PROTOCOLPGM("SCARA Cal - Theta:");
SERIAL_PROTOCOL(delta[X_AXIS]+add_homing[0]); SERIAL_PROTOCOL(delta[X_AXIS]+add_homing[X_AXIS]);
SERIAL_PROTOCOLPGM(" Psi+Theta (90):"); SERIAL_PROTOCOLPGM(" Psi+Theta (90):");
SERIAL_PROTOCOL(delta[Y_AXIS]-delta[X_AXIS]-90+add_homing[1]); SERIAL_PROTOCOL(delta[Y_AXIS]-delta[X_AXIS]-90+add_homing[Y_AXIS]);
SERIAL_PROTOCOLLN(""); SERIAL_PROTOCOLLN("");
SERIAL_PROTOCOLPGM("SCARA step Cal - Theta:"); SERIAL_PROTOCOLPGM("SCARA step Cal - Theta:");
@ -2883,11 +2883,11 @@ Sigma_Exit:
#ifdef SCARA #ifdef SCARA
if(code_seen('T')) // Theta if(code_seen('T')) // Theta
{ {
add_homing[0] = code_value() ; add_homing[X_AXIS] = code_value() ;
} }
if(code_seen('P')) // Psi if(code_seen('P')) // Psi
{ {
add_homing[1] = code_value() ; add_homing[Y_AXIS] = code_value() ;
} }
#endif #endif
break; break;
@ -3275,11 +3275,11 @@ Sigma_Exit:
//SERIAL_ECHOLN(" Soft endstops disabled "); //SERIAL_ECHOLN(" Soft endstops disabled ");
if(Stopped == false) { if(Stopped == false) {
//get_coordinates(); // For X Y Z E F //get_coordinates(); // For X Y Z E F
delta[0] = 0; delta[X_AXIS] = 0;
delta[1] = 120; delta[Y_AXIS] = 120;
calculate_SCARA_forward_Transform(delta); calculate_SCARA_forward_Transform(delta);
destination[0] = delta[0]/axis_scaling[X_AXIS]; destination[X_AXIS] = delta[X_AXIS]/axis_scaling[X_AXIS];
destination[1] = delta[1]/axis_scaling[Y_AXIS]; destination[Y_AXIS] = delta[Y_AXIS]/axis_scaling[Y_AXIS];
prepare_move(); prepare_move();
//ClearToSend(); //ClearToSend();
@ -3293,11 +3293,11 @@ Sigma_Exit:
//SERIAL_ECHOLN(" Soft endstops disabled "); //SERIAL_ECHOLN(" Soft endstops disabled ");
if(Stopped == false) { if(Stopped == false) {
//get_coordinates(); // For X Y Z E F //get_coordinates(); // For X Y Z E F
delta[0] = 90; delta[X_AXIS] = 90;
delta[1] = 130; delta[Y_AXIS] = 130;
calculate_SCARA_forward_Transform(delta); calculate_SCARA_forward_Transform(delta);
destination[0] = delta[0]/axis_scaling[X_AXIS]; destination[X_AXIS] = delta[X_AXIS]/axis_scaling[X_AXIS];
destination[1] = delta[1]/axis_scaling[Y_AXIS]; destination[Y_AXIS] = delta[Y_AXIS]/axis_scaling[Y_AXIS];
prepare_move(); prepare_move();
//ClearToSend(); //ClearToSend();
@ -3310,11 +3310,11 @@ Sigma_Exit:
//SERIAL_ECHOLN(" Soft endstops disabled "); //SERIAL_ECHOLN(" Soft endstops disabled ");
if(Stopped == false) { if(Stopped == false) {
//get_coordinates(); // For X Y Z E F //get_coordinates(); // For X Y Z E F
delta[0] = 60; delta[X_AXIS] = 60;
delta[1] = 180; delta[Y_AXIS] = 180;
calculate_SCARA_forward_Transform(delta); calculate_SCARA_forward_Transform(delta);
destination[0] = delta[0]/axis_scaling[X_AXIS]; destination[X_AXIS] = delta[X_AXIS]/axis_scaling[X_AXIS];
destination[1] = delta[1]/axis_scaling[Y_AXIS]; destination[Y_AXIS] = delta[Y_AXIS]/axis_scaling[Y_AXIS];
prepare_move(); prepare_move();
//ClearToSend(); //ClearToSend();
@ -3327,11 +3327,11 @@ Sigma_Exit:
//SERIAL_ECHOLN(" Soft endstops disabled "); //SERIAL_ECHOLN(" Soft endstops disabled ");
if(Stopped == false) { if(Stopped == false) {
//get_coordinates(); // For X Y Z E F //get_coordinates(); // For X Y Z E F
delta[0] = 50; delta[X_AXIS] = 50;
delta[1] = 90; delta[Y_AXIS] = 90;
calculate_SCARA_forward_Transform(delta); calculate_SCARA_forward_Transform(delta);
destination[0] = delta[0]/axis_scaling[X_AXIS]; destination[X_AXIS] = delta[X_AXIS]/axis_scaling[X_AXIS];
destination[1] = delta[1]/axis_scaling[Y_AXIS]; destination[Y_AXIS] = delta[Y_AXIS]/axis_scaling[Y_AXIS];
prepare_move(); prepare_move();
//ClearToSend(); //ClearToSend();
@ -3344,11 +3344,11 @@ Sigma_Exit:
//SERIAL_ECHOLN(" Soft endstops disabled "); //SERIAL_ECHOLN(" Soft endstops disabled ");
if(Stopped == false) { if(Stopped == false) {
//get_coordinates(); // For X Y Z E F //get_coordinates(); // For X Y Z E F
delta[0] = 45; delta[X_AXIS] = 45;
delta[1] = 135; delta[Y_AXIS] = 135;
calculate_SCARA_forward_Transform(delta); calculate_SCARA_forward_Transform(delta);
destination[0] = delta[0]/axis_scaling[X_AXIS]; destination[X_AXIS] = delta[X_AXIS]/axis_scaling[X_AXIS];
destination[1] = delta[1]/axis_scaling[Y_AXIS]; destination[Y_AXIS] = delta[Y_AXIS]/axis_scaling[Y_AXIS];
prepare_move(); prepare_move();
//ClearToSend(); //ClearToSend();
@ -4020,9 +4020,9 @@ for (int s = 1; s <= steps; s++) {
calculate_delta(destination); calculate_delta(destination);
//SERIAL_ECHOPGM("destination[0]="); SERIAL_ECHOLN(destination[0]); //SERIAL_ECHOPGM("destination[X_AXIS]="); SERIAL_ECHOLN(destination[X_AXIS]);
//SERIAL_ECHOPGM("destination[1]="); SERIAL_ECHOLN(destination[1]); //SERIAL_ECHOPGM("destination[Y_AXIS]="); SERIAL_ECHOLN(destination[Y_AXIS]);
//SERIAL_ECHOPGM("destination[2]="); SERIAL_ECHOLN(destination[2]); //SERIAL_ECHOPGM("destination[Z_AXIS]="); SERIAL_ECHOLN(destination[Z_AXIS]);
//SERIAL_ECHOPGM("delta[X_AXIS]="); SERIAL_ECHOLN(delta[X_AXIS]); //SERIAL_ECHOPGM("delta[X_AXIS]="); SERIAL_ECHOLN(delta[X_AXIS]);
//SERIAL_ECHOPGM("delta[Y_AXIS]="); SERIAL_ECHOLN(delta[Y_AXIS]); //SERIAL_ECHOPGM("delta[Y_AXIS]="); SERIAL_ECHOLN(delta[Y_AXIS]);
//SERIAL_ECHOPGM("delta[Z_AXIS]="); SERIAL_ECHOLN(delta[Z_AXIS]); //SERIAL_ECHOPGM("delta[Z_AXIS]="); SERIAL_ECHOLN(delta[Z_AXIS]);

@ -353,8 +353,8 @@
#define D_FILAMENT 1.75 #define D_FILAMENT 1.75
#define STEPS_MM_E 1000 #define STEPS_MM_E 1000
#define EXTRUTION_AREA (0.25 * D_FILAMENT * D_FILAMENT * 3.14159) #define EXTRUSION_AREA (0.25 * D_FILAMENT * D_FILAMENT * 3.14159)
#define STEPS_PER_CUBIC_MM_E (axis_steps_per_unit[E_AXIS]/ EXTRUTION_AREA) #define STEPS_PER_CUBIC_MM_E (axis_steps_per_unit[E_AXIS]/ EXTRUSION_AREA)
#endif // ADVANCE #endif // ADVANCE

@ -340,8 +340,8 @@
#define D_FILAMENT 2.85 #define D_FILAMENT 2.85
#define STEPS_MM_E 836 #define STEPS_MM_E 836
#define EXTRUTION_AREA (0.25 * D_FILAMENT * D_FILAMENT * 3.14159) #define EXTRUSION_AREA (0.25 * D_FILAMENT * D_FILAMENT * 3.14159)
#define STEPS_PER_CUBIC_MM_E (axis_steps_per_unit[E_AXIS]/ EXTRUTION_AREA) #define STEPS_PER_CUBIC_MM_E (axis_steps_per_unit[E_AXIS]/ EXTRUSION_AREA)
#endif // ADVANCE #endif // ADVANCE

@ -344,8 +344,8 @@
#define D_FILAMENT 2.85 #define D_FILAMENT 2.85
#define STEPS_MM_E 836 #define STEPS_MM_E 836
#define EXTRUTION_AREA (0.25 * D_FILAMENT * D_FILAMENT * 3.14159) #define EXTRUSION_AREA (0.25 * D_FILAMENT * D_FILAMENT * 3.14159)
#define STEPS_PER_CUBIC_MM_E (axis_steps_per_unit[E_AXIS]/ EXTRUTION_AREA) #define STEPS_PER_CUBIC_MM_E (axis_steps_per_unit[E_AXIS]/ EXTRUSION_AREA)
#endif // ADVANCE #endif // ADVANCE

@ -63,9 +63,9 @@
//=========================================================================== //===========================================================================
unsigned long minsegmenttime; unsigned long minsegmenttime;
float max_feedrate[4]; // set the max speeds float max_feedrate[NUM_AXIS]; // set the max speeds
float axis_steps_per_unit[4]; float axis_steps_per_unit[NUM_AXIS];
unsigned long max_acceleration_units_per_sq_second[4]; // Use M201 to override by software unsigned long max_acceleration_units_per_sq_second[NUM_AXIS]; // Use M201 to override by software
float minimumfeedrate; float minimumfeedrate;
float acceleration; // Normal acceleration mm/s^2 THIS IS THE DEFAULT ACCELERATION for all moves. M204 SXXXX float acceleration; // Normal acceleration mm/s^2 THIS IS THE DEFAULT ACCELERATION for all moves. M204 SXXXX
float retract_acceleration; // mm/s^2 filament pull-pack and push-forward while standing still in the other axis M204 TXXXX float retract_acceleration; // mm/s^2 filament pull-pack and push-forward while standing still in the other axis M204 TXXXX
@ -85,8 +85,8 @@ matrix_3x3 plan_bed_level_matrix = {
#endif // #ifdef ENABLE_AUTO_BED_LEVELING #endif // #ifdef ENABLE_AUTO_BED_LEVELING
// The current position of the tool in absolute steps // The current position of the tool in absolute steps
long position[4]; //rescaled from extern when axis_steps_per_unit are changed by gcode long position[NUM_AXIS]; //rescaled from extern when axis_steps_per_unit are changed by gcode
static float previous_speed[4]; // Speed of previous path line segment static float previous_speed[NUM_AXIS]; // Speed of previous path line segment
static float previous_nominal_speed; // Nominal speed of previous path line segment static float previous_nominal_speed; // Nominal speed of previous path line segment
#ifdef AUTOTEMP #ifdef AUTOTEMP
@ -989,7 +989,7 @@ block->steps_y = labs((target[X_AXIS]-position[X_AXIS]) - (target[Y_AXIS]-positi
else { else {
long acc_dist = estimate_acceleration_distance(0, block->nominal_rate, block->acceleration_st); long acc_dist = estimate_acceleration_distance(0, block->nominal_rate, block->acceleration_st);
float advance = (STEPS_PER_CUBIC_MM_E * EXTRUDER_ADVANCE_K) * float advance = (STEPS_PER_CUBIC_MM_E * EXTRUDER_ADVANCE_K) *
(current_speed[E_AXIS] * current_speed[E_AXIS] * EXTRUTION_AREA * EXTRUTION_AREA)*256; (current_speed[E_AXIS] * current_speed[E_AXIS] * EXTRUSION_AREA * EXTRUSION_AREA)*256;
block->advance = advance; block->advance = advance;
if(acc_dist == 0) { if(acc_dist == 0) {
block->advance_rate = 0; block->advance_rate = 0;

@ -106,9 +106,9 @@ void check_axes_activity();
uint8_t movesplanned(); //return the nr of buffered moves uint8_t movesplanned(); //return the nr of buffered moves
extern unsigned long minsegmenttime; extern unsigned long minsegmenttime;
extern float max_feedrate[4]; // set the max speeds extern float max_feedrate[NUM_AXIS]; // set the max speeds
extern float axis_steps_per_unit[4]; extern float axis_steps_per_unit[NUM_AXIS];
extern unsigned long max_acceleration_units_per_sq_second[4]; // Use M201 to override by software extern unsigned long max_acceleration_units_per_sq_second[NUM_AXIS]; // Use M201 to override by software
extern float minimumfeedrate; extern float minimumfeedrate;
extern float acceleration; // Normal acceleration mm/s^2 THIS IS THE DEFAULT ACCELERATION for all moves. M204 SXXXX extern float acceleration; // Normal acceleration mm/s^2 THIS IS THE DEFAULT ACCELERATION for all moves. M204 SXXXX
extern float retract_acceleration; // mm/s^2 filament pull-pack and push-forward while standing still in the other axis M204 TXXXX extern float retract_acceleration; // mm/s^2 filament pull-pack and push-forward while standing still in the other axis M204 TXXXX
@ -152,14 +152,7 @@ FORCE_INLINE block_t *plan_get_current_block()
} }
// Returns true if the buffer has a queued block, false otherwise // Returns true if the buffer has a queued block, false otherwise
FORCE_INLINE bool blocks_queued() FORCE_INLINE bool blocks_queued() { return (block_buffer_head != block_buffer_tail); }
{
if (block_buffer_head == block_buffer_tail) {
return false;
}
else
return true;
}
#ifdef PREVENT_DANGEROUS_EXTRUDE #ifdef PREVENT_DANGEROUS_EXTRUDE
void set_extrude_min_temp(float temp); void set_extrude_min_temp(float temp);

Loading…
Cancel
Save