Commit 77059690 authored by MagoKimbra's avatar MagoKimbra

Fix Delta Autocalibration

parent dda444c5
......@@ -188,7 +188,6 @@
// default settings
#define DEFAULT_AXIS_STEPS_PER_UNIT {80,80,3200,625,625,625,625} // X, Y, Z, E0, E1, E2, E3 default steps per unit
#define DEFAULT_MAX_FEEDRATE {300,300,2,100,100,100,100} // X, Y, Z, E0, E1, E2, E3 (mm/sec)
#define DEFAULT_RETRACTION_MAX_FEEDRATE {110,110,110,110} // E0, E1, E2, E3 (mm/sec)
#define DEFAULT_MAX_ACCELERATION {3000,3000,50,1000,1000,1000,1000} // X, Y, Z, E0, E1, E2, E3 maximum start speed for accelerated moves.
#define DEFAULT_ACCELERATION 2500 // X, Y, Z and E max acceleration in mm/s^2 for printing moves
......
......@@ -188,7 +188,6 @@
// default settings
#define DEFAULT_AXIS_STEPS_PER_UNIT {80,80,3200,625,625,625,625} // X, Y, Z, E0, E1, E2, E3 default steps per unit
#define DEFAULT_MAX_FEEDRATE {300,300,2,100,100,100,100} // X, Y, Z, E0, E1, E2, E3 (mm/sec)
#define DEFAULT_RETRACTION_MAX_FEEDRATE {110,110,110,110} // E0, E1, E2, E3 (mm/sec)
#define DEFAULT_MAX_ACCELERATION {3000,3000,50,1000,1000,1000,1000} // X, Y, Z, E0, E1, E2, E3 maximum start speed for accelerated moves.
#define DEFAULT_ACCELERATION 2500 // X, Y, Z and E max acceleration in mm/s^2 for printing moves
......
......@@ -47,7 +47,7 @@
#define Z_PROBE_RETRACT_START_LOCATION {0, 0, 30, 0} // X, Y, Z, E start location for z-probe retract sequence
#define Z_PROBE_RETRACT_END_LOCATION {0, 0, 30, 0} // X, Y, Z, E end location for z-probe retract sequence
#define Z_RAISE_BETWEEN_PROBINGS 2 // How much the extruder will be raised when travelling from between next probing points
#define AUTOLEVEL_GRID 24 // Distance between autolevel Z probing points, should be less than print surface radius/3.
#define AUTOLEVEL_GRID 20 // Distance between autolevel Z probing points, should be less than print surface radius/3.
//===========================================================================
//=============================Mechanical Settings===========================
......@@ -139,7 +139,6 @@
// delta speeds must be the same on xyz
#define DEFAULT_AXIS_STEPS_PER_UNIT {80,80,80,451,625,625,625} // X, Y, Z, E0, E1, E2, E3
#define DEFAULT_MAX_FEEDRATE {300,300,300,45,100,100,100} // X, Y, Z, E0, E1, E2, E3 (mm/sec)
#define DEFAULT_RETRACTION_MAX_FEEDRATE {150,150,150,150} // E0, E1, E2, E3 (mm/sec)
#define DEFAULT_MAX_ACCELERATION {2000,2000,2000,1000,1000,1000,1000} // X, Y, Z, E0, E1, E2, E3 maximum start speed for accelerated moves.
#define DEFAULT_ACCELERATION 1000 // X, Y, Z and E max acceleration in mm/s^2 for printing moves
......
......@@ -210,7 +210,6 @@
// default settings
#define DEFAULT_AXIS_STEPS_PER_UNIT {103.69,103.69,200/1.25,1000,1000,1000,1000} // X, Y, Z, E0, E1, E2, E3
#define DEFAULT_MAX_FEEDRATE {300,300,4,45,45,45,45} // X, Y, Z, E0, E1, E2, E3 (mm/sec)
#define DEFAULT_RETRACTION_MAX_FEEDRATE {80,80,80,80} // E0, E1, E2, E3 (mm/sec)
#define DEFAULT_MAX_ACCELERATION {5000,5000,50,5000,5000,5000,5000} // X, Y, Z, E0, E1, E2, E3 maximum start speed for accelerated moves.
#define DEFAULT_ACCELERATION 400 // X, Y, Z and E max acceleration in mm/s^2 for printing moves
......
......@@ -51,7 +51,6 @@ typedef unsigned long millis_t;
#include "comunication.h"
void get_command();
void process_commands();
void manage_inactivity(bool ignore_stepper_queue=false);
......@@ -138,6 +137,7 @@ void manage_inactivity(bool ignore_stepper_queue=false);
* X_HEAD and Y_HEAD is used for systems that don't have a 1:1 relationship between X_AXIS and X Head movement, like CoreXY bots.
*/
enum AxisEnum {X_AXIS=0, Y_AXIS=1, A_AXIS=0, B_AXIS=1, Z_AXIS=2, E_AXIS=3, X_HEAD=4, Y_HEAD=5};
enum EndstopEnum {X_MIN=0, Y_MIN=1, Z_MIN=2, Z_PROBE=3, X_MAX=4, Y_MAX=5, Z_MAX=6};
void enable_all_steppers();
......@@ -160,9 +160,9 @@ void adjust_delta(float cartesian[3]);
void prepare_move_raw();
extern float delta[3];
extern float delta_tmp[3];
extern float delta_tower1_x,delta_tower1_y;
extern float delta_tower2_x,delta_tower2_y;
extern float delta_tower3_x,delta_tower3_y;
extern float delta_tower1_x, delta_tower1_y;
extern float delta_tower2_x, delta_tower2_y;
extern float delta_tower3_x, delta_tower3_y;
#endif
#ifdef SCARA
void calculate_delta(float cartesian[3]);
......@@ -241,6 +241,7 @@ extern float home_offset[3];
extern float tower_adj[6];
extern float delta_radius;
extern float delta_diagonal_rod;
extern float delta_segments_per_second;
#elif defined(Z_DUAL_ENDSTOPS)
extern float z_endstop_adj;
#endif
......
This diff is collapsed.
......@@ -14,15 +14,14 @@
*
*/
#define EEPROM_VERSION "V21"
#define EEPROM_VERSION "V22"
/**
* V21 EEPROM Layout:
* V22 EEPROM Layout:
*
* ver
* M92 XYZ E0 E1 E2 E3 axis_steps_per_unit (x7)
* M203 XYZ E0 E1 E2 E3 max_feedrate (x7)
* M??? E0 E1 E2 E3 retraction_feedrate (x4)
* M201 XYZ E0 E1 E2 E3 max_acceleration_units_per_sq_second (x7)
* M204 P acceleration
* M204 R retract_acceleration
......@@ -45,7 +44,7 @@
* M666 R delta_radius
* M666 D delta_diagonal_rod
* M666 H Z max_pos
* M666 P z_probe_offset
* M666 P XYZ XYZ probe_offset (x3)
*
* Z_DUAL_ENDSTOPS
* M666 Z z_endstop_adj
......@@ -127,17 +126,16 @@ void _EEPROM_readData(int &pos, uint8_t* value, uint8_t size) {
#define EEPROM_WRITE_VAR(pos, value) _EEPROM_writeData(pos, (uint8_t*)&value, sizeof(value))
#define EEPROM_READ_VAR(pos, value) _EEPROM_readData(pos, (uint8_t*)&value, sizeof(value))
/**
* Store Configuration Settings - M500
*/
#define DUMMY_PID_VALUE 3000.0f
#define EEPROM_OFFSET 100
#define LIFETIME_EEPROM_OFFSET 600
#define LIFETIME_MAGIC "L99"
#ifdef EEPROM_SETTINGS
/**
* Store Configuration Settings - M500
*/
void Config_StoreSettings() {
float dummy = 0.0f;
char ver[4] = "000";
......@@ -145,7 +143,6 @@ void Config_StoreSettings() {
EEPROM_WRITE_VAR(i, ver); // invalidate data first
EEPROM_WRITE_VAR(i, axis_steps_per_unit);
EEPROM_WRITE_VAR(i, max_feedrate);
EEPROM_WRITE_VAR(i, max_retraction_feedrate);
EEPROM_WRITE_VAR(i, max_acceleration_units_per_sq_second);
EEPROM_WRITE_VAR(i, acceleration);
EEPROM_WRITE_VAR(i, retract_acceleration);
......@@ -293,7 +290,6 @@ void Config_RetrieveSettings() {
// version number match
EEPROM_READ_VAR(i, axis_steps_per_unit);
EEPROM_READ_VAR(i, max_feedrate);
EEPROM_READ_VAR(i, max_retraction_feedrate);
EEPROM_READ_VAR(i, max_acceleration_units_per_sq_second);
// steps per sq second need to be updated to agree with the units per sq second (as they are what is used in the planner)
......@@ -441,36 +437,33 @@ void Config_RetrieveSettings() {
* Reset Configuration Settings - M502
*/
void Config_ResetDefault() {
float tmp1[] = DEFAULT_AXIS_STEPS_PER_UNIT;
float tmp2[] = DEFAULT_MAX_FEEDRATE;
float tmp3[] = DEFAULT_RETRACTION_MAX_FEEDRATE;
long tmp4[] = DEFAULT_MAX_ACCELERATION;
long tmp3[] = DEFAULT_MAX_ACCELERATION;
#ifdef PIDTEMP
float tmp5[] = DEFAULT_Kp;
float tmp6[] = DEFAULT_Ki;
float tmp7[] = DEFAULT_Kd;
float tmp4[] = DEFAULT_Kp;
float tmp5[] = DEFAULT_Ki;
float tmp6[] = DEFAULT_Kd;
#endif // PIDTEMP
#if defined(HOTEND_OFFSET_X) && defined(HOTEND_OFFSET_Y)
float tmp8[] = HOTEND_OFFSET_X;
float tmp9[] = HOTEND_OFFSET_Y;
float tmp7[] = HOTEND_OFFSET_X;
float tmp8[] = HOTEND_OFFSET_Y;
#else
float tmp7[] = {0,0,0,0};
float tmp8[] = {0,0,0,0};
float tmp9[] = {0,0,0,0};
#endif
for (int 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];
max_acceleration_units_per_sq_second[i] = tmp3[i];
}
for (int i = 0; i < EXTRUDERS; i++) {
max_retraction_feedrate[i] = tmp3[i];
#if HOTENDS > 1
hotend_offset[X_AXIS][i] = tmp8[i];
hotend_offset[Y_AXIS][i] = tmp9[i];
hotend_offset[X_AXIS][i] = tmp7[i];
hotend_offset[Y_AXIS][i] = tmp8[i];
#endif
#ifdef SCARA
if (i < sizeof(axis_scaling) / sizeof(*axis_scaling))
......@@ -527,9 +520,9 @@ void Config_ResetDefault() {
#ifdef PIDTEMP
for (int e = 0; e < HOTENDS; e++)
{
Kp[e] = tmp5[e];
Ki[e] = scalePID_i(tmp6[e]);
Kd[e] = scalePID_d(tmp7[e]);
Kp[e] = tmp4[e];
Ki[e] = scalePID_i(tmp5[e]);
Kd[e] = scalePID_d(tmp6[e]);
}
// call updatePID (similar to when we have processed M301)
updatePID();
......@@ -623,21 +616,6 @@ void Config_PrintSettings(bool forReplay) {
#endif //EXTRUDERS > 1
ECHO_E;
if (!forReplay) {
ECHO_LM(DB, "Retraction Steps per unit:");
}
ECHO_SMV(DB, " E0 ",max_retraction_feedrate[0]);
#if EXTRUDERS > 1
ECHO_MV(" E1 ", max_retraction_feedrate[1]);
#if EXTRUDERS > 2
ECHO_MV(" E2 ", max_retraction_feedrate[2]);
#if EXTRUDERS > 3
ECHO_MV(" E3 ", max_retraction_feedrate[3]);
#endif //EXTRUDERS > 3
#endif //EXTRUDERS > 2
#endif //EXTRUDERS > 1
ECHO_E;
if (!forReplay) {
ECHO_LM(DB, "Maximum Acceleration (mm/s2):");
}
......
......@@ -4,8 +4,6 @@
#include "Configuration.h"
void Config_ResetDefault();
void load_lifetime_stats();
void save_lifetime_stats();
#ifndef DISABLE_M503
void Config_PrintSettings(bool forReplay=false);
......
......@@ -61,7 +61,6 @@
millis_t minsegmenttime;
float max_feedrate[3 + EXTRUDERS]; // Max speeds in mm per minute
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;
......@@ -411,7 +410,6 @@ void check_axes_activity() {
#ifdef LASERBEAM
tail_laser_ttl_modulation = block_buffer[block_index].laser_ttlmodulation;
#endif
while (block_index != block_buffer_head) {
block = &block_buffer[block_index];
for (int i=0; i<NUM_AXIS; i++) if (block->steps[i]) axis_active[i]++;
......@@ -432,11 +430,12 @@ void check_axes_activity() {
#ifdef FAN_KICKSTART_TIME
static millis_t fan_kick_end;
if (tail_fan_speed) {
millis_t ms = millis();
if (fan_kick_end == 0) {
// Just starting up fan - run at full power.
fan_kick_end = millis() + FAN_KICKSTART_TIME;
fan_kick_end = ms + FAN_KICKSTART_TIME;
tail_fan_speed = 255;
} else if (fan_kick_end > millis())
} else if (fan_kick_end > ms)
// Fan still spinning up.
tail_fan_speed = 255;
} else {
......@@ -463,7 +462,6 @@ void check_axes_activity() {
#endif
#endif
// add Laser TTL Modulation(PWM) Control
#ifdef LASERBEAM
analogWrite(LASER_TTL_PIN, tail_laser_ttl_modulation);
#endif
......@@ -572,8 +570,6 @@ float junction_deviation = 0.1;
block->valve_pressure = ValvePressure;
block->e_to_p_pressure = EtoPPressure;
#endif
// Add update block variables for LASER BEAM control
#ifdef LASERBEAM
block->laser_ttlmodulation = laser_ttl_modulation;
#endif
......@@ -635,7 +631,7 @@ float junction_deviation = 0.1;
#if EXTRUDERS > 1
case 1:
enable_e1();
g_uc_extruder_last_move[1] = BLOCK_BUFFER_SIZE*2;
g_uc_extruder_last_move[1] = BLOCK_BUFFER_SIZE * 2;
if (g_uc_extruder_last_move[0] == 0) disable_e0();
#if EXTRUDERS > 2
if (g_uc_extruder_last_move[2] == 0) disable_e2();
......@@ -647,7 +643,7 @@ float junction_deviation = 0.1;
#if EXTRUDERS > 2
case 2:
enable_e2();
g_uc_extruder_last_move[2] = BLOCK_BUFFER_SIZE*2;
g_uc_extruder_last_move[2] = BLOCK_BUFFER_SIZE * 2;
if (g_uc_extruder_last_move[0] == 0) disable_e0();
if (g_uc_extruder_last_move[1] == 0) disable_e1();
#if EXTRUDERS > 3
......@@ -657,7 +653,7 @@ float junction_deviation = 0.1;
#if EXTRUDERS > 3
case 3:
enable_e3();
g_uc_extruder_last_move[3] = BLOCK_BUFFER_SIZE*2;
g_uc_extruder_last_move[3] = BLOCK_BUFFER_SIZE * 2;
if (g_uc_extruder_last_move[0] == 0) disable_e0();
if (g_uc_extruder_last_move[1] == 0) disable_e1();
if (g_uc_extruder_last_move[2] == 0) disable_e2();
......@@ -794,24 +790,12 @@ float junction_deviation = 0.1;
// Calculate and limit speed in mm/sec for each axis
float current_speed[NUM_AXIS];
float speed_factor = 1.0; //factor <=1 do decrease speed
for (int i = 0; i < 3; i++) {
for (int i = 0; i < NUM_AXIS; i++) {
current_speed[i] = delta_mm[i] * inverse_second;
float cs = fabs(current_speed[i]), mf = max_feedrate[i];
if (cs > mf) speed_factor = min(speed_factor, mf / cs);
}
current_speed[E_AXIS] = delta_mm[E_AXIS] * inverse_second;
if (target[E_AXIS] < position[E_AXIS])
{
if(fabs(current_speed[E_AXIS]) > max_retraction_feedrate[extruder])
speed_factor = min(speed_factor, max_retraction_feedrate[extruder]/ fabs(current_speed[E_AXIS]));
}
else
{
if(fabs(current_speed[E_AXIS]) > max_feedrate[E_AXIS + extruder])
speed_factor = min(speed_factor, max_feedrate[E_AXIS + extruder] / fabs(current_speed[E_AXIS]));
}
// Max segement time in us.
#ifdef XY_FREQUENCY_LIMIT
#define MAX_FREQ_TIME (1000000.0 / XY_FREQUENCY_LIMIT)
......@@ -1026,11 +1010,15 @@ float junction_deviation = 0.1;
#endif // ENABLE_AUTO_BED_LEVELING
#ifdef ENABLE_AUTO_BED_LEVELING
void plan_set_position(float x, float y, float z, const float &e) {
void plan_set_position(float x, float y, float z, const float &e)
apply_rotation_xyz(plan_bed_level_matrix, x, y, z);
#else
void plan_set_position(const float &x, const float &y, const float &z, const float &e) {
void plan_set_position(const float &x, const float &y, const float &z, const float &e)
#endif // ENABLE_AUTO_BED_LEVELING
{
#ifdef ENABLE_AUTO_BED_LEVELING
apply_rotation_xyz(plan_bed_level_matrix, x, y, z);
#endif
float nx = position[X_AXIS] = lround(x * axis_steps_per_unit[X_AXIS]),
ny = position[Y_AXIS] = lround(y * axis_steps_per_unit[Y_AXIS]),
......@@ -1049,6 +1037,6 @@ void plan_set_e_position(const float &e) {
// Calculate the steps/s^2 acceleration rates, based on the mm/s^s
void reset_acceleration_rates() {
for (int i = 0; i < 3 + EXTRUDERS; i++)
for (int i = 0; i < 3 + EXTRUDERS; i++)
axis_steps_per_sqr_second[i] = max_acceleration_units_per_sq_second[i] * axis_steps_per_unit[i];
}
......@@ -120,7 +120,6 @@ void plan_set_e_position(const float &e);
extern millis_t minsegmenttime;
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;
......
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