Scott Lahteine 3 лет назад
Родитель
Сommit
58f0330d3f

+ 3
- 3
Marlin/src/lcd/HD44780/marlinui_HD44780.cpp Просмотреть файл

@@ -571,9 +571,9 @@ FORCE_INLINE void _draw_bed_status(const bool blink) {
571 571
 #if ENABLED(LCD_PROGRESS_BAR)
572 572
 
573 573
   void MarlinUI::draw_progress_bar(const uint8_t percent) {
574
-    const int16_t tix = (int16_t)(percent * (LCD_WIDTH) * 3) / 100,
575
-              cel = tix / 3,
576
-              rem = tix % 3;
574
+    const int16_t tix = int16_t(percent * (LCD_WIDTH) * 3) / 100,
575
+                  cel = tix / 3,
576
+                  rem = tix % 3;
577 577
     uint8_t i = LCD_WIDTH;
578 578
     char msg[LCD_WIDTH + 1], b = ' ';
579 579
     msg[LCD_WIDTH] = '\0';

+ 32
- 40
Marlin/src/lcd/dwin/e3v2/dwin.cpp Просмотреть файл

@@ -102,19 +102,11 @@
102 102
 #define DWIN_FONT_HEAD font10x20
103 103
 
104 104
 #define MENU_CHAR_LIMIT  24
105
-#define STATUS_Y 360
106
-
107
-// Fan speed limit
108
-#define FANON           255
109
-#define FANOFF          0
105
+#define STATUS_Y        360
110 106
 
111 107
 // Print speed limit
112
-#define MAX_PRINT_SPEED   999
113
-#define MIN_PRINT_SPEED   10
114
-
115
-#if HAS_HEATED_BED
116
-  #define MIN_BED_TEMP  BED_MINTEMP
117
-#endif
108
+#define MIN_PRINT_SPEED  10
109
+#define MAX_PRINT_SPEED 999
118 110
 
119 111
 // Feedspeed limit (max feedspeed = DEFAULT_MAX_FEEDRATE * 2)
120 112
 #define MIN_MAXFEEDSPEED      1
@@ -883,11 +875,11 @@ void Draw_Tune_Menu() {
883 875
 
884 876
   #if HAS_HOTEND
885 877
     Draw_Menu_Line(TUNE_CASE_TEMP, ICON_HotendTemp);
886
-    DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 216, MBASE(TUNE_CASE_TEMP), thermalManager.temp_hotend[0].target);
878
+    DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 216, MBASE(TUNE_CASE_TEMP), thermalManager.degTargetHotend(0));
887 879
   #endif
888 880
   #if HAS_HEATED_BED
889 881
     Draw_Menu_Line(TUNE_CASE_BED, ICON_BedTemp);
890
-    DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 216, MBASE(TUNE_CASE_BED), thermalManager.temp_bed.target);
882
+    DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 216, MBASE(TUNE_CASE_BED), thermalManager.degTargetBed());
891 883
   #endif
892 884
   #if HAS_FAN
893 885
     Draw_Menu_Line(TUNE_CASE_FAN, ICON_FanSpeed);
@@ -1394,7 +1386,7 @@ void HMI_Move_Z() {
1394 1386
         return;
1395 1387
       }
1396 1388
       // Bed_Temp limit
1397
-      LIMIT(HMI_ValueStruct.Bed_Temp, MIN_BED_TEMP, BED_MAX_TARGET);
1389
+      LIMIT(HMI_ValueStruct.Bed_Temp, BED_MINTEMP, BED_MAX_TARGET);
1398 1390
       // Bed_Temp value
1399 1391
       DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Select_Color, 3, 216, MBASE(bed_line), HMI_ValueStruct.Bed_Temp);
1400 1392
     }
@@ -1438,7 +1430,7 @@ void HMI_Move_Z() {
1438 1430
         return;
1439 1431
       }
1440 1432
       // Fan_speed limit
1441
-      LIMIT(HMI_ValueStruct.Fan_speed, FANOFF, FANON);
1433
+      LIMIT(HMI_ValueStruct.Fan_speed, 0, 255);
1442 1434
       // Fan_speed value
1443 1435
       DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Select_Color, 3, 216, MBASE(fan_line), HMI_ValueStruct.Fan_speed);
1444 1436
     }
