ソースを参照

🚸 MKS UI extrusion speed/steps config (#22656)

DvoraNoob 3年前
コミット
3a2eb574e2
コミッターのメールアドレスに関連付けられたアカウントが存在しません

+ 36
- 54
Marlin/src/lcd/extui/mks_ui/draw_extrusion.cpp ファイルの表示

89
       disp_extru_amount();
89
       disp_extru_amount();
90
       break;
90
       break;
91
     case ID_E_STEP:
91
     case ID_E_STEP:
92
-      switch (ABS(uiCfg.extruStep)) {
93
-        case  1: uiCfg.extruStep = 5; break;
94
-        case  5: uiCfg.extruStep = 10; break;
95
-        case 10: uiCfg.extruStep = 1; break;
96
-        default: break;
92
+      switch (uiCfg.extruStep) {
93
+        case uiCfg.eStepMin: uiCfg.extruStep = uiCfg.eStepMed; break;
94
+        case uiCfg.eStepMed: uiCfg.extruStep = uiCfg.eStepMax; break;
95
+        case uiCfg.eStepMax: uiCfg.extruStep = uiCfg.eStepMin; break;
97
       }
96
       }
98
       disp_ext_step();
97
       disp_ext_step();
99
       break;
98
       break;
100
     case ID_E_SPEED:
99
     case ID_E_SPEED:
101
       switch (uiCfg.extruSpeed) {
100
       switch (uiCfg.extruSpeed) {
102
-        case  1: uiCfg.extruSpeed = 10; break;
103
-        case 10: uiCfg.extruSpeed = 20; break;
104
-        case 20: uiCfg.extruSpeed = 1; break;
105
-        default: break;
101
+        case uiCfg.eSpeedL: uiCfg.extruSpeed = uiCfg.eSpeedN; break;
102
+        case uiCfg.eSpeedN: uiCfg.extruSpeed = uiCfg.eSpeedH; break;
103
+        case uiCfg.eSpeedH: uiCfg.extruSpeed = uiCfg.eSpeedL; break;
106
       }
104
       }
107
       disp_ext_speed();
105
       disp_ext_speed();
108
       break;
106
       break;
155
 void disp_ext_type() {
153
 void disp_ext_type() {
156
   if (uiCfg.extruderIndex == 1) {
154
   if (uiCfg.extruderIndex == 1) {
157
     lv_imgbtn_set_src_both(buttonType, "F:/bmp_extru2.bin");
155
     lv_imgbtn_set_src_both(buttonType, "F:/bmp_extru2.bin");
158
-    if (gCfgItems.multiple_language) {
159
-      lv_label_set_text(labelType, extrude_menu.ext2);
160
-      lv_obj_align(labelType, buttonType, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
161
-    }
156
+    if (gCfgItems.multiple_language) lv_label_set_text(labelType, extrude_menu.ext2);
162
   }
157
   }
163
   else {
158
   else {
164
     lv_imgbtn_set_src_both(buttonType, "F:/bmp_extru1.bin");
159
     lv_imgbtn_set_src_both(buttonType, "F:/bmp_extru1.bin");
165
-    if (gCfgItems.multiple_language) {
166
-      lv_label_set_text(labelType, extrude_menu.ext1);
167
-      lv_obj_align(labelType, buttonType, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
168
-    }
160
+    if (gCfgItems.multiple_language) lv_label_set_text(labelType, extrude_menu.ext1);
169
   }
161
   }
162
+  if (gCfgItems.multiple_language)
163
+    lv_obj_align(labelType, buttonType, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
170
 }
164
 }
171
 
165
 
172
 void disp_ext_speed() {
166
 void disp_ext_speed() {
173
-  if (uiCfg.extruSpeed == 20)
174
-    lv_imgbtn_set_src_both(buttonSpeed, "F:/bmp_speed_high.bin");
175
-  else if (uiCfg.extruSpeed == 1)
176
-    lv_imgbtn_set_src_both(buttonSpeed, "F:/bmp_speed_slow.bin");
177
-  else
178
-    lv_imgbtn_set_src_both(buttonSpeed, "F:/bmp_speed_normal.bin");
167
+  switch (uiCfg.extruSpeed) {
168
+    case uiCfg.eSpeedH: lv_imgbtn_set_src_both(buttonSpeed, "F:/bmp_speed_high.bin");   break;
169
+    case uiCfg.eSpeedL: lv_imgbtn_set_src_both(buttonSpeed, "F:/bmp_speed_slow.bin");   break;
170
+    case uiCfg.eSpeedN: lv_imgbtn_set_src_both(buttonSpeed, "F:/bmp_speed_normal.bin"); break;
171
+  }
179
 
172
 
180
   if (gCfgItems.multiple_language) {
173
   if (gCfgItems.multiple_language) {
181
-    if (uiCfg.extruSpeed == 20) {
182
-      lv_label_set_text(labelSpeed, extrude_menu.high);
183
-      lv_obj_align(labelSpeed, buttonSpeed, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
184
-    }
185
-    else if (uiCfg.extruSpeed == 1) {
186
-      lv_label_set_text(labelSpeed, extrude_menu.low);
187
-      lv_obj_align(labelSpeed, buttonSpeed, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
188
-    }
189
-    else {
190
-      lv_label_set_text(labelSpeed, extrude_menu.normal);
191
-      lv_obj_align(labelSpeed, buttonSpeed, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
174
+    switch (uiCfg.extruSpeed) {
175
+      case uiCfg.eSpeedH: lv_label_set_text(labelSpeed, extrude_menu.high);   break;
176
+      case uiCfg.eSpeedL: lv_label_set_text(labelSpeed, extrude_menu.low);    break;
177
+      case uiCfg.eSpeedN: lv_label_set_text(labelSpeed, extrude_menu.normal); break;
192
     }
178
     }
179
+    lv_obj_align(labelSpeed, buttonSpeed, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
193
   }
180
   }
194
 }
181
 }
195
 
182
 
221
 }
208
 }
222
 
209
 
223
 void disp_ext_step() {
210
 void disp_ext_step() {
224
-  if (uiCfg.extruStep == 1)
225
-    lv_imgbtn_set_src_both(buttonStep, "F:/bmp_step1_mm.bin");
226
-  else if (uiCfg.extruStep == 5)
227
-    lv_imgbtn_set_src_both(buttonStep, "F:/bmp_step5_mm.bin");
228
-  else if (uiCfg.extruStep == 10)
229
-    lv_imgbtn_set_src_both(buttonStep, "F:/bmp_step10_mm.bin");
211
+  char buf3[12];
212
+  sprintf_P(buf3, PSTR("%dmm"), uiCfg.extruStep);
213
+
214
+  switch (uiCfg.extruStep) {
215
+    case uiCfg.eStepMin: lv_imgbtn_set_src_both(buttonStep, "F:/bmp_step1_mm.bin");  break;
216
+    case uiCfg.eStepMed: lv_imgbtn_set_src_both(buttonStep, "F:/bmp_step5_mm.bin");  break;
217
+    case uiCfg.eStepMax: lv_imgbtn_set_src_both(buttonStep, "F:/bmp_step10_mm.bin"); break;
218
+  }
230
 
219
 
231
   if (gCfgItems.multiple_language) {
220
   if (gCfgItems.multiple_language) {
232
-    if (uiCfg.extruStep == 1) {
233
-      lv_label_set_text(labelStep, extrude_menu.step_1mm);
234
-      lv_obj_align(labelStep, buttonStep, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
235
-    }
236
-    else if (uiCfg.extruStep == 5) {
237
-      lv_label_set_text(labelStep, extrude_menu.step_5mm);
238
-      lv_obj_align(labelStep, buttonStep, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
239
-    }
240
-    else if (uiCfg.extruStep == 10) {
241
-      lv_label_set_text(labelStep, extrude_menu.step_10mm);
242
-      lv_obj_align(labelStep, buttonStep, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
221
+    switch (uiCfg.extruStep) {
222
+      case uiCfg.eStepMin: lv_label_set_text(labelStep, buf3); break;
223
+      case uiCfg.eStepMed: lv_label_set_text(labelStep, buf3); break;
224
+      case uiCfg.eStepMax: lv_label_set_text(labelStep, buf3); break;
243
     }
225
     }
226
+    lv_obj_align(labelStep, buttonStep, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
244
   }
227
   }
245
 }
228
 }
246
 
229
 
247
 void lv_clear_extrusion() {
230
 void lv_clear_extrusion() {
248
-  #if HAS_ROTARY_ENCODER
249
-    if (gCfgItems.encoder_enable) lv_group_remove_all_objs(g);
250
-  #endif
231
+  if (TERN0(HAS_ROTARY_ENCODER, gCfgItems.encoder_enable))
232
+    lv_group_remove_all_objs(g);
251
   lv_obj_del(scr);
233
   lv_obj_del(scr);
252
 }
234
 }
253
 
235
 

+ 6
- 9
Marlin/src/lcd/extui/mks_ui/draw_ui.cpp ファイルの表示

186
   uiCfg.stepHeat            = 10;
186
   uiCfg.stepHeat            = 10;
187
   uiCfg.leveling_first_time = false;
187
   uiCfg.leveling_first_time = false;
188
   uiCfg.para_ui_page        = false;
188
   uiCfg.para_ui_page        = false;
189
-  uiCfg.extruStep           = 5;
190
-  uiCfg.extruSpeed          = 10;
189
+  uiCfg.extruStep           = uiCfg.eStepMed;
190
+  uiCfg.extruSpeed          = uiCfg.eSpeedN;
191
   uiCfg.move_dist           = 1;
191
   uiCfg.move_dist           = 1;
192
-  uiCfg.moveSpeed           = 3000;
192
+  uiCfg.moveSpeed           = 1000;
193
   uiCfg.stepPrintSpeed      = 10;
193
   uiCfg.stepPrintSpeed      = 10;
194
   uiCfg.command_send        = false;
194
   uiCfg.command_send        = false;
195
   uiCfg.dialogType          = 0;
195
   uiCfg.dialogType          = 0;
609
             gPicturePreviewStart += (uintptr_t)p1 - (uintptr_t)((uint32_t *)(&public_buf[0]));
609
             gPicturePreviewStart += (uintptr_t)p1 - (uintptr_t)((uint32_t *)(&public_buf[0]));
610
             break;
610
             break;
611
           }
611
           }
612
-          else {
612
+          else
613
             gPicturePreviewStart += br;
613
             gPicturePreviewStart += br;
614
-          }
614
+
615
           if (br < 400) break;
615
           if (br < 400) break;
616
         }
616
         }
617
       }
617
       }
623
 
623
 
624
       while (1) {
624
       while (1) {
625
         card.read(public_buf, 400);
625
         card.read(public_buf, 400);
626
-        for (i = 0; i < 400;) {
626
+        for (i = 0; i < 400; i += 2, j++)
627
           bmp_public_buf[j] = ascii2dec_test((char*)&public_buf[i]) << 4 | ascii2dec_test((char*)&public_buf[i + 1]);
627
           bmp_public_buf[j] = ascii2dec_test((char*)&public_buf[i]) << 4 | ascii2dec_test((char*)&public_buf[i + 1]);
628
-          i                += 2;
629
-          j++;
630
-        }
631
         if (j >= 400) break;
628
         if (j >= 400) break;
632
       }
629
       }
633
       for (i = 0; i < 400; i += 2) {
630
       for (i = 0; i < 400; i += 2) {

+ 9
- 1
Marlin/src/lcd/extui/mks_ui/draw_ui.h ファイルの表示

208
   uint32_t  curFilesize;
208
   uint32_t  curFilesize;
209
 } CFG_ITMES;
209
 } CFG_ITMES;
210
 
210
 
211
-typedef struct {
211
+typedef struct UI_Config_Struct {
212
   uint8_t curTempType:1,
212
   uint8_t curTempType:1,
213
           extruderIndex:3,
213
           extruderIndex:3,
214
           stepHeat:4,
214
           stepHeat:4,
228
   uint8_t wifi_name[32];
228
   uint8_t wifi_name[32];
229
   uint8_t wifi_key[64];
229
   uint8_t wifi_key[64];
230
   uint8_t cloud_hostUrl[96];
230
   uint8_t cloud_hostUrl[96];
231
+  // Extruder Steps distances (mm)
231
   uint8_t extruStep;
232
   uint8_t extruStep;
233
+  static constexpr uint8_t eStepMin =  1,
234
+                           eStepMed =  5,
235
+                           eStepMax = 10;
236
+  // Extruder speed (mm/s)
232
   uint8_t extruSpeed;
237
   uint8_t extruSpeed;
238
+  static constexpr uint8_t eSpeedH =  1,
239
+                           eSpeedN = 10,
240
+                           eSpeedL = 20;
233
   uint8_t print_state;
241
   uint8_t print_state;
234
   uint8_t stepPrintSpeed;
242
   uint8_t stepPrintSpeed;
235
   uint8_t waitEndMoves;
243
   uint8_t waitEndMoves;

+ 7
- 13
Marlin/src/lcd/extui/mks_ui/wifi_module.cpp ファイルの表示

1445
 
1445
 
1446
   ZERO(FileName_unicode);
1446
   ZERO(FileName_unicode);
1447
 
1447
 
1448
-  while (1) {
1448
+  for (;;) {
1449
     char_byte_num = source[i] & 0xF0;
1449
     char_byte_num = source[i] & 0xF0;
1450
-    if (source[i] < 0x80) {
1451
-      //ASCII --1byte
1452
-      FileName_unicode[char_i] = source[i];
1453
-      i += 1;
1454
-      char_i += 1;
1450
+    if (source[i] < 0x80) { // ASCII -- 1 byte
1451
+      FileName_unicode[char_i++] = source[i++];
1455
     }
1452
     }
1456
-    else if (char_byte_num == 0xC0 || char_byte_num == 0xD0) {
1457
-      //--2byte
1453
+    else if (char_byte_num == 0xC0 || char_byte_num == 0xD0) { // -- 2 byte
1458
       u16_h = (((uint16_t)source[i] << 8) & 0x1F00) >> 2;
1454
       u16_h = (((uint16_t)source[i] << 8) & 0x1F00) >> 2;
1459
       u16_l = ((uint16_t)source[i + 1] & 0x003F);
1455
       u16_l = ((uint16_t)source[i + 1] & 0x003F);
1460
       u16_value = (u16_h | u16_l);
1456
       u16_value = (u16_h | u16_l);
1463
       i += 2;
1459
       i += 2;
1464
       char_i += 2;
1460
       char_i += 2;
1465
     }
1461
     }
1466
-    else if (char_byte_num == 0xE0) {
1467
-      //--3byte
1462
+    else if (char_byte_num == 0xE0) { // -- 3 byte
1468
       u16_h = (((uint16_t)source[i] << 8) & 0x0F00) << 4;
1463
       u16_h = (((uint16_t)source[i] << 8) & 0x0F00) << 4;
1469
       u16_m = (((uint16_t)source[i + 1] << 8) & 0x3F00) >> 2;
1464
       u16_m = (((uint16_t)source[i + 1] << 8) & 0x3F00) >> 2;
1470
       u16_l = ((uint16_t)source[i + 2] & 0x003F);
1465
       u16_l = ((uint16_t)source[i + 2] & 0x003F);
1474
       i += 3;
1469
       i += 3;
1475
       char_i += 2;
1470
       char_i += 2;
1476
     }
1471
     }
1477
-    else if (char_byte_num == 0xF0) {
1478
-      //--4byte
1472
+    else if (char_byte_num == 0xF0) { // -- 4 byte
1479
       i += 4;
1473
       i += 4;
1480
       //char_i += 3;
1474
       //char_i += 3;
1481
     }
1475
     }
1510
     TERN_(SDSUPPORT, card.mount());
1504
     TERN_(SDSUPPORT, card.mount());
1511
   }
1505
   }
1512
   else if (gCfgItems.fileSysType == FILE_SYS_USB) {
1506
   else if (gCfgItems.fileSysType == FILE_SYS_USB) {
1513
-
1507
+    // nothing
1514
   }
1508
   }
1515
   file_writer.write_index = 0;
1509
   file_writer.write_index = 0;
1516
   lastFragment = -1;
1510
   lastFragment = -1;

+ 1
- 1
buildroot/bin/mftest ファイルの表示

133
      t36) TESTENV='teensy35' ;;
133
      t36) TESTENV='teensy35' ;;
134
      t40) TESTENV='teensy41' ;;
134
      t40) TESTENV='teensy41' ;;
135
      t41) TESTENV='teensy41' ;;
135
      t41) TESTENV='teensy41' ;;
