|
@@ -113,6 +113,7 @@
|
113
|
113
|
// M207 - set retract length S[positive mm] F[feedrate mm/sec] Z[additional zlift/hop]
|
114
|
114
|
// M208 - set recover=unretract length S[positive mm surplus to the M207 S*] F[feedrate mm/sec]
|
115
|
115
|
// 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.
|
|
116
|
+// M218 - set hotend offset (in mm): T<extruder_number> X<offset_on_X> Y<offset_on_Y>
|
116
|
117
|
// M220 S<factor in percent>- set speed factor override percentage
|
117
|
118
|
// M221 S<factor in percent>- set extrude factor override percentage
|
118
|
119
|
// M240 - Trigger a camera to take a photograph
|
|
@@ -124,7 +125,7 @@
|
124
|
125
|
// M500 - stores paramters in EEPROM
|
125
|
126
|
// M501 - reads parameters from EEPROM (if you need reset them after you changed them temporarily).
|
126
|
127
|
// M502 - reverts to the default "factory settings". You still need to store them in EEPROM afterwards if you want to.
|
127
|
|
-// M503 - print the current settings (from memory not from eeprom)
|
|
128
|
+// M503 - print the current settings (from memory not from eeprom)
|
128
|
129
|
// M540 - Use S[0|1] to enable or disable the stop SD card print on endstop hit (requires ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED)
|
129
|
130
|
// M600 - Pause for filament change X[pos] Y[pos] Z[relative lift] E[initial retract] L[later retract distance for removal]
|
130
|
131
|
// 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 };
|
155
|
156
|
float add_homeing[3]={0,0,0};
|
156
|
157
|
float min_pos[3] = { X_MIN_POS, Y_MIN_POS, Z_MIN_POS };
|
157
|
158
|
float max_pos[3] = { X_MAX_POS, Y_MAX_POS, Z_MAX_POS };
|
|
159
|
+// Extruder offset, only in XY plane
|
|
160
|
+float extruder_offset[2][EXTRUDERS] = {
|
|
161
|
+#if defined(EXTRUDER_OFFSET_X) && defined(EXTRUDER_OFFSET_Y)
|
|
162
|
+ EXTRUDER_OFFSET_X, EXTRUDER_OFFSET_Y
|
|
163
|
+#endif
|
|
164
|
+};
|
158
|
165
|
uint8_t active_extruder = 0;
|
159
|
166
|
int fanSpeed=0;
|
160
|
167
|
|
|
@@ -1353,7 +1360,6 @@ void process_commands()
|
1353
|
1360
|
retract_recover_feedrate = code_value() ;
|
1354
|
1361
|
}
|
1355
|
1362
|
}break;
|
1356
|
|
-
|
1357
|
1363
|
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.
|
1358
|
1364
|
{
|
1359
|
1365
|
if(code_seen('S'))
|
|
@@ -1372,7 +1378,31 @@ void process_commands()
|
1372
|
1378
|
}
|
1373
|
1379
|
|
1374
|
1380
|
}break;
|
1375
|
|
- #endif
|
|
1381
|
+ #endif // FWRETRACT
|
|
1382
|
+ case 218: // M218 - set hotend offset (in mm), T<extruder_number> X<offset_on_X> Y<offset_on_Y>
|
|
1383
|
+ {
|
|
1384
|
+ if(setTargetedHotend(218)){
|
|
1385
|
+ break;
|
|
1386
|
+ }
|
|
1387
|
+ if(code_seen('X'))
|
|
1388
|
+ {
|
|
1389
|
+ extruder_offset[X_AXIS][tmp_extruder] = code_value();
|
|
1390
|
+ }
|
|
1391
|
+ if(code_seen('Y'))
|
|
1392
|
+ {
|
|
1393
|
+ extruder_offset[Y_AXIS][tmp_extruder] = code_value();
|
|
1394
|
+ }
|
|
1395
|
+ SERIAL_ECHO_START;
|
|
1396
|
+ SERIAL_ECHOPGM(MSG_HOTEND_OFFSET);
|
|
1397
|
+ for(tmp_extruder = 0; tmp_extruder < EXTRUDERS; tmp_extruder++)
|
|
1398
|
+ {
|
|
1399
|
+ SERIAL_ECHO(" ");
|
|
1400
|
+ SERIAL_ECHO(extruder_offset[X_AXIS][tmp_extruder]);
|
|
1401
|
+ SERIAL_ECHO(",");
|
|
1402
|
+ SERIAL_ECHO(extruder_offset[Y_AXIS][tmp_extruder]);
|
|
1403
|
+ }
|
|
1404
|
+ SERIAL_ECHOLN("");
|
|
1405
|
+ }break;
|
1376
|
1406
|
case 220: // M220 S<factor in percent>- set speed factor override percentage
|
1377
|
1407
|
{
|
1378
|
1408
|
if(code_seen('S'))
|
|
@@ -1499,13 +1529,13 @@ void process_commands()
|
1499
|
1529
|
{
|
1500
|
1530
|
Config_PrintSettings();
|
1501
|
1531
|
}
|
1502
|
|
- break;
|
1503
|
|
- #ifdef ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED
|
1504
|
|
- case 540:
|
1505
|
|
- {
|
1506
|
|
- if(code_seen('S')) abort_on_endstop_hit = code_value() > 0;
|
1507
|
|
- }
|
1508
|
|
- break;
|
|
1532
|
+ break;
|
|
1533
|
+ #ifdef ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED
|
|
1534
|
+ case 540:
|
|
1535
|
+ {
|
|
1536
|
+ if(code_seen('S')) abort_on_endstop_hit = code_value() > 0;
|
|
1537
|
+ }
|
|
1538
|
+ break;
|
1509
|
1539
|
#endif
|
1510
|
1540
|
#ifdef FILAMENTCHANGEENABLE
|
1511
|
1541
|
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()
|
1696
|
1726
|
SERIAL_ECHOLN(MSG_INVALID_EXTRUDER);
|
1697
|
1727
|
}
|
1698
|
1728
|
else {
|
1699
|
|
- active_extruder = tmp_extruder;
|
|
1729
|
+ boolean make_move = false;
|
|
1730
|
+ if(code_seen('F')) {
|
|
1731
|
+ make_move = true;
|
|
1732
|
+ next_feedrate = code_value();
|
|
1733
|
+ if(next_feedrate > 0.0) {
|
|
1734
|
+ feedrate = next_feedrate;
|
|
1735
|
+ }
|
|
1736
|
+ }
|
|
1737
|
+ if(tmp_extruder != active_extruder) {
|
|
1738
|
+ // Save current position to return to after applying extruder offset
|
|
1739
|
+ memcpy(destination, current_position, sizeof(destination));
|
|
1740
|
+ // Offset extruder (only by XY)
|
|
1741
|
+ int i;
|
|
1742
|
+ for(i = 0; i < 2; i++) {
|
|
1743
|
+ current_position[i] = current_position[i] -
|
|
1744
|
+ extruder_offset[i][active_extruder] +
|
|
1745
|
+ extruder_offset[i][tmp_extruder];
|
|
1746
|
+ }
|
|
1747
|
+ // Set the new active extruder and position
|
|
1748
|
+ active_extruder = tmp_extruder;
|
|
1749
|
+ plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
|
1750
|
+ // Move to the old position if 'F' was in the parameters
|
|
1751
|
+ if(make_move && Stopped == false) {
|
|
1752
|
+ prepare_move();
|
|
1753
|
+ }
|
|
1754
|
+ }
|
1700
|
1755
|
SERIAL_ECHO_START;
|
1701
|
1756
|
SERIAL_ECHO(MSG_ACTIVE_EXTRUDER);
|
1702
|
1757
|
SERIAL_PROTOCOLLN((int)active_extruder);
|
|
@@ -2059,6 +2114,9 @@ bool setTargetedHotend(int code){
|
2059
|
2114
|
case 109:
|
2060
|
2115
|
SERIAL_ECHO(MSG_M109_INVALID_EXTRUDER);
|
2061
|
2116
|
break;
|
|
2117
|
+ case 218:
|
|
2118
|
+ SERIAL_ECHO(MSG_M218_INVALID_EXTRUDER);
|
|
2119
|
+ break;
|
2062
|
2120
|
}
|
2063
|
2121
|
SERIAL_ECHOLN(tmp_extruder);
|
2064
|
2122
|
return true;
|