Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 44 additions & 19 deletions Marlin/Configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@

// This defines the number of extruders
// :[1, 2, 3, 4, 5, 6]
#define EXTRUDERS 1
#define EXTRUDERS 2

// Generally expected filament diameter (1.75, 2.85, 3.0, ...). Used for Volumetric, Filament Width Sensor, etc.
#define DEFAULT_NOMINAL_FILAMENT_DIA 3.0
Expand Down Expand Up @@ -370,7 +370,7 @@
* :{ '0': "Not used", '1':"100k / 4.7k - EPCOS", '2':"200k / 4.7k - ATC Semitec 204GT-2", '3':"Mendel-parts / 4.7k", '4':"10k !! do not use for a hotend. Bad resolution at high temp. !!", '5':"100K / 4.7k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '501':"100K Zonestar (Tronxy X3A)", '6':"100k / 4.7k EPCOS - Not as accurate as Table 1", '7':"100k / 4.7k Honeywell 135-104LAG-J01", '8':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT", '9':"100k / 4.7k GE Sensing AL03006-58.2K-97-G1", '10':"100k / 4.7k RS 198-961", '11':"100k / 4.7k beta 3950 1%", '12':"100k / 4.7k 0603 SMD Vishay NTCS0603E3104FXT (calibrated for Makibox hot bed)", '13':"100k Hisens 3950 1% up to 300°C for hotend 'Simple ONE ' & hotend 'All In ONE'", '20':"PT100 (Ultimainboard V2.x)", '51':"100k / 1k - EPCOS", '52':"200k / 1k - ATC Semitec 204GT-2", '55':"100k / 1k - ATC Semitec 104GT-2 (Used in ParCan & J-Head)", '60':"100k Maker's Tool Works Kapton Bed Thermistor beta=3950", '61':"100k Formbot / Vivedino 3950 350C thermistor 4.7k pullup", '66':"Dyze Design 4.7M High Temperature thermistor", '67':"Slice Engineering 450C High Temperature thermistor", '70':"the 100K thermistor found in the bq Hephestos 2", '71':"100k / 4.7k Honeywell 135-104LAF-J01", '147':"Pt100 / 4.7k", '1047':"Pt1000 / 4.7k", '110':"Pt100 / 1k (non-standard)", '1010':"Pt1000 / 1k (non standard)", '-4':"Thermocouple + AD8495", '-3':"Thermocouple + MAX31855 (only for sensor 0)", '-2':"Thermocouple + MAX6675 (only for sensor 0)", '-1':"Thermocouple + AD595",'998':"Dummy 1", '999':"Dummy 2" }
*/
#define TEMP_SENSOR_0 1
#define TEMP_SENSOR_1 0
#define TEMP_SENSOR_1 1
#define TEMP_SENSOR_2 0
#define TEMP_SENSOR_3 0
#define TEMP_SENSOR_4 0
Expand Down Expand Up @@ -400,26 +400,42 @@

// Below this temperature the heater will be switched off
// because it probably indicates a broken thermistor wire.
#define HEATER_0_MINTEMP 5
#define HEATER_1_MINTEMP 5
#define HEATER_2_MINTEMP 5
#define HEATER_3_MINTEMP 5
#define HEATER_4_MINTEMP 5
#define HEATER_5_MINTEMP 5
#define BED_MINTEMP 5
#define CHAMBER_MINTEMP 5
// #define HEATER_0_MINTEMP 5
// #define HEATER_1_MINTEMP 5
// #define HEATER_2_MINTEMP 5
// #define HEATER_3_MINTEMP 5
// #define HEATER_4_MINTEMP 5
// #define HEATER_5_MINTEMP 5
// #define BED_MINTEMP 5
// #define CHAMBER_MINTEMP 5
extern int32_t HEATER_0_MINTEMP;
extern int32_t HEATER_1_MINTEMP;
extern int32_t HEATER_2_MINTEMP;
extern int32_t HEATER_3_MINTEMP;
extern int32_t HEATER_4_MINTEMP;
extern int32_t HEATER_5_MINTEMP;
extern int32_t BED_MINTEMP;
extern int32_t CHAMBER_MINTEMP;