136
-[1-9][1-9]|[1-9]) TESTNUM=$TESTENV ; TESTENV=- ;;
136
+[1-9]|[1-9][0-9]) TESTNUM=$TESTENV ; TESTENV=- ;;
137
 esac
137
 esac
138
 
138
 
139
 if ((AUTO_BUILD)); then
139
 if ((AUTO_BUILD)); then

+ 16
- 16
buildroot/tests/mks_robin_nano35 ファイルの表示

15
 exec_test $1 $2 "MKS Robin nano v1.2 Emulated DOGM FSMC" "$3"
15
 exec_test $1 $2 "MKS Robin nano v1.2 Emulated DOGM FSMC" "$3"
16
 
16
 
17
 #
17
 #
18
-# MKS Robin v2 nano Emulated DOGM SPI
19
-# (Robin v2 nano has no FSMC interface)
18
+# MKS Robin nano v2 Emulated DOGM SPI
19
+# (Robin nano v2 has no FSMC interface)
20
 #
20
 #
21
 use_example_configs Mks/Robin
21
 use_example_configs Mks/Robin
22
 opt_set MOTHERBOARD BOARD_MKS_ROBIN_NANO_V2
22
 opt_set MOTHERBOARD BOARD_MKS_ROBIN_NANO_V2
23
 opt_disable TFT_INTERFACE_FSMC