@@ -1882,9 +1874,9 @@ void Draw_Status_Area(const bool with_update) {
1882 1874
 
1883 1875
   #if HAS_HOTEND
1884 1876
     DWIN_ICON_Show(ICON, ICON_HotendTemp, 10, 383);
1885
-    DWIN_Draw_IntValue(true, true, 0, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 3, 28, 384, thermalManager.temp_hotend[0].celsius);
1877
+    DWIN_Draw_IntValue(true, true, 0, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 3, 28, 384, thermalManager.degHotend(0));
1886 1878
     DWIN_Draw_String(false, false, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 25 + 3 * STAT_CHR_W + 5, 384, F("/"));
1887
-    DWIN_Draw_IntValue(true, true, 0, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 3, 25 + 4 * STAT_CHR_W + 6, 384, thermalManager.temp_hotend[0].target);
1879
+    DWIN_Draw_IntValue(true, true, 0, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 3, 25 + 4 * STAT_CHR_W + 6, 384, thermalManager.degTargetHotend(0));
1888 1880
 
1889 1881
     DWIN_ICON_Show(ICON, ICON_StepE, 112, 417);
1890 1882
     DWIN_Draw_IntValue(true, true, 0, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 3, 116 + 2 * STAT_CHR_W, 417, planner.flow_percentage[0]);
@@ -1893,9 +1885,9 @@ void Draw_Status_Area(const bool with_update) {
1893 1885
 
1894 1886
   #if HAS_HEATED_BED
1895 1887
     DWIN_ICON_Show(ICON, ICON_BedTemp, 10, 416);
1896
-    DWIN_Draw_IntValue(true, true, 0, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 3, 28, 417, thermalManager.temp_bed.celsius);
1888
+    DWIN_Draw_IntValue(true, true, 0, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 3, 28, 417, thermalManager.degBed());
1897 1889
     DWIN_Draw_String(false, false, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 25 + 3 * STAT_CHR_W + 5, 417, F("/"));
1898
-    DWIN_Draw_IntValue(true, true, 0, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 3, 25 + 4 * STAT_CHR_W + 6, 417, thermalManager.temp_bed.target);
1890
+    DWIN_Draw_IntValue(true, true, 0, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 3, 25 + 4 * STAT_CHR_W + 6, 417, thermalManager.degTargetBed());
1899 1891
   #endif
1900 1892
 
1901 1893
   DWIN_ICON_Show(ICON, ICON_Speed, 113, 383);
@@ -2157,8 +2149,8 @@ void HMI_SelectFile() {
2157 2149
       #if FAN_COUNT > 0
2158 2150
         // All fans on for Ender 3 v2 ?
2159 2151
         // The slicer should manage this for us.
2160
-        // for (uint8_t i = 0; i < FAN_COUNT; i++)
2161
-        //  thermalManager.fan_speed[i] = FANON;
2152
+        //for (uint8_t i = 0; i < FAN_COUNT; i++)
2153
+        //  thermalManager.fan_speed[i] = 255;
2162 2154
       #endif
2163 2155
 
2164 2156
       Goto_PrintProcess();
@@ -2539,11 +2531,11 @@ void Draw_Temperature_Menu() {
2539 2531
   #define _TMENU_ICON(N) Draw_Menu_Line(++i, ICON_SetEndTemp + (N) - 1)
2540 2532
   #if HAS_HOTEND
2541 2533
     _TMENU_ICON(TEMP_CASE_TEMP);
2542
-    DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 216, MBASE(i), thermalManager.temp_hotend[0].target);
2534
+    DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 216, MBASE(i), thermalManager.degTargetHotend(0));
2543 2535
   #endif
2544 2536
   #if HAS_HEATED_BED
2545 2537
     _TMENU_ICON(TEMP_CASE_BED);
2546
-    DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 216, MBASE(i), thermalManager.temp_bed.target);
2538
+    DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 216, MBASE(i), thermalManager.degTargetBed());
2547 2539
   #endif
2548 2540
   #if HAS_FAN
2549 2541
     _TMENU_ICON(TEMP_CASE_FAN);
@@ -2711,7 +2703,7 @@ void HMI_AxisMove() {
2711 2703
           case 4: // Extruder
2712 2704
             // window tips
2713 2705
             #ifdef PREVENT_COLD_EXTRUSION
2714
-              if (thermalManager.temp_hotend[0].celsius < EXTRUDE_MINTEMP) {
2706
+              if (thermalManager.degHotend(0) < EXTRUDE_MINTEMP) {
2715 2707
                 HMI_flag.ETempTooLow_flag = true;
2716 2708
                 Popup_Window_ETempTooLow();
2717 2709
                 DWIN_UpdateLCD();
@@ -2752,16 +2744,16 @@ void HMI_Temperature() {
2752 2744
       #if HAS_HOTEND
2753 2745
         case TEMP_CASE_TEMP: // Nozzle temperature
2754 2746
           checkkey = ETemp;
2755
-          HMI_ValueStruct.E_Temp = thermalManager.temp_hotend[0].target;
2756
-          DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Select_Color, 3, 216, MBASE(1), thermalManager.temp_hotend[0].target);
2747
+          HMI_ValueStruct.E_Temp = thermalManager.degTargetHotend(0);
2748
+          DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Select_Color, 3, 216, MBASE(1), HMI_ValueStruct.E_Temp);
2757 2749
           EncoderRate.enabled = true;
2758 2750
           break;
2759 2751
       #endif
2760 2752
       #if HAS_HEATED_BED
2761 2753
         case TEMP_CASE_BED: // Bed temperature
2762 2754
           checkkey = BedTemp;
2763
-          HMI_ValueStruct.Bed_Temp = thermalManager.temp_bed.target;
2764
-          DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Select_Color, 3, 216, MBASE(2), thermalManager.temp_bed.target);
2755
+          HMI_ValueStruct.Bed_Temp = thermalManager.degTargetBed();
2756
+          DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Select_Color, 3, 216, MBASE(2), HMI_ValueStruct.Bed_Temp);
2765 2757
           EncoderRate.enabled = true;
2766 2758
           break;
2767 2759
       #endif
@@ -2769,7 +2761,7 @@ void HMI_Temperature() {
2769 2761
         case TEMP_CASE_FAN: // Fan speed
2770 2762
           checkkey = FanSpeed;
2771 2763
           HMI_ValueStruct.Fan_speed = thermalManager.fan_speed[0];
2772
-          DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Select_Color, 3, 216, MBASE(3), thermalManager.fan_speed[0]);
2764
+          DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Select_Color, 3, 216, MBASE(3), HMI_ValueStruct.Fan_speed);
2773 2765
           EncoderRate.enabled = true;
2774 2766
           break;
2775 2767
       #endif
@@ -2801,7 +2793,7 @@ void HMI_Temperature() {
2801 2793
             #ifdef USE_STRING_HEADINGS
2802 2794
               Draw_Title("PLA Settings"); // TODO: GET_TEXT_F
2803 2795
             #else
2804
-              DWIN_Frame_TitleCopy(1, 56, 16, 141, 28);                                             // "PLA Settings"
2796
+              DWIN_Frame_TitleCopy(1, 56, 16, 141, 28);                                       // "PLA Settings"
2805 2797
             #endif
2806 2798
             #ifdef USE_STRING_TITLES
2807 2799
               DWIN_Draw_Label(MBASE(PREHEAT_CASE_TEMP), F("Nozzle Temp"));
@@ -2817,7 +2809,7 @@ void HMI_Temperature() {
2817 2809
             #else
2818 2810
               DWIN_Frame_AreaCopy(1, 157, 76, 181, 86, LBLX, MBASE(PREHEAT_CASE_TEMP));
2819 2811
               DWIN_Frame_AreaCopy(1, 197, 104, 238, 114, LBLX + 27, MBASE(PREHEAT_CASE_TEMP));
2820
-              DWIN_Frame_AreaCopy(1, 1, 89, 83, 101, LBLX + 71, MBASE(PREHEAT_CASE_TEMP)); // PLA nozzle temp
2812
+              DWIN_Frame_AreaCopy(1, 1, 89, 83, 101, LBLX + 71, MBASE(PREHEAT_CASE_TEMP));      // PLA nozzle temp
2821 2813
               #if HAS_HEATED_BED
2822 2814
                 DWIN_Frame_AreaCopy(1, 157, 76, 181, 86, LBLX, MBASE(PREHEAT_CASE_BED) + 3);
2823 2815
                 DWIN_Frame_AreaCopy(1, 240, 104, 264, 114, LBLX + 27, MBASE(PREHEAT_CASE_BED) + 3);
@@ -2828,7 +2820,7 @@ void HMI_Temperature() {
2828 2820
                 DWIN_Frame_AreaCopy(1, 0, 119, 64, 132, LBLX + 27, MBASE(PREHEAT_CASE_FAN));    // PLA fan speed
2829 2821
               #endif
2830 2822
               #if ENABLED(EEPROM_SETTINGS)
2831
-                DWIN_Frame_AreaCopy(1, 97, 165, 229, 177, LBLX, MBASE(PREHEAT_CASE_SAVE));          // Save PLA configuration
2823
+                DWIN_Frame_AreaCopy(1, 97, 165, 229, 177, LBLX, MBASE(PREHEAT_CASE_SAVE));      // Save PLA configuration
2832 2824
               #endif
2833 2825
             #endif
2834 2826
           }
@@ -3285,22 +3277,22 @@ void HMI_Tune() {
3285 3277
       case TUNE_CASE_SPEED: // Print speed
3286 3278
         checkkey = PrintSpeed;
3287 3279
         HMI_ValueStruct.print_speed = feedrate_percentage;
3288
-        DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Select_Color, 3, 216, MBASE(TUNE_CASE_SPEED + MROWS - index_tune), feedrate_percentage);
3280
+        DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Select_Color, 3, 216, MBASE(TUNE_CASE_SPEED + MROWS - index_tune), HMI_ValueStruct.print_speed);
3289 3281
         EncoderRate.enabled = true;
3290 3282
         break;
3291 3283
       #if HAS_HOTEND
3292 3284
         case TUNE_CASE_TEMP: // Nozzle temp
3293 3285
           checkkey = ETemp;
3294
-          HMI_ValueStruct.E_Temp = thermalManager.temp_hotend[0].target;
3295
-          DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Select_Color, 3, 216, MBASE(TUNE_CASE_TEMP + MROWS - index_tune), thermalManager.temp_hotend[0].target);
3286
+          HMI_ValueStruct.E_Temp = thermalManager.degTargetHotend(0);
3287
+          DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Select_Color, 3, 216, MBASE(TUNE_CASE_TEMP + MROWS - index_tune), HMI_ValueStruct.E_Temp);
3296 3288
           EncoderRate.enabled = true;
3297 3289
           break;
3298 3290
       #endif
3299 3291
       #if HAS_HEATED_BED
3300 3292
         case TUNE_CASE_BED: // Bed temp
3301 3293
           checkkey = BedTemp;
3302
-          HMI_ValueStruct.Bed_Temp = thermalManager.temp_bed.target;
3303
-          DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Select_Color, 3, 216, MBASE(TUNE_CASE_BED + MROWS - index_tune), thermalManager.temp_bed.target);
3294
+          HMI_ValueStruct.Bed_Temp = thermalManager.degTargetBed();
3295
+          DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Select_Color, 3, 216, MBASE(TUNE_CASE_BED + MROWS - index_tune), HMI_ValueStruct.Bed_Temp);
3304 3296
           EncoderRate.enabled = true;
3305 3297
           break;
3306 3298
       #endif
@@ -3308,7 +3300,7 @@ void HMI_Tune() {
3308 3300
         case TUNE_CASE_FAN: // Fan speed
3309 3301
           checkkey = FanSpeed;
3310 3302
           HMI_ValueStruct.Fan_speed = thermalManager.fan_speed[0];
3311
-          DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Select_Color, 3, 216, MBASE(TUNE_CASE_FAN + MROWS - index_tune), thermalManager.fan_speed[0]);
3303
+          DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Select_Color, 3, 216, MBASE(TUNE_CASE_FAN + MROWS - index_tune), HMI_ValueStruct.Fan_speed);
3312 3304
           EncoderRate.enabled = true;
3313 3305
           break;
3314 3306
       #endif
