|
@@ -840,7 +840,7 @@ void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) {
|
840
|
840
|
// buf[4] = axiscode;
|
841
|
841
|
|
842
|
842
|
char buf[6];
|
843
|
|
- sprintf(buf,"G28 %c",axiscode);
|
|
843
|
+ sprintf(buf, "G28 %c", axiscode);
|
844
|
844
|
//DEBUG_ECHOPAIR(" ", buf);
|
845
|
845
|
queue.enqueue_one_now(buf);
|
846
|
846
|
//DEBUG_ECHOLNPGM(" ✓");
|
|
@@ -1190,17 +1190,18 @@ void DGUSScreenHandler::GetManualFilamentSpeed(DGUS_VP_Variable &var, void *val_
|
1190
|
1190
|
|
1191
|
1191
|
uint16_t value_len = swap16(*(uint16_t*)val_ptr);
|
1192
|
1192
|
|
1193
|
|
- DEBUG_ECHOLNPAIR_F("FilamentSpeed value:", value_len);
|
|
1193
|
+ DEBUG_ECHOLNPAIR_F("filamentSpeed_mm_s value:", value_len);
|
1194
|
1194
|
|
1195
|
|
- FilamentSpeed = value_len;
|
|
1195
|
+ filamentSpeed_mm_s = value_len;
|
1196
|
1196
|
|
1197
|
1197
|
skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel
|
1198
|
1198
|
}
|
1199
|
1199
|
|
1200
|
1200
|
void DGUSScreenHandler::MKS_FilamentLoadUnload(DGUS_VP_Variable &var, void *val_ptr, const int filamentDir) {
|
1201
|
1201
|
#if EITHER(HAS_MULTI_HOTEND, SINGLENOZZLE)
|
1202
|
|
- char buf[40];
|
1203
|
1202
|
uint8_t swap_tool = 0;
|
|
1203
|
+ #else
|
|
1204
|
+ constexpr uint8_t swap_tool = 1; // T0 (or none at all)
|
1204
|
1205
|
#endif
|
1205
|
1206
|
|
1206
|
1207
|
#if HAS_HOTEND
|
|
@@ -1215,9 +1216,8 @@ void DGUSScreenHandler::MKS_FilamentLoadUnload(DGUS_VP_Variable &var, void *val_
|
1215
|
1216
|
default: break;
|
1216
|
1217
|
case 0:
|
1217
|
1218
|
#if HAS_HOTEND
|
1218
|
|
- if (thermalManager.tooColdToExtrude(0)) {
|
|
1219
|
+ if (thermalManager.tooColdToExtrude(0))
|
1219
|
1220
|
hotend_too_cold = 1;
|
1220
|
|
- }
|
1221
|
1221
|
else {
|
1222
|
1222
|
#if EITHER(HAS_MULTI_HOTEND, SINGLENOZZLE)
|
1223
|
1223
|
swap_tool = 1;
|
|
@@ -1243,15 +1243,41 @@ void DGUSScreenHandler::MKS_FilamentLoadUnload(DGUS_VP_Variable &var, void *val_
|
1243
|
1243
|
}
|
1244
|
1244
|
#endif
|
1245
|
1245
|
|
|
1246
|
+ if (swap_tool) {
|
|
1247
|
+ char buf[30];
|
|
1248
|
+ snprintf_P(buf, 30
|
|
1249
|
+ #if EITHER(HAS_MULTI_HOTEND, SINGLENOZZLE)
|
|
1250
|
+ , PSTR("M1002T%cE%dF%d"), char('0' + swap_tool - 1)
|
|
1251
|
+ #else
|
|
1252
|
+ , PSTR("M1002E%dF%d")
|
|
1253
|
+ #endif
|
|
1254
|
+ , (int)distanceFilament * filamentDir, filamentSpeed_mm_s * 60
|
|
1255
|
+ );
|
|
1256
|
+ queue.inject(buf);
|
|
1257
|
+ }
|
|
1258
|
+}
|
|
1259
|
+
|
|
1260
|
+/**
|
|
1261
|
+ * M1002: Do a tool-change and relative move for MKS_FilamentLoadUnload
|
|
1262
|
+ * within the G-code execution window for best concurrency.
|
|
1263
|
+ */
|
|
1264
|
+void GcodeSuite::M1002() {
|
1246
|
1265
|
#if EITHER(HAS_MULTI_HOTEND, SINGLENOZZLE)
|
1247
|
|
- if (swap_tool) {
|
1248
|
|
- queue.enqueue_now_P(swap_tool == 2 ? PSTR("T1") : PSTR("T0"));
|
1249
|
|
- queue.enqueue_now_P(PSTR("G91"));
|
1250
|
|
- snprintf_P(buf, 40, PSTR("G1 E%d F%d"), (int)distanceFilament * filamentDir, FilamentSpeed * 60);
|
1251
|
|
- queue.enqueue_one_now(buf);
|
1252
|
|
- queue.enqueue_now_P(PSTR("G90"));
|
1253
|
|
- }
|
|
1266
|
+ {
|
|
1267
|
+ char buf[3];
|
|
1268
|
+ sprintf_P(buf, PSTR("T%c"), char('0' + parser.intval('T')));
|
|
1269
|
+ process_subcommands_now(buf);
|
|
1270
|
+ }
|
1254
|
1271
|
#endif
|
|
1272
|
+
|
|
1273
|
+ const uint8_t old_axis_relative = axis_relative;
|
|
1274
|
+ set_e_relative(true); // M83
|
|
1275
|
+ {
|
|
1276
|
+ char buf[20];
|
|
1277
|
+ snprintf_P(buf, 20, PSTR("G1E%dF%d"), parser.intval('E'), parser.intval('F'));
|
|
1278
|
+ process_subcommands_now(buf);
|
|
1279
|
+ }
|
|
1280
|
+ axis_relative = old_axis_relative;
|
1255
|
1281
|
}
|
1256
|
1282
|
|
1257
|
1283
|
void DGUSScreenHandler::MKS_FilamentLoad(DGUS_VP_Variable &var, void *val_ptr) {
|
|
@@ -1445,7 +1471,7 @@ void DGUSScreenHandler::LanguagePInit() {
|
1445
|
1471
|
void DGUSScreenHandler::DGUS_ExtrudeLoadInit(void) {
|
1446
|
1472
|
ex_filament.ex_length = distanceFilament;
|
1447
|
1473
|
ex_filament.ex_load_unload_flag = 0;
|
1448
|
|
- ex_filament.ex_need_time = FilamentSpeed;
|
|
1474
|
+ ex_filament.ex_need_time = filamentSpeed_mm_s;
|
1449
|
1475
|
ex_filament.ex_speed = 0;
|
1450
|
1476
|
ex_filament.ex_status = EX_NONE;
|
1451
|
1477
|
ex_filament.ex_tick_end = 0;
|