23
 opt_disable TFT_INTERFACE_FSMC
24
 opt_enable TFT_INTERFACE_SPI MKS_WIFI_MODULE
24
 opt_enable TFT_INTERFACE_SPI MKS_WIFI_MODULE
25
 opt_add MKS_TEST
25
 opt_add MKS_TEST
26
-exec_test $1 $2 "MKS Robin v2 nano Emulated DOGM SPI, MKS_WIFI_MODULE" "$3"
26
+exec_test $1 $2 "MKS Robin nano v2 Emulated DOGM SPI, MKS_WIFI_MODULE" "$3"
27
 
27
 
28
 #
28
 #
29
 # MKS Robin nano v1.2 LVGL FSMC
29
 # MKS Robin nano v1.2 LVGL FSMC
35
 # exec_test $1 $2 "MKS Robin nano v1.2 LVGL FSMC" "$3"
35
 # exec_test $1 $2 "MKS Robin nano v1.2 LVGL FSMC" "$3"
36
 
36
 
37
 #
37
 #
38
-# MKS Robin v2 nano LVGL SPI
39
-# (Robin v2 nano has no FSMC interface)
38
+# MKS Robin nano v2 LVGL SPI
39
+# (Robin nano v2 has no FSMC interface)
40
 #
40
 #