// Above this temperature the heater will be switched off.
// This can protect components from overheating, but NOT from shorts and failures.
// (Use MINTEMP for thermistor short/failure protection.)
#define HEATER_0_MAXTEMP 290
#define HEATER_1_MAXTEMP 275
#define HEATER_2_MAXTEMP 275
#define HEATER_3_MAXTEMP 275
#define HEATER_4_MAXTEMP 275
#define HEATER_5_MAXTEMP 275
#define BED_MAXTEMP 130
#define CHAMBER_MAXTEMP 100
// #define HEATER_0_MAXTEMP 290
// #define HEATER_1_MAXTEMP 275
// #define HEATER_2_MAXTEMP 275
// #define HEATER_3_MAXTEMP 275
// #define HEATER_4_MAXTEMP 275
// #define HEATER_5_MAXTEMP 275
// #define BED_MAXTEMP 130
// #define CHAMBER_MAXTEMP 100
extern int32_t HEATER_0_MAXTEMP;
extern int32_t HEATER_1_MAXTEMP;
extern int32_t HEATER_2_MAXTEMP;
extern int32_t HEATER_3_MAXTEMP;
extern int32_t HEATER_4_MAXTEMP;
extern int32_t HEATER_5_MAXTEMP;
extern int32_t BED_MAXTEMP;
extern int32_t CHAMBER_MAXTEMP;

//===========================================================================
//============================= PID Settings ================================
Expand Down Expand Up @@ -868,7 +884,14 @@
*/
#define X_PROBE_OFFSET_FROM_EXTRUDER 13 // X offset: -left +right [of the nozzle]
#define Y_PROBE_OFFSET_FROM_EXTRUDER 19.15 // Y offset: -front +behind [the nozzle]
#define Z_PROBE_OFFSET_FROM_EXTRUDER 1 // Z offset: -below +above [the nozzle]
#define Z_PROBE_OFFSET_FROM_EXTRUDER 0 // Z offset: -below +above [the nozzle]

#define DUAL_EXTRUDER_X_PROBE_OFFSET_FROM_EXTRUDER -20
#define DUAL_ETTRUDER_Y_PROBE_OFFSET_FROM_EXTRUDER 26
#define DUAL_EXTRUDER_Z_PROBE_OFFSET_FROM_EXTRUDER 0

#define SWITCH_STROKE_EXTRUDER 1
#define SWITCH_STROKE_EXTRUDER_MAX_DEVIATION 10

// Certain types of probes need to stay away from edges
#define MIN_PROBE_EDGE 5
Expand Down Expand Up @@ -1054,7 +1077,9 @@

#define S_HOME_OFFSET_DEFAULT {-7, -5, 0, 0}
#define M_HOME_OFFSET_DEFAULT {-15.5, -7, 0, 0}
#define M_HOME_OFFSET_DEFAULT_DUAL_EXTRUDER {-45, -10.5, 0}
#define L_HOME_OFFSET_DEFAULT {-19, -10, 0, 0}
#define L_HOME_OFFSET_DEFAULT_DUAL_EXTRUDER {-48.5, -13.5, 0}
#endif //DISABLE(SW_MACHINE_SIZE)

// The size of the print bed
Expand Down
4 changes: 2 additions & 2 deletions Marlin/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
* and/or decrease WATCH_TEMP_INCREASE. WATCH_TEMP_INCREASE should not be set
* below 2.
*/
#define WATCH_TEMP_PERIOD 20 // Seconds
#define WATCH_TEMP_PERIOD 60 // Seconds
#define WATCH_TEMP_INCREASE 2 // Degrees Celsius

#define WATCH_TEMP_TARGET_START 100
Expand All @@ -105,7 +105,7 @@
#define WATCH_TEMP_DROP_DELTA 2

#define WATCH_TEMP_NOTHEATED_DEBOUNCE 4
#define WATCH_TEMP_NOTHEATED_PERIOD 5 // Seconds
#define WATCH_TEMP_NOTHEATED_PERIOD 20 // Seconds
#define WATCH_TEMP_NOTHEATED_LIMIT 15 // Degrees Celsius
#define WATCH_TEMP_NOTHEATED_DELTA 3 // Degrees Celsius
#endif
Expand Down
7 changes: 7 additions & 0 deletions Marlin/src/Marlin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,13 @@ millis_t max_inactive_time, // = 0
float X_MIN_POS = 0;
float Y_MIN_POS = 0;
float Z_MIN_POS = 0;
float DUAL_EXTRUDER_X_MAX_POS = 130;
float DUAL_EXTRUDER_Y_MAX_POS = 130;
float DUAL_EXTRUDER_Z_MAX_POS = 130;
float DUAL_EXTRUDER_X_MIN_POS = 30;
float DUAL_EXTRUDER_Y_MIN_POS = 30;
float DUAL_EXTRUDER_Z_MIN_POS = 30;
float TOOL_CHANGE_SAFE_SPACE = 30;

// Machine definition size
float X_DEF_SIZE = 145;
Expand Down
7 changes: 7 additions & 0 deletions Marlin/src/Marlin.h
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,13 @@ void protected_pin_err();
extern float X_MIN_POS;
extern float Y_MIN_POS;
extern float Z_MIN_POS;
extern float DUAL_EXTRUDER_X_MAX_POS;
extern float DUAL_EXTRUDER_Y_MAX_POS;
extern float DUAL_EXTRUDER_Z_MAX_POS;
extern float DUAL_EXTRUDER_X_MIN_POS;
extern float DUAL_EXTRUDER_Y_MIN_POS;
extern float DUAL_EXTRUDER_Z_MIN_POS;
extern float TOOL_CHANGE_SAFE_SPACE;
#endif //ENABLED(SW_MACHINE_SIZE)

