|
@@ -196,6 +196,7 @@ float endstop_adj[3]={0,0,0};
|
196
|
196
|
float min_pos[3] = { X_MIN_POS, Y_MIN_POS, Z_MIN_POS };
|
197
|
197
|
float max_pos[3] = { X_MAX_POS, Y_MAX_POS, Z_MAX_POS };
|
198
|
198
|
bool axis_known_position[3] = {false, false, false};
|
|
199
|
+float zprobe_zoffset;
|
199
|
200
|
|
200
|
201
|
// Extruder offset
|
201
|
202
|
#if EXTRUDERS > 1
|
|
@@ -240,6 +241,7 @@ int EtoPPressure=0;
|
240
|
241
|
float delta[3] = {0.0, 0.0, 0.0};
|
241
|
242
|
#endif
|
242
|
243
|
|
|
244
|
+
|
243
|
245
|
//===========================================================================
|
244
|
246
|
//=============================private variables=============================
|
245
|
247
|
//===========================================================================
|
|
@@ -779,7 +781,7 @@ static unsigned long delayed_move_time = 0; // used in mode 1
|
779
|
781
|
static float duplicate_extruder_x_offset = DEFAULT_DUPLICATION_X_OFFSET; // used in mode 2
|
780
|
782
|
static float duplicate_extruder_temp_offset = 0; // used in mode 2
|
781
|
783
|
bool extruder_duplication_enabled = false; // used in mode 2
|
782
|
|
-#endif //DUAL_X_CARRIAGE
|
|
784
|
+#endif //DUAL_X_CARRIAGE
|
783
|
785
|
|
784
|
786
|
static void axis_is_at_home(int axis) {
|
785
|
787
|
#ifdef DUAL_X_CARRIAGE
|
|
@@ -792,8 +794,8 @@ static void axis_is_at_home(int axis) {
|
792
|
794
|
}
|
793
|
795
|
else if (dual_x_carriage_mode == DXC_DUPLICATION_MODE && active_extruder == 0) {
|
794
|
796
|
current_position[X_AXIS] = base_home_pos(X_AXIS) + add_homeing[X_AXIS];
|
795
|
|
- min_pos[X_AXIS] = base_min_pos(X_AXIS) + add_homeing[X_AXIS];
|
796
|
|
- max_pos[X_AXIS] = min(base_max_pos(X_AXIS) + add_homeing[X_AXIS],
|
|
797
|
+ min_pos[X_AXIS] = base_min_pos(X_AXIS) + add_homeing[X_AXIS];
|
|
798
|
+ max_pos[X_AXIS] = min(base_max_pos(X_AXIS) + add_homeing[X_AXIS],
|
797
|
799
|
max(extruder_offset[X_AXIS][1], X2_MAX_POS) - duplicate_extruder_x_offset);
|
798
|
800
|
return;
|
799
|
801
|
}
|
|
@@ -824,7 +826,7 @@ static void set_bed_level_equation_lsq(double *plane_equation_coefficients)
|
824
|
826
|
current_position[Z_AXIS] = corrected_position.z;
|
825
|
827
|
|
826
|
828
|
// but the bed at 0 so we don't go below it.
|
827
|
|
- current_position[Z_AXIS] = -Z_PROBE_OFFSET_FROM_EXTRUDER;
|
|
829
|
+ current_position[Z_AXIS] = zprobe_zoffset; // in the lsq we reach here after raising the extruder due to the loop structure
|
828
|
830
|
|
829
|
831
|
plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
830
|
832
|
}
|
|
@@ -860,7 +862,7 @@ static void set_bed_level_equation(float z_at_xLeft_yFront, float z_at_xRight_yF
|
860
|
862
|
current_position[Z_AXIS] = corrected_position.z;
|
861
|
863
|
|
862
|
864
|
// but the bed at 0 so we don't go below it.
|
863
|
|
- current_position[Z_AXIS] = -Z_PROBE_OFFSET_FROM_EXTRUDER;
|
|
865
|
+ current_position[Z_AXIS] = zprobe_zoffset;
|
864
|
866
|
|
865
|
867
|
plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
866
|
868
|
}
|
|
@@ -885,7 +887,7 @@ static void run_z_probe() {
|
885
|
887
|
st_synchronize();
|
886
|
888
|
|
887
|
889
|
// move back down slowly to find bed
|
888
|
|
- feedrate = homing_feedrate[Z_AXIS]/4;
|
|
890
|
+ feedrate = homing_feedrate[Z_AXIS]/4;
|
889
|
891
|
zPosition -= home_retract_mm(Z_AXIS) * 2;
|
890
|
892
|
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], zPosition, current_position[E_AXIS], feedrate/60, active_extruder);
|
891
|
893
|
st_synchronize();
|
|
@@ -982,7 +984,7 @@ static void homeaxis(int axis) {
|
982
|
984
|
|
983
|
985
|
current_position[axis] = 0;
|
984
|
986
|
plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
985
|
|
-
|
|
987
|
+
|
986
|
988
|
|
987
|
989
|
// Engage Servo endstop if enabled
|
988
|
990
|
#ifdef SERVO_ENDSTOPS
|
|
@@ -1040,7 +1042,7 @@ static void homeaxis(int axis) {
|
1040
|
1042
|
#if defined (ENABLE_AUTO_BED_LEVELING) && (PROBE_SERVO_DEACTIVATION_DELAY > 0)
|
1041
|
1043
|
if (axis==Z_AXIS) retract_z_probe();
|
1042
|
1044
|
#endif
|
1043
|
|
-
|
|
1045
|
+
|
1044
|
1046
|
}
|
1045
|
1047
|
}
|
1046
|
1048
|
#define HOMEAXIS(LETTER) homeaxis(LETTER##_AXIS)
|
|
@@ -1114,7 +1116,7 @@ void process_commands()
|
1114
|
1116
|
destination[Y_AXIS]=current_position[Y_AXIS];
|
1115
|
1117
|
destination[Z_AXIS]=current_position[Z_AXIS];
|
1116
|
1118
|
current_position[Z_AXIS]+=retract_zlift;
|
1117
|
|
- destination[E_AXIS]=current_position[E_AXIS]+retract_length+retract_recover_length;
|
|
1119
|
+ destination[E_AXIS]=current_position[E_AXIS]+retract_length+retract_recover_length;
|
1118
|
1120
|
feedrate=retract_recover_feedrate;
|
1119
|
1121
|
retracted=false;
|
1120
|
1122
|
prepare_move();
|
|
@@ -1228,10 +1230,10 @@ void process_commands()
|
1228
|
1230
|
// reset state used by the different modes
|
1229
|
1231
|
memcpy(raised_parked_position, current_position, sizeof(raised_parked_position));
|
1230
|
1232
|
delayed_move_time = 0;
|
1231
|
|
- active_extruder_parked = true;
|
1232
|
|
- #else
|
|
1233
|
+ active_extruder_parked = true;
|
|
1234
|
+ #else
|
1233
|
1235
|
HOMEAXIS(X);
|
1234
|
|
- #endif
|
|
1236
|
+ #endif
|
1235
|
1237
|
}
|
1236
|
1238
|
|
1237
|
1239
|
if((home_all_axis) || (code_seen(axis_codes[Y_AXIS]))) {
|
|
@@ -1250,7 +1252,7 @@ void process_commands()
|
1250
|
1252
|
current_position[Y_AXIS]=code_value()+add_homeing[1];
|
1251
|
1253
|
}
|
1252
|
1254
|
}
|
1253
|
|
-
|
|
1255
|
+
|
1254
|
1256
|
#if Z_HOME_DIR < 0 // If homing towards BED do Z last
|
1255
|
1257
|
#ifndef Z_SAFE_HOMING
|
1256
|
1258
|
if((home_all_axis) || (code_seen(axis_codes[Z_AXIS]))) {
|
|
@@ -1262,14 +1264,14 @@ void process_commands()
|
1262
|
1264
|
#endif
|
1263
|
1265
|
HOMEAXIS(Z);
|
1264
|
1266
|
}
|
1265
|
|
- #else // Z Safe mode activated.
|
|
1267
|
+ #else // Z Safe mode activated.
|
1266
|
1268
|
if(home_all_axis) {
|
1267
|
1269
|
destination[X_AXIS] = round(Z_SAFE_HOMING_X_POINT - X_PROBE_OFFSET_FROM_EXTRUDER);
|
1268
|
1270
|
destination[Y_AXIS] = round(Z_SAFE_HOMING_Y_POINT - Y_PROBE_OFFSET_FROM_EXTRUDER);
|
1269
|
1271
|
destination[Z_AXIS] = Z_RAISE_BEFORE_HOMING * home_dir(Z_AXIS) * (-1); // Set destination away from bed
|
1270
|
1272
|
feedrate = XY_TRAVEL_SPEED;
|
1271
|
1273
|
current_position[Z_AXIS] = 0;
|
1272
|
|
-
|
|
1274
|
+
|
1273
|
1275
|
plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
1274
|
1276
|
plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate, active_extruder);
|
1275
|
1277
|
st_synchronize();
|
|
@@ -1287,7 +1289,7 @@ void process_commands()
|
1287
|
1289
|
&& (current_position[Y_AXIS]+Y_PROBE_OFFSET_FROM_EXTRUDER <= Y_MAX_POS)) {
|
1288
|
1290
|
|
1289
|
1291
|
current_position[Z_AXIS] = 0;
|
1290
|
|
- plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
|
1292
|
+ plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
1291
|
1293
|
destination[Z_AXIS] = Z_RAISE_BEFORE_HOMING * home_dir(Z_AXIS) * (-1); // Set destination away from bed
|
1292
|
1294
|
feedrate = max_feedrate[Z_AXIS];
|
1293
|
1295
|
plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate, active_extruder);
|
|
@@ -1307,8 +1309,8 @@ void process_commands()
|
1307
|
1309
|
#endif
|
1308
|
1310
|
#endif
|
1309
|
1311
|
|
1310
|
|
-
|
1311
|
|
-
|
|
1312
|
+
|
|
1313
|
+
|
1312
|
1314
|
if(code_seen(axis_codes[Z_AXIS])) {
|
1313
|
1315
|
if(code_value_long() != 0) {
|
1314
|
1316
|
current_position[Z_AXIS]=code_value()+add_homeing[2];
|
|
@@ -1316,7 +1318,7 @@ void process_commands()
|
1316
|
1318
|
}
|
1317
|
1319
|
#ifdef ENABLE_AUTO_BED_LEVELING
|
1318
|
1320
|
if((home_all_axis) || (code_seen(axis_codes[Z_AXIS]))) {
|
1319
|
|
- current_position[Z_AXIS] -= Z_PROBE_OFFSET_FROM_EXTRUDER; //Add Z_Probe offset (the distance is negative)
|
|
1321
|
+ current_position[Z_AXIS] += zprobe_zoffset; //Add Z_Probe offset (the distance is negative)
|
1320
|
1322
|
}
|
1321
|
1323
|
#endif
|
1322
|
1324
|
plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
|
@@ -1471,7 +1473,7 @@ void process_commands()
|
1471
|
1473
|
run_z_probe();
|
1472
|
1474
|
float z_at_xLeft_yFront = current_position[Z_AXIS];
|
1473
|
1475
|
retract_z_probe();
|
1474
|
|
-
|
|
1476
|
+
|
1475
|
1477
|
SERIAL_PROTOCOLPGM("Bed x: ");
|
1476
|
1478
|
SERIAL_PROTOCOL(LEFT_PROBE_BED_POSITION);
|
1477
|
1479
|
SERIAL_PROTOCOLPGM(" y: ");
|
|
@@ -1489,7 +1491,7 @@ void process_commands()
|
1489
|
1491
|
run_z_probe();
|
1490
|
1492
|
float z_at_xRight_yFront = current_position[Z_AXIS];
|
1491
|
1493
|
retract_z_probe(); // Retract Z Servo endstop if available
|
1492
|
|
-
|
|
1494
|
+
|
1493
|
1495
|
SERIAL_PROTOCOLPGM("Bed x: ");
|
1494
|
1496
|
SERIAL_PROTOCOL(RIGHT_PROBE_BED_POSITION);
|
1495
|
1497
|
SERIAL_PROTOCOLPGM(" y: ");
|
|
@@ -1504,10 +1506,10 @@ void process_commands()
|
1504
|
1506
|
|
1505
|
1507
|
|
1506
|
1508
|
#endif // ACCURATE_BED_LEVELING
|
1507
|
|
- st_synchronize();
|
|
1509
|
+ st_synchronize();
|
1508
|
1510
|
|
1509
|
1511
|
// The following code correct the Z height difference from z-probe position and hotend tip position.
|
1510
|
|
- // The Z height on homing is measured by Z-Probe, but the probe is quite far from the hotend.
|
|
1512
|
+ // The Z height on homing is measured by Z-Probe, but the probe is quite far from the hotend.
|
1511
|
1513
|
// When the bed is uneven, this height must be corrected.
|
1512
|
1514
|
real_z = float(st_get_position(Z_AXIS))/axis_steps_per_unit[Z_AXIS]; //get the real Z (since the auto bed leveling is already correcting the plane)
|
1513
|
1515
|
x_tmp = current_position[X_AXIS] + X_PROBE_OFFSET_FROM_EXTRUDER;
|
|
@@ -1519,11 +1521,11 @@ void process_commands()
|
1519
|
1521
|
plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
1520
|
1522
|
}
|
1521
|
1523
|
break;
|
1522
|
|
-
|
|
1524
|
+
|
1523
|
1525
|
case 30: // G30 Single Z Probe
|
1524
|
1526
|
{
|
1525
|
1527
|
engage_z_probe(); // Engage Z Servo endstop if available
|
1526
|
|
-
|
|
1528
|
+
|
1527
|
1529
|
st_synchronize();
|
1528
|
1530
|
// TODO: make sure the bed_level_rotation_matrix is identity or the planner will get set incorectly
|
1529
|
1531
|
setup_for_endstop_move();
|
|
@@ -1674,14 +1676,14 @@ void process_commands()
|
1674
|
1676
|
card.removeFile(strchr_pointer + 4);
|
1675
|
1677
|
}
|
1676
|
1678
|
break;
|
1677
|
|
- case 32: //M32 - Select file and start SD print
|
|
1679
|
+ case 32: //M32 - Select file and start SD print
|
1678
|
1680
|
{
|
1679
|
1681
|
if(card.sdprinting) {
|
1680
|
1682
|
st_synchronize();
|
1681
|
1683
|
|
1682
|
1684
|
}
|
1683
|
|
- starpos = (strchr(strchr_pointer + 4,'*'));
|
1684
|
|
-
|
|
1685
|
+ starpos = (strchr(strchr_pointer + 4,'*'));
|
|
1686
|
+
|
1685
|
1687
|
char* namestartpos = (strchr(strchr_pointer + 4,'!')); //find ! to indicate filename string start.
|
1686
|
1688
|
if(namestartpos==NULL)
|
1687
|
1689
|
{
|
|
@@ -1689,16 +1691,16 @@ void process_commands()
|
1689
|
1691
|
}
|
1690
|
1692
|
else
|
1691
|
1693
|
namestartpos++; //to skip the '!'
|
1692
|
|
-
|
|
1694
|
+
|
1693
|
1695
|
if(starpos!=NULL)
|
1694
|
1696
|
*(starpos-1)='\0';
|
1695
|
|
-
|
|
1697
|
+
|
1696
|
1698
|
bool call_procedure=(code_seen('P'));
|
1697
|
|
-
|
1698
|
|
- if(strchr_pointer>namestartpos)
|
|
1699
|
+
|
|
1700
|
+ if(strchr_pointer>namestartpos)
|
1699
|
1701
|
call_procedure=false; //false alert, 'P' found within filename
|
1700
|
|
-
|
1701
|
|
- if( card.cardOK )
|
|
1702
|
+
|
|
1703
|
+ if( card.cardOK )
|
1702
|
1704
|
{
|
1703
|
1705
|
card.openFile(namestartpos,true,!call_procedure);
|
1704
|
1706
|
if(code_seen('S'))
|
|
@@ -1771,7 +1773,7 @@ void process_commands()
|
1771
|
1773
|
#ifdef DUAL_X_CARRIAGE
|
1772
|
1774
|
if (dual_x_carriage_mode == DXC_DUPLICATION_MODE && tmp_extruder == 0)
|
1773
|
1775
|
setTargetHotend1(code_value() == 0.0 ? 0.0 : code_value() + duplicate_extruder_temp_offset);
|
1774
|
|
-#endif
|
|
1776
|
+#endif
|
1775
|
1777
|
setWatch();
|
1776
|
1778
|
break;
|
1777
|
1779
|
case 140: // M140 set bed temp
|
|
@@ -1827,7 +1829,7 @@ void process_commands()
|
1827
|
1829
|
SERIAL_PROTOCOL_F(rawHotendTemp(cur_extruder)/OVERSAMPLENR,0);
|
1828
|
1830
|
}
|
1829
|
1831
|
#endif
|
1830
|
|
-
|
|
1832
|
+
|
1831
|
1833
|
SERIAL_PROTOCOLLN("");
|
1832
|
1834
|
return;
|
1833
|
1835
|
break;
|
|
@@ -1845,14 +1847,14 @@ void process_commands()
|
1845
|
1847
|
#ifdef DUAL_X_CARRIAGE
|
1846
|
1848
|
if (dual_x_carriage_mode == DXC_DUPLICATION_MODE && tmp_extruder == 0)
|
1847
|
1849
|
setTargetHotend1(code_value() == 0.0 ? 0.0 : code_value() + duplicate_extruder_temp_offset);
|
1848
|
|
-#endif
|
|
1850
|
+#endif
|
1849
|
1851
|
CooldownNoWait = true;
|
1850
|
1852
|
} else if (code_seen('R')) {
|
1851
|
1853
|
setTargetHotend(code_value(), tmp_extruder);
|
1852
|
1854
|
#ifdef DUAL_X_CARRIAGE
|
1853
|
1855
|
if (dual_x_carriage_mode == DXC_DUPLICATION_MODE && tmp_extruder == 0)
|
1854
|
1856
|
setTargetHotend1(code_value() == 0.0 ? 0.0 : code_value() + duplicate_extruder_temp_offset);
|
1855
|
|
-#endif
|
|
1857
|
+#endif
|
1856
|
1858
|
CooldownNoWait = false;
|
1857
|
1859
|
}
|
1858
|
1860
|
#ifdef AUTOTEMP
|
|
@@ -2016,7 +2018,7 @@ void process_commands()
|
2016
|
2018
|
SET_OUTPUT(SUICIDE_PIN);
|
2017
|
2019
|
WRITE(SUICIDE_PIN, HIGH);
|
2018
|
2020
|
#endif
|
2019
|
|
-
|
|
2021
|
+
|
2020
|
2022
|
#ifdef ULTIPANEL
|
2021
|
2023
|
powersupply = true;
|
2022
|
2024
|
LCD_MESSAGEPGM(WELCOME_MSG);
|
|
@@ -2173,18 +2175,18 @@ void process_commands()
|
2173
|
2175
|
#endif
|
2174
|
2176
|
break;
|
2175
|
2177
|
//TODO: update for all axis, use for loop
|
2176
|
|
- #ifdef BLINKM
|
|
2178
|
+ #ifdef BLINKM
|
2177
|
2179
|
case 150: // M150
|
2178
|
2180
|
{
|
2179
|
2181
|
byte red;
|
2180
|
2182
|
byte grn;
|
2181
|
2183
|
byte blu;
|
2182
|
|
-
|
|
2184
|
+
|
2183
|
2185
|
if(code_seen('R')) red = code_value();
|
2184
|
2186
|
if(code_seen('U')) grn = code_value();
|
2185
|
2187
|
if(code_seen('B')) blu = code_value();
|
2186
|
|
-
|
2187
|
|
- SendColors(red,grn,blu);
|
|
2188
|
+
|
|
2189
|
+ SendColors(red,grn,blu);
|
2188
|
2190
|
}
|
2189
|
2191
|
break;
|
2190
|
2192
|
#endif //BLINKM
|
|
@@ -2306,7 +2308,7 @@ void process_commands()
|
2306
|
2308
|
{
|
2307
|
2309
|
extruder_offset[Z_AXIS][tmp_extruder] = code_value();
|
2308
|
2310
|
}
|
2309
|
|
- #endif
|
|
2311
|
+ #endif
|
2310
|
2312
|
SERIAL_ECHO_START;
|
2311
|
2313
|
SERIAL_ECHOPGM(MSG_HOTEND_OFFSET);
|
2312
|
2314
|
for(tmp_extruder = 0; tmp_extruder < EXTRUDERS; tmp_extruder++)
|
|
@@ -2339,17 +2341,17 @@ void process_commands()
|
2339
|
2341
|
}
|
2340
|
2342
|
}
|
2341
|
2343
|
break;
|
2342
|
|
-
|
|
2344
|
+
|
2343
|
2345
|
case 226: // M226 P<pin number> S<pin state>- Wait until the specified pin reaches the state required
|
2344
|
2346
|
{
|
2345
|
2347
|
if(code_seen('P')){
|
2346
|
2348
|
int pin_number = code_value(); // pin number
|
2347
|
2349
|
int pin_state = -1; // required pin state - default is inverted
|
2348
|
|
-
|
|
2350
|
+
|
2349
|
2351
|
if(code_seen('S')) pin_state = code_value(); // required pin state
|
2350
|
|
-
|
|
2352
|
+
|
2351
|
2353
|
if(pin_state >= -1 && pin_state <= 1){
|
2352
|
|
-
|
|
2354
|
+
|
2353
|
2355
|
for(int8_t i = 0; i < (int8_t)sizeof(sensitive_pins); i++)
|
2354
|
2356
|
{
|
2355
|
2357
|
if (sensitive_pins[i] == pin_number)
|
|
@@ -2358,28 +2360,28 @@ void process_commands()
|
2358
|
2360
|
break;
|
2359
|
2361
|
}
|
2360
|
2362
|
}
|
2361
|
|
-
|
|
2363
|
+
|
2362
|
2364
|
if (pin_number > -1)
|
2363
|
2365
|
{
|
2364
|
2366
|
st_synchronize();
|
2365
|
|
-
|
|
2367
|
+
|
2366
|
2368
|
pinMode(pin_number, INPUT);
|
2367
|
|
-
|
|
2369
|
+
|
2368
|
2370
|
int target;
|
2369
|
2371
|
switch(pin_state){
|
2370
|
2372
|
case 1:
|
2371
|
2373
|
target = HIGH;
|
2372
|
2374
|
break;
|
2373
|
|
-
|
|
2375
|
+
|
2374
|
2376
|
case 0:
|
2375
|
2377
|
target = LOW;
|
2376
|
2378
|
break;
|
2377
|
|
-
|
|
2379
|
+
|
2378
|
2380
|
case -1:
|
2379
|
2381
|
target = !digitalRead(pin_number);
|
2380
|
2382
|
break;
|
2381
|
2383
|
}
|
2382
|
|
-
|
|
2384
|
+
|
2383
|
2385
|
while(digitalRead(pin_number) != target){
|
2384
|
2386
|
manage_heater();
|
2385
|
2387
|
manage_inactivity();
|
|
@@ -2389,7 +2391,7 @@ void process_commands()
|
2389
|
2391
|
}
|
2390
|
2392
|
}
|
2391
|
2393
|
}
|
2392
|
|
- break;
|
|
2394
|
+ break;
|
2393
|
2395
|
|
2394
|
2396
|
#if NUM_SERVOS > 0
|
2395
|
2397
|
case 280: // M280 - set servo position absolute. P: servo index, S: angle or microseconds
|
|
@@ -2565,13 +2567,13 @@ void process_commands()
|
2565
|
2567
|
engage_z_probe(); // Engage Z Servo endstop if available
|
2566
|
2568
|
}
|
2567
|
2569
|
break;
|
2568
|
|
-
|
|
2570
|
+
|
2569
|
2571
|
case 402:
|
2570
|
2572
|
{
|
2571
|
2573
|
retract_z_probe(); // Retract Z Servo endstop if enabled
|
2572
|
2574
|
}
|
2573
|
2575
|
break;
|
2574
|
|
-#endif
|
|
2576
|
+#endif
|
2575
|
2577
|
case 500: // M500 Store settings in EEPROM
|
2576
|
2578
|
{
|
2577
|
2579
|
Config_StoreSettings();
|
|
@@ -2729,14 +2731,14 @@ void process_commands()
|
2729
|
2731
|
// M605 S0: Full control mode. The slicer has full control over x-carriage movement
|
2730
|
2732
|
// M605 S1: Auto-park mode. The inactive head will auto park/unpark without slicer involvement
|
2731
|
2733
|
// M605 S2 [Xnnn] [Rmmm]: Duplication mode. The second extruder will duplicate the first with nnn
|
2732
|
|
- // millimeters x-offset and an optional differential hotend temperature of
|
|
2734
|
+ // millimeters x-offset and an optional differential hotend temperature of
|
2733
|
2735
|
// mmm degrees. E.g., with "M605 S2 X100 R2" the second extruder will duplicate
|
2734
|
2736
|
// the first with a spacing of 100mm in the x direction and 2 degrees hotter.
|
2735
|
2737
|
//
|
2736
|
2738
|
// Note: the X axis should be homed after changing dual x-carriage mode.
|
2737
|
2739
|
{
|
2738
|
2740
|
st_synchronize();
|
2739
|
|
-
|
|
2741
|
+
|
2740
|
2742
|
if (code_seen('S'))
|
2741
|
2743
|
dual_x_carriage_mode = code_value();
|
2742
|
2744
|
|
|
@@ -2747,7 +2749,7 @@ void process_commands()
|
2747
|
2749
|
|
2748
|
2750
|
if (code_seen('R'))
|
2749
|
2751
|
duplicate_extruder_temp_offset = code_value();
|
2750
|
|
-
|
|
2752
|
+
|
2751
|
2753
|
SERIAL_ECHO_START;
|
2752
|
2754
|
SERIAL_ECHOPGM(MSG_HOTEND_OFFSET);
|
2753
|
2755
|
SERIAL_ECHO(" ");
|
|
@@ -2763,13 +2765,13 @@ void process_commands()
|
2763
|
2765
|
{
|
2764
|
2766
|
dual_x_carriage_mode = DEFAULT_DUAL_X_CARRIAGE_MODE;
|
2765
|
2767
|
}
|
2766
|
|
-
|
|
2768
|
+
|
2767
|
2769
|
active_extruder_parked = false;
|
2768
|
2770
|
extruder_duplication_enabled = false;
|
2769
|
2771
|
delayed_move_time = 0;
|
2770
|
2772
|
}
|
2771
|
2773
|
break;
|
2772
|
|
- #endif //DUAL_X_CARRIAGE
|
|
2774
|
+ #endif //DUAL_X_CARRIAGE
|
2773
|
2775
|
|
2774
|
2776
|
case 907: // M907 Set digital trimpot motor current using axis codes.
|
2775
|
2777
|
{
|
|
@@ -2859,19 +2861,19 @@ void process_commands()
|
2859
|
2861
|
// Save current position to return to after applying extruder offset
|
2860
|
2862
|
memcpy(destination, current_position, sizeof(destination));
|
2861
|
2863
|
#ifdef DUAL_X_CARRIAGE
|
2862
|
|
- if (dual_x_carriage_mode == DXC_AUTO_PARK_MODE && Stopped == false &&
|
|
2864
|
+ if (dual_x_carriage_mode == DXC_AUTO_PARK_MODE && Stopped == false &&
|
2863
|
2865
|
(delayed_move_time != 0 || current_position[X_AXIS] != x_home_pos(active_extruder)))
|
2864
|
2866
|
{
|
2865
|
2867
|
// Park old head: 1) raise 2) move to park position 3) lower
|
2866
|
|
- plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS] + TOOLCHANGE_PARK_ZLIFT,
|
|
2868
|
+ plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS] + TOOLCHANGE_PARK_ZLIFT,
|
2867
|
2869
|
current_position[E_AXIS], max_feedrate[Z_AXIS], active_extruder);
|
2868
|
|
- plan_buffer_line(x_home_pos(active_extruder), current_position[Y_AXIS], current_position[Z_AXIS] + TOOLCHANGE_PARK_ZLIFT,
|
|
2870
|
+ plan_buffer_line(x_home_pos(active_extruder), current_position[Y_AXIS], current_position[Z_AXIS] + TOOLCHANGE_PARK_ZLIFT,
|
2869
|
2871
|
current_position[E_AXIS], max_feedrate[X_AXIS], active_extruder);
|
2870
|
|
- plan_buffer_line(x_home_pos(active_extruder), current_position[Y_AXIS], current_position[Z_AXIS],
|
|
2872
|
+ plan_buffer_line(x_home_pos(active_extruder), current_position[Y_AXIS], current_position[Z_AXIS],
|
2871
|
2873
|
current_position[E_AXIS], max_feedrate[Z_AXIS], active_extruder);
|
2872
|
2874
|
st_synchronize();
|
2873
|
2875
|
}
|
2874
|
|
-
|
|
2876
|
+
|
2875
|
2877
|
// apply Y & Z extruder offset (x offset is already used in determining home pos)
|
2876
|
2878
|
current_position[Y_AXIS] = current_position[Y_AXIS] -
|
2877
|
2879
|
extruder_offset[Y_AXIS][active_extruder] +
|
|
@@ -2879,7 +2881,7 @@ void process_commands()
|
2879
|
2881
|
current_position[Z_AXIS] = current_position[Z_AXIS] -
|
2880
|
2882
|
extruder_offset[Z_AXIS][active_extruder] +
|
2881
|
2883
|
extruder_offset[Z_AXIS][tmp_extruder];
|
2882
|
|
-
|
|
2884
|
+
|
2883
|
2885
|
active_extruder = tmp_extruder;
|
2884
|
2886
|
|
2885
|
2887
|
// This function resets the max/min values - the current position may be overwritten below.
|
|
@@ -2887,18 +2889,18 @@ void process_commands()
|
2887
|
2889
|
|
2888
|
2890
|
if (dual_x_carriage_mode == DXC_FULL_CONTROL_MODE)
|
2889
|
2891
|
{
|
2890
|
|
- current_position[X_AXIS] = inactive_extruder_x_pos;
|
|
2892
|
+ current_position[X_AXIS] = inactive_extruder_x_pos;
|
2891
|
2893
|
inactive_extruder_x_pos = destination[X_AXIS];
|
2892
|
2894
|
}
|
2893
|
2895
|
else if (dual_x_carriage_mode == DXC_DUPLICATION_MODE)
|
2894
|
2896
|
{
|
2895
|
2897
|
active_extruder_parked = (active_extruder == 0); // this triggers the second extruder to move into the duplication position
|
2896
|
2898
|
if (active_extruder == 0 || active_extruder_parked)
|
2897
|
|
- current_position[X_AXIS] = inactive_extruder_x_pos;
|
|
2899
|
+ current_position[X_AXIS] = inactive_extruder_x_pos;
|
2898
|
2900
|
else
|
2899
|
|
- current_position[X_AXIS] = destination[X_AXIS] + duplicate_extruder_x_offset;
|
|
2901
|
+ current_position[X_AXIS] = destination[X_AXIS] + duplicate_extruder_x_offset;
|
2900
|
2902
|
inactive_extruder_x_pos = destination[X_AXIS];
|
2901
|
|
- extruder_duplication_enabled = false;
|
|
2903
|
+ extruder_duplication_enabled = false;
|
2902
|
2904
|
}
|
2903
|
2905
|
else
|
2904
|
2906
|
{
|
|
@@ -2908,7 +2910,7 @@ void process_commands()
|
2908
|
2910
|
active_extruder_parked = true;
|
2909
|
2911
|
delayed_move_time = 0;
|
2910
|
2912
|
}
|
2911
|
|
- #else
|
|
2913
|
+ #else
|
2912
|
2914
|
// Offset extruder (only by XY)
|
2913
|
2915
|
int i;
|
2914
|
2916
|
for(i = 0; i < 2; i++) {
|
|
@@ -3121,13 +3123,13 @@ void prepare_move()
|
3121
|
3123
|
{
|
3122
|
3124
|
// move duplicate extruder into correct duplication position.
|
3123
|
3125
|
plan_set_position(inactive_extruder_x_pos, current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
3124
|
|
- plan_buffer_line(current_position[X_AXIS] + duplicate_extruder_x_offset, current_position[Y_AXIS], current_position[Z_AXIS],
|
|
3126
|
+ plan_buffer_line(current_position[X_AXIS] + duplicate_extruder_x_offset, current_position[Y_AXIS], current_position[Z_AXIS],
|
3125
|
3127
|
current_position[E_AXIS], max_feedrate[X_AXIS], 1);
|
3126
|
3128
|
plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
3127
|
3129
|
st_synchronize();
|
3128
|
3130
|
extruder_duplication_enabled = true;
|
3129
|
3131
|
active_extruder_parked = false;
|
3130
|
|
- }
|
|
3132
|
+ }
|
3131
|
3133
|
else if (dual_x_carriage_mode == DXC_AUTO_PARK_MODE) // handle unparking of head
|
3132
|
3134
|
{
|
3133
|
3135
|
if (current_position[E_AXIS] == destination[E_AXIS])
|
|
@@ -3136,7 +3138,7 @@ void prepare_move()
|
3136
|
3138
|
// be used as start of first non-travel move)
|
3137
|
3139
|
if (delayed_move_time != 0xFFFFFFFFUL)
|
3138
|
3140
|
{
|
3139
|
|
- memcpy(current_position, destination, sizeof(current_position));
|
|
3141
|
+ memcpy(current_position, destination, sizeof(current_position));
|
3140
|
3142
|
if (destination[Z_AXIS] > raised_parked_position[Z_AXIS])
|
3141
|
3143
|
raised_parked_position[Z_AXIS] = destination[Z_AXIS];
|
3142
|
3144
|
delayed_move_time = millis();
|
|
@@ -3146,9 +3148,9 @@ void prepare_move()
|
3146
|
3148
|
delayed_move_time = 0;
|
3147
|
3149
|
// unpark extruder: 1) raise, 2) move into starting XY position, 3) lower
|
3148
|
3150
|
plan_buffer_line(raised_parked_position[X_AXIS], raised_parked_position[Y_AXIS], raised_parked_position[Z_AXIS], current_position[E_AXIS], max_feedrate[Z_AXIS], active_extruder);
|
3149
|
|
- plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], raised_parked_position[Z_AXIS],
|
|
3151
|
+ plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], raised_parked_position[Z_AXIS],
|
3150
|
3152
|
current_position[E_AXIS], min(max_feedrate[X_AXIS],max_feedrate[Y_AXIS]), active_extruder);
|
3151
|
|
- plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS],
|
|
3153
|
+ plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS],
|
3152
|
3154
|
current_position[E_AXIS], max_feedrate[Z_AXIS], active_extruder);
|
3153
|
3155
|
active_extruder_parked = false;
|
3154
|
3156
|
}
|
|
@@ -3314,7 +3316,7 @@ void manage_inactivity()
|
3314
|
3316
|
// travel moves have been received so enact them
|
3315
|
3317
|
delayed_move_time = 0xFFFFFFFFUL; // force moves to be done
|
3316
|
3318
|
memcpy(destination,current_position,sizeof(destination));
|
3317
|
|
- prepare_move();
|
|
3319
|
+ prepare_move();
|
3318
|
3320
|
}
|
3319
|
3321
|
#endif
|
3320
|
3322
|
#ifdef TEMP_STAT_LEDS
|