Commit 5f774564 authored by MagoKimbra's avatar MagoKimbra

Fix Hotend offset & add variant Core

parent 1d25bf4b
......@@ -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,9 +278,19 @@
// 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!)
//
// +-- 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
......@@ -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,9 +300,19 @@
// 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!)
//
// +-- 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
......@@ -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)
......@@ -35,13 +35,11 @@
* M205 Z max_z_jerk
* M205 E E0 ... max_e_jerk (per extruder)
* M206 XYZ home_offset (x3)
* M666 P zprobe_zoffset
*
* HOTENDS OFFSET:
* M218 T XY hotend_offset (x4) (T0..3)
* M666 P zprobe_zoffset
*
* 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,10 +243,8 @@ 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);
......@@ -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,7 +477,6 @@ 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];
......@@ -505,7 +492,6 @@ void Config_ResetDefault() {
hotend_offset[Z_AXIS][i] = tmp12[i];
else
hotend_offset[Z_AXIS][i] = 0;
#endif // HOTENDS > 1
}
#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,7 +705,6 @@ 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):");
}
......@@ -727,7 +714,6 @@ void Config_ResetDefault() {
ECHO_MV(" Y", hotend_offset[Y_AXIS][h]);
ECHO_EMV(" Z", hotend_offset[Z_AXIS][h]);
}
#endif // HOTENDS > 1
#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)
......
This diff is collapsed.
......@@ -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],
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