#if USE_EXECUTE_COMMANDS_IMMEDIATE
Expand Down
1 change: 1 addition & 0 deletions Marlin/src/core/macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@
#define MACHINE_TYPE_CNC 2
#define MACHINE_TYPE_LASER 3
#define MACHINE_TYPE_LASER_10W 4
#define MACHINE_TYPE_DUAL_EXTRUDER 5

//Machine size define
#define MACHINE_SIZE_UNKNOW 0
Expand Down
22 changes: 20 additions & 2 deletions Marlin/src/feature/bedlevel/abl/abl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
#define DEBUG_OUT ENABLED(DEBUG_LEVELING_FEATURE)
#include "../../../core/debug_out.h"
#include "../../../../../snapmaker/src/snapmaker.h"
#include "../../../../../snapmaker/src/module/toolhead_3dp.h"
#include "../../../module/tool_change.h"

int bilinear_grid_spacing[2], bilinear_start[2];
float bilinear_grid_factor[2],
Expand Down Expand Up @@ -464,7 +466,7 @@ uint8_t auto_probing(bool reply_screen, bool fast_leveling) {
float z;

int dir_idx = 0;
do_blocking_move_to_z(15, 10);
do_blocking_move_to_z(50, 10);

for (int k = 0; k < GRID_MAX_POINTS_X * GRID_MAX_POINTS_Y; ++k) {
LOG_I("Probing No. %d\n", k);
Expand Down Expand Up @@ -500,7 +502,23 @@ uint8_t auto_probing(bool reply_screen, bool fast_leveling) {
cur_y = new_y;
}


if (MODULE_TOOLHEAD_DUAL_EXTRUDER == ModuleBase::toolhead()) {
hotend_offset[Z_AXIS][TOOLHEAD_3DP_EXTRUDER1] = 0;
do_blocking_move_to_z(current_position[Z_AXIS] + 2, speed_in_calibration[Z_AXIS]);
tool_change(TOOLHEAD_3DP_EXTRUDER0);
printer1->SetProbeSensor(PROBE_SENSOR_LEFT_OPTOCOUPLER);
float z_extruder0 = probe_pt(_GET_MESH_X(GRID_MAX_POINTS_X / 2), _GET_MESH_Y(GRID_MAX_POINTS_Y / 2), PROBE_PT_RAISE, 0, false);
z_extruder0 += switch_stroke_extruder0;
compensate_offset(z_values[GRID_MAX_POINTS_X / 2][GRID_MAX_POINTS_Y / 2] - z_extruder0);
tool_change(TOOLHEAD_3DP_EXTRUDER1);
printer1->SetProbeSensor(PROBE_SENSOR_RIGHT_OPTOCOUPLER);
float z_extruder1 = probe_pt(_GET_MESH_X(GRID_MAX_POINTS_Y / 2), _GET_MESH_Y(GRID_MAX_POINTS_Y / 2), PROBE_PT_RAISE, 0, false);
z_extruder1 += switch_stroke_extruder1;
hotend_offset_z_temp = z_extruder0 - z_extruder1;

return ret;
}

// if fast_leveling is true, over directly. Otherwise move nozzle to current position of probe
if (!fast_leveling) {
do_blocking_move_to_z(current_position[Z_AXIS] + 1, speed_in_calibration[Z_AXIS]);
Expand Down
5 changes: 3 additions & 2 deletions Marlin/src/gcode/bedlevel/G42.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include "../../Marlin.h" // for IsRunning()
#include "../../module/motion.h"
#include "../../feature/bedlevel/bedlevel.h"
#include "../../module/probe.h"

/**
* G42: Move X & Y axes to mesh coordinates (I & J)
Expand All @@ -48,8 +49,8 @@ void GcodeSuite::G42() {
if (hasI) destination[X_AXIS] = _GET_MESH_X(ix);
if (hasJ) destination[Y_AXIS] = _GET_MESH_Y(iy);
if (parser.boolval('P')) {
if (hasI) destination[X_AXIS] -= X_PROBE_OFFSET_FROM_EXTRUDER;
if (hasJ) destination[Y_AXIS] -= Y_PROBE_OFFSET_FROM_EXTRUDER;
if (hasI) destination[X_AXIS] -= xprobe_offset_from_extruder;
if (hasJ) destination[Y_AXIS] -= yprobe_offset_from_extruder;
}

const float fval = parser.linearval('F');
Expand Down
90 changes: 74 additions & 16 deletions Marlin/src/gcode/bedlevel/abl/G1029.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,16 @@ void GcodeSuite::G1029() {
const bool seen_p = parser.seenval('P');
if (seen_p) {
int size = parser.value_int();

if (MODULE_TOOLHEAD_DUAL_EXTRUDER == ModuleBase::toolhead() && size%2 == 0) {
size++;
}

if (size < 0 || size > GRID_MAX_NUM) {
SERIAL_ECHOLNPAIR("Invalid grid size , maximum: ", GRID_MAX_NUM);
return;
}

set_bed_leveling_enabled(false);
GRID_MAX_POINTS_X = size;
GRID_MAX_POINTS_Y = size;
Expand Down Expand Up @@ -107,20 +113,28 @@ void GcodeSuite::G1029() {

const bool seen_a = parser.seen("A");
if (seen_a) {
if (ModuleBase::toolhead() == MODULE_TOOLHEAD_3DP) {
thermalManager.disable_all_heaters();
process_cmd_imd("G28");
set_bed_leveling_enabled(false);

thermalManager.disable_all_heaters();
process_cmd_imd("G28");
set_bed_leveling_enabled(false);

// Set the Z max feedrate to 50mm/s
planner.settings.max_feedrate_mm_s[Z_AXIS] = 40;

endstops.enable_z_probe(true);
auto_probing(false, false);
endstops.enable_z_probe(false);
// Set the Z max feedrate to 50mm/s
planner.settings.max_feedrate_mm_s[Z_AXIS] = 40;

endstops.enable_z_probe(true);
auto_probing(false, false);
endstops.enable_z_probe(false);

// Recover the Z max feedrate to 20mm/s
planner.settings.max_feedrate_mm_s[Z_AXIS] = 30;
} else if (ModuleBase::toolhead() == MODULE_TOOLHEAD_DUAL_EXTRUDER) {
uint8_t grid = (uint8_t)parser.byteval('A', (uint8_t)5);
SSTP_Event_t event = {EID_SETTING_REQ, SETTINGS_OPC_DO_AUTO_LEVELING};
event.data = &grid;
event.length = 1;
levelservice.DoAutoLeveling(event);
}

// Recover the Z max feedrate to 20mm/s
planner.settings.max_feedrate_mm_s[Z_AXIS] = 30;
return;
}

Expand All @@ -129,8 +143,10 @@ void GcodeSuite::G1029() {
uint8_t opt_s = (uint8_t)parser.byteval('S', (uint8_t)0);
if (opt_s == 0) {
compensate_offset();
}
else {
} else if (opt_s == 1) {
// there is no need to compensate, because it has already been done
hotend_offset[Z_AXIS][TOOLHEAD_3DP_EXTRUDER1] = hotend_offset_z_temp;
} else {
if (nozzle_height_probed <= 0 || nozzle_height_probed > MAX_NOZZLE_HEIGHT_PROBED) {
LOG_E("invalid nozzle height after level: %.2f", nozzle_height_probed);
return;
Expand All @@ -142,8 +158,7 @@ void GcodeSuite::G1029() {
bed_level_virt_interpolate();

// only save data in flash after adjusting z offset
if (opt_s == 0)
settings.save();
settings.save();
return;
}

Expand Down Expand Up @@ -173,5 +188,48 @@ void GcodeSuite::G1029() {
}
return;
}

SSTP_Event_t event = {EID_SETTING_REQ};
const bool seen_m = parser.seenval('M');
if (seen_m) {
uint8_t grid = (uint8_t)parser.byteval('M', (uint8_t)0);
if (grid < 0 || grid > GRID_MAX_NUM) {
SERIAL_ECHOLNPAIR("Invalid grid size , maximum: ", GRID_MAX_NUM);
return;
}

event.data = &grid;
event.length = 1;
event.op_code = SETTINGS_OPC_DO_MANUAL_LEVELING;
levelservice.DoManualLeveling(event);
}

const bool seen_n = parser.seenval('N');
if (seen_n) {
uint8_t level_point_index = (uint8_t)parser.byteval('N', (uint8_t)0);
if (level_point_index < 0 || level_point_index > GRID_MAX_NUM) {
SERIAL_ECHOLNPAIR("Invalid level_point_index");
return;
}

event.data = &level_point_index;
event.length = 1;
event.op_code = SETTINGS_OPC_SET_LEVELING_PONIT;
levelservice.SetManualLevelingPoint(event);
}

const bool seen_f = parser.seenval('F');
if (seen_f) {
uint8_t extruder_index = (uint8_t)parser.byteval('F', (uint8_t)0);
if (extruder_index > 1) {
SERIAL_ECHOLNPAIR("Invalid extruder_index");
return;
}

event.data = &extruder_index;
event.length = 1;
event.op_code = SETTINGS_OPC_SAVE_AND_EXIT_LEVELING;
levelservice.SaveAndExitLeveling(event);
}
}

Loading