|
@@ -111,7 +111,7 @@ void DGUSScreenHandler::DGUSLCD_SendPrintTimeToDisplay_MKS(DGUS_VP_Variable &var
|
111
|
111
|
|
112
|
112
|
void DGUSScreenHandler::DGUSLCD_SetUint8(DGUS_VP_Variable &var, void *val_ptr) {
|
113
|
113
|
if (var.memadr) {
|
114
|
|
- uint16_t value = swap16(*(uint16_t*)val_ptr);
|
|
114
|
+ const uint16_t value = swap16(*(uint16_t*)val_ptr);
|
115
|
115
|
DEBUG_ECHOLNPAIR("FAN value get:", value);
|
116
|
116
|
*(uint8_t*)var.memadr = map(constrain(value, 0, 255), 0, 255, 0, 255);
|
117
|
117
|
DEBUG_ECHOLNPAIR("FAN value change:", *(uint8_t*)var.memadr);
|
|
@@ -314,7 +314,7 @@ void DGUSScreenHandler::ScreenChangeHook(DGUS_VP_Variable &var, void *val_ptr) {
|
314
|
314
|
}
|
315
|
315
|
|
316
|
316
|
void DGUSScreenHandler::ScreenBackChange(DGUS_VP_Variable &var, void *val_ptr) {
|
317
|
|
- uint16_t target = swap16(*(uint16_t *)val_ptr);
|
|
317
|
+ const uint16_t target = swap16(*(uint16_t *)val_ptr);
|
318
|
318
|
DEBUG_ECHOLNPAIR(" back = 0x%x", target);
|
319
|
319
|
switch (target) {
|
320
|
320
|
}
|
|
@@ -330,7 +330,7 @@ void DGUSScreenHandler::ZoffsetConfirm(DGUS_VP_Variable &var, void *val_ptr) {
|
330
|
330
|
|
331
|
331
|
void DGUSScreenHandler::GetTurnOffCtrl(DGUS_VP_Variable &var, void *val_ptr) {
|
332
|
332
|
DEBUG_ECHOLNPGM("ctrl turn off\n");
|
333
|
|
- uint16_t value = swap16(*(uint16_t *)val_ptr);
|
|
333
|
+ const uint16_t value = swap16(*(uint16_t *)val_ptr);
|
334
|
334
|
switch (value) {
|
335
|
335
|
case 0 ... 1: DGUSAutoTurnOff = (bool)value; break;
|
336
|
336
|
default: break;
|
|
@@ -339,7 +339,7 @@ void DGUSScreenHandler::GetTurnOffCtrl(DGUS_VP_Variable &var, void *val_ptr) {
|
339
|
339
|
|
340
|
340
|
void DGUSScreenHandler::GetMinExtrudeTemp(DGUS_VP_Variable &var, void *val_ptr) {
|
341
|
341
|
DEBUG_ECHOLNPGM("MinExtrudeTempChange DistanceChange");
|
342
|
|
- uint16_t value = swap16(*(uint16_t *)val_ptr);
|
|
342
|
+ const uint16_t value = swap16(*(uint16_t *)val_ptr);
|
343
|
343
|
thermalManager.extrude_min_temp = value;
|
344
|
344
|
min_ex_temp = value;
|
345
|
345
|
settings.save();
|
|
@@ -347,7 +347,7 @@ void DGUSScreenHandler::GetMinExtrudeTemp(DGUS_VP_Variable &var, void *val_ptr)
|
347
|
347
|
|
348
|
348
|
void DGUSScreenHandler::GetZoffsetDistance(DGUS_VP_Variable &var, void *val_ptr) {
|
349
|
349
|
DEBUG_ECHOLNPGM("Zoffset DistanceChange");
|
350
|
|
- uint16_t value = swap16(*(uint16_t *)val_ptr);
|
|
350
|
+ const uint16_t value = swap16(*(uint16_t *)val_ptr);
|
351
|
351
|
float val_distance = 0;
|
352
|
352
|
switch (value) {
|
353
|
353
|
case 0: val_distance = 0.01; break;
|
|
@@ -365,7 +365,7 @@ void DGUSScreenHandler::GetManualMovestep(DGUS_VP_Variable &var, void *val_ptr)
|
365
|
365
|
}
|
366
|
366
|
|
367
|
367
|
void DGUSScreenHandler::EEPROM_CTRL(DGUS_VP_Variable &var, void *val_ptr) {
|
368
|
|
- uint16_t eep_flag = swap16(*(uint16_t *)val_ptr);
|
|
368
|
+ const uint16_t eep_flag = swap16(*(uint16_t *)val_ptr);
|
369
|
369
|
switch (eep_flag) {
|
370
|
370
|
case 0:
|
371
|
371
|
settings.save();
|
|
@@ -383,7 +383,7 @@ void DGUSScreenHandler::EEPROM_CTRL(DGUS_VP_Variable &var, void *val_ptr) {
|
383
|
383
|
}
|
384
|
384
|
|
385
|
385
|
void DGUSScreenHandler::Z_offset_select(DGUS_VP_Variable &var, void *val_ptr) {
|
386
|
|
- uint16_t z_value = swap16(*(uint16_t *)val_ptr);
|
|
386
|
+ const uint16_t z_value = swap16(*(uint16_t *)val_ptr);
|
387
|
387
|
switch (z_value) {
|
388
|
388
|
case 0: Z_distance = 0.01; break;
|
389
|
389
|
case 1: Z_distance = 0.1; break;
|
|
@@ -410,7 +410,7 @@ void DGUSScreenHandler::GetOffsetValue(DGUS_VP_Variable &var, void *val_ptr) {
|
410
|
410
|
}
|
411
|
411
|
|
412
|
412
|
void DGUSScreenHandler::LanguageChange_MKS(DGUS_VP_Variable &var, void *val_ptr) {
|
413
|
|
- uint16_t lag_flag = swap16(*(uint16_t *)val_ptr);
|
|
413
|
+ const uint16_t lag_flag = swap16(*(uint16_t *)val_ptr);
|
414
|
414
|
switch (lag_flag) {
|
415
|
415
|
case MKS_SimpleChinese:
|
416
|
416
|
DGUS_LanguageDisplay(MKS_SimpleChinese);
|
|
@@ -435,7 +435,7 @@ void DGUSScreenHandler::LanguageChange_MKS(DGUS_VP_Variable &var, void *val_ptr)
|
435
|
435
|
#endif
|
436
|
436
|
|
437
|
437
|
void DGUSScreenHandler::Level_Ctrl_MKS(DGUS_VP_Variable &var, void *val_ptr) {
|
438
|
|
- uint16_t lev_but = swap16(*(uint16_t *)val_ptr);
|
|
438
|
+ const uint16_t lev_but = swap16(*(uint16_t *)val_ptr);
|
439
|
439
|
#if ENABLED(MESH_BED_LEVELING)
|
440
|
440
|
auto cs = getCurrentScreen();
|
441
|
441
|
#endif
|
|
@@ -482,7 +482,7 @@ void DGUSScreenHandler::Level_Ctrl_MKS(DGUS_VP_Variable &var, void *val_ptr) {
|
482
|
482
|
}
|
483
|
483
|
|
484
|
484
|
void DGUSScreenHandler::MeshLevelDistanceConfig(DGUS_VP_Variable &var, void *val_ptr) {
|
485
|
|
- uint16_t mesh_dist = swap16(*(uint16_t *)val_ptr);
|
|
485
|
+ const uint16_t mesh_dist = swap16(*(uint16_t *)val_ptr);
|
486
|
486
|
switch (mesh_dist) {
|
487
|
487
|
case 0: mesh_adj_distance = 0.01; break;
|
488
|
488
|
case 1: mesh_adj_distance = 0.1; break;
|
|
@@ -493,7 +493,7 @@ void DGUSScreenHandler::MeshLevelDistanceConfig(DGUS_VP_Variable &var, void *val
|
493
|
493
|
|
494
|
494
|
void DGUSScreenHandler::MeshLevel(DGUS_VP_Variable &var, void *val_ptr) {
|
495
|
495
|
#if ENABLED(MESH_BED_LEVELING)
|
496
|
|
- uint16_t mesh_value = swap16(*(uint16_t *)val_ptr);
|
|
496
|
+ const uint16_t mesh_value = swap16(*(uint16_t *)val_ptr);
|
497
|
497
|
// static uint8_t a_first_level = 1;
|
498
|
498
|
char cmd_buf[30];
|
499
|
499
|
float offset = mesh_adj_distance;
|
|
@@ -586,20 +586,16 @@ void DGUSScreenHandler::MeshLevel(DGUS_VP_Variable &var, void *val_ptr) {
|
586
|
586
|
}
|
587
|
587
|
|
588
|
588
|
void DGUSScreenHandler::LCD_BLK_Adjust(DGUS_VP_Variable &var, void *val_ptr) {
|
|
589
|
+ const uint16_t lcd_value = swap16(*(uint16_t *)val_ptr);
|
589
|
590
|
|
590
|
|
- uint16_t lcd_value = swap16(*(uint16_t *)val_ptr);
|
|
591
|
+ lcd_default_light = constrain(lcd_value, 10, 100);
|
591
|
592
|
|
592
|
|
- if (lcd_value > 100) lcd_value = 100;
|
593
|
|
- else if (lcd_value < 10) lcd_value = 10;
|
594
|
|
-
|
595
|
|
- lcd_default_light = lcd_value;
|
596
|
|
-
|
597
|
|
- const uint16_t lcd_data[2] = {lcd_default_light, lcd_default_light};
|
|
593
|
+ const uint16_t lcd_data[2] = { lcd_default_light, lcd_default_light };
|
598
|
594
|
dgusdisplay.WriteVariable(0x0082, &lcd_data, 5, true);
|
599
|
595
|
}
|
600
|
596
|
|
601
|
597
|
void DGUSScreenHandler::ManualAssistLeveling(DGUS_VP_Variable &var, void *val_ptr) {
|
602
|
|
- int16_t point_value = swap16(*(uint16_t *)val_ptr);
|
|
598
|
+ const int16_t point_value = swap16(*(uint16_t *)val_ptr);
|
603
|
599
|
|
604
|
600
|
int16_t level_x_pos, level_y_pos;
|
605
|
601
|
char buf_level[32] = {0};
|
|
@@ -686,7 +682,7 @@ void DGUSScreenHandler::ManualAssistLeveling(DGUS_VP_Variable &var, void *val_pt
|
686
|
682
|
#define mks_max(a, b) ((a) > (b)) ? (a) : (b)
|
687
|
683
|
void DGUSScreenHandler::TMC_ChangeConfig(DGUS_VP_Variable &var, void *val_ptr) {
|
688
|
684
|
#if EITHER(HAS_TRINAMIC_CONFIG, HAS_STEALTHCHOP)
|
689
|
|
- uint16_t tmc_value = swap16(*(uint16_t*)val_ptr);
|
|
685
|
+ const uint16_t tmc_value = swap16(*(uint16_t*)val_ptr);
|
690
|
686
|
#endif
|
691
|
687
|
|
692
|
688
|
switch (var.VP) {
|
|
@@ -930,7 +926,7 @@ void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) {
|
930
|
926
|
}
|
931
|
927
|
|
932
|
928
|
void DGUSScreenHandler::GetParkPos_MKS(DGUS_VP_Variable &var, void *val_ptr) {
|
933
|
|
- int16_t value_pos = swap16(*(int16_t*)val_ptr);
|
|
929
|
+ const int16_t value_pos = swap16(*(int16_t*)val_ptr);
|
934
|
930
|
|
935
|
931
|
switch (var.VP) {
|
936
|
932
|
case VP_X_PARK_POS: x_park_pos = value_pos; break;
|
|
@@ -939,75 +935,76 @@ void DGUSScreenHandler::GetParkPos_MKS(DGUS_VP_Variable &var, void *val_ptr) {
|
939
|
935
|
default: break;
|
940
|
936
|
}
|
941
|
937
|
skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel
|
942
|
|
- return;
|
943
|
938
|
}
|
944
|
939
|
|
945
|
940
|
void DGUSScreenHandler::HandleChangeLevelPoint_MKS(DGUS_VP_Variable &var, void *val_ptr) {
|
946
|
941
|
DEBUG_ECHOLNPGM("HandleStepPerMMChanged");
|
947
|
942
|
|
948
|
|
- int16_t value_raw = swap16(*(int16_t*)val_ptr);
|
949
|
|
-
|
950
|
|
- DEBUG_ECHOLNPAIR_F("value:", value_raw);
|
|
943
|
+ const int16_t value_raw = swap16(*(int16_t*)val_ptr);
|
|
944
|
+ DEBUG_ECHOLNPAIR_F("value_raw:", value_raw);
|
951
|
945
|
|
952
|
946
|
*(int16_t*)var.memadr = value_raw;
|
953
|
947
|
|
954
|
948
|
settings.save();
|
955
|
949
|
skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel
|
956
|
|
- return;
|
957
|
950
|
}
|
958
|
951
|
|
959
|
952
|
void DGUSScreenHandler::HandleStepPerMMChanged_MKS(DGUS_VP_Variable &var, void *val_ptr) {
|
960
|
953
|
DEBUG_ECHOLNPGM("HandleStepPerMMChanged");
|
961
|
954
|
|
962
|
|
- uint16_t value_raw = swap16(*(uint16_t*)val_ptr);
|
|
955
|
+ const uint16_t value_raw = swap16(*(uint16_t*)val_ptr);
|
|
956
|
+ const float value = (float)value_raw;
|
963
|
957
|
|
964
|
958
|
DEBUG_ECHOLNPAIR("value_raw:", value_raw);
|
965
|
|
- float value = (float)value_raw;
|
|
959
|
+ DEBUG_ECHOLNPAIR_F("value:", value);
|
|
960
|
+
|
966
|
961
|
ExtUI::axis_t axis;
|
967
|
962
|
switch (var.VP) {
|
|
963
|
+ default: return;
|
968
|
964
|
case VP_X_STEP_PER_MM: axis = ExtUI::axis_t::X; break;
|
969
|
965
|
case VP_Y_STEP_PER_MM: axis = ExtUI::axis_t::Y; break;
|
970
|
966
|
case VP_Z_STEP_PER_MM: axis = ExtUI::axis_t::Z; break;
|
971
|
|
- default: return;
|
972
|
967
|
}
|
973
|
|
- DEBUG_ECHOLNPAIR_F("value:", value);
|
974
|
968
|
ExtUI::setAxisSteps_per_mm(value, axis);
|
975
|
969
|
DEBUG_ECHOLNPAIR_F("value_set:", ExtUI::getAxisSteps_per_mm(axis));
|
976
|
970
|
settings.save();
|
977
|
971
|
skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel
|
978
|
|
- return;
|
979
|
972
|
}
|
980
|
973
|
|
981
|
974
|
void DGUSScreenHandler::HandleStepPerMMExtruderChanged_MKS(DGUS_VP_Variable &var, void *val_ptr) {
|
982
|
975
|
DEBUG_ECHOLNPGM("HandleStepPerMMExtruderChanged");
|
983
|
976
|
|
984
|
|
- uint16_t value_raw = swap16(*(uint16_t*)val_ptr);
|
|
977
|
+ const uint16_t value_raw = swap16(*(uint16_t*)val_ptr);
|
|
978
|
+ const float value = (float)value_raw;
|
|
979
|
+
|
985
|
980
|
DEBUG_ECHOLNPAIR("value_raw:", value_raw);
|
986
|
|
- float value = (float)value_raw;
|
|
981
|
+ DEBUG_ECHOLNPAIR_F("value:", value);
|
|
982
|
+
|
987
|
983
|
ExtUI::extruder_t extruder;
|
988
|
984
|
switch (var.VP) {
|
989
|
985
|
default: return;
|
990
|
|
- #if HOTENDS >= 1
|
991
|
|
- case VP_E0_STEP_PER_MM: extruder = ExtUI::extruder_t::E0; break;
|
992
|
|
- #endif
|
993
|
|
- #if HOTENDS >= 2
|
994
|
|
- #endif
|
995
|
|
- case VP_E1_STEP_PER_MM: extruder = ExtUI::extruder_t::E1; break;
|
|
986
|
+ #if HAS_HOTEND
|
|
987
|
+ case VP_E0_STEP_PER_MM: extruder = ExtUI::extruder_t::E0; break;
|
|
988
|
+ #endif
|
|
989
|
+ #if HAS_MULTI_HOTEND
|
|
990
|
+ case VP_E1_STEP_PER_MM: extruder = ExtUI::extruder_t::E1; break;
|
|
991
|
+ #endif
|
996
|
992
|
}
|
997
|
|
- DEBUG_ECHOLNPAIR_F("value:", value);
|
998
|
993
|
ExtUI::setAxisSteps_per_mm(value, extruder);
|
999
|
994
|
DEBUG_ECHOLNPAIR_F("value_set:", ExtUI::getAxisSteps_per_mm(extruder));
|
1000
|
995
|
settings.save();
|
1001
|
996
|
skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel
|
1002
|
|
- return;
|
1003
|
997
|
}
|
1004
|
998
|
|
1005
|
999
|
void DGUSScreenHandler::HandleMaxSpeedChange_MKS(DGUS_VP_Variable &var, void *val_ptr) {
|
1006
|
1000
|
DEBUG_ECHOLNPGM("HandleMaxSpeedChange_MKS");
|
1007
|
1001
|
|
1008
|
|
- uint16_t value_raw = swap16(*(uint16_t*)val_ptr);
|
|
1002
|
+ const uint16_t value_raw = swap16(*(uint16_t*)val_ptr);
|
|
1003
|
+ const float value = (float)value_raw;
|
|
1004
|
+
|
1009
|
1005
|
DEBUG_ECHOLNPAIR("value_raw:", value_raw);
|
1010
|
|
- float value = (float)value_raw;
|
|
1006
|
+ DEBUG_ECHOLNPAIR_F("value:", value);
|
|
1007
|
+
|
1011
|
1008
|
ExtUI::axis_t axis;
|
1012
|
1009
|
switch (var.VP) {
|
1013
|
1010
|
case VP_X_MAX_SPEED: axis = ExtUI::axis_t::X; break;
|
|
@@ -1015,59 +1012,57 @@ void DGUSScreenHandler::HandleMaxSpeedChange_MKS(DGUS_VP_Variable &var, void *va
|
1015
|
1012
|
case VP_Z_MAX_SPEED: axis = ExtUI::axis_t::Z; break;
|
1016
|
1013
|
default: return;
|
1017
|
1014
|
}
|
1018
|
|
- DEBUG_ECHOLNPAIR_F("value:", value);
|
1019
|
|
- // ExtUI::setAxisSteps_per_mm(value,extruder);
|
1020
|
1015
|
ExtUI::setAxisMaxFeedrate_mm_s(value, axis);
|
1021
|
1016
|
DEBUG_ECHOLNPAIR_F("value_set:", ExtUI::getAxisMaxFeedrate_mm_s(axis));
|
1022
|
1017
|
settings.save();
|
1023
|
1018
|
skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel
|
1024
|
|
- return;
|
1025
|
1019
|
}
|
1026
|
1020
|
|
1027
|
1021
|
void DGUSScreenHandler::HandleExtruderMaxSpeedChange_MKS(DGUS_VP_Variable &var, void *val_ptr) {
|
1028
|
1022
|
DEBUG_ECHOLNPGM("HandleMaxSpeedChange_MKS");
|
1029
|
1023
|
|
1030
|
|
- uint16_t value_raw = swap16(*(uint16_t*)val_ptr);
|
|
1024
|
+ const uint16_t value_raw = swap16(*(uint16_t*)val_ptr);
|
|
1025
|
+ const float value = (float)value_raw;
|
|
1026
|
+
|
1031
|
1027
|
DEBUG_ECHOLNPAIR("value_raw:", value_raw);
|
1032
|
|
- float value = (float)value_raw;
|
|
1028
|
+ DEBUG_ECHOLNPAIR_F("value:", value);
|
|
1029
|
+
|
1033
|
1030
|
ExtUI::extruder_t extruder;
|
1034
|
1031
|
switch (var.VP) {
|
1035
|
1032
|
default: return;
|
1036
|
|
- #if HOTENDS >= 1
|
|
1033
|
+ #if HAS_HOTEND
|
1037
|
1034
|
case VP_E0_MAX_SPEED: extruder = ExtUI::extruder_t::E0; break;
|
1038
|
1035
|
#endif
|
1039
|
|
- #if HOTENDS >= 2
|
|
1036
|
+ #if HAS_MULTI_HOTEND
|
1040
|
1037
|
#endif
|
1041
|
1038
|
case VP_E1_MAX_SPEED: extruder = ExtUI::extruder_t::E1; break;
|
1042
|
1039
|
}
|
1043
|
|
- DEBUG_ECHOLNPAIR_F("value:", value);
|
1044
|
|
- // ExtUI::setAxisSteps_per_mm(value,extruder);
|
1045
|
1040
|
ExtUI::setAxisMaxFeedrate_mm_s(value, extruder);
|
1046
|
1041
|
DEBUG_ECHOLNPAIR_F("value_set:", ExtUI::getAxisMaxFeedrate_mm_s(extruder));
|
1047
|
1042
|
settings.save();
|
1048
|
1043
|
skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel
|
1049
|
|
- return;
|
1050
|
1044
|
}
|
1051
|
1045
|
|
1052
|
1046
|
void DGUSScreenHandler::HandleMaxAccChange_MKS(DGUS_VP_Variable &var, void *val_ptr) {
|
1053
|
1047
|
DEBUG_ECHOLNPGM("HandleMaxSpeedChange_MKS");
|
1054
|
1048
|
|
1055
|
|
- uint16_t value_raw = swap16(*(uint16_t*)val_ptr);
|
|
1049
|
+ const uint16_t value_raw = swap16(*(uint16_t*)val_ptr);
|
|
1050
|
+ const float value = (float)value_raw;
|
|
1051
|
+
|
1056
|
1052
|
DEBUG_ECHOLNPAIR("value_raw:", value_raw);
|
1057
|
|
- float value = (float)value_raw;
|
|
1053
|
+ DEBUG_ECHOLNPAIR_F("value:", value);
|
|
1054
|
+
|
1058
|
1055
|
ExtUI::axis_t axis;
|
1059
|
1056
|
switch (var.VP) {
|
|
1057
|
+ default: return;
|
1060
|
1058
|
case VP_X_ACC_MAX_SPEED: axis = ExtUI::axis_t::X; break;
|
1061
|
1059
|
case VP_Y_ACC_MAX_SPEED: axis = ExtUI::axis_t::Y; break;
|
1062
|
1060
|
case VP_Z_ACC_MAX_SPEED: axis = ExtUI::axis_t::Z; break;
|
1063
|
|
- default: return;
|
1064
|
1061
|
}
|
1065
|
|
- DEBUG_ECHOLNPAIR_F("value:", value);
|
1066
|
1062
|
ExtUI::setAxisMaxAcceleration_mm_s2(value, axis);
|
1067
|
1063
|
DEBUG_ECHOLNPAIR_F("value_set:", ExtUI::getAxisMaxAcceleration_mm_s2(axis));
|
1068
|
1064
|
settings.save();
|
1069
|
1065
|
skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel
|
1070
|
|
- return;
|
1071
|
1066
|
}
|
1072
|
1067
|
|
1073
|
1068
|
void DGUSScreenHandler::HandleExtruderAccChange_MKS(DGUS_VP_Variable &var, void *val_ptr) {
|
|
@@ -1079,76 +1074,66 @@ void DGUSScreenHandler::HandleExtruderAccChange_MKS(DGUS_VP_Variable &var, void
|
1079
|
1074
|
ExtUI::extruder_t extruder;
|
1080
|
1075
|
switch (var.VP) {
|
1081
|
1076
|
default: return;
|
1082
|
|
- #if HOTENDS >= 1
|
1083
|
|
- case VP_E0_ACC_MAX_SPEED: extruder = ExtUI::extruder_t::E0; settings.load(); break;
|
1084
|
|
- #endif
|
1085
|
|
- #if HOTENDS >= 2
|
1086
|
|
- #endif
|
1087
|
|
- case VP_E1_ACC_MAX_SPEED: extruder = ExtUI::extruder_t::E1; settings.load(); break;
|
|
1077
|
+ #if HAS_HOTEND
|
|
1078
|
+ case VP_E0_ACC_MAX_SPEED: extruder = ExtUI::extruder_t::E0; settings.load(); break;
|
|
1079
|
+ #endif
|
|
1080
|
+ #if HAS_MULTI_HOTEND
|
|
1081
|
+ case VP_E1_ACC_MAX_SPEED: extruder = ExtUI::extruder_t::E1; settings.load(); break;
|
|
1082
|
+ #endif
|
1088
|
1083
|
}
|
1089
|
1084
|
DEBUG_ECHOLNPAIR_F("value:", value);
|
1090
|
|
- // ExtUI::setAxisSteps_per_mm(value,extruder);
|
1091
|
1085
|
ExtUI::setAxisMaxAcceleration_mm_s2(value, extruder);
|
1092
|
1086
|
DEBUG_ECHOLNPAIR_F("value_set:", ExtUI::getAxisMaxAcceleration_mm_s2(extruder));
|
1093
|
1087
|
settings.save();
|
1094
|
1088
|
skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel
|
1095
|
|
- return;
|
1096
|
1089
|
}
|
1097
|
1090
|
|
1098
|
1091
|
void DGUSScreenHandler::HandleTravelAccChange_MKS(DGUS_VP_Variable &var, void *val_ptr) {
|
1099
|
1092
|
uint16_t value_travel = swap16(*(uint16_t*)val_ptr);
|
1100
|
|
- float value = (float)value_travel;
|
1101
|
|
- planner.settings.travel_acceleration = value;
|
|
1093
|
+ planner.settings.travel_acceleration = (float)value_travel;
|
1102
|
1094
|
skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel
|
1103
|
|
- return;
|
1104
|
1095
|
}
|
1105
|
1096
|
|
1106
|
1097
|
void DGUSScreenHandler::HandleFeedRateMinChange_MKS(DGUS_VP_Variable &var, void *val_ptr) {
|
1107
|
1098
|
uint16_t value_t = swap16(*(uint16_t*)val_ptr);
|
1108
|
|
- float value = (float)value_t;
|
1109
|
|
- planner.settings.min_feedrate_mm_s = value;
|
|
1099
|
+ planner.settings.min_feedrate_mm_s = (float)value_t;
|
1110
|
1100
|
skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel
|
1111
|
|
- return;
|
1112
|
1101
|
}
|
1113
|
1102
|
|
1114
|
1103
|
void DGUSScreenHandler::HandleMin_T_F_MKS(DGUS_VP_Variable &var, void *val_ptr) {
|
1115
|
1104
|
uint16_t value_t_f = swap16(*(uint16_t*)val_ptr);
|
1116
|
|
- float value = (float)value_t_f;
|
1117
|
|
- planner.settings.min_travel_feedrate_mm_s = value;
|
|
1105
|
+ planner.settings.min_travel_feedrate_mm_s = (float)value_t_f;
|
1118
|
1106
|
skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel
|
1119
|
|
- return;
|
1120
|
1107
|
}
|
1121
|
1108
|
|
1122
|
1109
|
void DGUSScreenHandler::HandleAccChange_MKS(DGUS_VP_Variable &var, void *val_ptr) {
|
1123
|
1110
|
uint16_t value_acc = swap16(*(uint16_t*)val_ptr);
|
1124
|
|
- float value = (float)value_acc;
|
1125
|
|
- planner.settings.acceleration = value;
|
|
1111
|
+ planner.settings.acceleration = (float)value_acc;
|
1126
|
1112
|
skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel
|
1127
|
|
- return;
|
1128
|
1113
|
}
|
1129
|
1114
|
|
1130
|
1115
|
void DGUSScreenHandler::HandleGetExMinTemp_MKS(DGUS_VP_Variable &var, void *val_ptr) {
|
1131
|
|
- uint16_t value_ex_min_temp = swap16(*(uint16_t*)val_ptr);
|
|
1116
|
+ const uint16_t value_ex_min_temp = swap16(*(uint16_t*)val_ptr);
|
1132
|
1117
|
thermalManager.extrude_min_temp = value_ex_min_temp;
|
1133
|
1118
|
skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel
|
1134
|
1119
|
}
|
1135
|
1120
|
|
1136
|
1121
|
#if HAS_PID_HEATING
|
1137
|
1122
|
void DGUSScreenHandler::HandleTemperaturePIDChanged(DGUS_VP_Variable &var, void *val_ptr) {
|
1138
|
|
- uint16_t rawvalue = swap16(*(uint16_t*)val_ptr);
|
|
1123
|
+ const uint16_t rawvalue = swap16(*(uint16_t*)val_ptr);
|
1139
|
1124
|
DEBUG_ECHOLNPAIR("V1:", rawvalue);
|
1140
|
|
- float value = (float)rawvalue / 10;
|
|
1125
|
+ const float value = 1.0f * rawvalue;
|
1141
|
1126
|
DEBUG_ECHOLNPAIR("V2:", value);
|
1142
|
1127
|
float newvalue = 0;
|
1143
|
1128
|
|
1144
|
1129
|
switch (var.VP) {
|
1145
|
1130
|
default: return;
|
1146
|
|
- #if HOTENDS >= 1
|
|
1131
|
+ #if HAS_HOTEND
|
1147
|
1132
|
case VP_E0_PID_P: newvalue = value; break;
|
1148
|
1133
|
case VP_E0_PID_I: newvalue = scalePID_i(value); break;
|
1149
|
1134
|
case VP_E0_PID_D: newvalue = scalePID_d(value); break;
|
1150
|
1135
|
#endif
|
1151
|
|
- #if HOTENDS >= 2
|
|
1136
|
+ #if HAS_MULTI_HOTEND
|
1152
|
1137
|
case VP_E1_PID_P: newvalue = value; break;
|
1153
|
1138
|
case VP_E1_PID_I: newvalue = scalePID_i(value); break;
|
1154
|
1139
|
case VP_E1_PID_D: newvalue = scalePID_d(value); break;
|
|
@@ -1224,7 +1209,6 @@ void DGUSScreenHandler::GetManualFilament(DGUS_VP_Variable &var, void *val_ptr)
|
1224
|
1209
|
distanceFilament = value;
|
1225
|
1210
|
|
1226
|
1211
|
skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel
|
1227
|
|
- return;
|
1228
|
1212
|
}
|
1229
|
1213
|
|
1230
|
1214
|
void DGUSScreenHandler::GetManualFilamentSpeed(DGUS_VP_Variable &var, void *val_ptr) {
|
|
@@ -1237,137 +1221,65 @@ void DGUSScreenHandler::GetManualFilamentSpeed(DGUS_VP_Variable &var, void *val_
|
1237
|
1221
|
FilamentSpeed = value_len;
|
1238
|
1222
|
|
1239
|
1223
|
skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel
|
1240
|
|
- return;
|
1241
|
1224
|
}
|
1242
|
1225
|
|
1243
|
|
-void DGUSScreenHandler::MKS_FilamentLoad(DGUS_VP_Variable &var, void *val_ptr) {
|
1244
|
|
- DEBUG_ECHOLNPGM("Load Filament");
|
1245
|
|
- char buf[40];
|
1246
|
|
-
|
1247
|
|
- uint16_t val_t = swap16(*(uint16_t*)val_ptr);
|
|
1226
|
+void DGUSScreenHandler::MKS_FilamentLoadUnload(DGUS_VP_Variable &var, void *val_ptr, const int filamentDir) {
|
|
1227
|
+ #if EITHER(HAS_MULTI_HOTEND, SINGLENOZZLE)
|
|
1228
|
+ uint8_t swap_tool = 0;
|
|
1229
|
+ #endif
|
|
1230
|
+ #if HAS_HOTEND
|
|
1231
|
+ uint8_t hotend_too_cold = 0;
|
|
1232
|
+ #endif
|
1248
|
1233
|
|
1249
|
1234
|
if (!print_job_timer.isPaused() && !queue.ring_buffer.empty())
|
1250
|
1235
|
return;
|
1251
|
1236
|
|
|
1237
|
+ char buf[40];
|
|
1238
|
+ const uint16_t val_t = swap16(*(uint16_t*)val_ptr);
|
1252
|
1239
|
switch (val_t) {
|
|
1240
|
+ default: break;
|
1253
|
1241
|
case 0:
|
1254
|
|
- #if HOTENDS >= 1
|
1255
|
|
- if (thermalManager.degHotend(0) < thermalManager.extrude_min_temp) {
|
1256
|
|
- if (thermalManager.degTargetHotend(0) < thermalManager.extrude_min_temp)
|
1257
|
|
- thermalManager.setTargetHotend(thermalManager.extrude_min_temp, 0);
|
1258
|
|
- sendinfoscreen(PSTR("NOTICE"), nullptr, PSTR("Please wait."), PSTR("Nozzle heating!"), true, true, true, true);
|
1259
|
|
- SetupConfirmAction(nullptr);
|
1260
|
|
- GotoScreen(DGUSLCD_SCREEN_POPUP);
|
1261
|
|
- }
|
1262
|
|
- else {
|
1263
|
|
- queue.enqueue_now_P(PSTR("T0"));
|
1264
|
|
- queue.enqueue_now_P(PSTR("G91"));
|
1265
|
|
- snprintf_P(buf,40,PSTR("G1 E%d F%d"),(int)distanceFilament,FilamentSpeed * 60);
|
1266
|
|
- queue.enqueue_one_now(buf);
|
1267
|
|
- queue.enqueue_now_P(PSTR("G90"));
|
1268
|
|
- }
|
|
1242
|
+ #if HAS_HOTEND
|
|
1243
|
+ if (thermalManager.tooColdToExtrude(0)) hotend_too_cold = 1; else swap_tool = 1;
|
1269
|
1244
|
#endif
|
1270
|
1245
|
break;
|
1271
|
|
-
|
1272
|
1246
|
case 1:
|
1273
|
|
- #if HOTENDS >= 2
|
1274
|
|
- if (thermalManager.degHotend(1) < thermalManager.extrude_min_temp) {
|
1275
|
|
- if (thermalManager.degTargetHotend(1) < thermalManager.extrude_min_temp)
|
1276
|
|
- thermalManager.setTargetHotend(thermalManager.extrude_min_temp, 1);
|
1277
|
|
- sendinfoscreen(PSTR("NOTICE"), nullptr, PSTR("Please wait."), PSTR("Nozzle heating!"), true, true, true, true);
|
1278
|
|
- SetupConfirmAction(nullptr);
|
1279
|
|
- GotoScreen(DGUSLCD_SCREEN_POPUP);
|
1280
|
|
- }
|
1281
|
|
- else {
|
1282
|
|
- queue.enqueue_now_P(PSTR("T1"));
|
1283
|
|
- queue.enqueue_now_P(PSTR("G91"));
|
1284
|
|
- snprintf_P(buf,40,PSTR("G1 E%d F%d"),(int)distanceFilament,FilamentSpeed * 60);
|
1285
|
|
- queue.enqueue_one_now(buf);
|
1286
|
|
- queue.enqueue_now_P(PSTR("G90"));
|
1287
|
|
- }
|
1288
|
|
- #endif
|
1289
|
|
- #if ENABLED(SINGLENOZZLE)
|
1290
|
|
- if (thermalManager.degHotend(0) < thermalManager.extrude_min_temp) {
|
1291
|
|
- if (thermalManager.degTargetHotend(0) < thermalManager.extrude_min_temp)
|
1292
|
|
- thermalManager.setTargetHotend(thermalManager.extrude_min_temp, 0);
|
1293
|
|
- sendinfoscreen(PSTR("NOTICE"), nullptr, PSTR("Please wait."), PSTR("Nozzle heating!"), true, true, true, true);
|
1294
|
|
- SetupConfirmAction(nullptr);
|
1295
|
|
- GotoScreen(DGUSLCD_SCREEN_POPUP);
|
1296
|
|
- }
|
1297
|
|
- else {
|
1298
|
|
- queue.enqueue_now_P(PSTR("T1"));
|
1299
|
|
- queue.enqueue_now_P(PSTR("G91"));
|
1300
|
|
- snprintf_P(buf,40,PSTR("G1 E%d F%d"),(int)distanceFilament,FilamentSpeed * 60);
|
1301
|
|
- queue.enqueue_one_now(buf);
|
1302
|
|
- queue.enqueue_now_P(PSTR("G90"));
|
1303
|
|
- }
|
|
1247
|
+ #if HAS_MULTI_HOTEND
|
|
1248
|
+ if (thermalManager.tooColdToExtrude(1)) hotend_too_cold = 2; else swap_tool = 2;
|
|
1249
|
+ #elif ENABLED(SINGLENOZZLE)
|
|
1250
|
+ if (thermalManager.tooColdToExtrude(0)) hotend_too_cold = 1; else swap_tool = 2;
|
1304
|
1251
|
#endif
|
1305
|
1252
|
break;
|
1306
|
|
-
|
1307
|
|
- default:
|
1308
|
|
- break;
|
1309
|
1253
|
}
|
|
1254
|
+
|
|
1255
|
+ #if HAS_HOTEND
|
|
1256
|
+ if (hotend_too_cold) {
|
|
1257
|
+ if (thermalManager.targetTooColdToExtrude(hotend_too_cold - 1)) thermalManager.setTargetHotend(thermalManager.extrude_min_temp, hotend_too_cold - 1);
|
|
1258
|
+ sendinfoscreen(PSTR("NOTICE"), nullptr, PSTR("Please wait."), PSTR("Nozzle heating!"), true, true, true, true);
|
|
1259
|
+ SetupConfirmAction(nullptr);
|
|
1260
|
+ GotoScreen(DGUSLCD_SCREEN_POPUP);
|
|
1261
|
+ }
|
|
1262
|
+ #endif
|
|
1263
|
+
|
|
1264
|
+ #if EITHER(HAS_MULTI_HOTEND, SINGLENOZZLE)
|
|
1265
|
+ if (swap_tool) {
|
|
1266
|
+ queue.enqueue_now_P(swap_tool == 2 ? PSTR("T1") : PSTR("T0"));
|
|
1267
|
+ queue.enqueue_now_P(PSTR("G91"));
|
|
1268
|
+ snprintf_P(buf, 40, PSTR("G1 E%d F%d"), (int)distanceFilament * filamentDir, FilamentSpeed * 60);
|
|
1269
|
+ queue.enqueue_one_now(buf);
|
|
1270
|
+ queue.enqueue_now_P(PSTR("G90"));
|
|
1271
|
+ }
|
|
1272
|
+ #endif
|
|
1273
|
+}
|
|
1274
|
+
|
|
1275
|
+void DGUSScreenHandler::MKS_FilamentLoad(DGUS_VP_Variable &var, void *val_ptr) {
|
|
1276
|
+ DEBUG_ECHOLNPGM("Load Filament");
|
|
1277
|
+ MKS_FilamentLoadUnload(var, val_ptr, 1);
|
1310
|
1278
|
}
|
1311
|
1279
|
|
1312
|
1280
|
void DGUSScreenHandler::MKS_FilamentUnLoad(DGUS_VP_Variable &var, void *val_ptr) {
|
1313
|
1281
|
DEBUG_ECHOLNPGM("UnLoad Filament");
|
1314
|
|
- char buf[40];
|
1315
|
|
- uint16_t val_t = swap16(*(uint16_t*)val_ptr);
|
1316
|
|
- switch (val_t) {
|
1317
|
|
- case 0:
|
1318
|
|
- #if HOTENDS >= 1
|
1319
|
|
- if (thermalManager.degHotend(0) < thermalManager.extrude_min_temp) {
|
1320
|
|
- if (thermalManager.degTargetHotend(0) < thermalManager.extrude_min_temp)
|
1321
|
|
- thermalManager.setTargetHotend(thermalManager.extrude_min_temp, 0);
|
1322
|
|
- sendinfoscreen(PSTR("NOTICE"), nullptr, PSTR("Please wait."), PSTR("Nozzle heating!"), true, true, true, true);
|
1323
|
|
- SetupConfirmAction(nullptr);
|
1324
|
|
- GotoScreen(DGUSLCD_SCREEN_POPUP);
|
1325
|
|
- }
|
1326
|
|
- else {
|
1327
|
|
- queue.enqueue_now_P(PSTR("T0"));
|
1328
|
|
- queue.enqueue_now_P(PSTR("G91"));
|
1329
|
|
- snprintf_P(buf,40,PSTR("G1 E-%d F%d"),(int)distanceFilament,FilamentSpeed * 60);
|
1330
|
|
- queue.enqueue_one_now(buf);
|
1331
|
|
- queue.enqueue_now_P(PSTR("G90"));
|
1332
|
|
- }
|
1333
|
|
- #endif
|
1334
|
|
- break;
|
1335
|
|
- case 1:
|
1336
|
|
- #if HOTENDS >= 2
|
1337
|
|
- if (thermalManager.degHotend(1) < thermalManager.extrude_min_temp) {
|
1338
|
|
- if (thermalManager.degTargetHotend(1) < thermalManager.extrude_min_temp)
|
1339
|
|
- thermalManager.setTargetHotend(thermalManager.extrude_min_temp, 1);
|
1340
|
|
- sendinfoscreen(PSTR("NOTICE"), nullptr, PSTR("Please wait."), PSTR("Nozzle heating!"), true, true, true, true);
|
1341
|
|
- SetupConfirmAction(nullptr);
|
1342
|
|
- GotoScreen(DGUSLCD_SCREEN_POPUP);
|
1343
|
|
- }
|
1344
|
|
- else {
|
1345
|
|
- queue.enqueue_now_P(PSTR("T1"));
|
1346
|
|
- queue.enqueue_now_P(PSTR("G91"));
|
1347
|
|
- snprintf_P(buf,40,PSTR("G1 E-%d F%d"),(int)distanceFilament,FilamentSpeed * 60);
|
1348
|
|
- queue.enqueue_one_now(buf);
|
1349
|
|
- queue.enqueue_now_P(PSTR("G90"));
|
1350
|
|
- }
|
1351
|
|
- #endif
|
1352
|
|
-
|
1353
|
|
- #if ENABLED(SINGLENOZZLE)
|
1354
|
|
- if (thermalManager.degHotend(0) < thermalManager.extrude_min_temp) {
|
1355
|
|
- if (thermalManager.degTargetHotend(0) < thermalManager.extrude_min_temp)
|
1356
|
|
- thermalManager.setTargetHotend(thermalManager.extrude_min_temp, 0);
|
1357
|
|
- sendinfoscreen(PSTR("NOTICE"), nullptr, PSTR("Please wait."), PSTR("Nozzle heating!"), true, true, true, true);
|
1358
|
|
- SetupConfirmAction(nullptr);
|
1359
|
|
- GotoScreen(DGUSLCD_SCREEN_POPUP);
|
1360
|
|
- }
|
1361
|
|
- else {
|
1362
|
|
- queue.enqueue_now_P(PSTR("T1"));
|
1363
|
|
- queue.enqueue_now_P(PSTR("G91"));
|
1364
|
|
- snprintf_P(buf,40,PSTR("G1 E-%d F%d"),(int)distanceFilament,FilamentSpeed * 60);
|
1365
|
|
- queue.enqueue_one_now(buf);
|
1366
|
|
- queue.enqueue_now_P(PSTR("G90"));
|
1367
|
|
- }
|
1368
|
|
- #endif
|
1369
|
|
- break;
|
1370
|
|
- }
|
|
1282
|
+ MKS_FilamentLoadUnload(var, val_ptr, -1);
|
1371
|
1283
|
}
|
1372
|
1284
|
|
1373
|
1285
|
#if ENABLED(DGUS_FILAMENT_LOADUNLOAD)
|
|
@@ -1378,17 +1290,15 @@ void DGUSScreenHandler::MKS_FilamentUnLoad(DGUS_VP_Variable &var, void *val_ptr)
|
1378
|
1290
|
uint8_t e_temp = 0;
|
1379
|
1291
|
filament_data.heated = false;
|
1380
|
1292
|
uint16_t preheat_option = swap16(*(uint16_t*)val_ptr);
|
1381
|
|
- if (preheat_option <= 8) { // Load filament type
|
1382
|
|
- filament_data.action = 1;
|
1383
|
|
- }
|
1384
|
|
- else if (preheat_option >= 10) { // Unload filament type
|
|
1293
|
+ if (preheat_option >= 10) { // Unload filament type
|
1385
|
1294
|
preheat_option -= 10;
|
1386
|
1295
|
filament_data.action = 2;
|
1387
|
1296
|
filament_data.purge_length = DGUS_FILAMENT_PURGE_LENGTH;
|
1388
|
1297
|
}
|
1389
|
|
- else { // Cancel filament operation
|
|
1298
|
+ else if (preheat_option <= 8) // Load filament type
|
|
1299
|
+ filament_data.action = 1;
|
|
1300
|
+ else // Cancel filament operation
|
1390
|
1301
|
filament_data.action = 0;
|
1391
|
|
- }
|
1392
|
1302
|
|
1393
|
1303
|
switch (preheat_option) {
|
1394
|
1304
|
case 0: // Load PLA
|
|
@@ -1416,10 +1326,10 @@ void DGUSScreenHandler::MKS_FilamentUnLoad(DGUS_VP_Variable &var, void *val_ptr)
|
1416
|
1326
|
}
|
1417
|
1327
|
|
1418
|
1328
|
if (filament_data.action == 0) { // Go back to utility screen
|
1419
|
|
- #if HOTENDS >= 1
|
|
1329
|
+ #if HAS_HOTEND
|
1420
|
1330
|
thermalManager.setTargetHotend(e_temp, ExtUI::extruder_t::E0);
|
1421
|
1331
|
#endif
|
1422
|
|
- #if HOTENDS >= 2
|
|
1332
|
+ #if HAS_MULTI_HOTEND
|
1423
|
1333
|
thermalManager.setTargetHotend(e_temp, ExtUI::extruder_t::E1);
|
1424
|
1334
|
#endif
|
1425
|
1335
|
GotoScreen(DGUSLCD_SCREEN_UTILITY);
|
|
@@ -1427,13 +1337,13 @@ void DGUSScreenHandler::MKS_FilamentUnLoad(DGUS_VP_Variable &var, void *val_ptr)
|
1427
|
1337
|
else { // Go to the preheat screen to show the heating progress
|
1428
|
1338
|
switch (var.VP) {
|
1429
|
1339
|
default: return;
|
1430
|
|
- #if HOTENDS >= 1
|
|
1340
|
+ #if HAS_HOTEND
|
1431
|
1341
|
case VP_E0_FILAMENT_LOAD_UNLOAD:
|
1432
|
1342
|
filament_data.extruder = ExtUI::extruder_t::E0;
|
1433
|
1343
|
thermalManager.setTargetHotend(e_temp, filament_data.extruder);
|
1434
|
1344
|
break;
|
1435
|
1345
|
#endif
|
1436
|
|
- #if HOTENDS >= 2
|
|
1346
|
+ #if HAS_MULTI_HOTEND
|
1437
|
1347
|
case VP_E1_FILAMENT_LOAD_UNLOAD:
|
1438
|
1348
|
filament_data.extruder = ExtUI::extruder_t::E1;
|
1439
|
1349
|
thermalManager.setTargetHotend(e_temp, filament_data.extruder);
|
|
@@ -1475,6 +1385,7 @@ void DGUSScreenHandler::MKS_FilamentUnLoad(DGUS_VP_Variable &var, void *val_ptr)
|
1475
|
1385
|
ExtUI::setAxisPosition_mm(movevalue, filament_data.extruder);
|
1476
|
1386
|
}
|
1477
|
1387
|
}
|
|
1388
|
+
|
1478
|
1389
|
#endif // DGUS_FILAMENT_LOADUNLOAD
|
1479
|
1390
|
|
1480
|
1391
|
bool DGUSScreenHandler::loop() {
|