Merge pull request #383 from dob71/jeff
Hotend offset handling for multi-extruder machines
This commit is contained in:
commit
3e9cd334a4
@ -286,7 +286,13 @@ const bool Z_ENDSTOPS_INVERTING = true; // set to true to invert the logic of th
|
||||
#define DEFAULT_ACCELERATION 3000 // X, Y, Z and E max acceleration in mm/s^2 for printing moves
|
||||
#define DEFAULT_RETRACT_ACCELERATION 3000 // X, Y, Z and E max acceleration in mm/s^2 for r retracts
|
||||
|
||||
//
|
||||
// Offset of the extruders (uncomment if using more than one and relying on firmware to position when changing).
|
||||
// The offset has to be X=0, Y=0 for the extruder 0 hotend (default extruder).
|
||||
// For the other hotends it is their distance from the extruder 0 hotend.
|
||||
// #define EXTRUDER_OFFSET_X {0.0, 20.00} // (in mm) for each extruder, offset of the hotend on the X axis
|
||||
// #define EXTRUDER_OFFSET_Y {0.0, 5.00} // (in mm) for each extruder, offset of the hotend on the Y axis
|
||||
|
||||
// The speed change that does not require acceleration (i.e. the software might assume it can be done instanteneously)
|
||||
#define DEFAULT_XYJERK 20.0 // (mm/sec)
|
||||
#define DEFAULT_ZJERK 0.4 // (mm/sec)
|
||||
#define DEFAULT_EJERK 5.0 // (mm/sec)
|
||||
|
@ -113,6 +113,7 @@
|
||||
// M207 - set retract length S[positive mm] F[feedrate mm/sec] Z[additional zlift/hop]
|
||||
// M208 - set recover=unretract length S[positive mm surplus to the M207 S*] F[feedrate mm/sec]
|
||||
// M209 - S<1=true/0=false> enable automatic retract detect if the slicer did not support G10/11: every normal extrude-only move will be classified as retract depending on the direction.
|
||||
// M218 - set hotend offset (in mm): T<extruder_number> X<offset_on_X> Y<offset_on_Y>
|
||||
// M220 S<factor in percent>- set speed factor override percentage
|
||||
// M221 S<factor in percent>- set extrude factor override percentage
|
||||
// M240 - Trigger a camera to take a photograph
|
||||
@ -124,7 +125,7 @@
|
||||
// M500 - stores paramters in EEPROM
|
||||
// M501 - reads parameters from EEPROM (if you need reset them after you changed them temporarily).
|
||||
// M502 - reverts to the default "factory settings". You still need to store them in EEPROM afterwards if you want to.
|
||||
// M503 - print the current settings (from memory not from eeprom)
|
||||
// M503 - print the current settings (from memory not from eeprom)
|
||||
// M540 - Use S[0|1] to enable or disable the stop SD card print on endstop hit (requires ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED)
|
||||
// M600 - Pause for filament change X[pos] Y[pos] Z[relative lift] E[initial retract] L[later retract distance for removal]
|
||||
// M907 - Set digital trimpot motor current using axis codes.
|
||||
@ -155,6 +156,12 @@ float current_position[NUM_AXIS] = { 0.0, 0.0, 0.0, 0.0 };
|
||||
float add_homeing[3]={0,0,0};
|
||||
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 };
|
||||
// Extruder offset, only in XY plane
|
||||
float extruder_offset[2][EXTRUDERS] = {
|
||||
#if defined(EXTRUDER_OFFSET_X) && defined(EXTRUDER_OFFSET_Y)
|
||||
EXTRUDER_OFFSET_X, EXTRUDER_OFFSET_Y
|
||||
#endif
|
||||
};
|
||||
uint8_t active_extruder = 0;
|
||||
int fanSpeed=0;
|
||||
|
||||
@ -1353,7 +1360,6 @@ void process_commands()
|
||||
retract_recover_feedrate = code_value() ;
|
||||
}
|
||||
}break;
|
||||
|
||||
case 209: // M209 - S<1=true/0=false> enable automatic retract detect if the slicer did not support G10/11: every normal extrude-only move will be classified as retract depending on the direction.
|
||||
{
|
||||
if(code_seen('S'))
|
||||
@ -1372,7 +1378,31 @@ void process_commands()
|
||||
}
|
||||
|
||||
}break;
|
||||
#endif
|
||||
#endif // FWRETRACT
|
||||
case 218: // M218 - set hotend offset (in mm), T<extruder_number> X<offset_on_X> Y<offset_on_Y>
|
||||
{
|
||||
if(setTargetedHotend(218)){
|
||||
break;
|
||||
}
|
||||
if(code_seen('X'))
|
||||
{
|
||||
extruder_offset[X_AXIS][tmp_extruder] = code_value();
|
||||
}
|
||||
if(code_seen('Y'))
|
||||
{
|
||||
extruder_offset[Y_AXIS][tmp_extruder] = code_value();
|
||||
}
|
||||
SERIAL_ECHO_START;
|
||||
SERIAL_ECHOPGM(MSG_HOTEND_OFFSET);
|
||||
for(tmp_extruder = 0; tmp_extruder < EXTRUDERS; tmp_extruder++)
|
||||
{
|
||||
SERIAL_ECHO(" ");
|
||||
SERIAL_ECHO(extruder_offset[X_AXIS][tmp_extruder]);
|
||||
SERIAL_ECHO(",");
|
||||
SERIAL_ECHO(extruder_offset[Y_AXIS][tmp_extruder]);
|
||||
}
|
||||
SERIAL_ECHOLN("");
|
||||
}break;
|
||||
case 220: // M220 S<factor in percent>- set speed factor override percentage
|
||||
{
|
||||
if(code_seen('S'))
|
||||
@ -1499,13 +1529,13 @@ void process_commands()
|
||||
{
|
||||
Config_PrintSettings();
|
||||
}
|
||||
break;
|
||||
#ifdef ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED
|
||||
case 540:
|
||||
{
|
||||
if(code_seen('S')) abort_on_endstop_hit = code_value() > 0;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
#ifdef ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED
|
||||
case 540:
|
||||
{
|
||||
if(code_seen('S')) abort_on_endstop_hit = code_value() > 0;
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
#ifdef FILAMENTCHANGEENABLE
|
||||
case 600: //Pause for filament change X[pos] Y[pos] Z[relative lift] E[initial retract] L[later retract distance for removal]
|
||||
@ -1696,7 +1726,32 @@ void process_commands()
|
||||
SERIAL_ECHOLN(MSG_INVALID_EXTRUDER);
|
||||
}
|
||||
else {
|
||||
active_extruder = tmp_extruder;
|
||||
boolean make_move = false;
|
||||
if(code_seen('F')) {
|
||||
make_move = true;
|
||||
next_feedrate = code_value();
|
||||
if(next_feedrate > 0.0) {
|
||||
feedrate = next_feedrate;
|
||||
}
|
||||
}
|
||||
if(tmp_extruder != active_extruder) {
|
||||
// Save current position to return to after applying extruder offset
|
||||
memcpy(destination, current_position, sizeof(destination));
|
||||
// Offset extruder (only by XY)
|
||||
int i;
|
||||
for(i = 0; i < 2; i++) {
|
||||
current_position[i] = current_position[i] -
|
||||
extruder_offset[i][active_extruder] +
|
||||
extruder_offset[i][tmp_extruder];
|
||||
}
|
||||
// Set the new active extruder and position
|
||||
active_extruder = tmp_extruder;
|
||||
plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
||||
// Move to the old position if 'F' was in the parameters
|
||||
if(make_move && Stopped == false) {
|
||||
prepare_move();
|
||||
}
|
||||
}
|
||||
SERIAL_ECHO_START;
|
||||
SERIAL_ECHO(MSG_ACTIVE_EXTRUDER);
|
||||
SERIAL_PROTOCOLLN((int)active_extruder);
|
||||
@ -2059,6 +2114,9 @@ bool setTargetedHotend(int code){
|
||||
case 109:
|
||||
SERIAL_ECHO(MSG_M109_INVALID_EXTRUDER);
|
||||
break;
|
||||
case 218:
|
||||
SERIAL_ECHO(MSG_M218_INVALID_EXTRUDER);
|
||||
break;
|
||||
}
|
||||
SERIAL_ECHOLN(tmp_extruder);
|
||||
return true;
|
||||
|
2910
Marlin/language.h
2910
Marlin/language.h
File diff suppressed because it is too large
Load Diff
@ -248,7 +248,7 @@ const short temptable_6[][2] PROGMEM = {
|
||||
{970*OVERSAMPLENR, 25},
|
||||
{978*OVERSAMPLENR, 22},
|
||||
{1008*OVERSAMPLENR, 3},
|
||||
{1023*OVERSAMPLENR, 0} //to allow internal 0C
|
||||
{1023*OVERSAMPLENR, 0} //to allow internal 0 degrees C
|
||||
};
|
||||
#endif
|
||||
|
||||
@ -309,7 +309,7 @@ const short temptable_7[][2] PROGMEM = {
|
||||
{994*OVERSAMPLENR, 15},
|
||||
{1001*OVERSAMPLENR, 10},
|
||||
{1005*OVERSAMPLENR, 5},
|
||||
{1023*OVERSAMPLENR, 0} //to allow internal 0C
|
||||
{1023*OVERSAMPLENR, 0} //to allow internal 0 degrees C
|
||||
};
|
||||
#endif
|
||||
#if (THERMISTORHEATER_0 == 8) || (THERMISTORHEATER_1 == 8) || (THERMISTORHEATER_2 == 8) || (THERMISTORBED == 8)
|
||||
|
Loading…
Reference in New Issue
Block a user