|
@@ -54,9 +54,6 @@
|
54
|
54
|
bool DGUSAutoTurnOff = false;
|
55
|
55
|
MKS_Language mks_language_index; // Initialized by settings.load()
|
56
|
56
|
|
57
|
|
-// endianness swap
|
58
|
|
-uint32_t swap32(const uint32_t value) { return (value & 0x000000FFU) << 24U | (value & 0x0000FF00U) << 8U | (value & 0x00FF0000U) >> 8U | (value & 0xFF000000U) >> 24U; }
|
59
|
|
-
|
60
|
57
|
#if 0
|
61
|
58
|
void DGUSScreenHandlerMKS::sendinfoscreen_ch(const uint16_t *line1, const uint16_t *line2, const uint16_t *line3, const uint16_t *line4) {
|
62
|
59
|
dgusdisplay.WriteVariable(VP_MSGSTR1, line1, 32, true);
|
|
@@ -108,10 +105,10 @@ void DGUSScreenHandlerMKS::DGUSLCD_SendPrintTimeToDisplay(DGUS_VP_Variable &var)
|
108
|
105
|
|
109
|
106
|
void DGUSScreenHandlerMKS::DGUSLCD_SetUint8(DGUS_VP_Variable &var, void *val_ptr) {
|
110
|
107
|
if (var.memadr) {
|
111
|
|
- const uint16_t value = swap16(*(uint16_t*)val_ptr);
|
112
|
|
- DEBUG_ECHOLNPGM("FAN value get:", value);
|
|
108
|
+ const uint16_t value = BE16_P(val_ptr);
|
|
109
|
+ DEBUG_ECHOLNPGM("Got uint8:", value);
|
113
|
110
|
*(uint8_t*)var.memadr = map(constrain(value, 0, 255), 0, 255, 0, 255);
|
114
|
|
- DEBUG_ECHOLNPGM("FAN value change:", *(uint8_t*)var.memadr);
|
|
111
|
+ DEBUG_ECHOLNPGM("Set uint8:", *(uint8_t*)var.memadr);
|
115
|
112
|
}
|
116
|
113
|
}
|
117
|
114
|
|
|
@@ -152,7 +149,7 @@ void DGUSScreenHandlerMKS::DGUSLCD_SendTMCStepValue(DGUS_VP_Variable &var) {
|
152
|
149
|
#if ENABLED(SDSUPPORT)
|
153
|
150
|
|
154
|
151
|
void DGUSScreenHandler::DGUSLCD_SD_FileSelected(DGUS_VP_Variable &var, void *val_ptr) {
|
155
|
|
- uint16_t touched_nr = (int16_t)swap16(*(uint16_t*)val_ptr) + top_file;
|
|
152
|
+ uint16_t touched_nr = (int16_t)BE16_P(val_ptr) + top_file;
|
156
|
153
|
if (touched_nr != 0x0F && touched_nr > filelist.count()) return;
|
157
|
154
|
if (!filelist.seek(touched_nr) && touched_nr != 0x0F) return;
|
158
|
155
|
|
|
@@ -191,7 +188,7 @@ void DGUSScreenHandlerMKS::DGUSLCD_SendTMCStepValue(DGUS_VP_Variable &var) {
|
191
|
188
|
void DGUSScreenHandler::DGUSLCD_SD_ResumePauseAbort(DGUS_VP_Variable &var, void *val_ptr) {
|
192
|
189
|
|
193
|
190
|
if (!ExtUI::isPrintingFromMedia()) return; // avoid race condition when user stays in this menu and printer finishes.
|
194
|
|
- switch (swap16(*(uint16_t*)val_ptr)) {
|
|
191
|
+ switch (BE16_P(val_ptr)) {
|
195
|
192
|
case 0: { // Resume
|
196
|
193
|
auto cs = getCurrentScreen();
|
197
|
194
|
if (runout_mks.runout_status != RUNOUT_WAITING_STATUS && runout_mks.runout_status != UNRUNOUT_STATUS) {
|
|
@@ -268,7 +265,7 @@ void DGUSScreenHandlerMKS::DGUSLCD_SendTMCStepValue(DGUS_VP_Variable &var) {
|
268
|
265
|
|
269
|
266
|
#else
|
270
|
267
|
void DGUSScreenHandlerMKS::PrintReturn(DGUS_VP_Variable& var, void *val_ptr) {
|
271
|
|
- uint16_t value = swap16(*(uint16_t*)val_ptr);
|
|
268
|
+ const uint16_t value = BE16_P(val_ptr);
|
272
|
269
|
if (value == 0x0F) GotoScreen(DGUSLCD_SCREEN_MAIN);
|
273
|
270
|
}
|
274
|
271
|
#endif // SDSUPPORT
|
|
@@ -315,7 +312,7 @@ void DGUSScreenHandler::ScreenChangeHook(DGUS_VP_Variable &var, void *val_ptr) {
|
315
|
312
|
}
|
316
|
313
|
|
317
|
314
|
void DGUSScreenHandlerMKS::ScreenBackChange(DGUS_VP_Variable &var, void *val_ptr) {
|
318
|
|
- const uint16_t target = swap16(*(uint16_t *)val_ptr);
|
|
315
|
+ const uint16_t target = BE16_P(val_ptr);
|
319
|
316
|
DEBUG_ECHOLNPGM(" back = 0x%x", target);
|
320
|
317
|
switch (target) {
|
321
|
318
|
}
|
|
@@ -331,7 +328,7 @@ void DGUSScreenHandlerMKS::ZoffsetConfirm(DGUS_VP_Variable &var, void *val_ptr)
|
331
|
328
|
|
332
|
329
|
void DGUSScreenHandlerMKS::GetTurnOffCtrl(DGUS_VP_Variable &var, void *val_ptr) {
|
333
|
330
|
DEBUG_ECHOLNPGM("GetTurnOffCtrl\n");
|
334
|
|
- const uint16_t value = swap16(*(uint16_t *)val_ptr);
|
|
331
|
+ const uint16_t value = BE16_P(val_ptr);
|
335
|
332
|
switch (value) {
|
336
|
333
|
case 0 ... 1: DGUSAutoTurnOff = (bool)value; break;
|
337
|
334
|
default: break;
|
|
@@ -340,7 +337,7 @@ void DGUSScreenHandlerMKS::GetTurnOffCtrl(DGUS_VP_Variable &var, void *val_ptr)
|
340
|
337
|
|
341
|
338
|
void DGUSScreenHandlerMKS::GetMinExtrudeTemp(DGUS_VP_Variable &var, void *val_ptr) {
|
342
|
339
|
DEBUG_ECHOLNPGM("GetMinExtrudeTemp");
|
343
|
|
- const uint16_t value = swap16(*(uint16_t *)val_ptr);
|
|
340
|
+ const uint16_t value = BE16_P(val_ptr);
|
344
|
341
|
TERN_(PREVENT_COLD_EXTRUSION, thermalManager.extrude_min_temp = value);
|
345
|
342
|
mks_min_extrusion_temp = value;
|
346
|
343
|
settings.save();
|
|
@@ -348,7 +345,7 @@ void DGUSScreenHandlerMKS::GetMinExtrudeTemp(DGUS_VP_Variable &var, void *val_pt
|
348
|
345
|
|
349
|
346
|
void DGUSScreenHandlerMKS::GetZoffsetDistance(DGUS_VP_Variable &var, void *val_ptr) {
|
350
|
347
|
DEBUG_ECHOLNPGM("GetZoffsetDistance");
|
351
|
|
- const uint16_t value = swap16(*(uint16_t *)val_ptr);
|
|
348
|
+ const uint16_t value = BE16_P(val_ptr);
|
352
|
349
|
float val_distance = 0;
|
353
|
350
|
switch (value) {
|
354
|
351
|
case 0: val_distance = 0.01; break;
|
|
@@ -362,11 +359,11 @@ void DGUSScreenHandlerMKS::GetZoffsetDistance(DGUS_VP_Variable &var, void *val_p
|
362
|
359
|
|
363
|
360
|
void DGUSScreenHandlerMKS::GetManualMovestep(DGUS_VP_Variable &var, void *val_ptr) {
|
364
|
361
|
DEBUG_ECHOLNPGM("\nGetManualMovestep");
|
365
|
|
- *(uint16_t *)var.memadr = swap16(*(uint16_t *)val_ptr);
|
|
362
|
+ *(uint16_t *)var.memadr = BE16_P(val_ptr);
|
366
|
363
|
}
|
367
|
364
|
|
368
|
365
|
void DGUSScreenHandlerMKS::EEPROM_CTRL(DGUS_VP_Variable &var, void *val_ptr) {
|
369
|
|
- const uint16_t eep_flag = swap16(*(uint16_t *)val_ptr);
|
|
366
|
+ const uint16_t eep_flag = BE16_P(val_ptr);
|
370
|
367
|
switch (eep_flag) {
|
371
|
368
|
case 0:
|
372
|
369
|
settings.save();
|
|
@@ -384,7 +381,7 @@ void DGUSScreenHandlerMKS::EEPROM_CTRL(DGUS_VP_Variable &var, void *val_ptr) {
|
384
|
381
|
}
|
385
|
382
|
|
386
|
383
|
void DGUSScreenHandlerMKS::Z_offset_select(DGUS_VP_Variable &var, void *val_ptr) {
|
387
|
|
- const uint16_t z_value = swap16(*(uint16_t *)val_ptr);
|
|
384
|
+ const uint16_t z_value = BE16_P(val_ptr);
|
388
|
385
|
switch (z_value) {
|
389
|
386
|
case 0: Z_distance = 0.01; break;
|
390
|
387
|
case 1: Z_distance = 0.1; break;
|
|
@@ -396,22 +393,22 @@ void DGUSScreenHandlerMKS::Z_offset_select(DGUS_VP_Variable &var, void *val_ptr)
|
396
|
393
|
void DGUSScreenHandlerMKS::GetOffsetValue(DGUS_VP_Variable &var, void *val_ptr) {
|
397
|
394
|
|
398
|
395
|
#if HAS_BED_PROBE
|
399
|
|
- int32_t value = swap32(*(int32_t *)val_ptr);
|
400
|
|
- float Offset = value / 100.0f;
|
|
396
|
+ const int32_t value = BE32_P(val_ptr);
|
|
397
|
+ const float Offset = value / 100.0f;
|
401
|
398
|
DEBUG_ECHOLNPGM("\nget int6 offset >> ", value, 6);
|
402
|
|
- #endif
|
403
|
399
|
|
404
|
|
- switch (var.VP) {
|
405
|
|
- case VP_OFFSET_X: TERN_(HAS_BED_PROBE, probe.offset.x = Offset); break;
|
406
|
|
- case VP_OFFSET_Y: TERN_(HAS_BED_PROBE, probe.offset.y = Offset); break;
|
407
|
|
- case VP_OFFSET_Z: TERN_(HAS_BED_PROBE, probe.offset.z = Offset); break;
|
408
|
|
- default: break;
|
409
|
|
- }
|
410
|
|
- settings.save();
|
|
400
|
+ switch (var.VP) {
|
|
401
|
+ default: break;
|
|
402
|
+ case VP_OFFSET_X: probe.offset.x = Offset; break;
|
|
403
|
+ case VP_OFFSET_Y: probe.offset.y = Offset; break;
|
|
404
|
+ case VP_OFFSET_Z: probe.offset.z = Offset; break;
|
|
405
|
+ }
|
|
406
|
+ settings.save();
|
|
407
|
+ #endif
|
411
|
408
|
}
|
412
|
409
|
|
413
|
410
|
void DGUSScreenHandlerMKS::LanguageChange(DGUS_VP_Variable &var, void *val_ptr) {
|
414
|
|
- const uint16_t lag_flag = swap16(*(uint16_t *)val_ptr);
|
|
411
|
+ const uint16_t lag_flag = BE16_P(val_ptr);
|
415
|
412
|
switch (lag_flag) {
|
416
|
413
|
case MKS_SimpleChinese:
|
417
|
414
|
DGUS_LanguageDisplay(MKS_SimpleChinese);
|
|
@@ -436,10 +433,10 @@ void DGUSScreenHandlerMKS::LanguageChange(DGUS_VP_Variable &var, void *val_ptr)
|
436
|
433
|
#endif
|
437
|
434
|
|
438
|
435
|
void DGUSScreenHandlerMKS::Level_Ctrl(DGUS_VP_Variable &var, void *val_ptr) {
|
439
|
|
- const uint16_t lev_but = swap16(*(uint16_t *)val_ptr);
|
440
|
436
|
#if ENABLED(MESH_BED_LEVELING)
|
441
|
437
|
auto cs = getCurrentScreen();
|
442
|
438
|
#endif
|
|
439
|
+ const uint16_t lev_but = BE16_P(val_ptr);
|
443
|
440
|
switch (lev_but) {
|
444
|
441
|
case 0:
|
445
|
442
|
#if ENABLED(AUTO_BED_LEVELING_BILINEAR)
|
|
@@ -483,7 +480,7 @@ void DGUSScreenHandlerMKS::Level_Ctrl(DGUS_VP_Variable &var, void *val_ptr) {
|
483
|
480
|
}
|
484
|
481
|
|
485
|
482
|
void DGUSScreenHandlerMKS::MeshLevelDistanceConfig(DGUS_VP_Variable &var, void *val_ptr) {
|
486
|
|
- const uint16_t mesh_dist = swap16(*(uint16_t *)val_ptr);
|
|
483
|
+ const uint16_t mesh_dist = BE16_P(val_ptr);
|
487
|
484
|
switch (mesh_dist) {
|
488
|
485
|
case 0: mesh_adj_distance = 0.01; break;
|
489
|
486
|
case 1: mesh_adj_distance = 0.1; break;
|
|
@@ -494,7 +491,7 @@ void DGUSScreenHandlerMKS::MeshLevelDistanceConfig(DGUS_VP_Variable &var, void *
|
494
|
491
|
|
495
|
492
|
void DGUSScreenHandlerMKS::MeshLevel(DGUS_VP_Variable &var, void *val_ptr) {
|
496
|
493
|
#if ENABLED(MESH_BED_LEVELING)
|
497
|
|
- const uint16_t mesh_value = swap16(*(uint16_t *)val_ptr);
|
|
494
|
+ const uint16_t mesh_value = BE16_P(val_ptr);
|
498
|
495
|
// static uint8_t a_first_level = 1;
|
499
|
496
|
char cmd_buf[30];
|
500
|
497
|
float offset = mesh_adj_distance;
|
|
@@ -592,8 +589,8 @@ void DGUSScreenHandlerMKS::SD_FileBack(DGUS_VP_Variable&, void*) {
|
592
|
589
|
}
|
593
|
590
|
|
594
|
591
|
void DGUSScreenHandlerMKS::LCD_BLK_Adjust(DGUS_VP_Variable &var, void *val_ptr) {
|
595
|
|
- const uint16_t lcd_value = swap16(*(uint16_t *)val_ptr);
|
596
|
592
|
|
|
593
|
+ const uint16_t lcd_value = BE16_P(val_ptr);
|
597
|
594
|
lcd_default_light = constrain(lcd_value, 10, 100);
|
598
|
595
|
|
599
|
596
|
const uint16_t lcd_data[2] = { lcd_default_light, lcd_default_light };
|
|
@@ -601,7 +598,7 @@ void DGUSScreenHandlerMKS::LCD_BLK_Adjust(DGUS_VP_Variable &var, void *val_ptr)
|
601
|
598
|
}
|
602
|
599
|
|
603
|
600
|
void DGUSScreenHandlerMKS::ManualAssistLeveling(DGUS_VP_Variable &var, void *val_ptr) {
|
604
|
|
- const int16_t point_value = swap16(*(uint16_t *)val_ptr);
|
|
601
|
+ const int16_t point_value = BE16_P(val_ptr);
|
605
|
602
|
|
606
|
603
|
// Insist on leveling first time at this screen
|
607
|
604
|
static bool first_level_flag = false;
|
|
@@ -655,7 +652,7 @@ void DGUSScreenHandlerMKS::ManualAssistLeveling(DGUS_VP_Variable &var, void *val
|
655
|
652
|
#define mks_max(a, b) ((a) > (b)) ? (a) : (b)
|
656
|
653
|
void DGUSScreenHandlerMKS::TMC_ChangeConfig(DGUS_VP_Variable &var, void *val_ptr) {
|
657
|
654
|
#if EITHER(HAS_TRINAMIC_CONFIG, HAS_STEALTHCHOP)
|
658
|
|
- const uint16_t tmc_value = swap16(*(uint16_t*)val_ptr);
|
|
655
|
+ const uint16_t tmc_value = BE16_P(val_ptr);
|
659
|
656
|
#endif
|
660
|
657
|
|
661
|
658
|
switch (var.VP) {
|
|
@@ -748,7 +745,7 @@ void DGUSScreenHandlerMKS::TMC_ChangeConfig(DGUS_VP_Variable &var, void *val_ptr
|
748
|
745
|
void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) {
|
749
|
746
|
DEBUG_ECHOLNPGM("HandleManualMove");
|
750
|
747
|
|
751
|
|
- int16_t movevalue = swap16(*(uint16_t*)val_ptr);
|
|
748
|
+ int16_t movevalue = BE16_P(val_ptr);
|
752
|
749
|
|
753
|
750
|
// Choose Move distance
|
754
|
751
|
if (manualMoveStep == 0x01) manualMoveStep = 10;
|
|
@@ -893,7 +890,7 @@ void DGUSScreenHandler::HandleManualMove(DGUS_VP_Variable &var, void *val_ptr) {
|
893
|
890
|
}
|
894
|
891
|
|
895
|
892
|
void DGUSScreenHandlerMKS::GetParkPos(DGUS_VP_Variable &var, void *val_ptr) {
|
896
|
|
- const int16_t value_pos = swap16(*(int16_t*)val_ptr);
|
|
893
|
+ const int16_t value_pos = BE16_P(val_ptr);
|
897
|
894
|
|
898
|
895
|
switch (var.VP) {
|
899
|
896
|
case VP_X_PARK_POS: mks_park_pos.x = value_pos; break;
|
|
@@ -907,7 +904,7 @@ void DGUSScreenHandlerMKS::GetParkPos(DGUS_VP_Variable &var, void *val_ptr) {
|
907
|
904
|
void DGUSScreenHandlerMKS::HandleChangeLevelPoint(DGUS_VP_Variable &var, void *val_ptr) {
|
908
|
905
|
DEBUG_ECHOLNPGM("HandleChangeLevelPoint");
|
909
|
906
|
|
910
|
|
- const int16_t value_raw = swap16(*(int16_t*)val_ptr);
|
|
907
|
+ const int16_t value_raw = BE16_P(val_ptr);
|
911
|
908
|
DEBUG_ECHOLNPGM("value_raw:", value_raw);
|
912
|
909
|
|
913
|
910
|
*(int16_t*)var.memadr = value_raw;
|
|
@@ -919,7 +916,7 @@ void DGUSScreenHandlerMKS::HandleChangeLevelPoint(DGUS_VP_Variable &var, void *v
|
919
|
916
|
void DGUSScreenHandlerMKS::HandleStepPerMMChanged(DGUS_VP_Variable &var, void *val_ptr) {
|
920
|
917
|
DEBUG_ECHOLNPGM("HandleStepPerMMChanged");
|
921
|
918
|
|
922
|
|
- const uint16_t value_raw = swap16(*(uint16_t*)val_ptr);
|
|
919
|
+ const uint16_t value_raw = BE16_P(val_ptr);
|
923
|
920
|
const float value = (float)value_raw;
|
924
|
921
|
|
925
|
922
|
DEBUG_ECHOLNPGM("value_raw:", value_raw);
|
|
@@ -941,7 +938,7 @@ void DGUSScreenHandlerMKS::HandleStepPerMMChanged(DGUS_VP_Variable &var, void *v
|
941
|
938
|
void DGUSScreenHandlerMKS::HandleStepPerMMExtruderChanged(DGUS_VP_Variable &var, void *val_ptr) {
|
942
|
939
|
DEBUG_ECHOLNPGM("HandleStepPerMMExtruderChanged");
|
943
|
940
|
|
944
|
|
- const uint16_t value_raw = swap16(*(uint16_t*)val_ptr);
|
|
941
|
+ const uint16_t value_raw = BE16_P(val_ptr);
|
945
|
942
|
const float value = (float)value_raw;
|
946
|
943
|
|
947
|
944
|
DEBUG_ECHOLNPGM("value_raw:", value_raw);
|
|
@@ -966,7 +963,7 @@ void DGUSScreenHandlerMKS::HandleStepPerMMExtruderChanged(DGUS_VP_Variable &var,
|
966
|
963
|
void DGUSScreenHandlerMKS::HandleMaxSpeedChange(DGUS_VP_Variable &var, void *val_ptr) {
|
967
|
964
|
DEBUG_ECHOLNPGM("HandleMaxSpeedChange");
|
968
|
965
|
|
969
|
|
- const uint16_t value_raw = swap16(*(uint16_t*)val_ptr);
|
|
966
|
+ const uint16_t value_raw = BE16_P(val_ptr);
|
970
|
967
|
const float value = (float)value_raw;
|
971
|
968
|
|
972
|
969
|
DEBUG_ECHOLNPGM("value_raw:", value_raw);
|
|
@@ -988,7 +985,7 @@ void DGUSScreenHandlerMKS::HandleMaxSpeedChange(DGUS_VP_Variable &var, void *val
|
988
|
985
|
void DGUSScreenHandlerMKS::HandleExtruderMaxSpeedChange(DGUS_VP_Variable &var, void *val_ptr) {
|
989
|
986
|
DEBUG_ECHOLNPGM("HandleExtruderMaxSpeedChange");
|
990
|
987
|
|
991
|
|
- const uint16_t value_raw = swap16(*(uint16_t*)val_ptr);
|
|
988
|
+ const uint16_t value_raw = BE16_P(val_ptr);
|
992
|
989
|
const float value = (float)value_raw;
|
993
|
990
|
|
994
|
991
|
DEBUG_ECHOLNPGM("value_raw:", value_raw);
|
|
@@ -1013,7 +1010,7 @@ void DGUSScreenHandlerMKS::HandleExtruderMaxSpeedChange(DGUS_VP_Variable &var, v
|
1013
|
1010
|
void DGUSScreenHandlerMKS::HandleMaxAccChange(DGUS_VP_Variable &var, void *val_ptr) {
|
1014
|
1011
|
DEBUG_ECHOLNPGM("HandleMaxAccChange");
|
1015
|
1012
|
|
1016
|
|
- const uint16_t value_raw = swap16(*(uint16_t*)val_ptr);
|
|
1013
|
+ const uint16_t value_raw = BE16_P(val_ptr);
|
1017
|
1014
|
const float value = (float)value_raw;
|
1018
|
1015
|
|
1019
|
1016
|
DEBUG_ECHOLNPGM("value_raw:", value_raw);
|
|
@@ -1035,7 +1032,7 @@ void DGUSScreenHandlerMKS::HandleMaxAccChange(DGUS_VP_Variable &var, void *val_p
|
1035
|
1032
|
void DGUSScreenHandlerMKS::HandleExtruderAccChange(DGUS_VP_Variable &var, void *val_ptr) {
|
1036
|
1033
|
DEBUG_ECHOLNPGM("HandleExtruderAccChange");
|
1037
|
1034
|
|
1038
|
|
- uint16_t value_raw = swap16(*(uint16_t*)val_ptr);
|
|
1035
|
+ uint16_t value_raw = BE16_P(val_ptr);
|
1039
|
1036
|
DEBUG_ECHOLNPGM("value_raw:", value_raw);
|
1040
|
1037
|
float value = (float)value_raw;
|
1041
|
1038
|
ExtUI::extruder_t extruder;
|
|
@@ -1056,32 +1053,32 @@ void DGUSScreenHandlerMKS::HandleExtruderAccChange(DGUS_VP_Variable &var, void *
|
1056
|
1053
|
}
|
1057
|
1054
|
|
1058
|
1055
|
void DGUSScreenHandlerMKS::HandleTravelAccChange(DGUS_VP_Variable &var, void *val_ptr) {
|
1059
|
|
- uint16_t value_travel = swap16(*(uint16_t*)val_ptr);
|
|
1056
|
+ uint16_t value_travel = BE16_P(val_ptr);
|
1060
|
1057
|
planner.settings.travel_acceleration = (float)value_travel;
|
1061
|
1058
|
skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel
|
1062
|
1059
|
}
|
1063
|
1060
|
|
1064
|
1061
|
void DGUSScreenHandlerMKS::HandleFeedRateMinChange(DGUS_VP_Variable &var, void *val_ptr) {
|
1065
|
|
- uint16_t value_t = swap16(*(uint16_t*)val_ptr);
|
|
1062
|
+ uint16_t value_t = BE16_P(val_ptr);
|
1066
|
1063
|
planner.settings.min_feedrate_mm_s = (float)value_t;
|
1067
|
1064
|
skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel
|
1068
|
1065
|
}
|
1069
|
1066
|
|
1070
|
1067
|
void DGUSScreenHandlerMKS::HandleMin_T_F(DGUS_VP_Variable &var, void *val_ptr) {
|
1071
|
|
- uint16_t value_t_f = swap16(*(uint16_t*)val_ptr);
|
|
1068
|
+ uint16_t value_t_f = BE16_P(val_ptr);
|
1072
|
1069
|
planner.settings.min_travel_feedrate_mm_s = (float)value_t_f;
|
1073
|
1070
|
skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel
|
1074
|
1071
|
}
|
1075
|
1072
|
|
1076
|
1073
|
void DGUSScreenHandlerMKS::HandleAccChange(DGUS_VP_Variable &var, void *val_ptr) {
|
1077
|
|
- uint16_t value_acc = swap16(*(uint16_t*)val_ptr);
|
|
1074
|
+ uint16_t value_acc = BE16_P(val_ptr);
|
1078
|
1075
|
planner.settings.acceleration = (float)value_acc;
|
1079
|
1076
|
skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel
|
1080
|
1077
|
}
|
1081
|
1078
|
|
1082
|
1079
|
#if ENABLED(PREVENT_COLD_EXTRUSION)
|
1083
|
1080
|
void DGUSScreenHandlerMKS::HandleGetExMinTemp(DGUS_VP_Variable &var, void *val_ptr) {
|
1084
|
|
- const uint16_t value_ex_min_temp = swap16(*(uint16_t*)val_ptr);
|
|
1081
|
+ const uint16_t value_ex_min_temp = BE16_P(val_ptr);
|
1085
|
1082
|
thermalManager.extrude_min_temp = value_ex_min_temp;
|
1086
|
1083
|
skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel
|
1087
|
1084
|
}
|
|
@@ -1089,7 +1086,7 @@ void DGUSScreenHandlerMKS::HandleAccChange(DGUS_VP_Variable &var, void *val_ptr)
|
1089
|
1086
|
|
1090
|
1087
|
#if HAS_PID_HEATING
|
1091
|
1088
|
void DGUSScreenHandler::HandleTemperaturePIDChanged(DGUS_VP_Variable &var, void *val_ptr) {
|
1092
|
|
- const uint16_t rawvalue = swap16(*(uint16_t*)val_ptr);
|
|
1089
|
+ const uint16_t rawvalue = BE16_P(val_ptr);
|
1093
|
1090
|
DEBUG_ECHOLNPGM("V1:", rawvalue);
|
1094
|
1091
|
const float value = 1.0f * rawvalue;
|
1095
|
1092
|
DEBUG_ECHOLNPGM("V2:", value);
|
|
@@ -1125,9 +1122,9 @@ void DGUSScreenHandlerMKS::HandleAccChange(DGUS_VP_Variable &var, void *val_ptr)
|
1125
|
1122
|
#if ENABLED(BABYSTEPPING)
|
1126
|
1123
|
void DGUSScreenHandler::HandleLiveAdjustZ(DGUS_VP_Variable &var, void *val_ptr) {
|
1127
|
1124
|
DEBUG_ECHOLNPGM("HandleLiveAdjustZ");
|
1128
|
|
- float step = ZOffset_distance;
|
|
1125
|
+ const float step = ZOffset_distance;
|
1129
|
1126
|
|
1130
|
|
- uint16_t flag = swap16(*(uint16_t*)val_ptr);
|
|
1127
|
+ const uint16_t flag = BE16_P(val_ptr);
|
1131
|
1128
|
switch (flag) {
|
1132
|
1129
|
case 0:
|
1133
|
1130
|
if (step == 0.01)
|
|
@@ -1159,34 +1156,26 @@ void DGUSScreenHandlerMKS::HandleAccChange(DGUS_VP_Variable &var, void *val_ptr)
|
1159
|
1156
|
z_offset_add += ZOffset_distance;
|
1160
|
1157
|
break;
|
1161
|
1158
|
|
1162
|
|
- default:
|
1163
|
|
- break;
|
|
1159
|
+ default: break;
|
1164
|
1160
|
}
|
1165
|
1161
|
ForceCompleteUpdate();
|
1166
|
1162
|
}
|
1167
|
1163
|
#endif // BABYSTEPPING
|
1168
|
1164
|
|
1169
|
1165
|
void DGUSScreenHandlerMKS::GetManualFilament(DGUS_VP_Variable &var, void *val_ptr) {
|
1170
|
|
- DEBUG_ECHOLNPGM("GetManualFilament");
|
1171
|
|
-
|
1172
|
|
- uint16_t value_len = swap16(*(uint16_t*)val_ptr);
|
|
1166
|
+ const uint16_t value_len = BE16_P(val_ptr);
|
|
1167
|
+ const float value = (float)value_len;
|
1173
|
1168
|
|
1174
|
|
- float value = (float)value_len;
|
1175
|
|
-
|
1176
|
|
- DEBUG_ECHOLNPGM("Get Filament len value:", value);
|
|
1169
|
+ DEBUG_ECHOLNPGM("GetManualFilament:", value);
|
1177
|
1170
|
distanceFilament = value;
|
1178
|
1171
|
|
1179
|
1172
|
skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel
|
1180
|
1173
|
}
|
1181
|
1174
|
|
1182
|
1175
|
void DGUSScreenHandlerMKS::GetManualFilamentSpeed(DGUS_VP_Variable &var, void *val_ptr) {
|
1183
|
|
- DEBUG_ECHOLNPGM("GetManualFilamentSpeed");
|
1184
|
|
-
|
1185
|
|
- uint16_t value_len = swap16(*(uint16_t*)val_ptr);
|
1186
|
|
-
|
1187
|
|
- DEBUG_ECHOLNPGM("filamentSpeed_mm_s value:", value_len);
|
1188
|
|
-
|
|
1176
|
+ const uint16_t value_len = BE16_P(val_ptr);
|
1189
|
1177
|
filamentSpeed_mm_s = value_len;
|
|
1178
|
+ DEBUG_ECHOLNPGM("GetManualFilamentSpeed:", value_len);
|
1190
|
1179
|
|
1191
|
1180
|
skipVP = var.VP; // don't overwrite value the next update time as the display might autoincrement in parallel
|
1192
|
1181
|
}
|
|
@@ -1205,7 +1194,7 @@ void DGUSScreenHandlerMKS::FilamentLoadUnload(DGUS_VP_Variable &var, void *val_p
|
1205
|
1194
|
if (!print_job_timer.isPaused() && !queue.ring_buffer.empty())
|
1206
|
1195
|
return;
|
1207
|
1196
|
|
1208
|
|
- const uint16_t val_t = swap16(*(uint16_t*)val_ptr);
|
|
1197
|
+ const uint16_t val_t = BE16_P(val_ptr);
|
1209
|
1198
|
switch (val_t) {
|
1210
|
1199
|
default: break;
|
1211
|
1200
|
case 0:
|
|
@@ -1291,7 +1280,7 @@ void DGUSScreenHandlerMKS::FilamentUnLoad(DGUS_VP_Variable &var, void *val_ptr)
|
1291
|
1280
|
|
1292
|
1281
|
uint8_t e_temp = 0;
|
1293
|
1282
|
filament_data.heated = false;
|
1294
|
|
- uint16_t preheat_option = swap16(*(uint16_t*)val_ptr);
|
|
1283
|
+ uint16_t preheat_option = BE16_P(val_ptr);
|
1295
|
1284
|
if (preheat_option >= 10) { // Unload filament type
|
1296
|
1285
|
preheat_option -= 10;
|
1297
|
1286
|
filament_data.action = 2;
|