41
 # use_example_configs Mks/Robin
41
 # use_example_configs Mks/Robin
42
 # opt_set MOTHERBOARD BOARD_MKS_ROBIN_NANO_V2
42
 # opt_set MOTHERBOARD BOARD_MKS_ROBIN_NANO_V2
43
 # opt_disable TFT_INTERFACE_FSMC TFT_COLOR_UI TOUCH_SCREEN TFT_RES_320x240
43
 # opt_disable TFT_INTERFACE_FSMC TFT_COLOR_UI TOUCH_SCREEN TFT_RES_320x240
44
 # opt_enable TFT_INTERFACE_SPI TFT_LVGL_UI TFT_RES_480x320
44
 # opt_enable TFT_INTERFACE_SPI TFT_LVGL_UI TFT_RES_480x320
45
-# exec_test $1 $2 "MKS Robin v2 nano LVGL SPI" "$3"
45
+# exec_test $1 $2 "MKS Robin nano v2 LVGL SPI" "$3"
46
 
46
 
47
 #
47
 #
48
-# MKS Robin v2 nano New Color UI 480x320 SPI
49
-# (Robin v2 nano has no FSMC interface)
48
+# MKS Robin nano v2 New Color UI 480x320 SPI
49
+# (Robin nano v2 has no FSMC interface)
50
 #
