Commit 245af238 authored by MagoKimbra's avatar MagoKimbra

Merge remote-tracking branch 'refs/remotes/origin/master' into dev

parents 0e1c4b38 5f774564
......@@ -72,10 +72,22 @@
/***********************************************************************
*************************** Mechanism type ****************************
***********************************************************************
* *
* CARTESIAN - Prusa, Mendel, etc *
* COREXY - H-Bot/Core XY (x_motor = x+y, y_motor = x-y) *
* COREYX - H-Bot/Core XY (x_motor = y+x, y_motor = y-x) *
* COREXZ - H-Bot/Core XZ (x_motor = x+z, z_motor = x-z) *
* COREZX - H-Bot/Core XZ (x_motor = z+x, z_motor = z-x) *
* DELTA - Rostock, Kossel, RostockMax, Cerberus, etc *
* SCARA - SCARA *
* *
***********************************************************************/
#define MECHANISM MECH_CARTESIAN
//#define MECHANISM MECH_COREXY
//#define MECHANISM MECH_COREYX
//#define MECHANISM MECH_COREXZ
//#define MECHANISM MECH_COREZX
//#define MECHANISM MECH_DELTA
//#define MECHANISM MECH_SCARA
/***********************************************************************/
......
......@@ -278,16 +278,26 @@
// Offsets to the probe relative to the extruder tip (Hotend - Probe)
// X and Y offsets MUST be INTEGERS
#define X_PROBE_OFFSET_FROM_EXTRUDER 0 // Probe on: -left +right
#define Y_PROBE_OFFSET_FROM_EXTRUDER 0 // Probe on: -front +behind
#define Z_PROBE_OFFSET_FROM_EXTRUDER -1 // -below (always!)
#define Z_RAISE_BEFORE_HOMING 10 // (in mm) Raise Z before homing (G28) for Probe Clearance.
//
// +-- BACK ---+
// | |
// L | (+) P | R <-- probe (10,10)
// E | | I
// F | (-) N (+) | G <-- nozzle (0,0)
// T | | H
// | P (-) | T <-- probe (-10,-10)
// | |
// O-- FRONT --+
#define X_PROBE_OFFSET_FROM_EXTRUDER 0 // X offset: -left [of the nozzle] +right
#define Y_PROBE_OFFSET_FROM_EXTRUDER 0 // Y offset: -front [of the nozzle] +behind
#define Z_PROBE_OFFSET_FROM_EXTRUDER -1 // Z offset: -below [of the nozzle] (always negative!)
#define Z_RAISE_BEFORE_HOMING 10 // (in mm) Raise Z before homing (G28) for Probe Clearance.
// Be sure you have this distance over your Z_MAX_POS in case
#define Z_RAISE_BEFORE_PROBING 10 //How much the extruder will be raised before travelling to the first probing point.
#define Z_RAISE_BETWEEN_PROBINGS 5 //How much the extruder will be raised when travelling from between next probing points
#define Z_RAISE_AFTER_PROBING 5 //How much the extruder will be raised after the last probing point.
#define Z_RAISE_BEFORE_PROBING 10 //How much the extruder will be raised before travelling to the first probing point.
#define Z_RAISE_BETWEEN_PROBINGS 5 //How much the extruder will be raised when travelling from between next probing points
#define Z_RAISE_AFTER_PROBING 5 //How much the extruder will be raised after the last probing point.
//#define Z_PROBE_END_SCRIPT "G1 Z10 F8000\nG1 X10 Y10\nG1 Z0.5" // These commands will be executed in the end of G29 routine.
// Useful to retract a deployable Z probe.
......@@ -419,9 +429,9 @@
* For the other hotends it is their distance from the hotend 0. *
* *
*****************************************************************************************/
//#define HOTEND_OFFSET_X {0.0, 5.0, 0.0, 0.0} // (in mm) for each hotend, offset of the hotend on the X axis
//#define HOTEND_OFFSET_Y {0.0, 5.0, 0.0, 0.0} // (in mm) for each hotend, offset of the hotend on the Y axis
//#define HOTEND_OFFSET_Z {0.0, 0.0, 0.0, 0.0} // (in mm) for each hotend, offset of the hotend on the Z axis
#define HOTEND_OFFSET_X {0.0, 0.0, 0.0, 0.0} // (in mm) for each hotend, offset of the hotend on the X axis
#define HOTEND_OFFSET_Y {0.0, 0.0, 0.0, 0.0} // (in mm) for each hotend, offset of the hotend on the Y axis
#define HOTEND_OFFSET_Z {0.0, 0.0, 0.0, 0.0} // (in mm) for each hotend, offset of the hotend on the Z axis
/*****************************************************************************************/
......
......@@ -46,7 +46,8 @@
/*****************************************************************************************
************************************* Core settings *************************************
*****************************************************************************************
* This define the moltiplicator axis from X to Y or Z in COREXY or COREXZ. *
* This define the moltiplicator axis from X to Y or Z in *
* COREXY - COREYX or COREXZ - COREZX *
* Example: *
* COREXY set COREX_YZ_FACTOR 1 *
* The result is: *
......@@ -299,16 +300,26 @@
// Offsets to the probe relative to the extruder tip (Hotend - Probe)
// X and Y offsets MUST be INTEGERS
#define X_PROBE_OFFSET_FROM_EXTRUDER 0 // Probe on: -left +right
#define Y_PROBE_OFFSET_FROM_EXTRUDER 0 // Probe on: -front +behind
#define Z_PROBE_OFFSET_FROM_EXTRUDER -1 // -below (always!)
#define Z_RAISE_BEFORE_HOMING 10 // (in mm) Raise Z before homing (G28) for Probe Clearance.
//
// +-- BACK ---+
// | |
// L | (+) P | R <-- probe (10,10)
// E | | I
// F | (-) N (+) | G <-- nozzle (0,0)
// T | | H
// | P (-) | T <-- probe (-10,-10)
// | |
// O-- FRONT --+
#define X_PROBE_OFFSET_FROM_EXTRUDER 0 // X offset: -left [of the nozzle] +right
#define Y_PROBE_OFFSET_FROM_EXTRUDER 0 // Y offset: -front [of the nozzle] +behind
#define Z_PROBE_OFFSET_FROM_EXTRUDER -1 // Z offset: -below [of the nozzle] (always negative!)
#define Z_RAISE_BEFORE_HOMING 10 // (in mm) Raise Z before homing (G28) for Probe Clearance.
// Be sure you have this distance over your Z_MAX_POS in case
#define Z_RAISE_BEFORE_PROBING 10 //How much the extruder will be raised before travelling to the first probing point.
#define Z_RAISE_BETWEEN_PROBINGS 5 //How much the extruder will be raised when travelling from between next probing points
#define Z_RAISE_AFTER_PROBING 5 //How much the extruder will be raised after the last probing point.
#define Z_RAISE_BEFORE_PROBING 10 //How much the extruder will be raised before travelling to the first probing point.
#define Z_RAISE_BETWEEN_PROBINGS 5 //How much the extruder will be raised when travelling from between next probing points
#define Z_RAISE_AFTER_PROBING 5 //How much the extruder will be raised after the last probing point.
//#define Z_PROBE_END_SCRIPT "G1 Z10 F8000\nG1 X10 Y10\nG1 Z0.5" // These commands will be executed in the end of G29 routine.
// Useful to retract a deployable Z probe.
......@@ -440,9 +451,9 @@
* For the other hotends it is their distance from the hotend 0. *
* *
*****************************************************************************************/
//#define HOTEND_OFFSET_X {0.0, 5.0, 0.0, 0.0} // (in mm) for each hotend, offset of the hotend on the X axis
//#define HOTEND_OFFSET_Y {0.0, 5.0, 0.0, 0.0} // (in mm) for each hotend, offset of the hotend on the Y axis
//#define HOTEND_OFFSET_Z {0.0, 0.0, 0.0, 0.0} // (in mm) for each hotend, offset of the hotend on the Z axis
#define HOTEND_OFFSET_X {0.0, 0.0, 0.0, 0.0} // (in mm) for each hotend, offset of the hotend on the X axis
#define HOTEND_OFFSET_Y {0.0, 0.0, 0.0, 0.0} // (in mm) for each hotend, offset of the hotend on the Y axis
#define HOTEND_OFFSET_Z {0.0, 0.0, 0.0, 0.0} // (in mm) for each hotend, offset of the hotend on the Z axis
/*****************************************************************************************/
#endif
\ No newline at end of file
......@@ -118,8 +118,21 @@
#define PROBE_COUNT 3
// Z-Probe variables
// X, Y, Z, E distance between hotend nozzle and deployed bed leveling probe.
#define Z_PROBE_OFFSET {0, 0, -1}
// Offsets to the probe relative to the extruder tip (Hotend - Probe)
// X and Y offsets MUST be INTEGERS
//
// +-- BACK ---+
// | |
// L | (+) P | R <-- probe (10,10)
// E | | I
// F | (-) N (+) | G <-- nozzle (0,0)
// T | | H
// | P (-) | T <-- probe (-10,-10)
// | |
// O-- FRONT --+
#define X_PROBE_OFFSET_FROM_EXTRUDER 0 // X offset: -left [of the nozzle] +right
#define Y_PROBE_OFFSET_FROM_EXTRUDER 0 // Y offset: -front [of the nozzle] +behind
#define Z_PROBE_OFFSET_FROM_EXTRUDER -1 // Z offset: -below [of the nozzle] (always negative!)
// Start and end location values are used to deploy/retract the probe (will move from start to end and back again)
#define Z_PROBE_DEPLOY_START_LOCATION {0, 0, 20} // X, Y, Z, E start location for z-probe deployment sequence
......@@ -377,9 +390,9 @@
* For the other hotends it is their distance from the hotend 0. *
* *
*****************************************************************************************/
//#define HOTEND_OFFSET_X {0.0, 5.0, 0.0, 0.0} // (in mm) for each hotend, offset of the hotend on the X axis
//#define HOTEND_OFFSET_Y {0.0, 5.0, 0.0, 0.0} // (in mm) for each hotend, offset of the hotend on the Y axis
//#define HOTEND_OFFSET_Z {0.0, 0.0, 0.0, 0.0} // (in mm) for each hotend, offset of the hotend on the Z axis
#define HOTEND_OFFSET_X {0.0, 0.0, 0.0, 0.0} // (in mm) for each hotend, offset of the hotend on the X axis
#define HOTEND_OFFSET_Y {0.0, 0.0, 0.0, 0.0} // (in mm) for each hotend, offset of the hotend on the Y axis
#define HOTEND_OFFSET_Z {0.0, 0.0, 0.0, 0.0} // (in mm) for each hotend, offset of the hotend on the Z axis
/*****************************************************************************************/
#endif
\ No newline at end of file
......@@ -182,9 +182,9 @@
#define LPQ_MAX_LEN 50
// HotEnd{HE0,HE1,HE2,HE3}
#define DEFAULT_Kp {40, 40, 40, 40} // Kp for E0, E1, E2, E3
#define DEFAULT_Ki {07, 07, 07, 07} // Ki for E0, E1, E2, E3
#define DEFAULT_Kd {60, 60, 60, 60} // Kd for E0, E1, E2, E3
#define DEFAULT_Kp {40, 40, 40, 40} // Kp for H0, H1, H2, H3
#define DEFAULT_Ki {07, 07, 07, 07} // Ki for H0, H1, H2, H3
#define DEFAULT_Kd {60, 60, 60, 60} // Kd for H0, H1, H2, H3
#define DEFAULT_Kc {100, 100, 100, 100} // heating power = Kc * (e_speed)
/***********************************************************************/
......
......@@ -16,10 +16,10 @@
*
*/
#define EEPROM_VERSION "V25"
#define EEPROM_VERSION "MKV428"
/**
* V25 EEPROM Layout:
* MKV428 EEPROM Layout:
*
* ver
* M92 XYZ E0 ... axis_steps_per_unit X,Y,Z,E0 ... (per extruder)
......@@ -33,15 +33,13 @@
* M205 B minsegmenttime
* M205 X max_xy_jerk
* M205 Z max_z_jerk
* M205 E E0 ... max_e_jerk (per extruder)
* M205 E E0 ... max_e_jerk (per extruder)
* M206 XYZ home_offset (x3)
* M218 T XY hotend_offset (x4) (T0..3)
* M666 P zprobe_zoffset
*
* HOTENDS OFFSET:
* M218 T XY hotend_offset (x4) (T0..3)
*
* HOTENDS AD595:
* M595 T O G Hotend AD595 Offset & Gain
* M595 H OS Hotend AD595 Offset & Gain
*
* DELTA:
* M666 XYZ endstop_adj (x3)
......@@ -137,7 +135,7 @@ void _EEPROM_readData(int& pos, uint8_t* value, uint8_t size) {
void Config_StoreSettings() {
float dummy = 0.0f;
char ver[4] = "000";
char ver[7] = "000000";
int i = EEPROM_OFFSET;
EEPROM_WRITE_VAR(i, ver); // invalidate data first
EEPROM_WRITE_VAR(i, axis_steps_per_unit);
......@@ -153,15 +151,12 @@ void Config_StoreSettings() {
EEPROM_WRITE_VAR(i, max_z_jerk);
EEPROM_WRITE_VAR(i, max_e_jerk);
EEPROM_WRITE_VAR(i, home_offset);
EEPROM_WRITE_VAR(i, hotend_offset);
#if !MECH(DELTA)
EEPROM_WRITE_VAR(i, zprobe_zoffset);
#endif
#if HOTENDS > 1
EEPROM_WRITE_VAR(i, hotend_offset);
#endif
#if HEATER_USES_AD595
EEPROM_WRITE_VAR(i, ad595_offset);
EEPROM_WRITE_VAR(i, ad595_gain);
......@@ -248,11 +243,9 @@ void Config_StoreSettings() {
EEPROM_WRITE_VAR(i, volumetric_enabled);
// Save filament sizes
for (int q = 0; q < 4; q++) {
if (q < EXTRUDERS) dummy = filament_size[q];
EEPROM_WRITE_VAR(i, dummy);
}
for (int e = 0; e < EXTRUDERS; e++)
EEPROM_WRITE_VAR(i, filament_size[e]);
#if ENABLED(IDLE_OOZING_PREVENT)
EEPROM_WRITE_VAR(i, IDLE_OOZING_enabled);
#endif
......@@ -261,7 +254,7 @@ void Config_StoreSettings() {
EEPROM_WRITE_VAR(i, motor_current);
#endif
char ver2[4] = EEPROM_VERSION;
char ver2[7] = EEPROM_VERSION;
int j = EEPROM_OFFSET;
EEPROM_WRITE_VAR(j, ver2); // validate data
......@@ -276,12 +269,12 @@ void Config_StoreSettings() {
void Config_RetrieveSettings() {
int i = EEPROM_OFFSET;
char stored_ver[4];
char ver[4] = EEPROM_VERSION;
EEPROM_READ_VAR(i, stored_ver); //read stored version
// ECHO_EM("Version: [" << ver << "] Stored version: [" << stored_ver << "]");
char stored_ver[7];
char ver[7] = EEPROM_VERSION;
EEPROM_READ_VAR(i, stored_ver); // read stored version
//ECHO_EM("Version: [" << ver << "] Stored version: [" << stored_ver << "]");
if (strncmp(ver, stored_ver, 3) != 0) {
if (strncmp(ver, stored_ver, 6) != 0) {
Config_ResetDefault();
}
else {
......@@ -305,15 +298,12 @@ void Config_RetrieveSettings() {
EEPROM_READ_VAR(i, max_z_jerk);
EEPROM_READ_VAR(i, max_e_jerk);
EEPROM_READ_VAR(i, home_offset);
EEPROM_READ_VAR(i, hotend_offset);
#if !MECH(DELTA)
EEPROM_READ_VAR(i, zprobe_zoffset);
#endif
#if HOTENDS > 1
EEPROM_READ_VAR(i, hotend_offset);
#endif
#if HEATER_USES_AD595
EEPROM_READ_VAR(i, ad595_offset);
EEPROM_READ_VAR(i, ad595_gain);
......@@ -400,10 +390,8 @@ void Config_RetrieveSettings() {
EEPROM_READ_VAR(i, volumetric_enabled);
for (int8_t q = 0; q < 4; q++) {
EEPROM_READ_VAR(i, dummy);
if (q < EXTRUDERS) filament_size[q] = dummy;
}
for (int8_t e = 0; e < EXTRUDERS; e++)
EEPROM_READ_VAR(i, filament_size[e]);
calculate_volumetric_multipliers();
......@@ -489,23 +477,21 @@ void Config_ResetDefault() {
max_e_jerk[i] = tmp5[i];
else
max_e_jerk[i] = tmp5[max_i - 1];
#if HOTENDS > 1
max_i = sizeof(tmp10) / sizeof(*tmp10);
if(i < max_i)
hotend_offset[X_AXIS][i] = tmp10[i];
else
hotend_offset[X_AXIS][i] = 0;
max_i = sizeof(tmp11) / sizeof(*tmp11);
if(i < max_i)
hotend_offset[Y_AXIS][i] = tmp11[i];
else
hotend_offset[Y_AXIS][i] = 0;
max_i = sizeof(tmp12) / sizeof(*tmp12);
if(i < max_i)
hotend_offset[Z_AXIS][i] = tmp12[i];
else
hotend_offset[Z_AXIS][i] = 0;
#endif // HOTENDS > 1
max_i = sizeof(tmp10) / sizeof(*tmp10);
if(i < max_i)
hotend_offset[X_AXIS][i] = tmp10[i];
else
hotend_offset[X_AXIS][i] = 0;
max_i = sizeof(tmp11) / sizeof(*tmp11);
if(i < max_i)
hotend_offset[Y_AXIS][i] = tmp11[i];
else
hotend_offset[Y_AXIS][i] = 0;
max_i = sizeof(tmp12) / sizeof(*tmp12);
if(i < max_i)
hotend_offset[Z_AXIS][i] = tmp12[i];
else
hotend_offset[Z_AXIS][i] = 0;
}
#if MB(ALLIGATOR)
max_i = sizeof(tmp13) / sizeof(*tmp13);
......@@ -557,7 +543,9 @@ void Config_ResetDefault() {
diagrod_adj[1] = TOWER_B_DIAGROD_ADJ;
diagrod_adj[2] = TOWER_C_DIAGROD_ADJ;
max_pos[2] = MANUAL_Z_HOME_POS;
set_default_z_probe_offset();
z_probe_offset[0] = X_PROBE_OFFSET_FROM_EXTRUDER;
z_probe_offset[1] = Y_PROBE_OFFSET_FROM_EXTRUDER;
z_probe_offset[2] = Z_PROBE_OFFSET_FROM_EXTRUDER;
set_delta_constants();
#endif
......@@ -717,17 +705,15 @@ void Config_ResetDefault() {
ECHO_MV(" Y", home_offset[Y_AXIS] );
ECHO_EMV(" Z", home_offset[Z_AXIS] );
#if HOTENDS > 1
if (!forReplay) {
ECHO_LM(CFG, "Hotend offset (mm):");
}
for (int8_t h = 0; h < HOTENDS; h++) {
ECHO_SMV(CFG, " M218 T", h);
ECHO_MV(" X", hotend_offset[X_AXIS][h]);
ECHO_MV(" Y", hotend_offset[Y_AXIS][h]);
ECHO_EMV(" Z", hotend_offset[Z_AXIS][h]);
}
#endif // HOTENDS > 1
if (!forReplay) {
ECHO_LM(CFG, "Hotend offset (mm):");
}
for (int8_t h = 0; h < HOTENDS; h++) {
ECHO_SMV(CFG, " M218 T", h);
ECHO_MV(" X", hotend_offset[X_AXIS][h]);
ECHO_MV(" Y", hotend_offset[Y_AXIS][h]);
ECHO_EMV(" Z", hotend_offset[Z_AXIS][h]);
}
#if HEATER_USES_AD595
if (!forReplay) {
......@@ -736,7 +722,7 @@ void Config_ResetDefault() {
for (int8_t h = 0; h < HOTENDS; h++) {
ECHO_SMV(CFG, " M595 T", h);
ECHO_MV(" O", ad595_offset[h]);
ECHO_EMV(", G", ad595_gain[h]);
ECHO_EMV(", S", ad595_gain[h]);
}
#endif // HEATER_USES_AD595
......
......@@ -23,8 +23,12 @@
#include "Configuration_Cartesian.h"
#elif MECH(COREXY)
#include "Configuration_Core.h"
#elif MECH(COREYX)
#include "Configuration_Core.h"
#elif MECH(COREXZ)
#include "Configuration_Core.h"
#elif MECH(COREZX)
#include "Configuration_Core.h"
#elif MECH(DELTA)
#include "Configuration_Delta.h"
#elif MECH(SCARA)
......
......@@ -74,6 +74,7 @@ bool volumetric_enabled = false;
float filament_size[EXTRUDERS] = ARRAY_BY_EXTRUDERS(DEFAULT_NOMINAL_FILAMENT_DIA);
float volumetric_multiplier[EXTRUDERS] = ARRAY_BY_EXTRUDERS(1.0);
float home_offset[3] = { 0 };
float hotend_offset[3][HOTENDS];
float min_pos[3] = { X_MIN_POS, Y_MIN_POS, Z_MIN_POS };
float max_pos[3] = { X_MAX_POS, Y_MAX_POS, Z_MAX_POS };
......@@ -115,11 +116,6 @@ double printer_usage_filament;
float z_endstop_adj = 0;
#endif
// Hotend offset
#if HOTENDS > 1
float hotend_offset[3][HOTENDS];
#endif
#if HEATER_USES_AD595
float ad595_offset[HOTENDS] = ARRAY_BY_HOTENDS1(TEMP_SENSOR_AD595_OFFSET);
float ad595_gain[HOTENDS] = ARRAY_BY_HOTENDS1(TEMP_SENSOR_AD595_GAIN);
......@@ -136,6 +132,10 @@ double printer_usage_filament;
bool Spool_must_write[EXTRUDERS] = ARRAY_BY_EXTRUDERS (false);
#endif
#if HAS(SERVOS)
Servo servo[NUM_SERVOS];
#endif
#if HAS(SERVO_ENDSTOPS)
const int servo_endstop_id[] = SERVO_ENDSTOP_IDS;
const int servo_endstop_angle[][2] = {X_ENDSTOP_SERVO_ANGLES, Y_ENDSTOP_SERVO_ANGLES, Z_ENDSTOP_SERVO_ANGLES};
......@@ -173,6 +173,11 @@ double printer_usage_filament;
#endif
#if MECH(DELTA)
#define TOWER_1 X_AXIS
#define TOWER_2 Y_AXIS
#define TOWER_3 Z_AXIS
float delta[3] = { 0.0 };
float delta_tmp[3] = { 0.0 };
float endstop_adj[3] = { 0 };
......@@ -191,7 +196,7 @@ double printer_usage_filament;
float base_max_pos[3] = {X_MAX_POS, Y_MAX_POS, Z_MAX_POS};
float base_home_pos[3] = {X_HOME_POS, Y_HOME_POS, Z_HOME_POS};
float max_length[3] = {X_MAX_LENGTH, Y_MAX_LENGTH, Z_MAX_LENGTH};
float z_probe_offset[3] = Z_PROBE_OFFSET;
float z_probe_offset[3];
float bed_level[AUTO_BED_LEVELING_GRID_POINTS][AUTO_BED_LEVELING_GRID_POINTS];
int delta_grid_spacing[2] = { 0, 0 };
const float bed_radius = DELTA_PROBABLE_RADIUS;
......@@ -293,10 +298,6 @@ double printer_usage_filament;
bool allow_lengthy_extrude_once; // for load/unload
#endif
#if HAS(SERVOS)
Servo servo[NUM_SERVOS];
#endif
#if HAS(CHDK)
unsigned long chdkHigh = 0;
boolean chdkActive = false;
......@@ -320,8 +321,6 @@ void process_next_command();
void plan_arc(float target[NUM_AXIS], float* offset, uint8_t clockwise);
bool setTargetedExtruder(int code);
#if ENABLED(PREVENT_DANGEROUS_EXTRUDE)
float extrude_min_temp = EXTRUDE_MINTEMP;
#endif
......@@ -973,7 +972,7 @@ DEFINE_PGM_READ_ANY(signed char, byte);
static inline type array(int axis) \
{ return pgm_read_any(&array##_P[axis]); }
#if MECH(CARTESIAN) || MECH(COREXY) || MECH(COREXZ) || MECH(SCARA)
#if MECH(CARTESIAN) || MECH(COREXY) || MECH(COREYX) || MECH(COREXZ) || MECH(COREZX) || MECH(SCARA)
XYZ_CONSTS_FROM_CONFIG(float, base_max_pos, MAX_POS);
XYZ_CONSTS_FROM_CONFIG(float, base_home_pos, HOME_POS);
XYZ_CONSTS_FROM_CONFIG(float, max_length, MAX_LENGTH);
......@@ -1126,7 +1125,7 @@ inline void sync_plan_position() {
#if MECH(DELTA) || MECH(SCARA)
inline void sync_plan_position_delta() {
calculate_delta(current_position);
plan_set_position(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], current_position[E_AXIS]);
plan_set_position(delta[TOWER_1], delta[TOWER_2], delta[TOWER_3], current_position[E_AXIS]);
}
#endif
inline void set_current_to_destination() { memcpy(current_position, destination, sizeof(current_position)); }
......@@ -1150,7 +1149,7 @@ static void clean_up_after_endstop_move() {
endstops_hit_on_purpose(); // clear endstop hit flags
}
#if MECH(CARTESIAN) || MECH(COREXY) || MECH(COREXZ) || MECH(SCARA)
#if MECH(CARTESIAN) || MECH(COREXY) || MECH(COREYX) || MECH(COREXZ) || MECH(COREZX) || MECH(SCARA)
/**
* Plan a move to (X, Y, Z) and set the current_position
......@@ -1534,7 +1533,7 @@ static void clean_up_after_endstop_move() {
}
}
#define HOMEAXIS(LETTER) homeaxis(LETTER##_AXIS)
#endif // CARTESIAN || COREXY || COREXZ || SCARA
#endif // CARTESIAN || COREXY || COREYX || COREXZ || COREZX || SCARA
#if MECH(DELTA)
static void homeaxis(AxisEnum axis) {
......@@ -1611,11 +1610,6 @@ static void clean_up_after_endstop_move() {
}
#define HOMEAXIS(LETTER) homeaxis(LETTER##_AXIS)
void set_default_z_probe_offset() {
float default_z_probe_offset[] = Z_PROBE_OFFSET;
memcpy(z_probe_offset, default_z_probe_offset, sizeof(z_probe_offset));
}
void set_delta_constants() {
max_length[Z_AXIS] = max_pos[Z_AXIS] - Z_MIN_POS;
base_max_pos[Z_AXIS] = max_pos[Z_AXIS];
......@@ -1758,7 +1752,7 @@ static void clean_up_after_endstop_move() {
endstop_adj[Z_AXIS] += z_endstop;
calculate_delta(current_position);
plan_set_position(delta[X_AXIS] - (endstop_adj[X_AXIS] - saved_endstop_adj[X_AXIS]) , delta[Y_AXIS] - (endstop_adj[Y_AXIS] - saved_endstop_adj[Y_AXIS]), delta[Z_AXIS] - (endstop_adj[Z_AXIS] - saved_endstop_adj[Z_AXIS]), current_position[E_AXIS]);
plan_set_position(delta[TOWER_1] - (endstop_adj[X_AXIS] - saved_endstop_adj[X_AXIS]) , delta[TOWER_2] - (endstop_adj[Y_AXIS] - saved_endstop_adj[Y_AXIS]), delta[TOWER_3] - (endstop_adj[Z_AXIS] - saved_endstop_adj[Z_AXIS]), current_position[E_AXIS]);
st_synchronize();
}
......@@ -2477,20 +2471,20 @@ static void clean_up_after_endstop_move() {
}
refresh_cmd_timeout();
calculate_delta(destination);
plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], destination[E_AXIS], feedrate * feedrate_multiplier / 60 / 100.0, active_extruder, active_driver);
plan_buffer_line(delta[TOWER_1], delta[TOWER_2], delta[TOWER_3], destination[E_AXIS], feedrate * feedrate_multiplier / 60 / 100.0, active_extruder, active_driver);
set_current_to_destination();
}
void calculate_delta(float cartesian[3]) {
delta[X_AXIS] = sqrt(delta_diagonal_rod_1
delta[TOWER_1] = sqrt(delta_diagonal_rod_1
- sq(delta_tower1_x - cartesian[X_AXIS])
- sq(delta_tower1_y - cartesian[Y_AXIS])
) + cartesian[Z_AXIS];
delta[Y_AXIS] = sqrt(delta_diagonal_rod_2
delta[TOWER_2] = sqrt(delta_diagonal_rod_2
- sq(delta_tower2_x - cartesian[X_AXIS])
- sq(delta_tower2_y - cartesian[Y_AXIS])
) + cartesian[Z_AXIS];
delta[Z_AXIS] = sqrt(delta_diagonal_rod_3
delta[TOWER_3] = sqrt(delta_diagonal_rod_3
- sq(delta_tower3_x - cartesian[X_AXIS])
- sq(delta_tower3_y - cartesian[Y_AXIS])
) + cartesian[Z_AXIS];
......@@ -2514,9 +2508,9 @@ static void clean_up_after_endstop_move() {
right = (1 - ratio_y) * z3 + ratio_y * z4,
offset = (1 - ratio_x) * left + ratio_x * right;
delta[X_AXIS] += offset;
delta[Y_AXIS] += offset;
delta[Z_AXIS] += offset;
delta[TOWER_1] += offset;
delta[TOWER_2] += offset;
delta[TOWER_3] += offset;
if (debugLevel & DEBUG_DEBUG) {
ECHO_SMV(DEB, "grid_x=", grid_x);
......@@ -2730,10 +2724,10 @@ static void clean_up_after_endstop_move() {
ECHO_MV(" ADC B:", degBed(), 1);
ECHO_MV("C->", rawBedTemp() / OVERSAMPLENR, 0);
#endif
for (uint8_t cur_hotend = 0; cur_hotend < HOTENDS; ++cur_hotend) {
ECHO_MV(" T", cur_hotend);
ECHO_MV(":", degHotend(cur_hotend), 1);
ECHO_MV("C->", rawHotendTemp(cur_hotend) / OVERSAMPLENR, 0);
for (uint8_t h = 0; h < HOTENDS; ++h) {
ECHO_MV(" T", h);
ECHO_MV(":", degHotend(h), 1);
ECHO_MV("C->", rawHotendTemp(h) / OVERSAMPLENR, 0);
}
#endif
}
......@@ -2827,7 +2821,7 @@ void gcode_get_destination() {
for (int i = 0; i < NUM_AXIS; i++) {
if (code_seen(axis_codes[i])) {
destination[i] = code_value() + (axis_relative_modes[i] || relative_mode ? current_position[i] : 0);
destination[i] = code_value() + (axis_relative_modes[i] || relative_mode ? current_position[i] : -hotend_offset[i][active_extruder]);
}
else {
destination[i] = current_position[i];
......@@ -5167,7 +5161,7 @@ inline void gcode_M114() {
zpos = count_position[Z_AXIS];
CRITICAL_SECTION_END;
#if MECH(COREXY) || MECH(COREXZ)
#if MECH(COREXY) || MECH(COREYX) || MECH(COREXZ) || MECH(COREZX)
ECHO_M(MSG_COUNT_A);
#elif MECH(DELTA)
ECHO_M(MSG_COUNT_ALPHA);
......@@ -5176,7 +5170,7 @@ inline void gcode_M114() {
#endif
ECHO_V(xpos);
#if ENABLED(COREXY)
#if MECH(COREXY) || MECH(COREYX)
ECHO_M(" B:");
#elif MECH(DELTA)
ECHO_M(" Beta:");
......@@ -5185,7 +5179,7 @@ inline void gcode_M114() {
#endif
ECHO_V(ypos);
#if ENABLED(COREXZ)
#if MECH(COREXZ) || MECH(COREZX)
ECHO_M(" C:");
#elif MECH(DELTA)
ECHO_M(" Teta:");
......@@ -5685,27 +5679,24 @@ inline void gcode_M206() {
}
#endif // FWRETRACT
#if HOTENDS > 1
/**
* M218 - set hotend offset (in mm), T<extruder_number> X<offset_on_X> Y<offset_on_Y>
*/
inline void gcode_M218() {
if (setTargetedExtruder(218)) return;
/**
* M218 - set hotend offset (in mm), H<hotend_number> X<offset_on_X> Y<offset_on_Y> Z<offset_on_Z>
*/
inline void gcode_M218() {
if (setTargetedHotend(218)) return;
if (code_seen('X')) hotend_offset[X_AXIS][target_extruder] = code_value();
if (code_seen('Y')) hotend_offset[Y_AXIS][target_extruder] = code_value();
if (code_seen('Z')) hotend_offset[Z_AXIS][target_extruder] = code_value();
if (code_seen('X')) hotend_offset[X_AXIS][target_extruder] = code_value();
if (code_seen('Y')) hotend_offset[Y_AXIS][target_extruder] = code_value();
if (code_seen('Z')) hotend_offset[Z_AXIS][target_extruder] = code_value();
ECHO_SM(DB, SERIAL_HOTEND_OFFSET);
for (int e = 0; e < HOTENDS; e++) {
ECHO_MV(" ", hotend_offset[X_AXIS][e]);
ECHO_MV(",", hotend_offset[Y_AXIS][e]);
ECHO_MV(",", hotend_offset[Z_AXIS][e]);
}
ECHO_E;
ECHO_SM(DB, SERIAL_HOTEND_OFFSET);
for (uint8_t h = 0; h < HOTENDS; h++) {
ECHO_MV(" ", hotend_offset[X_AXIS][h]);
ECHO_MV(",", hotend_offset[Y_AXIS][h]);
ECHO_MV(",", hotend_offset[Z_AXIS][h]);
}
#endif // HOTENDS > 1
ECHO_E;
}
/**
* M220: Set speed percentage factor, aka "Feed Rate" (M220 S95)
......@@ -5898,25 +5889,25 @@ inline void gcode_M226() {
// multi-hotend PID patch: M301 updates or prints a single hotend's PID values
// default behaviour (omitting E parameter) is to update for hotend 0 only
int e = code_seen('H') ? code_value() : 0; // hotend being updated
int h = code_seen('H') ? code_value() : 0; // hotend being updated
if (e < HOTENDS) { // catch bad input value
if (code_seen('P')) PID_PARAM(Kp, e) = code_value();
if (code_seen('I')) PID_PARAM(Ki, e) = scalePID_i(code_value());
if (code_seen('D')) PID_PARAM(Kd, e) = scalePID_d(code_value());
if (h < HOTENDS) { // catch bad input value
if (code_seen('P')) PID_PARAM(Kp, h) = code_value();
if (code_seen('I')) PID_PARAM(Ki, h) = scalePID_i(code_value());
if (code_seen('D')) PID_PARAM(Kd, h) = scalePID_d(code_value());
#if ENABLED(PID_ADD_EXTRUSION_RATE)
if (code_seen('C')) PID_PARAM(Kc, e) = code_value();
if (code_seen('C')) PID_PARAM(Kc, h) = code_value();
if (code_seen('L')) lpq_len = code_value();
NOMORE(lpq_len, LPQ_MAX_LEN);
#endif
updatePID();
ECHO_SMV(OK, "e:", e);
ECHO_MV(" p:", PID_PARAM(Kp, e));
ECHO_MV(" i:", unscalePID_i(PID_PARAM(Ki, e)));
ECHO_MV(" d:", unscalePID_d(PID_PARAM(Kd, e)));
ECHO_SMV(OK, "H:", h);
ECHO_MV(" p:", PID_PARAM(Kp, h));
ECHO_MV(" i:", unscalePID_i(PID_PARAM(Ki, h)));
ECHO_MV(" d:", unscalePID_d(PID_PARAM(Kd, h)));
#if ENABLED(PID_ADD_EXTRUSION_RATE)
ECHO_MV(" c:", PID_PARAM(Kc, e));
ECHO_MV(" c:", PID_PARAM(Kc, h));
#endif
ECHO_E;
}
......@@ -6295,9 +6286,13 @@ inline void gcode_M400() { st_synchronize(); }
#if MECH(CARTESIAN)
ECHO_M("cartesian");
#elif MECH(COREXY)
ECHO_M("coreXY");
ECHO_M("corexy");
#elif MECH(COREYX)
ECHO_M("coreyx");
#elif MECH(COREXZ)
ECHO_M("coreXZ");
ECHO_M("corexz");
#elif MECH(COREZX)
ECHO_M("corezx");
#elif MECH(DELTA)
ECHO_M("delta");
#endif
......@@ -6574,21 +6569,21 @@ inline void gcode_M503() {
#if HEATER_USES_AD595
/**
* M595 - set Hotend AD595 offset & Gain T<hotend_number> O<offset> S<gain>
* M595 - set Hotend AD595 offset & Gain H<hotend_number> O<offset> S<gain>
*/
inline void gcode_M595() {
if (setTargetedExtruder(595)) return;
if (setTargetedHotend(595)) return;
if (code_seen('O')) ad595_offset[target_extruder] = code_value();
if (code_seen('S')) ad595_gain[target_extruder] = code_value();
for (int h = 0; h < HOTENDS; h++) {
for (uint8_t h = 0; h < HOTENDS; h++) {
// if gain == 0 you get MINTEMP!
if (ad595_gain[h] == 0) ad595_gain[h]= 1;
}
ECHO_LM(DB, MSG_AD595);
for (int h = 0; h < HOTENDS; h++) {
for (uint8_t h = 0; h < HOTENDS; h++) {
ECHO_SMV(DB, "T", h);
ECHO_MV(" Offset: ", ad595_offset[h]);
ECHO_EMV(", Gain: ", ad595_gain[h]);
......@@ -6625,7 +6620,7 @@ inline void gcode_M503() {
#if MECH(DELTA)
float fr60 = feedrate / 60;
#define RUNPLAN calculate_delta(destination); \
plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], destination[E_AXIS], fr60, active_extruder, active_driver);
plan_buffer_line(delta[TOWER_1], delta[TOWER_2], delta[TOWER_3], destination[E_AXIS], fr60, active_extruder, active_driver);
#else
#define RUNPLAN line_to_destination();
#endif
......@@ -6739,8 +6734,8 @@ inline void gcode_M503() {
#if MECH(DELTA)
// Move XYZ to starting position, then E
calculate_delta(lastpos);
plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], destination[E_AXIS], fr60, active_extruder, active_driver);
plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], lastpos[E_AXIS], fr60, active_extruder, active_driver);
plan_buffer_line(delta[TOWER_1], delta[TOWER_2], delta[TOWER_3], destination[E_AXIS], fr60, active_extruder, active_driver);
plan_buffer_line(delta[TOWER_1], delta[TOWER_2], delta[TOWER_3], lastpos[E_AXIS], fr60, active_extruder, active_driver);
#else
// Move XY to starting position, then Z, then E
destination[X_AXIS] = lastpos[X_AXIS];
......@@ -7046,14 +7041,6 @@ inline void gcode_T(uint8_t tmp_extruder) {
st_synchronize();
}
// apply Y & Z extruder offset (x offset is already used in determining home pos)
current_position[Y_AXIS] = current_position[Y_AXIS] -
hotend_offset[Y_AXIS][active_extruder] +
hotend_offset[Y_AXIS][target_extruder];
current_position[Z_AXIS] = current_position[Z_AXIS] -
hotend_offset[Z_AXIS][active_extruder] +
hotend_offset[Z_AXIS][target_extruder];
active_extruder = target_extruder;
// This function resets the max/min values - the current position may be overwritten below.
......@@ -7080,11 +7067,6 @@ inline void gcode_T(uint8_t tmp_extruder) {
delayed_move_time = 0;
}
#else // !DUAL_X_CARRIAGE
// Offset hotend (XYZ)
#if HOTENDS > 1
for (int i = X_AXIS; i <= Z_AXIS; i++)
current_position[i] += hotend_offset[i][target_extruder] - hotend_offset[i][active_extruder];
#endif // HOTENDS > 1
#if ENABLED(MKR4)
#if (EXTRUDERS == 4) && HAS(E0E2) && HAS(E1E3) && (DRIVER_EXTRUDERS == 2)
......@@ -7613,11 +7595,8 @@ void process_next_command() {
gcode_M209(); break;
#endif // FWRETRACT
#if HOTENDS > 1
case 218: // M218 - set hotend offset (in mm), T<extruder_number> X<offset_on_X> Y<offset_on_Y>
gcode_M218(); break;
#endif
case 218: // M218 - set hotend offset (in mm), T<extruder_number> X<offset_on_X> Y<offset_on_Y>
gcode_M218(); break;
case 220: // M220 S<factor in percent> - set speed factor override percentage
gcode_M220(); break;
case 221: // M221 T<extruder> S<factor in percent> - set extrude factor override percentage
......@@ -7922,12 +7901,12 @@ void clamp_to_software_endstops(float target[3]) {
ECHO_LMV(DEB, "target[X_AXIS]=", target[X_AXIS]);
ECHO_LMV(DEB, "target[Y_AXIS]=", target[Y_AXIS]);
ECHO_LMV(DEB, "target[Z_AXIS]=", target[Z_AXIS]);
ECHO_LMV(DEB, "delta[X_AXIS]=", delta[X_AXIS]);
ECHO_LMV(DEB, "delta[Y_AXIS]=", delta[Y_AXIS]);
ECHO_LMV(DEB, "delta[Z_AXIS]=", delta[Z_AXIS]);
ECHO_LMV(DEB, "delta[TOWER_1]=", delta[TOWER_1]);
ECHO_LMV(DEB, "delta[TOWER_2]=", delta[TOWER_2]);
ECHO_LMV(DEB, "delta[TOWER_3]=", delta[TOWER_3]);
}
plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], target[E_AXIS], frfm, active_extruder, active_driver);
plan_buffer_line(delta[TOWER_1], delta[TOWER_2], delta[TOWER_3], target[E_AXIS], frfm, active_extruder, active_driver);
}
return true;
}
......@@ -7976,7 +7955,7 @@ void clamp_to_software_endstops(float target[3]) {
#endif // DUAL_X_CARRIAGE
#if MECH(CARTESIAN) || MECH(COREXY) || MECH(COREXZ)
#if MECH(CARTESIAN) || MECH(COREXY) || MECH(COREYX) || MECH(COREXZ) || MECH(COREZX)
inline bool prepare_move_cartesian() {
// Do not use feedrate_multiplier for E or Z only moves
......@@ -7989,7 +7968,7 @@ void clamp_to_software_endstops(float target[3]) {
return true;
}
#endif // CARTESIAN || COREXY || COREXZ
#endif // CARTESIAN || COREXY || COREYX || COREXZ || COREZX
/**
* Prepare a single move and get ready for the next one
......@@ -8015,7 +7994,7 @@ void prepare_move() {
if (!prepare_move_dual_x_carriage()) return;
#endif
#if MECH(CARTESIAN) || MECH(COREXY) || MECH(COREXZ)
#if MECH(CARTESIAN) || MECH(COREXY) || MECH(COREYX) || MECH(COREXZ) || MECH(COREZX)
if (!prepare_move_cartesian()) return;
#endif
......@@ -8138,7 +8117,7 @@ void plan_arc(
#if MECH(DELTA) || MECH(SCARA)
calculate_delta(arc_target);
adjust_delta(arc_target);
plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], arc_target[E_AXIS], feed_rate, active_extruder, active_driver);
plan_buffer_line(delta[TOWER_1], delta[TOWER_2], delta[TOWER_3], arc_target[E_AXIS], feed_rate, active_extruder, active_driver);
#else
plan_buffer_line(arc_target[X_AXIS], arc_target[Y_AXIS], arc_target[Z_AXIS], arc_target[E_AXIS], feed_rate, active_extruder, active_driver);
#endif
......@@ -8148,7 +8127,7 @@ void plan_arc(
#if MECH(DELTA) || MECH(SCARA)
calculate_delta(target);
adjust_delta(target);
plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], target[E_AXIS], feed_rate, active_extruder, active_driver);
plan_buffer_line(delta[TOWER_1], delta[TOWER_2], delta[TOWER_3], target[E_AXIS], feed_rate, active_extruder, active_driver);
#else
plan_buffer_line(target[X_AXIS], target[Y_AXIS], target[Z_AXIS], target[E_AXIS], feed_rate, active_extruder, active_driver);
#endif
......@@ -8290,8 +8269,8 @@ void plan_arc(
float max_temp = 0.0;
if (millis() > next_status_led_update_ms) {
next_status_led_update_ms += 500; // Update every 0.5s
for (uint8_t cur_hotend = 0; cur_hotend < HOTENDS; ++cur_hotend)
max_temp = max(max(max_temp, degHotend(cur_hotend)), degTargetHotend(cur_hotend));
for (uint8_t h = 0; h < HOTENDS; ++h)
max_temp = max(max(max_temp, degHotend(h)), degTargetHotend(h));
#if HAS(TEMP_BED)
max_temp = max(max(max_temp, degTargetBed()), degBed());
#endif
......@@ -8677,6 +8656,19 @@ bool setTargetedExtruder(int code) {
return false;
}
bool setTargetedHotend(int code) {
target_extruder = active_extruder;
if (code_seen('H')) {
target_extruder = code_value_short();
if (target_extruder >= HOTENDS) {
ECHO_SMV(ER, "M", code);
ECHO_EMV(" " SERIAL_INVALID_HOTEND, target_extruder);
return true;
}
}
return false;
}
float calculate_volumetric_multiplier(float diameter) {
if (!volumetric_enabled || diameter == 0) return 1.0;
float d2 = diameter * 0.5;
......
......@@ -16,6 +16,9 @@ void manage_inactivity(bool ignore_stepper_queue = false);
void FlushSerialRequestResend();
void ok_to_send();
bool setTargetedExtruder(int code);
bool setTargetedHotend(int code);
#if MECH(DELTA)
float probe_bed(float x, float y);
void set_delta_constants();
......@@ -24,7 +27,6 @@ void ok_to_send();
void home_delta_axis();
void calibration_report();
void bed_probe_all();
void set_default_z_probe_offset();
void set_delta_constants();
void save_carriage_positions(int position_num);
void calculate_delta(float cartesian[3]);
......@@ -44,6 +46,7 @@ void ok_to_send();
extern float delta_radius;
extern float delta_diagonal_rod;
#endif
#if MECH(SCARA)
void calculate_delta(float cartesian[3]);
void calculate_SCARA_forward_Transform(float f_scara[3]);
......@@ -103,17 +106,13 @@ extern float volumetric_multiplier[EXTRUDERS]; // reciprocal of cross-sectional
extern float current_position[NUM_AXIS];
extern float destination[NUM_AXIS];
extern float home_offset[3];
extern float hotend_offset[3][HOTENDS];
extern float min_pos[3];
extern float max_pos[3];
extern float zprobe_zoffset;
extern uint8_t axis_known_position;
extern uint8_t axis_was_homed;
// Hotend offset
#if HOTENDS > 1
extern float hotend_offset[3][HOTENDS];
#endif // HOTENDS > 1
#if HEATER_USES_AD595
extern float ad595_offset[HOTENDS];
extern float ad595_gain[HOTENDS];
......@@ -123,13 +122,7 @@ extern uint8_t axis_was_homed;
extern uint8_t old_color; // old color for system NPR2
#endif
#if MECH(DELTA)
extern float z_probe_offset[3];
extern float endstop_adj[3];
extern float tower_adj[6];
extern float delta_radius;
extern float delta_diagonal_rod;
#elif ENABLED(Z_DUAL_ENDSTOPS)
#if ENABLED(Z_DUAL_ENDSTOPS)
extern float z_endstop_adj;
#endif
......
......@@ -85,9 +85,9 @@
#define ORIG_TEMP_2_PIN 3 // PA22, analog pin on piggy
#define ORIG_TEMP_3_PIN 4 // PA6, analog on piggy
#define LED_PWM1_PIN 40 // PC8
#define LED_PWM2_PIN 41 // PC9
#define LED_PWM3_PIN 36 // PC4
#define LED_PWM1_PIN 36 // PC4
#define LED_PWM2_PIN 40 // PC8
#define LED_PWM3_PIN 41 // PC9
#define EXP_VOLTAGE_LEVEL_PIN 65
......
......@@ -63,9 +63,13 @@
#if MECH(CARTESIAN)
#define SERIAL_M115_REPORT "FIRMWARE_NAME:" BUILD_VERSION " FIRMWARE_URL:" FIRMWARE_URL " PROTOCOL_VERSION:" PROTOCOL_VERSION " MACHINE_TYPE:Cartesian EXTRUDER_COUNT:" STRINGIFY(EXTRUDERS) " UUID:" MACHINE_UUID "\n"
#elif MECH(COREXY)
#define SERIAL_M115_REPORT "FIRMWARE_NAME:" BUILD_VERSION " FIRMWARE_URL:" FIRMWARE_URL " PROTOCOL_VERSION:" PROTOCOL_VERSION " MACHINE_TYPE:Core_XY EXTRUDER_COUNT:" STRINGIFY(EXTRUDERS) " UUID:" MACHINE_UUID "\n"
#define SERIAL_M115_REPORT "FIRMWARE_NAME:" BUILD_VERSION " FIRMWARE_URL:" FIRMWARE_URL " PROTOCOL_VERSION:" PROTOCOL_VERSION " MACHINE_TYPE:CoreXY EXTRUDER_COUNT:" STRINGIFY(EXTRUDERS) " UUID:" MACHINE_UUID "\n"
#elif MECH(COREYX)
#define SERIAL_M115_REPORT "FIRMWARE_NAME:" BUILD_VERSION " FIRMWARE_URL:" FIRMWARE_URL " PROTOCOL_VERSION:" PROTOCOL_VERSION " MACHINE_TYPE:CoreYX EXTRUDER_COUNT:" STRINGIFY(EXTRUDERS) " UUID:" MACHINE_UUID "\n"
#elif MECH(COREXZ)
#define SERIAL_M115_REPORT "FIRMWARE_NAME:" BUILD_VERSION " FIRMWARE_URL:" FIRMWARE_URL " PROTOCOL_VERSION:" PROTOCOL_VERSION " MACHINE_TYPE:Core_XZ EXTRUDER_COUNT:" STRINGIFY(EXTRUDERS) " UUID:" MACHINE_UUID "\n"
#define SERIAL_M115_REPORT "FIRMWARE_NAME:" BUILD_VERSION " FIRMWARE_URL:" FIRMWARE_URL " PROTOCOL_VERSION:" PROTOCOL_VERSION " MACHINE_TYPE:CoreXZ EXTRUDER_COUNT:" STRINGIFY(EXTRUDERS) " UUID:" MACHINE_UUID "\n"
#elif MECH(COREZX)
#define SERIAL_M115_REPORT "FIRMWARE_NAME:" BUILD_VERSION " FIRMWARE_URL:" FIRMWARE_URL " PROTOCOL_VERSION:" PROTOCOL_VERSION " MACHINE_TYPE:CoreZX EXTRUDER_COUNT:" STRINGIFY(EXTRUDERS) " UUID:" MACHINE_UUID "\n"
#elif MECH(DELTA)
#define SERIAL_M115_REPORT "FIRMWARE_NAME:" BUILD_VERSION " FIRMWARE_URL:" FIRMWARE_URL " PROTOCOL_VERSION:" PROTOCOL_VERSION " MACHINE_TYPE:Delta EXTRUDER_COUNT:" STRINGIFY(EXTRUDERS) " UUID:" MACHINE_UUID "\n"
#elif MECH(SCARA)
......@@ -91,6 +95,7 @@
#define SERIAL_BEGIN_FILE_LIST "Begin file list"
#define SERIAL_END_FILE_LIST "End file list"
#define SERIAL_INVALID_EXTRUDER "Invalid extruder"
#define SERIAL_INVALID_HOTEND "Invalid hotend"
#define SERIAL_INVALID_SOLENOID "Invalid solenoid"
#define SERIAL_ERR_NO_THERMISTORS "No thermistors - no temperature"
#define SERIAL_COUNT_X " Count X: "
......
......@@ -5,7 +5,9 @@
#define MECH_UNKNOWN -1
#define MECH_CARTESIAN 0
#define MECH_COREXY 1
#define MECH_COREXZ 2
#define MECH_COREYX 2
#define MECH_COREXZ 8
#define MECH_COREZX 9
#define MECH_DELTA 3
#define MECH_SCARA 4
......
......@@ -511,7 +511,7 @@ float junction_deviation = 0.1;
// The target position of the tool in absolute steps
// Calculate target position in absolute steps
//this should be done after the wait, because otherwise a M92 code within the gcode disrupts this calculation somehow
long target[NUM_AXIS];
int32_t target[NUM_AXIS];
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]);
......@@ -528,16 +528,22 @@ float junction_deviation = 0.1;
}
#endif
long dx = target[X_AXIS] - position[X_AXIS],
dy = target[Y_AXIS] - position[Y_AXIS],
dz = target[Z_AXIS] - position[Z_AXIS],
de = target[E_AXIS] - position[E_AXIS];
int32_t dx = target[X_AXIS] - position[X_AXIS],
dy = target[Y_AXIS] - position[Y_AXIS],
dz = target[Z_AXIS] - position[Z_AXIS],
de = target[E_AXIS] - position[E_AXIS];
#if MECH(COREXY)
long da = dx + COREX_YZ_FACTOR * dy;
long db = dx - COREX_YZ_FACTOR * dy;
int32_t da = dx + COREX_YZ_FACTOR * dy;
int32_t db = dx - COREX_YZ_FACTOR * dy;
#elif MECH(COREYX)
int32_t da = dy + COREX_YZ_FACTOR * dx;
int32_t db = dy - COREX_YZ_FACTOR * dx;
#elif MECH(COREXZ)
long da = dx + COREX_YZ_FACTOR * dz;
long dc = dx - COREX_YZ_FACTOR * dz;
int32_t da = dx + COREX_YZ_FACTOR * dz;
int32_t dc = dx - COREX_YZ_FACTOR * dz;
#elif MECH(COREZX)
int32_t da = dz + COREX_YZ_FACTOR * dx;
int32_t dc = dz - COREX_YZ_FACTOR * dx;
#endif
#if ENABLED(PREVENT_DANGEROUS_EXTRUDE)
......@@ -577,13 +583,12 @@ float junction_deviation = 0.1;
block->busy = false;
// Number of steps for each axis
#if MECH(COREXY)
#if MECH(COREXY) || MECH(COREYX)
// corexy planning
// these equations follow the form of the dA and dB equations on http://www.corexy.com/theory.html
block->steps[A_AXIS] = labs(da);
block->steps[B_AXIS] = labs(db);
block->steps[Z_AXIS] = labs(dz);
#elif MECH(COREXZ)
#elif MECH(COREXZ) || MECH(COREZX)
// corexz planning
block->steps[A_AXIS] = labs(da);
block->steps[Y_AXIS] = labs(dy);
......@@ -624,13 +629,13 @@ float junction_deviation = 0.1;
// Compute direction bits for this block
uint8_t dirb = 0;
#if MECH(COREXY)
#if MECH(COREXY) || MECH(COREYX)
if (dx < 0) SBI(dirb, X_HEAD); // Save the real Extruder (head) direction in X Axis
if (dy < 0) SBI(dirb, Y_HEAD); // ...and Y
if (dz < 0) SBI(dirb, Z_AXIS);
if (da < 0) SBI(dirb, A_AXIS); // Motor A direction
if (db < 0) SBI(dirb, B_AXIS); // Motor B direction
#elif MECH(COREXZ)
#elif MECH(COREXZ) || MECH(COREZX)
if (dx < 0) SBI(dirb, X_HEAD); // Save the real Extruder (head) direction in X Axis
if (dy < 0) SBI(dirb, Y_AXIS);
if (dz < 0) SBI(dirb, Z_HEAD); // ...and Z
......@@ -647,7 +652,7 @@ float junction_deviation = 0.1;
block->active_driver = driver;
// Enable active axes
#if MECH(COREXY)
#if MECH(COREXY) || MECH(COREYX)
if (block->steps[A_AXIS] || block->steps[B_AXIS]) {
enable_x();
enable_y();
......@@ -655,7 +660,7 @@ float junction_deviation = 0.1;
#if DISABLED(Z_LATE_ENABLE)
if (block->steps[Z_AXIS]) enable_z();
#endif
#elif MECH(COREXZ)
#elif MECH(COREXZ) || MECH(COREZX)
if (block->steps[A_AXIS] || block->steps[C_AXIS]) {
enable_x();
enable_z();
......@@ -815,14 +820,14 @@ float junction_deviation = 0.1;
* So we need to create other 2 "AXIS", named X_HEAD and Y_HEAD, meaning the real displacement of the Head.
* Having the real displacement of the head, we can calculate the total movement length and apply the desired speed.
*/
#if MECH(COREXY)
#if MECH(COREXY) || MECH(COREYX)
float delta_mm[6];
delta_mm[X_HEAD] = dx / axis_steps_per_unit[A_AXIS];
delta_mm[Y_HEAD] = dy / axis_steps_per_unit[B_AXIS];
delta_mm[Z_AXIS] = dz / axis_steps_per_unit[Z_AXIS];
delta_mm[A_AXIS] = da / axis_steps_per_unit[A_AXIS];
delta_mm[B_AXIS] = db / axis_steps_per_unit[B_AXIS];
#elif MECH(COREXZ)
#elif MECH(COREXZ) || MECH(COREZX)
float delta_mm[6];
delta_mm[X_HEAD] = dx / axis_steps_per_unit[A_AXIS];
delta_mm[Y_AXIS] = dy / axis_steps_per_unit[Y_AXIS];
......@@ -842,9 +847,9 @@ float junction_deviation = 0.1;
}
else {
block->millimeters = sqrt(
#if MECH(COREXY)
#if MECH(COREXY) || MECH(COREYX)
square(delta_mm[X_HEAD]) + square(delta_mm[Y_HEAD]) + square(delta_mm[Z_AXIS])
#elif MECH(COREXZ)
#elif MECH(COREXZ) || MECH(COREZX)
square(delta_mm[X_HEAD]) + square(delta_mm[Y_AXIS]) + square(delta_mm[Z_HEAD])
#else
square(delta_mm[X_AXIS]) + square(delta_mm[Y_AXIS]) + square(delta_mm[Z_AXIS])
......
......@@ -311,9 +311,9 @@ void checkHitEndstops() {
}
}
#if MECH(COREXY)
#if MECH(COREXY) || MECH(COREYX)
#define CORE_AXIS_2 B_AXIS
#elif MECH(COREXZ)
#elif MECH(COREXZ) || MECH(COREZX)
#define CORE_AXIS_2 C_AXIS
#endif
......@@ -342,7 +342,7 @@ inline void update_endstops() {
// TEST_ENDSTOP: test the old and the current status of an endstop
#define TEST_ENDSTOP(ENDSTOP) (TEST(current_endstop_bits, ENDSTOP) && TEST(old_endstop_bits, ENDSTOP))
#if MECH(COREXY) || MECH(COREXZ)
#if MECH(COREXY) || MECH(COREYX)|| MECH(COREXZ) || MECH(COREZX)
#define _SET_TRIGSTEPS(AXIS) do { \
float axis_pos = count_position[_AXIS(AXIS)]; \
......@@ -357,7 +357,7 @@ inline void update_endstops() {
#define _SET_TRIGSTEPS(AXIS) endstops_trigsteps[_AXIS(AXIS)] = count_position[_AXIS(AXIS)]
#endif // COREXY || COREXZ
#endif // COREXY || COREYX || COREXZ || COREZX
#define UPDATE_ENDSTOP(AXIS,MINMAX) do { \
SET_ENDSTOP_BIT(AXIS, MINMAX); \
......@@ -368,7 +368,7 @@ inline void update_endstops() {
} \
} while(0)
#if MECH(COREXY) || MECH(COREXZ)
#if MECH(COREXY) || MECH(COREYX)|| MECH(COREXZ) || MECH(COREZX)
// Head direction in -X axis for CoreXY and CoreXZ bots.
// If Delta1 == -Delta2, the movement is only in Y or Z axis
if ((current_block->steps[A_AXIS] != current_block->steps[CORE_AXIS_2]) || (TEST(out_bits, A_AXIS) == TEST(out_bits, CORE_AXIS_2))) {
......@@ -398,11 +398,11 @@ inline void update_endstops() {
#endif
}
}
#if MECH(COREXY) || MECH(COREXZ)
#if MECH(COREXY) || MECH(COREYX)|| MECH(COREXZ) || MECH(COREZX)
}
#endif
#if MECH(COREXY)
#if MECH(COREXY) || MECH(COREYX)
// Head direction in -Y axis for CoreXY bots.
// If DeltaX == DeltaY, the movement is only in X axis
if ((current_block->steps[A_AXIS] != current_block->steps[B_AXIS]) || (TEST(out_bits, A_AXIS) != TEST(out_bits, B_AXIS))) {
......@@ -420,11 +420,11 @@ inline void update_endstops() {
UPDATE_ENDSTOP(Y, MAX);
#endif
}
#if MECH(COREXY)
#if MECH(COREXY) || MECH(COREYX)
}
#endif
#if MECH(COREXZ)
#if MECH(COREXZ) || MECH(COREZX)
// Head direction in -Z axis for CoreXZ bots.
// If DeltaX == DeltaZ, the movement is only in X axis
if ((current_block->steps[A_AXIS] != current_block->steps[C_AXIS]) || (TEST(out_bits, A_AXIS) != TEST(out_bits, C_AXIS))) {
......@@ -495,7 +495,7 @@ inline void update_endstops() {
#endif // !Z_DUAL_ENDSTOPS
#endif // Z_MAX_PIN
}
#if MECH(COREXZ)
#if MECH(COREXZ) || MECH(COREZX)
}
#endif
#if ENABLED(NPR2)
......@@ -569,8 +569,8 @@ FORCE_INLINE unsigned short calc_timer(unsigned short step_rate) {
/**
* Set the stepper direction of each axis
*
* X_AXIS=A_AXIS and Y_AXIS=B_AXIS for COREXY
* X_AXIS=A_AXIS and Z_AXIS=C_AXIS for COREXZ
* X_AXIS=A_AXIS and Y_AXIS=B_AXIS for COREXY or COREYX
* X_AXIS=A_AXIS and Z_AXIS=C_AXIS for COREXZ or COREZX
*/
void set_stepper_direction(bool onlye) {
......@@ -1207,7 +1207,7 @@ long st_get_position(uint8_t axis) {
float st_get_axis_position_mm(AxisEnum axis) {
float axis_pos;
#if ENABLED(COREXY) | ENABLED(COREXZ)
#if MECH(COREXY) || MECH(COREYX) || MECH(COREXZ) || MECH(COREZX)
if (axis == X_AXIS || axis == CORE_AXIS_2) {
CRITICAL_SECTION_START;
long pos1 = count_position[A_AXIS],
......
......@@ -25,8 +25,9 @@
/**
* Axis indices as enumerated constants
*
* A_AXIS and B_AXIS are used by COREXY printers
* 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.
* A_AXIS and B_AXIS are used by COREXY or COREYX printers
* A_AXIS and C_AXIS are used by COREXZ or COREZX printers
* X_HEAD and Y_HEAD and Z_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, A_AXIS=0, Y_AXIS=1, B_AXIS=1, Z_AXIS=2, C_AXIS=2, E_AXIS=3, X_HEAD=4, Y_HEAD=5, Z_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, Z2_MIN=7, Z2_MAX=8, E_MIN=9};
......
......@@ -1190,7 +1190,7 @@
#error DEPENDENCY ERROR: Missing setting MANUAL_Z_HOME_POS
#endif
#endif
#if MECH(COREXY) || MECH(COREXZ)
#if MECH(COREXY) || MECH(COREYX) || MECH(COREXZ) || MECH(COREZX)
#if DISABLED(COREX_YZ_FACTOR)
#error DEPENDENCY ERROR: Missing setting COREX_YZ_FACTOR
#endif
......@@ -1280,8 +1280,14 @@
#if DISABLED(TOWER_C_DIAGROD_ADJ)
#error DEPENDENCY ERROR: Missing setting TOWER_C_DIAGROD_ADJ
#endif
#if DISABLED(Z_PROBE_OFFSET)
#error DEPENDENCY ERROR: Missing setting Z_PROBE_OFFSET
#if DISABLED(X_PROBE_OFFSET_FROM_EXTRUDER)
#error DEPENDENCY ERROR: Missing setting X_PROBE_OFFSET_FROM_EXTRUDER
#endif
#if DISABLED(Y_PROBE_OFFSET_FROM_EXTRUDER)
#error DEPENDENCY ERROR: Missing setting Y_PROBE_OFFSET_FROM_EXTRUDER
#endif
#if DISABLED(Z_PROBE_OFFSET_FROM_EXTRUDER)
#error DEPENDENCY ERROR: Missing setting Z_PROBE_OFFSET_FROM_EXTRUDER
#endif
#if DISABLED(Z_PROBE_DEPLOY_START_LOCATION)
#error DEPENDENCY ERROR: Missing setting Z_PROBE_DEPLOY_START_LOCATION
......@@ -1346,9 +1352,12 @@
* Babystepping
*/
#if ENABLED(BABYSTEPPING)
#if MECH(COREXY) && ENABLED(BABYSTEP_XY)
#if (MECH(COREXY) || MECH(COREYX)) && ENABLED(BABYSTEP_XY)
#error CONFLICT ERROR: BABYSTEPPING only implemented for Z axis on CoreXY.
#endif
#if (MECH(COREXZ) || MECH(COREZX))
#error CONFLICT ERROR: BABYSTEPPING not implemented for CoreXZ or CoreZX.
#endif
#if MECH(SCARA)
#error CONFLICT ERROR: BABYSTEPPING is not implemented for SCARA yet.
#endif
......
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