Commit 173df6c2 authored by MagoKimbra's avatar MagoKimbra

Same Fix

parent fe8a61e5
...@@ -248,7 +248,7 @@ ...@@ -248,7 +248,7 @@
// HotEnd{HE0,HE1,HE2,HE3} // HotEnd{HE0,HE1,HE2,HE3}
#define DEFAULT_Kp {41,41,41,41} // Kp for E0, E1, E2, E3 #define DEFAULT_Kp {41,41,41,41} // Kp for E0, E1, E2, E3
#define DEFAULT_Ki {7,7,7,7} // Ki for E0, E1, E2, E3 #define DEFAULT_Ki {07,07,07,07} // Ki for E0, E1, E2, E3
#define DEFAULT_Kd {59,59,59,59} // Kd for E0, E1, E2, E3 #define DEFAULT_Kd {59,59,59,59} // Kd for E0, E1, E2, E3
#endif // PIDTEMP #endif // PIDTEMP
......
...@@ -145,10 +145,16 @@ void Config_PrintSettings() ...@@ -145,10 +145,16 @@ void Config_PrintSettings()
SERIAL_ECHOPAIR(" M92 X",axis_steps_per_unit[X_AXIS]); SERIAL_ECHOPAIR(" M92 X",axis_steps_per_unit[X_AXIS]);
SERIAL_ECHOPAIR(" Y",axis_steps_per_unit[Y_AXIS]); SERIAL_ECHOPAIR(" Y",axis_steps_per_unit[Y_AXIS]);
SERIAL_ECHOPAIR(" Z",axis_steps_per_unit[Z_AXIS]); SERIAL_ECHOPAIR(" Z",axis_steps_per_unit[Z_AXIS]);
SERIAL_ECHOPAIR(" E0 ",axis_steps_per_unit[3]); SERIAL_ECHOPAIR(" E0 ",axis_steps_per_unit[E_AXIS + 0]);
SERIAL_ECHOPAIR(" E1 ",axis_steps_per_unit[4]); #if EXTRUDERS > 1
SERIAL_ECHOPAIR(" E2 ",axis_steps_per_unit[5]); SERIAL_ECHOPAIR(" E1 ",axis_steps_per_unit[E_AXIS + 1]);
SERIAL_ECHOPAIR(" E3 ",axis_steps_per_unit[6]); #if EXTRUDERS > 2
SERIAL_ECHOPAIR(" E2 ",axis_steps_per_unit[E_AXIS + 2]);
#if EXTRUDERS > 3
SERIAL_ECHOPAIR(" E3 ",axis_steps_per_unit[E_AXIS + 3]);
#endif //EXTRUDERS > 3
#endif //EXTRUDERS > 2
#endif //EXTRUDERS > 1
SERIAL_ECHOLN(""); SERIAL_ECHOLN("");
SERIAL_ECHO_START; SERIAL_ECHO_START;
...@@ -167,19 +173,31 @@ void Config_PrintSettings() ...@@ -167,19 +173,31 @@ void Config_PrintSettings()
SERIAL_ECHOPAIR(" M203 X ",max_feedrate[X_AXIS]); SERIAL_ECHOPAIR(" M203 X ",max_feedrate[X_AXIS]);
SERIAL_ECHOPAIR(" Y ",max_feedrate[Y_AXIS] ); SERIAL_ECHOPAIR(" Y ",max_feedrate[Y_AXIS] );
SERIAL_ECHOPAIR(" Z ", max_feedrate[Z_AXIS] ); SERIAL_ECHOPAIR(" Z ", max_feedrate[Z_AXIS] );
SERIAL_ECHOPAIR(" E0 ", max_feedrate[3]); SERIAL_ECHOPAIR(" E0 ", max_feedrate[E_AXIS + 0]);
SERIAL_ECHOPAIR(" E1 ", max_feedrate[4]); #if EXTRUDERS > 1
SERIAL_ECHOPAIR(" E2 ", max_feedrate[5]); SERIAL_ECHOPAIR(" E1 ", max_feedrate[E_AXIS + 1]);
SERIAL_ECHOPAIR(" E3 ", max_feedrate[6]); #if EXTRUDERS > 2
SERIAL_ECHOPAIR(" E2 ", max_feedrate[E_AXIS + 2]);
#if EXTRUDERS > 3
SERIAL_ECHOPAIR(" E3 ", max_feedrate[E_AXIS + 3]);
#endif //EXTRUDERS > 3
#endif //EXTRUDERS > 2
#endif //EXTRUDERS > 1
SERIAL_ECHOLN(""); SERIAL_ECHOLN("");
SERIAL_ECHO_START; SERIAL_ECHO_START;
SERIAL_ECHOLNPGM("Retraction Steps per unit:"); SERIAL_ECHOLNPGM("Retraction Steps per unit:");
SERIAL_ECHO_START; SERIAL_ECHO_START;
SERIAL_ECHOPAIR(" E0 ",max_retraction_feedrate[0]); SERIAL_ECHOPAIR(" E0 ",max_retraction_feedrate[0]);
#if EXTRUDERS > 1
SERIAL_ECHOPAIR(" E1 ",max_retraction_feedrate[1]); SERIAL_ECHOPAIR(" E1 ",max_retraction_feedrate[1]);
#if EXTRUDERS > 2
SERIAL_ECHOPAIR(" E2 ",max_retraction_feedrate[2]); SERIAL_ECHOPAIR(" E2 ",max_retraction_feedrate[2]);
#if EXTRUDERS > 3
SERIAL_ECHOPAIR(" E3 ",max_retraction_feedrate[3]); SERIAL_ECHOPAIR(" E3 ",max_retraction_feedrate[3]);
#endif //EXTRUDERS > 3
#endif //EXTRUDERS > 2
#endif //EXTRUDERS > 1
SERIAL_ECHOLN(""); SERIAL_ECHOLN("");
SERIAL_ECHO_START; SERIAL_ECHO_START;
SERIAL_ECHOLNPGM("Maximum Acceleration (mm/s2):"); SERIAL_ECHOLNPGM("Maximum Acceleration (mm/s2):");
...@@ -187,10 +205,16 @@ void Config_PrintSettings() ...@@ -187,10 +205,16 @@ void Config_PrintSettings()
SERIAL_ECHOPAIR(" M201 X " ,max_acceleration_units_per_sq_second[X_AXIS] ); SERIAL_ECHOPAIR(" M201 X " ,max_acceleration_units_per_sq_second[X_AXIS] );
SERIAL_ECHOPAIR(" Y " , max_acceleration_units_per_sq_second[Y_AXIS] ); SERIAL_ECHOPAIR(" Y " , max_acceleration_units_per_sq_second[Y_AXIS] );
SERIAL_ECHOPAIR(" Z " ,max_acceleration_units_per_sq_second[Z_AXIS] ); SERIAL_ECHOPAIR(" Z " ,max_acceleration_units_per_sq_second[Z_AXIS] );
SERIAL_ECHOPAIR(" E0 " ,max_acceleration_units_per_sq_second[3]); SERIAL_ECHOPAIR(" E0 " ,max_acceleration_units_per_sq_second[E_AXIS]);
SERIAL_ECHOPAIR(" E1 " ,max_acceleration_units_per_sq_second[4]); #if EXTRUDERS > 1
SERIAL_ECHOPAIR(" E2 " ,max_acceleration_units_per_sq_second[5]); SERIAL_ECHOPAIR(" E1 " ,max_acceleration_units_per_sq_second[E_AXIS+1]);
SERIAL_ECHOPAIR(" E3 " ,max_acceleration_units_per_sq_second[6]); #if EXTRUDERS > 2
SERIAL_ECHOPAIR(" E2 " ,max_acceleration_units_per_sq_second[E_AXIS+2]);
#if EXTRUDERS > 3
SERIAL_ECHOPAIR(" E3 " ,max_acceleration_units_per_sq_second[E_AXIS+3]);
#endif //EXTRUDERS > 3
#endif //EXTRUDERS > 2
#endif //EXTRUDERS > 1
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");
...@@ -255,14 +279,20 @@ void Config_PrintSettings() ...@@ -255,14 +279,20 @@ void Config_PrintSettings()
#ifdef ENABLE_AUTO_BED_LEVELING #ifdef ENABLE_AUTO_BED_LEVELING
SERIAL_ECHO_START; SERIAL_ECHO_START;
SERIAL_ECHOPAIR("Z Probe offset (mm):" ,zprobe_zoffset); SERIAL_ECHOLNPGM("Z Probe offset (mm)");
SERIAL_ECHO_START;
SERIAL_ECHOPAIR(" M666 P",zprobe_zoffset);
SERIAL_ECHOLN(""); SERIAL_ECHOLN("");
#endif // ENABLE_AUTO_BED_LEVELING #endif // ENABLE_AUTO_BED_LEVELING
#ifdef PIDTEMP #ifdef PIDTEMP
SERIAL_ECHO_START; SERIAL_ECHO_START;
SERIAL_ECHOLNPGM("PID settings:"); SERIAL_ECHOLNPGM("PID settings:");
#ifndef SINGLENOZZLE
for (int e = 0; e < EXTRUDERS; e++) for (int e = 0; e < EXTRUDERS; e++)
#else
int e = 0;
#endif
{ {
SERIAL_ECHO_START; SERIAL_ECHO_START;
SERIAL_ECHOPAIR(" M301 E", (long unsigned int)e); SERIAL_ECHOPAIR(" M301 E", (long unsigned int)e);
...@@ -461,14 +491,14 @@ void Config_ResetDefault() ...@@ -461,14 +491,14 @@ void Config_ResetDefault()
const static float tmp7[] = DEFAULT_Kd; const static float tmp7[] = DEFAULT_Kd;
#endif // PIDTEMP #endif // PIDTEMP
for (short i=0;i<7;i++) for (short i=0;i<3+EXTRUDERS;i++)
{ {
axis_steps_per_unit[i] = tmp1[i]; axis_steps_per_unit[i] = tmp1[i];
max_feedrate[i] = tmp2[i]; max_feedrate[i] = tmp2[i];
max_acceleration_units_per_sq_second[i] = tmp4[i]; max_acceleration_units_per_sq_second[i] = tmp4[i];
} }
for (short i=0;i<4;i++) for (short i=0;i<EXTRUDERS;i++)
{ {
max_retraction_feedrate[i] = tmp3[i]; max_retraction_feedrate[i] = tmp3[i];
#ifdef SCARA #ifdef SCARA
...@@ -516,7 +546,7 @@ void Config_ResetDefault() ...@@ -516,7 +546,7 @@ void Config_ResetDefault()
#endif #endif
#ifdef PIDTEMP #ifdef PIDTEMP
#ifndef SINGLENOZZLE #ifndef SINGLENOZZLE
for (short e=0;e<4;e++) for (short e=0;e<EXTRUDERS;e++)
#else #else
int e = 0; // only need to write once int e = 0; // only need to write once
#endif #endif
......
...@@ -63,10 +63,10 @@ ...@@ -63,10 +63,10 @@
//=========================================================================== //===========================================================================
unsigned long minsegmenttime; unsigned long minsegmenttime;
float max_feedrate[7]; // set the max speeds float max_feedrate[3 + EXTRUDERS]; // set the max speeds
float max_retraction_feedrate[4]; // set the max speeds for retraction float max_retraction_feedrate[EXTRUDERS]; // set the max speeds for retraction
float axis_steps_per_unit[7]; float axis_steps_per_unit[3 + EXTRUDERS];
unsigned long max_acceleration_units_per_sq_second[7]; // Use M201 to override by software unsigned long max_acceleration_units_per_sq_second[3 + EXTRUDERS]; // 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
...@@ -74,7 +74,7 @@ float max_xy_jerk; //speed than can be stopped at once, if i understand correctl ...@@ -74,7 +74,7 @@ float max_xy_jerk; //speed than can be stopped at once, if i understand correctl
float max_z_jerk; float max_z_jerk;
float max_e_jerk; float max_e_jerk;
float mintravelfeedrate; float mintravelfeedrate;
unsigned long axis_steps_per_sqr_second[7]; unsigned long axis_steps_per_sqr_second[3 + EXTRUDERS];
#ifdef ENABLE_AUTO_BED_LEVELING #ifdef ENABLE_AUTO_BED_LEVELING
// this holds the required transform to compensate for bed level // this holds the required transform to compensate for bed level
...@@ -86,8 +86,8 @@ matrix_3x3 plan_bed_level_matrix = { ...@@ -86,8 +86,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
...@@ -572,7 +572,7 @@ void plan_buffer_line(const float &x, const float &y, const float &z, const floa ...@@ -572,7 +572,7 @@ void plan_buffer_line(const float &x, const float &y, const float &z, const floa
target[X_AXIS] = lround(x*axis_steps_per_unit[X_AXIS]); target[X_AXIS] = lround(x*axis_steps_per_unit[X_AXIS]);
target[Y_AXIS] = lround(y*axis_steps_per_unit[Y_AXIS]); target[Y_AXIS] = lround(y*axis_steps_per_unit[Y_AXIS]);
target[Z_AXIS] = lround(z*axis_steps_per_unit[Z_AXIS]); target[Z_AXIS] = lround(z*axis_steps_per_unit[Z_AXIS]);
target[E_AXIS] = lround(e*axis_steps_per_unit[active_extruder+3]); target[E_AXIS] = lround(e*axis_steps_per_unit[E_AXIS + active_extruder]);
#ifdef PREVENT_DANGEROUS_EXTRUDE #ifdef PREVENT_DANGEROUS_EXTRUDE
#ifdef NPR2 #ifdef NPR2
...@@ -867,24 +867,23 @@ block->steps_y = labs((target[X_AXIS]-position[X_AXIS]) - (target[Y_AXIS]-positi ...@@ -867,24 +867,23 @@ block->steps_y = labs((target[X_AXIS]-position[X_AXIS]) - (target[Y_AXIS]-positi
// Calculate and limit speed in mm/sec for each axis // Calculate and limit speed in mm/sec for each axis
float current_speed[4]; float current_speed[4];
float speed_factor = 1.0; //factor <=1 do decrease speed float speed_factor = 1.0; //factor <=1 do decrease speed
for(int i=0; i < 4; i++) for(int i=0; i < 3; i++)
{ {
current_speed[i] = delta_mm[i] * inverse_second; current_speed[i] = delta_mm[i] * inverse_second;
if ((i == 3) && (target[E_AXIS] < position[E_AXIS])) if(fabs(current_speed[i]) > max_feedrate[i])
{ speed_factor = min(speed_factor, max_feedrate[i] / fabs(current_speed[i]));
if(fabs(current_speed[i]) > max_retraction_feedrate[active_extruder])
speed_factor = min(speed_factor, max_retraction_feedrate[active_extruder]/ fabs(current_speed[i]));
} }
else if (i==3)
current_speed[E_AXIS] = delta_mm[E_AXIS] * inverse_second;
if (target[E_AXIS] < position[E_AXIS])
{ {
if(fabs(current_speed[i]) > max_feedrate[active_extruder + 3]) if(fabs(current_speed[E_AXIS]) > max_retraction_feedrate[active_extruder])
speed_factor = min(speed_factor, max_feedrate[active_extruder + 3] / fabs(current_speed[i])); speed_factor = min(speed_factor, max_retraction_feedrate[active_extruder]/ fabs(current_speed[E_AXIS]));
} }
else else
{ {
if(fabs(current_speed[i]) > max_feedrate[i]) if(fabs(current_speed[E_AXIS]) > max_feedrate[E_AXIS + active_extruder])
speed_factor = min(speed_factor, max_feedrate[i] / fabs(current_speed[i])); speed_factor = min(speed_factor, max_feedrate[E_AXIS + active_extruder] / fabs(current_speed[E_AXIS]));
}
} }
// Max segement time in us. // Max segement time in us.
...@@ -947,10 +946,10 @@ block->steps_y = labs((target[X_AXIS]-position[X_AXIS]) - (target[Y_AXIS]-positi ...@@ -947,10 +946,10 @@ block->steps_y = labs((target[X_AXIS]-position[X_AXIS]) - (target[Y_AXIS]-positi
block->acceleration_st = axis_steps_per_sqr_second[X_AXIS]; block->acceleration_st = axis_steps_per_sqr_second[X_AXIS];
if(((float)block->acceleration_st * (float)block->steps_y / (float)block->step_event_count) > axis_steps_per_sqr_second[Y_AXIS]) if(((float)block->acceleration_st * (float)block->steps_y / (float)block->step_event_count) > axis_steps_per_sqr_second[Y_AXIS])
block->acceleration_st = axis_steps_per_sqr_second[Y_AXIS]; block->acceleration_st = axis_steps_per_sqr_second[Y_AXIS];
if(((float)block->acceleration_st * (float)block->steps_e / (float)block->step_event_count) > axis_steps_per_sqr_second[E_AXIS])
block->acceleration_st = axis_steps_per_sqr_second[E_AXIS];
if(((float)block->acceleration_st * (float)block->steps_z / (float)block->step_event_count ) > axis_steps_per_sqr_second[Z_AXIS]) if(((float)block->acceleration_st * (float)block->steps_z / (float)block->step_event_count ) > axis_steps_per_sqr_second[Z_AXIS])
block->acceleration_st = axis_steps_per_sqr_second[Z_AXIS]; block->acceleration_st = axis_steps_per_sqr_second[Z_AXIS];
if(((float)block->acceleration_st * (float)block->steps_e / (float)block->step_event_count) > axis_steps_per_sqr_second[E_AXIS])
block->acceleration_st = axis_steps_per_sqr_second[E_AXIS];
} }
block->acceleration = block->acceleration_st / steps_per_mm; block->acceleration = block->acceleration_st / steps_per_mm;
block->acceleration_rate = (long)((float)block->acceleration_st * (16777216.0 / (F_CPU / 8.0))); block->acceleration_rate = (long)((float)block->acceleration_st * (16777216.0 / (F_CPU / 8.0)));
...@@ -1116,7 +1115,7 @@ void plan_set_position(const float &x, const float &y, const float &z, const flo ...@@ -1116,7 +1115,7 @@ void plan_set_position(const float &x, const float &y, const float &z, const flo
position[X_AXIS] = lround(x*axis_steps_per_unit[X_AXIS]); position[X_AXIS] = lround(x*axis_steps_per_unit[X_AXIS]);
position[Y_AXIS] = lround(y*axis_steps_per_unit[Y_AXIS]); position[Y_AXIS] = lround(y*axis_steps_per_unit[Y_AXIS]);
position[Z_AXIS] = lround(z*axis_steps_per_unit[Z_AXIS]); position[Z_AXIS] = lround(z*axis_steps_per_unit[Z_AXIS]);
position[E_AXIS] = lround(e*axis_steps_per_unit[active_extruder+3]); position[E_AXIS] = lround(e*axis_steps_per_unit[E_AXIS + active_extruder]);
st_set_position(position[X_AXIS], position[Y_AXIS], position[Z_AXIS], position[E_AXIS]); st_set_position(position[X_AXIS], position[Y_AXIS], position[Z_AXIS], position[E_AXIS]);
previous_nominal_speed = 0.0; // Resets planner junction speeds. Assumes start from rest. previous_nominal_speed = 0.0; // Resets planner junction speeds. Assumes start from rest.
previous_speed[0] = 0.0; previous_speed[0] = 0.0;
...@@ -1127,7 +1126,7 @@ void plan_set_position(const float &x, const float &y, const float &z, const flo ...@@ -1127,7 +1126,7 @@ void plan_set_position(const float &x, const float &y, const float &z, const flo
void plan_set_e_position(const float &e) void plan_set_e_position(const float &e)
{ {
position[E_AXIS] = lround(e*axis_steps_per_unit[active_extruder+3]); position[E_AXIS] = lround(e*axis_steps_per_unit[E_AXIS + active_extruder]);
st_set_e_position(position[E_AXIS]); st_set_e_position(position[E_AXIS]);
} }
...@@ -1146,7 +1145,7 @@ void set_extrude_min_temp(float temp) ...@@ -1146,7 +1145,7 @@ void set_extrude_min_temp(float temp)
// Calculate the steps/s^2 acceleration rates, based on the mm/s^s // Calculate the steps/s^2 acceleration rates, based on the mm/s^s
void reset_acceleration_rates() void reset_acceleration_rates()
{ {
for(int8_t i=0; i < 7; i++) for(int8_t i=0; i < 3 + EXTRUDERS; i++)
{ {
axis_steps_per_sqr_second[i] = max_acceleration_units_per_sq_second[i] * axis_steps_per_unit[i]; axis_steps_per_sqr_second[i] = max_acceleration_units_per_sq_second[i] * axis_steps_per_unit[i];
} }
......
...@@ -109,10 +109,10 @@ void check_axes_activity(); ...@@ -109,10 +109,10 @@ 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[7]; // set the max speeds extern float max_feedrate[3 + EXTRUDERS]; // set the max speeds
extern float max_retraction_feedrate[4]; // set the max speeds for retraction extern float max_retraction_feedrate[EXTRUDERS]; // set the max speeds for retraction
extern float axis_steps_per_unit[7]; extern float axis_steps_per_unit[3 + EXTRUDERS];
extern unsigned long max_acceleration_units_per_sq_second[7]; // Use M201 to override by software extern unsigned long max_acceleration_units_per_sq_second[3 + EXTRUDERS]; // 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
...@@ -120,7 +120,7 @@ extern float max_xy_jerk; //speed than can be stopped at once, if i understand c ...@@ -120,7 +120,7 @@ extern float max_xy_jerk; //speed than can be stopped at once, if i understand c
extern float max_z_jerk; extern float max_z_jerk;
extern float max_e_jerk; extern float max_e_jerk;
extern float mintravelfeedrate; extern float mintravelfeedrate;
extern unsigned long axis_steps_per_sqr_second[7]; extern unsigned long axis_steps_per_sqr_second[3 + EXTRUDERS];
#ifdef AUTOTEMP #ifdef AUTOTEMP
extern bool autotemp_enabled; extern bool autotemp_enabled;
......
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
#include "stepper.h" #include "stepper.h"
// public functions // public functions
void tp_init(); //initialize the heating void tp_init(); //initialize the heating
void manage_heater(); //it is critical that this is called periodically. void manage_heater(); //it is critical that this is called periodically.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment