瀏覽代碼

MKS H43 fixup (#21267)

Co-authored-by: makerbase <4164049@qq.com>
Co-authored-by: MKS-Sean <56996910+MKS-Sean@users.noreply.github.com>
Co-authored-by: Scott Lahteine <github@thinkyhead.com>
Sola 4 年之前
父節點
當前提交
72cc5a49e6
No account linked to committer's email address

+ 8
- 0
Marlin/src/gcode/queue.cpp 查看文件

611
 }
611
 }
612
 
612
 
613
 /**
613
 /**
614
+ * Run the entire queue in-place. Blocks SD completion/abort until complete.
615
+ */
616
+void GCodeQueue::exhaust() {
617
+  while (ring_buffer.occupied()) advance();
618
+  planner.synchronize();
619
+}
620
+
621
+/**
614
  * Get the next command in the queue, optionally log it to SD, then dispatch it
622
  * Get the next command in the queue, optionally log it to SD, then dispatch it
615
  */
623
  */
616
 void GCodeQueue::advance() {
624
 void GCodeQueue::advance() {

+ 8
- 1
Marlin/src/gcode/queue.h 查看文件

93
 
93
 
94
     inline bool full(uint8_t cmdCount=1) const { return length > (BUFSIZE - cmdCount); }
94
     inline bool full(uint8_t cmdCount=1) const { return length > (BUFSIZE - cmdCount); }
95
 
95
 
96
-    inline bool empty() const { return length == 0; }
96
+    inline bool occupied() const { return length != 0; }
97
+
98
+    inline bool empty() const { return !occupied(); }
97
 
99
 
98
     inline CommandLine& peek_next_command() { return commands[index_r]; }
100
     inline CommandLine& peek_next_command() { return commands[index_r]; }
99
 
101
 
163
   static void advance();
165
   static void advance();
164
 
166
 
165
   /**
167
   /**
168
+   * Run the entire queue in-place
169
+   */
170
+  static void exhaust();
171
+
172
+  /**
166
    * Add to the circular command queue the next command from:
173
    * Add to the circular command queue the next command from:
167
    *  - The command-injection queue (injected_commands_P)
174
    *  - The command-injection queue (injected_commands_P)
168
    *  - The active serial input (usually USB)
175
    *  - The active serial input (usually USB)

+ 6
- 3
Marlin/src/lcd/extui/lib/dgus/DGUSScreenHandler.cpp 查看文件

395
     default: return;
395
     default: return;
396
     #if HOTENDS >= 1
396
     #if HOTENDS >= 1
397
       case VP_T_E0_Set:
397
       case VP_T_E0_Set:
398
+        NOMORE(newvalue, HEATER_0_MAXTEMP);
398
         thermalManager.setTargetHotend(newvalue, 0);
399
         thermalManager.setTargetHotend(newvalue, 0);
399
-        acceptedvalue = thermalManager.temp_hotend[0].target;
400
+        acceptedvalue = thermalManager.degTargetHotend(0);
400
         break;
401
         break;
401
     #endif
402
     #endif
402
     #if HOTENDS >= 2
403
     #if HOTENDS >= 2
403
       case VP_T_E1_Set:
404
       case VP_T_E1_Set:
405
+        NOMORE(newvalue, HEATER_1_MAXTEMP);
404
         thermalManager.setTargetHotend(newvalue, 1);
406
         thermalManager.setTargetHotend(newvalue, 1);
405
-        acceptedvalue = thermalManager.temp_hotend[1].target;
407
+        acceptedvalue = thermalManager.degTargetHotend(1);
406
         break;
408
         break;
407
     #endif
409
     #endif
408
     #if HAS_HEATED_BED
410
     #if HAS_HEATED_BED
409
       case VP_T_Bed_Set:
411
       case VP_T_Bed_Set:
412
+        NOMORE(newvalue, BED_MAXTEMP);
410
         thermalManager.setTargetBed(newvalue);
413
         thermalManager.setTargetBed(newvalue);
411
-        acceptedvalue = thermalManager.temp_bed.target;
414
+        acceptedvalue = thermalManager.degTargetBed();
412
         break;
415
         break;
413
     #endif
416
     #endif
414
   }
417
   }

+ 1
- 1
Marlin/src/lcd/extui/lib/dgus/mks/DGUSDisplayDef.cpp 查看文件

75
 xyz_pos_t position_before_pause;
75
 xyz_pos_t position_before_pause;
76
 
76
 
77
 void MKS_pause_print_move() {
77
 void MKS_pause_print_move() {
78
-  planner.synchronize();
78
+  queue.exhaust();
79
   position_before_pause = current_position;
79
   position_before_pause = current_position;
80
   do_blocking_move_to(X_MIN_POS + x_park_pos, Y_MIN_POS + y_park_pos, current_position.z + z_park_pos);
80
   do_blocking_move_to(X_MIN_POS + x_park_pos, Y_MIN_POS + y_park_pos, current_position.z + z_park_pos);
81
 }
81
 }

+ 3
- 3
Marlin/src/lcd/extui/lib/dgus/mks/DGUSDisplayDef.h 查看文件

23
 
23
 
24
 #include "../DGUSDisplayDef.h"
24
 #include "../DGUSDisplayDef.h"
25
 
25
 
26
-//#define USE_MKS_GREEN_UI
26
+#define USE_MKS_GREEN_UI
27
 //#define DGUS_MKS_RUNOUT_SENSOR
27
 //#define DGUS_MKS_RUNOUT_SENSOR
28
 
28
 
29
-#define LOGO_TIME_DELAY TERN(USE_MKS_GREEN_UI, 5000, 1500)
29
+#define LOGO_TIME_DELAY TERN(USE_MKS_GREEN_UI, 8000, 1500)
30
 
30
 
31
 #if ENABLED(DGUS_MKS_RUNOUT_SENSOR)
31
 #if ENABLED(DGUS_MKS_RUNOUT_SENSOR)
32
   #define MT_DET_1_PIN         1
32
   #define MT_DET_1_PIN         1
178
     MKSLCD_SCREEN_PRINT_CONFIG          =  72,
178
     MKSLCD_SCREEN_PRINT_CONFIG          =  72,
179
     MKSLCD_SCREEN_LEVEL_DATA            = 106,
179
     MKSLCD_SCREEN_LEVEL_DATA            = 106,
180
     MKSLCD_PrintPause_SET               = 107,
180
     MKSLCD_PrintPause_SET               = 107,
181
-    //MKSLCD_FILAMENT_DATA                =  50,
181
+    MKSLCD_FILAMENT_DATA                =  50,
182
     MKSLCD_ABOUT                        =  83,
182
     MKSLCD_ABOUT                        =  83,
183
     MKSLCD_PID                          = 108,
183
     MKSLCD_PID                          = 108,
184
     MKSLCD_PAUSE_SETTING_MOVE           =  98,
184
     MKSLCD_PAUSE_SETTING_MOVE           =  98,

+ 24
- 24
Marlin/src/lcd/extui/lib/dgus/mks/DGUSScreenHandler.cpp 查看文件

39
 #include "../../../../../gcode/gcode.h"
39
 #include "../../../../../gcode/gcode.h"
40
 #include "../../../../../pins/pins.h"
40
 #include "../../../../../pins/pins.h"
41
 #include "../../../../../libs/nozzle.h"
41
 #include "../../../../../libs/nozzle.h"
42
+
42
 #if ENABLED(HAS_STEALTHCHOP)
43
 #if ENABLED(HAS_STEALTHCHOP)
43
   #include "../../../../../module/stepper/trinamic.h"
44
   #include "../../../../../module/stepper/trinamic.h"
44
   #include "../../../../../module/stepper/indirection.h"
45
   #include "../../../../../module/stepper/indirection.h"
60
 uint32_t swap32(const uint32_t value) { return (value & 0x000000FFU) << 24U | (value & 0x0000FF00U) << 8U | (value & 0x00FF0000U) >> 8U | (value & 0xFF000000U) >> 24U; }
61
 uint32_t swap32(const uint32_t value) { return (value & 0x000000FFU) << 24U | (value & 0x0000FF00U) << 8U | (value & 0x00FF0000U) >> 8U | (value & 0xFF000000U) >> 24U; }
61
 
62
 
62
 #if 0
63
 #if 0
63
-
64
 void DGUSScreenHandler::sendinfoscreen_ch_mks(const uint16_t* line1, const uint16_t* line2, const uint16_t* line3, const uint16_t* line4) {
64
 void DGUSScreenHandler::sendinfoscreen_ch_mks(const uint16_t* line1, const uint16_t* line2, const uint16_t* line3, const uint16_t* line4) {
65
   dgusdisplay.WriteVariable(VP_MSGSTR1, line1, 32, true);
65
   dgusdisplay.WriteVariable(VP_MSGSTR1, line1, 32, true);
66
   dgusdisplay.WriteVariable(VP_MSGSTR2, line2, 32, true);
66
   dgusdisplay.WriteVariable(VP_MSGSTR2, line2, 32, true);
264
 
264
 
265
   void DGUSScreenHandler::SDPrintingFinished() {
265
   void DGUSScreenHandler::SDPrintingFinished() {
266
     if (DGUSAutoTurnOff) {
266
     if (DGUSAutoTurnOff) {
267
-      while (!queue.ring_buffer.empty()) queue.advance();
267
+      queue.exhaust();
268
       gcode.process_subcommands_now_P(PSTR("M81"));
268
       gcode.process_subcommands_now_P(PSTR("M81"));
269
     }
269
     }
270
     GotoScreen(MKSLCD_SCREEN_PrintDone);
270
     GotoScreen(MKSLCD_SCREEN_PrintDone);
465
 
465
 
466
         cs = getCurrentScreen();
466
         cs = getCurrentScreen();
467
         if (cs != MKSLCD_AUTO_LEVEL) GotoScreen(MKSLCD_AUTO_LEVEL);
467
         if (cs != MKSLCD_AUTO_LEVEL) GotoScreen(MKSLCD_AUTO_LEVEL);
468
-
469
       #else
468
       #else
470
 
469
 
471
         GotoScreen(MKSLCD_SCREEN_LEVEL);
470
         GotoScreen(MKSLCD_SCREEN_LEVEL);
499
     char cmd_buf[30];
498
     char cmd_buf[30];
500
     float offset = mesh_adj_distance;
499
     float offset = mesh_adj_distance;
501
     int16_t integer, Deci, Deci2;
500
     int16_t integer, Deci, Deci2;
502
-    // float f3 = current_position.z;
503
-    // float f4 = current_position.z;
501
+
502
+    if (!queue.ring_buffer.empty()) return;
503
+
504
     switch (mesh_value) {
504
     switch (mesh_value) {
505
       case 0:
505
       case 0:
506
         offset = mesh_adj_distance;
506
         offset = mesh_adj_distance;
507
         integer = offset; // get int
507
         integer = offset; // get int
508
-        Deci = (offset * 100);
509
-        Deci = Deci % 100;
508
+        Deci = (offset * 10);
509
+        Deci = Deci % 10;
510
         Deci2 = offset * 100;
510
         Deci2 = offset * 100;
511
         Deci2 = Deci2 % 10;
511
         Deci2 = Deci2 % 10;
512
         soft_endstop._enabled = false;
512
         soft_endstop._enabled = false;
520
       case 1:
520
       case 1:
521
         offset = mesh_adj_distance;
521
         offset = mesh_adj_distance;
522
         integer = offset;       // get int
522
         integer = offset;       // get int
523
-        Deci = (offset * 100);
524
-        Deci = Deci % 100;
523
+        Deci = (offset * 10);
524
+        Deci = Deci % 10;
525
         Deci2 = offset * 100;
525
         Deci2 = offset * 100;
526
         Deci2 = Deci2 % 10;
526
         Deci2 = Deci2 % 10;
527
         soft_endstop._enabled = false;
527
         soft_endstop._enabled = false;
589
 
589
 
590
   uint16_t lcd_value = swap16(*(uint16_t *)val_ptr);
590
   uint16_t lcd_value = swap16(*(uint16_t *)val_ptr);
591
 
591
 
592
-  if(lcd_value > 100) lcd_value = 100;
593
-  else if(lcd_value < 10) lcd_value = 10;
592
+  if (lcd_value > 100) lcd_value = 100;
593
+  else if (lcd_value < 10) lcd_value = 10;
594
 
594
 
595
   lcd_default_light = lcd_value;
595
   lcd_default_light = lcd_value;
596
 
596
 
794
 
794
 
795
   DEBUG_ECHOLNPAIR("QUEUE LEN:", queue.length);
795
   DEBUG_ECHOLNPAIR("QUEUE LEN:", queue.length);
796
 
796
 
797
-  if (!print_job_timer.isPaused() && queue.ring_buffer.full(1))
797
+  if (!print_job_timer.isPaused() && !queue.ring_buffer.empty())
798
     return;
798
     return;
799
 
799
 
800
   char axiscode;
800
   char axiscode;
1249
   switch (val_t) {
1249
   switch (val_t) {
1250
     case 0:
1250
     case 0:
1251
       #if HOTENDS >= 1
1251
       #if HOTENDS >= 1
1252
-        if (thermalManager.temp_hotend[0].celsius < thermalManager.extrude_min_temp) {
1253
-          if (thermalManager.temp_hotend[0].target < thermalManager.extrude_min_temp)
1252
+        if (thermalManager.degHotend(0) < thermalManager.extrude_min_temp) {
1253
+          if (thermalManager.degTargetHotend(0) < thermalManager.extrude_min_temp)
1254
             thermalManager.setTargetHotend(thermalManager.extrude_min_temp, 0);
1254
             thermalManager.setTargetHotend(thermalManager.extrude_min_temp, 0);
1255
           sendinfoscreen(PSTR("NOTICE"), nullptr, PSTR("Please wait."), PSTR("Nozzle heating!"), true, true, true, true);
1255
           sendinfoscreen(PSTR("NOTICE"), nullptr, PSTR("Please wait."), PSTR("Nozzle heating!"), true, true, true, true);
1256
           SetupConfirmAction(nullptr);
1256
           SetupConfirmAction(nullptr);
1268
 
1268
 
1269
     case 1:
1269
     case 1:
1270
       #if HOTENDS >= 2
1270
       #if HOTENDS >= 2
1271
-        if (thermalManager.temp_hotend[1].celsius < thermalManager.extrude_min_temp) {
1272
-          if (thermalManager.temp_hotend[1].target < thermalManager.extrude_min_temp)
1271
+        if (thermalManager.degHotend(1) < thermalManager.extrude_min_temp) {
1272
+          if (thermalManager.degTargetHotend(1) < thermalManager.extrude_min_temp)
1273
             thermalManager.setTargetHotend(thermalManager.extrude_min_temp, 1);
1273
             thermalManager.setTargetHotend(thermalManager.extrude_min_temp, 1);
1274
           sendinfoscreen(PSTR("NOTICE"), nullptr, PSTR("Please wait."), PSTR("Nozzle heating!"), true, true, true, true);
1274
           sendinfoscreen(PSTR("NOTICE"), nullptr, PSTR("Please wait."), PSTR("Nozzle heating!"), true, true, true, true);
1275
           SetupConfirmAction(nullptr);
1275
           SetupConfirmAction(nullptr);
1284
         }
1284
         }
1285
       #endif
1285
       #endif
1286
       #if ENABLED(SINGLENOZZLE)
1286
       #if ENABLED(SINGLENOZZLE)
1287
-        if (thermalManager.temp_hotend[0].celsius < thermalManager.extrude_min_temp) {
1288
-          if (thermalManager.temp_hotend[0].target < thermalManager.extrude_min_temp)
1287
+        if (thermalManager.degHotend(0) < thermalManager.extrude_min_temp) {
1288
+          if (thermalManager.degTargetHotend(0) < thermalManager.extrude_min_temp)
1289
             thermalManager.setTargetHotend(thermalManager.extrude_min_temp, 0);
1289
             thermalManager.setTargetHotend(thermalManager.extrude_min_temp, 0);
1290
           sendinfoscreen(PSTR("NOTICE"), nullptr, PSTR("Please wait."), PSTR("Nozzle heating!"), true, true, true, true);
1290
           sendinfoscreen(PSTR("NOTICE"), nullptr, PSTR("Please wait."), PSTR("Nozzle heating!"), true, true, true, true);
1291
           SetupConfirmAction(nullptr);
1291
           SetupConfirmAction(nullptr);
1313
   switch (val_t) {
1313
   switch (val_t) {
1314
     case 0:
1314
     case 0:
1315
       #if HOTENDS >= 1
1315
       #if HOTENDS >= 1
1316
-        if (thermalManager.temp_hotend[0].celsius < thermalManager.extrude_min_temp) {
1317
-          if (thermalManager.temp_hotend[0].target < thermalManager.extrude_min_temp)
1316
+        if (thermalManager.degHotend(0) < thermalManager.extrude_min_temp) {
1317
+          if (thermalManager.degTargetHotend(0) < thermalManager.extrude_min_temp)
1318
             thermalManager.setTargetHotend(thermalManager.extrude_min_temp, 0);
1318
             thermalManager.setTargetHotend(thermalManager.extrude_min_temp, 0);
1319
           sendinfoscreen(PSTR("NOTICE"), nullptr, PSTR("Please wait."), PSTR("Nozzle heating!"), true, true, true, true);
1319
           sendinfoscreen(PSTR("NOTICE"), nullptr, PSTR("Please wait."), PSTR("Nozzle heating!"), true, true, true, true);
1320
           SetupConfirmAction(nullptr);
1320
           SetupConfirmAction(nullptr);
1331
       break;
1331
       break;
1332
     case 1:
1332
     case 1:
1333
       #if HOTENDS >= 2
1333
       #if HOTENDS >= 2
1334
-        if (thermalManager.temp_hotend[1].celsius < thermalManager.extrude_min_temp) {
1335
-          if (thermalManager.temp_hotend[1].target < thermalManager.extrude_min_temp)
1334
+        if (thermalManager.degHotend(1) < thermalManager.extrude_min_temp) {
1335
+          if (thermalManager.degTargetHotend(1) < thermalManager.extrude_min_temp)
1336
             thermalManager.setTargetHotend(thermalManager.extrude_min_temp, 1);
1336
             thermalManager.setTargetHotend(thermalManager.extrude_min_temp, 1);
1337
           sendinfoscreen(PSTR("NOTICE"), nullptr, PSTR("Please wait."), PSTR("Nozzle heating!"), true, true, true, true);
1337
           sendinfoscreen(PSTR("NOTICE"), nullptr, PSTR("Please wait."), PSTR("Nozzle heating!"), true, true, true, true);
1338
           SetupConfirmAction(nullptr);
1338
           SetupConfirmAction(nullptr);
1348
       #endif
1348
       #endif
1349
 
1349
 
1350
       #if ENABLED(SINGLENOZZLE)
1350
       #if ENABLED(SINGLENOZZLE)
1351
-        if (thermalManager.temp_hotend[0].celsius < thermalManager.extrude_min_temp) {
1352
-          if (thermalManager.temp_hotend[0].target < thermalManager.extrude_min_temp)
1351
+        if (thermalManager.degHotend(0) < thermalManager.extrude_min_temp) {
1352
+          if (thermalManager.degTargetHotend(0) < thermalManager.extrude_min_temp)
1353
             thermalManager.setTargetHotend(thermalManager.extrude_min_temp, 0);
1353
             thermalManager.setTargetHotend(thermalManager.extrude_min_temp, 0);
1354
           sendinfoscreen(PSTR("NOTICE"), nullptr, PSTR("Please wait."), PSTR("Nozzle heating!"), true, true, true, true);
1354
           sendinfoscreen(PSTR("NOTICE"), nullptr, PSTR("Please wait."), PSTR("Nozzle heating!"), true, true, true, true);
1355
           SetupConfirmAction(nullptr);
1355
           SetupConfirmAction(nullptr);

+ 11
- 11
Marlin/src/lcd/extui/lib/mks_ui/draw_dialog.cpp 查看文件

191
     TERN_(ADVANCED_PAUSE_FEATURE, pause_menu_response = PAUSE_RESPONSE_RESUME_PRINT);
191
     TERN_(ADVANCED_PAUSE_FEATURE, pause_menu_response = PAUSE_RESPONSE_RESUME_PRINT);
192
   }
192
   }
193
   else if (DIALOG_IS(TYPE_FILAMENT_LOAD_HEAT, TYPE_FILAMENT_UNLOAD_HEAT, TYPE_FILAMENT_HEAT_LOAD_COMPLETED, TYPE_FILAMENT_HEAT_UNLOAD_COMPLETED)) {
193
   else if (DIALOG_IS(TYPE_FILAMENT_LOAD_HEAT, TYPE_FILAMENT_UNLOAD_HEAT, TYPE_FILAMENT_HEAT_LOAD_COMPLETED, TYPE_FILAMENT_HEAT_UNLOAD_COMPLETED)) {
194
-    thermalManager.temp_hotend[uiCfg.curSprayerChoose].target= uiCfg.desireSprayerTempBak;
194
+    thermalManager.setTargetHotend(uiCfg.hotendTargetTempBak, uiCfg.extruderIndex);
195
     clear_cur_ui();
195
     clear_cur_ui();
196
     draw_return_ui();
196
     draw_return_ui();
197
   }
197
   }
204
     uiCfg.filament_loading_time_cnt    = 0;
204
     uiCfg.filament_loading_time_cnt    = 0;
205
     uiCfg.filament_unloading_time_flg  = false;
205
     uiCfg.filament_unloading_time_flg  = false;
206
     uiCfg.filament_unloading_time_cnt  = 0;
206
     uiCfg.filament_unloading_time_cnt  = 0;
207
-    thermalManager.temp_hotend[uiCfg.curSprayerChoose].target = uiCfg.desireSprayerTempBak;
207
+    thermalManager.setTargetHotend(uiCfg.hotendTargetTempBak, uiCfg.extruderIndex);
208
     clear_cur_ui();
208
     clear_cur_ui();
209
     draw_return_ui();
209
     draw_return_ui();
210
   }
210
   }
479
 
479
 
480
 void filament_sprayer_temp() {
480
 void filament_sprayer_temp() {
481
   char buf[20] = {0};
481
   char buf[20] = {0};
482
-  sprintf(buf, preheat_menu.value_state, (int)thermalManager.temp_hotend[uiCfg.curSprayerChoose].celsius, (int)thermalManager.temp_hotend[uiCfg.curSprayerChoose].target);
482
+  sprintf(buf, preheat_menu.value_state, (int)thermalManager.degHotend(uiCfg.extruderIndex), (int)thermalManager.degTargetHotend(uiCfg.extruderIndex));
483
 
483
 
484
-  strcpy(public_buf_l, uiCfg.curSprayerChoose < 1 ? extrude_menu.ext1 : extrude_menu.ext2);
484
+  strcpy(public_buf_l, uiCfg.extruderIndex < 1 ? extrude_menu.ext1 : extrude_menu.ext2);
485
   strcat_P(public_buf_l, PSTR(": "));
485
   strcat_P(public_buf_l, PSTR(": "));
486
   strcat(public_buf_l, buf);
486
   strcat(public_buf_l, buf);
487
   lv_label_set_text(tempText1, public_buf_l);
487
   lv_label_set_text(tempText1, public_buf_l);
500
     planner.synchronize();
500
     planner.synchronize();
501
     uiCfg.filament_loading_time_flg = true;
501
     uiCfg.filament_loading_time_flg = true;
502
     uiCfg.filament_loading_time_cnt = 0;
502
     uiCfg.filament_loading_time_cnt = 0;
503
-    sprintf_P(public_buf_m, PSTR("T%d\nG91\nG1 E%d F%d\nG90"), uiCfg.curSprayerChoose, gCfgItems.filamentchange_load_length, gCfgItems.filamentchange_load_speed);
503
+    sprintf_P(public_buf_m, PSTR("T%d\nG91\nG1 E%d F%d\nG90"), uiCfg.extruderIndex, gCfgItems.filamentchange_load_length, gCfgItems.filamentchange_load_speed);
504
     queue.inject(public_buf_m);
504
     queue.inject(public_buf_m);
505
   }
505
   }
506
   if (uiCfg.filament_heat_completed_unload) {
506
   if (uiCfg.filament_heat_completed_unload) {
510
     planner.synchronize();
510
     planner.synchronize();
511
     uiCfg.filament_unloading_time_flg = true;
511
     uiCfg.filament_unloading_time_flg = true;
512
     uiCfg.filament_unloading_time_cnt = 0;
512
     uiCfg.filament_unloading_time_cnt = 0;
513
-    sprintf_P(public_buf_m, PSTR("T%d\nG91\nG1 E-%d F%d\nG90"), uiCfg.curSprayerChoose, gCfgItems.filamentchange_unload_length, gCfgItems.filamentchange_unload_speed);
513
+    sprintf_P(public_buf_m, PSTR("T%d\nG91\nG1 E-%d F%d\nG90"), uiCfg.extruderIndex, gCfgItems.filamentchange_unload_length, gCfgItems.filamentchange_unload_speed);
514
     queue.inject(public_buf_m);
514
     queue.inject(public_buf_m);
515
   }
515
   }
516
 
516
 
517
-  if (((abs((int)((int)thermalManager.temp_hotend[uiCfg.curSprayerChoose].celsius - gCfgItems.filament_limit_temper)) <= 1)
518
-    || ((int)thermalManager.temp_hotend[uiCfg.curSprayerChoose].celsius > gCfgItems.filament_limit_temper))
519
-    && (uiCfg.filament_load_heat_flg)
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
   ) {
520
   ) {
521
     uiCfg.filament_load_heat_flg = false;
521
     uiCfg.filament_load_heat_flg = false;
522
     lv_clear_dialog();
522
     lv_clear_dialog();
529
     lv_clear_dialog();
529
     lv_clear_dialog();
530
     lv_draw_dialog(DIALOG_TYPE_FILAMENT_LOAD_COMPLETED);
530
     lv_draw_dialog(DIALOG_TYPE_FILAMENT_LOAD_COMPLETED);
531
   }
531
   }
532
-  if (((abs((int)((int)thermalManager.temp_hotend[uiCfg.curSprayerChoose].celsius - gCfgItems.filament_limit_temper)) <= 1)
533
-     || ((int)thermalManager.temp_hotend[uiCfg.curSprayerChoose].celsius > gCfgItems.filament_limit_temper))
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
534
      && uiCfg.filament_unload_heat_flg
535
   ) {
535
   ) {
536
     uiCfg.filament_unload_heat_flg = false;
536
     uiCfg.filament_unload_heat_flg = false;

+ 9
- 9
Marlin/src/lcd/extui/lib/mks_ui/draw_extrusion.cpp 查看文件

54
   if (event != LV_EVENT_RELEASED) return;
54
   if (event != LV_EVENT_RELEASED) return;
55
   switch (obj->mks_obj_id) {
55
   switch (obj->mks_obj_id) {
56
     case ID_E_ADD:
56
     case ID_E_ADD:
57
-      if (thermalManager.temp_hotend[uiCfg.curSprayerChoose].celsius >= EXTRUDE_MINTEMP) {
57
+      if (thermalManager.degHotend(uiCfg.extruderIndex) >= EXTRUDE_MINTEMP) {
58
         sprintf_P((char *)public_buf_l, PSTR("G91\nG1 E%d F%d\nG90"), uiCfg.extruStep, 60 * uiCfg.extruSpeed);
58
         sprintf_P((char *)public_buf_l, PSTR("G91\nG1 E%d F%d\nG90"), uiCfg.extruStep, 60 * uiCfg.extruSpeed);
59
         queue.inject(public_buf_l);
59
         queue.inject(public_buf_l);
60
         extrudeAmount += uiCfg.extruStep;
60
         extrudeAmount += uiCfg.extruStep;
62
       }
62
       }
63
       break;
63
       break;
64
     case ID_E_DEC:
64
     case ID_E_DEC:
65
-      if (thermalManager.temp_hotend[uiCfg.curSprayerChoose].celsius >= EXTRUDE_MINTEMP) {
65
+      if (thermalManager.degHotend(uiCfg.extruderIndex) >= EXTRUDE_MINTEMP) {
66
         sprintf_P((char *)public_buf_l, PSTR("G91\nG1 E%d F%d\nG90"), 0 - uiCfg.extruStep, 60 * uiCfg.extruSpeed);
66
         sprintf_P((char *)public_buf_l, PSTR("G91\nG1 E%d F%d\nG90"), 0 - uiCfg.extruStep, 60 * uiCfg.extruSpeed);
67
         queue.enqueue_one_now(public_buf_l);
67
         queue.enqueue_one_now(public_buf_l);
68
         extrudeAmount -= uiCfg.extruStep;
68
         extrudeAmount -= uiCfg.extruStep;
71
       break;
71
       break;
72
     case ID_E_TYPE:
72
     case ID_E_TYPE:
73
       if (ENABLED(HAS_MULTI_EXTRUDER)) {
73
       if (ENABLED(HAS_MULTI_EXTRUDER)) {
74
-        if (uiCfg.curSprayerChoose == 0) {
75
-          uiCfg.curSprayerChoose = 1;
74
+        if (uiCfg.extruderIndex == 0) {
75
+          uiCfg.extruderIndex = 1;
76
           queue.inject_P(PSTR("T1"));
76
           queue.inject_P(PSTR("T1"));
77
         }
77
         }
78
         else {
78
         else {
79
-          uiCfg.curSprayerChoose = 0;
79
+          uiCfg.extruderIndex = 0;
80
           queue.inject_P(PSTR("T0"));
80
           queue.inject_P(PSTR("T0"));
81
         }
81
         }
82
       }
82
       }
83
       else
83
       else
84
-        uiCfg.curSprayerChoose = 0;
84
+        uiCfg.extruderIndex = 0;
85
 
85
 
86
       extrudeAmount = 0;
86
       extrudeAmount = 0;
87
       disp_hotend_temp();
87
       disp_hotend_temp();
153
 }
153
 }
154
 
154
 
155
 void disp_ext_type() {
155
 void disp_ext_type() {
156
-  if (uiCfg.curSprayerChoose == 1) {
156
+  if (uiCfg.extruderIndex == 1) {
157
     lv_imgbtn_set_src_both(buttonType, "F:/bmp_extru2.bin");
157
     lv_imgbtn_set_src_both(buttonType, "F:/bmp_extru2.bin");
158
     if (gCfgItems.multiple_language) {
158
     if (gCfgItems.multiple_language) {
159
       lv_label_set_text(labelType, extrude_menu.ext2);
159
       lv_label_set_text(labelType, extrude_menu.ext2);
195
 
195
 
196
 void disp_hotend_temp() {
196
 void disp_hotend_temp() {
197
   char buf[20] = {0};
197
   char buf[20] = {0};
198
-  sprintf(buf, extrude_menu.temp_value, (int)thermalManager.temp_hotend[uiCfg.curSprayerChoose].celsius, (int)thermalManager.temp_hotend[uiCfg.curSprayerChoose].target);
198
+  sprintf(buf, extrude_menu.temp_value, (int)thermalManager.degHotend(uiCfg.extruderIndex), (int)thermalManager.degTargetHotend(uiCfg.extruderIndex));
199
   strcpy(public_buf_l, extrude_menu.temper_text);
199
   strcpy(public_buf_l, extrude_menu.temper_text);
200
   strcat(public_buf_l, buf);
200
   strcat(public_buf_l, buf);
201
   lv_label_set_text(tempText, public_buf_l);
201
   lv_label_set_text(tempText, public_buf_l);
213
     sprintf(buf1, extrude_menu.count_value_cm, extrudeAmount / 10);
213
     sprintf(buf1, extrude_menu.count_value_cm, extrudeAmount / 10);
214
   else
214
   else
215
     sprintf(buf1, extrude_menu.count_value_m, extrudeAmount / 1000);
215
     sprintf(buf1, extrude_menu.count_value_m, extrudeAmount / 1000);
216
-  strcat(public_buf_l, uiCfg.curSprayerChoose < 1 ? extrude_menu.ext1 : extrude_menu.ext2);
216
+  strcat(public_buf_l, uiCfg.extruderIndex == 0 ? extrude_menu.ext1 : extrude_menu.ext2);
217
   strcat(public_buf_l, buf1);
217
   strcat(public_buf_l, buf1);
218
 
218
 
219
   lv_label_set_text(ExtruText, public_buf_l);
219
   lv_label_set_text(ExtruText, public_buf_l);

+ 17
- 17
Marlin/src/lcd/extui/lib/mks_ui/draw_filament_change.cpp 查看文件

50
   switch (obj->mks_obj_id) {
50
   switch (obj->mks_obj_id) {
51
     case ID_FILAMNT_IN:
51
     case ID_FILAMNT_IN:
52
       uiCfg.filament_load_heat_flg = true;
52
       uiCfg.filament_load_heat_flg = true;
53
-      if ((abs(thermalManager.temp_hotend[uiCfg.curSprayerChoose].target - thermalManager.temp_hotend[uiCfg.curSprayerChoose].celsius) <= 1)
54
-          || (gCfgItems.filament_limit_temper <= thermalManager.temp_hotend[uiCfg.curSprayerChoose].celsius)) {
53
+      if ((abs(thermalManager.degTargetHotend(uiCfg.extruderIndex) - thermalManager.degHotend(uiCfg.extruderIndex)) <= 1)
54
+          || (gCfgItems.filament_limit_temper <= thermalManager.degHotend(uiCfg.extruderIndex))) {
55
         lv_clear_filament_change();
55
         lv_clear_filament_change();
56
         lv_draw_dialog(DIALOG_TYPE_FILAMENT_HEAT_LOAD_COMPLETED);
56
         lv_draw_dialog(DIALOG_TYPE_FILAMENT_HEAT_LOAD_COMPLETED);
57
       }
57
       }
58
       else {
58
       else {
59
         lv_clear_filament_change();
59
         lv_clear_filament_change();
60
         lv_draw_dialog(DIALOG_TYPE_FILAMENT_LOAD_HEAT);
60
         lv_draw_dialog(DIALOG_TYPE_FILAMENT_LOAD_HEAT);
61
-        if (thermalManager.temp_hotend[uiCfg.curSprayerChoose].target < gCfgItems.filament_limit_temper) {
62
-          thermalManager.temp_hotend[uiCfg.curSprayerChoose].target = gCfgItems.filament_limit_temper;
63
-          thermalManager.start_watching_hotend(uiCfg.curSprayerChoose);
61
+        if (thermalManager.degTargetHotend(uiCfg.extruderIndex) < gCfgItems.filament_limit_temper) {
62
+          thermalManager.setTargetHotend(gCfgItems.filament_limit_temper, uiCfg.extruderIndex);
63
+          thermalManager.start_watching_hotend(uiCfg.extruderIndex);
64
         }
64
         }
65
       }
65
       }
66
       break;
66
       break;
67
     case ID_FILAMNT_OUT:
67
     case ID_FILAMNT_OUT:
68
       uiCfg.filament_unload_heat_flg = true;
68
       uiCfg.filament_unload_heat_flg = true;
69
-      if ((thermalManager.temp_hotend[uiCfg.curSprayerChoose].target > 0)
70
-        && ((abs((int)((int)thermalManager.temp_hotend[uiCfg.curSprayerChoose].target - thermalManager.temp_hotend[uiCfg.curSprayerChoose].celsius)) <= 1)
71
-        || ((int)thermalManager.temp_hotend[uiCfg.curSprayerChoose].celsius >= gCfgItems.filament_limit_temper))
69
+      if (thermalManager.degTargetHotend(uiCfg.extruderIndex)
70
+          && ((abs((int)((int)thermalManager.degTargetHotend(uiCfg.extruderIndex) - thermalManager.degHotend(uiCfg.extruderIndex))) <= 1)
71
+              || ((int)thermalManager.degHotend(uiCfg.extruderIndex) >= gCfgItems.filament_limit_temper))
72
       ) {
72
       ) {
73
         lv_clear_filament_change();
73
         lv_clear_filament_change();
74
         lv_draw_dialog(DIALOG_TYPE_FILAMENT_HEAT_UNLOAD_COMPLETED);
74
         lv_draw_dialog(DIALOG_TYPE_FILAMENT_HEAT_UNLOAD_COMPLETED);
76
       else {
76
       else {
77
         lv_clear_filament_change();
77
         lv_clear_filament_change();
78
         lv_draw_dialog(DIALOG_TYPE_FILAMENT_UNLOAD_HEAT);
78
         lv_draw_dialog(DIALOG_TYPE_FILAMENT_UNLOAD_HEAT);
79
-        if (thermalManager.temp_hotend[uiCfg.curSprayerChoose].target < gCfgItems.filament_limit_temper) {
80
-          thermalManager.temp_hotend[uiCfg.curSprayerChoose].target = gCfgItems.filament_limit_temper;
81
-          thermalManager.start_watching_hotend(uiCfg.curSprayerChoose);
79
+        if (thermalManager.degTargetHotend(uiCfg.extruderIndex) < gCfgItems.filament_limit_temper) {
80
+          thermalManager.setTargetHotend(gCfgItems.filament_limit_temper, uiCfg.extruderIndex);
81
+          thermalManager.start_watching_hotend(uiCfg.extruderIndex);
82
         }
82
         }
83
         filament_sprayer_temp();
83
         filament_sprayer_temp();
84
       }
84
       }
85
       break;
85
       break;
86
     case ID_FILAMNT_TYPE:
86
     case ID_FILAMNT_TYPE:
87
       #if HAS_MULTI_EXTRUDER
87
       #if HAS_MULTI_EXTRUDER
88
-        uiCfg.curSprayerChoose = !uiCfg.curSprayerChoose;
88
+        uiCfg.extruderIndex = !uiCfg.extruderIndex;
89
       #endif
89
       #endif
90
       disp_filament_type();
90
       disp_filament_type();
91
       break;
91
       break;
92
     case ID_FILAMNT_RETURN:
92
     case ID_FILAMNT_RETURN:
93
       #if HAS_MULTI_EXTRUDER
93
       #if HAS_MULTI_EXTRUDER
94
         if (uiCfg.print_state != IDLE && uiCfg.print_state != REPRINTED)
94
         if (uiCfg.print_state != IDLE && uiCfg.print_state != REPRINTED)
95
-          gcode.process_subcommands_now_P(uiCfg.curSprayerChoose_bak == 1 ? PSTR("T1") : PSTR("T0"));
95
+          gcode.process_subcommands_now_P(uiCfg.extruderIndexBak == 1 ? PSTR("T1") : PSTR("T0"));
96
       #endif
96
       #endif
97
       feedrate_mm_s = (float)uiCfg.moveSpeed_bak;
97
       feedrate_mm_s = (float)uiCfg.moveSpeed_bak;
98
       if (uiCfg.print_state == PAUSED)
98
       if (uiCfg.print_state == PAUSED)
99
         planner.set_e_position_mm((destination.e = current_position.e = uiCfg.current_e_position_bak));
99
         planner.set_e_position_mm((destination.e = current_position.e = uiCfg.current_e_position_bak));
100
-      thermalManager.temp_hotend[uiCfg.curSprayerChoose].target = uiCfg.desireSprayerTempBak;
100
+      thermalManager.setTargetHotend(uiCfg.hotendTargetTempBak, uiCfg.extruderIndex);
101
 
101
 
102
       clear_cur_ui();
102
       clear_cur_ui();
103
       draw_return_ui();
103
       draw_return_ui();
132
 }
132
 }
133
 
133
 
134
 void disp_filament_type() {
134
 void disp_filament_type() {
135
-  if (uiCfg.curSprayerChoose == 1) {
135
+  if (uiCfg.extruderIndex == 1) {
136
     lv_imgbtn_set_src_both(buttonType, "F:/bmp_extru2.bin");
136
     lv_imgbtn_set_src_both(buttonType, "F:/bmp_extru2.bin");
137
     if (gCfgItems.multiple_language) {
137
     if (gCfgItems.multiple_language) {
138
       lv_label_set_text(labelType, preheat_menu.ext2);
138
       lv_label_set_text(labelType, preheat_menu.ext2);
153
 
153
 
154
   public_buf_l[0] = '\0';
154
   public_buf_l[0] = '\0';
155
 
155
 
156
-  strcat(public_buf_l, uiCfg.curSprayerChoose < 1 ? preheat_menu.ext1 : preheat_menu.ext2);
157
-  sprintf(buf, preheat_menu.value_state, (int)thermalManager.temp_hotend[uiCfg.curSprayerChoose].celsius,  (int)thermalManager.temp_hotend[uiCfg.curSprayerChoose].target);
156
+  strcat(public_buf_l, uiCfg.extruderIndex < 1 ? preheat_menu.ext1 : preheat_menu.ext2);
157
+  sprintf(buf, preheat_menu.value_state, (int)thermalManager.degHotend(uiCfg.extruderIndex), (int)thermalManager.degTargetHotend(uiCfg.extruderIndex));
158
 
158
 
159
   strcat_P(public_buf_l, PSTR(": "));
159
   strcat_P(public_buf_l, PSTR(": "));
160
   strcat(public_buf_l, buf);
160
   strcat(public_buf_l, buf);

+ 2
- 2
Marlin/src/lcd/extui/lib/mks_ui/draw_operation.cpp 查看文件

66
       break;
66
       break;
67
     case ID_O_FILAMENT:
67
     case ID_O_FILAMENT:
68
       #if HAS_MULTI_EXTRUDER
68
       #if HAS_MULTI_EXTRUDER
69
-        uiCfg.curSprayerChoose_bak = active_extruder;
69
+        uiCfg.extruderIndexBak = active_extruder;
70
       #endif
70
       #endif
71
       if (uiCfg.print_state == WORKING) {
71
       if (uiCfg.print_state == WORKING) {
72
         #if ENABLED(SDSUPPORT)
72
         #if ENABLED(SDSUPPORT)
76
         #endif
76
         #endif
77
       }
77
       }
78
       uiCfg.moveSpeed_bak = (uint16_t)feedrate_mm_s;
78
       uiCfg.moveSpeed_bak = (uint16_t)feedrate_mm_s;
79
-      uiCfg.desireSprayerTempBak = thermalManager.temp_hotend[active_extruder].target;
79
+      uiCfg.hotendTargetTempBak = thermalManager.degTargetHotend(active_extruder);
80
       lv_clear_operation();
80
       lv_clear_operation();
81
       lv_draw_filament_change();
81
       lv_draw_filament_change();
82
       break;
82
       break;

+ 32
- 33
Marlin/src/lcd/extui/lib/mks_ui/draw_preHeat.cpp 查看文件

48
 static void event_handler(lv_obj_t *obj, lv_event_t event) {
48
 static void event_handler(lv_obj_t *obj, lv_event_t event) {
49
   if (event != LV_EVENT_RELEASED) return;
49
   if (event != LV_EVENT_RELEASED) return;
50
   switch (obj->mks_obj_id) {
50
   switch (obj->mks_obj_id) {
51
-    case ID_P_ADD:
51
+    case ID_P_ADD: {
52
       if (uiCfg.curTempType == 0) {
52
       if (uiCfg.curTempType == 0) {
53
-        thermalManager.temp_hotend[uiCfg.curSprayerChoose].target += uiCfg.stepHeat;
54
-        if (uiCfg.curSprayerChoose == 0) {
55
-          if ((int)thermalManager.temp_hotend[uiCfg.curSprayerChoose].target > (HEATER_0_MAXTEMP - (WATCH_TEMP_INCREASE + TEMP_HYSTERESIS + 1))) {
56
-            thermalManager.temp_hotend[uiCfg.curSprayerChoose].target = (float)HEATER_0_MAXTEMP - (WATCH_TEMP_INCREASE + TEMP_HYSTERESIS + 1);
57
-          }
58
-        }
53
+        int16_t max_target;
54
+        thermalManager.temp_hotend[uiCfg.extruderIndex].target += uiCfg.stepHeat;
55
+        if (uiCfg.extruderIndex == 0)
56
+          max_target = HEATER_0_MAXTEMP - (WATCH_TEMP_INCREASE + TEMP_HYSTERESIS + 1);
59
         #if HAS_MULTI_HOTEND
57
         #if HAS_MULTI_HOTEND
60
-          else if ((int)thermalManager.temp_hotend[uiCfg.curSprayerChoose].target > (HEATER_1_MAXTEMP - (WATCH_TEMP_INCREASE + TEMP_HYSTERESIS + 1))) {
61
-            thermalManager.temp_hotend[uiCfg.curSprayerChoose].target = (float)HEATER_1_MAXTEMP - (WATCH_TEMP_INCREASE + TEMP_HYSTERESIS + 1);
62
-          }
58
+          else
59
+            max_target = HEATER_1_MAXTEMP - (WATCH_TEMP_INCREASE + TEMP_HYSTERESIS + 1);
63
         #endif
60
         #endif
64
-        thermalManager.start_watching_hotend(uiCfg.curSprayerChoose);
61
+        if (thermalManager.degTargetHotend(uiCfg.extruderIndex) > max_target)
62
+          thermalManager.setTargetHotend(max_target, uiCfg.extruderIndex);
63
+        thermalManager.start_watching_hotend(uiCfg.extruderIndex);
65
       }
64
       }
66
       #if HAS_HEATED_BED
65
       #if HAS_HEATED_BED
67
         else {
66
         else {
67
+          constexpr int16_t max_target = BED_MAXTEMP - (WATCH_BED_TEMP_INCREASE + TEMP_BED_HYSTERESIS + 1);
68
           thermalManager.temp_bed.target += uiCfg.stepHeat;
68
           thermalManager.temp_bed.target += uiCfg.stepHeat;
69
-          if ((int)thermalManager.temp_bed.target > BED_MAXTEMP - (WATCH_BED_TEMP_INCREASE + TEMP_BED_HYSTERESIS + 1)) {
70
-            thermalManager.temp_bed.target = (float)BED_MAXTEMP - (WATCH_BED_TEMP_INCREASE + TEMP_BED_HYSTERESIS + 1);
71
-          }
69
+          if (thermalManager.degTargetBed() > max_target)
70
+            thermalManager.setTargetBed(max_target);
72
           thermalManager.start_watching_bed();
71
           thermalManager.start_watching_bed();
73
         }
72
         }
74
       #endif
73
       #endif
75
       disp_desire_temp();
74
       disp_desire_temp();
76
-      break;
75
+    } break;
76
+
77
     case ID_P_DEC:
77
     case ID_P_DEC:
78
       if (uiCfg.curTempType == 0) {
78
       if (uiCfg.curTempType == 0) {
79
-        if ((int)thermalManager.temp_hotend[uiCfg.curSprayerChoose].target > uiCfg.stepHeat)
80
-          thermalManager.temp_hotend[uiCfg.curSprayerChoose].target -= uiCfg.stepHeat;
79
+        if ((int)thermalManager.degTargetHotend(uiCfg.extruderIndex) > uiCfg.stepHeat)
80
+          thermalManager.temp_hotend[uiCfg.extruderIndex].target -= uiCfg.stepHeat;
81
         else
81
         else
82
-          thermalManager.temp_hotend[uiCfg.curSprayerChoose].target = 0;
83
-
84
-        thermalManager.start_watching_hotend(uiCfg.curSprayerChoose);
82
+          thermalManager.setTargetHotend(0, uiCfg.extruderIndex);
83
+        thermalManager.start_watching_hotend(uiCfg.extruderIndex);
85
       }
84
       }
86
       #if HAS_HEATED_BED
85
       #if HAS_HEATED_BED
87
         else {
86
         else {
88
           if ((int)thermalManager.temp_bed.target > uiCfg.stepHeat)
87
           if ((int)thermalManager.temp_bed.target > uiCfg.stepHeat)
89
             thermalManager.temp_bed.target -= uiCfg.stepHeat;
88
             thermalManager.temp_bed.target -= uiCfg.stepHeat;
90
           else
89
           else
91
-            thermalManager.temp_bed.target = 0;
90
+            thermalManager.setTargetBed(0);
92
 
91
 
93
           thermalManager.start_watching_bed();
92
           thermalManager.start_watching_bed();
94
         }
93
         }
98
     case ID_P_TYPE:
97
     case ID_P_TYPE:
99
       if (uiCfg.curTempType == 0) {
98
       if (uiCfg.curTempType == 0) {
100
         if (ENABLED(HAS_MULTI_EXTRUDER)) {
99
         if (ENABLED(HAS_MULTI_EXTRUDER)) {
101
-          if (uiCfg.curSprayerChoose == 0) {
102
-            uiCfg.curSprayerChoose = 1;
100
+          if (uiCfg.extruderIndex == 0) {
101
+            uiCfg.extruderIndex = 1;
103
           }
102
           }
104
-          else if (uiCfg.curSprayerChoose == 1) {
103
+          else if (uiCfg.extruderIndex == 1) {
105
             if (TEMP_SENSOR_BED != 0) {
104
             if (TEMP_SENSOR_BED != 0) {
106
               uiCfg.curTempType = 1;
105
               uiCfg.curTempType = 1;
107
             }
106
             }
108
             else {
107
             else {
109
               uiCfg.curTempType      = 0;
108
               uiCfg.curTempType      = 0;
110
-              uiCfg.curSprayerChoose = 0;
109
+              uiCfg.extruderIndex = 0;
111
             }
110
             }
112
           }
111
           }
113
         }
112
         }
114
-        else if (uiCfg.curSprayerChoose == 0) {
113
+        else if (uiCfg.extruderIndex == 0) {
115
           if (TEMP_SENSOR_BED != 0)
114
           if (TEMP_SENSOR_BED != 0)
116
             uiCfg.curTempType = 1;
115
             uiCfg.curTempType = 1;
117
           else
116
           else
119
         }
118
         }
120
       }
119
       }
121
       else if (uiCfg.curTempType == 1) {
120
       else if (uiCfg.curTempType == 1) {
122
-        uiCfg.curSprayerChoose = 0;
121
+        uiCfg.extruderIndex = 0;
123
         uiCfg.curTempType      = 0;
122
         uiCfg.curTempType      = 0;
124
       }
123
       }
125
       disp_temp_type();
124
       disp_temp_type();
135
       break;
134
       break;
136
     case ID_P_OFF:
135
     case ID_P_OFF:
137
       if (uiCfg.curTempType == 0) {
136
       if (uiCfg.curTempType == 0) {
138
-        thermalManager.temp_hotend[uiCfg.curSprayerChoose].target = 0;
139
-        thermalManager.start_watching_hotend(uiCfg.curSprayerChoose);
137
+        thermalManager.setTargetHotend(0, uiCfg.extruderIndex);
138
+        thermalManager.start_watching_hotend(uiCfg.extruderIndex);
140
       }
139
       }
141
       #if HAS_HEATED_BED
140
       #if HAS_HEATED_BED
142
         else {
141
         else {
186
 
185
 
187
 void disp_temp_type() {
186
 void disp_temp_type() {
188
   if (uiCfg.curTempType == 0) {
187
   if (uiCfg.curTempType == 0) {
189
-    if (uiCfg.curSprayerChoose == 1) {
188
+    if (uiCfg.extruderIndex == 1) {
190
     lv_imgbtn_set_src_both(buttonType, "F:/bmp_extru2.bin");
189
     lv_imgbtn_set_src_both(buttonType, "F:/bmp_extru2.bin");
191
       if (gCfgItems.multiple_language) {
190
       if (gCfgItems.multiple_language) {
192
         lv_label_set_text(labelType, preheat_menu.ext2);
191
         lv_label_set_text(labelType, preheat_menu.ext2);
217
   public_buf_l[0] = '\0';
216
   public_buf_l[0] = '\0';
218
 
217
 
219
   if (uiCfg.curTempType == 0) {
218
   if (uiCfg.curTempType == 0) {
220
-    strcat(public_buf_l, uiCfg.curSprayerChoose < 1 ? preheat_menu.ext1 : preheat_menu.ext2);
221
-    sprintf(buf, preheat_menu.value_state, (int)thermalManager.temp_hotend[uiCfg.curSprayerChoose].celsius,  (int)thermalManager.temp_hotend[uiCfg.curSprayerChoose].target);
219
+    strcat(public_buf_l, uiCfg.extruderIndex < 1 ? preheat_menu.ext1 : preheat_menu.ext2);
220
+    sprintf(buf, preheat_menu.value_state, (int)thermalManager.degHotend(uiCfg.extruderIndex), (int)thermalManager.degTargetHotend(uiCfg.extruderIndex));
222
   }
221
   }
223
   #if HAS_HEATED_BED
222
   #if HAS_HEATED_BED
224
     else {
223
     else {
225
       strcat(public_buf_l, preheat_menu.hotbed);
224
       strcat(public_buf_l, preheat_menu.hotbed);
226
-      sprintf(buf, preheat_menu.value_state, (int)thermalManager.temp_bed.celsius,  (int)thermalManager.temp_bed.target);
225
+      sprintf(buf, preheat_menu.value_state, (int)thermalManager.temp_bed.celsius, (int)thermalManager.temp_bed.target);
227
     }
226
     }
228
   #endif
227
   #endif
229
   strcat_P(public_buf_l, PSTR(": "));
228
   strcat_P(public_buf_l, PSTR(": "));

+ 2
- 2
Marlin/src/lcd/extui/lib/mks_ui/draw_printing.cpp 查看文件

203
 }
203
 }
204
 
204
 
205
 void disp_ext_temp() {
205
 void disp_ext_temp() {
206
-  sprintf(public_buf_l, printing_menu.temp1, (int)thermalManager.temp_hotend[0].celsius, (int)thermalManager.temp_hotend[0].target);
206
+  sprintf(public_buf_l, printing_menu.temp1, (int)thermalManager.degHotend(0), (int)thermalManager.degTargetHotend(0));
207
   lv_label_set_text(labelExt1, public_buf_l);
207
   lv_label_set_text(labelExt1, public_buf_l);
208
 
208
 
209
   #if HAS_MULTI_EXTRUDER
209
   #if HAS_MULTI_EXTRUDER
210
-    sprintf(public_buf_l, printing_menu.temp1, (int)thermalManager.temp_hotend[1].celsius, (int)thermalManager.temp_hotend[1].target);
210
+    sprintf(public_buf_l, printing_menu.temp1, (int)thermalManager.degHotend(1), (int)thermalManager.degTargetHotend(1));
211
     lv_label_set_text(labelExt2, public_buf_l);
211
     lv_label_set_text(labelExt2, public_buf_l);
212
   #endif
212
   #endif
213
 }
213
 }

+ 4
- 4
Marlin/src/lcd/extui/lib/mks_ui/draw_ready_print.cpp 查看文件

98
 lv_obj_t *e1, *e2, *e3, *bed;
98
 lv_obj_t *e1, *e2, *e3, *bed;
99
 void mks_disp_test() {
99
 void mks_disp_test() {
100
   char buf[30] = {0};
100
   char buf[30] = {0};
101
-  sprintf_P(buf, PSTR("e1:%d"), (int)thermalManager.temp_hotend[0].celsius);
101
+  sprintf_P(buf, PSTR("e1:%d"), (int)thermalManager.degHotend(0));
102
   lv_label_set_text(e1, buf);
102
   lv_label_set_text(e1, buf);
103
   #if HAS_MULTI_HOTEND
103
   #if HAS_MULTI_HOTEND
104
-    sprintf_P(buf, PSTR("e2:%d"), (int)thermalManager.temp_hotend[1].celsius);
104
+    sprintf_P(buf, PSTR("e2:%d"), (int)thermalManager.degHotend(1));
105
     lv_label_set_text(e2, buf);
105
     lv_label_set_text(e2, buf);
106
   #endif
106
   #endif
107
   #if HAS_HEATED_BED
107
   #if HAS_HEATED_BED
133
     #if 1
133
     #if 1
134
       e1 = lv_label_create_empty(scr);
134
       e1 = lv_label_create_empty(scr);
135
       lv_obj_set_pos(e1, 20, 20);
135
       lv_obj_set_pos(e1, 20, 20);
136
-      sprintf_P(buf, PSTR("e1:  %d"), (int)thermalManager.temp_hotend[0].celsius);
136
+      sprintf_P(buf, PSTR("e1:  %d"), (int)thermalManager.degHotend(0));
137
       lv_label_set_text(e1, buf);
137
       lv_label_set_text(e1, buf);
138
       #if HAS_MULTI_HOTEND
138
       #if HAS_MULTI_HOTEND
139
         e2 = lv_label_create_empty(scr);
139
         e2 = lv_label_create_empty(scr);
140
         lv_obj_set_pos(e2, 20, 45);
140
         lv_obj_set_pos(e2, 20, 45);
141
-        sprintf_P(buf, PSTR("e1:  %d"), (int)thermalManager.temp_hotend[1].celsius);
141
+        sprintf_P(buf, PSTR("e1:  %d"), (int)thermalManager.degHotend(1));
142
         lv_label_set_text(e2, buf);
142
         lv_label_set_text(e2, buf);
143
       #endif
143
       #endif
144
 
144
 

+ 1
- 1
Marlin/src/lcd/extui/lib/mks_ui/draw_tool.cpp 查看文件

68
       #endif
68
       #endif
69
       break;
69
       break;
70
     case ID_T_FILAMENT:
70
     case ID_T_FILAMENT:
71
-      uiCfg.desireSprayerTempBak = thermalManager.temp_hotend[uiCfg.curSprayerChoose].target;
71
+      uiCfg.hotendTargetTempBak = thermalManager.degTargetHotend(uiCfg.extruderIndex);
72
       lv_draw_filament_change();
72
       lv_draw_filament_change();
73
       break;
73
       break;
74
     case ID_T_MORE:
74
     case ID_T_MORE:

+ 1
- 1
Marlin/src/lcd/extui/lib/mks_ui/draw_ui.cpp 查看文件

179
 
179
 
180
 void ui_cfg_init() {
180
 void ui_cfg_init() {
181
   uiCfg.curTempType         = 0;
181
   uiCfg.curTempType         = 0;
182
-  uiCfg.curSprayerChoose    = 0;
182
+  uiCfg.extruderIndex       = 0;
183
   uiCfg.stepHeat            = 10;
183
   uiCfg.stepHeat            = 10;
184
   uiCfg.leveling_first_time = false;
184
   uiCfg.leveling_first_time = false;
185
   uiCfg.para_ui_page        = false;
185
   uiCfg.para_ui_page        = false;

+ 3
- 3
Marlin/src/lcd/extui/lib/mks_ui/draw_ui.h 查看文件

211
 
211
 
212
 typedef struct {
212
 typedef struct {
213
   uint8_t curTempType:1,
213
   uint8_t curTempType:1,
214
-          curSprayerChoose:3,
214
+          extruderIndex:3,
215
           stepHeat:4,
215
           stepHeat:4,
216
-          curSprayerChoose_bak:4;
216
+          extruderIndexBak:4;
217
   bool    leveling_first_time:1,
217
   bool    leveling_first_time:1,
218
           para_ui_page:1,
218
           para_ui_page:1,
219
           configWifi:1,
219
           configWifi:1,
246
            filament_loading_time_cnt,
246
            filament_loading_time_cnt,
247
            filament_unloading_time_cnt;
247
            filament_unloading_time_cnt;
248
   float move_dist;
248
   float move_dist;
249
-  float desireSprayerTempBak;
249
+  float hotendTargetTempBak;
250
   float current_x_position_bak,
250
   float current_x_position_bak,
251
         current_y_position_bak,
251
         current_y_position_bak,
252
         current_z_position_bak,
252
         current_z_position_bak,

+ 7
- 7
Marlin/src/lcd/extui/lib/mks_ui/wifi_module.cpp 查看文件

885
             char *outBuf = (char *)tempBuf;
885
             char *outBuf = (char *)tempBuf;
886
             char str_1[16], tbuf[34];
886
             char str_1[16], tbuf[34];
887
 
887
 
888
-            dtostrf(thermalManager.temp_hotend[0].celsius, 1, 1, tbuf);
888
+            dtostrf(thermalManager.degHotend(0), 1, 1, tbuf);
889
             strcat_P(tbuf, PSTR(" /"));
889
             strcat_P(tbuf, PSTR(" /"));
890
-            strcat(tbuf, dtostrf(thermalManager.temp_hotend[0].target, 1, 1, str_1));
890
+            strcat(tbuf, dtostrf(thermalManager.degTargetHotend(0), 1, 1, str_1));
891
 
891
 
892
             const int tlen = strlen(tbuf);
892
             const int tlen = strlen(tbuf);
893
 
893
 
912
             strcat_P(outBuf, PSTR(" T1:"));
912
             strcat_P(outBuf, PSTR(" T1:"));
913
             outBuf += 4;
913
             outBuf += 4;
914
             #if HAS_MULTI_HOTEND
914
             #if HAS_MULTI_HOTEND
915
-              strcat(outBuf, dtostrf(thermalManager.temp_hotend[1].celsius, 1, 1, str_1));
915
+              strcat(outBuf, dtostrf(thermalManager.degHotend(1), 1, 1, str_1));
916
               strcat_P(outBuf, PSTR(" /"));
916
               strcat_P(outBuf, PSTR(" /"));
917
-              strcat(outBuf, dtostrf(thermalManager.temp_hotend[1].target, 1, 1, str_1));
917
+              strcat(outBuf, dtostrf(thermalManager.degTargetHotend(1), 1, 1, str_1));
918
             #else
918
             #else
919
               strcat_P(outBuf, PSTR("0 /0"));
919
               strcat_P(outBuf, PSTR("0 /0"));
920
             #endif
920
             #endif
924
           }
924
           }
925
           else {
925
           else {
926
             sprintf_P((char *)tempBuf, PSTR("T:%d /%d B:%d /%d T0:%d /%d T1:%d /%d @:0 B@:0\r\n"),
926
             sprintf_P((char *)tempBuf, PSTR("T:%d /%d B:%d /%d T0:%d /%d T1:%d /%d @:0 B@:0\r\n"),
927
-              (int)thermalManager.temp_hotend[0].celsius, (int)thermalManager.temp_hotend[0].target,
927
+              (int)thermalManager.degHotend(0), (int)thermalManager.degTargetHotend(0),
928
               #if HAS_HEATED_BED
928
               #if HAS_HEATED_BED
929
                 (int)thermalManager.temp_bed.celsius, (int)thermalManager.temp_bed.target,
929
                 (int)thermalManager.temp_bed.celsius, (int)thermalManager.temp_bed.target,
930
               #else
930
               #else
931
                 0, 0,
931
                 0, 0,
932
               #endif
932
               #endif
933
-              (int)thermalManager.temp_hotend[0].celsius, (int)thermalManager.temp_hotend[0].target,
933
+              (int)thermalManager.degHotend(0), (int)thermalManager.degTargetHotend(0),
934
               #if HAS_MULTI_HOTEND
934
               #if HAS_MULTI_HOTEND
935
-                (int)thermalManager.temp_hotend[1].celsius, (int)thermalManager.temp_hotend[1].target
935
+                (int)thermalManager.degHotend(1), (int)thermalManager.degTargetHotend(1)
936
               #else
936
               #else
937
                 0, 0
937
                 0, 0
938
               #endif
938
               #endif

Loading…
取消
儲存