@@ -3626,8 +3618,8 @@ void EachMomentUpdate() {
3626 3618
   if (HMI_flag.pause_action && printingIsPaused() && !planner.has_blocks_queued()) {
3627 3619
     HMI_flag.pause_action = false;
3628 3620
     #if ENABLED(PAUSE_HEAT)
3629
-      TERN_(HAS_HOTEND, resume_hotend_temp = thermalManager.temp_hotend[0].target);
3630
-      TERN_(HAS_HEATED_BED, resume_bed_temp = thermalManager.temp_bed.target);
3621
+      TERN_(HAS_HOTEND, resume_hotend_temp = thermalManager.degTargetHotend(0));
3622
+      TERN_(HAS_HEATED_BED, resume_bed_temp = thermalManager.degTargetBed());
3631 3623
       thermalManager.disable_all_heaters();
3632 3624
     #endif
3633 3625
     queue.inject_P(PSTR("G1 F1200 X0 Y0"));

+ 6
- 7
Marlin/src/lcd/extui/lib/anycubic_i3mega/anycubic_i3mega_lcd.cpp Просмотреть файл

@@ -560,32 +560,31 @@ void AnycubicTFTClass::GetCommandFromTFT() {
560 560
 
561 561
         switch (a_command) {
562 562
           case 0: { // A0 GET HOTEND TEMP
563
-            float hotendActualTemp = getActualTemp_celsius((extruder_t) (extruder_t) E0);
563
+            const float hotendActualTemp = getActualTemp_celsius(E0);
564 564
             SEND_PGM_VAL("A0V ", int(hotendActualTemp + 0.5));
565 565
           }
566 566
           break;
567 567
 
568 568
           case 1: { // A1  GET HOTEND TARGET TEMP
569
-            float hotendTargetTemp = getTargetTemp_celsius((extruder_t) (extruder_t) E0);
569
+            const float hotendTargetTemp = getTargetTemp_celsius(E0);
570 570
             SEND_PGM_VAL("A1V ", int(hotendTargetTemp + 0.5));
571 571
           }
572 572
           break;
573 573
 
574 574
           case 2: { // A2 GET HOTBED TEMP
575
-            float heatedBedActualTemp = getActualTemp_celsius((heater_t) BED);
575
+            const float heatedBedActualTemp = getActualTemp_celsius(BED);
576 576
             SEND_PGM_VAL("A2V ", int(heatedBedActualTemp + 0.5));
577 577
           }
578 578
           break;
579 579
 
580 580
           case 3: { // A3 GET HOTBED TARGET TEMP
581
-            float heatedBedTargetTemp = getTargetTemp_celsius((heater_t) BED);
581
+            const float heatedBedTargetTemp = getTargetTemp_celsius(BED);
582 582
             SEND_PGM_VAL("A3V ", int(heatedBedTargetTemp + 0.5));
583 583
           } break;
584 584
 
585 585
           case 4: { // A4 GET FAN SPEED
586
-            float fanPercent = getActualFan_percent(FAN0);
587
-            fanPercent = constrain(fanPercent, 0, 100);
588
-            SEND_PGM_VAL("A4V ", int(fanPercent));
586
+            const float fanPercent = getActualFan_percent(FAN0);
587
+            SEND_PGM_VAL("A4V ", int(LIMIT(fanPercent, 0, 100)));
589 588
           } break;
590 589
 
591 590
           case 5: { // A5 GET CURRENT COORDINATE

+ 2
- 2
Marlin/src/lcd/extui/lib/dgus/mks/DGUSDisplayDef.cpp Просмотреть файл

@@ -764,8 +764,8 @@ const struct DGUS_VP_Variable ListOfVP[] PROGMEM = {
764 764
     VPHELPER(VP_SD_AbortPrintConfirmed, nullptr, ScreenHandler.DGUSLCD_SD_ReallyAbort, nullptr),
765 765
     VPHELPER(VP_SD_Print_Setting, nullptr, ScreenHandler.DGUSLCD_SD_PrintTune, nullptr),
766 766
     #if ENABLED(BABYSTEPPING)
767
-      VPHELPER(VP_SD_Print_LiveAdjustZ,nullptr, ScreenHandler.HandleLiveAdjustZ, &ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<2>),
768
-      VPHELPER(VP_ZOffset_DE_DIS,&z_offset_add,nullptr, &ScreenHandler.DGUSLCD_SendFloatAsLongValueToDisplay<2>),
767
+      VPHELPER(VP_SD_Print_LiveAdjustZ, nullptr, ScreenHandler.HandleLiveAdjustZ, &ScreenHandler.DGUSLCD_SendFloatAsIntValueToDisplay<2>),
768
+      VPHELPER(VP_ZOffset_DE_DIS, &z_offset_add, nullptr, &ScreenHandler.DGUSLCD_SendFloatAsLongValueToDisplay<2>),
769 769
     #endif
770 770
     #if HAS_BED_PROBE
771 771
       VPHELPER(VP_OFFSET_X, &probe.offset.x, ScreenHandler.GetOffsetValue,ScreenHandler.DGUSLCD_SendFloatAsLongValueToDisplay<2>),

+ 118
- 207
Marlin/src/lcd/extui/lib/dgus/mks/DGUSScreenHandler.cpp Просмотреть файл

@@ -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() {

+ 1
- 0
Marlin/src/lcd/extui/lib/dgus/mks/DGUSScreenHandler.h Просмотреть файл

@@ -149,6 +149,7 @@ public:
149 149
     // Hook for filament load and unload
150 150
     static void HandleFilamentLoadUnload(DGUS_VP_Variable &var);
151 151
 
152
+    static void MKS_FilamentLoadUnload(DGUS_VP_Variable &var, void *val_ptr, const int filamentDir);
152 153
     static void MKS_FilamentLoad(DGUS_VP_Variable &var, void *val_ptr);
153 154
     static void MKS_FilamentUnLoad(DGUS_VP_Variable &var, void *val_ptr);
154 155
     static void MKS_LOAD_UNLOAD_IDLE();

+ 15
- 14
Marlin/src/lcd/extui/lib/mks_ui/draw_dialog.cpp Просмотреть файл

@@ -514,13 +514,13 @@ void filament_dialog_handle() {
514 514
     queue.inject(public_buf_m);
515 515
   }
516 516
 
517
-  if ( ((abs((int)((int)thermalManager.degHotend(uiCfg.extruderIndex) - gCfgItems.filament_limit_temper)) <= 1)
518
-        || ((int)thermalManager.degHotend(uiCfg.extruderIndex) > gCfgItems.filament_limit_temper))
519
-    && uiCfg.filament_load_heat_flg
520
-  ) {
521
-    uiCfg.filament_load_heat_flg = false;
522
-    lv_clear_dialog();
523
-    lv_draw_dialog(DIALOG_TYPE_FILAMENT_HEAT_LOAD_COMPLETED);
517
+  if (uiCfg.filament_load_heat_flg) {
518
+    const int16_t diff = thermalManager.degHotend(uiCfg.extruderIndex) - gCfgItems.filament_limit_temp;
519
+    if (abs(diff) < 2 || diff > 0) {
520
+      uiCfg.filament_load_heat_flg = false;
521
+      lv_clear_dialog();
522
+      lv_draw_dialog(DIALOG_TYPE_FILAMENT_HEAT_LOAD_COMPLETED);
523
+    }
524 524
   }
525 525
 
526 526
   if (uiCfg.filament_loading_completed) {
@@ -529,13 +529,14 @@ void filament_dialog_handle() {
529 529
     lv_clear_dialog();
530 530
     lv_draw_dialog(DIALOG_TYPE_FILAMENT_LOAD_COMPLETED);
531 531
   }
532
-  if (((abs((int)((int)thermalManager.degHotend(uiCfg.extruderIndex) - gCfgItems.filament_limit_temper)) <= 1)
533
-     || ((int)thermalManager.degHotend(uiCfg.extruderIndex) > gCfgItems.filament_limit_temper))
534
-     && uiCfg.filament_unload_heat_flg
535
-  ) {
536
-    uiCfg.filament_unload_heat_flg = false;
537
-    lv_clear_dialog();
538
-    lv_draw_dialog(DIALOG_TYPE_FILAMENT_HEAT_UNLOAD_COMPLETED);
532
+
533
+  if (uiCfg.filament_unload_heat_flg) {
534
+    const int16_t diff = thermalManager.degHotend(uiCfg.extruderIndex) - gCfgItems.filament_limit_temp;
535
+    if (abs(diff) < 2 || diff > 0) {
536
+      uiCfg.filament_unload_heat_flg = false;
537
+      lv_clear_dialog();
538
+      lv_draw_dialog(DIALOG_TYPE_FILAMENT_HEAT_UNLOAD_COMPLETED);
539
+    }
539 540
   }
540 541
 
541 542
   if (uiCfg.filament_unloading_completed) {

+ 6
- 6
Marlin/src/lcd/extui/lib/mks_ui/draw_filament_change.cpp Просмотреть файл

@@ -51,15 +51,15 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
51 51
     case ID_FILAMNT_IN:
52 52
       uiCfg.filament_load_heat_flg = true;
53 53
       if ((abs(thermalManager.degTargetHotend(uiCfg.extruderIndex) - thermalManager.degHotend(uiCfg.extruderIndex)) <= 1)
54
-          || (gCfgItems.filament_limit_temper <= thermalManager.degHotend(uiCfg.extruderIndex))) {
54
+          || (gCfgItems.filament_limit_temp <= thermalManager.degHotend(uiCfg.extruderIndex))) {
55 55
         lv_clear_filament_change();
56 56
         lv_draw_dialog(DIALOG_TYPE_FILAMENT_HEAT_LOAD_COMPLETED);
57 57
       }
58 58
       else {
59 59
         lv_clear_filament_change();
60 60
         lv_draw_dialog(DIALOG_TYPE_FILAMENT_LOAD_HEAT);
61
-        if (thermalManager.degTargetHotend(uiCfg.extruderIndex) < gCfgItems.filament_limit_temper) {
62
-          thermalManager.setTargetHotend(gCfgItems.filament_limit_temper, uiCfg.extruderIndex);
61
+        if (thermalManager.degTargetHotend(uiCfg.extruderIndex) < gCfgItems.filament_limit_temp) {
62
+          thermalManager.setTargetHotend(gCfgItems.filament_limit_temp, uiCfg.extruderIndex);
63 63
           thermalManager.start_watching_hotend(uiCfg.extruderIndex);
64 64
         }
65 65
       }
@@ -68,7 +68,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
68 68
       uiCfg.filament_unload_heat_flg = true;
69 69
       if (thermalManager.degTargetHotend(uiCfg.extruderIndex)
70 70
           && ((abs((int)((int)thermalManager.degTargetHotend(uiCfg.extruderIndex) - thermalManager.degHotend(uiCfg.extruderIndex))) <= 1)
71
-              || ((int)thermalManager.degHotend(uiCfg.extruderIndex) >= gCfgItems.filament_limit_temper))
71
+              || ((int)thermalManager.degHotend(uiCfg.extruderIndex) >= gCfgItems.filament_limit_temp))
72 72
       ) {
73 73
         lv_clear_filament_change();
74 74
         lv_draw_dialog(DIALOG_TYPE_FILAMENT_HEAT_UNLOAD_COMPLETED);
@@ -76,8 +76,8 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
76 76
       else {
77 77
         lv_clear_filament_change();
78 78
         lv_draw_dialog(DIALOG_TYPE_FILAMENT_UNLOAD_HEAT);
79
-        if (thermalManager.degTargetHotend(uiCfg.extruderIndex) < gCfgItems.filament_limit_temper) {
80
-          thermalManager.setTargetHotend(gCfgItems.filament_limit_temper, uiCfg.extruderIndex);
79
+        if (thermalManager.degTargetHotend(uiCfg.extruderIndex) < gCfgItems.filament_limit_temp) {
80
+          thermalManager.setTargetHotend(gCfgItems.filament_limit_temp, uiCfg.extruderIndex);
81 81
           thermalManager.start_watching_hotend(uiCfg.extruderIndex);
82 82
         }
83 83
         filament_sprayer_temp();

+ 1
- 1
Marlin/src/lcd/extui/lib/mks_ui/draw_filament_settings.cpp Просмотреть файл

@@ -107,7 +107,7 @@ void lv_draw_filament_settings() {
107 107
     lv_big_button_create(scr, "F:/bmp_back70x40.bin", machine_menu.next, PARA_UI_TURN_PAGE_POS_X, PARA_UI_TURN_PAGE_POS_Y, event_handler, ID_FILAMENT_SET_DOWN, true);
108 108
   }
109 109
   else {
110
-    sprintf_P(public_buf_l, PSTR("%d"), gCfgItems.filament_limit_temper);
110
+    sprintf_P(public_buf_l, PSTR("%d"), gCfgItems.filament_limit_temp);
111 111
     lv_screen_menu_item_1_edit(scr, machine_menu.FilamentTemperature, PARA_UI_POS_X, PARA_UI_POS_Y, event_handler, ID_FILAMENT_SET_TEMP, 0, public_buf_l);
112 112
 
113 113
     lv_big_button_create(scr, "F:/bmp_back70x40.bin", machine_menu.previous, PARA_UI_TURN_PAGE_POS_X, PARA_UI_TURN_PAGE_POS_Y, event_handler, ID_FILAMENT_SET_UP, true);

+ 2
- 2
Marlin/src/lcd/extui/lib/mks_ui/draw_number_key.cpp Просмотреть файл

@@ -261,7 +261,7 @@ static void disp_key_value() {
261 261
       sprintf_P(public_buf_m, PSTR("%d"), gCfgItems.filamentchange_unload_speed);
262 262
       break;
263 263
     case filament_temp:
264
-      sprintf_P(public_buf_m, PSTR("%d"), gCfgItems.filament_limit_temper);
264
+      sprintf_P(public_buf_m, PSTR("%d"), gCfgItems.filament_limit_temp);
265 265
       break;
266 266
     case x_sensitivity:
267 267
       #if X_SENSORLESS
@@ -505,7 +505,7 @@ static void set_value_confirm() {
505 505
       update_spi_flash();
506 506
       break;
507 507
     case filament_temp:
508
-      gCfgItems.filament_limit_temper = atoi(key_value);
508
+      gCfgItems.filament_limit_temp = atoi(key_value);
509 509
       update_spi_flash();
510 510
       break;
511 511
     case x_sensitivity:

+ 3
- 3
Marlin/src/lcd/extui/lib/mks_ui/draw_ui.cpp Просмотреть файл

@@ -143,7 +143,7 @@ void gCfgItems_init() {
143 143
   gCfgItems.filamentchange_load_speed    = 1000;
144 144
   gCfgItems.filamentchange_unload_length = 200;
145 145
   gCfgItems.filamentchange_unload_speed  = 1000;
146
-  gCfgItems.filament_limit_temper        = 200;
146
+  gCfgItems.filament_limit_temp          = 200;
147 147
 
148 148
   gCfgItems.encoder_enable = true;
149 149
 
@@ -226,8 +226,8 @@ void ui_cfg_init() {
226 226
     uiCfg.cloud_port = 10086;
227 227
   #endif
228 228
 
229
-  uiCfg.filament_loading_time = (uint32_t)((gCfgItems.filamentchange_load_length * 60.0 / gCfgItems.filamentchange_load_speed) + 0.5);
230
-  uiCfg.filament_unloading_time = (uint32_t)((gCfgItems.filamentchange_unload_length * 60.0 / gCfgItems.filamentchange_unload_speed) + 0.5);
229
+  uiCfg.filament_loading_time = (uint32_t)((gCfgItems.filamentchange_load_length * 60.0f / gCfgItems.filamentchange_load_speed) + 0.5f);
230
+  uiCfg.filament_unloading_time = (uint32_t)((gCfgItems.filamentchange_unload_length * 60.0f / gCfgItems.filamentchange_unload_speed) + 0.5f);
231 231
 }
232 232
 
233 233
 void update_spi_flash() {

+ 21
- 23
Marlin/src/lcd/extui/lib/mks_ui/draw_ui.h Просмотреть файл

@@ -184,29 +184,27 @@ extern char public_buf_m[100];
184 184
 extern char public_buf_l[30];
185 185
 
186 186
 typedef struct {
187
-  uint32_t spi_flash_flag;
188
-  uint8_t disp_rotation_180;
189
-  bool multiple_language;
190
-  uint8_t language;
191
-  uint8_t leveling_mode;
192
-  bool from_flash_pic;
193
-  bool finish_power_off;
194
-  bool pause_reprint;
195
-  uint8_t wifi_mode_sel;
196
-  uint8_t fileSysType;
197
-  uint8_t wifi_type;
198
-  bool  cloud_enable,
199
-        encoder_enable;
200
-  int   levelingPos[5][2];
201
-  int   filamentchange_load_length,
202
-        filamentchange_load_speed,
203
-        filamentchange_unload_length,
204
-        filamentchange_unload_speed,
205
-        filament_limit_temper;
206
-  float pausePosX,
207
-        pausePosY,
208
-        pausePosZ;
209
-  uint32_t curFilesize;
187
+  uint32_t  spi_flash_flag;
188
+  uint8_t   disp_rotation_180;
189
+  bool      multiple_language;
190
+  uint8_t   language;
191
+  uint8_t   leveling_mode;
192
+  bool      from_flash_pic;
193
+  bool      finish_power_off;
194
+  bool      pause_reprint;
195
+  uint8_t   wifi_mode_sel;
196
+  uint8_t   fileSysType;
197
+  uint8_t   wifi_type;
198
+  bool      cloud_enable,
199
+            encoder_enable;
200
+  int       levelingPos[5][2];
201
+  int       filamentchange_load_length,
202
+            filamentchange_load_speed,
203
+            filamentchange_unload_length,
204
+            filamentchange_unload_speed;
205
+  int16_t   filament_limit_temp;
206
+  float     pausePosX, pausePosY, pausePosZ;
207
+  uint32_t  curFilesize;
210 208
 } CFG_ITMES;
211 209
 
212 210
 typedef struct {

Загрузка…
Отмена
Сохранить