50
 #
51
 use_example_configs Mks/Robin
51
 use_example_configs Mks/Robin
52
 opt_set MOTHERBOARD BOARD_MKS_ROBIN_NANO_V2
52
 opt_set MOTHERBOARD BOARD_MKS_ROBIN_NANO_V2
53
 opt_disable TFT_INTERFACE_FSMC TFT_RES_320x240
53
 opt_disable TFT_INTERFACE_FSMC TFT_RES_320x240
54
 opt_enable TFT_INTERFACE_SPI TFT_RES_480x320
54
 opt_enable TFT_INTERFACE_SPI TFT_RES_480x320
55
-exec_test $1 $2 "MKS Robin v2 nano New Color UI 480x320 SPI" "$3"
55
+exec_test $1 $2 "MKS Robin nano v2 with New Color UI 480x320 SPI" "$3"
56
 
56
 
57
 #
57
 #
58
-# MKS Robin v2 nano LVGL SPI + TMC
59
-# (Robin v2 nano has no FSMC interface)
58
+# MKS Robin nano v2 LVGL SPI + TMC
59
+# (Robin nano v2 has no FSMC interface)
60
 #
60
 #
61
-# use_example_configs Mks/Robin
62
-# opt_set MOTHERBOARD BOARD_MKS_ROBIN_NANO_V2 X_DRIVER_TYPE TMC2209 Y_DRIVER_TYPE TMC2209
63
-# opt_disable TFT_INTERFACE_FSMC TFT_COLOR_UI TOUCH_SCREEN TFT_RES_320x240
64
-# opt_enable TFT_INTERFACE_SPI TFT_LVGL_UI TFT_RES_480x320
65
-# exec_test $1 $2 "MKS Robin v2 nano LVGL SPI + TMC" "$3"
61
+use_example_configs Mks/Robin
62
+opt_set MOTHERBOARD BOARD_MKS_ROBIN_NANO_V2 X_DRIVER_TYPE TMC2209 Y_DRIVER_TYPE TMC2209
63
+opt_disable TFT_INTERFACE_FSMC TFT_COLOR_UI TOUCH_SCREEN TFT_RES_320x240
64
+opt_enable TFT_INTERFACE_SPI TFT_LVGL_UI TFT_RES_480x320
65
+exec_test $1 $2 "MKS Robin nano v2 LVGL SPI + TMC" "$3"
66
 
66
 
67
 # cleanup
67
 # cleanup
68
 restore_configs
68
 restore_configs

読み込み中…
キャンセル
保存