Commit 173df6c2 authored by MagoKimbra's avatar MagoKimbra

Same Fix

parent fe8a61e5
......@@ -248,7 +248,7 @@
// HotEnd{HE0,HE1,HE2,HE3}
#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
#endif // PIDTEMP
......
......@@ -145,10 +145,16 @@ void Config_PrintSettings()
SERIAL_ECHOPAIR(" M92 X",axis_steps_per_unit[X_AXIS]);
SERIAL_ECHOPAIR(" Y",axis_steps_per_unit[Y_AXIS]);
SERIAL_ECHOPAIR(" Z",axis_steps_per_unit[Z_AXIS]);
SERIAL_ECHOPAIR(" E0 ",axis_steps_per_unit[3]);
SERIAL_ECHOPAIR(" E1 ",axis_steps_per_unit[4]);
SERIAL_ECHOPAIR(" E2 ",axis_steps_per_unit[5]);
SERIAL_ECHOPAIR(" E3 ",axis_steps_per_unit[6]);
SERIAL_ECHOPAIR(" E0 ",axis_steps_per_unit[E_AXIS + 0]);
#if EXTRUDERS > 1
SERIAL_ECHOPAIR(" E1 ",axis_steps_per_unit[E_AXIS + 1]);
#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_ECHO_START;
......@@ -167,19 +173,31 @@ void Config_PrintSettings()
SERIAL_ECHOPAIR(" M203 X ",max_feedrate[X_AXIS]);
SERIAL_ECHOPAIR(" Y ",max_feedrate[Y_AXIS] );
SERIAL_ECHOPAIR(" Z ", max_feedrate[Z_AXIS] );
SERIAL_ECHOPAIR(" E0 ", max_feedrate[3]);
SERIAL_ECHOPAIR(" E1 ", max_feedrate[4]);
SERIAL_ECHOPAIR(" E2 ", max_feedrate[5]);
SERIAL_ECHOPAIR(" E3 ", max_feedrate[6]);
SERIAL_ECHOPAIR(" E0 ", max_feedrate[E_AXIS + 0]);
#if EXTRUDERS > 1
SERIAL_ECHOPAIR(" E1 ", max_feedrate[E_AXIS + 1]);
#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_ECHO_START;
SERIAL_ECHOLNPGM("Retraction Steps per unit:");
SERIAL_ECHO_START;
SERIAL_ECHOPAIR(" E0 ",max_retraction_feedrate[0]);
#if EXTRUDERS > 1
SERIAL_ECHOPAIR(" E1 ",max_retraction_feedrate[1]);
#if EXTRUDERS > 2
SERIAL_ECHOPAIR(" E2 ",max_retraction_feedrate[2]);
#if EXTRUDERS > 3
SERIAL_ECHOPAIR(" E3 ",max_retraction_feedrate[3]);
#endif //EXTRUDERS > 3
#endif //EXTRUDERS > 2
#endif //EXTRUDERS > 1
SERIAL_ECHOLN("");
SERIAL_ECHO_START;
SERIAL_ECHOLNPGM("Maximum Acceleration (mm/s2):");
......@@ -187,10 +205,16 @@ void Config_PrintSettings()
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(" Z " ,max_acceleration_units_per_sq_second[Z_AXIS] );
SERIAL_ECHOPAIR(" E0 " ,max_acceleration_units_per_sq_second[3]);
SERIAL_ECHOPAIR(" E1 " ,max_acceleration_units_per_sq_second[4]);
SERIAL_ECHOPAIR(" E2 " ,max_acceleration_units_per_sq_second[5]);
SERIAL_ECHOPAIR(" E3 " ,max_acceleration_units_per_sq_second[6]);
SERIAL_ECHOPAIR(" E0 " ,max_acceleration_units_per_sq_second[E_AXIS]);
#if EXTRUDERS > 1
SERIAL_ECHOPAIR(" E1 " ,max_acceleration_units_per_sq_second[E_AXIS+1]);
#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_ECHO_START;
SERIAL_ECHOLNPGM("Acceleration: S=acceleration, T=retract acceleration");
......@@ -255,14 +279,20 @@ void Config_PrintSettings()
#ifdef ENABLE_AUTO_BED_LEVELING
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("");
#endif // ENABLE_AUTO_BED_LEVELING
#ifdef PIDTEMP
SERIAL_ECHO_START;
SERIAL_ECHOLNPGM("PID settings:");
#ifndef SINGLENOZZLE
for (int e = 0; e < EXTRUDERS; e++)
#else
int e = 0;
#endif
{
SERIAL_ECHO_START;
SERIAL_ECHOPAIR(" M301 E", (long unsigned int)e);
......@@ -461,14 +491,14 @@ void Config_ResetDefault()
const static float tmp7[] = DEFAULT_Kd;
#endif // PIDTEMP
for (short i=0;i<7;i++)
for (short i=0;i<3+EXTRUDERS;i++)
{
axis_steps_per_unit[i] = tmp1[i];
max_feedrate[i] = tmp2[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];
#ifdef SCARA
......@@ -516,7 +546,7 @@ void Config_ResetDefault()
#endif
#ifdef PIDTEMP
#ifndef SINGLENOZZLE
for (short e=0;e<4;e++)
for (short e=0;e<EXTRUDERS;e++)
#else
int e = 0; // only need to write once
#endif
......
......@@ -63,10 +63,10 @@
//===========================================================================
unsigned long minsegmenttime;
float max_feedrate[7]; // set the max speeds
float max_retraction_feedrate[4]; // set the max speeds for retraction
float axis_steps_per_unit[7];
unsigned long max_acceleration_units_per_sq_second[7]; // Use M201 to override by software
float max_feedrate[3 + EXTRUDERS]; // set the max speeds
float max_retraction_feedrate[EXTRUDERS]; // set the max speeds for retraction
float axis_steps_per_unit[3 + EXTRUDERS];
unsigned long max_acceleration_units_per_sq_second[3 + EXTRUDERS]; // Use M201 to override by software
float minimumfeedrate;
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
......@@ -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_e_jerk;
float mintravelfeedrate;
unsigned long axis_steps_per_sqr_second[7];
unsigned long axis_steps_per_sqr_second[3 + EXTRUDERS];
#ifdef ENABLE_AUTO_BED_LEVELING
// this holds the required transform to compensate for bed level
......@@ -86,8 +86,8 @@ matrix_3x3 plan_bed_level_matrix = {
#endif // #ifdef ENABLE_AUTO_BED_LEVELING
// The current position of the tool in absolute steps
long position[4]; //rescaled from extern when axis_steps_per_unit are changed by gcode
static float previous_speed[4]; // Speed of previous path line segment
long position[NUM_AXIS]; //rescaled from extern when axis_steps_per_unit are changed by gcode
static float previous_speed[NUM_AXIS]; // Speed of previous path line segment
static float previous_nominal_speed; // Nominal speed of previous path line segment
#ifdef AUTOTEMP
......@@ -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[Y_AXIS] = lround(y*axis_steps_per_unit[Y_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 NPR2
......@@ -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
float current_speed[4];
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;
if ((i == 3) && (target[E_AXIS] < position[E_AXIS]))
{
if(fabs(current_speed[i]) > max_retraction_feedrate[active_extruder])
speed_factor = min(speed_factor, max_retraction_feedrate[active_extruder]/ fabs(current_speed[i]));
if(fabs(current_speed[i]) > max_feedrate[i])
speed_factor = min(speed_factor, max_feedrate[i] / 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])
speed_factor = min(speed_factor, max_feedrate[active_extruder + 3] / fabs(current_speed[i]));
if(fabs(current_speed[E_AXIS]) > max_retraction_feedrate[active_extruder])
speed_factor = min(speed_factor, max_retraction_feedrate[active_extruder]/ fabs(current_speed[E_AXIS]));
}
else
{
if(fabs(current_speed[i]) > max_feedrate[i])
speed_factor = min(speed_factor, max_feedrate[i] / fabs(current_speed[i]));
}
if(fabs(current_speed[E_AXIS]) > max_feedrate[E_AXIS + active_extruder])
speed_factor = min(speed_factor, max_feedrate[E_AXIS + active_extruder] / fabs(current_speed[E_AXIS]));
}
// Max segement time in us.
......@@ -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];
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];
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])
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_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
position[X_AXIS] = lround(x*axis_steps_per_unit[X_AXIS]);
position[Y_AXIS] = lround(y*axis_steps_per_unit[Y_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]);
previous_nominal_speed = 0.0; // Resets planner junction speeds. Assumes start from rest.
previous_speed[0] = 0.0;
......@@ -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)
{
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]);
}
......@@ -1146,7 +1145,7 @@ void set_extrude_min_temp(float temp)
// Calculate the steps/s^2 acceleration rates, based on the mm/s^s
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];
}
......
......@@ -109,10 +109,10 @@ void check_axes_activity();
uint8_t movesplanned(); //return the nr of buffered moves
extern unsigned long minsegmenttime;
extern float max_feedrate[7]; // set the max speeds
extern float max_retraction_feedrate[4]; // set the max speeds for retraction
extern float axis_steps_per_unit[7];
extern unsigned long max_acceleration_units_per_sq_second[7]; // Use M201 to override by software
extern float max_feedrate[3 + EXTRUDERS]; // set the max speeds
extern float max_retraction_feedrate[EXTRUDERS]; // set the max speeds for retraction
extern float axis_steps_per_unit[3 + EXTRUDERS];
extern unsigned long max_acceleration_units_per_sq_second[3 + EXTRUDERS]; // Use M201 to override by software
extern float minimumfeedrate;
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
......@@ -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_e_jerk;
extern float mintravelfeedrate;
extern unsigned long axis_steps_per_sqr_second[7];
extern unsigned long axis_steps_per_sqr_second[3 + EXTRUDERS];
#ifdef AUTOTEMP
extern bool autotemp_enabled;
......
......@@ -26,7 +26,6 @@
#include "stepper.h"
// public functions
void tp_init(); //initialize the heating
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