Browse Source

Robin nano V2, TFT LVGL UI parameters, and more (#18500)

MKS-Sean 3 years ago
parent
commit
d20d459132
90 changed files with 11716 additions and 4179 deletions
  1. 12
    9
      Marlin/Configuration.h
  2. 3
    3
      Marlin/Version.h
  3. 6
    5
      Marlin/src/MarlinCore.cpp
  4. 25
    24
      Marlin/src/core/boards.h
  5. 6
    1
      Marlin/src/inc/Conditionals_LCD.h
  6. 6
    2
      Marlin/src/inc/SanityCheck.h
  7. 272
    205
      Marlin/src/lcd/extui/lib/mks_ui/SPI_TFT.cpp
  8. 2
    0
      Marlin/src/lcd/extui/lib/mks_ui/SPI_TFT.h
  9. 3
    3
      Marlin/src/lcd/extui/lib/mks_ui/W25Qxx.cpp
  10. 12
    15
      Marlin/src/lcd/extui/lib/mks_ui/W25Qxx.h
  11. 11
    11
      Marlin/src/lcd/extui/lib/mks_ui/draw_about.cpp
  12. 483
    0
      Marlin/src/lcd/extui/lib/mks_ui/draw_acceleration_settings.cpp
  13. 33
    0
      Marlin/src/lcd/extui/lib/mks_ui/draw_acceleration_settings.h
  14. 140
    0
      Marlin/src/lcd/extui/lib/mks_ui/draw_advance_settings.cpp
  15. 33
    0
      Marlin/src/lcd/extui/lib/mks_ui/draw_advance_settings.h
  16. 37
    38
      Marlin/src/lcd/extui/lib/mks_ui/draw_change_speed.cpp
  17. 111
    84
      Marlin/src/lcd/extui/lib/mks_ui/draw_dialog.cpp
  18. 5
    1
      Marlin/src/lcd/extui/lib/mks_ui/draw_dialog.h
  19. 237
    0
      Marlin/src/lcd/extui/lib/mks_ui/draw_eeprom_settings.cpp
  20. 33
    0
      Marlin/src/lcd/extui/lib/mks_ui/draw_eeprom_settings.h
  21. 11
    7
      Marlin/src/lcd/extui/lib/mks_ui/draw_error_message.cpp
  22. 48
    49
      Marlin/src/lcd/extui/lib/mks_ui/draw_extrusion.cpp
  23. 35
    32
      Marlin/src/lcd/extui/lib/mks_ui/draw_fan.cpp
  24. 35
    48
      Marlin/src/lcd/extui/lib/mks_ui/draw_home.cpp
  25. 263
    0
      Marlin/src/lcd/extui/lib/mks_ui/draw_jerk_settings.cpp
  26. 33
    0
      Marlin/src/lcd/extui/lib/mks_ui/draw_jerk_settings.h
  27. 75
    77
      Marlin/src/lcd/extui/lib/mks_ui/draw_language.cpp
  28. 232
    0
      Marlin/src/lcd/extui/lib/mks_ui/draw_machine_para.cpp
  29. 33
    0
      Marlin/src/lcd/extui/lib/mks_ui/draw_machine_para.h
  30. 241
    0
      Marlin/src/lcd/extui/lib/mks_ui/draw_machine_settings.cpp
  31. 33
    0
      Marlin/src/lcd/extui/lib/mks_ui/draw_machine_settings.h
  32. 62
    65
      Marlin/src/lcd/extui/lib/mks_ui/draw_manuaLevel.cpp
  33. 359
    0
      Marlin/src/lcd/extui/lib/mks_ui/draw_max_feedrate_settings.cpp
  34. 33
    0
      Marlin/src/lcd/extui/lib/mks_ui/draw_max_feedrate_settings.h
  35. 247
    0
      Marlin/src/lcd/extui/lib/mks_ui/draw_motor_settings.cpp
  36. 33
    0
      Marlin/src/lcd/extui/lib/mks_ui/draw_motor_settings.h
  37. 65
    70
      Marlin/src/lcd/extui/lib/mks_ui/draw_move_motor.cpp
  38. 799
    0
      Marlin/src/lcd/extui/lib/mks_ui/draw_number_key.cpp
  39. 33
    0
      Marlin/src/lcd/extui/lib/mks_ui/draw_number_key.h
  40. 72
    68
      Marlin/src/lcd/extui/lib/mks_ui/draw_operation.cpp
  41. 2
    2
      Marlin/src/lcd/extui/lib/mks_ui/draw_operation.h
  42. 2
    2
      Marlin/src/lcd/extui/lib/mks_ui/draw_pause_message.cpp
  43. 222
    0
      Marlin/src/lcd/extui/lib/mks_ui/draw_pause_position.cpp
  44. 33
    0
      Marlin/src/lcd/extui/lib/mks_ui/draw_pause_position.h
  45. 62
    67
      Marlin/src/lcd/extui/lib/mks_ui/draw_preHeat.cpp
  46. 129
    127
      Marlin/src/lcd/extui/lib/mks_ui/draw_print_file.cpp
  47. 112
    112
      Marlin/src/lcd/extui/lib/mks_ui/draw_printing.cpp
  48. 179
    162
      Marlin/src/lcd/extui/lib/mks_ui/draw_ready_print.cpp
  49. 1
    1
      Marlin/src/lcd/extui/lib/mks_ui/draw_ready_print.h
  50. 85
    41
      Marlin/src/lcd/extui/lib/mks_ui/draw_set.cpp
  51. 358
    0
      Marlin/src/lcd/extui/lib/mks_ui/draw_step_settings.cpp
  52. 33
    0
      Marlin/src/lcd/extui/lib/mks_ui/draw_step_settings.h
  53. 385
    0
      Marlin/src/lcd/extui/lib/mks_ui/draw_tmc_current_settings.cpp
  54. 34
    0
      Marlin/src/lcd/extui/lib/mks_ui/draw_tmc_current_settings.h
  55. 478
    0
      Marlin/src/lcd/extui/lib/mks_ui/draw_tmc_step_mode_settings.cpp
  56. 33
    0
      Marlin/src/lcd/extui/lib/mks_ui/draw_tmc_step_mode_settings.h
  57. 57
    60
      Marlin/src/lcd/extui/lib/mks_ui/draw_tool.cpp
  58. 616
    351
      Marlin/src/lcd/extui/lib/mks_ui/draw_ui.cpp
  59. 111
    16
      Marlin/src/lcd/extui/lib/mks_ui/draw_ui.h
  60. 8
    8
      Marlin/src/lcd/extui/lib/mks_ui/gb2312_puhui16.cpp
  61. 106
    74
      Marlin/src/lcd/extui/lib/mks_ui/mks_hardware_test.cpp
  62. 7
    5
      Marlin/src/lcd/extui/lib/mks_ui/mks_hardware_test.h
  63. 130
    147
      Marlin/src/lcd/extui/lib/mks_ui/pic_manager.cpp
  64. 46
    37
      Marlin/src/lcd/extui/lib/mks_ui/pic_manager.h
  65. 217
    0
      Marlin/src/lcd/extui/lib/mks_ui/printer_operation.cpp
  66. 0
    0
      Marlin/src/lcd/extui/lib/mks_ui/printer_operation.h
  67. 0
    209
      Marlin/src/lcd/extui/lib/mks_ui/printer_opration.cpp
  68. 53
    23
      Marlin/src/lcd/extui/lib/mks_ui/tft_Language_en.h
  69. 35
    25
      Marlin/src/lcd/extui/lib/mks_ui/tft_Language_fr.h
  70. 224
    214
      Marlin/src/lcd/extui/lib/mks_ui/tft_Language_it.h
  71. 23
    13
      Marlin/src/lcd/extui/lib/mks_ui/tft_Language_ru.h
  72. 228
    13
      Marlin/src/lcd/extui/lib/mks_ui/tft_Language_s_cn.h
  73. 29
    19
      Marlin/src/lcd/extui/lib/mks_ui/tft_Language_sp.h
  74. 480
    0
      Marlin/src/lcd/extui/lib/mks_ui/tft_Language_t_cn.h
  75. 2
    2
      Marlin/src/lcd/extui/lib/mks_ui/tft_fsmc.cpp
  76. 85
    101
      Marlin/src/lcd/extui/lib/mks_ui/tft_lvgl_configuration.cpp
  77. 1
    1
      Marlin/src/lcd/extui/lib/mks_ui/tft_lvgl_configuration.h
  78. 2139
    1428
      Marlin/src/lcd/extui/lib/mks_ui/tft_multi_language.cpp
  79. 274
    10
      Marlin/src/lcd/extui/lib/mks_ui/tft_multi_language.h
  80. 1
    5
      Marlin/src/module/motion.cpp
  81. 1
    1
      Marlin/src/module/stepper.cpp
  82. 2
    2
      Marlin/src/module/stepper/indirection.h
  83. 3
    1
      Marlin/src/pins/pins.h
  84. 8
    3
      Marlin/src/pins/sam/pins_RADDS.h
  85. 2
    1
      Marlin/src/pins/stm32f1/pins_CHITU3D_V5.h
  86. 2
    1
      Marlin/src/pins/stm32f1/pins_CHITU3D_V6.h
  87. 77
    73
      Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO.h
  88. 325
    0
      Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_V2.h
  89. 46
    0
      buildroot/share/PlatformIO/scripts/download_mks_assets.py
  90. 18
    5
      platformio.ini

+ 12
- 9
Marlin/Configuration.h View File

@@ -135,7 +135,7 @@
135 135
 //#define CUSTOM_MACHINE_NAME "3D Printer"
136 136
 
137 137
 // Printer's unique ID, used by some programs to differentiate between machines.
138
-// Choose your own or use a service like http://www.uuidgenerator.net/version4
138
+// Choose your own or use a service like https://www.uuidgenerator.net/version4
139 139
 //#define MACHINE_UUID "00000000-0000-0000-0000-000000000000"
140 140
 
141 141
 // @section extruder
@@ -2148,21 +2148,24 @@
2148 2148
 //
2149 2149
 // TFT LVGL UI
2150 2150
 //
2151
-// Default MKS icons and fonts: https://git.io/JJvzK
2152
-// Copy mks_pic and mks_font folders to the root of your SD
2151
+// Using default MKS icons and fonts from: https://git.io/JJvzK
2152
+// Just copy the `assets` folder from the build directory to the
2153
+// root of your SD card, together with the compiled firmware.
2153 2154
 //
2154
-//#define TFT_LVGL_UI
2155
+// Robin nano v1.2 uses FSMC
2156
+//
2157
+//#define TFT_LVGL_UI_FSMC
2158
+
2159
+// Robin nano v2.0 uses SPI
2160
+//
2161
+//#define TFT_LVGL_UI_SPI
2162
+
2155 2163
 
2156 2164
 //=============================================================================
2157 2165
 //============================  Other Controllers  ============================
2158 2166
 //=============================================================================
2159 2167
 
2160 2168
 //
2161
-// Robin nano v2.0 SPI touch screen
2162
-//
2163
-//#define SPI_GRAPHICAL_TFT
2164
-
2165
-//
2166 2169
 // Ender-3 v2 OEM display. A DWIN display with Rotary Encoder.
2167 2170
 //
2168 2171
 //#define DWIN_CREALITY_LCD

+ 3
- 3
Marlin/Version.h View File

@@ -71,6 +71,6 @@
71 71
  * Set the vendor info the serial USB interface, if changable
72 72
  * Currently only supported by DUE platform
73 73
  */
74
-//#define  USB_DEVICE_VENDOR_ID           0x0000
75
-//#define  USB_DEVICE_PRODUCT_ID          0x0000
76
-//#define  USB_DEVICE_MANUFACTURE_NAME    WEBSITE_URL
74
+//#define USB_DEVICE_VENDOR_ID           0x0000
75
+//#define USB_DEVICE_PRODUCT_ID          0x0000
76
+//#define USB_DEVICE_MANUFACTURE_NAME    WEBSITE_URL

+ 6
- 5
Marlin/src/MarlinCore.cpp View File

@@ -59,10 +59,11 @@
59 59
 #include "gcode/parser.h"
60 60
 #include "gcode/queue.h"
61 61
 
62
-#if ENABLED(TFT_LVGL_UI)
63
-  #include "lvgl.h"
62
+#if HAS_TFT_LVGL_UI
64 63
   #include "lcd/extui/lib/mks_ui/tft_lvgl_configuration.h"
65 64
   #include "lcd/extui/lib/mks_ui/draw_ui.h"
65
+  #include "lcd/extui/lib/mks_ui/mks_hardware_test.h"
66
+  #include <lvgl.h>
66 67
 #endif
67 68
 
68 69
 #if ENABLED(DWIN_CREALITY_LCD)
@@ -755,7 +756,7 @@ void idle(TERN_(ADVANCED_PAUSE_FEATURE, bool no_stepper_sleep/*=false*/)) {
755 756
   // Direct Stepping
756 757
   TERN_(DIRECT_STEPPING, page_manager.write_responses());
757 758
 
758
-  #if ENABLED(TFT_LVGL_UI)
759
+  #if HAS_TFT_LVGL_UI
759 760
     LV_TASK_HANDLER();
760 761
   #endif
761 762
 }
@@ -1192,7 +1193,7 @@ void setup() {
1192 1193
     SETUP_RUN(page_manager.init());
1193 1194
   #endif
1194 1195
 
1195
-  #if ENABLED(TFT_LVGL_UI)
1196
+  #if HAS_TFT_LVGL_UI
1196 1197
     if (!card.isMounted()) SETUP_RUN(card.mount()); // Mount SD to load graphics and fonts
1197 1198
     SETUP_RUN(tft_lvgl_init());
1198 1199
   #endif
@@ -1229,7 +1230,7 @@ void loop() {
1229 1230
 
1230 1231
     endstops.event_handler();
1231 1232
 
1232
-    TERN_(TFT_LVGL_UI, printer_state_polling());
1233
+    TERN_(HAS_TFT_LVGL_UI, printer_state_polling());
1233 1234
 
1234 1235
   } while (ENABLED(__AVR__)); // Loop forever on slower (AVR) boards
1235 1236
 }

+ 25
- 24
Marlin/src/core/boards.h View File

@@ -288,30 +288,31 @@
288 288
 #define BOARD_MKS_ROBIN               4007  // MKS Robin (STM32F103ZET6)
289 289
 #define BOARD_MKS_ROBIN_MINI          4008  // MKS Robin Mini (STM32F103VET6)
290 290
 #define BOARD_MKS_ROBIN_NANO          4009  // MKS Robin Nano (STM32F103VET6)
291
-#define BOARD_MKS_ROBIN_LITE          4010  // MKS Robin Lite/Lite2 (STM32F103RCT6)
292
-#define BOARD_MKS_ROBIN_LITE3         4011  // MKS Robin Lite3 (STM32F103RCT6)
293
-#define BOARD_MKS_ROBIN_PRO           4012  // MKS Robin Pro (STM32F103ZET6)
294
-#define BOARD_BTT_SKR_MINI_V1_1       4013  // BigTreeTech SKR Mini v1.1 (STM32F103RC)
295
-#define BOARD_BTT_SKR_MINI_E3_V1_0    4014  // BigTreeTech SKR Mini E3 (STM32F103RC)
296
-#define BOARD_BTT_SKR_MINI_E3_V1_2    4015  // BigTreeTech SKR Mini E3 V1.2 (STM32F103RC)
297
-#define BOARD_BTT_SKR_MINI_E3_V2_0    4016  // BigTreeTech SKR Mini E3 V2.0 (STM32F103RC)
298
-#define BOARD_BTT_SKR_E3_DIP          4017  // BigTreeTech SKR E3 DIP V1.0 (STM32F103RC / STM32F103RE)
299
-#define BOARD_JGAURORA_A5S_A1         4018  // JGAurora A5S A1 (STM32F103ZET6)
300
-#define BOARD_FYSETC_AIO_II           4019  // FYSETC AIO_II
301
-#define BOARD_FYSETC_CHEETAH          4020  // FYSETC Cheetah
302
-#define BOARD_FYSETC_CHEETAH_V12      4021  // FYSETC Cheetah V1.2
303
-#define BOARD_LONGER3D_LK             4022  // Alfawise U20/U20+/U30 (Longer3D LK1/2) / STM32F103VET6
304
-#define BOARD_GTM32_MINI              4023  // STM32F103VET6 controller
305
-#define BOARD_GTM32_MINI_A30          4024  // STM32F103VET6 controller
306
-#define BOARD_GTM32_REV_B             4025  // STM32F103VET6 controller
307
-#define BOARD_MKS_ROBIN_E3D           4026  // MKS Robin E3D (STM32F103RCT6)
308
-#define BOARD_MKS_ROBIN_E3            4027  // MKS Robin E3 (STM32F103RCT6)
309
-#define BOARD_MALYAN_M300             4028  // STM32F070-based delta
310
-#define BOARD_CCROBOT_MEEB_3DP        4029  // ccrobot-online.com MEEB_3DP (STM32F103RC)
311
-#define BOARD_CHITU3D_V5              4030  // Chitu3D TronXY X5SA V5 Board
312
-#define BOARD_CHITU3D_V6              4031  // Chitu3D TronXY X5SA V5 Board
313
-#define BOARD_CREALITY_V4             4032  // Creality v4.x (STM32F103RE)
314
-#define BOARD_TRIGORILLA_PRO          4033  // Trigorilla Pro (STM32F103ZET6)
291
+#define BOARD_MKS_ROBIN_NANO_V2       4010  // MKS Robin Nano V2 (STM32F103VET6)
292
+#define BOARD_MKS_ROBIN_LITE          4011  // MKS Robin Lite/Lite2 (STM32F103RCT6)
293
+#define BOARD_MKS_ROBIN_LITE3         4012  // MKS Robin Lite3 (STM32F103RCT6)
294
+#define BOARD_MKS_ROBIN_PRO           4013  // MKS Robin Pro (STM32F103ZET6)
295
+#define BOARD_BTT_SKR_MINI_V1_1       4014  // BigTreeTech SKR Mini v1.1 (STM32F103RC)
296
+#define BOARD_BTT_SKR_MINI_E3_V1_0    4015  // BigTreeTech SKR Mini E3 (STM32F103RC)
297
+#define BOARD_BTT_SKR_MINI_E3_V1_2    4016  // BigTreeTech SKR Mini E3 V1.2 (STM32F103RC)
298
+#define BOARD_BTT_SKR_MINI_E3_V2_0    4017  // BigTreeTech SKR Mini E3 V2.0 (STM32F103RC)
299
+#define BOARD_BTT_SKR_E3_DIP          4018  // BigTreeTech SKR E3 DIP V1.0 (STM32F103RC / STM32F103RE)
300
+#define BOARD_JGAURORA_A5S_A1         4019  // JGAurora A5S A1 (STM32F103ZET6)
301
+#define BOARD_FYSETC_AIO_II           4020  // FYSETC AIO_II
302
+#define BOARD_FYSETC_CHEETAH          4021  // FYSETC Cheetah
303
+#define BOARD_FYSETC_CHEETAH_V12      4022  // FYSETC Cheetah V1.2
304
+#define BOARD_LONGER3D_LK             4023  // Alfawise U20/U20+/U30 (Longer3D LK1/2) / STM32F103VET6
305
+#define BOARD_GTM32_MINI              4024  // STM32F103VET6 controller
306
+#define BOARD_GTM32_MINI_A30          4025  // STM32F103VET6 controller
307
+#define BOARD_GTM32_REV_B             4026  // STM32F103VET6 controller
308
+#define BOARD_MKS_ROBIN_E3D           4027  // MKS Robin E3D (STM32F103RCT6)
309
+#define BOARD_MKS_ROBIN_E3            4028  // MKS Robin E3 (STM32F103RCT6)
310
+#define BOARD_MALYAN_M300             4029  // STM32F070-based delta
311
+#define BOARD_CCROBOT_MEEB_3DP        4030  // ccrobot-online.com MEEB_3DP (STM32F103RC)
312
+#define BOARD_CHITU3D_V5              4031  // Chitu3D TronXY X5SA V5 Board
313
+#define BOARD_CHITU3D_V6              4032  // Chitu3D TronXY X5SA V5 Board
314
+#define BOARD_CREALITY_V4             4033  // Creality v4.x (STM32F103RE)
315
+#define BOARD_TRIGORILLA_PRO          4034  // Trigorilla Pro (STM32F103ZET6)
315 316
 
316 317
 //
317 318
 // ARM Cortex-M4F

+ 6
- 1
Marlin/src/inc/Conditionals_LCD.h View File

@@ -255,12 +255,17 @@
255 255
   #define IS_ULTIPANEL
256 256
 #endif
257 257
 
258
+// LVGL UI, SPI or FSMC
259
+#if EITHER(TFT_LVGL_UI_SPI, TFT_LVGL_UI_FSMC)
260
+  #define HAS_TFT_LVGL_UI 1
261
+#endif
262
+
258 263
 // FSMC/SPI TFT Panels
259 264
 #if ENABLED(FSMC_GRAPHICAL_TFT)
260 265
   #define DOGLCD
261 266
   #define IS_ULTIPANEL
262 267
   #define DELAYED_BACKLIGHT_INIT
263
-#elif ENABLED(SPI_GRAPHICAL_TFT)
268
+#elif ENABLED(TFT_LVGL_UI_SPI)
264 269
   #define DELAYED_BACKLIGHT_INIT
265 270
 #endif
266 271
 

+ 6
- 2
Marlin/src/inc/SanityCheck.h View File

@@ -449,6 +449,10 @@
449 449
   #error "POWER_SUPPLY is now obsolete. Please remove it from Configuration.h."
450 450
 #elif defined(MKS_ROBIN_TFT)
451 451
   #error "MKS_ROBIN_TFT is now FSMC_GRAPHICAL_TFT. Please update your configuration."
452
+#elif defined(TFT_LVGL_UI)
453
+  #error "TFT_LVGL_UI is now TFT_LVGL_UI_FSMC. Please update your configuration."
454
+#elif defined(SPI_GRAPHICAL_TFT)
455
+  #error "SPI_GRAPHICAL_TFT is now TFT_LVGL_UI_SPI. Please update your configuration."
452 456
 #elif defined(SDPOWER)
453 457
   #error "SDPOWER is now SDPOWER_PIN. Please update your configuration and/or pins."
454 458
 #elif defined(STRING_SPLASH_LINE1) || defined(STRING_SPLASH_LINE2)
@@ -2217,8 +2221,8 @@ static_assert(hbm[Z_AXIS] >= 0, "HOMING_BUMP_MM.Z must be greater than or equal
2217 2221
   + ENABLED(MALYAN_LCD) \
2218 2222
   + ENABLED(TOUCH_UI_FTDI_EVE) \
2219 2223
   + ENABLED(FSMC_GRAPHICAL_TFT) \
2220
-  + ENABLED(TFT_LVGL_UI) \
2221
-  + ENABLED(SPI_GRAPHICAL_TFT)
2224
+  + ENABLED(TFT_LVGL_UI_FSMC) \
2225
+  + ENABLED(TFT_LVGL_UI_SPI)
2222 2226
   #error "Please select no more than one LCD controller option."
2223 2227
 #endif
2224 2228
 

+ 272
- 205
Marlin/src/lcd/extui/lib/mks_ui/SPI_TFT.cpp View File

@@ -22,69 +22,72 @@
22 22
 
23 23
 #include "../../../../inc/MarlinConfigPre.h"
24 24
 
25
-#if ENABLED(SPI_GRAPHICAL_TFT)
25
+#if ENABLED(TFT_LVGL_UI_SPI)
26 26
 
27
-  #include <SPI.h>
28
-  #include "../../../../inc/MarlinConfig.h"
29
-  #include "SPI_TFT.h"
27
+#include "SPI_TFT.h"
28
+#include "pic_manager.h"
30 29
 
31
-  TFT SPI_TFT;
30
+#include "../../../../inc/MarlinConfig.h"
32 31
 
33
-  #ifndef SPI_TFT_MISO_PIN
34
-    #define SPI_TFT_MISO_PIN PA6
35
-  #endif
36
-  #ifndef SPI_TFT_MOSI_PIN
37
-    #define SPI_TFT_MOSI_PIN PA7
38
-  #endif
39
-  #ifndef SPI_TFT_SCK_PIN
40
-    #define SPI_TFT_SCK_PIN  PA5
41
-  #endif
42
-  #ifndef SPI_TFT_CS_PIN
43
-    #define SPI_TFT_CS_PIN   PD11
44
-  #endif
45
-  #ifndef SPI_TFT_DC_PIN
46
-    #define SPI_TFT_DC_PIN   PD10
47
-  #endif
48
-  #ifndef SPI_TFT_RST_PIN
49
-    #define SPI_TFT_RST_PIN   PC6
50
-  #endif
32
+#include <SPI.h>
33
+
34
+TFT SPI_TFT;
35
+
36
+#ifndef SPI_TFT_MISO_PIN
37
+  #define SPI_TFT_MISO_PIN PA6
38
+#endif
39
+#ifndef SPI_TFT_MOSI_PIN
40
+  #define SPI_TFT_MOSI_PIN PA7
41
+#endif
42
+#ifndef SPI_TFT_SCK_PIN
43
+  #define SPI_TFT_SCK_PIN  PA5
44
+#endif
45
+#ifndef SPI_TFT_CS_PIN
46
+  #define SPI_TFT_CS_PIN   PD11
47
+#endif
48
+#ifndef SPI_TFT_DC_PIN
49
+  #define SPI_TFT_DC_PIN   PD10
50
+#endif
51
+#ifndef SPI_TFT_RST_PIN
52
+  #define SPI_TFT_RST_PIN  PC6
53
+#endif
51 54
 
52 55
 // use SPI1 for the spi tft.
53
-  void TFT::spi_init(uint8_t spiRate) {
54
-
55
-    SPI_TFT_CS_H;
56
-
57
-    /**
58
-     * STM32F1 APB2 = 72MHz, APB1 = 36MHz, max SPI speed of this MCU if 18Mhz
59
-     * STM32F1 has 3 SPI ports, SPI1 in APB2, SPI2/SPI3 in APB1
60
-     * so the minimum prescale of SPI1 is DIV4, SPI2/SPI3 is DIV2
61
-     */
62
-    uint8_t clock;
63
-    switch (spiRate) {
64
-      case SPI_FULL_SPEED:    clock = SPI_CLOCK_DIV4;  break;
65
-      case SPI_HALF_SPEED:    clock = SPI_CLOCK_DIV4; break;
66
-      case SPI_QUARTER_SPEED: clock = SPI_CLOCK_DIV8; break;
67
-      case SPI_EIGHTH_SPEED:  clock = SPI_CLOCK_DIV16; break;
68
-      case SPI_SPEED_5:       clock = SPI_CLOCK_DIV32; break;
69
-      case SPI_SPEED_6:       clock = SPI_CLOCK_DIV64; break;
70
-      default:                clock = SPI_CLOCK_DIV2;        // Default from the SPI library
71
-    }
72
-    SPI.setModule(1);
73
-    SPI.begin();
74
-    SPI.setClockDivider(clock);
75
-    SPI.setBitOrder(MSBFIRST);
76
-    SPI.setDataMode(SPI_MODE0);
77
-  }
56
+void TFT::spi_init(uint8_t spiRate) {
78 57
 
79
-  uint8_t TFT::spi_Rec() {
80
-    uint8_t returnByte = SPI.transfer(ff);
81
-    return returnByte;
82
-  }
58
+  SPI_TFT_CS_H;
83 59
 
84
-  uint8_t TFT::spi_read_write_byte(uint8_t data) {
85
-    uint8_t returnByte = SPI.transfer(data);
86
-    return returnByte;
60
+  /**
61
+   * STM32F1 APB2 = 72MHz, APB1 = 36MHz, max SPI speed of this MCU if 18Mhz
62
+   * STM32F1 has 3 SPI ports, SPI1 in APB2, SPI2/SPI3 in APB1
63
+   * so the minimum prescale of SPI1 is DIV4, SPI2/SPI3 is DIV2
64
+   */
65
+  uint8_t clock;
66
+  switch (spiRate) {
67
+    case SPI_FULL_SPEED:    clock = SPI_CLOCK_DIV4;  break;
68
+    case SPI_HALF_SPEED:    clock = SPI_CLOCK_DIV4; break;
69
+    case SPI_QUARTER_SPEED: clock = SPI_CLOCK_DIV8; break;
70
+    case SPI_EIGHTH_SPEED:  clock = SPI_CLOCK_DIV16; break;
71
+    case SPI_SPEED_5:       clock = SPI_CLOCK_DIV32; break;
72
+    case SPI_SPEED_6:       clock = SPI_CLOCK_DIV64; break;
73
+    default:                clock = SPI_CLOCK_DIV2;        // Default from the SPI library
87 74
   }
75
+  SPI.setModule(1);
76
+  SPI.begin();
77
+  SPI.setClockDivider(clock);
78
+  SPI.setBitOrder(MSBFIRST);
79
+  SPI.setDataMode(SPI_MODE0);
80
+}
81
+
82
+uint8_t TFT::spi_Rec() {
83
+  uint8_t returnByte = SPI.transfer(ff);
84
+  return returnByte;
85
+}
86
+
87
+uint8_t TFT::spi_read_write_byte(uint8_t data) {
88
+  uint8_t returnByte = SPI.transfer(data);
89
+  return returnByte;
90
+}
88 91
 
89 92
 /**
90 93
  * @brief  Receive a number of bytes from the SPI port to a buffer
@@ -95,7 +98,7 @@
95 98
  *
96 99
  * @details Uses DMA
97 100
  */
98
-  void TFT::spi_Read(uint8_t* buf, uint16_t nbyte) {SPI.dmaTransfer(0, const_cast<uint8_t*>(buf), nbyte);}
101
+void TFT::spi_Read(uint8_t* buf, uint16_t nbyte) {SPI.dmaTransfer(0, const_cast<uint8_t*>(buf), nbyte);}
99 102
 
100 103
 /**
101 104
  * @brief  Send a single byte on SPI port
@@ -104,7 +107,7 @@
104 107
  *
105 108
  * @details
106 109
  */
107
-  void TFT::spi_Send(uint8_t b) {SPI.send(b);}
110
+void TFT::spi_Send(uint8_t b) {SPI.send(b);}
108 111
 
109 112
 /**
110 113
  * @brief  Write token and then write from 512 byte buffer to SPI (for SD card)
@@ -114,158 +117,222 @@
114 117
  *
115 118
  * @details Use DMA
116 119
  */
117
-  void TFT::spi_SendBlock(uint8_t token, const uint8_t* buf) {
118
-    SPI.send(token);
119
-    SPI.dmaSend(const_cast<uint8_t*>(buf), 512);
120
-  }
120
+void TFT::spi_SendBlock(uint8_t token, const uint8_t* buf) {
121
+  SPI.send(token);
122
+  SPI.dmaSend(const_cast<uint8_t*>(buf), 512);
123
+}
121 124
 
122
-  void TFT::LCD_WR_REG(uint8_t cmd) {
123
-    SPI_TFT_CS_L;
124
-    SPI_TFT_DC_L;
125
-    spi_Send(cmd);
126
-    SPI_TFT_CS_H;
127
-  }
128
-  void TFT::LCD_WR_DATA(uint8_t data) {
129
-    SPI_TFT_CS_L;
130
-    SPI_TFT_DC_H;
131
-    spi_Send(data);
132
-    SPI_TFT_CS_H;
133
-  }
134
-  void TFT::LCD_WriteRAM_Prepare() {LCD_WR_REG(0X2C);}
135
-  void TFT::SetCursor(uint16_t x, uint16_t y) {
136
-    LCD_WR_REG(0x2a);
137
-    LCD_WR_DATA(x >> 8);
138
-    LCD_WR_DATA(x);
139
-    LCD_WR_DATA(x >> 8);
140
-    LCD_WR_DATA(x);
141
-
142
-    LCD_WR_REG(0x2b);
143
-    LCD_WR_DATA(y >> 8);
144
-    LCD_WR_DATA(y);
145
-    LCD_WR_DATA(y >> 8);
146
-    LCD_WR_DATA(y);
125
+void TFT::LCD_WR_REG(uint8_t cmd) {
126
+  SPI_TFT_CS_L;
127
+  SPI_TFT_DC_L;
128
+  spi_Send(cmd);
129
+  SPI_TFT_CS_H;
130
+}
131
+void TFT::LCD_WR_DATA(uint8_t data) {
132
+  SPI_TFT_CS_L;
133
+  SPI_TFT_DC_H;
134
+  spi_Send(data);
135
+  SPI_TFT_CS_H;
136
+}
137
+void TFT::LCD_WriteRAM_Prepare() {LCD_WR_REG(0X2C);}
138
+void TFT::SetCursor(uint16_t x, uint16_t y) {
139
+  LCD_WR_REG(0x2A);
140
+  LCD_WR_DATA(x >> 8);
141
+  LCD_WR_DATA(x);
142
+  LCD_WR_DATA(x >> 8);
143
+  LCD_WR_DATA(x);
144
+
145
+  LCD_WR_REG(0x2B);
146
+  LCD_WR_DATA(y >> 8);
147
+  LCD_WR_DATA(y);
148
+  LCD_WR_DATA(y >> 8);
149
+  LCD_WR_DATA(y);
150
+}
151
+
152
+void TFT::SetPoint(uint16_t x, uint16_t y, uint16_t point) {
153
+  if ((x > 480) || (y > 320)) return;
154
+
155
+  SetCursor(x, y);
156
+
157
+  LCD_WriteRAM_Prepare();
158
+  LCD_WR_DATA((uint8_t)(point >> 8));
159
+  LCD_WR_DATA((uint8_t)point);
160
+}
161
+
162
+void TFT::SetWindows(uint16_t x, uint16_t y, uint16_t with, uint16_t height) {
163
+  LCD_WR_REG(0x2A);
164
+  LCD_WR_DATA(x >> 8);
165
+  LCD_WR_DATA(x);
166
+  LCD_WR_DATA((x + with - 1) >> 8);
167
+  LCD_WR_DATA((x + with - 1));
168
+
169
+  LCD_WR_REG(0x2B);
170
+  LCD_WR_DATA(y >> 8);
171
+  LCD_WR_DATA(y);
172
+  LCD_WR_DATA((y + height - 1) >> 8);
173
+  LCD_WR_DATA(y + height - 1);
174
+}
175
+
176
+void TFT::LCD_init() {
177
+  SPI_TFT_RST_H;
178
+  delay(150);
179
+  SPI_TFT_RST_L;
180
+  delay(150);
181
+  SPI_TFT_RST_H;
182
+
183
+  delay(120);
184
+  LCD_WR_REG(0x11);
185
+  delay(120);
186
+
187
+  LCD_WR_REG(0xF0);
188
+  LCD_WR_DATA(0xC3);
189
+  LCD_WR_REG(0xF0);
190
+  LCD_WR_DATA(0x96);
191
+
192
+  LCD_WR_REG(0x36);
193
+  LCD_WR_DATA(0x28);
194
+
195
+  LCD_WR_REG(0x3A);
196
+  LCD_WR_DATA(0x55);
197
+
198
+  LCD_WR_REG(0xB4);
199
+  LCD_WR_DATA(0x01);
200
+  LCD_WR_REG(0xB7);
201
+  LCD_WR_DATA(0xC6);
202
+  LCD_WR_REG(0xE8);
203
+  LCD_WR_DATA(0x40);
204
+  LCD_WR_DATA(0x8A);
205
+  LCD_WR_DATA(0x00);
206
+  LCD_WR_DATA(0x00);
207
+  LCD_WR_DATA(0x29);
208
+  LCD_WR_DATA(0x19);
209
+  LCD_WR_DATA(0xA5);
210
+  LCD_WR_DATA(0x33);
211
+  LCD_WR_REG(0xC1);
212
+  LCD_WR_DATA(0x06);
213
+  LCD_WR_REG(0xC2);
214
+  LCD_WR_DATA(0xA7);
215
+  LCD_WR_REG(0xC5);
216
+  LCD_WR_DATA(0x18);
217
+  LCD_WR_REG(0xE0);     // Positive Voltage Gamma Control
218
+  LCD_WR_DATA(0xF0);
219
+  LCD_WR_DATA(0x09);
220
+  LCD_WR_DATA(0x0B);
221
+  LCD_WR_DATA(0x06);
222
+  LCD_WR_DATA(0x04);
223
+  LCD_WR_DATA(0x15);
224
+  LCD_WR_DATA(0x2F);
225
+  LCD_WR_DATA(0x54);
226
+  LCD_WR_DATA(0x42);
227
+  LCD_WR_DATA(0x3C);
228
+  LCD_WR_DATA(0x17);
229
+  LCD_WR_DATA(0x14);
230
+  LCD_WR_DATA(0x18);
231
+  LCD_WR_DATA(0x1B);
232
+  LCD_WR_REG(0xE1);     // Negative Voltage Gamma Control
233
+  LCD_WR_DATA(0xF0);
234
+  LCD_WR_DATA(0x09);
235
+  LCD_WR_DATA(0x0B);
236
+  LCD_WR_DATA(0x06);
237
+  LCD_WR_DATA(0x04);
238
+  LCD_WR_DATA(0x03);
239
+  LCD_WR_DATA(0x2D);
240
+  LCD_WR_DATA(0x43);
241
+  LCD_WR_DATA(0x42);
242
+  LCD_WR_DATA(0x3B);
243
+  LCD_WR_DATA(0x16);
244
+  LCD_WR_DATA(0x14);
245
+  LCD_WR_DATA(0x17);
246
+  LCD_WR_DATA(0x1B);
247
+  LCD_WR_REG(0xF0);
248
+  LCD_WR_DATA(0x3C);
249
+  LCD_WR_REG(0xF0);
250
+  LCD_WR_DATA(0x69);
251
+  delay(120);     // Delay 120ms
252
+  LCD_WR_REG(0x29);     // Display ON
253
+
254
+  LCD_clear(0x0000);    //
255
+  LCD_Draw_Logo();
256
+  SPI_TFT_BLK_H;
257
+  delay(2000);
258
+}
259
+
260
+void TFT::LCD_clear(uint16_t color) {
261
+  unsigned int i;
262
+  uint8_t tbuf[960];
263
+
264
+  SetCursor(0, 0);
265
+  SetWindows(0, 0, 480 - 1, 320 - 1);
266
+  LCD_WriteRAM_Prepare();
267
+  SPI_TFT_CS_L;
268
+  SPI_TFT_DC_H;
269
+  for (i = 0; i < 960;) {
270
+    tbuf[i]     = color >> 8;
271
+    tbuf[i + 1] = color;
272
+    i += 2;
147 273
   }
148
-  void TFT::SetWindows(uint16_t x, uint16_t y, uint16_t with, uint16_t height) {
149
-    LCD_WR_REG(0x2a);
150
-    LCD_WR_DATA(x >> 8);
151
-    LCD_WR_DATA(x);
152
-    LCD_WR_DATA((x + with) >> 8);
153
-    LCD_WR_DATA((x + with));
154
-
155
-    LCD_WR_REG(0x2b);
156
-    LCD_WR_DATA(y >> 8);
157
-    LCD_WR_DATA(y);
158
-    LCD_WR_DATA((y + height) >> 8);
159
-    LCD_WR_DATA(y + height);
274
+  for (i = 0; i < 320; i++) {
275
+    // for (m=0;m<480;m++)
276
+    // {
277
+    // LCD_WR_DATA(color>>8);
278
+    // LCD_WR_DATA(color);
279
+    SPI.dmaSend(tbuf, 960, true);
280
+    // SPI_TFT_CS_H;
281
+    // }
160 282
   }
161
-  void TFT::LCD_init() {
162
-    SPI_TFT_RST_H;
163
-    delay(150);
164
-    SPI_TFT_RST_L;
165
-    delay(150);
166
-    SPI_TFT_RST_H;
167
-
168
-    delay(120);
169
-    LCD_WR_REG(0x11);
170
-    delay(120);
171
-
172
-    LCD_WR_REG(0xf0);
173
-    LCD_WR_DATA(0xc3);
174
-    LCD_WR_REG(0xf0);
175
-    LCD_WR_DATA(0x96);
176
-
177
-    LCD_WR_REG(0x36);
178
-    LCD_WR_DATA(0x28);
179
-
180
-    LCD_WR_REG(0x3A);
181
-    LCD_WR_DATA(0x55);
182
-
183
-    LCD_WR_REG(0xB4);
184
-    LCD_WR_DATA(0x01);
185
-    LCD_WR_REG(0xB7);
186
-    LCD_WR_DATA(0xC6);
187
-    LCD_WR_REG(0xe8);
188
-    LCD_WR_DATA(0x40);
189
-    LCD_WR_DATA(0x8a);
190
-    LCD_WR_DATA(0x00);
191
-    LCD_WR_DATA(0x00);
192
-    LCD_WR_DATA(0x29);
193
-    LCD_WR_DATA(0x19);
194
-    LCD_WR_DATA(0xa5);
195
-    LCD_WR_DATA(0x33);
196
-    LCD_WR_REG(0xc1);
197
-    LCD_WR_DATA(0x06);
198
-    LCD_WR_REG(0xc2);
199
-    LCD_WR_DATA(0xa7);
200
-    LCD_WR_REG(0xc5);
201
-    LCD_WR_DATA(0x18);
202
-    LCD_WR_REG(0xe0);     // Positive Voltage Gamma Control
203
-    LCD_WR_DATA(0xf0);
204
-    LCD_WR_DATA(0x09);
205
-    LCD_WR_DATA(0x0b);
206
-    LCD_WR_DATA(0x06);
207
-    LCD_WR_DATA(0x04);
208
-    LCD_WR_DATA(0x15);
209
-    LCD_WR_DATA(0x2f);
210
-    LCD_WR_DATA(0x54);
211
-    LCD_WR_DATA(0x42);
212
-    LCD_WR_DATA(0x3c);
213
-    LCD_WR_DATA(0x17);
214
-    LCD_WR_DATA(0x14);
215
-    LCD_WR_DATA(0x18);
216
-    LCD_WR_DATA(0x1b);
217
-    LCD_WR_REG(0xe1);     // Negative Voltage Gamma Control
218
-    LCD_WR_DATA(0xf0);
219
-    LCD_WR_DATA(0x09);
220
-    LCD_WR_DATA(0x0b);
221
-    LCD_WR_DATA(0x06);
222
-    LCD_WR_DATA(0x04);
223
-    LCD_WR_DATA(0x03);
224
-    LCD_WR_DATA(0x2d);
225
-    LCD_WR_DATA(0x43);
226
-    LCD_WR_DATA(0x42);
227
-    LCD_WR_DATA(0x3b);
228
-    LCD_WR_DATA(0x16);
229
-    LCD_WR_DATA(0x14);
230
-    LCD_WR_DATA(0x17);
231
-    LCD_WR_DATA(0x1b);
232
-    LCD_WR_REG(0xf0);
233
-    LCD_WR_DATA(0x3c);
234
-    LCD_WR_REG(0xf0);
235
-    LCD_WR_DATA(0x69);
236
-    delay(120);     // Delay 120ms
237
-    LCD_WR_REG(0x29);     // Display ON
238
-
239
-    LCD_clear(0x0000);    //
240
-    SPI_TFT_BLK_H;
283
+  SPI_TFT_CS_H;
284
+}
241 285
 
242
-  }
243
-  void TFT::LCD_clear(uint16_t color) {
244
-    unsigned int i, m;
245
-    uint32_t count;
246
-    uint8_t tbuf[960];
247
-
248
-    SetCursor(0, 0);
249
-    SetWindows(0, 0, 480 - 1, 320 - 1);
250
-    LCD_WriteRAM_Prepare();
251
-    SPI_TFT_CS_L;
252
-    SPI_TFT_DC_H;
253
-    for (i = 0; i < 960;) {
254
-      tbuf[i]     = color >> 8;
255
-      tbuf[i + 1] = color;
256
-      i += 2;
286
+extern unsigned char bmp_public_buf[17 * 1024];
287
+
288
+void TFT::LCD_Draw_Logo() {
289
+  uint16_t i,y_off = 0;
290
+  uint16_t *p_index;
291
+  uint16_t Color;
292
+
293
+  #if 1
294
+    for (y_off = 0; y_off < 320; y_off ++) {
295
+      Pic_Logo_Read((uint8_t *)"", (uint8_t *)bmp_public_buf, 960);
296
+
297
+      SPI_TFT.spi_init(SPI_FULL_SPEED);
298
+      SetWindows(0, y_off, 480, 1);
299
+      LCD_WriteRAM_Prepare(); /* Prepare to write GRAM */
300
+      for (i = 0; i < 960;) {
301
+        p_index = (uint16_t *)(&bmp_public_buf[i]);
302
+        Color = (*p_index >> 8);
303
+        *p_index = Color | ((*p_index & 0xFF) << 8);
304
+        i+=2;
305
+      }
306
+      SPI_TFT_CS_L;
307
+      SPI_TFT_DC_H;
308
+      SPI.dmaSend(bmp_public_buf,960,true);
309
+      SPI_TFT_CS_H;
257 310
     }
258
-    for (i = 0; i < 320; i++) {
259
-      // for(m=0;m<480;m++)
260
-      // {
261
-      // LCD_WR_DATA(color>>8);
262
-      // LCD_WR_DATA(color);
263
-
264
-      SPI.dmaSend(tbuf, 960, true);
265
-      // SPI_TFT_CS_H;
266
-      // }
311
+
312
+  #else
313
+
314
+    for (index = 0; index < 40; index ++) {
315
+      Pic_Logo_Read((uint8_t *)"", bmp_public_buf, 480*8*2);
316
+      i = 0;
317
+      SetCursor(0,0);
318
+      SetWindows(0, y_off * 8, 480, 8);
319
+      LCD_WriteRAM_Prepare(); /* Prepare to write GRAM */
320
+      for (i = 0; i < 480 * 8 * 2;) {
321
+        p_index = (uint16_t *)(&bmp_public_buf[i]);
322
+        Color = (*p_index >> 8);
323
+        *p_index = Color | ((*p_index & 0xFF) << 8);
324
+        i += 2;
325
+      }
326
+      SPI_TFT_CS_L;
327
+      SPI_TFT_DC_H;
328
+      SPI.dmaSend(bmp_public_buf,480*8*2,true);
329
+      SPI_TFT_CS_H;
330
+
331
+      y_off++;
267 332
     }
268
-    SPI_TFT_CS_H;
269
-  }
333
+  #endif
334
+
335
+  SetWindows(0, 0, 479, 319);
336
+}
270 337
 
271
-#endif // SPI_GRAPHICAL_TFT
338
+#endif // HAS_TFT_LVGL_UI_SPI

+ 2
- 0
Marlin/src/lcd/extui/lib/mks_ui/SPI_TFT.h View File

@@ -46,10 +46,12 @@ public:
46 46
   void LCD_WR_REG(uint8_t cmd);
47 47
   void LCD_WR_DATA(uint8_t data);
48 48
   void SetCursor(uint16_t x, uint16_t y);
49
+  void SetPoint(uint16_t x, uint16_t y, uint16_t point);
49 50
   void SetWindows(uint16_t x, uint16_t y, uint16_t with, uint16_t height);
50 51
   void LCD_init();
51 52
   void LCD_clear(uint16_t color);
52 53
   void LCD_WriteRAM_Prepare();
54
+  void LCD_Draw_Logo();
53 55
 };
54 56
 
55 57
 extern TFT SPI_TFT;

+ 3
- 3
Marlin/src/lcd/extui/lib/mks_ui/W25Qxx.cpp View File

@@ -22,7 +22,7 @@
22 22
 #include "../../../../inc/MarlinConfigPre.h"
23 23
 
24 24
 #if 1 // ENABLED(SPI_FLASH)
25
-#if ENABLED(TFT_LVGL_UI)
25
+#if HAS_TFT_LVGL_UI
26 26
 
27 27
 #include <SPI.h>
28 28
 #include "../../../../inc/MarlinConfig.h"
@@ -131,7 +131,7 @@ void ext_FLASH::spi_flash_SendBlock(uint8_t token, const uint8_t* buf) {
131 131
 uint16_t ext_FLASH::W25QXX_ReadID(void) {
132 132
   uint16_t Temp = 0;
133 133
   W25QXX_CS_L;
134
-  spi_flash_Send(0x90);//���Ͷ�ȡID����
134
+  spi_flash_Send(0x90);
135 135
   spi_flash_Send(0x00);
136 136
   spi_flash_Send(0x00);
137 137
   spi_flash_Send(0x00);
@@ -391,5 +391,5 @@ void ext_FLASH::SPI_FLASH_BufferRead(uint8_t* pBuffer, uint32_t ReadAddr, uint16
391 391
 
392 392
 void ext_FLASH::lv_pic_read(uint8_t *P_Rbuff, uint32_t addr, uint32_t size) {SPI_FLASH_BufferRead((uint8_t *)P_Rbuff, addr, size);}
393 393
 
394
-#endif // TFT_LVGL_UI
394
+#endif // HAS_TFT_LVGL_UI
395 395
 #endif // 1 ... SPI_FLASH

+ 12
- 15
Marlin/src/lcd/extui/lib/mks_ui/W25Qxx.h View File

@@ -56,38 +56,35 @@
56 56
 
57 57
   #define PIC_NAME_MAX_LEN        50
58 58
 
59
-  #define LOGO_MAX_SIZE           (300*1024)//logo���ֵ
60
-  #define TITLELOGO_MAX_SIZE      (150*1024)//logo���ֵ
59
+  #define LOGO_MAX_SIZE           (300*1024)
60
+  #define TITLELOGO_MAX_SIZE      (150*1024)
61 61
   #define DEFAULT_VIEW_MAX_SIZE   (200*200*2)
62 62
   #define FLASH_VIEW_MAX_SIZE     (200*200*2)
63 63
 
64
-  //ͼƬ
65
-  //Robin2�洢��ַ
66
-  #define PIC_NAME_ADDR           0x003000  //ͼƬ��Ϣ�洢��ַ��ͼƬ����
67
-  #define PIC_SIZE_ADDR           0x007000  //ͼƬ��Ϣ�洢��ַ��ͼƬ��Сֵ
68
-  #define PIC_COUNTER_ADDR        0x008000  //ͼƬ������ֵ�洢��ַ
69
-  #define PIC_LOGO_ADDR           0x009000  //ͼƬlogo�洢��ַ
70
-  //#define PIC_DATA_ADDR         0x02f000  //ͼƬ���ݴ洢��ַ
64
+  //Robin 2
65
+  #define PIC_NAME_ADDR           0x003000
66
+  #define PIC_SIZE_ADDR           0x007000
67
+  #define PIC_COUNTER_ADDR        0x008000
68
+  #define PIC_LOGO_ADDR           0x009000
69
+  //#define PIC_DATA_ADDR         0x02f000
71 70
 
72 71
   #define DEFAULT_VIEW_ADDR       0XC5800
73 72
   #define BAK_VIEW_ADDR           (DEFAULT_VIEW_ADDR+90*1024)
74 73
   #define PIC_ICON_LOGO_ADDR      (BAK_VIEW_ADDR+80*1024)
75 74
 
76
-  #define PIC_DATA_ADDR           (PIC_ICON_LOGO_ADDR+350*1024) //ͼƬ���ݴ洢��ַ//(800*240)
75
+  #define PIC_DATA_ADDR           (PIC_ICON_LOGO_ADDR+350*1024)
77 76
 
78
-  // �ֿ�
79
-  #define FONTINFOADDR            0x600000 // 6M�Ժ��ַΪ�ֿ�
77
+  #define FONTINFOADDR            0x600000
80 78
   #define UNIGBK_FLASH_ADDR       (FONTINFOADDR+4096) // 4*1024
81 79
   #define GBK_FLASH_ADDR          (UNIGBK_FLASH_ADDR+180224) // 176*1024
82 80
 
83
-  #define PER_PIC_MAX_SPACE       (32*1024) // Ϊ�˷�ֹ����Խ������⣬ÿ��СͼƬ�����仮��Ӧ��ȡ�ܹ�����4K��ֵ
81
+  #define PER_PIC_MAX_SPACE       (32*1024)
84 82
 
85
-  //
86 83
   union union32 {
87 84
     uint8_t bytes[4];
88 85
     uint32_t dwords;
89 86
   };
90
-  // ͼƬ��Ϣ�ṹ��
87
+
91 88
   struct pic_msg {
92 89
     uint8_t name[PIC_NAME_MAX_LEN];
93 90
     union union32 size;

+ 11
- 11
Marlin/src/lcd/extui/lib/mks_ui/draw_about.cpp View File

@@ -21,7 +21,7 @@
21 21
  */
22 22
 #include "../../../../inc/MarlinConfigPre.h"
23 23
 
24
-#if ENABLED(TFT_LVGL_UI)
24
+#if HAS_TFT_LVGL_UI
25 25
 
26 26
 #include "lv_conf.h"
27 27
 #include "draw_ui.h"
@@ -67,7 +67,7 @@ void lv_draw_about(void) {
67 67
   lv_obj_clean(scr);
68 68
 
69 69
   lv_obj_t * title = lv_label_create(scr, NULL);
70
-  lv_obj_set_style(title, &tft_style_lable_rel);
70
+  lv_obj_set_style(title, &tft_style_label_rel);
71 71
   lv_obj_set_pos(title, TITLE_XPOS, TITLE_YPOS);
72 72
   lv_label_set_text(title, creat_title_text());
73 73
 
@@ -79,14 +79,14 @@ void lv_draw_about(void) {
79 79
   buttonBack = lv_imgbtn_create(scr, NULL);
80 80
 
81 81
   #if 1
82
-    lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_A_RETURN, "bmp_Return.bin", 0);
82
+    lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_A_RETURN, "bmp_return.bin", 0);
83 83
     lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_REL, &bmp_pic);
84 84
     lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_PR, &bmp_pic);
85
-    lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_PR, &tft_style_lable_pre);
86
-    lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_REL, &tft_style_lable_rel);
85
+    lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_PR, &tft_style_label_pre);
86
+    lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_REL, &tft_style_label_rel);
87 87
   #endif
88 88
 
89
-  lv_obj_set_pos(buttonBack, BTN_X_PIXEL * 3 + INTERVAL_V * 4,  BTN_Y_PIXEL + INTERVAL_H + titleHeight);
89
+  lv_obj_set_pos(buttonBack, BTN_X_PIXEL * 3 + INTERVAL_V * 4, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
90 90
   lv_btn_set_layout(buttonBack, LV_LAYOUT_OFF);
91 91
   /*Create a label on the Image button*/
92 92
 
@@ -98,16 +98,16 @@ void lv_draw_about(void) {
98 98
   }
99 99
 
100 100
   fw_version = lv_label_create(scr, NULL);
101
-  lv_obj_set_style(fw_version, &tft_style_lable_rel);
101
+  lv_obj_set_style(fw_version, &tft_style_label_rel);
102 102
   lv_label_set_text(fw_version, SHORT_BUILD_VERSION);
103 103
   lv_obj_align(fw_version, NULL, LV_ALIGN_CENTER, 0, -60);
104 104
 
105 105
   fw_type = lv_label_create(scr, NULL);
106
-  lv_obj_set_style(fw_type, &tft_style_lable_rel);
106
+  lv_obj_set_style(fw_type, &tft_style_label_rel);
107 107
   lv_label_set_text(fw_type,
108 108
     #if MB(MKS_ROBIN_PRO)
109 109
       "Firmware: Robin_Pro35"
110
-    #elif MB(MKS_ROBIN_NANO)
110
+    #elif MB(MKS_ROBIN_NANO, MKS_ROBIN_NANO_V2)
111 111
       "Firmware: Robin_Nano35"
112 112
     #else
113 113
       CUSTOM_MACHINE_NAME
@@ -116,11 +116,11 @@ void lv_draw_about(void) {
116 116
   lv_obj_align(fw_type, NULL, LV_ALIGN_CENTER, 0, -20);
117 117
 
118 118
   board = lv_label_create(scr, NULL);
119
-  lv_obj_set_style(board, &tft_style_lable_rel);
119
+  lv_obj_set_style(board, &tft_style_label_rel);
120 120
   lv_label_set_text(board, "Board: " BOARD_INFO_NAME);
121 121
   lv_obj_align(board, NULL, LV_ALIGN_CENTER, 0, 20);
122 122
 }
123 123
 
124 124
 void lv_clear_about() { lv_obj_del(scr); }
125 125
 
126
-#endif // TFT_LVGL_UI
126
+#endif // HAS_TFT_LVGL_UI

+ 483
- 0
Marlin/src/lcd/extui/lib/mks_ui/draw_acceleration_settings.cpp View File

@@ -0,0 +1,483 @@
1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
+ *
5
+ * Based on Sprinter and grbl.
6
+ * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
7
+ *
8
+ * This program is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+#include "../../../../inc/MarlinConfigPre.h"
23
+
24
+#if HAS_TFT_LVGL_UI
25
+
26
+#include "lv_conf.h"
27
+#include "draw_ui.h"
28
+
29
+#include "../../../../MarlinCore.h"
30
+#include "../../../../module/planner.h"
31
+
32
+static lv_obj_t * scr;
33
+
34
+#define ID_ACCE_RETURN  1
35
+#define ID_ACCE_PRINT   2
36
+#define ID_ACCE_RETRA   3
37
+#define ID_ACCE_TRAVEL  4
38
+#define ID_ACCE_X       5
39
+#define ID_ACCE_Y       6
40
+#define ID_ACCE_Z       7
41
+#define ID_ACCE_E0      8
42
+#define ID_ACCE_E1      9
43
+#define ID_ACCE_UP     10
44
+#define ID_ACCE_DOWN   11
45
+
46
+static void event_handler(lv_obj_t * obj, lv_event_t event) {
47
+  switch (obj->mks_obj_id) {
48
+    case ID_ACCE_RETURN:
49
+      if (event == LV_EVENT_CLICKED) {
50
+
51
+      }
52
+      else if (event == LV_EVENT_RELEASED) {
53
+        uiCfg.para_ui_page = 0;
54
+        lv_clear_acceleration_settings();
55
+        draw_return_ui();
56
+      }
57
+      break;
58
+    case ID_ACCE_PRINT:
59
+      if (event == LV_EVENT_CLICKED) {
60
+
61
+      }
62
+      else if (event == LV_EVENT_RELEASED) {
63
+        value = PrintAcceleration;
64
+        lv_clear_acceleration_settings();
65
+        lv_draw_number_key();
66
+      }
67
+      break;
68
+    case ID_ACCE_RETRA:
69
+      if (event == LV_EVENT_CLICKED) {
70
+
71
+      }
72
+      else if (event == LV_EVENT_RELEASED) {
73
+        value = RetractAcceleration;
74
+        lv_clear_acceleration_settings();
75
+        lv_draw_number_key();
76
+      }
77
+      break;
78
+    case ID_ACCE_TRAVEL:
79
+      if (event == LV_EVENT_CLICKED) {
80
+
81
+      }
82
+      else if (event == LV_EVENT_RELEASED) {
83
+        value = TravelAcceleration;
84
+        lv_clear_acceleration_settings();
85
+        lv_draw_number_key();
86
+      }
87
+      break;
88
+    case ID_ACCE_X:
89
+      if (event == LV_EVENT_CLICKED) {
90
+
91
+      }
92
+      else if (event == LV_EVENT_RELEASED) {
93
+        value = XAcceleration;
94
+        lv_clear_acceleration_settings();
95
+        lv_draw_number_key();
96
+      }
97
+      break;
98
+    case ID_ACCE_Y:
99
+      if (event == LV_EVENT_CLICKED) {
100
+
101
+      }
102
+      else if (event == LV_EVENT_RELEASED) {
103
+        value = YAcceleration;
104
+        lv_clear_acceleration_settings();
105
+        lv_draw_number_key();
106
+      }
107
+      break;
108
+    case ID_ACCE_Z:
109
+      if (event == LV_EVENT_CLICKED) {
110
+
111
+      }
112
+      else if (event == LV_EVENT_RELEASED) {
113
+        value = ZAcceleration;
114
+        lv_clear_acceleration_settings();
115
+        lv_draw_number_key();
116
+      }
117
+      break;
118
+    case ID_ACCE_E0:
119
+      if (event == LV_EVENT_CLICKED) {
120
+
121
+      }
122
+      else if (event == LV_EVENT_RELEASED) {
123
+        value = E0Acceleration;
124
+        lv_clear_acceleration_settings();
125
+        lv_draw_number_key();
126
+      }
127
+      break;
128
+    case ID_ACCE_E1:
129
+      if (event == LV_EVENT_CLICKED) {
130
+
131
+      }
132
+      else if (event == LV_EVENT_RELEASED) {
133
+        value = E1Acceleration;
134
+        lv_clear_acceleration_settings();
135
+        lv_draw_number_key();
136
+      }
137
+      break;
138
+    case ID_ACCE_UP:
139
+      if (event == LV_EVENT_CLICKED) {
140
+
141
+      }
142
+      else if (event == LV_EVENT_RELEASED) {
143
+        uiCfg.para_ui_page = 0;
144
+        lv_clear_acceleration_settings();
145
+        lv_draw_acceleration_settings();
146
+      }
147
+      break;
148
+    case ID_ACCE_DOWN:
149
+      if (event == LV_EVENT_CLICKED) {
150
+
151
+      }
152
+      else if (event == LV_EVENT_RELEASED) {
153
+        uiCfg.para_ui_page = 1;
154
+        lv_clear_acceleration_settings();
155
+        lv_draw_acceleration_settings();
156
+      }
157
+      break;
158
+  }
159
+}
160
+
161
+void lv_draw_acceleration_settings(void) {
162
+  lv_obj_t *buttonBack = NULL, *label_Back = NULL, *buttonTurnPage = NULL, *labelTurnPage = NULL;
163
+  lv_obj_t *buttonPrintText = NULL, *labelPrintText = NULL, *buttonPrintValue = NULL, *labelPrintValue = NULL;
164
+  lv_obj_t *buttonRetraText = NULL, *labelRetraText = NULL, *buttonRetraValue = NULL, *labelRetraValue = NULL;
165
+  lv_obj_t *buttonTravelText = NULL, *labelTravelText = NULL, *buttonTravelValue = NULL, *labelTravelValue = NULL;
166
+  lv_obj_t *buttonXText = NULL, *labelXText = NULL, *buttonXValue = NULL, *labelXValue = NULL;
167
+  lv_obj_t *buttonYText = NULL, *labelYText = NULL, *buttonYValue = NULL, *labelYValue = NULL;
168
+  lv_obj_t *buttonZText = NULL, *labelZText = NULL, *buttonZValue = NULL, *labelZValue = NULL;
169
+  lv_obj_t *buttonE0Text = NULL, *labelE0Text = NULL, *buttonE0Value = NULL, *labelE0Value = NULL;
170
+  lv_obj_t *buttonE1Text = NULL, *labelE1Text = NULL, *buttonE1Value = NULL, *labelE1Value = NULL;
171
+  lv_obj_t * line1 = NULL, * line2 = NULL, * line3 = NULL, * line4 = NULL;
172
+  if (disp_state_stack._disp_state[disp_state_stack._disp_index] != ACCELERATION_UI) {
173
+    disp_state_stack._disp_index++;
174
+    disp_state_stack._disp_state[disp_state_stack._disp_index] = ACCELERATION_UI;
175
+  }
176
+  disp_state = ACCELERATION_UI;
177
+
178
+  scr = lv_obj_create(NULL, NULL);
179
+
180
+  lv_obj_set_style(scr, &tft_style_scr);
181
+  lv_scr_load(scr);
182
+  lv_obj_clean(scr);
183
+
184
+  lv_obj_t * title = lv_label_create(scr, NULL);
185
+  lv_obj_set_style(title, &tft_style_label_rel);
186
+  lv_obj_set_pos(title, TITLE_XPOS, TITLE_YPOS);
187
+  lv_label_set_text(title, machine_menu.AccelerationConfTitle);
188
+
189
+  lv_refr_now(lv_refr_get_disp_refreshing());
190
+
191
+  LV_IMG_DECLARE(bmp_para_back);
192
+  // LV_IMG_DECLARE(bmp_para_arrow);
193
+  LV_IMG_DECLARE(bmp_para_bank);
194
+
195
+  if (uiCfg.para_ui_page != 1) {
196
+    buttonPrintText = lv_btn_create(scr, NULL);                                 /*Add a button the current screen*/
197
+    lv_obj_set_pos(buttonPrintText, PARA_UI_POS_X, PARA_UI_POS_Y);              /*Set its position*/
198
+    lv_obj_set_size(buttonPrintText, PARA_UI_VALUE_SIZE_X, PARA_UI_SIZE_Y);     /*Set its size*/
199
+    lv_obj_set_event_cb(buttonPrintText, event_handler);
200
+    lv_btn_set_style(buttonPrintText, LV_BTN_STYLE_REL, &tft_style_label_rel);  /*Set the button's released style*/
201
+    lv_btn_set_style(buttonPrintText, LV_BTN_STYLE_PR, &tft_style_label_pre);   /*Set the button's pressed style*/
202
+    lv_btn_set_layout(buttonPrintText, LV_LAYOUT_OFF);
203
+    labelPrintText = lv_label_create(buttonPrintText, NULL);                    /*Add a label to the button*/
204
+
205
+    buttonPrintValue = lv_imgbtn_create(scr, NULL);
206
+    lv_obj_set_pos(buttonPrintValue, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y + PARA_UI_VALUE_V);
207
+    lv_obj_set_event_cb_mks(buttonPrintValue, event_handler, ID_ACCE_PRINT, "bmp_value_blank.bin", 0);
208
+    lv_imgbtn_set_src(buttonPrintValue, LV_BTN_STATE_REL, &bmp_para_bank);
209
+    lv_imgbtn_set_src(buttonPrintValue, LV_BTN_STATE_PR, &bmp_para_bank);
210
+    lv_imgbtn_set_style(buttonPrintValue, LV_BTN_STATE_PR, &style_para_value_pre);
211
+    lv_imgbtn_set_style(buttonPrintValue, LV_BTN_STATE_REL, &style_para_value_rel);
212
+    lv_btn_set_layout(buttonPrintValue, LV_LAYOUT_OFF);
213
+    labelPrintValue = lv_label_create(buttonPrintValue, NULL);
214
+
215
+    line1 = lv_line_create(scr, NULL);
216
+    lv_ex_line(line1, line_points[0]);
217
+
218
+    buttonRetraText = lv_btn_create(scr, NULL);                                 /*Add a button the current screen*/
219
+    lv_obj_set_pos(buttonRetraText, PARA_UI_POS_X, PARA_UI_POS_Y * 2);          /*Set its position*/
220
+    lv_obj_set_size(buttonRetraText, PARA_UI_VALUE_SIZE_X, PARA_UI_SIZE_Y);     /*Set its size*/
221
+    lv_obj_set_event_cb(buttonRetraText, event_handler);
222
+    lv_btn_set_style(buttonRetraText, LV_BTN_STYLE_REL, &tft_style_label_rel);  /*Set the button's released style*/
223
+    lv_btn_set_style(buttonRetraText, LV_BTN_STYLE_PR, &tft_style_label_pre);   /*Set the button's pressed style*/
224
+    lv_btn_set_layout(buttonRetraText, LV_LAYOUT_OFF);
225
+    labelRetraText = lv_label_create(buttonRetraText, NULL);                    /*Add a label to the button*/
226
+
227
+    buttonRetraValue = lv_imgbtn_create(scr, NULL);
228
+    lv_obj_set_pos(buttonRetraValue, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 2 + PARA_UI_VALUE_V);
229
+    lv_obj_set_event_cb_mks(buttonRetraValue, event_handler, ID_ACCE_RETRA, "bmp_value_blank.bin", 0);
230
+    lv_imgbtn_set_src(buttonRetraValue, LV_BTN_STATE_REL, &bmp_para_bank);
231
+    lv_imgbtn_set_src(buttonRetraValue, LV_BTN_STATE_PR, &bmp_para_bank);
232
+    lv_imgbtn_set_style(buttonRetraValue, LV_BTN_STATE_PR, &style_para_value_pre);
233
+    lv_imgbtn_set_style(buttonRetraValue, LV_BTN_STATE_REL, &style_para_value_rel);
234
+    lv_btn_set_layout(buttonRetraValue, LV_LAYOUT_OFF);
235
+    labelRetraValue = lv_label_create(buttonRetraValue, NULL);
236
+
237
+    line2 = lv_line_create(scr, NULL);
238
+    lv_ex_line(line2, line_points[1]);
239
+
240
+    buttonTravelText = lv_btn_create(scr, NULL);                                /*Add a button the current screen*/
241
+    lv_obj_set_pos(buttonTravelText, PARA_UI_POS_X, PARA_UI_POS_Y * 3);         /*Set its position*/
242
+    lv_obj_set_size(buttonTravelText, PARA_UI_VALUE_SIZE_X, PARA_UI_SIZE_Y);    /*Set its size*/
243
+    lv_obj_set_event_cb(buttonTravelText, event_handler);
244
+    lv_btn_set_style(buttonTravelText, LV_BTN_STYLE_REL, &tft_style_label_rel); /*Set the button's released style*/
245
+    lv_btn_set_style(buttonTravelText, LV_BTN_STYLE_PR, &tft_style_label_pre);  /*Set the button's pressed style*/
246
+    lv_btn_set_layout(buttonTravelText, LV_LAYOUT_OFF);
247
+    labelTravelText = lv_label_create(buttonTravelText, NULL);                  /*Add a label to the button*/
248
+
249
+    buttonTravelValue = lv_imgbtn_create(scr, NULL);
250
+    lv_obj_set_pos(buttonTravelValue, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 3 + PARA_UI_VALUE_V);
251
+    lv_obj_set_event_cb_mks(buttonTravelValue, event_handler, ID_ACCE_TRAVEL, "bmp_value_blank.bin", 0);
252
+    lv_imgbtn_set_src(buttonTravelValue, LV_BTN_STATE_REL, &bmp_para_bank);
253
+    lv_imgbtn_set_src(buttonTravelValue, LV_BTN_STATE_PR, &bmp_para_bank);
254
+    lv_imgbtn_set_style(buttonTravelValue, LV_BTN_STATE_PR, &style_para_value_pre);
255
+    lv_imgbtn_set_style(buttonTravelValue, LV_BTN_STATE_REL, &style_para_value_rel);
256
+    lv_btn_set_layout(buttonTravelValue, LV_LAYOUT_OFF);
257
+    labelTravelValue = lv_label_create(buttonTravelValue, NULL);
258
+
259
+    line3 = lv_line_create(scr, NULL);
260
+    lv_ex_line(line3, line_points[2]);
261
+
262
+    buttonXText = lv_btn_create(scr, NULL);                                 /*Add a button the current screen*/
263
+    lv_obj_set_pos(buttonXText, PARA_UI_POS_X, PARA_UI_POS_Y * 4);          /*Set its position*/
264
+    lv_obj_set_size(buttonXText, PARA_UI_VALUE_SIZE_X, PARA_UI_SIZE_Y);     /*Set its size*/
265
+    lv_obj_set_event_cb(buttonXText, event_handler);
266
+    lv_btn_set_style(buttonXText, LV_BTN_STYLE_REL, &tft_style_label_rel);  /*Set the button's released style*/
267
+    lv_btn_set_style(buttonXText, LV_BTN_STYLE_PR, &tft_style_label_pre);   /*Set the button's pressed style*/
268
+    lv_btn_set_layout(buttonXText, LV_LAYOUT_OFF);
269
+    labelXText = lv_label_create(buttonXText, NULL);                        /*Add a label to the button*/
270
+
271
+    buttonXValue = lv_imgbtn_create(scr, NULL);
272
+    lv_obj_set_pos(buttonXValue, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 4 + PARA_UI_VALUE_V);
273
+    lv_obj_set_event_cb_mks(buttonXValue, event_handler, ID_ACCE_X, "bmp_value_blank.bin", 0);
274
+    lv_imgbtn_set_src(buttonXValue, LV_BTN_STATE_REL, &bmp_para_bank);
275
+    lv_imgbtn_set_src(buttonXValue, LV_BTN_STATE_PR, &bmp_para_bank);
276
+    lv_imgbtn_set_style(buttonXValue, LV_BTN_STATE_PR, &style_para_value_pre);
277
+    lv_imgbtn_set_style(buttonXValue, LV_BTN_STATE_REL, &style_para_value_rel);
278
+    lv_btn_set_layout(buttonXValue, LV_LAYOUT_OFF);
279
+    labelXValue = lv_label_create(buttonXValue, NULL);
280
+
281
+    line4 = lv_line_create(scr, NULL);
282
+    lv_ex_line(line4, line_points[3]);
283
+
284
+    buttonTurnPage = lv_imgbtn_create(scr, NULL);
285
+    lv_obj_set_event_cb_mks(buttonTurnPage, event_handler, ID_ACCE_DOWN, "bmp_back70x40.bin", 0);
286
+    lv_imgbtn_set_src(buttonTurnPage, LV_BTN_STATE_REL, &bmp_para_back);
287
+    lv_imgbtn_set_src(buttonTurnPage, LV_BTN_STATE_PR, &bmp_para_back);
288
+    lv_imgbtn_set_style(buttonTurnPage, LV_BTN_STATE_PR, &tft_style_label_pre);
289
+    lv_imgbtn_set_style(buttonTurnPage, LV_BTN_STATE_REL, &tft_style_label_rel);
290
+  }
291
+  else {
292
+    buttonYText = lv_btn_create(scr, NULL);                                 /*Add a button the current screen*/
293
+    lv_obj_set_pos(buttonYText, PARA_UI_POS_X, PARA_UI_POS_Y);              /*Set its position*/
294
+    lv_obj_set_size(buttonYText, PARA_UI_VALUE_SIZE_X, PARA_UI_SIZE_Y);     /*Set its size*/
295
+    lv_obj_set_event_cb(buttonYText, event_handler);
296
+    lv_btn_set_style(buttonYText, LV_BTN_STYLE_REL, &tft_style_label_rel);  /*Set the button's released style*/
297
+    lv_btn_set_style(buttonYText, LV_BTN_STYLE_PR, &tft_style_label_pre);   /*Set the button's pressed style*/
298
+    lv_btn_set_layout(buttonYText, LV_LAYOUT_OFF);
299
+    labelYText = lv_label_create(buttonYText, NULL);                        /*Add a label to the button*/
300
+
301
+    buttonYValue = lv_imgbtn_create(scr, NULL);
302
+    lv_obj_set_pos(buttonYValue, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y + PARA_UI_VALUE_V);
303
+    lv_obj_set_event_cb_mks(buttonYValue, event_handler, ID_ACCE_Y, "bmp_value_blank.bin", 0);
304
+    lv_imgbtn_set_src(buttonYValue, LV_BTN_STATE_REL, &bmp_para_bank);
305
+    lv_imgbtn_set_src(buttonYValue, LV_BTN_STATE_PR, &bmp_para_bank);
306
+    lv_imgbtn_set_style(buttonYValue, LV_BTN_STATE_PR, &style_para_value_pre);
307
+    lv_imgbtn_set_style(buttonYValue, LV_BTN_STATE_REL, &style_para_value_rel);
308
+    lv_btn_set_layout(buttonYValue, LV_LAYOUT_OFF);
309
+    labelYValue = lv_label_create(buttonYValue, NULL);
310
+
311
+    line1 = lv_line_create(scr, NULL);
312
+    lv_ex_line(line1, line_points[0]);
313
+
314
+    buttonZText = lv_btn_create(scr, NULL);                                 /*Add a button the current screen*/
315
+    lv_obj_set_pos(buttonZText, PARA_UI_POS_X, PARA_UI_POS_Y * 2);          /*Set its position*/
316
+    lv_obj_set_size(buttonZText, PARA_UI_VALUE_SIZE_X, PARA_UI_SIZE_Y);     /*Set its size*/
317
+    lv_obj_set_event_cb(buttonZText, event_handler);
318
+    lv_btn_set_style(buttonZText, LV_BTN_STYLE_REL, &tft_style_label_rel);  /*Set the button's released style*/
319
+    lv_btn_set_style(buttonZText, LV_BTN_STYLE_PR, &tft_style_label_pre);   /*Set the button's pressed style*/
320
+    lv_btn_set_layout(buttonZText, LV_LAYOUT_OFF);
321
+    labelZText = lv_label_create(buttonZText, NULL);                        /*Add a label to the button*/
322
+
323
+    buttonZValue = lv_imgbtn_create(scr, NULL);
324
+    lv_obj_set_pos(buttonZValue, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 2 + PARA_UI_VALUE_V);
325
+    lv_obj_set_event_cb_mks(buttonZValue, event_handler, ID_ACCE_Z, "bmp_value_blank.bin", 0);
326
+    lv_imgbtn_set_src(buttonZValue, LV_BTN_STATE_REL, &bmp_para_bank);
327
+    lv_imgbtn_set_src(buttonZValue, LV_BTN_STATE_PR, &bmp_para_bank);
328
+    lv_imgbtn_set_style(buttonZValue, LV_BTN_STATE_PR, &style_para_value_pre);
329
+    lv_imgbtn_set_style(buttonZValue, LV_BTN_STATE_REL, &style_para_value_rel);
330
+    lv_btn_set_layout(buttonZValue, LV_LAYOUT_OFF);
331
+    labelZValue = lv_label_create(buttonZValue, NULL);
332
+
333
+    line2 = lv_line_create(scr, NULL);
334
+    lv_ex_line(line2, line_points[1]);
335
+
336
+    buttonE0Text = lv_btn_create(scr, NULL);                                /*Add a button the current screen*/
337
+    lv_obj_set_pos(buttonE0Text, PARA_UI_POS_X, PARA_UI_POS_Y * 3);         /*Set its position*/
338
+    lv_obj_set_size(buttonE0Text, PARA_UI_VALUE_SIZE_X, PARA_UI_SIZE_Y);    /*Set its size*/
339
+    lv_obj_set_event_cb(buttonE0Text, event_handler);
340
+    lv_btn_set_style(buttonE0Text, LV_BTN_STYLE_REL, &tft_style_label_rel); /*Set the button's released style*/
341
+    lv_btn_set_style(buttonE0Text, LV_BTN_STYLE_PR, &tft_style_label_pre);  /*Set the button's pressed style*/
342
+    lv_btn_set_layout(buttonE0Text, LV_LAYOUT_OFF);
343
+    labelE0Text = lv_label_create(buttonE0Text, NULL);                      /*Add a label to the button*/
344
+
345
+    buttonE0Value = lv_imgbtn_create(scr, NULL);
346
+    lv_obj_set_pos(buttonE0Value, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 3 + PARA_UI_VALUE_V);
347
+    lv_obj_set_event_cb_mks(buttonE0Value, event_handler, ID_ACCE_E0, "bmp_value_blank.bin", 0);
348
+    lv_imgbtn_set_src(buttonE0Value, LV_BTN_STATE_REL, &bmp_para_bank);
349
+    lv_imgbtn_set_src(buttonE0Value, LV_BTN_STATE_PR, &bmp_para_bank);
350
+    lv_imgbtn_set_style(buttonE0Value, LV_BTN_STATE_PR, &style_para_value_pre);
351
+    lv_imgbtn_set_style(buttonE0Value, LV_BTN_STATE_REL, &style_para_value_rel);
352
+    lv_btn_set_layout(buttonE0Value, LV_LAYOUT_OFF);
353
+    labelE0Value = lv_label_create(buttonE0Value, NULL);
354
+
355
+    line3 = lv_line_create(scr, NULL);
356
+    lv_ex_line(line3, line_points[2]);
357
+
358
+    buttonE1Text = lv_btn_create(scr, NULL);                                /*Add a button the current screen*/
359
+    lv_obj_set_pos(buttonE1Text, PARA_UI_POS_X, PARA_UI_POS_Y * 4);         /*Set its position*/
360
+    lv_obj_set_size(buttonE1Text, PARA_UI_VALUE_SIZE_X, PARA_UI_SIZE_Y);    /*Set its size*/
361
+    lv_obj_set_event_cb(buttonE1Text, event_handler);
362
+    lv_btn_set_style(buttonE1Text, LV_BTN_STYLE_REL, &tft_style_label_rel); /*Set the button's released style*/
363
+    lv_btn_set_style(buttonE1Text, LV_BTN_STYLE_PR, &tft_style_label_pre);  /*Set the button's pressed style*/
364
+    lv_btn_set_layout(buttonE1Text, LV_LAYOUT_OFF);
365
+    labelE1Text = lv_label_create(buttonE1Text, NULL);                      /*Add a label to the button*/
366
+
367
+    buttonE1Value = lv_imgbtn_create(scr, NULL);
368
+    lv_obj_set_pos(buttonE1Value, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 4 + PARA_UI_VALUE_V);
369
+    lv_obj_set_event_cb_mks(buttonE1Value, event_handler, ID_ACCE_E1, "bmp_value_blank.bin", 0);
370
+    lv_imgbtn_set_src(buttonE1Value, LV_BTN_STATE_REL, &bmp_para_bank);
371
+    lv_imgbtn_set_src(buttonE1Value, LV_BTN_STATE_PR, &bmp_para_bank);
372
+    lv_imgbtn_set_style(buttonE1Value, LV_BTN_STATE_PR, &style_para_value_pre);
373
+    lv_imgbtn_set_style(buttonE1Value, LV_BTN_STATE_REL, &style_para_value_rel);
374
+    lv_btn_set_layout(buttonE1Value, LV_LAYOUT_OFF);
375
+    labelE1Value = lv_label_create(buttonE1Value, NULL);
376
+
377
+    line4 = lv_line_create(scr, NULL);
378
+    lv_ex_line(line4, line_points[3]);
379
+
380
+    buttonTurnPage = lv_imgbtn_create(scr, NULL);
381
+    lv_obj_set_event_cb_mks(buttonTurnPage, event_handler, ID_ACCE_UP, "bmp_back70x40.bin", 0);
382
+    lv_imgbtn_set_src(buttonTurnPage, LV_BTN_STATE_REL, &bmp_para_back);
383
+    lv_imgbtn_set_src(buttonTurnPage, LV_BTN_STATE_PR, &bmp_para_back);
384
+    lv_imgbtn_set_style(buttonTurnPage, LV_BTN_STATE_PR, &tft_style_label_pre);
385
+    lv_imgbtn_set_style(buttonTurnPage, LV_BTN_STATE_REL, &tft_style_label_rel);
386
+  }
387
+
388
+  lv_obj_set_pos(buttonTurnPage, PARA_UI_TURN_PAGE_POS_X, PARA_UI_TURN_PAGE_POS_Y);
389
+  lv_btn_set_layout(buttonTurnPage, LV_LAYOUT_OFF);
390
+  labelTurnPage = lv_label_create(buttonTurnPage, NULL);
391
+
392
+  buttonBack = lv_imgbtn_create(scr, NULL);
393
+  lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_ACCE_RETURN, "bmp_back70x40.bin", 0);
394
+  lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_REL, &bmp_para_back);
395
+  lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_PR, &bmp_para_back);
396
+  lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_PR, &tft_style_label_pre);
397
+  lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_REL, &tft_style_label_rel);
398
+
399
+  lv_obj_set_pos(buttonBack, PARA_UI_BACL_POS_X, PARA_UI_BACL_POS_Y);
400
+  lv_btn_set_layout(buttonBack, LV_LAYOUT_OFF);
401
+  label_Back = lv_label_create(buttonBack, NULL);
402
+
403
+  if (gCfgItems.multiple_language != 0) {
404
+    if (uiCfg.para_ui_page != 1) {
405
+      lv_label_set_text(labelPrintText, machine_menu.PrintAcceleration);
406
+      lv_obj_align(labelPrintText, buttonPrintText, LV_ALIGN_IN_LEFT_MID, 0, 0);
407
+
408
+      lv_label_set_text(labelRetraText, machine_menu.RetractAcceleration);
409
+      lv_obj_align(labelRetraText, buttonRetraText, LV_ALIGN_IN_LEFT_MID, 0, 0);
410
+
411
+      lv_label_set_text(labelTravelText, machine_menu.TravelAcceleration);
412
+      lv_obj_align(labelTravelText, buttonTravelText, LV_ALIGN_IN_LEFT_MID, 0, 0);
413
+
414
+      lv_label_set_text(labelXText, machine_menu.X_Acceleration);
415
+      lv_obj_align(labelXText, buttonXText, LV_ALIGN_IN_LEFT_MID, 0, 0);
416
+
417
+      lv_label_set_text(labelTurnPage, machine_menu.next);
418
+      lv_obj_align(labelTurnPage, buttonTurnPage, LV_ALIGN_CENTER, 0, 0);
419
+
420
+      ZERO(public_buf_l);
421
+      sprintf_P(public_buf_l, PSTR("%.1f"), planner.settings.acceleration);
422
+      lv_label_set_text(labelPrintValue, public_buf_l);
423
+      lv_obj_align(labelPrintValue, buttonPrintValue, LV_ALIGN_CENTER, 0, 0);
424
+
425
+      ZERO(public_buf_l);
426
+      sprintf_P(public_buf_l, PSTR("%.1f"), planner.settings.retract_acceleration);
427
+      lv_label_set_text(labelRetraValue, public_buf_l);
428
+      lv_obj_align(labelRetraValue, buttonRetraValue, LV_ALIGN_CENTER, 0, 0);
429
+
430
+      ZERO(public_buf_l);
431
+      sprintf_P(public_buf_l, PSTR("%.1f"), planner.settings.travel_acceleration);
432
+      lv_label_set_text(labelTravelValue, public_buf_l);
433
+      lv_obj_align(labelTravelValue, buttonTravelValue, LV_ALIGN_CENTER, 0, 0);
434
+
435
+      ZERO(public_buf_l);
436
+      sprintf_P(public_buf_l, PSTR("%d"), (int)planner.settings.max_acceleration_mm_per_s2[X_AXIS]);
437
+      lv_label_set_text(labelXValue, public_buf_l);
438
+      lv_obj_align(labelXValue, buttonXValue, LV_ALIGN_CENTER, 0, 0);
439
+    }
440
+    else {
441
+      lv_label_set_text(labelYText, machine_menu.Y_Acceleration);
442
+      lv_obj_align(labelYText, buttonYText, LV_ALIGN_IN_LEFT_MID, 0, 0);
443
+
444
+      lv_label_set_text(labelZText, machine_menu.Z_Acceleration);
445
+      lv_obj_align(labelZText, buttonZText, LV_ALIGN_IN_LEFT_MID, 0, 0);
446
+
447
+      lv_label_set_text(labelE0Text, machine_menu.E0_Acceleration);
448
+      lv_obj_align(labelE0Text, buttonE0Text, LV_ALIGN_IN_LEFT_MID, 0, 0);
449
+
450
+      lv_label_set_text(labelE1Text, machine_menu.E1_Acceleration);
451
+      lv_obj_align(labelE1Text, buttonE1Text, LV_ALIGN_IN_LEFT_MID, 0, 0);
452
+
453
+      lv_label_set_text(labelTurnPage, machine_menu.previous);
454
+      lv_obj_align(labelTurnPage, buttonTurnPage, LV_ALIGN_CENTER, 0, 0);
455
+      ZERO(public_buf_l);
456
+      sprintf_P(public_buf_l, PSTR("%d"), (int)planner.settings.max_acceleration_mm_per_s2[Y_AXIS]);
457
+      lv_label_set_text(labelYValue, public_buf_l);
458
+      lv_obj_align(labelYValue, buttonYValue, LV_ALIGN_CENTER, 0, 0);
459
+
460
+      ZERO(public_buf_l);
461
+      sprintf_P(public_buf_l, PSTR("%d"), (int)planner.settings.max_acceleration_mm_per_s2[Z_AXIS]);
462
+      lv_label_set_text(labelZValue, public_buf_l);
463
+      lv_obj_align(labelZValue, buttonZValue, LV_ALIGN_CENTER, 0, 0);
464
+
465
+      ZERO(public_buf_l);
466
+      sprintf_P(public_buf_l, PSTR("%d"), (int)planner.settings.max_acceleration_mm_per_s2[E_AXIS]);
467
+      lv_label_set_text(labelE0Value, public_buf_l);
468
+      lv_obj_align(labelE0Value, buttonE0Value, LV_ALIGN_CENTER, 0, 0);
469
+
470
+      ZERO(public_buf_l);
471
+      sprintf_P(public_buf_l, PSTR("%d"), (int)planner.settings.max_acceleration_mm_per_s2[E_AXIS_N(1)]);
472
+      lv_label_set_text(labelE1Value, public_buf_l);
473
+      lv_obj_align(labelE1Value, buttonE1Value, LV_ALIGN_CENTER, 0, 0);
474
+    }
475
+
476
+    lv_label_set_text(label_Back, common_menu.text_back);
477
+    lv_obj_align(label_Back, buttonBack, LV_ALIGN_CENTER, 0, 0);
478
+  }
479
+}
480
+
481
+void lv_clear_acceleration_settings() { lv_obj_del(scr); }
482
+
483
+#endif // HAS_TFT_LVGL_UI

+ 33
- 0
Marlin/src/lcd/extui/lib/mks_ui/draw_acceleration_settings.h View File

@@ -0,0 +1,33 @@
1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
+ *
5
+ * Based on Sprinter and grbl.
6
+ * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
7
+ *
8
+ * This program is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+#pragma once
23
+
24
+#ifdef __cplusplus
25
+extern "C" { /* C-declarations for C++ */
26
+#endif
27
+
28
+extern void lv_draw_acceleration_settings(void);
29
+extern void lv_clear_acceleration_settings();
30
+
31
+#ifdef __cplusplus
32
+} /* C-declarations for C++ */
33
+#endif

+ 140
- 0
Marlin/src/lcd/extui/lib/mks_ui/draw_advance_settings.cpp View File

@@ -0,0 +1,140 @@
1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
+ *
5
+ * Based on Sprinter and grbl.
6
+ * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
7
+ *
8
+ * This program is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+#include "../../../../inc/MarlinConfigPre.h"
23
+
24
+#if HAS_TFT_LVGL_UI
25
+
26
+#include "lv_conf.h"
27
+#include "draw_ui.h"
28
+
29
+#include "../../../../MarlinCore.h"
30
+
31
+static lv_obj_t * scr;
32
+
33
+#define ID_ADVANCE_RETURN   1
34
+#define ID_PAUSE_POS        2
35
+#define ID_PAUSE_POS_ARROW  3
36
+
37
+static void event_handler(lv_obj_t * obj, lv_event_t event) {
38
+  switch (obj->mks_obj_id) {
39
+    case ID_ADVANCE_RETURN:
40
+      if (event == LV_EVENT_CLICKED) {
41
+
42
+      }
43
+      else if (event == LV_EVENT_RELEASED) {
44
+        lv_clear_advance_settings();
45
+        draw_return_ui();
46
+      }
47
+      break;
48
+    case ID_PAUSE_POS:
49
+      if (event == LV_EVENT_CLICKED) {
50
+
51
+      }
52
+      else if (event == LV_EVENT_RELEASED) {
53
+        lv_clear_advance_settings();
54
+        lv_draw_pause_position();
55
+      }
56
+      break;
57
+    case ID_PAUSE_POS_ARROW:
58
+      if (event == LV_EVENT_CLICKED) {
59
+
60
+      }
61
+      else if (event == LV_EVENT_RELEASED) {
62
+        lv_clear_advance_settings();
63
+        lv_draw_pause_position();
64
+      }
65
+      break;
66
+  }
67
+}
68
+
69
+void lv_draw_advance_settings(void) {
70
+  lv_obj_t *buttonBack, *label_Back;
71
+  lv_obj_t *buttonPausePos, *labelPausePos, *buttonPausePosNarrow;
72
+  lv_obj_t * line1;
73
+  if (disp_state_stack._disp_state[disp_state_stack._disp_index] != ADVANCED_UI) {
74
+    disp_state_stack._disp_index++;
75
+    disp_state_stack._disp_state[disp_state_stack._disp_index] = ADVANCED_UI;
76
+  }
77
+  disp_state = ADVANCED_UI;
78
+
79
+  scr = lv_obj_create(NULL, NULL);
80
+
81
+  lv_obj_set_style(scr, &tft_style_scr);
82
+  lv_scr_load(scr);
83
+  lv_obj_clean(scr);
84
+
85
+  lv_obj_t * title = lv_label_create(scr, NULL);
86
+  lv_obj_set_style(title, &tft_style_label_rel);
87
+  lv_obj_set_pos(title, TITLE_XPOS, TITLE_YPOS);
88
+  lv_label_set_text(title, machine_menu.AdvancedConfTitle);
89
+
90
+  lv_refr_now(lv_refr_get_disp_refreshing());
91
+
92
+  LV_IMG_DECLARE(bmp_para_back);
93
+  LV_IMG_DECLARE(bmp_para_arrow);
94
+
95
+  buttonPausePos = lv_btn_create(scr, NULL);   /*Add a button the current screen*/
96
+  lv_obj_set_pos(buttonPausePos, PARA_UI_POS_X, PARA_UI_POS_Y);                         /*Set its position*/
97
+  lv_obj_set_size(buttonPausePos, PARA_UI_SIZE_X, PARA_UI_SIZE_Y);                       /*Set its size*/
98
+  // lv_obj_set_event_cb(buttonMachine, event_handler);
99
+  lv_obj_set_event_cb_mks(buttonPausePos, event_handler, ID_PAUSE_POS, NULL, 0);
100
+  lv_btn_set_style(buttonPausePos, LV_BTN_STYLE_REL, &tft_style_label_rel);  /*Set the button's released style*/
101
+  lv_btn_set_style(buttonPausePos, LV_BTN_STYLE_PR, &tft_style_label_pre);    /*Set the button's pressed style*/
102
+  lv_btn_set_layout(buttonPausePos, LV_LAYOUT_OFF);
103
+  labelPausePos = lv_label_create(buttonPausePos, NULL);        /*Add a label to the button*/
104
+
105
+  buttonPausePosNarrow = lv_imgbtn_create(scr, NULL);
106
+  lv_obj_set_pos(buttonPausePosNarrow, PARA_UI_POS_X + PARA_UI_SIZE_X, PARA_UI_POS_Y + PARA_UI_ARROW_V);
107
+  lv_obj_set_event_cb_mks(buttonPausePosNarrow, event_handler, ID_PAUSE_POS_ARROW, "bmp_arrow.bin", 0);
108
+  lv_imgbtn_set_src(buttonPausePosNarrow, LV_BTN_STATE_REL, &bmp_para_arrow);
109
+  lv_imgbtn_set_src(buttonPausePosNarrow, LV_BTN_STATE_PR, &bmp_para_arrow);
110
+  lv_imgbtn_set_style(buttonPausePosNarrow, LV_BTN_STATE_PR, &tft_style_label_pre);
111
+  lv_imgbtn_set_style(buttonPausePosNarrow, LV_BTN_STATE_REL, &tft_style_label_rel);
112
+  lv_btn_set_layout(buttonPausePosNarrow, LV_LAYOUT_OFF);
113
+
114
+  line1 = lv_line_create(lv_scr_act(), NULL);
115
+  lv_ex_line(line1, line_points[0]);
116
+
117
+  buttonBack = lv_imgbtn_create(scr, NULL);
118
+  lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_ADVANCE_RETURN, "bmp_back70x40.bin", 0);
119
+  lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_REL, &bmp_para_back);
120
+  lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_PR, &bmp_para_back);
121
+  lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_PR, &tft_style_label_pre);
122
+  lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_REL, &tft_style_label_rel);
123
+
124
+  lv_obj_set_pos(buttonBack, PARA_UI_BACL_POS_X, PARA_UI_BACL_POS_Y);
125
+  lv_btn_set_layout(buttonBack, LV_LAYOUT_OFF);
126
+  label_Back = lv_label_create(buttonBack, NULL);
127
+
128
+  if (gCfgItems.multiple_language != 0) {
129
+    lv_label_set_text(label_Back, common_menu.text_back);
130
+    lv_obj_align(label_Back, buttonBack, LV_ALIGN_CENTER, 0, 0);
131
+
132
+    lv_label_set_text(labelPausePos, machine_menu.PausePosition);
133
+    lv_obj_align(labelPausePos, buttonPausePos, LV_ALIGN_IN_LEFT_MID, 0, 0);
134
+  }
135
+
136
+}
137
+
138
+void lv_clear_advance_settings() { lv_obj_del(scr); }
139
+
140
+#endif // HAS_TFT_LVGL_UI

+ 33
- 0
Marlin/src/lcd/extui/lib/mks_ui/draw_advance_settings.h View File

@@ -0,0 +1,33 @@
1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
+ *
5
+ * Based on Sprinter and grbl.
6
+ * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
7
+ *
8
+ * This program is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+#pragma once
23
+
24
+#ifdef __cplusplus
25
+extern "C" { /* C-declarations for C++ */
26
+#endif
27
+
28
+extern void lv_draw_advance_settings(void);
29
+extern void lv_clear_advance_settings();
30
+
31
+#ifdef __cplusplus
32
+} /* C-declarations for C++ */
33
+#endif

+ 37
- 38
Marlin/src/lcd/extui/lib/mks_ui/draw_change_speed.cpp View File

@@ -21,7 +21,7 @@
21 21
  */
22 22
 #include "../../../../inc/MarlinConfigPre.h"
23 23
 
24
-#if ENABLED(TFT_LVGL_UI)
24
+#if HAS_TFT_LVGL_UI
25 25
 
26 26
 #include "lv_conf.h"
27 27
 #include "draw_ui.h"
@@ -44,7 +44,7 @@ static lv_obj_t * printSpeedText;
44 44
 #define ID_C_MOVE   3
45 45
 #define ID_C_EXT    4
46 46
 #define ID_C_STEP   5
47
-#define ID_C_RETURN   6
47
+#define ID_C_RETURN 6
48 48
 
49 49
 static uint8_t speedType;
50 50
 
@@ -169,7 +169,7 @@ void lv_draw_change_speed(void) {
169 169
   lv_obj_clean(scr);
170 170
 
171 171
   lv_obj_t * title = lv_label_create(scr, NULL);
172
-  lv_obj_set_style(title, &tft_style_lable_rel);
172
+  lv_obj_set_style(title, &tft_style_label_rel);
173 173
   lv_obj_set_pos(title, TITLE_XPOS, TITLE_YPOS);
174 174
   lv_label_set_text(title, creat_title_text());
175 175
 
@@ -178,56 +178,55 @@ void lv_draw_change_speed(void) {
178 178
   LV_IMG_DECLARE(bmp_pic);
179 179
 
180 180
   /*Create an Image button*/
181
-  buttonAdd = lv_imgbtn_create(scr, NULL);
182
-  buttonDec = lv_imgbtn_create(scr, NULL);
183
-  buttonMov = lv_imgbtn_create(scr, NULL);
184
-  buttonExt = lv_imgbtn_create(scr, NULL);
181
+  buttonAdd  = lv_imgbtn_create(scr, NULL);
182
+  buttonDec  = lv_imgbtn_create(scr, NULL);
183
+  buttonMov  = lv_imgbtn_create(scr, NULL);
184
+  buttonExt  = lv_imgbtn_create(scr, NULL);
185 185
   buttonStep = lv_imgbtn_create(scr, NULL);
186 186
   buttonBack = lv_imgbtn_create(scr, NULL);
187 187
 
188 188
   lv_obj_set_event_cb_mks(buttonAdd, event_handler, ID_C_ADD, "bmp_Add.bin", 0);
189 189
   lv_imgbtn_set_src(buttonAdd, LV_BTN_STATE_REL, &bmp_pic);
190 190
   lv_imgbtn_set_src(buttonAdd, LV_BTN_STATE_PR, &bmp_pic);
191
-  lv_imgbtn_set_style(buttonAdd, LV_BTN_STATE_PR, &tft_style_lable_pre);
192
-  lv_imgbtn_set_style(buttonAdd, LV_BTN_STATE_REL, &tft_style_lable_rel);
191
+  lv_imgbtn_set_style(buttonAdd, LV_BTN_STATE_PR, &tft_style_label_pre);
192
+  lv_imgbtn_set_style(buttonAdd, LV_BTN_STATE_REL, &tft_style_label_rel);
193 193
   lv_obj_clear_protect(buttonAdd, LV_PROTECT_FOLLOW);
194 194
 
195 195
   #if 1
196 196
     lv_obj_set_event_cb_mks(buttonDec, event_handler, ID_C_DEC, "bmp_Dec.bin", 0);
197 197
     lv_imgbtn_set_src(buttonDec, LV_BTN_STATE_REL, &bmp_pic);
198 198
     lv_imgbtn_set_src(buttonDec, LV_BTN_STATE_PR, &bmp_pic);
199
-    lv_imgbtn_set_style(buttonDec, LV_BTN_STATE_PR, &tft_style_lable_pre);
200
-    lv_imgbtn_set_style(buttonDec, LV_BTN_STATE_REL, &tft_style_lable_rel);
201
-
199
+    lv_imgbtn_set_style(buttonDec, LV_BTN_STATE_PR, &tft_style_label_pre);
200
+    lv_imgbtn_set_style(buttonDec, LV_BTN_STATE_REL, &tft_style_label_rel);
202 201
 
203 202
     lv_imgbtn_set_src(buttonMov, LV_BTN_STATE_REL, &bmp_pic);
204 203
     lv_imgbtn_set_src(buttonMov, LV_BTN_STATE_PR, &bmp_pic);
205
-    lv_imgbtn_set_style(buttonMov, LV_BTN_STATE_PR, &tft_style_lable_pre);
206
-    lv_imgbtn_set_style(buttonMov, LV_BTN_STATE_REL, &tft_style_lable_rel);
204
+    lv_imgbtn_set_style(buttonMov, LV_BTN_STATE_PR, &tft_style_label_pre);
205
+    lv_imgbtn_set_style(buttonMov, LV_BTN_STATE_REL, &tft_style_label_rel);
207 206
 
208 207
     lv_imgbtn_set_src(buttonExt, LV_BTN_STATE_REL, &bmp_pic);
209 208
     lv_imgbtn_set_src(buttonExt, LV_BTN_STATE_PR, &bmp_pic);
210
-    lv_imgbtn_set_style(buttonExt, LV_BTN_STATE_PR, &tft_style_lable_pre);
211
-    lv_imgbtn_set_style(buttonExt, LV_BTN_STATE_REL, &tft_style_lable_rel);
209
+    lv_imgbtn_set_style(buttonExt, LV_BTN_STATE_PR, &tft_style_label_pre);
210
+    lv_imgbtn_set_style(buttonExt, LV_BTN_STATE_REL, &tft_style_label_rel);
212 211
 
213 212
     lv_imgbtn_set_src(buttonStep, LV_BTN_STATE_REL, &bmp_pic);
214 213
     lv_imgbtn_set_src(buttonStep, LV_BTN_STATE_PR, &bmp_pic);
215
-    lv_imgbtn_set_style(buttonStep, LV_BTN_STATE_PR, &tft_style_lable_pre);
216
-    lv_imgbtn_set_style(buttonStep, LV_BTN_STATE_REL, &tft_style_lable_rel);
214
+    lv_imgbtn_set_style(buttonStep, LV_BTN_STATE_PR, &tft_style_label_pre);
215
+    lv_imgbtn_set_style(buttonStep, LV_BTN_STATE_REL, &tft_style_label_rel);
217 216
 
218
-    lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_C_RETURN, "bmp_Return.bin", 0);
217
+    lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_C_RETURN, "bmp_return.bin", 0);
219 218
     lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_REL, &bmp_pic);
220 219
     lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_PR, &bmp_pic);
221
-    lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_PR, &tft_style_lable_pre);
222
-    lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_REL, &tft_style_lable_rel);
220
+    lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_PR, &tft_style_label_pre);
221
+    lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_REL, &tft_style_label_rel);
223 222
   #endif
224 223
 
225 224
   lv_obj_set_pos(buttonAdd, INTERVAL_V, titleHeight);
226 225
   lv_obj_set_pos(buttonDec, BTN_X_PIXEL * 3 + INTERVAL_V * 4, titleHeight);
227
-  lv_obj_set_pos(buttonMov, INTERVAL_V,  BTN_Y_PIXEL + INTERVAL_H + titleHeight);
226
+  lv_obj_set_pos(buttonMov, INTERVAL_V, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
228 227
   lv_obj_set_pos(buttonExt, BTN_X_PIXEL + INTERVAL_V * 2, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
229
-  lv_obj_set_pos(buttonStep, BTN_X_PIXEL * 2 + INTERVAL_V * 3,  BTN_Y_PIXEL + INTERVAL_H + titleHeight);
230
-  lv_obj_set_pos(buttonBack, BTN_X_PIXEL * 3 + INTERVAL_V * 4,  BTN_Y_PIXEL + INTERVAL_H + titleHeight);
228
+  lv_obj_set_pos(buttonStep, BTN_X_PIXEL * 2 + INTERVAL_V * 3, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
229
+  lv_obj_set_pos(buttonBack, BTN_X_PIXEL * 3 + INTERVAL_V * 4, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
231 230
 
232 231
   /*Create a label on the Image button*/
233 232
   lv_btn_set_layout(buttonAdd, LV_LAYOUT_OFF);
@@ -239,8 +238,8 @@ void lv_draw_change_speed(void) {
239 238
 
240 239
   lv_obj_t * labelAdd = lv_label_create(buttonAdd, NULL);
241 240
   lv_obj_t * labelDec = lv_label_create(buttonDec, NULL);
242
-  labelMov = lv_label_create(buttonMov, NULL);
243
-  labelExt = lv_label_create(buttonExt, NULL);
241
+  labelMov  = lv_label_create(buttonMov, NULL);
242
+  labelExt  = lv_label_create(buttonExt, NULL);
244 243
   labelStep = lv_label_create(buttonStep, NULL);
245 244
   lv_obj_t * label_Back = lv_label_create(buttonBack, NULL);
246 245
 
@@ -258,17 +257,17 @@ void lv_draw_change_speed(void) {
258 257
   disp_speed_step();
259 258
 
260 259
   printSpeedText = lv_label_create(scr, NULL);
261
-  lv_obj_set_style(printSpeedText, &tft_style_lable_rel);
260
+  lv_obj_set_style(printSpeedText, &tft_style_label_rel);
262 261
   disp_print_speed();
263 262
 }
264 263
 
265 264
 void disp_speed_step() {
266 265
   if (uiCfg.stepPrintSpeed == 1)
267
-    lv_obj_set_event_cb_mks(buttonStep, event_handler, ID_C_STEP, "bmp_Step1_percent.bin", 0);
266
+    lv_obj_set_event_cb_mks(buttonStep, event_handler, ID_C_STEP, "bmp_step1_percent.bin", 0);
268 267
   else if (uiCfg.stepPrintSpeed == 5)
269
-    lv_obj_set_event_cb_mks(buttonStep, event_handler, ID_C_STEP, "bmp_Step5_percent.bin", 0);
268
+    lv_obj_set_event_cb_mks(buttonStep, event_handler, ID_C_STEP, "bmp_step5_percent.bin", 0);
270 269
   else if (uiCfg.stepPrintSpeed == 10)
271
-    lv_obj_set_event_cb_mks(buttonStep, event_handler, ID_C_STEP, "bmp_Step10_percent.bin", 0);
270
+    lv_obj_set_event_cb_mks(buttonStep, event_handler, ID_C_STEP, "bmp_step10_percent.bin", 0);
272 271
 
273 272
   if (gCfgItems.multiple_language != 0) {
274 273
     if (uiCfg.stepPrintSpeed == 1) {
@@ -291,16 +290,16 @@ void disp_print_speed() {
291 290
 
292 291
   public_buf_l[0] = '\0';
293 292
 
294
-  if (speedType == 0) { //move
293
+  if (speedType == 0) { // move
295 294
     strcat(public_buf_l, speed_menu.move_speed);
296
-    strcat(public_buf_l, ": ");
297
-    sprintf(buf, "%d%%", feedrate_percentage);
295
+    strcat_P(public_buf_l, PSTR(": "));
296
+    sprintf_P(buf, PSTR("%d%%"), feedrate_percentage);
298 297
     strcat(public_buf_l, buf);
299 298
   }
300 299
   else if (speedType == 1) { // e1
301 300
     strcat(public_buf_l, speed_menu.extrude_speed);
302
-    strcat(public_buf_l, ": ");
303
-    sprintf(buf, "%d%%", planner.flow_percentage[0]);
301
+    strcat_P(public_buf_l, PSTR(": "));
302
+    sprintf_P(buf, PSTR("%d%%"), planner.flow_percentage[0]);
304 303
     strcat(public_buf_l, buf);
305 304
   }
306 305
   lv_label_set_text(printSpeedText, public_buf_l);
@@ -311,11 +310,11 @@ void disp_speed_type() {
311 310
   switch (speedType) {
312 311
     case 1:
313 312
       lv_obj_set_event_cb_mks(buttonExt, event_handler, ID_C_EXT, "bmp_extruct_sel.bin", 0);
314
-      lv_obj_set_event_cb_mks(buttonMov, event_handler, ID_C_MOVE, "bmp_mov_changespeed.bin", 0);
313
+      lv_obj_set_event_cb_mks(buttonMov, event_handler, ID_C_MOVE, "bmp_mov_changeSpeed.bin", 0);
315 314
       break;
316 315
 
317 316
     default:
318
-      lv_obj_set_event_cb_mks(buttonExt, event_handler, ID_C_EXT, "bmp_Extruct.bin", 0);
317
+      lv_obj_set_event_cb_mks(buttonExt, event_handler, ID_C_EXT, "bmp_speed_extruct.bin", 0);
319 318
       lv_obj_set_event_cb_mks(buttonMov, event_handler, ID_C_MOVE, "bmp_mov_sel.bin", 0);
320 319
       break;
321 320
   }
@@ -333,4 +332,4 @@ void disp_speed_type() {
333 332
 
334 333
 void lv_clear_change_speed() { lv_obj_del(scr); }
335 334
 
336
-#endif // TFT_LVGL_UI
335
+#endif // HAS_TFT_LVGL_UI

+ 111
- 84
Marlin/src/lcd/extui/lib/mks_ui/draw_dialog.cpp View File

@@ -26,10 +26,11 @@
26 26
 
27 27
 #include "../../../../inc/MarlinConfigPre.h"
28 28
 
29
-#if ENABLED(TFT_LVGL_UI)
29
+#if HAS_TFT_LVGL_UI
30 30
 
31 31
 #include "lv_conf.h"
32 32
 #include "draw_ui.h"
33
+
33 34
 //#include "../lvgl/src/lv_objx/lv_imgbtn.h"
34 35
 //#include "../lvgl/src/lv_objx/lv_img.h"
35 36
 //#include "../lvgl/src/lv_core/lv_disp.h"
@@ -48,6 +49,7 @@
48 49
 #if ENABLED(PARK_HEAD_ON_PAUSE)
49 50
   #include "../../../../feature/pause.h"
50 51
 #endif
52
+#include "../../../../gcode/gcode.h"
51 53
 
52 54
 static lv_obj_t * scr;
53 55
 extern uint8_t sel_id;
@@ -72,36 +74,36 @@ static void btn_ok_event_cb(lv_obj_t * btn, lv_event_t event) {
72 74
       lv_draw_printing();
73 75
 
74 76
       #if ENABLED(SDSUPPORT)
75
-      if (gcode_preview_over != 1) {
76
-        char *cur_name;
77
-        cur_name = strrchr(list_file.file_name[sel_id], '/');
78
-
79
-        SdFile file, *curDir;
80
-        card.endFilePrint();
81
-        const char * const fname = card.diveToFile(true, curDir, cur_name);
82
-        if (!fname) return;
83
-        if (file.open(curDir, fname, O_READ)) {
84
-          gCfgItems.curFilesize = file.fileSize();
85
-          file.close();
86
-          update_spi_flash();
87
-        }
88
-        card.openFileRead(cur_name);
89
-        if (card.isFileOpen()) {
90
-          feedrate_percentage = 100;
91
-          //saved_feedrate_percentage = feedrate_percentage;
92
-          planner.flow_percentage[0] = 100;
93
-          planner.e_factor[0] = planner.flow_percentage[0] * 0.01f;
94
-          #if EXTRUDERS == 2
95
-            planner.flow_percentage[1] = 100;
96
-            planner.e_factor[1] = planner.flow_percentage[1] * 0.01f;
97
-          #endif
98
-          card.startFileprint();
99
-          #if ENABLED(POWER_LOSS_RECOVERY)
100
-            recovery.prepare();
101
-          #endif
102
-          once_flag = 0;
77
+        if (gcode_preview_over != 1) {
78
+          char *cur_name;
79
+          cur_name = strrchr(list_file.file_name[sel_id], '/');
80
+
81
+          SdFile file, *curDir;
82
+          card.endFilePrint();
83
+          const char * const fname = card.diveToFile(true, curDir, cur_name);
84
+          if (!fname) return;
85
+          if (file.open(curDir, fname, O_READ)) {
86
+            gCfgItems.curFilesize = file.fileSize();
87
+            file.close();
88
+            update_spi_flash();
89
+          }
90
+          card.openFileRead(cur_name);
91
+          if (card.isFileOpen()) {
92
+            feedrate_percentage = 100;
93
+            //saved_feedrate_percentage = feedrate_percentage;
94
+            planner.flow_percentage[0] = 100;
95
+            planner.e_factor[0]        = planner.flow_percentage[0] * 0.01f;
96
+            #if EXTRUDERS == 2
97
+              planner.flow_percentage[1] = 100;
98
+              planner.e_factor[1]        = planner.flow_percentage[1] * 0.01f;
99
+            #endif
100
+            card.startFileprint();
101
+            #if ENABLED(POWER_LOSS_RECOVERY)
102
+              recovery.prepare();
103
+            #endif
104
+            once_flag = 0;
105
+          }
103 106
         }
104
-      }
105 107
       #endif
106 108
     }
107 109
     else if (DialogType == DIALOG_TYPE_STOP) {
@@ -112,7 +114,7 @@ static void btn_ok_event_cb(lv_obj_t * btn, lv_event_t event) {
112 114
       #if ENABLED(SDSUPPORT)
113 115
         //card.endFilePrint();
114 116
         //wait_for_heatup = false;
115
-        uiCfg.print_state = IDLE;
117
+        uiCfg.print_state           = IDLE;
116 118
         card.flag.abort_sd_printing = true;
117 119
         //queue.clear();
118 120
         //quickstop_stepper();
@@ -120,12 +122,9 @@ static void btn_ok_event_cb(lv_obj_t * btn, lv_event_t event) {
120 122
         //thermalManager.disable_all_heaters();
121 123
 
122 124
         //#if ENABLED(POWER_LOSS_RECOVERY)
123
-        //recovery.purge();
125
+        //  recovery.purge();
124 126
         //#endif
125
-        //queue.enqueue_one_now(PSTR("G91"));
126
-        //queue.enqueue_one_now(PSTR("G1 Z10"));
127
-        //queue.enqueue_one_now(PSTR("G90"));
128
-        //queue.enqueue_one_now(PSTR("G28 X0 Y0"));
127
+        //queue.enqueue_now_P(PSTR("G91\nG1 Z10\nG90\nG28 X0 Y0"));
129 128
         //queue.inject_P(PSTR("G91\nG1 Z10\nG90\nG28 X0 Y0\nM84\nM107"));
130 129
       #endif
131 130
     }
@@ -148,6 +147,21 @@ static void btn_ok_event_cb(lv_obj_t * btn, lv_event_t event) {
148 147
         draw_return_ui();
149 148
       }
150 149
     #endif
150
+    else if (DialogType == DIALOG_STORE_EEPROM_TIPS) {
151
+      gcode.process_subcommands_now_P(PSTR("M500"));
152
+      clear_cur_ui();
153
+      draw_return_ui();
154
+    }
155
+    else if (DialogType == DIALOG_READ_EEPROM_TIPS) {
156
+      gcode.process_subcommands_now_P(PSTR("M501"));
157
+      clear_cur_ui();
158
+      draw_return_ui();
159
+    }
160
+    else if (DialogType == DIALOG_REVERT_EEPROM_TIPS) {
161
+      gcode.process_subcommands_now_P(PSTR("M502"));
162
+      clear_cur_ui();
163
+      draw_return_ui();
164
+    }
151 165
   }
152 166
 }
153 167
 
@@ -186,7 +200,7 @@ void lv_draw_dialog(uint8_t type) {
186 200
   lv_obj_clean(scr);
187 201
 
188 202
   lv_obj_t * title = lv_label_create(scr, NULL);
189
-  lv_obj_set_style(title, &tft_style_lable_rel);
203
+  lv_obj_set_style(title, &tft_style_label_rel);
190 204
   lv_obj_set_pos(title, TITLE_XPOS, TITLE_YPOS);
191 205
   lv_label_set_text(title, creat_title_text());
192 206
 
@@ -194,51 +208,52 @@ void lv_draw_dialog(uint8_t type) {
194 208
 
195 209
   //LV_IMG_DECLARE(bmp_pic);
196 210
 
197
-  static lv_style_t style_btn_rel;                                   // A variable to store the released style
198
-  lv_style_copy(&style_btn_rel, &lv_style_plain);                    // Initialize from a built-in style
211
+  static lv_style_t style_btn_rel;                                 // A variable to store the released style
212
+  lv_style_copy(&style_btn_rel, &lv_style_plain);                  // Initialize from a built-in style
199 213
   style_btn_rel.body.border.color = lv_color_hex3(0x269);
200 214
   style_btn_rel.body.border.width = 1;
201
-  style_btn_rel.body.main_color = lv_color_hex3(0xADF);
202
-  style_btn_rel.body.grad_color = lv_color_hex3(0x46B);
215
+  style_btn_rel.body.main_color   = lv_color_hex3(0xADF);
216
+  style_btn_rel.body.grad_color   = lv_color_hex3(0x46B);
203 217
   style_btn_rel.body.shadow.width = 4;
204
-  style_btn_rel.body.shadow.type = LV_SHADOW_BOTTOM;
205
-  style_btn_rel.body.radius = LV_RADIUS_CIRCLE;
206
-  style_btn_rel.text.color = lv_color_hex3(0xDEF);
207
-  style_btn_rel.text.font = &lv_font_roboto_22;
218
+  style_btn_rel.body.shadow.type  = LV_SHADOW_BOTTOM;
219
+  style_btn_rel.body.radius       = LV_RADIUS_CIRCLE;
220
+  style_btn_rel.text.color        = lv_color_hex3(0xDEF);
221
+  style_btn_rel.text.font         = &TERN(HAS_SPI_FLASH_FONT, gb2312_puhui32, lv_font_roboto_22);
208 222
 
209
-  static lv_style_t style_btn_pr;                                    // A variable to store the pressed style
210
-  lv_style_copy(&style_btn_pr, &style_btn_rel);                      // Initialize from the released style
223
+  static lv_style_t style_btn_pr;                                  // A variable to store the pressed style
224
+  lv_style_copy(&style_btn_pr, &style_btn_rel);                    // Initialize from the released style
211 225
   style_btn_pr.body.border.color = lv_color_hex3(0x46B);
212
-  style_btn_pr.body.main_color = lv_color_hex3(0x8BD);
213
-  style_btn_pr.body.grad_color = lv_color_hex3(0x24A);
226
+  style_btn_pr.body.main_color   = lv_color_hex3(0x8BD);
227
+  style_btn_pr.body.grad_color   = lv_color_hex3(0x24A);
214 228
   style_btn_pr.body.shadow.width = 2;
215
-  style_btn_pr.text.color = lv_color_hex3(0xBCD);
216
-  style_btn_pr.text.font = &lv_font_roboto_22;
229
+  style_btn_pr.text.color        = lv_color_hex3(0xBCD);
230
+  style_btn_pr.text.font         = &TERN(HAS_SPI_FLASH_FONT, gb2312_puhui32, lv_font_roboto_22);
217 231
 
218 232
   lv_obj_t * labelDialog = lv_label_create(scr, NULL);
219
-  lv_obj_set_style(labelDialog, &tft_style_lable_rel);
233
+  lv_obj_set_style(labelDialog, &tft_style_label_rel);
220 234
 
221 235
   if (DialogType == DIALOG_TYPE_FINISH_PRINT || DialogType == DIALOG_PAUSE_MESSAGE_RESUME) {
222
-    lv_obj_t * btnOk = lv_btn_create(scr, NULL);                     // Add a button the current screen
223
-    lv_obj_set_pos(btnOk, BTN_OK_X + 90, BTN_OK_Y);                  // Set its position
224
-    lv_obj_set_size(btnOk, 100, 50);                                 // Set its size
236
+    lv_obj_t * btnOk = lv_btn_create(scr, NULL);                   // Add a button the current screen
237
+    lv_obj_set_pos(btnOk, BTN_OK_X + 90, BTN_OK_Y);                // Set its position
238
+    lv_obj_set_size(btnOk, 100, 50);                               // Set its size
225 239
     lv_obj_set_event_cb(btnOk, btn_ok_event_cb);
226
-    lv_btn_set_style(btnOk, LV_BTN_STYLE_REL, &style_btn_rel);       // Set the button's released style
227
-    lv_btn_set_style(btnOk, LV_BTN_STYLE_PR, &style_btn_pr);         // Set the button's pressed style
228
-    lv_obj_t * labelOk = lv_label_create(btnOk, NULL);               // Add a label to the button
229
-    lv_label_set_text(labelOk, print_file_dialog_menu.confirm);      // Set the labels text
240
+    lv_btn_set_style(btnOk, LV_BTN_STYLE_REL, &style_btn_rel);     // Set the button's released style
241
+    lv_btn_set_style(btnOk, LV_BTN_STYLE_PR, &style_btn_pr);       // Set the button's pressed style
242
+    lv_obj_t * labelOk = lv_label_create(btnOk, NULL);             // Add a label to the button
243
+    lv_label_set_text(labelOk, print_file_dialog_menu.confirm);    // Set the labels text
230 244
   }
231 245
   else if (DialogType == DIALOG_PAUSE_MESSAGE_WAITING
232
-           || DialogType == DIALOG_PAUSE_MESSAGE_INSERT
233
-           || DialogType == DIALOG_PAUSE_MESSAGE_HEAT) {
234
-    lv_obj_t * btnOk = lv_btn_create(scr, NULL);                     // Add a button the current screen
235
-    lv_obj_set_pos(btnOk, BTN_OK_X + 90, BTN_OK_Y);                  // Set its position
236
-    lv_obj_set_size(btnOk, 100, 50);                                 // Set its size
246
+        || DialogType == DIALOG_PAUSE_MESSAGE_INSERT
247
+        || DialogType == DIALOG_PAUSE_MESSAGE_HEAT
248
+  ) {
249
+    lv_obj_t * btnOk = lv_btn_create(scr, NULL);                   // Add a button the current screen
250
+    lv_obj_set_pos(btnOk, BTN_OK_X + 90, BTN_OK_Y);                // Set its position
251
+    lv_obj_set_size(btnOk, 100, 50);                               // Set its size
237 252
     lv_obj_set_event_cb(btnOk, btn_ok_event_cb);
238
-    lv_btn_set_style(btnOk, LV_BTN_STYLE_REL, &style_btn_rel);       // Set the button's released style
239
-    lv_btn_set_style(btnOk, LV_BTN_STYLE_PR, &style_btn_pr);         // Set the button's pressed style
240
-    lv_obj_t * labelOk = lv_label_create(btnOk, NULL);               // Add a label to the button
241
-    lv_label_set_text(labelOk, print_file_dialog_menu.confirm);      // Set the labels text
253
+    lv_btn_set_style(btnOk, LV_BTN_STYLE_REL, &style_btn_rel);     // Set the button's released style
254
+    lv_btn_set_style(btnOk, LV_BTN_STYLE_PR, &style_btn_pr);       // Set the button's pressed style
255
+    lv_obj_t * labelOk = lv_label_create(btnOk, NULL);             // Add a label to the button
256
+    lv_label_set_text(labelOk, print_file_dialog_menu.confirm);    // Set the labels text
242 257
   }
243 258
   else if (DialogType == DIALOG_PAUSE_MESSAGE_PAUSING
244 259
         || DialogType == DIALOG_PAUSE_MESSAGE_CHANGING
@@ -251,28 +266,28 @@ void lv_draw_dialog(uint8_t type) {
251 266
     // nothing to do
252 267
   }
253 268
   else {
254
-    lv_obj_t * btnOk = lv_btn_create(scr, NULL);                     // Add a button the current screen
255
-    lv_obj_set_pos(btnOk, BTN_OK_X, BTN_OK_Y);                       // Set its position
256
-    lv_obj_set_size(btnOk, 100, 50);                                 // Set its size
269
+    lv_obj_t * btnOk = lv_btn_create(scr, NULL);                   // Add a button the current screen
270
+    lv_obj_set_pos(btnOk, BTN_OK_X, BTN_OK_Y);                     // Set its position
271
+    lv_obj_set_size(btnOk, 100, 50);                               // Set its size
257 272
     lv_obj_set_event_cb(btnOk, btn_ok_event_cb);
258
-    lv_btn_set_style(btnOk, LV_BTN_STYLE_REL, &style_btn_rel);       // Set the button's released style
259
-    lv_btn_set_style(btnOk, LV_BTN_STYLE_PR, &style_btn_pr);         // Set the button's pressed style
260
-    lv_obj_t * labelOk = lv_label_create(btnOk, NULL);               // Add a label to the button
273
+    lv_btn_set_style(btnOk, LV_BTN_STYLE_REL, &style_btn_rel);     // Set the button's released style
274
+    lv_btn_set_style(btnOk, LV_BTN_STYLE_PR, &style_btn_pr);       // Set the button's pressed style
275
+    lv_obj_t * labelOk = lv_label_create(btnOk, NULL);             // Add a label to the button
261 276
 
262
-    lv_obj_t * btnCancel = lv_btn_create(scr, NULL);                 // Add a button the current screen
263
-    lv_obj_set_pos(btnCancel, BTN_CANCEL_X, BTN_CANCEL_Y);           // Set its position
264
-    lv_obj_set_size(btnCancel, 100, 50);                             // Set its size
277
+    lv_obj_t * btnCancel = lv_btn_create(scr, NULL);               // Add a button the current screen
278
+    lv_obj_set_pos(btnCancel, BTN_CANCEL_X, BTN_CANCEL_Y);         // Set its position
279
+    lv_obj_set_size(btnCancel, 100, 50);                           // Set its size
265 280
     lv_obj_set_event_cb(btnCancel, btn_cancel_event_cb);
266
-    lv_btn_set_style(btnCancel, LV_BTN_STYLE_REL, &style_btn_rel);   // Set the button's released style
267
-    lv_btn_set_style(btnCancel, LV_BTN_STYLE_PR, &style_btn_pr);     // Set the button's pressed style
268
-    lv_obj_t * labelCancel = lv_label_create(btnCancel, NULL);       // Add a label to the button
281
+    lv_btn_set_style(btnCancel, LV_BTN_STYLE_REL, &style_btn_rel); // Set the button's released style
282
+    lv_btn_set_style(btnCancel, LV_BTN_STYLE_PR, &style_btn_pr);   // Set the button's pressed style
283
+    lv_obj_t * labelCancel = lv_label_create(btnCancel, NULL);     // Add a label to the button
269 284
 
270 285
     if (DialogType == DIALOG_PAUSE_MESSAGE_OPTION) {
271
-      lv_label_set_text(labelOk, pause_msg_menu.purgeMore);          // Set the labels text
286
+      lv_label_set_text(labelOk, pause_msg_menu.purgeMore);        // Set the labels text
272 287
       lv_label_set_text(labelCancel, pause_msg_menu.continuePrint);
273 288
     }
274 289
     else {
275
-      lv_label_set_text(labelOk, print_file_dialog_menu.confirm);    // Set the labels text
290
+      lv_label_set_text(labelOk, print_file_dialog_menu.confirm);  // Set the labels text
276 291
       lv_label_set_text(labelCancel, print_file_dialog_menu.cancle);
277 292
     }
278 293
   }
@@ -281,7 +296,7 @@ void lv_draw_dialog(uint8_t type) {
281 296
     lv_obj_align(labelDialog, NULL, LV_ALIGN_CENTER, 0, -20);
282 297
 
283 298
     lv_obj_t * labelFile = lv_label_create(scr, NULL);
284
-    lv_obj_set_style(labelFile, &tft_style_lable_rel);
299
+    lv_obj_set_style(labelFile, &tft_style_label_rel);
285 300
 
286 301
     lv_label_set_text(labelFile, list_file.long_name[sel_id]);
287 302
     lv_obj_align(labelFile, NULL, LV_ALIGN_CENTER, 0, -60);
@@ -338,8 +353,20 @@ void lv_draw_dialog(uint8_t type) {
338 353
     lv_label_set_text(labelDialog, pause_msg_menu.option);
339 354
     lv_obj_align(labelDialog, NULL, LV_ALIGN_CENTER, 0, -20);
340 355
   }
356
+  else if (DialogType == DIALOG_STORE_EEPROM_TIPS) {
357
+    lv_label_set_text(labelDialog, eeprom_menu.storeTips);
358
+    lv_obj_align(labelDialog, NULL, LV_ALIGN_CENTER, 0, -20);
359
+  }
360
+  else if (DialogType == DIALOG_READ_EEPROM_TIPS) {
361
+    lv_label_set_text(labelDialog, eeprom_menu.readTips);
362
+    lv_obj_align(labelDialog, NULL, LV_ALIGN_CENTER, 0, -20);
363
+  }
364
+  else if (DialogType == DIALOG_REVERT_EEPROM_TIPS) {
365
+    lv_label_set_text(labelDialog, eeprom_menu.revertTips);
366
+    lv_obj_align(labelDialog, NULL, LV_ALIGN_CENTER, 0, -20);
367
+  }
341 368
 }
342 369
 
343 370
 void lv_clear_dialog() { lv_obj_del(scr); }
344 371
 
345
-#endif // TFT_LVGL_UI
372
+#endif // HAS_TFT_LVGL_UI

+ 5
- 1
Marlin/src/lcd/extui/lib/mks_ui/draw_dialog.h View File

@@ -30,7 +30,7 @@ extern "C" { /* C-declarations for C++ */
30 30
 #define DIALOG_TYPE_REPRINT_NO_FILE                  2
31 31
 
32 32
 #define DIALOG_TYPE_M80_FAIL                         3  //**
33
-#define DIALOG_TYPE_MESSEGE_ERR1                     4  //**
33
+#define DIALOG_TYPE_MESSAGE_ERR1                     4  //**
34 34
 
35 35
 #define DIALOG_TYPE_UPDATE_ESP_FIRMARE               5
36 36
 #define DIALOG_TYPE_UPDATE_ESP_DATA                  6
@@ -65,6 +65,10 @@ extern "C" { /* C-declarations for C++ */
65 65
 #define DIALOG_PAUSE_MESSAGE_HEATING                30
66 66
 #define DIALOG_PAUSE_MESSAGE_OPTION                 31
67 67
 
68
+#define DIALOG_STORE_EEPROM_TIPS                    32
69
+#define DIALOG_READ_EEPROM_TIPS                     33
70
+#define DIALOG_REVERT_EEPROM_TIPS                   34
71
+
68 72
 #define BTN_OK_X      100
69 73
 #define BTN_OK_Y      180
70 74
 #define BTN_CANCEL_X  280

+ 237
- 0
Marlin/src/lcd/extui/lib/mks_ui/draw_eeprom_settings.cpp View File

@@ -0,0 +1,237 @@
1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
+ *
5
+ * Based on Sprinter and grbl.
6
+ * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
7
+ *
8
+ * This program is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+#include "../../../../inc/MarlinConfigPre.h"
23
+
24
+#if HAS_TFT_LVGL_UI
25
+
26
+#include "lv_conf.h"
27
+#include "draw_ui.h"
28
+
29
+#include "../../../../MarlinCore.h"
30
+
31
+static lv_obj_t * scr;
32
+
33
+#define ID_EEPROM_RETURN        1
34
+#define ID_EEPROM_STORE         2
35
+#define ID_EEPROM_STORE_ARROW   3
36
+#define ID_EEPROM_READ          4
37
+#define ID_EEPROM_READ_ARROW    5
38
+#define ID_EEPROM_REVERT        6
39
+#define ID_EEPROM_REVERT_ARROW  7
40
+
41
+static void event_handler(lv_obj_t * obj, lv_event_t event) {
42
+  switch (obj->mks_obj_id) {
43
+    case ID_EEPROM_RETURN:
44
+      if (event == LV_EVENT_CLICKED) {
45
+      }
46
+      else if (event == LV_EVENT_RELEASED) {
47
+        lv_clear_eeprom_settings();
48
+        draw_return_ui();
49
+      }
50
+      break;
51
+
52
+    #if 0
53
+      case ID_EEPROM_STORE:
54
+        if (event == LV_EVENT_CLICKED) {
55
+
56
+        }
57
+        else if (event == LV_EVENT_RELEASED) {
58
+          lv_clear_eeprom_settings();
59
+          lv_draw_dialog(DIALOG_STORE_EEPROM_TIPS);
60
+        }
61
+        break;
62
+      case ID_EEPROM_STORE_ARROW:
63
+        if (event == LV_EVENT_CLICKED) {
64
+
65
+        }
66
+        else if (event == LV_EVENT_RELEASED) {
67
+          lv_clear_eeprom_settings();
68
+          lv_draw_dialog(DIALOG_STORE_EEPROM_TIPS);
69
+        }
70
+        break;
71
+      case ID_EEPROM_READ:
72
+        if (event == LV_EVENT_CLICKED) {
73
+
74
+        }
75
+        else if (event == LV_EVENT_RELEASED) {
76
+          lv_clear_eeprom_settings();
77
+          lv_draw_dialog(DIALOG_READ_EEPROM_TIPS);
78
+        }
79
+        break;
80
+      case ID_EEPROM_READ_ARROW:
81
+        if (event == LV_EVENT_CLICKED) {
82
+
83
+        }
84
+        else if (event == LV_EVENT_RELEASED) {
85
+          lv_clear_eeprom_settings();
86
+          lv_draw_dialog(DIALOG_READ_EEPROM_TIPS);
87
+        }
88
+        break;
89
+    #endif
90
+
91
+    case ID_EEPROM_REVERT:
92
+      if (event == LV_EVENT_CLICKED) {
93
+
94
+      }
95
+      else if (event == LV_EVENT_RELEASED) {
96
+        lv_clear_eeprom_settings();
97
+        lv_draw_dialog(DIALOG_REVERT_EEPROM_TIPS);
98
+      }
99
+      break;
100
+    case ID_EEPROM_REVERT_ARROW:
101
+      if (event == LV_EVENT_CLICKED) {
102
+
103
+      }
104
+      else if (event == LV_EVENT_RELEASED) {
105
+        lv_clear_eeprom_settings();
106
+        lv_draw_dialog(DIALOG_REVERT_EEPROM_TIPS);
107
+      }
108
+      break;
109
+  }
110
+}
111
+
112
+void lv_draw_eeprom_settings(void) {
113
+  lv_obj_t *buttonBack, *label_Back;
114
+  //lv_obj_t *buttonStore,*labelStore,*buttonStoreNarrow;
115
+  //lv_obj_t *buttonRead,*labelRead,*buttonReadNarrow;
116
+  lv_obj_t *buttonRevert, *labelRevert, *buttonRevertNarrow;
117
+  lv_obj_t * line1; // * line2,* line3;
118
+  if (disp_state_stack._disp_state[disp_state_stack._disp_index] != EEPROM_SETTINGS_UI) {
119
+    disp_state_stack._disp_index++;
120
+    disp_state_stack._disp_state[disp_state_stack._disp_index] = EEPROM_SETTINGS_UI;
121
+  }
122
+  disp_state = EEPROM_SETTINGS_UI;
123
+
124
+  scr = lv_obj_create(NULL, NULL);
125
+
126
+  lv_obj_set_style(scr, &tft_style_scr);
127
+  lv_scr_load(scr);
128
+  lv_obj_clean(scr);
129
+
130
+  lv_obj_t * title = lv_label_create(scr, NULL);
131
+  lv_obj_set_style(title, &tft_style_label_rel);
132
+  lv_obj_set_pos(title, TITLE_XPOS, TITLE_YPOS);
133
+  lv_label_set_text(title, creat_title_text());
134
+
135
+  lv_refr_now(lv_refr_get_disp_refreshing());
136
+
137
+  LV_IMG_DECLARE(bmp_para_back);
138
+  LV_IMG_DECLARE(bmp_para_arrow);
139
+  #if 0
140
+    buttonStore = lv_btn_create(scr, NULL); /*Add a button the current screen*/
141
+    lv_obj_set_pos(buttonStore, PARA_UI_POS_X, PARA_UI_POS_Y);                       /*Set its position*/
142
+    lv_obj_set_size(buttonStore, PARA_UI_SIZE_X, PARA_UI_SIZE_Y);                     /*Set its size*/
143
+    //lv_obj_set_event_cb(buttonMachine, event_handler);
144
+    lv_obj_set_event_cb_mks(buttonStore, event_handler, ID_EEPROM_STORE, NULL, 0);
145
+    lv_btn_set_style(buttonStore, LV_BTN_STYLE_REL, &tft_style_label_rel); /*Set the button's released style*/
146
+    lv_btn_set_style(buttonStore, LV_BTN_STYLE_PR, &tft_style_label_pre);  /*Set the button's pressed style*/
147
+    lv_btn_set_layout(buttonStore, LV_LAYOUT_OFF);
148
+    labelStore = lv_label_create(buttonStore, NULL);      /*Add a label to the button*/
149
+
150
+    buttonStoreNarrow = lv_imgbtn_create(scr, NULL);
151
+    lv_obj_set_pos(buttonStoreNarrow, PARA_UI_POS_X + PARA_UI_SIZE_X, PARA_UI_POS_Y + PARA_UI_ARROW_V);
152
+    lv_obj_set_event_cb_mks(buttonStoreNarrow, event_handler, ID_EEPROM_STORE_ARROW, "bmp_arrow.bin", 0);
153
+    lv_imgbtn_set_src(buttonStoreNarrow, LV_BTN_STATE_REL, &bmp_para_arrow);
154
+    lv_imgbtn_set_src(buttonStoreNarrow, LV_BTN_STATE_PR, &bmp_para_arrow);
155
+    lv_imgbtn_set_style(buttonStoreNarrow, LV_BTN_STATE_PR, &tft_style_label_pre);
156
+    lv_imgbtn_set_style(buttonStoreNarrow, LV_BTN_STATE_REL, &tft_style_label_rel);
157
+    lv_btn_set_layout(buttonStoreNarrow, LV_LAYOUT_OFF);
158
+
159
+    line1 = lv_line_create(scr, NULL);
160
+    lv_ex_line(line1, line_points[0]);
161
+
162
+    buttonRead = lv_btn_create(scr, NULL); /*Add a button the current screen*/
163
+    lv_obj_set_pos(buttonRead, PARA_UI_POS_X, PARA_UI_POS_Y * 2);                     /*Set its position*/
164
+    lv_obj_set_size(buttonRead, PARA_UI_SIZE_X, PARA_UI_SIZE_Y);                     /*Set its size*/
165
+    //lv_obj_set_event_cb(buttonMotor, event_handler);
166
+    lv_obj_set_event_cb_mks(buttonRead, event_handler, ID_EEPROM_READ, NULL, 0);
167
+    lv_btn_set_style(buttonRead, LV_BTN_STYLE_REL, &tft_style_label_rel); /*Set the button's released style*/
168
+    lv_btn_set_style(buttonRead, LV_BTN_STYLE_PR, &tft_style_label_pre);  /*Set the button's pressed style*/
169
+    lv_btn_set_layout(buttonRead, LV_LAYOUT_OFF);
170
+    labelRead = lv_label_create(buttonRead, NULL);      /*Add a label to the button*/
171
+
172
+    buttonReadNarrow = lv_imgbtn_create(scr, NULL);
173
+    lv_obj_set_pos(buttonReadNarrow, PARA_UI_POS_X + PARA_UI_SIZE_X, PARA_UI_POS_Y * 2 + PARA_UI_ARROW_V);
174
+    lv_obj_set_event_cb_mks(buttonReadNarrow, event_handler, ID_EEPROM_READ_ARROW, "bmp_arrow.bin", 0);
175
+    lv_imgbtn_set_src(buttonReadNarrow, LV_BTN_STATE_REL, &bmp_para_arrow);
176
+    lv_imgbtn_set_src(buttonReadNarrow, LV_BTN_STATE_PR, &bmp_para_arrow);
177
+    lv_imgbtn_set_style(buttonReadNarrow, LV_BTN_STATE_PR, &tft_style_label_pre);
178
+    lv_imgbtn_set_style(buttonReadNarrow, LV_BTN_STATE_REL, &tft_style_label_rel);
179
+    lv_btn_set_layout(buttonReadNarrow, LV_LAYOUT_OFF);
180
+
181
+    line2 = lv_line_create(scr, NULL);
182
+    lv_ex_line(line2, line_points[1]);
183
+  #endif // if 0
184
+  buttonRevert = lv_btn_create(scr, NULL);   /*Add a button the current screen*/
185
+  lv_obj_set_pos(buttonRevert, PARA_UI_POS_X, PARA_UI_POS_Y);                         /*Set its position*/
186
+  lv_obj_set_size(buttonRevert, PARA_UI_SIZE_X, PARA_UI_SIZE_Y);                       /*Set its size*/
187
+  //lv_obj_set_event_cb(buttonMotor, event_handler);
188
+  lv_obj_set_event_cb_mks(buttonRevert, event_handler, ID_EEPROM_REVERT, NULL, 0);
189
+  lv_btn_set_style(buttonRevert, LV_BTN_STYLE_REL, &tft_style_label_rel);  /*Set the button's released style*/
190
+  lv_btn_set_style(buttonRevert, LV_BTN_STYLE_PR, &tft_style_label_pre);    /*Set the button's pressed style*/
191
+  lv_btn_set_layout(buttonRevert, LV_LAYOUT_OFF);
192
+  labelRevert = lv_label_create(buttonRevert, NULL);        /*Add a label to the button*/
193
+
194
+  buttonRevertNarrow = lv_imgbtn_create(scr, NULL);
195
+  lv_obj_set_pos(buttonRevertNarrow, PARA_UI_POS_X + PARA_UI_SIZE_X, PARA_UI_POS_Y + PARA_UI_ARROW_V);
196
+  lv_obj_set_event_cb_mks(buttonRevertNarrow, event_handler, ID_EEPROM_REVERT_ARROW, "bmp_arrow.bin", 0);
197
+  lv_imgbtn_set_src(buttonRevertNarrow, LV_BTN_STATE_REL, &bmp_para_arrow);
198
+  lv_imgbtn_set_src(buttonRevertNarrow, LV_BTN_STATE_PR, &bmp_para_arrow);
199
+  lv_imgbtn_set_style(buttonRevertNarrow, LV_BTN_STATE_PR, &tft_style_label_pre);
200
+  lv_imgbtn_set_style(buttonRevertNarrow, LV_BTN_STATE_REL, &tft_style_label_rel);
201
+  lv_btn_set_layout(buttonRevertNarrow, LV_LAYOUT_OFF);
202
+
203
+  //line3 = lv_line_create(scr, NULL);
204
+  //lv_ex_line(line3,line_points[2]);
205
+  line1 = lv_line_create(scr, NULL);
206
+  lv_ex_line(line1, line_points[0]);
207
+
208
+  buttonBack = lv_imgbtn_create(scr, NULL);
209
+  lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_EEPROM_RETURN, "bmp_back70x40.bin", 0);
210
+  lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_REL, &bmp_para_back);
211
+  lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_PR, &bmp_para_back);
212
+  lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_PR, &tft_style_label_pre);
213
+  lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_REL, &tft_style_label_rel);
214
+
215
+  lv_obj_set_pos(buttonBack, PARA_UI_BACL_POS_X, PARA_UI_BACL_POS_Y);
216
+  lv_btn_set_layout(buttonBack, LV_LAYOUT_OFF);
217
+  label_Back = lv_label_create(buttonBack, NULL);
218
+
219
+  if (gCfgItems.multiple_language != 0) {
220
+    lv_label_set_text(label_Back, common_menu.text_back);
221
+    lv_obj_align(label_Back, buttonBack, LV_ALIGN_CENTER, 0, 0);
222
+
223
+    //lv_label_set_text(labelStore, eeprom_menu.store);
224
+    //lv_obj_align(labelStore, buttonStore, LV_ALIGN_IN_LEFT_MID,0, 0);
225
+
226
+    //lv_label_set_text(labelRead, eeprom_menu.read);
227
+    //lv_obj_align(labelRead, buttonRead, LV_ALIGN_IN_LEFT_MID,0, 0);
228
+
229
+    lv_label_set_text(labelRevert, eeprom_menu.revert);
230
+    lv_obj_align(labelRevert, buttonRevert, LV_ALIGN_IN_LEFT_MID, 0, 0);
231
+  }
232
+
233
+}
234
+
235
+void lv_clear_eeprom_settings() { lv_obj_del(scr); }
236
+
237
+#endif // HAS_TFT_LVGL_UI

+ 33
- 0
Marlin/src/lcd/extui/lib/mks_ui/draw_eeprom_settings.h View File

@@ -0,0 +1,33 @@
1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
+ *
5
+ * Based on Sprinter and grbl.
6
+ * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
7
+ *
8
+ * This program is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+#pragma once
23
+
24
+#ifdef __cplusplus
25
+extern "C" { /* C-declarations for C++ */
26
+#endif
27
+
28
+extern void lv_draw_eeprom_settings(void);
29
+extern void lv_clear_eeprom_settings();
30
+
31
+#ifdef __cplusplus
32
+} /* C-declarations for C++ */
33
+#endif

+ 11
- 7
Marlin/src/lcd/extui/lib/mks_ui/draw_error_message.cpp View File

@@ -21,7 +21,11 @@
21 21
  */
22 22
 #include "../../../../inc/MarlinConfigPre.h"
23 23
 
24
-#if ENABLED(TFT_LVGL_UI)
24
+#if HAS_TFT_LVGL_UI
25
+
26
+#if ENABLED(TFT_LVGL_UI_SPI)
27
+  #include "SPI_TFT.h"
28
+#endif
25 29
 
26 30
 #include "lv_conf.h"
27 31
 #include "draw_ui.h"
@@ -55,30 +59,30 @@ void lv_draw_error_message(PGM_P const msg) {
55 59
 
56 60
     if (msg) {
57 61
       message = lv_label_create(scr, NULL);
58
-      lv_obj_set_style(message, &tft_style_lable_rel);
62
+      lv_obj_set_style(message, &tft_style_label_rel);
59 63
       lv_label_set_text(message, msg);
60 64
       lv_obj_align(message, NULL, LV_ALIGN_CENTER, 0, -50);
61 65
     }
62 66
 
63 67
     kill_message = lv_label_create(scr, NULL);
64
-    lv_obj_set_style(kill_message, &tft_style_lable_rel);
68
+    lv_obj_set_style(kill_message, &tft_style_label_rel);
65 69
     lv_label_set_text(kill_message, "PRINTER HALTED");
66 70
     lv_obj_align(kill_message, NULL, LV_ALIGN_CENTER, 0, -10);
67 71
 
68 72
     reset_tips = lv_label_create(scr, NULL);
69
-    lv_obj_set_style(reset_tips, &tft_style_lable_rel);
73
+    lv_obj_set_style(reset_tips, &tft_style_label_rel);
70 74
     lv_label_set_text(reset_tips, "Please Reset");
71 75
     lv_obj_align(reset_tips, NULL, LV_ALIGN_CENTER, 0, 30);
72 76
 
73 77
     lv_task_handler();
74 78
   #endif
75
-  LCD_Clear(0x0000);
79
+
80
+  TERN(TFT_LVGL_UI_SPI, SPI_TFT.LCD_clear, LCD_Clear)(0x0000);
76 81
   if (msg) disp_string((TFT_WIDTH - strlen(msg) * 16) / 2, 100, msg, 0xFFFF, 0x0000);
77 82
   disp_string((TFT_WIDTH - strlen("PRINTER HALTED") * 16) / 2, 140, "PRINTER HALTED", 0xFFFF, 0x0000);
78 83
   disp_string((TFT_WIDTH - strlen("Please Reset") * 16) / 2, 180, "Please Reset", 0xFFFF, 0x0000);
79
-
80 84
 }
81 85
 
82 86
 void lv_clear_error_message() { lv_obj_del(scr); }
83 87
 
84
-#endif // TFT_LVGL_UI
88
+#endif // HAS_TFT_LVGL_UI

+ 48
- 49
Marlin/src/lcd/extui/lib/mks_ui/draw_extrusion.cpp View File

@@ -21,7 +21,7 @@
21 21
  */
22 22
 #include "../../../../inc/MarlinConfigPre.h"
23 23
 
24
-#if ENABLED(TFT_LVGL_UI)
24
+#if HAS_TFT_LVGL_UI
25 25
 
26 26
 #include "lv_conf.h"
27 27
 #include "draw_ui.h"
@@ -59,11 +59,11 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
59 59
       }
60 60
       else if (event == LV_EVENT_RELEASED) {
61 61
         if (thermalManager.temp_hotend[uiCfg.curSprayerChoose].celsius >= EXTRUDE_MINTEMP) {
62
-          queue.enqueue_one_now(PSTR("G91"));
63
-          memset(public_buf_l, 0, sizeof(public_buf_l));
64
-          sprintf((char *)public_buf_l, "G1 E%d F%d", uiCfg.extruStep, 60 * uiCfg.extruSpeed);
65
-          queue.enqueue_one_now(PSTR(public_buf_l));
66
-          queue.enqueue_one_now(PSTR("G90"));
62
+          queue.enqueue_now_P(PSTR("G91"));
63
+          ZERO(public_buf_l);
64
+          sprintf_P((char *)public_buf_l, PSTR("G1 E%d F%d"), uiCfg.extruStep, 60 * uiCfg.extruSpeed);
65
+          queue.enqueue_one_now(public_buf_l);
66
+          queue.enqueue_now_P(PSTR("G90"));
67 67
           extructAmount += uiCfg.extruStep;
68 68
           disp_extru_amount();
69 69
         }
@@ -75,11 +75,11 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
75 75
       }
76 76
       else if (event == LV_EVENT_RELEASED) {
77 77
         if (thermalManager.temp_hotend[uiCfg.curSprayerChoose].celsius >= EXTRUDE_MINTEMP) {
78
-          queue.enqueue_one_now(PSTR("G91"));
79
-          memset(public_buf_l, 0, sizeof(public_buf_l));
80
-          sprintf((char *)public_buf_l, "G1 E%d F%d", 0 - uiCfg.extruStep, 60 * uiCfg.extruSpeed);
81
-          queue.enqueue_one_now(PSTR(public_buf_l));
82
-          queue.enqueue_one_now(PSTR("G90"));
78
+          queue.enqueue_now_P(PSTR("G91"));
79
+          ZERO(public_buf_l);
80
+          sprintf_P((char *)public_buf_l, PSTR("G1 E%d F%d"), 0 - uiCfg.extruStep, 60 * uiCfg.extruSpeed);
81
+          queue.enqueue_one_now(public_buf_l);
82
+          queue.enqueue_now_P(PSTR("G90"));
83 83
           extructAmount -= uiCfg.extruStep;
84 84
           disp_extru_amount();
85 85
         }
@@ -166,7 +166,7 @@ void lv_draw_extrusion(void) {
166 166
   lv_obj_clean(scr);
167 167
 
168 168
   lv_obj_t * title = lv_label_create(scr, NULL);
169
-  lv_obj_set_style(title, &tft_style_lable_rel);
169
+  lv_obj_set_style(title, &tft_style_label_rel);
170 170
   lv_obj_set_pos(title, TITLE_XPOS, TITLE_YPOS);
171 171
   lv_label_set_text(title, creat_title_text());
172 172
 
@@ -175,55 +175,54 @@ void lv_draw_extrusion(void) {
175 175
   LV_IMG_DECLARE(bmp_pic);
176 176
 
177 177
   /*Create an Image button*/
178
-  buttonAdd = lv_imgbtn_create(scr, NULL);
179
-  buttonDec = lv_imgbtn_create(scr, NULL);
180
-  buttoType = lv_imgbtn_create(scr, NULL);
181
-  buttonStep = lv_imgbtn_create(scr, NULL);
178
+  buttonAdd   = lv_imgbtn_create(scr, NULL);
179
+  buttonDec   = lv_imgbtn_create(scr, NULL);
180
+  buttoType   = lv_imgbtn_create(scr, NULL);
181
+  buttonStep  = lv_imgbtn_create(scr, NULL);
182 182
   buttonSpeed = lv_imgbtn_create(scr, NULL);
183
-  buttonBack = lv_imgbtn_create(scr, NULL);
183
+  buttonBack  = lv_imgbtn_create(scr, NULL);
184 184
 
185
-  lv_obj_set_event_cb_mks(buttonAdd, event_handler, ID_E_ADD, "bmp_In.bin", 0);
185
+  lv_obj_set_event_cb_mks(buttonAdd, event_handler, ID_E_ADD, "bmp_in.bin", 0);
186 186
   lv_imgbtn_set_src(buttonAdd, LV_BTN_STATE_REL, &bmp_pic);
187 187
   lv_imgbtn_set_src(buttonAdd, LV_BTN_STATE_PR, &bmp_pic);
188
-  lv_imgbtn_set_style(buttonAdd, LV_BTN_STATE_PR, &tft_style_lable_pre);
189
-  lv_imgbtn_set_style(buttonAdd, LV_BTN_STATE_REL, &tft_style_lable_rel);
188
+  lv_imgbtn_set_style(buttonAdd, LV_BTN_STATE_PR, &tft_style_label_pre);
189
+  lv_imgbtn_set_style(buttonAdd, LV_BTN_STATE_REL, &tft_style_label_rel);
190 190
   lv_obj_clear_protect(buttonAdd, LV_PROTECT_FOLLOW);
191
-
192 191
   #if 1
193
-    lv_obj_set_event_cb_mks(buttonDec, event_handler, ID_E_DEC, "bmp_Out.bin", 0);
192
+    lv_obj_set_event_cb_mks(buttonDec, event_handler, ID_E_DEC, "bmp_out.bin", 0);
194 193
     lv_imgbtn_set_src(buttonDec, LV_BTN_STATE_REL, &bmp_pic);
195 194
     lv_imgbtn_set_src(buttonDec, LV_BTN_STATE_PR, &bmp_pic);
196
-    lv_imgbtn_set_style(buttonDec, LV_BTN_STATE_PR, &tft_style_lable_pre);
197
-    lv_imgbtn_set_style(buttonDec, LV_BTN_STATE_REL, &tft_style_lable_rel);
195
+    lv_imgbtn_set_style(buttonDec, LV_BTN_STATE_PR, &tft_style_label_pre);
196
+    lv_imgbtn_set_style(buttonDec, LV_BTN_STATE_REL, &tft_style_label_rel);
198 197
 
199 198
     lv_imgbtn_set_src(buttoType, LV_BTN_STATE_REL, &bmp_pic);
200 199
     lv_imgbtn_set_src(buttoType, LV_BTN_STATE_PR, &bmp_pic);
201
-    lv_imgbtn_set_style(buttoType, LV_BTN_STATE_PR, &tft_style_lable_pre);
202
-    lv_imgbtn_set_style(buttoType, LV_BTN_STATE_REL, &tft_style_lable_rel);
200
+    lv_imgbtn_set_style(buttoType, LV_BTN_STATE_PR, &tft_style_label_pre);
201
+    lv_imgbtn_set_style(buttoType, LV_BTN_STATE_REL, &tft_style_label_rel);
203 202
 
204 203
     lv_imgbtn_set_src(buttonStep, LV_BTN_STATE_REL, &bmp_pic);
205 204
     lv_imgbtn_set_src(buttonStep, LV_BTN_STATE_PR, &bmp_pic);
206
-    lv_imgbtn_set_style(buttonStep, LV_BTN_STATE_PR, &tft_style_lable_pre);
207
-    lv_imgbtn_set_style(buttonStep, LV_BTN_STATE_REL, &tft_style_lable_rel);
205
+    lv_imgbtn_set_style(buttonStep, LV_BTN_STATE_PR, &tft_style_label_pre);
206
+    lv_imgbtn_set_style(buttonStep, LV_BTN_STATE_REL, &tft_style_label_rel);
208 207
 
209 208
     lv_imgbtn_set_src(buttonSpeed, LV_BTN_STATE_REL, &bmp_pic);
210 209
     lv_imgbtn_set_src(buttonSpeed, LV_BTN_STATE_PR, &bmp_pic);
211
-    lv_imgbtn_set_style(buttonSpeed, LV_BTN_STATE_PR, &tft_style_lable_pre);
212
-    lv_imgbtn_set_style(buttonSpeed, LV_BTN_STATE_REL, &tft_style_lable_rel);
210
+    lv_imgbtn_set_style(buttonSpeed, LV_BTN_STATE_PR, &tft_style_label_pre);
211
+    lv_imgbtn_set_style(buttonSpeed, LV_BTN_STATE_REL, &tft_style_label_rel);
213 212
 
214
-    lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_E_RETURN, "bmp_Return.bin", 0);
213
+    lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_E_RETURN, "bmp_return.bin", 0);
215 214
     lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_REL, &bmp_pic);
216 215
     lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_PR, &bmp_pic);
217
-    lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_PR, &tft_style_lable_pre);
218
-    lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_REL, &tft_style_lable_rel);
216
+    lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_PR, &tft_style_label_pre);
217
+    lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_REL, &tft_style_label_rel);
219 218
   #endif
220 219
 
221 220
   lv_obj_set_pos(buttonAdd, INTERVAL_V, titleHeight);
222 221
   lv_obj_set_pos(buttonDec, BTN_X_PIXEL * 3 + INTERVAL_V * 4, titleHeight);
223
-  lv_obj_set_pos(buttoType, INTERVAL_V,  BTN_Y_PIXEL + INTERVAL_H + titleHeight);
222
+  lv_obj_set_pos(buttoType, INTERVAL_V, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
224 223
   lv_obj_set_pos(buttonStep, BTN_X_PIXEL + INTERVAL_V * 2, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
225
-  lv_obj_set_pos(buttonSpeed, BTN_X_PIXEL * 2 + INTERVAL_V * 3,  BTN_Y_PIXEL + INTERVAL_H + titleHeight);
226
-  lv_obj_set_pos(buttonBack, BTN_X_PIXEL * 3 + INTERVAL_V * 4,  BTN_Y_PIXEL + INTERVAL_H + titleHeight);
224
+  lv_obj_set_pos(buttonSpeed, BTN_X_PIXEL * 2 + INTERVAL_V * 3, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
225
+  lv_obj_set_pos(buttonBack, BTN_X_PIXEL * 3 + INTERVAL_V * 4, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
227 226
 
228 227
   /*Create a label on the Image button*/
229 228
   lv_btn_set_layout(buttonAdd, LV_LAYOUT_OFF);
@@ -235,8 +234,8 @@ void lv_draw_extrusion(void) {
235 234
 
236 235
   lv_obj_t * labelAdd = lv_label_create(buttonAdd, NULL);
237 236
   lv_obj_t * labelDec = lv_label_create(buttonDec, NULL);
238
-  labelType = lv_label_create(buttoType, NULL);
239
-  labelStep = lv_label_create(buttonStep, NULL);
237
+  labelType  = lv_label_create(buttoType, NULL);
238
+  labelStep  = lv_label_create(buttonStep, NULL);
240 239
   labelSpeed = lv_label_create(buttonSpeed, NULL);
241 240
   lv_obj_t * label_Back = lv_label_create(buttonBack, NULL);
242 241
 
@@ -256,24 +255,24 @@ void lv_draw_extrusion(void) {
256 255
   disp_ext_speed();
257 256
 
258 257
   tempText = lv_label_create(scr, NULL);
259
-  lv_obj_set_style(tempText, &tft_style_lable_rel);
258
+  lv_obj_set_style(tempText, &tft_style_label_rel);
260 259
   disp_hotend_temp();
261 260
 
262 261
   ExtruText = lv_label_create(scr, NULL);
263
-  lv_obj_set_style(ExtruText, &tft_style_lable_rel);
262
+  lv_obj_set_style(ExtruText, &tft_style_label_rel);
264 263
   disp_extru_amount();
265 264
 }
266 265
 
267 266
 void disp_ext_type() {
268 267
   if (uiCfg.curSprayerChoose == 1) {
269
-    lv_obj_set_event_cb_mks(buttoType, event_handler, ID_E_TYPE, "bmp_Extru2.bin", 0);
268
+    lv_obj_set_event_cb_mks(buttoType, event_handler, ID_E_TYPE, "bmp_extru2.bin", 0);
270 269
     if (gCfgItems.multiple_language != 0) {
271 270
       lv_label_set_text(labelType, extrude_menu.ext2);
272 271
       lv_obj_align(labelType, buttoType, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
273 272
     }
274 273
   }
275 274
   else {
276
-    lv_obj_set_event_cb_mks(buttoType, event_handler, ID_E_TYPE, "bmp_Extru1.bin", 0);
275
+    lv_obj_set_event_cb_mks(buttoType, event_handler, ID_E_TYPE, "bmp_extru1.bin", 0);
277 276
     if (gCfgItems.multiple_language != 0) {
278 277
       lv_label_set_text(labelType, extrude_menu.ext1);
279 278
       lv_obj_align(labelType, buttoType, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
@@ -283,11 +282,11 @@ void disp_ext_type() {
283 282
 
284 283
 void disp_ext_speed() {
285 284
   if (uiCfg.extruSpeed == 20)
286
-    lv_obj_set_event_cb_mks(buttonSpeed, event_handler, ID_E_SPEED, "bmp_Speed_high.bin", 0);
285
+    lv_obj_set_event_cb_mks(buttonSpeed, event_handler, ID_E_SPEED, "bmp_speed_high.bin", 0);
287 286
   else if (uiCfg.extruSpeed == 1)
288
-    lv_obj_set_event_cb_mks(buttonSpeed, event_handler, ID_E_SPEED, "bmp_Speed_slow.bin", 0);
287
+    lv_obj_set_event_cb_mks(buttonSpeed, event_handler, ID_E_SPEED, "bmp_speed_slow.bin", 0);
289 288
   else
290
-    lv_obj_set_event_cb_mks(buttonSpeed, event_handler, ID_E_SPEED, "bmp_Speed_normal.bin", 0);
289
+    lv_obj_set_event_cb_mks(buttonSpeed, event_handler, ID_E_SPEED, "bmp_speed_normal.bin", 0);
291 290
 
292 291
   if (gCfgItems.multiple_language != 0) {
293 292
     if (uiCfg.extruSpeed == 20) {
@@ -351,11 +350,11 @@ void disp_extru_amount() {
351 350
 
352 351
 void disp_ext_step() {
353 352
   if (uiCfg.extruStep == 1)
354
-    lv_obj_set_event_cb_mks(buttonStep, event_handler, ID_E_STEP, "bmp_Step1_mm.bin", 0);
353
+    lv_obj_set_event_cb_mks(buttonStep, event_handler, ID_E_STEP, "bmp_step1_mm.bin", 0);
355 354
   else if (uiCfg.extruStep == 5)
356
-    lv_obj_set_event_cb_mks(buttonStep, event_handler, ID_E_STEP, "bmp_Step5_mm.bin", 0);
355
+    lv_obj_set_event_cb_mks(buttonStep, event_handler, ID_E_STEP, "bmp_step5_mm.bin", 0);
357 356
   else if (uiCfg.extruStep == 10)
358
-    lv_obj_set_event_cb_mks(buttonStep, event_handler, ID_E_STEP, "bmp_Step10_mm.bin", 0);
357
+    lv_obj_set_event_cb_mks(buttonStep, event_handler, ID_E_STEP, "bmp_step10_mm.bin", 0);
359 358
 
360 359
   if (gCfgItems.multiple_language != 0) {
361 360
     if (uiCfg.extruStep == 1) {
@@ -375,4 +374,4 @@ void disp_ext_step() {
375 374
 
376 375
 void lv_clear_extrusion() { lv_obj_del(scr); }
377 376
 
378
-#endif // TFT_LVGL_UI
377
+#endif // HAS_TFT_LVGL_UI

+ 35
- 32
Marlin/src/lcd/extui/lib/mks_ui/draw_fan.cpp View File

@@ -21,7 +21,7 @@
21 21
  */
22 22
 #include "../../../../inc/MarlinConfigPre.h"
23 23
 
24
-#if ENABLED(TFT_LVGL_UI)
24
+#if HAS_TFT_LVGL_UI
25 25
 
26 26
 #include "../../../../MarlinCore.h"
27 27
 #include "lv_conf.h"
@@ -33,6 +33,7 @@
33 33
 #include "draw_ui.h"
34 34
 #include "../../../../module/temperature.h"
35 35
 #include "../../../../gcode/queue.h"
36
+#include "../../../../gcode/gcode.h"
36 37
 
37 38
 static lv_obj_t * scr;
38 39
 static lv_obj_t * fanText;
@@ -55,9 +56,9 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
55 56
       else if (event == LV_EVENT_RELEASED) {
56 57
         if (fanSpeed + 1 <= 255) {
57 58
           fanSpeed++;
58
-          memset(public_buf_l, 0, sizeof(public_buf_l));
59
-          sprintf(public_buf_l, "M106 S%d", fanSpeed);
60
-          queue.enqueue_one_now(PSTR(public_buf_l));
59
+          ZERO(public_buf_l);
60
+          sprintf_P(public_buf_l, PSTR("M106 S%d"), fanSpeed);
61
+          gcode.process_subcommands_now(public_buf_l);
61 62
         }
62 63
       }
63 64
       break;
@@ -68,9 +69,9 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
68 69
       else if (event == LV_EVENT_RELEASED) {
69 70
         if (fanSpeed > 0) {
70 71
           fanSpeed--;
71
-          memset(public_buf_l, 0, sizeof(public_buf_l));
72
-          sprintf(public_buf_l, "M106 S%d", fanSpeed);
73
-          queue.enqueue_one_now(PSTR(public_buf_l));
72
+          ZERO(public_buf_l);
73
+          sprintf_P(public_buf_l, PSTR("M106 S%d"), fanSpeed);
74
+          gcode.process_subcommands_now(public_buf_l);
74 75
         }
75 76
       }
76 77
 
@@ -80,7 +81,7 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
80 81
         // nothing to do
81 82
       }
82 83
       else if (event == LV_EVENT_RELEASED) {
83
-        queue.enqueue_one_now(PSTR("M106 S255"));
84
+        gcode.process_subcommands_now_P(PSTR("M106 S255"));
84 85
       }
85 86
       break;
86 87
     case ID_F_MID:
@@ -88,7 +89,7 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
88 89
         // nothing to do
89 90
       }
90 91
       else if (event == LV_EVENT_RELEASED) {
91
-        queue.enqueue_one_now(PSTR("M106 S127"));
92
+        gcode.process_subcommands_now_P(PSTR("M106 S127"));
92 93
       }
93 94
       break;
94 95
     case ID_F_OFF:
@@ -96,7 +97,7 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
96 97
         // nothing to do
97 98
       }
98 99
       else if (event == LV_EVENT_RELEASED) {
99
-        queue.enqueue_one_now(PSTR("M107"));
100
+        gcode.process_subcommands_now_P(PSTR("M107"));
100 101
       }
101 102
       break;
102 103
     case ID_F_RETURN:
@@ -111,11 +112,13 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
111 112
   }
112 113
 }
113 114
 
114
-
115 115
 void lv_draw_fan(void) {
116 116
   lv_obj_t *buttonAdd, *buttonDec, *buttonHigh, *buttonMid;
117 117
   lv_obj_t *buttonOff, *buttonBack;
118 118
 
119
+  #if HAS_FAN
120
+    fanSpeed = thermalManager.fan_speed[0];
121
+  #endif
119 122
   if (disp_state_stack._disp_state[disp_state_stack._disp_index] != FAN_UI) {
120 123
     disp_state_stack._disp_index++;
121 124
     disp_state_stack._disp_state[disp_state_stack._disp_index] = FAN_UI;
@@ -129,7 +132,7 @@ void lv_draw_fan(void) {
129 132
   lv_obj_clean(scr);
130 133
 
131 134
   lv_obj_t * title = lv_label_create(scr, NULL);
132
-  lv_obj_set_style(title, &tft_style_lable_rel);
135
+  lv_obj_set_style(title, &tft_style_label_rel);
133 136
   lv_obj_set_pos(title, TITLE_XPOS, TITLE_YPOS);
134 137
   lv_label_set_text(title, creat_title_text());
135 138
 
@@ -148,39 +151,39 @@ void lv_draw_fan(void) {
148 151
   lv_obj_set_event_cb_mks(buttonAdd, event_handler, ID_F_ADD, "bmp_Add.bin", 0);
149 152
   lv_imgbtn_set_src(buttonAdd, LV_BTN_STATE_REL, &bmp_pic);
150 153
   lv_imgbtn_set_src(buttonAdd, LV_BTN_STATE_PR, &bmp_pic);
151
-  lv_imgbtn_set_style(buttonAdd, LV_BTN_STATE_PR, &tft_style_lable_pre);
152
-  lv_imgbtn_set_style(buttonAdd, LV_BTN_STATE_REL, &tft_style_lable_rel);
154
+  lv_imgbtn_set_style(buttonAdd, LV_BTN_STATE_PR, &tft_style_label_pre);
155
+  lv_imgbtn_set_style(buttonAdd, LV_BTN_STATE_REL, &tft_style_label_rel);
153 156
   lv_obj_clear_protect(buttonAdd, LV_PROTECT_FOLLOW);
154 157
   #if 1
155 158
     lv_obj_set_event_cb_mks(buttonDec, event_handler, ID_F_DEC, "bmp_Dec.bin", 0);
156 159
     lv_imgbtn_set_src(buttonDec, LV_BTN_STATE_REL, &bmp_pic);
157 160
     lv_imgbtn_set_src(buttonDec, LV_BTN_STATE_PR, &bmp_pic);
158
-    lv_imgbtn_set_style(buttonDec, LV_BTN_STATE_PR, &tft_style_lable_pre);
159
-    lv_imgbtn_set_style(buttonDec, LV_BTN_STATE_REL, &tft_style_lable_rel);
161
+    lv_imgbtn_set_style(buttonDec, LV_BTN_STATE_PR, &tft_style_label_pre);
162
+    lv_imgbtn_set_style(buttonDec, LV_BTN_STATE_REL, &tft_style_label_rel);
160 163
 
161
-    lv_obj_set_event_cb_mks(buttonHigh, event_handler, ID_F_HIGH, "bmp_Speed255.bin", 0);
164
+    lv_obj_set_event_cb_mks(buttonHigh, event_handler,ID_F_HIGH,"bmp_speed255.bin",0);
162 165
     lv_imgbtn_set_src(buttonHigh, LV_BTN_STATE_REL, &bmp_pic);
163 166
     lv_imgbtn_set_src(buttonHigh, LV_BTN_STATE_PR, &bmp_pic);
164
-    lv_imgbtn_set_style(buttonHigh, LV_BTN_STATE_PR, &tft_style_lable_pre);
165
-    lv_imgbtn_set_style(buttonHigh, LV_BTN_STATE_REL, &tft_style_lable_rel);
167
+    lv_imgbtn_set_style(buttonHigh, LV_BTN_STATE_PR, &tft_style_label_pre);
168
+    lv_imgbtn_set_style(buttonHigh, LV_BTN_STATE_REL, &tft_style_label_rel);
166 169
 
167
-    lv_obj_set_event_cb_mks(buttonMid, event_handler, ID_F_MID, "bmp_Speed127.bin", 0);
170
+    lv_obj_set_event_cb_mks(buttonMid, event_handler,ID_F_MID,"bmp_speed127.bin",0);
168 171
     lv_imgbtn_set_src(buttonMid, LV_BTN_STATE_REL, &bmp_pic);
169 172
     lv_imgbtn_set_src(buttonMid, LV_BTN_STATE_PR, &bmp_pic);
170
-    lv_imgbtn_set_style(buttonMid, LV_BTN_STATE_PR, &tft_style_lable_pre);
171
-    lv_imgbtn_set_style(buttonMid, LV_BTN_STATE_REL, &tft_style_lable_rel);
173
+    lv_imgbtn_set_style(buttonMid, LV_BTN_STATE_PR, &tft_style_label_pre);
174
+    lv_imgbtn_set_style(buttonMid, LV_BTN_STATE_REL, &tft_style_label_rel);
172 175
 
173
-    lv_obj_set_event_cb_mks(buttonOff, event_handler, ID_F_OFF, "bmp_Speed0.bin", 0);
176
+    lv_obj_set_event_cb_mks(buttonOff, event_handler,ID_F_OFF,"bmp_speed0.bin",0);
174 177
     lv_imgbtn_set_src(buttonOff, LV_BTN_STATE_REL, &bmp_pic);
175 178
     lv_imgbtn_set_src(buttonOff, LV_BTN_STATE_PR, &bmp_pic);
176
-    lv_imgbtn_set_style(buttonOff, LV_BTN_STATE_PR, &tft_style_lable_pre);
177
-    lv_imgbtn_set_style(buttonOff, LV_BTN_STATE_REL, &tft_style_lable_rel);
179
+    lv_imgbtn_set_style(buttonOff, LV_BTN_STATE_PR, &tft_style_label_pre);
180
+    lv_imgbtn_set_style(buttonOff, LV_BTN_STATE_REL, &tft_style_label_rel);
178 181
 
179
-    lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_F_RETURN, "bmp_Return.bin", 0);
182
+    lv_obj_set_event_cb_mks(buttonBack, event_handler,ID_F_RETURN,"bmp_return.bin",0);
180 183
     lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_REL, &bmp_pic);
181 184
     lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_PR, &bmp_pic);
182
-    lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_PR, &tft_style_lable_pre);
183
-    lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_REL, &tft_style_lable_rel);
185
+    lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_PR, &tft_style_label_pre);
186
+    lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_REL, &tft_style_label_rel);
184 187
   #endif
185 188
 
186 189
   lv_obj_set_pos(buttonAdd, INTERVAL_V, titleHeight);
@@ -227,7 +230,7 @@ void lv_draw_fan(void) {
227 230
   }
228 231
 
229 232
   fanText = lv_label_create(scr, NULL);
230
-  lv_obj_set_style(fanText, &tft_style_lable_rel);
233
+  lv_obj_set_style(fanText, &tft_style_label_rel);
231 234
   disp_fan_value();
232 235
 }
233 236
 
@@ -235,8 +238,8 @@ void disp_fan_value() {
235 238
   char buf1[10] = {0};
236 239
   public_buf_l[0] = '\0';
237 240
   strcat(public_buf_l, fan_menu.state);
238
-  strcat(public_buf_l, ": ");
239
-  sprintf(buf1, "%3d", thermalManager.fan_speed[0]);
241
+  strcat_P(public_buf_l, PSTR(": "));
242
+  sprintf_P(buf1, PSTR("%3d"), thermalManager.fan_speed[0]);
240 243
   strcat(public_buf_l, buf1);
241 244
   lv_label_set_text(fanText, public_buf_l);
242 245
   lv_obj_align(fanText, NULL, LV_ALIGN_CENTER, 0, -65);
@@ -244,4 +247,4 @@ void disp_fan_value() {
244 247
 
245 248
 void lv_clear_fan() { lv_obj_del(scr); }
246 249
 
247
-#endif // TFT_LVGL_UI
250
+#endif // HAS_TFT_LVGL_UI

+ 35
- 48
Marlin/src/lcd/extui/lib/mks_ui/draw_home.cpp View File

@@ -21,7 +21,7 @@
21 21
  */
22 22
 #include "../../../../inc/MarlinConfigPre.h"
23 23
 
24
-#if ENABLED(TFT_LVGL_UI)
24
+#if HAS_TFT_LVGL_UI
25 25
 
26 26
 #include "../../../../MarlinCore.h"
27 27
 #include "draw_ready_print.h"
@@ -48,8 +48,6 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
48 48
   switch (obj->mks_obj_id) {
49 49
     case ID_H_ALL:
50 50
       if (event == LV_EVENT_CLICKED) {
51
-
52
-
53 51
       }
54 52
       else if (event == LV_EVENT_RELEASED) {
55 53
         queue.inject_P(PSTR("G28"));
@@ -57,8 +55,6 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
57 55
       break;
58 56
     case ID_H_X:
59 57
       if (event == LV_EVENT_CLICKED) {
60
-
61
-
62 58
       }
63 59
       else if (event == LV_EVENT_RELEASED) {
64 60
         queue.inject_P(PSTR("G28 X0"));
@@ -66,8 +62,6 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
66 62
       break;
67 63
     case ID_H_Y:
68 64
       if (event == LV_EVENT_CLICKED) {
69
-
70
-
71 65
       }
72 66
       else if (event == LV_EVENT_RELEASED) {
73 67
         queue.inject_P(PSTR("G28 Y0"));
@@ -75,8 +69,6 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
75 69
       break;
76 70
     case ID_H_Z:
77 71
       if (event == LV_EVENT_CLICKED) {
78
-
79
-
80 72
       }
81 73
       else if (event == LV_EVENT_RELEASED) {
82 74
         queue.inject_P(PSTR("G28 Z0"));
@@ -84,8 +76,6 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
84 76
       break;
85 77
     case ID_H_OFF_ALL:
86 78
       if (event == LV_EVENT_CLICKED) {
87
-
88
-
89 79
       }
90 80
       else if (event == LV_EVENT_RELEASED) {
91 81
         queue.inject_P(PSTR("M84"));
@@ -93,8 +83,6 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
93 83
       break;
94 84
     case ID_H_OFF_XY:
95 85
       if (event == LV_EVENT_CLICKED) {
96
-
97
-
98 86
       }
99 87
       else if (event == LV_EVENT_RELEASED) {
100 88
         queue.inject_P(PSTR("M84 X Y"));
@@ -102,7 +90,6 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
102 90
       break;
103 91
     case ID_H_RETURN:
104 92
       if (event == LV_EVENT_CLICKED) {
105
-
106 93
       }
107 94
       else if (event == LV_EVENT_RELEASED) {
108 95
         lv_obj_del(scr);
@@ -113,7 +100,6 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
113 100
   }
114 101
 }
115 102
 
116
-
117 103
 void lv_draw_home(void) {
118 104
   lv_obj_t *buttonHomeAll, *buttonHomeX, *buttonHomeY, *buttonHomeZ;
119 105
   lv_obj_t *buttonBack;
@@ -134,7 +120,7 @@ void lv_draw_home(void) {
134 120
   lv_obj_clean(scr);
135 121
 
136 122
   lv_obj_t * title = lv_label_create(scr, NULL);
137
-  lv_obj_set_style(title, &tft_style_lable_rel);
123
+  lv_obj_set_style(title, &tft_style_label_rel);
138 124
   lv_obj_set_pos(title, TITLE_XPOS, TITLE_YPOS);
139 125
   lv_label_set_text(title, creat_title_text());
140 126
 
@@ -156,67 +142,68 @@ void lv_draw_home(void) {
156 142
   //lv_obj_set_event_cb_mks(buttonWifi, event_handler,ID_S_WIFI,"bmp_Wifi.bin",0);
157 143
   //lv_imgbtn_set_src(buttonWifi, LV_BTN_STATE_REL, &bmp_pic);
158 144
   //lv_imgbtn_set_src(buttonWifi, LV_BTN_STATE_PR, &bmp_pic);
159
-  //lv_imgbtn_set_style(buttonWifi, LV_BTN_STATE_PR, &tft_style_lable_pre);
160
-  //lv_imgbtn_set_style(buttonWifi, LV_BTN_STATE_REL, &tft_style_lable_rel);
145
+  //lv_imgbtn_set_style(buttonWifi, LV_BTN_STATE_PR, &tft_style_label_pre);
146
+  //lv_imgbtn_set_style(buttonWifi, LV_BTN_STATE_REL, &tft_style_label_rel);
161 147
   //lv_obj_clear_protect(buttonWifi, LV_PROTECT_FOLLOW);
162 148
   #if 1
163
-    lv_obj_set_event_cb_mks(buttonHomeAll, event_handler, ID_H_ALL, "bmp_Zero.bin", 0);
149
+    lv_obj_set_event_cb_mks(buttonHomeAll, event_handler,ID_H_ALL,"bmp_zero.bin",0);
164 150
     lv_imgbtn_set_src(buttonHomeAll, LV_BTN_STATE_REL, &bmp_pic);
165 151
     lv_imgbtn_set_src(buttonHomeAll, LV_BTN_STATE_PR, &bmp_pic);
166
-    lv_imgbtn_set_style(buttonHomeAll, LV_BTN_STATE_PR, &tft_style_lable_pre);
167
-    lv_imgbtn_set_style(buttonHomeAll, LV_BTN_STATE_REL, &tft_style_lable_rel);
152
+    lv_imgbtn_set_style(buttonHomeAll, LV_BTN_STATE_PR, &tft_style_label_pre);
153
+    lv_imgbtn_set_style(buttonHomeAll, LV_BTN_STATE_REL, &tft_style_label_rel);
168 154
 
169 155
     lv_obj_set_event_cb_mks(buttonHomeX, event_handler, ID_H_X, "bmp_zeroX.bin", 0);
170 156
     lv_imgbtn_set_src(buttonHomeX, LV_BTN_STATE_REL, &bmp_pic);
171 157
     lv_imgbtn_set_src(buttonHomeX, LV_BTN_STATE_PR, &bmp_pic);
172
-    lv_imgbtn_set_style(buttonHomeX, LV_BTN_STATE_PR, &tft_style_lable_pre);
173
-    lv_imgbtn_set_style(buttonHomeX, LV_BTN_STATE_REL, &tft_style_lable_rel);
158
+    lv_imgbtn_set_style(buttonHomeX, LV_BTN_STATE_PR, &tft_style_label_pre);
159
+    lv_imgbtn_set_style(buttonHomeX, LV_BTN_STATE_REL, &tft_style_label_rel);
174 160
 
175 161
     //lv_obj_set_event_cb_mks(buttonContinue, event_handler,ID_S_CONTINUE,"bmp_Breakpoint.bin",0);
176 162
     //lv_imgbtn_set_src(buttonContinue, LV_BTN_STATE_REL, &bmp_pic);
177 163
     //lv_imgbtn_set_src(buttonContinue, LV_BTN_STATE_PR, &bmp_pic);
178
-    //lv_imgbtn_set_style(buttonContinue, LV_BTN_STATE_PR, &tft_style_lable_pre);
179
-    //lv_imgbtn_set_style(buttonContinue, LV_BTN_STATE_REL, &tft_style_lable_rel);
164
+    //lv_imgbtn_set_style(buttonContinue, LV_BTN_STATE_PR, &tft_style_label_pre);
165
+    //lv_imgbtn_set_style(buttonContinue, LV_BTN_STATE_REL, &tft_style_label_rel);
180 166
 
181 167
     lv_obj_set_event_cb_mks(buttonHomeY, event_handler, ID_H_Y, "bmp_zeroY.bin", 0);
182 168
     lv_imgbtn_set_src(buttonHomeY, LV_BTN_STATE_REL, &bmp_pic);
183 169
     lv_imgbtn_set_src(buttonHomeY, LV_BTN_STATE_PR, &bmp_pic);
184
-    lv_imgbtn_set_style(buttonHomeY, LV_BTN_STATE_PR, &tft_style_lable_pre);
185
-    lv_imgbtn_set_style(buttonHomeY, LV_BTN_STATE_REL, &tft_style_lable_rel);
170
+    lv_imgbtn_set_style(buttonHomeY, LV_BTN_STATE_PR, &tft_style_label_pre);
171
+    lv_imgbtn_set_style(buttonHomeY, LV_BTN_STATE_REL, &tft_style_label_rel);
186 172
 
187 173
     lv_obj_set_event_cb_mks(buttonHomeZ, event_handler, ID_H_Z, "bmp_zeroZ.bin", 0);
188 174
     lv_imgbtn_set_src(buttonHomeZ, LV_BTN_STATE_REL, &bmp_pic);
189 175
     lv_imgbtn_set_src(buttonHomeZ, LV_BTN_STATE_PR, &bmp_pic);
190
-    lv_imgbtn_set_style(buttonHomeZ, LV_BTN_STATE_PR, &tft_style_lable_pre);
191
-    lv_imgbtn_set_style(buttonHomeZ, LV_BTN_STATE_REL, &tft_style_lable_rel);
176
+    lv_imgbtn_set_style(buttonHomeZ, LV_BTN_STATE_PR, &tft_style_label_pre);
177
+    lv_imgbtn_set_style(buttonHomeZ, LV_BTN_STATE_REL, &tft_style_label_rel);
192 178
 
193
-    lv_obj_set_event_cb_mks(buttonOffAll, event_handler, ID_H_OFF_ALL, "bmp_manual_off.bin", 0);
179
+    lv_obj_set_event_cb_mks(buttonOffAll, event_handler,ID_H_OFF_ALL,"bmp_function1.bin",0);
194 180
     lv_imgbtn_set_src(buttonOffAll, LV_BTN_STATE_REL, &bmp_pic);
195 181
     lv_imgbtn_set_src(buttonOffAll, LV_BTN_STATE_PR, &bmp_pic);
196
-    lv_imgbtn_set_style(buttonOffAll, LV_BTN_STATE_PR, &tft_style_lable_pre);
197
-    lv_imgbtn_set_style(buttonOffAll, LV_BTN_STATE_REL, &tft_style_lable_rel);
182
+    lv_imgbtn_set_style(buttonOffAll, LV_BTN_STATE_PR, &tft_style_label_pre);
183
+    lv_imgbtn_set_style(buttonOffAll, LV_BTN_STATE_REL, &tft_style_label_rel);
198 184
 
199
-    lv_obj_set_event_cb_mks(buttonOffXY, event_handler, ID_H_OFF_XY, "bmp_manual_off.bin", 0);
185
+    lv_obj_set_event_cb_mks(buttonOffXY, event_handler,ID_H_OFF_XY,"bmp_function1.bin",0);
200 186
     lv_imgbtn_set_src(buttonOffXY, LV_BTN_STATE_REL, &bmp_pic);
201 187
     lv_imgbtn_set_src(buttonOffXY, LV_BTN_STATE_PR, &bmp_pic);
202
-    lv_imgbtn_set_style(buttonOffXY, LV_BTN_STATE_PR, &tft_style_lable_pre);
203
-    lv_imgbtn_set_style(buttonOffXY, LV_BTN_STATE_REL, &tft_style_lable_rel);
188
+    lv_imgbtn_set_style(buttonOffXY, LV_BTN_STATE_PR, &tft_style_label_pre);
189
+    lv_imgbtn_set_style(buttonOffXY, LV_BTN_STATE_REL, &tft_style_label_rel);
204 190
 
205
-    lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_H_RETURN, "bmp_Return.bin", 0);
191
+    lv_obj_set_event_cb_mks(buttonBack, event_handler,ID_H_RETURN,"bmp_return.bin",0);
206 192
     lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_REL, &bmp_pic);
207 193
     lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_PR, &bmp_pic);
208
-    lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_PR, &tft_style_lable_pre);
209
-    lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_REL, &tft_style_lable_rel);
194
+    lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_PR, &tft_style_label_pre);
195
+    lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_REL, &tft_style_label_rel);
210 196
   #endif
211
-         /*lv_obj_set_pos(buttonWifi,INTERVAL_V,titleHeight);
212
-         lv_obj_set_pos(buttonFan,BTN_X_PIXEL+INTERVAL_V*2,titleHeight);
213
-         lv_obj_set_pos(buttonAbout,BTN_X_PIXEL*2+INTERVAL_V*3,titleHeight);
214
-         lv_obj_set_pos(buttonContinue,BTN_X_PIXEL*3+INTERVAL_V*4,titleHeight);
215
-         lv_obj_set_pos(buMotorOff,INTERVAL_V,  BTN_Y_PIXEL+INTERVAL_H+titleHeight);
216
-         lv_obj_set_pos(buttonLanguage,BTN_X_PIXEL+INTERVAL_V*2,BTN_Y_PIXEL+INTERVAL_H+titleHeight);
217
-         lv_obj_set_pos(buttonBack,BTN_X_PIXEL*3+INTERVAL_V*4,  BTN_Y_PIXEL+INTERVAL_H+titleHeight);*/
218
-
219
-  //lv_obj_set_pos(buttonWifi,INTERVAL_V,titleHeight);
197
+
198
+  /*lv_obj_set_pos(buttonWifi, INTERVAL_V, titleHeight);
199
+  lv_obj_set_pos(buttonFan, BTN_X_PIXEL+INTERVAL_V*2, titleHeight);
200
+  lv_obj_set_pos(buttonAbout, BTN_X_PIXEL*2+INTERVAL_V*3, titleHeight);
201
+  lv_obj_set_pos(buttonContinue, BTN_X_PIXEL*3+INTERVAL_V*4, titleHeight);
202
+  lv_obj_set_pos(buMotorOff, INTERVAL_V,  BTN_Y_PIXEL+INTERVAL_H+titleHeight);
203
+  lv_obj_set_pos(buttonLanguage, BTN_X_PIXEL+INTERVAL_V*2, BTN_Y_PIXEL+INTERVAL_H+titleHeight);
204
+  lv_obj_set_pos(buttonBack, BTN_X_PIXEL*3+INTERVAL_V*4, BTN_Y_PIXEL+INTERVAL_H+titleHeight);*/
205
+
206
+  //lv_obj_set_pos(buttonWifi, INTERVAL_V, titleHeight);
220 207
   lv_obj_set_pos(buttonHomeX, BTN_X_PIXEL + INTERVAL_V * 2, titleHeight);
221 208
   lv_obj_set_pos(buttonHomeY, BTN_X_PIXEL * 2 + INTERVAL_V * 3, titleHeight);
222 209
   //lv_obj_set_pos(buttonContinue,BTN_X_PIXEL*3+INTERVAL_V*4,titleHeight);
@@ -280,4 +267,4 @@ void lv_draw_home(void) {
280 267
 
281 268
 void lv_clear_home() { lv_obj_del(scr); }
282 269
 
283
-#endif // TFT_LVGL_UI
270
+#endif // HAS_TFT_LVGL_UI

+ 263
- 0
Marlin/src/lcd/extui/lib/mks_ui/draw_jerk_settings.cpp View File

@@ -0,0 +1,263 @@
1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
+ *
5
+ * Based on Sprinter and grbl.
6
+ * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
7
+ *
8
+ * This program is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+#include "../../../../inc/MarlinConfigPre.h"
23
+
24
+#if BOTH(HAS_TFT_LVGL_UI, HAS_CLASSIC_JERK)
25
+
26
+#include "lv_conf.h"
27
+#include "draw_ui.h"
28
+
29
+#include "../../../../MarlinCore.h"
30
+#include "../../../../module/planner.h"
31
+
32
+static lv_obj_t * scr;
33
+
34
+#define ID_JERK_RETURN  1
35
+#define ID_JERK_X       2
36
+#define ID_JERK_Y       3
37
+#define ID_JERK_Z       4
38
+#define ID_JERK_E       5
39
+
40
+static void event_handler(lv_obj_t * obj, lv_event_t event) {
41
+  switch (obj->mks_obj_id) {
42
+    case ID_JERK_RETURN:
43
+      if (event == LV_EVENT_CLICKED) {
44
+
45
+      }
46
+      else if (event == LV_EVENT_RELEASED) {
47
+        lv_clear_jerk_settings();
48
+        draw_return_ui();
49
+      }
50
+      break;
51
+    case ID_JERK_X:
52
+      if (event == LV_EVENT_CLICKED) {
53
+
54
+      }
55
+      else if (event == LV_EVENT_RELEASED) {
56
+        value = XJerk;
57
+        lv_clear_jerk_settings();
58
+        lv_draw_number_key();
59
+      }
60
+      break;
61
+    case ID_JERK_Y:
62
+      if (event == LV_EVENT_CLICKED) {
63
+
64
+      }
65
+      else if (event == LV_EVENT_RELEASED) {
66
+        value = YJerk;
67
+        lv_clear_jerk_settings();
68
+        lv_draw_number_key();
69
+      }
70
+      break;
71
+    case ID_JERK_Z:
72
+      if (event == LV_EVENT_CLICKED) {
73
+
74
+      }
75
+      else if (event == LV_EVENT_RELEASED) {
76
+        value = ZJerk;
77
+        lv_clear_jerk_settings();
78
+        lv_draw_number_key();
79
+      }
80
+      break;
81
+    case ID_JERK_E:
82
+      if (event == LV_EVENT_CLICKED) {
83
+
84
+      }
85
+      else if (event == LV_EVENT_RELEASED) {
86
+        value = EJerk;
87
+        lv_clear_jerk_settings();
88
+        lv_draw_number_key();
89
+      }
90
+      break;
91
+  }
92
+}
93
+
94
+void lv_draw_jerk_settings(void) {
95
+  lv_obj_t *buttonBack = NULL, *label_Back = NULL;
96
+  lv_obj_t *buttonXText = NULL, *labelXText = NULL, *buttonXValue = NULL, *labelXValue = NULL;
97
+  lv_obj_t *buttonYText = NULL, *labelYText = NULL, *buttonYValue = NULL, *labelYValue = NULL;
98
+  lv_obj_t *buttonZText = NULL, *labelZText = NULL, *buttonZValue = NULL, *labelZValue = NULL;
99
+  lv_obj_t *buttonEText = NULL, *labelEText = NULL, *buttonEValue = NULL, *labelEValue = NULL;
100
+  lv_obj_t * line1 = NULL, * line2 = NULL, * line3 = NULL, * line4 = NULL;
101
+  if (disp_state_stack._disp_state[disp_state_stack._disp_index] != JERK_UI) {
102
+    disp_state_stack._disp_index++;
103
+    disp_state_stack._disp_state[disp_state_stack._disp_index] = JERK_UI;
104
+  }
105
+  disp_state = JERK_UI;
106
+
107
+  scr = lv_obj_create(NULL, NULL);
108
+
109
+  lv_obj_set_style(scr, &tft_style_scr);
110
+  lv_scr_load(scr);
111
+  lv_obj_clean(scr);
112
+
113
+  lv_obj_t * title = lv_label_create(scr, NULL);
114
+  lv_obj_set_style(title, &tft_style_label_rel);
115
+  lv_obj_set_pos(title, TITLE_XPOS, TITLE_YPOS);
116
+  lv_label_set_text(title, machine_menu.JerkConfTitle);
117
+
118
+  lv_refr_now(lv_refr_get_disp_refreshing());
119
+
120
+  LV_IMG_DECLARE(bmp_para_back);
121
+  // LV_IMG_DECLARE(bmp_para_arrow);
122
+  LV_IMG_DECLARE(bmp_para_bank);
123
+
124
+  buttonXText = lv_btn_create(scr, NULL);                                 /*Add a button the current screen*/
125
+  lv_obj_set_pos(buttonXText, PARA_UI_POS_X, PARA_UI_POS_Y);              /*Set its position*/
126
+  lv_obj_set_size(buttonXText, PARA_UI_VALUE_SIZE_X, PARA_UI_SIZE_Y);     /*Set its size*/
127
+  lv_obj_set_event_cb(buttonXText, event_handler);
128
+  lv_btn_set_style(buttonXText, LV_BTN_STYLE_REL, &tft_style_label_rel);  /*Set the button's released style*/
129
+  lv_btn_set_style(buttonXText, LV_BTN_STYLE_PR, &tft_style_label_pre);   /*Set the button's pressed style*/
130
+  lv_btn_set_layout(buttonXText, LV_LAYOUT_OFF);
131
+  labelXText = lv_label_create(buttonXText, NULL);                        /*Add a label to the button*/
132
+
133
+  buttonXValue = lv_imgbtn_create(scr, NULL);
134
+  lv_obj_set_pos(buttonXValue, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y + PARA_UI_VALUE_V);
135
+  lv_obj_set_event_cb_mks(buttonXValue, event_handler, ID_JERK_X, "bmp_value_blank.bin", 0);
136
+  lv_imgbtn_set_src(buttonXValue, LV_BTN_STATE_REL, &bmp_para_bank);
137
+  lv_imgbtn_set_src(buttonXValue, LV_BTN_STATE_PR, &bmp_para_bank);
138
+  lv_imgbtn_set_style(buttonXValue, LV_BTN_STATE_PR, &style_para_value_pre);
139
+  lv_imgbtn_set_style(buttonXValue, LV_BTN_STATE_REL, &style_para_value_rel);
140
+  lv_btn_set_layout(buttonXValue, LV_LAYOUT_OFF);
141
+  labelXValue = lv_label_create(buttonXValue, NULL);
142
+
143
+  line1 = lv_line_create(scr, NULL);
144
+  lv_ex_line(line1, line_points[0]);
145
+
146
+  buttonYText = lv_btn_create(scr, NULL);                                 /*Add a button the current screen*/
147
+  lv_obj_set_pos(buttonYText, PARA_UI_POS_X, PARA_UI_POS_Y * 2);          /*Set its position*/
148
+  lv_obj_set_size(buttonYText, PARA_UI_VALUE_SIZE_X, PARA_UI_SIZE_Y);     /*Set its size*/
149
+  lv_obj_set_event_cb(buttonYText, event_handler);
150
+  lv_btn_set_style(buttonYText, LV_BTN_STYLE_REL, &tft_style_label_rel);  /*Set the button's released style*/
151
+  lv_btn_set_style(buttonYText, LV_BTN_STYLE_PR, &tft_style_label_pre);   /*Set the button's pressed style*/
152
+  lv_btn_set_layout(buttonYText, LV_LAYOUT_OFF);
153
+  labelYText = lv_label_create(buttonYText, NULL);                        /*Add a label to the button*/
154
+
155
+  buttonYValue = lv_imgbtn_create(scr, NULL);
156
+  lv_obj_set_pos(buttonYValue, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 2 + PARA_UI_VALUE_V);
157
+  lv_obj_set_event_cb_mks(buttonYValue, event_handler, ID_JERK_Y, "bmp_value_blank.bin", 0);
158
+  lv_imgbtn_set_src(buttonYValue, LV_BTN_STATE_REL, &bmp_para_bank);
159
+  lv_imgbtn_set_src(buttonYValue, LV_BTN_STATE_PR, &bmp_para_bank);
160
+  lv_imgbtn_set_style(buttonYValue, LV_BTN_STATE_PR, &style_para_value_pre);
161
+  lv_imgbtn_set_style(buttonYValue, LV_BTN_STATE_REL, &style_para_value_rel);
162
+  lv_btn_set_layout(buttonYValue, LV_LAYOUT_OFF);
163
+  labelYValue = lv_label_create(buttonYValue, NULL);
164
+
165
+  line2 = lv_line_create(scr, NULL);
166
+  lv_ex_line(line2, line_points[1]);
167
+
168
+  buttonZText = lv_btn_create(scr, NULL);                                 /*Add a button the current screen*/
169
+  lv_obj_set_pos(buttonZText, PARA_UI_POS_X, PARA_UI_POS_Y * 3);          /*Set its position*/
170
+  lv_obj_set_size(buttonZText, PARA_UI_VALUE_SIZE_X, PARA_UI_SIZE_Y);     /*Set its size*/
171
+  lv_obj_set_event_cb(buttonZText, event_handler);
172
+  lv_btn_set_style(buttonZText, LV_BTN_STYLE_REL, &tft_style_label_rel);  /*Set the button's released style*/
173
+  lv_btn_set_style(buttonZText, LV_BTN_STYLE_PR, &tft_style_label_pre);   /*Set the button's pressed style*/
174
+  lv_btn_set_layout(buttonZText, LV_LAYOUT_OFF);
175
+  labelZText = lv_label_create(buttonZText, NULL);                        /*Add a label to the button*/
176
+
177
+  buttonZValue = lv_imgbtn_create(scr, NULL);
178
+  lv_obj_set_pos(buttonZValue, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 3 + PARA_UI_VALUE_V);
179
+  lv_obj_set_event_cb_mks(buttonZValue, event_handler, ID_JERK_Z, "bmp_value_blank.bin", 0);
180
+  lv_imgbtn_set_src(buttonZValue, LV_BTN_STATE_REL, &bmp_para_bank);
181
+  lv_imgbtn_set_src(buttonZValue, LV_BTN_STATE_PR, &bmp_para_bank);
182
+  lv_imgbtn_set_style(buttonZValue, LV_BTN_STATE_PR, &style_para_value_pre);
183
+  lv_imgbtn_set_style(buttonZValue, LV_BTN_STATE_REL, &style_para_value_rel);
184
+  lv_btn_set_layout(buttonZValue, LV_LAYOUT_OFF);
185
+  labelZValue = lv_label_create(buttonZValue, NULL);
186
+
187
+  line3 = lv_line_create(scr, NULL);
188
+  lv_ex_line(line3, line_points[2]);
189
+
190
+  buttonEText = lv_btn_create(scr, NULL);                                 /*Add a button the current screen*/
191
+  lv_obj_set_pos(buttonEText, PARA_UI_POS_X, PARA_UI_POS_Y * 4);          /*Set its position*/
192
+  lv_obj_set_size(buttonEText, PARA_UI_VALUE_SIZE_X, PARA_UI_SIZE_Y);     /*Set its size*/
193
+  lv_obj_set_event_cb(buttonEText, event_handler);
194
+  lv_btn_set_style(buttonEText, LV_BTN_STYLE_REL, &tft_style_label_rel);  /*Set the button's released style*/
195
+  lv_btn_set_style(buttonEText, LV_BTN_STYLE_PR, &tft_style_label_pre);   /*Set the button's pressed style*/
196
+  lv_btn_set_layout(buttonEText, LV_LAYOUT_OFF);
197
+  labelEText = lv_label_create(buttonEText, NULL);                        /*Add a label to the button*/
198
+
199
+  buttonEValue = lv_imgbtn_create(scr, NULL);
200
+  lv_obj_set_pos(buttonEValue, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 4 + PARA_UI_VALUE_V);
201
+  lv_obj_set_event_cb_mks(buttonEValue, event_handler, ID_JERK_E, "bmp_value_blank.bin", 0);
202
+  lv_imgbtn_set_src(buttonEValue, LV_BTN_STATE_REL, &bmp_para_bank);
203
+  lv_imgbtn_set_src(buttonEValue, LV_BTN_STATE_PR, &bmp_para_bank);
204
+  lv_imgbtn_set_style(buttonEValue, LV_BTN_STATE_PR, &style_para_value_pre);
205
+  lv_imgbtn_set_style(buttonEValue, LV_BTN_STATE_REL, &style_para_value_rel);
206
+  lv_btn_set_layout(buttonEValue, LV_LAYOUT_OFF);
207
+  labelEValue = lv_label_create(buttonEValue, NULL);
208
+
209
+  line4 = lv_line_create(scr, NULL);
210
+  lv_ex_line(line4, line_points[3]);
211
+
212
+  buttonBack = lv_imgbtn_create(scr, NULL);
213
+  lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_JERK_RETURN, "bmp_back70x40.bin", 0);
214
+  lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_REL, &bmp_para_back);
215
+  lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_PR, &bmp_para_back);
216
+  lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_PR, &tft_style_label_pre);
217
+  lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_REL, &tft_style_label_rel);
218
+
219
+  lv_obj_set_pos(buttonBack, PARA_UI_BACL_POS_X, PARA_UI_BACL_POS_Y);
220
+  lv_btn_set_layout(buttonBack, LV_LAYOUT_OFF);
221
+  label_Back = lv_label_create(buttonBack, NULL);
222
+
223
+  if (gCfgItems.multiple_language != 0) {
224
+    ZERO(public_buf_l);
225
+    sprintf_P(public_buf_l, PSTR("%.1f"), planner.max_jerk[X_AXIS]);
226
+    lv_label_set_text(labelXValue, public_buf_l);
227
+    lv_obj_align(labelXValue, buttonXValue, LV_ALIGN_CENTER, 0, 0);
228
+
229
+    ZERO(public_buf_l);
230
+    sprintf_P(public_buf_l, PSTR("%.1f"), planner.max_jerk[Y_AXIS]);
231
+    lv_label_set_text(labelYValue, public_buf_l);
232
+    lv_obj_align(labelYValue, buttonYValue, LV_ALIGN_CENTER, 0, 0);
233
+
234
+    ZERO(public_buf_l);
235
+    sprintf_P(public_buf_l, PSTR("%.1f"), planner.max_jerk[Z_AXIS]);
236
+    lv_label_set_text(labelZValue, public_buf_l);
237
+    lv_obj_align(labelZValue, buttonZValue, LV_ALIGN_CENTER, 0, 0);
238
+
239
+    ZERO(public_buf_l);
240
+    sprintf_P(public_buf_l, PSTR("%.1f"), planner.max_jerk[E_AXIS]);
241
+    lv_label_set_text(labelEValue, public_buf_l);
242
+    lv_obj_align(labelEValue, buttonEValue, LV_ALIGN_CENTER, 0, 0);
243
+
244
+    lv_label_set_text(labelXText, machine_menu.X_Jerk);
245
+    lv_obj_align(labelXText, buttonXText, LV_ALIGN_IN_LEFT_MID, 0, 0);
246
+
247
+    lv_label_set_text(labelYText, machine_menu.Y_Jerk);
248
+    lv_obj_align(labelYText, buttonYText, LV_ALIGN_IN_LEFT_MID, 0, 0);
249
+
250
+    lv_label_set_text(labelZText, machine_menu.Z_Jerk);
251
+    lv_obj_align(labelZText, buttonZText, LV_ALIGN_IN_LEFT_MID, 0, 0);
252
+
253
+    lv_label_set_text(labelEText, machine_menu.E_Jerk);
254
+    lv_obj_align(labelEText, buttonEText, LV_ALIGN_IN_LEFT_MID, 0, 0);
255
+
256
+    lv_label_set_text(label_Back, common_menu.text_back);
257
+    lv_obj_align(label_Back, buttonBack, LV_ALIGN_CENTER, 0, 0);
258
+  }
259
+}
260
+
261
+void lv_clear_jerk_settings() { lv_obj_del(scr); }
262
+
263
+#endif // HAS_TFT_LVGL_UI && HAS_CLASSIC_JERK

+ 33
- 0
Marlin/src/lcd/extui/lib/mks_ui/draw_jerk_settings.h View File

@@ -0,0 +1,33 @@
1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
+ *
5
+ * Based on Sprinter and grbl.
6
+ * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
7
+ *
8
+ * This program is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+#pragma once
23
+
24
+#ifdef __cplusplus
25
+extern "C" { /* C-declarations for C++ */
26
+#endif
27
+
28
+extern void lv_draw_jerk_settings(void);
29
+extern void lv_clear_jerk_settings();
30
+
31
+#ifdef __cplusplus
32
+} /* C-declarations for C++ */
33
+#endif

+ 75
- 77
Marlin/src/lcd/extui/lib/mks_ui/draw_language.cpp View File

@@ -21,7 +21,7 @@
21 21
  */
22 22
 #include "../../../../inc/MarlinConfigPre.h"
23 23
 
24
-#if ENABLED(TFT_LVGL_UI)
24
+#if HAS_TFT_LVGL_UI
25 25
 
26 26
 #include "lv_conf.h"
27 27
 #include "draw_ui.h"
@@ -35,17 +35,17 @@
35 35
 
36 36
 //static lv_obj_t *buttonMoveZ,*buttonTest,*buttonZ0,*buttonStop,*buttonReturn;
37 37
 
38
-#define ID_CN                           1
39
-#define ID_T_CN                         2
40
-#define ID_EN                           3
41
-#define ID_RU                           4
42
-#define ID_ES                           5
43
-#define ID_FR                           6
44
-#define ID_IT                           7
45
-#define ID_L_RETURN                     8
38
+#define ID_CN       1
39
+#define ID_T_CN     2
40
+#define ID_EN       3
41
+#define ID_RU       4
42
+#define ID_ES       5
43
+#define ID_FR       6
44
+#define ID_IT       7
45
+#define ID_L_RETURN 8
46 46
 
47
-#define SELECTED                        1
48
-#define UNSELECTED                      0
47
+#define SELECTED    1
48
+#define UNSELECTED  0
49 49
 
50 50
 static void disp_language(uint8_t language, uint8_t state);
51 51
 
@@ -85,7 +85,7 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
85 85
       }
86 86
       else if (event == LV_EVENT_RELEASED) {
87 87
         disp_language(gCfgItems.language, UNSELECTED);
88
-        lv_obj_set_event_cb_mks(buttonEN, event_handler, ID_EN, "bmp_English_sel.bin", 0);
88
+        lv_obj_set_event_cb_mks(buttonEN, event_handler, ID_EN, "bmp_english_sel.bin", 0);
89 89
         gCfgItems.language = LANG_ENGLISH;
90 90
         gCfg_to_spiFlah();
91 91
         disp_language_init();
@@ -97,7 +97,7 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
97 97
       }
98 98
       else if (event == LV_EVENT_RELEASED) {
99 99
         disp_language(gCfgItems.language, UNSELECTED);
100
-        lv_obj_set_event_cb_mks(buttonRU, event_handler, ID_RU, "bmp_Russian_sel.bin", 0);
100
+        lv_obj_set_event_cb_mks(buttonRU, event_handler, ID_RU, "bmp_russian_sel.bin", 0);
101 101
         gCfgItems.language = LANG_RUSSIAN;
102 102
         gCfg_to_spiFlah();
103 103
         disp_language_init();
@@ -109,7 +109,7 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
109 109
       }
110 110
       else if (event == LV_EVENT_RELEASED) {
111 111
         disp_language(gCfgItems.language, UNSELECTED);
112
-        lv_obj_set_event_cb_mks(buttonES, event_handler, ID_ES, "bmp_Spanish_sel.bin", 0);
112
+        lv_obj_set_event_cb_mks(buttonES, event_handler, ID_ES, "bmp_spanish_sel.bin", 0);
113 113
         gCfgItems.language = LANG_SPANISH;
114 114
         gCfg_to_spiFlah();
115 115
         disp_language_init();
@@ -121,7 +121,7 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
121 121
       }
122 122
       else if (event == LV_EVENT_RELEASED) {
123 123
         disp_language(gCfgItems.language, UNSELECTED);
124
-        lv_obj_set_event_cb_mks(buttonFR, event_handler, ID_FR, "bmp_French_sel.bin", 0);
124
+        lv_obj_set_event_cb_mks(buttonFR, event_handler, ID_FR, "bmp_french_sel.bin", 0);
125 125
         gCfgItems.language = LANG_FRENCH;
126 126
         gCfg_to_spiFlah();
127 127
         disp_language_init();
@@ -133,7 +133,7 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
133 133
       }
134 134
       else if (event == LV_EVENT_RELEASED) {
135 135
         disp_language(gCfgItems.language, UNSELECTED);
136
-        lv_obj_set_event_cb_mks(buttonIT, event_handler, ID_FR, "bmp_Italy_sel.bin", 0);
136
+        lv_obj_set_event_cb_mks(buttonIT, event_handler, ID_FR, "bmp_italy_sel.bin", 0);
137 137
         gCfgItems.language = LANG_ITALY;
138 138
         gCfg_to_spiFlah();
139 139
         disp_language_init();
@@ -145,14 +145,14 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
145 145
       }
146 146
       else if (event == LV_EVENT_RELEASED) {
147 147
 
148
-        buttonCN = NULL;
148
+        buttonCN   = NULL;
149 149
         buttonT_CN = NULL;
150
-        buttonEN = NULL;
151
-        buttonRU = NULL;
152
-        buttonES = NULL;
153
-        buttonFR = NULL;
154
-        buttonFR = NULL;
155
-        buttonIT = NULL;
150
+        buttonEN   = NULL;
151
+        buttonRU   = NULL;
152
+        buttonES   = NULL;
153
+        buttonFR   = NULL;
154
+        buttonFR   = NULL;
155
+        buttonIT   = NULL;
156 156
         buttonBack = NULL;
157 157
 
158 158
         lv_obj_del(scr);
@@ -170,52 +170,51 @@ static void disp_language(uint8_t language, uint8_t state) {
170 170
   public_buf_l[0] = '\0';
171 171
 
172 172
   switch (language) {
173
-
174 173
     case LANG_SIMPLE_CHINESE:
175 174
       id = ID_CN;
176
-      strcat(public_buf_l, "bmp_Simple_cn");
175
+      strcpy_P(public_buf_l, PSTR("bmp_simplified_cn"));
177 176
       obj = buttonCN;
178
-
179 177
       break;
180 178
     case LANG_COMPLEX_CHINESE:
181 179
       id = ID_T_CN;
182
-      strcat(public_buf_l, "bmp_Tradition_cn");
180
+      strcpy_P(public_buf_l, PSTR("bmp_traditional_cn"));
183 181
       obj = buttonT_CN;
184 182
       break;
185 183
     case LANG_ENGLISH:
186 184
       id = ID_EN;
187
-      strcat(public_buf_l, "bmp_English");
185
+      strcpy_P(public_buf_l, PSTR("bmp_english"));
188 186
       obj = buttonEN;
189 187
       break;
190 188
     case LANG_RUSSIAN:
191 189
       id = ID_RU;
192
-      strcat(public_buf_l, "bmp_Russian");
190
+      strcpy_P(public_buf_l, PSTR("bmp_russian"));
193 191
       obj = buttonRU;
194 192
       break;
195 193
     case LANG_SPANISH:
196 194
       id = ID_ES;
197
-      strcat(public_buf_l, "bmp_Spanish");
195
+      strcpy_P(public_buf_l, PSTR("bmp_spanish"));
198 196
       obj = buttonES;
199 197
       break;
200 198
     case LANG_FRENCH:
201 199
       id = ID_FR;
202
-      strcat(public_buf_l, "bmp_French");
200
+      strcpy_P(public_buf_l, PSTR("bmp_french"));
203 201
       obj = buttonFR;
204 202
       break;
205 203
     case LANG_ITALY:
206 204
       id = ID_IT;
207
-      strcat(public_buf_l, "bmp_Italy");
205
+      strcpy_P(public_buf_l, PSTR("bmp_italy"));
208 206
       obj = buttonIT;
209 207
       break;
210 208
     default:
211 209
       id = ID_CN;
212
-      strcat(public_buf_l, "bmp_Simple_cn");
210
+      strcpy_P(public_buf_l, PSTR("bmp_simplified_cn"));
213 211
       obj = buttonCN;
214 212
       break;
215 213
   }
216 214
 
217
-  if (state == SELECTED) strcat(public_buf_l, "_sel.bin");
218
-  else strcat(public_buf_l, ".bin");
215
+  if (state == SELECTED) strcat_P(public_buf_l, PSTR("_sel"));
216
+
217
+  strcat_P(public_buf_l, PSTR(".bin"));
219 218
 
220 219
   lv_obj_set_event_cb_mks(obj, event_handler, id, public_buf_l, 0);
221 220
 
@@ -232,14 +231,14 @@ void lv_draw_language(void) {
232 231
 
233 232
   scr = lv_obj_create(NULL, NULL);
234 233
 
235
-  //static lv_style_t tool_style;
234
+  // static lv_style_t tool_style;
236 235
 
237 236
   lv_obj_set_style(scr, &tft_style_scr);
238 237
   lv_scr_load(scr);
239 238
   lv_obj_clean(scr);
240 239
 
241 240
   lv_obj_t * title = lv_label_create(scr, NULL);
242
-  lv_obj_set_style(title, &tft_style_lable_rel);
241
+  lv_obj_set_style(title, &tft_style_label_rel);
243 242
   lv_obj_set_pos(title, TITLE_XPOS, TITLE_YPOS);
244 243
   lv_label_set_text(title, creat_title_text());
245 244
 
@@ -248,74 +247,73 @@ void lv_draw_language(void) {
248 247
   LV_IMG_DECLARE(bmp_pic);
249 248
 
250 249
   /*Create an Image button*/
251
-  buttonCN = lv_imgbtn_create(scr, NULL);
250
+  buttonCN   = lv_imgbtn_create(scr, NULL);
252 251
   buttonT_CN = lv_imgbtn_create(scr, NULL);
253
-  buttonEN = lv_imgbtn_create(scr, NULL);
254
-  buttonRU = lv_imgbtn_create(scr, NULL);
255
-  buttonES = lv_imgbtn_create(scr, NULL);
256
-  buttonFR = lv_imgbtn_create(scr, NULL);
257
-  buttonIT = lv_imgbtn_create(scr, NULL);
252
+  buttonEN   = lv_imgbtn_create(scr, NULL);
253
+  buttonRU   = lv_imgbtn_create(scr, NULL);
254
+  buttonES   = lv_imgbtn_create(scr, NULL);
255
+  buttonFR   = lv_imgbtn_create(scr, NULL);
256
+  buttonIT   = lv_imgbtn_create(scr, NULL);
258 257
   buttonBack = lv_imgbtn_create(scr, NULL);
259 258
 
260
-
261 259
   lv_obj_set_event_cb_mks(buttonCN, event_handler, ID_CN, "bmp_simplified_cn.bin", 0);
262 260
   lv_imgbtn_set_src(buttonCN, LV_BTN_STATE_REL, &bmp_pic);
263 261
   lv_imgbtn_set_src(buttonCN, LV_BTN_STATE_PR, &bmp_pic);
264
-  lv_imgbtn_set_style(buttonCN, LV_BTN_STATE_PR, &tft_style_lable_pre);
265
-  lv_imgbtn_set_style(buttonCN, LV_BTN_STATE_REL, &tft_style_lable_rel);
262
+  lv_imgbtn_set_style(buttonCN, LV_BTN_STATE_PR, &tft_style_label_pre);
263
+  lv_imgbtn_set_style(buttonCN, LV_BTN_STATE_REL, &tft_style_label_rel);
266 264
   lv_obj_clear_protect(buttonCN, LV_PROTECT_FOLLOW);
267 265
   #if 1
268 266
     lv_obj_set_event_cb_mks(buttonT_CN, event_handler, ID_T_CN, "bmp_traditional_cn.bin", 0);
269 267
     lv_imgbtn_set_src(buttonT_CN, LV_BTN_STATE_REL, &bmp_pic);
270 268
     lv_imgbtn_set_src(buttonT_CN, LV_BTN_STATE_PR, &bmp_pic);
271
-    lv_imgbtn_set_style(buttonT_CN, LV_BTN_STATE_PR, &tft_style_lable_pre);
272
-    lv_imgbtn_set_style(buttonT_CN, LV_BTN_STATE_REL, &tft_style_lable_rel);
269
+    lv_imgbtn_set_style(buttonT_CN, LV_BTN_STATE_PR, &tft_style_label_pre);
270
+    lv_imgbtn_set_style(buttonT_CN, LV_BTN_STATE_REL, &tft_style_label_rel);
273 271
 
274
-    lv_obj_set_event_cb_mks(buttonEN, event_handler, ID_EN, "bmp_English.bin", 0);
272
+    lv_obj_set_event_cb_mks(buttonEN, event_handler, ID_EN, "bmp_english.bin", 0);
275 273
     lv_imgbtn_set_src(buttonEN, LV_BTN_STATE_REL, &bmp_pic);
276 274
     lv_imgbtn_set_src(buttonEN, LV_BTN_STATE_PR, &bmp_pic);
277
-    lv_imgbtn_set_style(buttonEN, LV_BTN_STATE_PR, &tft_style_lable_pre);
278
-    lv_imgbtn_set_style(buttonEN, LV_BTN_STATE_REL, &tft_style_lable_rel);
275
+    lv_imgbtn_set_style(buttonEN, LV_BTN_STATE_PR, &tft_style_label_pre);
276
+    lv_imgbtn_set_style(buttonEN, LV_BTN_STATE_REL, &tft_style_label_rel);
279 277
 
280
-    lv_obj_set_event_cb_mks(buttonRU, event_handler, ID_RU, "bmp_Russian.bin", 0);
278
+    lv_obj_set_event_cb_mks(buttonRU, event_handler, ID_RU, "bmp_russian.bin", 0);
281 279
     lv_imgbtn_set_src(buttonRU, LV_BTN_STATE_REL, &bmp_pic);
282 280
     lv_imgbtn_set_src(buttonRU, LV_BTN_STATE_PR, &bmp_pic);
283
-    lv_imgbtn_set_style(buttonRU, LV_BTN_STATE_PR, &tft_style_lable_pre);
284
-    lv_imgbtn_set_style(buttonRU, LV_BTN_STATE_REL, &tft_style_lable_rel);
281
+    lv_imgbtn_set_style(buttonRU, LV_BTN_STATE_PR, &tft_style_label_pre);
282
+    lv_imgbtn_set_style(buttonRU, LV_BTN_STATE_REL, &tft_style_label_rel);
285 283
 
286
-    lv_obj_set_event_cb_mks(buttonES, event_handler, ID_ES, "bmp_Spanish.bin", 0);
284
+    lv_obj_set_event_cb_mks(buttonES, event_handler, ID_ES, "bmp_spanish.bin", 0);
287 285
     lv_imgbtn_set_src(buttonES, LV_BTN_STATE_REL, &bmp_pic);
288 286
     lv_imgbtn_set_src(buttonES, LV_BTN_STATE_PR, &bmp_pic);
289
-    lv_imgbtn_set_style(buttonES, LV_BTN_STATE_PR, &tft_style_lable_pre);
290
-    lv_imgbtn_set_style(buttonES, LV_BTN_STATE_REL, &tft_style_lable_rel);
287
+    lv_imgbtn_set_style(buttonES, LV_BTN_STATE_PR, &tft_style_label_pre);
288
+    lv_imgbtn_set_style(buttonES, LV_BTN_STATE_REL, &tft_style_label_rel);
291 289
 
292
-    lv_obj_set_event_cb_mks(buttonFR, event_handler, ID_FR, "bmp_French.bin", 0);
290
+    lv_obj_set_event_cb_mks(buttonFR, event_handler, ID_FR, "bmp_french.bin", 0);
293 291
     lv_imgbtn_set_src(buttonFR, LV_BTN_STATE_REL, &bmp_pic);
294 292
     lv_imgbtn_set_src(buttonFR, LV_BTN_STATE_PR, &bmp_pic);
295
-    lv_imgbtn_set_style(buttonFR, LV_BTN_STATE_PR, &tft_style_lable_pre);
296
-    lv_imgbtn_set_style(buttonFR, LV_BTN_STATE_REL, &tft_style_lable_rel);
293
+    lv_imgbtn_set_style(buttonFR, LV_BTN_STATE_PR, &tft_style_label_pre);
294
+    lv_imgbtn_set_style(buttonFR, LV_BTN_STATE_REL, &tft_style_label_rel);
297 295
 
298
-    lv_obj_set_event_cb_mks(buttonIT, event_handler, ID_IT, "bmp_Italy.bin", 0);
296
+    lv_obj_set_event_cb_mks(buttonIT, event_handler, ID_IT, "bmp_italy.bin", 0);
299 297
     lv_imgbtn_set_src(buttonIT, LV_BTN_STATE_REL, &bmp_pic);
300 298
     lv_imgbtn_set_src(buttonIT, LV_BTN_STATE_PR, &bmp_pic);
301
-    lv_imgbtn_set_style(buttonIT, LV_BTN_STATE_PR, &tft_style_lable_pre);
302
-    lv_imgbtn_set_style(buttonIT, LV_BTN_STATE_REL, &tft_style_lable_rel);
299
+    lv_imgbtn_set_style(buttonIT, LV_BTN_STATE_PR, &tft_style_label_pre);
300
+    lv_imgbtn_set_style(buttonIT, LV_BTN_STATE_REL, &tft_style_label_rel);
303 301
 
304
-    lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_L_RETURN, "bmp_Return.bin", 0);
302
+    lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_L_RETURN, "bmp_return.bin", 0);
305 303
     lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_REL, &bmp_pic);
306 304
     lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_PR, &bmp_pic);
307
-    lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_PR, &tft_style_lable_pre);
308
-    lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_REL, &tft_style_lable_rel);
309
-  #endif
305
+    lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_PR, &tft_style_label_pre);
306
+    lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_REL, &tft_style_label_rel);
307
+  #endif // if 1
310 308
 
311 309
   lv_obj_set_pos(buttonCN, INTERVAL_V, titleHeight);
312 310
   lv_obj_set_pos(buttonT_CN, BTN_X_PIXEL + INTERVAL_V * 2, titleHeight);
313 311
   lv_obj_set_pos(buttonEN, BTN_X_PIXEL * 2 + INTERVAL_V * 3, titleHeight);
314 312
   lv_obj_set_pos(buttonRU, BTN_X_PIXEL * 3 + INTERVAL_V * 4, titleHeight);
315
-  lv_obj_set_pos(buttonES, INTERVAL_V,  BTN_Y_PIXEL + INTERVAL_H + titleHeight);
313
+  lv_obj_set_pos(buttonES, INTERVAL_V, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
316 314
   lv_obj_set_pos(buttonFR, BTN_X_PIXEL + INTERVAL_V * 2, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
317
-  lv_obj_set_pos(buttonIT, BTN_X_PIXEL * 2 + INTERVAL_V * 3,  BTN_Y_PIXEL + INTERVAL_H + titleHeight);
318
-  lv_obj_set_pos(buttonBack, BTN_X_PIXEL * 3 + INTERVAL_V * 4,  BTN_Y_PIXEL + INTERVAL_H + titleHeight);
315
+  lv_obj_set_pos(buttonIT, BTN_X_PIXEL * 2 + INTERVAL_V * 3, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
316
+  lv_obj_set_pos(buttonBack, BTN_X_PIXEL * 3 + INTERVAL_V * 4, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
319 317
 
320 318
   /*Create a label on the Image button*/
321 319
   lv_btn_set_layout(buttonCN, LV_LAYOUT_OFF);
@@ -327,13 +325,13 @@ void lv_draw_language(void) {
327 325
   lv_btn_set_layout(buttonIT, LV_LAYOUT_OFF);
328 326
   lv_btn_set_layout(buttonBack, LV_LAYOUT_OFF);
329 327
 
330
-  lv_obj_t * label_CN = lv_label_create(buttonCN, NULL);
328
+  lv_obj_t * label_CN   = lv_label_create(buttonCN, NULL);
331 329
   lv_obj_t * label_T_CN = lv_label_create(buttonT_CN, NULL);
332
-  lv_obj_t * label_EN = lv_label_create(buttonEN, NULL);
333
-  lv_obj_t * label_RU = lv_label_create(buttonRU, NULL);
334
-  lv_obj_t * label_ES = lv_label_create(buttonES, NULL);
335
-  lv_obj_t * label_FR = lv_label_create(buttonFR, NULL);
336
-  lv_obj_t * label_IT = lv_label_create(buttonIT, NULL);
330
+  lv_obj_t * label_EN   = lv_label_create(buttonEN, NULL);
331
+  lv_obj_t * label_RU   = lv_label_create(buttonRU, NULL);
332
+  lv_obj_t * label_ES   = lv_label_create(buttonES, NULL);
333
+  lv_obj_t * label_FR   = lv_label_create(buttonFR, NULL);
334
+  lv_obj_t * label_IT   = lv_label_create(buttonIT, NULL);
337 335
   lv_obj_t * label_Back = lv_label_create(buttonBack, NULL);
338 336
 
339 337
   disp_language(gCfgItems.language, SELECTED);
@@ -367,4 +365,4 @@ void lv_draw_language(void) {
367 365
 
368 366
 void lv_clear_language() { lv_obj_del(scr); }
369 367
 
370
-#endif // TFT_LVGL_UI
368
+#endif // HAS_TFT_LVGL_UI

+ 232
- 0
Marlin/src/lcd/extui/lib/mks_ui/draw_machine_para.cpp View File

@@ -0,0 +1,232 @@
1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
+ *
5
+ * Based on Sprinter and grbl.
6
+ * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
7
+ *
8
+ * This program is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+#include "../../../../inc/MarlinConfigPre.h"
23
+
24
+#if HAS_TFT_LVGL_UI
25
+
26
+#include "lv_conf.h"
27
+#include "draw_ui.h"
28
+
29
+#include "../../../../MarlinCore.h"
30
+
31
+static lv_obj_t * scr;
32
+
33
+#define ID_PARA_RETURN        1
34
+#define ID_PARA_MACHINE       2
35
+#define ID_PARA_MACHINE_ARROW 3
36
+#define ID_PARA_MOTOR         4
37
+#define ID_PARA_MOTOR_ARROW   5
38
+#define ID_PARA_ADVANCE       6
39
+#define ID_PARA_ADVANCE_ARROW 7
40
+
41
+static void event_handler(lv_obj_t * obj, lv_event_t event) {
42
+  switch (obj->mks_obj_id) {
43
+    case ID_PARA_RETURN:
44
+      if (event == LV_EVENT_CLICKED) {
45
+
46
+      }
47
+      else if (event == LV_EVENT_RELEASED) {
48
+        lv_clear_machine_para();
49
+        draw_return_ui();
50
+      }
51
+      break;
52
+    case ID_PARA_MACHINE:
53
+      if (event == LV_EVENT_CLICKED) {
54
+
55
+      }
56
+      else if (event == LV_EVENT_RELEASED) {
57
+        lv_clear_machine_para();
58
+        lv_draw_machine_settings();
59
+      }
60
+      break;
61
+    case ID_PARA_MACHINE_ARROW:
62
+      if (event == LV_EVENT_CLICKED) {
63
+
64
+      }
65
+      else if (event == LV_EVENT_RELEASED) {
66
+        lv_clear_machine_para();
67
+        lv_draw_machine_settings();
68
+      }
69
+      break;
70
+    case ID_PARA_MOTOR:
71
+      if (event == LV_EVENT_CLICKED) {
72
+
73
+      }
74
+      else if (event == LV_EVENT_RELEASED) {
75
+        lv_clear_machine_para();
76
+        lv_draw_motor_settings();
77
+      }
78
+      break;
79
+    case ID_PARA_MOTOR_ARROW:
80
+      if (event == LV_EVENT_CLICKED) {
81
+
82
+      }
83
+      else if (event == LV_EVENT_RELEASED) {
84
+        lv_clear_machine_para();
85
+        lv_draw_motor_settings();
86
+      }
87
+      break;
88
+    case ID_PARA_ADVANCE:
89
+      if (event == LV_EVENT_CLICKED) {
90
+
91
+      }
92
+      else if (event == LV_EVENT_RELEASED) {
93
+        lv_clear_machine_para();
94
+        lv_draw_advance_settings();
95
+      }
96
+      break;
97
+    case ID_PARA_ADVANCE_ARROW:
98
+      if (event == LV_EVENT_CLICKED) {
99
+
100
+      }
101
+      else if (event == LV_EVENT_RELEASED) {
102
+        lv_clear_machine_para();
103
+        lv_draw_advance_settings();
104
+      }
105
+      break;
106
+  }
107
+}
108
+
109
+void lv_draw_machine_para(void) {
110
+  lv_obj_t *buttonBack, *label_Back;
111
+  lv_obj_t *buttonMachine, *labelMachine, *buttonMachineNarrow;
112
+  lv_obj_t *buttonMotor, *labelMotor, *buttonMotorNarrow;
113
+  lv_obj_t *buttonAdvance, *labelAdvance, *buttonAdvanceNarrow;
114
+  lv_obj_t * line1, * line2, * line3;
115
+  if (disp_state_stack._disp_state[disp_state_stack._disp_index] != MACHINE_PARA_UI) {
116
+    disp_state_stack._disp_index++;
117
+    disp_state_stack._disp_state[disp_state_stack._disp_index] = MACHINE_PARA_UI;
118
+  }
119
+  disp_state = MACHINE_PARA_UI;
120
+
121
+  scr = lv_obj_create(NULL, NULL);
122
+
123
+  lv_obj_set_style(scr, &tft_style_scr);
124
+  lv_scr_load(scr);
125
+  lv_obj_clean(scr);
126
+
127
+  lv_obj_t * title = lv_label_create(scr, NULL);
128
+  lv_obj_set_style(title, &tft_style_label_rel);
129
+  lv_obj_set_pos(title, TITLE_XPOS, TITLE_YPOS);
130
+  lv_label_set_text(title, creat_title_text());
131
+
132
+  lv_refr_now(lv_refr_get_disp_refreshing());
133
+
134
+  LV_IMG_DECLARE(bmp_para_back);
135
+  LV_IMG_DECLARE(bmp_para_arrow);
136
+
137
+  buttonMachine = lv_btn_create(scr, NULL);                                 /*Add a button the current screen*/
138
+  lv_obj_set_pos(buttonMachine, PARA_UI_POS_X, PARA_UI_POS_Y);              /*Set its position*/
139
+  lv_obj_set_size(buttonMachine, PARA_UI_SIZE_X, PARA_UI_SIZE_Y);           /*Set its size*/
140
+  // lv_obj_set_event_cb(buttonMachine, event_handler);
141
+  lv_obj_set_event_cb_mks(buttonMachine, event_handler, ID_PARA_MACHINE, NULL, 0);
142
+  lv_btn_set_style(buttonMachine, LV_BTN_STYLE_REL, &tft_style_label_rel);  /*Set the button's released style*/
143
+  lv_btn_set_style(buttonMachine, LV_BTN_STYLE_PR, &tft_style_label_pre);   /*Set the button's pressed style*/
144
+  lv_btn_set_layout(buttonMachine, LV_LAYOUT_OFF);
145
+  labelMachine = lv_label_create(buttonMachine, NULL);                      /*Add a label to the button*/
146
+
147
+  buttonMachineNarrow = lv_imgbtn_create(scr, NULL);
148
+  lv_obj_set_pos(buttonMachineNarrow, PARA_UI_POS_X + PARA_UI_SIZE_X, PARA_UI_POS_Y + PARA_UI_ARROW_V);
149
+  lv_obj_set_event_cb_mks(buttonMachineNarrow, event_handler, ID_PARA_MACHINE_ARROW, "bmp_arrow.bin", 0);
150
+  lv_imgbtn_set_src(buttonMachineNarrow, LV_BTN_STATE_REL, &bmp_para_arrow);
151
+  lv_imgbtn_set_src(buttonMachineNarrow, LV_BTN_STATE_PR, &bmp_para_arrow);
152
+  lv_imgbtn_set_style(buttonMachineNarrow, LV_BTN_STATE_PR, &tft_style_label_pre);
153
+  lv_imgbtn_set_style(buttonMachineNarrow, LV_BTN_STATE_REL, &tft_style_label_rel);
154
+  lv_btn_set_layout(buttonMachineNarrow, LV_LAYOUT_OFF);
155
+
156
+  line1 = lv_line_create(scr, NULL);
157
+  lv_ex_line(line1, line_points[0]);
158
+
159
+  buttonMotor = lv_btn_create(scr, NULL);                                   /*Add a button the current screen*/
160
+  lv_obj_set_pos(buttonMotor, PARA_UI_POS_X, PARA_UI_POS_Y * 2);            /*Set its position*/
161
+  lv_obj_set_size(buttonMotor, PARA_UI_SIZE_X, PARA_UI_SIZE_Y);             /*Set its size*/
162
+  // lv_obj_set_event_cb(buttonMotor, event_handler);
163
+  lv_obj_set_event_cb_mks(buttonMotor, event_handler, ID_PARA_MOTOR, NULL, 0);
164
+  lv_btn_set_style(buttonMotor, LV_BTN_STYLE_REL, &tft_style_label_rel);    /*Set the button's released style*/
165
+  lv_btn_set_style(buttonMotor, LV_BTN_STYLE_PR, &tft_style_label_pre);     /*Set the button's pressed style*/
166
+  lv_btn_set_layout(buttonMotor, LV_LAYOUT_OFF);
167
+  labelMotor = lv_label_create(buttonMotor, NULL);                          /*Add a label to the button*/
168
+
169
+  buttonMotorNarrow = lv_imgbtn_create(scr, NULL);
170
+  lv_obj_set_pos(buttonMotorNarrow, PARA_UI_POS_X + PARA_UI_SIZE_X, PARA_UI_POS_Y * 2 + PARA_UI_ARROW_V);
171
+  lv_obj_set_event_cb_mks(buttonMotorNarrow, event_handler, ID_PARA_MOTOR_ARROW, "bmp_arrow.bin", 0);
172
+  lv_imgbtn_set_src(buttonMotorNarrow, LV_BTN_STATE_REL, &bmp_para_arrow);
173
+  lv_imgbtn_set_src(buttonMotorNarrow, LV_BTN_STATE_PR, &bmp_para_arrow);
174
+  lv_imgbtn_set_style(buttonMotorNarrow, LV_BTN_STATE_PR, &tft_style_label_pre);
175
+  lv_imgbtn_set_style(buttonMotorNarrow, LV_BTN_STATE_REL, &tft_style_label_rel);
176
+  lv_btn_set_layout(buttonMotorNarrow, LV_LAYOUT_OFF);
177
+
178
+  line2 = lv_line_create(scr, NULL);
179
+  lv_ex_line(line2, line_points[1]);
180
+
181
+  buttonAdvance = lv_btn_create(scr, NULL);                                 /*Add a button the current screen*/
182
+  lv_obj_set_pos(buttonAdvance, PARA_UI_POS_X, PARA_UI_POS_Y * 3);          /*Set its position*/
183
+  lv_obj_set_size(buttonAdvance, PARA_UI_SIZE_X, PARA_UI_SIZE_Y);           /*Set its size*/
184
+  // lv_obj_set_event_cb(buttonMotor, event_handler);
185
+  lv_obj_set_event_cb_mks(buttonAdvance, event_handler, ID_PARA_ADVANCE, NULL, 0);
186
+  lv_btn_set_style(buttonAdvance, LV_BTN_STYLE_REL, &tft_style_label_rel);  /*Set the button's released style*/
187
+  lv_btn_set_style(buttonAdvance, LV_BTN_STYLE_PR, &tft_style_label_pre);   /*Set the button's pressed style*/
188
+  lv_btn_set_layout(buttonAdvance, LV_LAYOUT_OFF);
189
+  labelAdvance = lv_label_create(buttonAdvance, NULL);                      /*Add a label to the button*/
190
+
191
+  buttonAdvanceNarrow = lv_imgbtn_create(scr, NULL);
192
+  lv_obj_set_pos(buttonAdvanceNarrow, PARA_UI_POS_X + PARA_UI_SIZE_X, PARA_UI_POS_Y * 3 + PARA_UI_ARROW_V);
193
+  lv_obj_set_event_cb_mks(buttonAdvanceNarrow, event_handler, ID_PARA_ADVANCE_ARROW, "bmp_arrow.bin", 0);
194
+  lv_imgbtn_set_src(buttonAdvanceNarrow, LV_BTN_STATE_REL, &bmp_para_arrow);
195
+  lv_imgbtn_set_src(buttonAdvanceNarrow, LV_BTN_STATE_PR, &bmp_para_arrow);
196
+  lv_imgbtn_set_style(buttonAdvanceNarrow, LV_BTN_STATE_PR, &tft_style_label_pre);
197
+  lv_imgbtn_set_style(buttonAdvanceNarrow, LV_BTN_STATE_REL, &tft_style_label_rel);
198
+  lv_btn_set_layout(buttonAdvanceNarrow, LV_LAYOUT_OFF);
199
+
200
+  line3 = lv_line_create(scr, NULL);
201
+  lv_ex_line(line3, line_points[2]);
202
+
203
+  buttonBack = lv_imgbtn_create(scr, NULL);
204
+  lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_PARA_RETURN, "bmp_back70x40.bin", 0);
205
+  lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_REL, &bmp_para_back);
206
+  lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_PR, &bmp_para_back);
207
+  lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_PR, &tft_style_label_pre);
208
+  lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_REL, &tft_style_label_rel);
209
+
210
+  lv_obj_set_pos(buttonBack, PARA_UI_BACL_POS_X, PARA_UI_BACL_POS_Y);
211
+  lv_btn_set_layout(buttonBack, LV_LAYOUT_OFF);
212
+  label_Back = lv_label_create(buttonBack, NULL);
213
+
214
+  if (gCfgItems.multiple_language != 0) {
215
+    lv_label_set_text(label_Back, common_menu.text_back);
216
+    lv_obj_align(label_Back, buttonBack, LV_ALIGN_CENTER, 0, 0);
217
+
218
+    lv_label_set_text(labelMachine, MachinePara_menu.MachineSetting);
219
+    lv_obj_align(labelMachine, buttonMachine, LV_ALIGN_IN_LEFT_MID, 0, 0);
220
+
221
+    lv_label_set_text(labelMotor, MachinePara_menu.MotorSetting);
222
+    lv_obj_align(labelMotor, buttonMotor, LV_ALIGN_IN_LEFT_MID, 0, 0);
223
+
224
+    lv_label_set_text(labelAdvance, MachinePara_menu.AdvanceSetting);
225
+    lv_obj_align(labelAdvance, buttonAdvance, LV_ALIGN_IN_LEFT_MID, 0, 0);
226
+  }
227
+
228
+}
229
+
230
+void lv_clear_machine_para() { lv_obj_del(scr); }
231
+
232
+#endif // HAS_TFT_LVGL_UI

+ 33
- 0
Marlin/src/lcd/extui/lib/mks_ui/draw_machine_para.h View File

@@ -0,0 +1,33 @@
1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
+ *
5
+ * Based on Sprinter and grbl.
6
+ * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
7
+ *
8
+ * This program is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+#pragma once
23
+
24
+#ifdef __cplusplus
25
+extern "C" { /* C-declarations for C++ */
26
+#endif
27
+
28
+extern void lv_draw_machine_para(void);
29
+extern void lv_clear_machine_para();
30
+
31
+#ifdef __cplusplus
32
+} /* C-declarations for C++ */
33
+#endif

+ 241
- 0
Marlin/src/lcd/extui/lib/mks_ui/draw_machine_settings.cpp View File

@@ -0,0 +1,241 @@
1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
+ *
5
+ * Based on Sprinter and grbl.
6
+ * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
7
+ *
8
+ * This program is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+#include "../../../../inc/MarlinConfigPre.h"
23
+
24
+#if HAS_TFT_LVGL_UI
25
+
26
+#include "lv_conf.h"
27
+#include "draw_ui.h"
28
+
29
+#include "../../../../MarlinCore.h"
30
+
31
+static lv_obj_t * scr;
32
+
33
+#define ID_MACHINE_RETURN             1
34
+#define ID_MACHINE_ACCELERATION       2
35
+#define ID_MACHINE_ACCELERATION_ARROW 3
36
+#define ID_MACHINE_FEEDRATE           4
37
+#define ID_MACHINE_FEEDRATE_ARROW     5
38
+#define ID_MACHINE_JERK               6
39
+#define ID_MACHINE_JERK_ARROW         7
40
+
41
+static void event_handler(lv_obj_t * obj, lv_event_t event) {
42
+  switch (obj->mks_obj_id) {
43
+    case ID_MACHINE_RETURN:
44
+      if (event == LV_EVENT_CLICKED) {
45
+
46
+      }
47
+      else if (event == LV_EVENT_RELEASED) {
48
+        lv_clear_machine_settings();
49
+        draw_return_ui();
50
+      }
51
+      break;
52
+    case ID_MACHINE_ACCELERATION:
53
+      if (event == LV_EVENT_CLICKED) {
54
+
55
+      }
56
+      else if (event == LV_EVENT_RELEASED) {
57
+        lv_clear_machine_settings();
58
+        lv_draw_acceleration_settings();
59
+      }
60
+      break;
61
+    case ID_MACHINE_ACCELERATION_ARROW:
62
+      if (event == LV_EVENT_CLICKED) {
63
+
64
+      }
65
+      else if (event == LV_EVENT_RELEASED) {
66
+        lv_clear_machine_settings();
67
+        lv_draw_acceleration_settings();
68
+      }
69
+      break;
70
+    case ID_MACHINE_FEEDRATE:
71
+      if (event == LV_EVENT_CLICKED) {
72
+
73
+      }
74
+      else if (event == LV_EVENT_RELEASED) {
75
+        lv_clear_machine_settings();
76
+        lv_draw_max_feedrate_settings();
77
+      }
78
+      break;
79
+    case ID_MACHINE_FEEDRATE_ARROW:
80
+      if (event == LV_EVENT_CLICKED) {
81
+
82
+      }
83
+      else if (event == LV_EVENT_RELEASED) {
84
+        lv_clear_machine_settings();
85
+        lv_draw_max_feedrate_settings();
86
+      }
87
+      break;
88
+      #if HAS_CLASSIC_JERK
89
+        case ID_MACHINE_JERK:
90
+          if (event == LV_EVENT_CLICKED) {
91
+
92
+          }
93
+          else if (event == LV_EVENT_RELEASED) {
94
+            lv_clear_machine_settings();
95
+            lv_draw_jerk_settings();
96
+          }
97
+          break;
98
+        case ID_MACHINE_JERK_ARROW:
99
+          if (event == LV_EVENT_CLICKED) {
100
+
101
+          }
102
+          else if (event == LV_EVENT_RELEASED) {
103
+            lv_clear_machine_settings();
104
+            lv_draw_jerk_settings();
105
+          }
106
+          break;
107
+      #endif
108
+  }
109
+}
110
+
111
+void lv_draw_machine_settings(void) {
112
+  lv_obj_t *buttonBack, *label_Back;
113
+  lv_obj_t *buttonAcceleration, *labelAcceleration, *buttonAccelerationNarrow;
114
+  lv_obj_t *buttonMaxFeedrate, *labelMaxFeedrate, *buttonMaxFeedrateNarrow;
115
+  #if HAS_CLASSIC_JERK
116
+    lv_obj_t *buttonJerk, *labelJerk, *buttonJerkNarrow;
117
+  #endif
118
+  lv_obj_t * line1, * line2;
119
+  #if HAS_CLASSIC_JERK
120
+    lv_obj_t * line3;
121
+  #endif
122
+  if (disp_state_stack._disp_state[disp_state_stack._disp_index] != MACHINE_SETTINGS_UI) {
123
+    disp_state_stack._disp_index++;
124
+    disp_state_stack._disp_state[disp_state_stack._disp_index] = MACHINE_SETTINGS_UI;
125
+  }
126
+  disp_state = MACHINE_SETTINGS_UI;
127
+
128
+  scr = lv_obj_create(NULL, NULL);
129
+
130
+  lv_obj_set_style(scr, &tft_style_scr);
131
+  lv_scr_load(scr);
132
+  lv_obj_clean(scr);
133
+
134
+  lv_obj_t * title = lv_label_create(scr, NULL);
135
+  lv_obj_set_style(title, &tft_style_label_rel);
136
+  lv_obj_set_pos(title, TITLE_XPOS, TITLE_YPOS);
137
+  lv_label_set_text(title, machine_menu.MachineConfigTitle);
138
+
139
+  lv_refr_now(lv_refr_get_disp_refreshing());
140
+
141
+  LV_IMG_DECLARE(bmp_para_back);
142
+  LV_IMG_DECLARE(bmp_para_arrow);
143
+
144
+  buttonAcceleration = lv_btn_create(scr, NULL);                                /*Add a button the current screen*/
145
+  lv_obj_set_pos(buttonAcceleration, PARA_UI_POS_X, PARA_UI_POS_Y);             /*Set its position*/
146
+  lv_obj_set_size(buttonAcceleration, PARA_UI_SIZE_X, PARA_UI_SIZE_Y);          /*Set its size*/
147
+  // lv_obj_set_event_cb(buttonMachine, event_handler);
148
+  lv_obj_set_event_cb_mks(buttonAcceleration, event_handler, ID_MACHINE_ACCELERATION, NULL, 0);
149
+  lv_btn_set_style(buttonAcceleration, LV_BTN_STYLE_REL, &tft_style_label_rel); /*Set the button's released style*/
150
+  lv_btn_set_style(buttonAcceleration, LV_BTN_STYLE_PR, &tft_style_label_pre);  /*Set the button's pressed style*/
151
+  lv_btn_set_layout(buttonAcceleration, LV_LAYOUT_OFF);
152
+  labelAcceleration = lv_label_create(buttonAcceleration, NULL);                /*Add a label to the button*/
153
+
154
+  buttonAccelerationNarrow = lv_imgbtn_create(scr, NULL);
155
+  lv_obj_set_pos(buttonAccelerationNarrow, PARA_UI_POS_X + PARA_UI_SIZE_X, PARA_UI_POS_Y + PARA_UI_ARROW_V);
156
+  lv_obj_set_event_cb_mks(buttonAccelerationNarrow, event_handler, ID_MACHINE_ACCELERATION_ARROW, "bmp_arrow.bin", 0);
157
+  lv_imgbtn_set_src(buttonAccelerationNarrow, LV_BTN_STATE_REL, &bmp_para_arrow);
158
+  lv_imgbtn_set_src(buttonAccelerationNarrow, LV_BTN_STATE_PR, &bmp_para_arrow);
159
+  lv_imgbtn_set_style(buttonAccelerationNarrow, LV_BTN_STATE_PR, &tft_style_label_pre);
160
+  lv_imgbtn_set_style(buttonAccelerationNarrow, LV_BTN_STATE_REL, &tft_style_label_rel);
161
+  lv_btn_set_layout(buttonAccelerationNarrow, LV_LAYOUT_OFF);
162
+
163
+  line1 = lv_line_create(lv_scr_act(), NULL);
164
+  lv_ex_line(line1, line_points[0]);
165
+
166
+  buttonMaxFeedrate = lv_btn_create(scr, NULL);                                 /*Add a button the current screen*/
167
+  lv_obj_set_pos(buttonMaxFeedrate, PARA_UI_POS_X, PARA_UI_POS_Y * 2);          /*Set its position*/
168
+  lv_obj_set_size(buttonMaxFeedrate, PARA_UI_SIZE_X, PARA_UI_SIZE_Y);           /*Set its size*/
169
+  // lv_obj_set_event_cb(buttonMachine, event_handler);
170
+  lv_obj_set_event_cb_mks(buttonMaxFeedrate, event_handler, ID_MACHINE_FEEDRATE, NULL, 0);
171
+  lv_btn_set_style(buttonMaxFeedrate, LV_BTN_STYLE_REL, &tft_style_label_rel);  /*Set the button's released style*/
172
+  lv_btn_set_style(buttonMaxFeedrate, LV_BTN_STYLE_PR, &tft_style_label_pre);   /*Set the button's pressed style*/
173
+  lv_btn_set_layout(buttonMaxFeedrate, LV_LAYOUT_OFF);
174
+  labelMaxFeedrate = lv_label_create(buttonMaxFeedrate, NULL);                  /*Add a label to the button*/
175
+
176
+  buttonMaxFeedrateNarrow = lv_imgbtn_create(scr, NULL);
177
+  lv_obj_set_pos(buttonMaxFeedrateNarrow, PARA_UI_POS_X + PARA_UI_SIZE_X, PARA_UI_POS_Y * 2 + PARA_UI_ARROW_V);
178
+  lv_obj_set_event_cb_mks(buttonMaxFeedrateNarrow, event_handler, ID_MACHINE_FEEDRATE_ARROW, "bmp_arrow.bin", 0);
179
+  lv_imgbtn_set_src(buttonMaxFeedrateNarrow, LV_BTN_STATE_REL, &bmp_para_arrow);
180
+  lv_imgbtn_set_src(buttonMaxFeedrateNarrow, LV_BTN_STATE_PR, &bmp_para_arrow);
181
+  lv_imgbtn_set_style(buttonMaxFeedrateNarrow, LV_BTN_STATE_PR, &tft_style_label_pre);
182
+  lv_imgbtn_set_style(buttonMaxFeedrateNarrow, LV_BTN_STATE_REL, &tft_style_label_rel);
183
+  lv_btn_set_layout(buttonMaxFeedrateNarrow, LV_LAYOUT_OFF);
184
+
185
+  line2 = lv_line_create(lv_scr_act(), NULL);
186
+  lv_ex_line(line2, line_points[1]);
187
+
188
+  #if HAS_CLASSIC_JERK
189
+    buttonJerk = lv_btn_create(scr, NULL);                                      /*Add a button the current screen*/
190
+    lv_obj_set_pos(buttonJerk, PARA_UI_POS_X, PARA_UI_POS_Y * 3);               /*Set its position*/
191
+    lv_obj_set_size(buttonJerk, PARA_UI_SIZE_X, PARA_UI_SIZE_Y);                /*Set its size*/
192
+    // lv_obj_set_event_cb(buttonMotor, event_handler);
193
+    lv_obj_set_event_cb_mks(buttonJerk, event_handler, ID_MACHINE_JERK, NULL, 0);
194
+    lv_btn_set_style(buttonJerk, LV_BTN_STYLE_REL, &tft_style_label_rel);       /*Set the button's released style*/
195
+    lv_btn_set_style(buttonJerk, LV_BTN_STYLE_PR, &tft_style_label_pre);        /*Set the button's pressed style*/
196
+    lv_btn_set_layout(buttonJerk, LV_LAYOUT_OFF);
197
+    labelJerk = lv_label_create(buttonJerk, NULL);                              /*Add a label to the button*/
198
+
199
+    buttonJerkNarrow = lv_imgbtn_create(scr, NULL);
200
+    lv_obj_set_pos(buttonJerkNarrow, PARA_UI_POS_X + PARA_UI_SIZE_X, PARA_UI_POS_Y * 3 + PARA_UI_ARROW_V);
201
+    lv_obj_set_event_cb_mks(buttonJerkNarrow, event_handler, ID_MACHINE_JERK_ARROW, "bmp_arrow.bin", 0);
202
+    lv_imgbtn_set_src(buttonJerkNarrow, LV_BTN_STATE_REL, &bmp_para_arrow);
203
+    lv_imgbtn_set_src(buttonJerkNarrow, LV_BTN_STATE_PR, &bmp_para_arrow);
204
+    lv_imgbtn_set_style(buttonJerkNarrow, LV_BTN_STATE_PR, &tft_style_label_pre);
205
+    lv_imgbtn_set_style(buttonJerkNarrow, LV_BTN_STATE_REL, &tft_style_label_rel);
206
+    lv_btn_set_layout(buttonJerkNarrow, LV_LAYOUT_OFF);
207
+
208
+    line3 = lv_line_create(lv_scr_act(), NULL);
209
+    lv_ex_line(line3, line_points[2]);
210
+  #endif
211
+
212
+  buttonBack = lv_imgbtn_create(scr, NULL);
213
+  lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_MACHINE_RETURN, "bmp_back70x40.bin", 0);
214
+  lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_REL, &bmp_para_back);
215
+  lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_PR, &bmp_para_back);
216
+  lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_PR, &tft_style_label_pre);
217
+  lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_REL, &tft_style_label_rel);
218
+
219
+  lv_obj_set_pos(buttonBack, PARA_UI_BACL_POS_X, PARA_UI_BACL_POS_Y);
220
+  lv_btn_set_layout(buttonBack, LV_LAYOUT_OFF);
221
+  label_Back = lv_label_create(buttonBack, NULL);
222
+
223
+  if (gCfgItems.multiple_language != 0) {
224
+    lv_label_set_text(label_Back, common_menu.text_back);
225
+    lv_obj_align(label_Back, buttonBack, LV_ALIGN_CENTER, 0, 0);
226
+
227
+    lv_label_set_text(labelAcceleration, machine_menu.AccelerationConf);
228
+    lv_obj_align(labelAcceleration, buttonAcceleration, LV_ALIGN_IN_LEFT_MID, 0, 0);
229
+
230
+    lv_label_set_text(labelMaxFeedrate, machine_menu.MaxFeedRateConf);
231
+    lv_obj_align(labelMaxFeedrate, buttonMaxFeedrate, LV_ALIGN_IN_LEFT_MID, 0, 0);
232
+    #if HAS_CLASSIC_JERK
233
+      lv_label_set_text(labelJerk, machine_menu.JerkConf);
234
+      lv_obj_align(labelJerk, buttonJerk, LV_ALIGN_IN_LEFT_MID, 0, 0);
235
+    #endif
236
+  }
237
+}
238
+
239
+void lv_clear_machine_settings() { lv_obj_del(scr); }
240
+
241
+#endif // HAS_TFT_LVGL_UI

+ 33
- 0
Marlin/src/lcd/extui/lib/mks_ui/draw_machine_settings.h View File

@@ -0,0 +1,33 @@
1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
+ *
5
+ * Based on Sprinter and grbl.
6
+ * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
7
+ *
8
+ * This program is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+#pragma once
23
+
24
+#ifdef __cplusplus
25
+extern "C" { /* C-declarations for C++ */
26
+#endif
27
+
28
+extern void lv_draw_machine_settings(void);
29
+extern void lv_clear_machine_settings();
30
+
31
+#ifdef __cplusplus
32
+} /* C-declarations for C++ */
33
+#endif

+ 62
- 65
Marlin/src/lcd/extui/lib/mks_ui/draw_manuaLevel.cpp View File

@@ -21,7 +21,7 @@
21 21
  */
22 22
 #include "../../../../inc/MarlinConfigPre.h"
23 23
 
24
-#if ENABLED(TFT_LVGL_UI)
24
+#if HAS_TFT_LVGL_UI
25 25
 
26 26
 #include "../../../../MarlinCore.h"
27 27
 #include "lv_conf.h"
@@ -35,13 +35,12 @@
35 35
 //static lv_obj_t *buttonMoveZ,*buttonTest,*buttonZ0,*buttonStop,*buttonReturn;
36 36
 static lv_obj_t * scr;
37 37
 
38
-#define ID_M_POINT1             1
39
-#define ID_M_POINT2             2
40
-#define ID_M_POINT3             3
41
-#define ID_M_POINT4             4
42
-#define ID_M_POINT5             5
43
-
44
-#define ID_MANUAL_RETURN                6
38
+#define ID_M_POINT1      1
39
+#define ID_M_POINT2      2
40
+#define ID_M_POINT3      3
41
+#define ID_M_POINT4      4
42
+#define ID_M_POINT5      5
43
+#define ID_MANUAL_RETURN 6
45 44
 
46 45
 static void event_handler(lv_obj_t * obj, lv_event_t event) {
47 46
   switch (obj->mks_obj_id) {
@@ -53,16 +52,16 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
53 52
 
54 53
         if (queue.length == 0) {
55 54
           if (uiCfg.leveling_first_time) {
56
-            queue.enqueue_one_P(PSTR("G28"));
55
+            queue.enqueue_now_P(PSTR("G28"));
57 56
             uiCfg.leveling_first_time = 0;
58 57
           }
59 58
 
60
-          queue.enqueue_one_P(PSTR("G1 Z10"));
59
+          queue.enqueue_now_P(PSTR("G1 Z10"));
61 60
 
62
-          memset(public_buf_l, 0, sizeof(public_buf_l));
63
-          sprintf(public_buf_l, "G1 X%d Y%d", X_MIN_POS + 30, Y_MIN_POS + 30);
64
-          queue.enqueue_one_P(PSTR(public_buf_l));
65
-          queue.enqueue_one_P(PSTR("G1 Z0"));
61
+          ZERO(public_buf_l);
62
+          sprintf_P(public_buf_l, PSTR("G1 X%d Y%d"), X_MIN_POS + 30, Y_MIN_POS + 30);
63
+          queue.enqueue_one_now(public_buf_l);
64
+          queue.enqueue_now_P(PSTR("G1 Z0"));
66 65
         }
67 66
       }
68 67
       break;
@@ -73,16 +72,16 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
73 72
       else if (event == LV_EVENT_RELEASED) {
74 73
         if (queue.length == 0) {
75 74
           if (uiCfg.leveling_first_time) {
76
-            queue.enqueue_one_P(PSTR("G28"));
75
+            queue.enqueue_now_P(PSTR("G28"));
77 76
             uiCfg.leveling_first_time = 0;
78 77
           }
79 78
 
80
-          queue.enqueue_one_P(PSTR("G1 Z10"));
79
+          queue.enqueue_now_P(PSTR("G1 Z10"));
81 80
 
82
-          memset(public_buf_l, 0, sizeof(public_buf_l));
83
-          sprintf(public_buf_l, "G1 X%d Y%d", X_MAX_POS - 30, Y_MIN_POS + 30);
84
-          queue.enqueue_one_P(PSTR(public_buf_l));
85
-          queue.enqueue_one_P(PSTR("G1 Z0"));
81
+          ZERO(public_buf_l);
82
+          sprintf_P(public_buf_l, PSTR("G1 X%d Y%d"), X_MAX_POS - 30, Y_MIN_POS + 30);
83
+          queue.enqueue_one_now(public_buf_l);
84
+          queue.enqueue_now_P(PSTR("G1 Z0"));
86 85
         }
87 86
       }
88 87
       break;
@@ -93,16 +92,16 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
93 92
       else if (event == LV_EVENT_RELEASED) {
94 93
         if (queue.length == 0) {
95 94
           if (uiCfg.leveling_first_time) {
96
-            queue.enqueue_one_P(PSTR("G28"));
95
+            queue.enqueue_now_P(PSTR("G28"));
97 96
             uiCfg.leveling_first_time = 0;
98 97
           }
99 98
 
100
-          queue.enqueue_one_P(PSTR("G1 Z10"));
99
+          queue.enqueue_now_P(PSTR("G1 Z10"));
101 100
 
102
-          memset(public_buf_l, 0, sizeof(public_buf_l));
103
-          sprintf(public_buf_l, "G1 X%d Y%d", X_MAX_POS - 30, Y_MAX_POS - 30);
104
-          queue.enqueue_one_P(PSTR(public_buf_l));
105
-          queue.enqueue_one_P(PSTR("G1 Z0"));
101
+          ZERO(public_buf_l);
102
+          sprintf_P(public_buf_l, PSTR("G1 X%d Y%d"), X_MAX_POS - 30, Y_MAX_POS - 30);
103
+          queue.enqueue_one_now(public_buf_l);
104
+          queue.enqueue_now_P(PSTR("G1 Z0"));
106 105
         }
107 106
       }
108 107
 
@@ -114,16 +113,16 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
114 113
       else if (event == LV_EVENT_RELEASED) {
115 114
         if (queue.length == 0) {
116 115
           if (uiCfg.leveling_first_time) {
117
-            queue.enqueue_one_P(PSTR("G28"));
116
+            queue.enqueue_now_P(PSTR("G28"));
118 117
             uiCfg.leveling_first_time = 0;
119 118
           }
120 119
 
121
-          queue.enqueue_one_P(PSTR("G1 Z10"));
120
+          queue.enqueue_now_P(PSTR("G1 Z10"));
122 121
 
123
-          memset(public_buf_l, 0, sizeof(public_buf_l));
124
-          sprintf(public_buf_l, "G1 X%d Y%d", X_MIN_POS + 30, Y_MAX_POS - 30);
125
-          queue.enqueue_one_P(PSTR(public_buf_l));
126
-          queue.enqueue_one_P(PSTR("G1 Z0"));
122
+          ZERO(public_buf_l);
123
+          sprintf_P(public_buf_l, PSTR("G1 X%d Y%d"), X_MIN_POS + 30, Y_MAX_POS - 30);
124
+          queue.enqueue_one_now(public_buf_l);
125
+          queue.enqueue_now_P(PSTR("G1 Z0"));
127 126
         }
128 127
       }
129 128
       break;
@@ -134,16 +133,16 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
134 133
       else if (event == LV_EVENT_RELEASED) {
135 134
         if (queue.length == 0) {
136 135
           if (uiCfg.leveling_first_time) {
137
-            queue.enqueue_one_P(PSTR("G28"));
136
+            queue.enqueue_now_P(PSTR("G28"));
138 137
             uiCfg.leveling_first_time = 0;
139 138
           }
140 139
 
141
-          queue.enqueue_one_P(PSTR("G1 Z10"));
140
+          queue.enqueue_now_P(PSTR("G1 Z10"));
142 141
 
143
-          memset(public_buf_l, 0, sizeof(public_buf_l));
144
-          sprintf(public_buf_l, "G1 X%d Y%d", X_BED_SIZE / 2, Y_BED_SIZE / 2);
145
-          queue.enqueue_one_P(PSTR(public_buf_l));
146
-          queue.enqueue_one_P(PSTR("G1 Z0"));
142
+          ZERO(public_buf_l);
143
+          sprintf_P(public_buf_l, PSTR("G1 X%d Y%d"), X_BED_SIZE / 2, Y_BED_SIZE / 2);
144
+          queue.enqueue_one_now(public_buf_l);
145
+          queue.enqueue_now_P(PSTR("G1 Z0"));
147 146
         }
148 147
       }
149 148
 
@@ -157,7 +156,6 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
157 156
         lv_draw_tool();
158 157
       }
159 158
       break;
160
-
161 159
   }
162 160
 }
163 161
 
@@ -174,14 +172,14 @@ void lv_draw_manualLevel(void) {
174 172
 
175 173
   scr = lv_obj_create(NULL, NULL);
176 174
 
177
-  //static lv_style_t tool_style;
175
+  // static lv_style_t tool_style;
178 176
 
179 177
   lv_obj_set_style(scr, &tft_style_scr);
180 178
   lv_scr_load(scr);
181 179
   lv_obj_clean(scr);
182 180
 
183 181
   lv_obj_t * title = lv_label_create(scr, NULL);
184
-  lv_obj_set_style(title, &tft_style_lable_rel);
182
+  lv_obj_set_style(title, &tft_style_label_rel);
185 183
   lv_obj_set_pos(title, TITLE_XPOS, TITLE_YPOS);
186 184
   lv_label_set_text(title, creat_title_text());
187 185
 
@@ -195,52 +193,52 @@ void lv_draw_manualLevel(void) {
195 193
   buttonPoint3 = lv_imgbtn_create(scr, NULL);
196 194
   buttonPoint4 = lv_imgbtn_create(scr, NULL);
197 195
   buttonPoint5 = lv_imgbtn_create(scr, NULL);
198
-  buttonBack = lv_imgbtn_create(scr, NULL);
196
+  buttonBack   = lv_imgbtn_create(scr, NULL);
199 197
 
200
-  lv_obj_set_event_cb_mks(buttonPoint1, event_handler, ID_M_POINT1, "bmp_Leveling1.bin", 0);
198
+  lv_obj_set_event_cb_mks(buttonPoint1, event_handler, ID_M_POINT1, "bmp_leveling1.bin", 0);
201 199
   lv_imgbtn_set_src(buttonPoint1, LV_BTN_STATE_REL, &bmp_pic);
202 200
   lv_imgbtn_set_src(buttonPoint1, LV_BTN_STATE_PR, &bmp_pic);
203
-  lv_imgbtn_set_style(buttonPoint1, LV_BTN_STATE_PR, &tft_style_lable_pre);
204
-  lv_imgbtn_set_style(buttonPoint1, LV_BTN_STATE_REL, &tft_style_lable_rel);
201
+  lv_imgbtn_set_style(buttonPoint1, LV_BTN_STATE_PR, &tft_style_label_pre);
202
+  lv_imgbtn_set_style(buttonPoint1, LV_BTN_STATE_REL, &tft_style_label_rel);
205 203
   lv_obj_clear_protect(buttonPoint1, LV_PROTECT_FOLLOW);
206 204
   #if 1
207
-    lv_obj_set_event_cb_mks(buttonPoint2, event_handler, ID_M_POINT2, "bmp_Leveling2.bin", 0);
205
+    lv_obj_set_event_cb_mks(buttonPoint2, event_handler, ID_M_POINT2, "bmp_leveling2.bin", 0);
208 206
     lv_imgbtn_set_src(buttonPoint2, LV_BTN_STATE_REL, &bmp_pic);
209 207
     lv_imgbtn_set_src(buttonPoint2, LV_BTN_STATE_PR, &bmp_pic);
210
-    lv_imgbtn_set_style(buttonPoint2, LV_BTN_STATE_PR, &tft_style_lable_pre);
211
-    lv_imgbtn_set_style(buttonPoint2, LV_BTN_STATE_REL, &tft_style_lable_rel);
208
+    lv_imgbtn_set_style(buttonPoint2, LV_BTN_STATE_PR, &tft_style_label_pre);
209
+    lv_imgbtn_set_style(buttonPoint2, LV_BTN_STATE_REL, &tft_style_label_rel);
212 210
 
213
-    lv_obj_set_event_cb_mks(buttonPoint3, event_handler, ID_M_POINT3, "bmp_Leveling3.bin", 0);
211
+    lv_obj_set_event_cb_mks(buttonPoint3, event_handler, ID_M_POINT3, "bmp_leveling3.bin", 0);
214 212
     lv_imgbtn_set_src(buttonPoint3, LV_BTN_STATE_REL, &bmp_pic);
215 213
     lv_imgbtn_set_src(buttonPoint3, LV_BTN_STATE_PR, &bmp_pic);
216
-    lv_imgbtn_set_style(buttonPoint3, LV_BTN_STATE_PR, &tft_style_lable_pre);
217
-    lv_imgbtn_set_style(buttonPoint3, LV_BTN_STATE_REL, &tft_style_lable_rel);
214
+    lv_imgbtn_set_style(buttonPoint3, LV_BTN_STATE_PR, &tft_style_label_pre);
215
+    lv_imgbtn_set_style(buttonPoint3, LV_BTN_STATE_REL, &tft_style_label_rel);
218 216
 
219
-    lv_obj_set_event_cb_mks(buttonPoint4, event_handler, ID_M_POINT4, "bmp_Leveling4.bin", 0);
217
+    lv_obj_set_event_cb_mks(buttonPoint4, event_handler, ID_M_POINT4, "bmp_leveling4.bin", 0);
220 218
     lv_imgbtn_set_src(buttonPoint4, LV_BTN_STATE_REL, &bmp_pic);
221 219
     lv_imgbtn_set_src(buttonPoint4, LV_BTN_STATE_PR, &bmp_pic);
222
-    lv_imgbtn_set_style(buttonPoint4, LV_BTN_STATE_PR, &tft_style_lable_pre);
223
-    lv_imgbtn_set_style(buttonPoint4, LV_BTN_STATE_REL, &tft_style_lable_rel);
220
+    lv_imgbtn_set_style(buttonPoint4, LV_BTN_STATE_PR, &tft_style_label_pre);
221
+    lv_imgbtn_set_style(buttonPoint4, LV_BTN_STATE_REL, &tft_style_label_rel);
224 222
 
225
-    lv_obj_set_event_cb_mks(buttonPoint5, event_handler, ID_M_POINT5, "bmp_Leveling5.bin", 0);
223
+    lv_obj_set_event_cb_mks(buttonPoint5, event_handler, ID_M_POINT5, "bmp_leveling5.bin", 0);
226 224
     lv_imgbtn_set_src(buttonPoint5, LV_BTN_STATE_REL, &bmp_pic);
227 225
     lv_imgbtn_set_src(buttonPoint5, LV_BTN_STATE_PR, &bmp_pic);
228
-    lv_imgbtn_set_style(buttonPoint5, LV_BTN_STATE_PR, &tft_style_lable_pre);
229
-    lv_imgbtn_set_style(buttonPoint5, LV_BTN_STATE_REL, &tft_style_lable_rel);
226
+    lv_imgbtn_set_style(buttonPoint5, LV_BTN_STATE_PR, &tft_style_label_pre);
227
+    lv_imgbtn_set_style(buttonPoint5, LV_BTN_STATE_REL, &tft_style_label_rel);
230 228
 
231
-    lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_MANUAL_RETURN, "bmp_Return.bin", 0);
229
+    lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_MANUAL_RETURN, "bmp_return.bin", 0);
232 230
     lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_REL, &bmp_pic);
233 231
     lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_PR, &bmp_pic);
234
-    lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_PR, &tft_style_lable_pre);
235
-    lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_REL, &tft_style_lable_rel);
232
+    lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_PR, &tft_style_label_pre);
233
+    lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_REL, &tft_style_label_rel);
236 234
   #endif
237 235
 
238 236
   lv_obj_set_pos(buttonPoint1, INTERVAL_V, titleHeight);
239 237
   lv_obj_set_pos(buttonPoint2, BTN_X_PIXEL + INTERVAL_V * 2, titleHeight);
240 238
   lv_obj_set_pos(buttonPoint3, BTN_X_PIXEL * 2 + INTERVAL_V * 3, titleHeight);
241 239
   lv_obj_set_pos(buttonPoint4, BTN_X_PIXEL * 3 + INTERVAL_V * 4, titleHeight);
242
-  lv_obj_set_pos(buttonPoint5, INTERVAL_V,  BTN_Y_PIXEL + INTERVAL_H + titleHeight);
243
-  lv_obj_set_pos(buttonBack, BTN_X_PIXEL * 3 + INTERVAL_V * 4,  BTN_Y_PIXEL + INTERVAL_H + titleHeight);
240
+  lv_obj_set_pos(buttonPoint5, INTERVAL_V, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
241
+  lv_obj_set_pos(buttonBack, BTN_X_PIXEL * 3 + INTERVAL_V * 4, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
244 242
 
245 243
   /*Create a label on the Image button*/
246 244
   lv_btn_set_layout(buttonPoint1, LV_LAYOUT_OFF);
@@ -255,8 +253,7 @@ void lv_draw_manualLevel(void) {
255 253
   lv_obj_t * label_Point3 = lv_label_create(buttonPoint3, NULL);
256 254
   lv_obj_t * label_Point4 = lv_label_create(buttonPoint4, NULL);
257 255
   lv_obj_t * label_Point5 = lv_label_create(buttonPoint5, NULL);
258
-  lv_obj_t * label_Back = lv_label_create(buttonBack, NULL);
259
-
256
+  lv_obj_t * label_Back   = lv_label_create(buttonBack, NULL);
260 257
 
261 258
   if (gCfgItems.multiple_language != 0) {
262 259
     lv_label_set_text(label_Point1, leveling_menu.position1);
@@ -281,4 +278,4 @@ void lv_draw_manualLevel(void) {
281 278
 
282 279
 void lv_clear_manualLevel() { lv_obj_del(scr); }
283 280
 
284
-#endif // TFT_LVGL_UI
281
+#endif // HAS_TFT_LVGL_UI

+ 359
- 0
Marlin/src/lcd/extui/lib/mks_ui/draw_max_feedrate_settings.cpp View File

@@ -0,0 +1,359 @@
1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
+ *
5
+ * Based on Sprinter and grbl.
6
+ * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
7
+ *
8
+ * This program is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+#include "../../../../inc/MarlinConfigPre.h"
23
+
24
+#if HAS_TFT_LVGL_UI
25
+
26
+#include "lv_conf.h"
27
+#include "draw_ui.h"
28
+
29
+#include "../../../../MarlinCore.h"
30
+#include "../../../../module/planner.h"
31
+
32
+static lv_obj_t * scr;
33
+
34
+#define ID_FEED_RETURN  1
35
+#define ID_FEED_X       2
36
+#define ID_FEED_Y       3
37
+#define ID_FEED_Z       4
38
+#define ID_FEED_E0      5
39
+#define ID_FEED_E1      6
40
+#define ID_FEED_DOWN    7
41
+#define ID_FEED_UP      8
42
+
43
+static void event_handler(lv_obj_t * obj, lv_event_t event) {
44
+  switch (obj->mks_obj_id) {
45
+    case ID_FEED_RETURN:
46
+      if (event == LV_EVENT_CLICKED) {
47
+
48
+      }
49
+      else if (event == LV_EVENT_RELEASED) {
50
+        uiCfg.para_ui_page = 0;
51
+        lv_clear_max_feedrate_settings();
52
+        draw_return_ui();
53
+      }
54
+      break;
55
+    case ID_FEED_X:
56
+      if (event == LV_EVENT_CLICKED) {
57
+
58
+      }
59
+      else if (event == LV_EVENT_RELEASED) {
60
+        value = XMaxFeedRate;
61
+        lv_clear_max_feedrate_settings();
62
+        lv_draw_number_key();
63
+      }
64
+      break;
65
+    case ID_FEED_Y:
66
+      if (event == LV_EVENT_CLICKED) {
67
+
68
+      }
69
+      else if (event == LV_EVENT_RELEASED) {
70
+        value = YMaxFeedRate;
71
+        lv_clear_max_feedrate_settings();
72
+        lv_draw_number_key();
73
+      }
74
+      break;
75
+    case ID_FEED_Z:
76
+      if (event == LV_EVENT_CLICKED) {
77
+
78
+      }
79
+      else if (event == LV_EVENT_RELEASED) {
80
+        value = ZMaxFeedRate;
81
+        lv_clear_max_feedrate_settings();
82
+        lv_draw_number_key();
83
+      }
84
+      break;
85
+    case ID_FEED_E0:
86
+      if (event == LV_EVENT_CLICKED) {
87
+
88
+      }
89
+      else if (event == LV_EVENT_RELEASED) {
90
+        value = E0MaxFeedRate;
91
+        lv_clear_max_feedrate_settings();
92
+        lv_draw_number_key();
93
+      }
94
+      break;
95
+    case ID_FEED_E1:
96
+      if (event == LV_EVENT_CLICKED) {
97
+
98
+      }
99
+      else if (event == LV_EVENT_RELEASED) {
100
+        value = E1MaxFeedRate;
101
+        lv_clear_max_feedrate_settings();
102
+        lv_draw_number_key();
103
+      }
104
+      break;
105
+    case ID_FEED_UP:
106
+      if (event == LV_EVENT_CLICKED) {
107
+
108
+      }
109
+      else if (event == LV_EVENT_RELEASED) {
110
+        uiCfg.para_ui_page = 0;
111
+        lv_clear_max_feedrate_settings();
112
+        lv_draw_max_feedrate_settings();
113
+      }
114
+      break;
115
+    case ID_FEED_DOWN:
116
+      if (event == LV_EVENT_CLICKED) {
117
+
118
+      }
119
+      else if (event == LV_EVENT_RELEASED) {
120
+        uiCfg.para_ui_page = 1;
121
+        lv_clear_max_feedrate_settings();
122
+        lv_draw_max_feedrate_settings();
123
+      }
124
+      break;
125
+  }
126
+}
127
+
128
+void lv_draw_max_feedrate_settings(void) {
129
+  lv_obj_t *buttonBack = NULL, *label_Back = NULL, *buttonTurnPage = NULL, *labelTurnPage = NULL;
130
+  lv_obj_t *buttonXText = NULL, *labelXText = NULL, *buttonXValue = NULL, *labelXValue = NULL;
131
+  lv_obj_t *buttonYText = NULL, *labelYText = NULL, *buttonYValue = NULL, *labelYValue = NULL;
132
+  lv_obj_t *buttonZText = NULL, *labelZText = NULL, *buttonZValue = NULL, *labelZValue = NULL;
133
+  lv_obj_t *buttonE0Text = NULL, *labelE0Text = NULL, *buttonE0Value = NULL, *labelE0Value = NULL;
134
+  lv_obj_t *buttonE1Text = NULL, *labelE1Text = NULL, *buttonE1Value = NULL, *labelE1Value = NULL;
135
+  lv_obj_t * line1 = NULL, * line2 = NULL, * line3 = NULL, * line4 = NULL;
136
+  if (disp_state_stack._disp_state[disp_state_stack._disp_index] != MAXFEEDRATE_UI) {
137
+    disp_state_stack._disp_index++;
138
+    disp_state_stack._disp_state[disp_state_stack._disp_index] = MAXFEEDRATE_UI;
139
+  }
140
+  disp_state = MAXFEEDRATE_UI;
141
+
142
+  scr = lv_obj_create(NULL, NULL);
143
+
144
+  lv_obj_set_style(scr, &tft_style_scr);
145
+  lv_scr_load(scr);
146
+  lv_obj_clean(scr);
147
+
148
+  lv_obj_t * title = lv_label_create(scr, NULL);
149
+  lv_obj_set_style(title, &tft_style_label_rel);
150
+  lv_obj_set_pos(title, TITLE_XPOS, TITLE_YPOS);
151
+  lv_label_set_text(title, machine_menu.MaxFeedRateConfTitle);
152
+
153
+  lv_refr_now(lv_refr_get_disp_refreshing());
154
+
155
+  LV_IMG_DECLARE(bmp_para_back);
156
+  // LV_IMG_DECLARE(bmp_para_arrow);
157
+  LV_IMG_DECLARE(bmp_para_bank);
158
+
159
+  if (uiCfg.para_ui_page != 1) {
160
+    buttonXText = lv_btn_create(scr, NULL);                                 /*Add a button the current screen*/
161
+    lv_obj_set_pos(buttonXText, PARA_UI_POS_X, PARA_UI_POS_Y);              /*Set its position*/
162
+    lv_obj_set_size(buttonXText, PARA_UI_VALUE_SIZE_X, PARA_UI_SIZE_Y);     /*Set its size*/
163
+    lv_obj_set_event_cb(buttonXText, event_handler);
164
+    lv_btn_set_style(buttonXText, LV_BTN_STYLE_REL, &tft_style_label_rel);  /*Set the button's released style*/
165
+    lv_btn_set_style(buttonXText, LV_BTN_STYLE_PR, &tft_style_label_pre);   /*Set the button's pressed style*/
166
+    lv_btn_set_layout(buttonXText, LV_LAYOUT_OFF);
167
+    labelXText = lv_label_create(buttonXText, NULL);                        /*Add a label to the button*/
168
+
169
+    buttonXValue = lv_imgbtn_create(scr, NULL);
170
+    lv_obj_set_pos(buttonXValue, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y + PARA_UI_VALUE_V);
171
+    lv_obj_set_event_cb_mks(buttonXValue, event_handler, ID_FEED_X, "bmp_value_blank.bin", 0);
172
+    lv_imgbtn_set_src(buttonXValue, LV_BTN_STATE_REL, &bmp_para_bank);
173
+    lv_imgbtn_set_src(buttonXValue, LV_BTN_STATE_PR, &bmp_para_bank);
174
+    lv_imgbtn_set_style(buttonXValue, LV_BTN_STATE_PR, &style_para_value_pre);
175
+    lv_imgbtn_set_style(buttonXValue, LV_BTN_STATE_REL, &style_para_value_rel);
176
+    lv_btn_set_layout(buttonXValue, LV_LAYOUT_OFF);
177
+    labelXValue = lv_label_create(buttonXValue, NULL);
178
+
179
+    line1 = lv_line_create(scr, NULL);
180
+    lv_ex_line(line1, line_points[0]);
181
+
182
+    buttonYText = lv_btn_create(scr, NULL);                                 /*Add a button the current screen*/
183
+    lv_obj_set_pos(buttonYText, PARA_UI_POS_X, PARA_UI_POS_Y * 2);          /*Set its position*/
184
+    lv_obj_set_size(buttonYText, PARA_UI_VALUE_SIZE_X, PARA_UI_SIZE_Y);     /*Set its size*/
185
+    lv_obj_set_event_cb(buttonYText, event_handler);
186
+    lv_btn_set_style(buttonYText, LV_BTN_STYLE_REL, &tft_style_label_rel);  /*Set the button's released style*/
187
+    lv_btn_set_style(buttonYText, LV_BTN_STYLE_PR, &tft_style_label_pre);   /*Set the button's pressed style*/
188
+    lv_btn_set_layout(buttonYText, LV_LAYOUT_OFF);
189
+    labelYText = lv_label_create(buttonYText, NULL);                        /*Add a label to the button*/
190
+
191
+    buttonYValue = lv_imgbtn_create(scr, NULL);
192
+    lv_obj_set_pos(buttonYValue, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 2 + PARA_UI_VALUE_V);
193
+    lv_obj_set_event_cb_mks(buttonYValue, event_handler, ID_FEED_Y, "bmp_value_blank.bin", 0);
194
+    lv_imgbtn_set_src(buttonYValue, LV_BTN_STATE_REL, &bmp_para_bank);
195
+    lv_imgbtn_set_src(buttonYValue, LV_BTN_STATE_PR, &bmp_para_bank);
196
+    lv_imgbtn_set_style(buttonYValue, LV_BTN_STATE_PR, &style_para_value_pre);
197
+    lv_imgbtn_set_style(buttonYValue, LV_BTN_STATE_REL, &style_para_value_rel);
198
+    lv_btn_set_layout(buttonYValue, LV_LAYOUT_OFF);
199
+    labelYValue = lv_label_create(buttonYValue, NULL);
200
+
201
+    line2 = lv_line_create(scr, NULL);
202
+    lv_ex_line(line2, line_points[1]);
203
+
204
+    buttonZText = lv_btn_create(scr, NULL);                                 /*Add a button the current screen*/
205
+    lv_obj_set_pos(buttonZText, PARA_UI_POS_X, PARA_UI_POS_Y * 3);          /*Set its position*/
206
+    lv_obj_set_size(buttonZText, PARA_UI_VALUE_SIZE_X, PARA_UI_SIZE_Y);     /*Set its size*/
207
+    lv_obj_set_event_cb(buttonZText, event_handler);
208
+    lv_btn_set_style(buttonZText, LV_BTN_STYLE_REL, &tft_style_label_rel);  /*Set the button's released style*/
209
+    lv_btn_set_style(buttonZText, LV_BTN_STYLE_PR, &tft_style_label_pre);   /*Set the button's pressed style*/
210
+    lv_btn_set_layout(buttonZText, LV_LAYOUT_OFF);
211
+    labelZText = lv_label_create(buttonZText, NULL);                        /*Add a label to the button*/
212
+
213
+    buttonZValue = lv_imgbtn_create(scr, NULL);
214
+    lv_obj_set_pos(buttonZValue, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 3 + PARA_UI_VALUE_V);
215
+    lv_obj_set_event_cb_mks(buttonZValue, event_handler, ID_FEED_Z, "bmp_value_blank.bin", 0);
216
+    lv_imgbtn_set_src(buttonZValue, LV_BTN_STATE_REL, &bmp_para_bank);
217
+    lv_imgbtn_set_src(buttonZValue, LV_BTN_STATE_PR, &bmp_para_bank);
218
+    lv_imgbtn_set_style(buttonZValue, LV_BTN_STATE_PR, &style_para_value_pre);
219
+    lv_imgbtn_set_style(buttonZValue, LV_BTN_STATE_REL, &style_para_value_rel);
220
+    lv_btn_set_layout(buttonZValue, LV_LAYOUT_OFF);
221
+    labelZValue = lv_label_create(buttonZValue, NULL);
222
+
223
+    line3 = lv_line_create(scr, NULL);
224
+    lv_ex_line(line3, line_points[2]);
225
+
226
+    buttonE0Text = lv_btn_create(scr, NULL);                                /*Add a button the current screen*/
227
+    lv_obj_set_pos(buttonE0Text, PARA_UI_POS_X, PARA_UI_POS_Y * 4);         /*Set its position*/
228
+    lv_obj_set_size(buttonE0Text, PARA_UI_VALUE_SIZE_X, PARA_UI_SIZE_Y);    /*Set its size*/
229
+    lv_obj_set_event_cb(buttonE0Text, event_handler);
230
+    lv_btn_set_style(buttonE0Text, LV_BTN_STYLE_REL, &tft_style_label_rel); /*Set the button's released style*/
231
+    lv_btn_set_style(buttonE0Text, LV_BTN_STYLE_PR, &tft_style_label_pre);  /*Set the button's pressed style*/
232
+    lv_btn_set_layout(buttonE0Text, LV_LAYOUT_OFF);
233
+    labelE0Text = lv_label_create(buttonE0Text, NULL);                      /*Add a label to the button*/
234
+
235
+    buttonE0Value = lv_imgbtn_create(scr, NULL);
236
+    lv_obj_set_pos(buttonE0Value, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 4 + PARA_UI_VALUE_V);
237
+    lv_obj_set_event_cb_mks(buttonE0Value, event_handler, ID_FEED_E0, "bmp_value_blank.bin", 0);
238
+    lv_imgbtn_set_src(buttonE0Value, LV_BTN_STATE_REL, &bmp_para_bank);
239
+    lv_imgbtn_set_src(buttonE0Value, LV_BTN_STATE_PR, &bmp_para_bank);
240
+    lv_imgbtn_set_style(buttonE0Value, LV_BTN_STATE_PR, &style_para_value_pre);
241
+    lv_imgbtn_set_style(buttonE0Value, LV_BTN_STATE_REL, &style_para_value_rel);
242
+    lv_btn_set_layout(buttonE0Value, LV_LAYOUT_OFF);
243
+    labelE0Value = lv_label_create(buttonE0Value, NULL);
244
+
245
+    line4 = lv_line_create(scr, NULL);
246
+    lv_ex_line(line4, line_points[3]);
247
+
248
+    buttonTurnPage = lv_imgbtn_create(scr, NULL);
249
+    lv_obj_set_event_cb_mks(buttonTurnPage, event_handler, ID_FEED_DOWN, "bmp_back70x40.bin", 0);
250
+    lv_imgbtn_set_src(buttonTurnPage, LV_BTN_STATE_REL, &bmp_para_back);
251
+    lv_imgbtn_set_src(buttonTurnPage, LV_BTN_STATE_PR, &bmp_para_back);
252
+    lv_imgbtn_set_style(buttonTurnPage, LV_BTN_STATE_PR, &tft_style_label_pre);
253
+    lv_imgbtn_set_style(buttonTurnPage, LV_BTN_STATE_REL, &tft_style_label_rel);
254
+  }
255
+  else {
256
+    buttonE1Text = lv_btn_create(scr, NULL);                                /*Add a button the current screen*/
257
+    lv_obj_set_pos(buttonE1Text, PARA_UI_POS_X, PARA_UI_POS_Y);             /*Set its position*/
258
+    lv_obj_set_size(buttonE1Text, PARA_UI_VALUE_SIZE_X, PARA_UI_SIZE_Y);    /*Set its size*/
259
+    lv_obj_set_event_cb(buttonE1Text, event_handler);
260
+    lv_btn_set_style(buttonE1Text, LV_BTN_STYLE_REL, &tft_style_label_rel); /*Set the button's released style*/
261
+    lv_btn_set_style(buttonE1Text, LV_BTN_STYLE_PR, &tft_style_label_pre);  /*Set the button's pressed style*/
262
+    lv_btn_set_layout(buttonE1Text, LV_LAYOUT_OFF);
263
+    labelE1Text = lv_label_create(buttonE1Text, NULL);                      /*Add a label to the button*/
264
+
265
+    buttonE1Value = lv_imgbtn_create(scr, NULL);
266
+    lv_obj_set_pos(buttonE1Value, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y + PARA_UI_VALUE_V);
267
+    lv_obj_set_event_cb_mks(buttonE1Value, event_handler, ID_FEED_E1, "bmp_value_blank.bin", 0);
268
+    lv_imgbtn_set_src(buttonE1Value, LV_BTN_STATE_REL, &bmp_para_bank);
269
+    lv_imgbtn_set_src(buttonE1Value, LV_BTN_STATE_PR, &bmp_para_bank);
270
+    lv_imgbtn_set_style(buttonE1Value, LV_BTN_STATE_PR, &style_para_value_pre);
271
+    lv_imgbtn_set_style(buttonE1Value, LV_BTN_STATE_REL, &style_para_value_rel);
272
+    lv_btn_set_layout(buttonE1Value, LV_LAYOUT_OFF);
273
+    labelE1Value = lv_label_create(buttonE1Value, NULL);
274
+
275
+    line1 = lv_line_create(scr, NULL);
276
+    lv_ex_line(line1, line_points[0]);
277
+
278
+    buttonTurnPage = lv_imgbtn_create(scr, NULL);
279
+    lv_obj_set_event_cb_mks(buttonTurnPage, event_handler, ID_FEED_UP, "bmp_back70x40.bin", 0);
280
+    lv_imgbtn_set_src(buttonTurnPage, LV_BTN_STATE_REL, &bmp_para_back);
281
+    lv_imgbtn_set_src(buttonTurnPage, LV_BTN_STATE_PR, &bmp_para_back);
282
+    lv_imgbtn_set_style(buttonTurnPage, LV_BTN_STATE_PR, &tft_style_label_pre);
283
+    lv_imgbtn_set_style(buttonTurnPage, LV_BTN_STATE_REL, &tft_style_label_rel);
284
+  }
285
+
286
+  lv_obj_set_pos(buttonTurnPage, PARA_UI_TURN_PAGE_POS_X, PARA_UI_TURN_PAGE_POS_Y);
287
+  lv_btn_set_layout(buttonTurnPage, LV_LAYOUT_OFF);
288
+  labelTurnPage = lv_label_create(buttonTurnPage, NULL);
289
+
290
+
291
+  buttonBack = lv_imgbtn_create(scr, NULL);
292
+  lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_FEED_RETURN, "bmp_back70x40.bin", 0);
293
+  lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_REL, &bmp_para_back);
294
+  lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_PR, &bmp_para_back);
295
+  lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_PR, &tft_style_label_pre);
296
+  lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_REL, &tft_style_label_rel);
297
+
298
+  lv_obj_set_pos(buttonBack, PARA_UI_BACL_POS_X, PARA_UI_BACL_POS_Y);
299
+  lv_btn_set_layout(buttonBack, LV_LAYOUT_OFF);
300
+  label_Back = lv_label_create(buttonBack, NULL);
301
+
302
+  if (gCfgItems.multiple_language != 0) {
303
+    if (uiCfg.para_ui_page != 1) {
304
+      lv_label_set_text(labelXText, machine_menu.XMaxFeedRate);
305
+      lv_obj_align(labelXText, buttonXText, LV_ALIGN_IN_LEFT_MID, 0, 0);
306
+
307
+      lv_label_set_text(labelYText, machine_menu.YMaxFeedRate);
308
+      lv_obj_align(labelYText, buttonYText, LV_ALIGN_IN_LEFT_MID, 0, 0);
309
+
310
+      lv_label_set_text(labelZText, machine_menu.ZMaxFeedRate);
311
+      lv_obj_align(labelZText, buttonZText, LV_ALIGN_IN_LEFT_MID, 0, 0);
312
+
313
+      lv_label_set_text(labelE0Text, machine_menu.E0MaxFeedRate);
314
+      lv_obj_align(labelE0Text, buttonE0Text, LV_ALIGN_IN_LEFT_MID, 0, 0);
315
+
316
+      lv_label_set_text(labelTurnPage, machine_menu.next);
317
+      lv_obj_align(labelTurnPage, buttonTurnPage, LV_ALIGN_CENTER, 0, 0);
318
+
319
+      ZERO(public_buf_l);
320
+      sprintf_P(public_buf_l, PSTR("%.1f"), planner.settings.max_feedrate_mm_s[X_AXIS]);
321
+      lv_label_set_text(labelXValue, public_buf_l);
322
+      lv_obj_align(labelXValue, buttonXValue, LV_ALIGN_CENTER, 0, 0);
323
+
324
+      ZERO(public_buf_l);
325
+      sprintf_P(public_buf_l, PSTR("%.1f"), planner.settings.max_feedrate_mm_s[Y_AXIS]);
326
+      lv_label_set_text(labelYValue, public_buf_l);
327
+      lv_obj_align(labelYValue, buttonYValue, LV_ALIGN_CENTER, 0, 0);
328
+
329
+      ZERO(public_buf_l);
330
+      sprintf_P(public_buf_l, PSTR("%.1f"), planner.settings.max_feedrate_mm_s[Z_AXIS]);
331
+      lv_label_set_text(labelZValue, public_buf_l);
332
+      lv_obj_align(labelZValue, buttonZValue, LV_ALIGN_CENTER, 0, 0);
333
+
334
+      ZERO(public_buf_l);
335
+      sprintf_P(public_buf_l, PSTR("%.1f"), planner.settings.max_feedrate_mm_s[E_AXIS]);
336
+      lv_label_set_text(labelE0Value, public_buf_l);
337
+      lv_obj_align(labelE0Value, buttonE0Value, LV_ALIGN_CENTER, 0, 0);
338
+    }
339
+    else {
340
+      lv_label_set_text(labelE1Text, machine_menu.E1MaxFeedRate);
341
+      lv_obj_align(labelE1Text, buttonE1Text, LV_ALIGN_IN_LEFT_MID, 0, 0);
342
+
343
+      lv_label_set_text(labelTurnPage, machine_menu.previous);
344
+      lv_obj_align(labelTurnPage, buttonTurnPage, LV_ALIGN_CENTER, 0, 0);
345
+
346
+      ZERO(public_buf_l);
347
+      sprintf_P(public_buf_l, PSTR("%.1f"), planner.settings.max_feedrate_mm_s[E_AXIS_N(1)]);
348
+      lv_label_set_text(labelE1Value, public_buf_l);
349
+      lv_obj_align(labelE1Value, buttonE1Value, LV_ALIGN_CENTER, 0, 0);
350
+    }
351
+
352
+    lv_label_set_text(label_Back, common_menu.text_back);
353
+    lv_obj_align(label_Back, buttonBack, LV_ALIGN_CENTER, 0, 0);
354
+  }
355
+}
356
+
357
+void lv_clear_max_feedrate_settings() { lv_obj_del(scr); }
358
+
359
+#endif // HAS_TFT_LVGL_UI

+ 33
- 0
Marlin/src/lcd/extui/lib/mks_ui/draw_max_feedrate_settings.h View File

@@ -0,0 +1,33 @@
1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
+ *
5
+ * Based on Sprinter and grbl.
6
+ * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
7
+ *
8
+ * This program is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+#pragma once
23
+
24
+#ifdef __cplusplus
25
+extern "C" { /* C-declarations for C++ */
26
+#endif
27
+
28
+extern void lv_draw_max_feedrate_settings(void);
29
+extern void lv_clear_max_feedrate_settings();
30
+
31
+#ifdef __cplusplus
32
+} /* C-declarations for C++ */
33
+#endif

+ 247
- 0
Marlin/src/lcd/extui/lib/mks_ui/draw_motor_settings.cpp View File

@@ -0,0 +1,247 @@
1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
+ *
5
+ * Based on Sprinter and grbl.
6
+ * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
7
+ *
8
+ * This program is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+#include "../../../../inc/MarlinConfigPre.h"
23
+
24
+#if HAS_TFT_LVGL_UI
25
+
26
+#include "lv_conf.h"
27
+#include "draw_ui.h"
28
+
29
+#include "../../../../MarlinCore.h"
30
+
31
+static lv_obj_t * scr;
32
+
33
+#define ID_MOTOR_RETURN            1
34
+#define ID_MOTOR_STEPS             2
35
+#define ID_MOTOR_STEPS_ARROW       3
36
+#define ID_MOTOR_TMC_CURRENT       4
37
+#define ID_MOTOR_TMC_CURRENT_ARROW 5
38
+#define ID_MOTOR_STEP_MODE         6
39
+#define ID_MOTOR_STEP_MODE_ARROW   7
40
+
41
+static void event_handler(lv_obj_t * obj, lv_event_t event) {
42
+  switch (obj->mks_obj_id) {
43
+    case ID_MOTOR_RETURN:
44
+      if (event == LV_EVENT_CLICKED) {
45
+
46
+      }
47
+      else if (event == LV_EVENT_RELEASED) {
48
+        lv_clear_motor_settings();
49
+        draw_return_ui();
50
+      }
51
+      break;
52
+    case ID_MOTOR_STEPS:
53
+      if (event == LV_EVENT_CLICKED) {
54
+
55
+      }
56
+      else if (event == LV_EVENT_RELEASED) {
57
+        lv_clear_motor_settings();
58
+        lv_draw_step_settings();
59
+      }
60
+      break;
61
+    case ID_MOTOR_STEPS_ARROW:
62
+      if (event == LV_EVENT_CLICKED) {
63
+
64
+      }
65
+      else if (event == LV_EVENT_RELEASED) {
66
+        lv_clear_motor_settings();
67
+        lv_draw_step_settings();
68
+      }
69
+      break;
70
+      #if HAS_TRINAMIC_CONFIG
71
+        case ID_MOTOR_TMC_CURRENT:
72
+          if (event == LV_EVENT_CLICKED) {
73
+
74
+          }
75
+          else if (event == LV_EVENT_RELEASED) {
76
+            lv_clear_motor_settings();
77
+            lv_draw_tmc_current_settings();
78
+          }
79
+          break;
80
+        case ID_MOTOR_TMC_CURRENT_ARROW:
81
+          if (event == LV_EVENT_CLICKED) {
82
+
83
+          }
84
+          else if (event == LV_EVENT_RELEASED) {
85
+            lv_clear_motor_settings();
86
+            lv_draw_tmc_current_settings();
87
+          }
88
+          break;
89
+          #if HAS_STEALTHCHOP
90
+            case ID_MOTOR_STEP_MODE:
91
+              if (event == LV_EVENT_CLICKED) {
92
+
93
+              }
94
+              else if (event == LV_EVENT_RELEASED) {
95
+                lv_clear_motor_settings();
96
+                lv_draw_tmc_step_mode_settings();
97
+              }
98
+              break;
99
+            case ID_MOTOR_STEP_MODE_ARROW:
100
+              if (event == LV_EVENT_CLICKED) {
101
+
102
+              }
103
+              else if (event == LV_EVENT_RELEASED) {
104
+                lv_clear_motor_settings();
105
+                lv_draw_tmc_step_mode_settings();
106
+              }
107
+              break;
108
+          #endif
109
+      #endif
110
+  }
111
+}
112
+
113
+void lv_draw_motor_settings(void) {
114
+  lv_obj_t *buttonBack, *label_Back;
115
+  lv_obj_t *buttonSteps, *labelSteps, *buttonStepsNarrow;
116
+  #if HAS_TRINAMIC_CONFIG
117
+    lv_obj_t *buttonTMCcurrent, *labelTMCcurrent, *buttonTMCcurrentNarrow;
118
+    lv_obj_t * line2;
119
+    #if HAS_STEALTHCHOP
120
+      lv_obj_t *buttonStepMode, *labelStepMode, *buttonStepModeNarrow;
121
+      lv_obj_t * line3;
122
+    #endif
123
+  #endif
124
+  lv_obj_t * line1;
125
+  if (disp_state_stack._disp_state[disp_state_stack._disp_index] != MOTOR_SETTINGS_UI) {
126
+    disp_state_stack._disp_index++;
127
+    disp_state_stack._disp_state[disp_state_stack._disp_index] = MOTOR_SETTINGS_UI;
128
+  }
129
+  disp_state = MOTOR_SETTINGS_UI;
130
+
131
+  scr = lv_obj_create(NULL, NULL);
132
+
133
+  lv_obj_set_style(scr, &tft_style_scr);
134
+  lv_scr_load(scr);
135
+  lv_obj_clean(scr);
136
+
137
+  lv_obj_t * title = lv_label_create(scr, NULL);
138
+  lv_obj_set_style(title, &tft_style_label_rel);
139
+  lv_obj_set_pos(title, TITLE_XPOS, TITLE_YPOS);
140
+  lv_label_set_text(title, machine_menu.MotorConfTitle);
141
+
142
+  lv_refr_now(lv_refr_get_disp_refreshing());
143
+
144
+  LV_IMG_DECLARE(bmp_para_back);
145
+  LV_IMG_DECLARE(bmp_para_arrow);
146
+
147
+  buttonSteps = lv_btn_create(scr, NULL);                                 /*Add a button the current screen*/
148
+  lv_obj_set_pos(buttonSteps, PARA_UI_POS_X, PARA_UI_POS_Y);              /*Set its position*/
149
+  lv_obj_set_size(buttonSteps, PARA_UI_SIZE_X, PARA_UI_SIZE_Y);           /*Set its size*/
150
+  // lv_obj_set_event_cb(buttonMachine, event_handler);
151
+  lv_obj_set_event_cb_mks(buttonSteps, event_handler, ID_MOTOR_STEPS, NULL, 0);
152
+  lv_btn_set_style(buttonSteps, LV_BTN_STYLE_REL, &tft_style_label_rel);  /*Set the button's released style*/
153
+  lv_btn_set_style(buttonSteps, LV_BTN_STYLE_PR, &tft_style_label_pre);   /*Set the button's pressed style*/
154
+  lv_btn_set_layout(buttonSteps, LV_LAYOUT_OFF);
155
+  labelSteps = lv_label_create(buttonSteps, NULL);                        /*Add a label to the button*/
156
+
157
+  buttonStepsNarrow = lv_imgbtn_create(scr, NULL);
158
+  lv_obj_set_pos(buttonStepsNarrow, PARA_UI_POS_X + PARA_UI_SIZE_X, PARA_UI_POS_Y + PARA_UI_ARROW_V);
159
+  lv_obj_set_event_cb_mks(buttonStepsNarrow, event_handler, ID_MOTOR_STEPS_ARROW, "bmp_arrow.bin", 0);
160
+  lv_imgbtn_set_src(buttonStepsNarrow, LV_BTN_STATE_REL, &bmp_para_arrow);
161
+  lv_imgbtn_set_src(buttonStepsNarrow, LV_BTN_STATE_PR, &bmp_para_arrow);
162
+  lv_imgbtn_set_style(buttonStepsNarrow, LV_BTN_STATE_PR, &tft_style_label_pre);
163
+  lv_imgbtn_set_style(buttonStepsNarrow, LV_BTN_STATE_REL, &tft_style_label_rel);
164
+  lv_btn_set_layout(buttonStepsNarrow, LV_LAYOUT_OFF);
165
+
166
+  line1 = lv_line_create(lv_scr_act(), NULL);
167
+  lv_ex_line(line1, line_points[0]);
168
+  #if HAS_TRINAMIC_CONFIG
169
+    buttonTMCcurrent = lv_btn_create(scr, NULL);                                /*Add a button the current screen*/
170
+    lv_obj_set_pos(buttonTMCcurrent, PARA_UI_POS_X, PARA_UI_POS_Y * 2);         /*Set its position*/
171
+    lv_obj_set_size(buttonTMCcurrent, PARA_UI_SIZE_X, PARA_UI_SIZE_Y);          /*Set its size*/
172
+    // lv_obj_set_event_cb(buttonMachine, event_handler);
173
+    lv_obj_set_event_cb_mks(buttonTMCcurrent, event_handler, ID_MOTOR_TMC_CURRENT, NULL, 0);
174
+    lv_btn_set_style(buttonTMCcurrent, LV_BTN_STYLE_REL, &tft_style_label_rel); /*Set the button's released style*/
175
+    lv_btn_set_style(buttonTMCcurrent, LV_BTN_STYLE_PR, &tft_style_label_pre);  /*Set the button's pressed style*/
176
+    lv_btn_set_layout(buttonTMCcurrent, LV_LAYOUT_OFF);
177
+    labelTMCcurrent = lv_label_create(buttonTMCcurrent, NULL);                  /*Add a label to the button*/
178
+
179
+    buttonTMCcurrentNarrow = lv_imgbtn_create(scr, NULL);
180
+    lv_obj_set_pos(buttonTMCcurrentNarrow, PARA_UI_POS_X + PARA_UI_SIZE_X, PARA_UI_POS_Y * 2 + PARA_UI_ARROW_V);
181
+    lv_obj_set_event_cb_mks(buttonTMCcurrentNarrow, event_handler, ID_MOTOR_TMC_CURRENT_ARROW, "bmp_arrow.bin", 0);
182
+    lv_imgbtn_set_src(buttonTMCcurrentNarrow, LV_BTN_STATE_REL, &bmp_para_arrow);
183
+    lv_imgbtn_set_src(buttonTMCcurrentNarrow, LV_BTN_STATE_PR, &bmp_para_arrow);
184
+    lv_imgbtn_set_style(buttonTMCcurrentNarrow, LV_BTN_STATE_PR, &tft_style_label_pre);
185
+    lv_imgbtn_set_style(buttonTMCcurrentNarrow, LV_BTN_STATE_REL, &tft_style_label_rel);
186
+    lv_btn_set_layout(buttonTMCcurrentNarrow, LV_LAYOUT_OFF);
187
+
188
+    line2 = lv_line_create(lv_scr_act(), NULL);
189
+    lv_ex_line(line2, line_points[1]);
190
+
191
+    #if HAS_STEALTHCHOP
192
+      buttonStepMode = lv_btn_create(scr, NULL);                                /*Add a button the current screen*/
193
+      lv_obj_set_pos(buttonStepMode, PARA_UI_POS_X, PARA_UI_POS_Y * 3);         /*Set its position*/
194
+      lv_obj_set_size(buttonStepMode, PARA_UI_SIZE_X, PARA_UI_SIZE_Y);          /*Set its size*/
195
+      // lv_obj_set_event_cb(buttonMachine, event_handler);
196
+      lv_obj_set_event_cb_mks(buttonStepMode, event_handler, ID_MOTOR_STEP_MODE, NULL, 0);
197
+      lv_btn_set_style(buttonStepMode, LV_BTN_STYLE_REL, &tft_style_label_rel); /*Set the button's released style*/
198
+      lv_btn_set_style(buttonStepMode, LV_BTN_STYLE_PR, &tft_style_label_pre);  /*Set the button's pressed style*/
199
+      lv_btn_set_layout(buttonStepMode, LV_LAYOUT_OFF);
200
+      labelStepMode = lv_label_create(buttonStepMode, NULL);                    /*Add a label to the button*/
201
+
202
+      buttonStepModeNarrow = lv_imgbtn_create(scr, NULL);
203
+      lv_obj_set_pos(buttonStepModeNarrow, PARA_UI_POS_X + PARA_UI_SIZE_X, PARA_UI_POS_Y * 3 + PARA_UI_ARROW_V);
204
+      lv_obj_set_event_cb_mks(buttonStepModeNarrow, event_handler, ID_MOTOR_STEP_MODE_ARROW, "bmp_arrow.bin", 0);
205
+      lv_imgbtn_set_src(buttonStepModeNarrow, LV_BTN_STATE_REL, &bmp_para_arrow);
206
+      lv_imgbtn_set_src(buttonStepModeNarrow, LV_BTN_STATE_PR, &bmp_para_arrow);
207
+      lv_imgbtn_set_style(buttonStepModeNarrow, LV_BTN_STATE_PR, &tft_style_label_pre);
208
+      lv_imgbtn_set_style(buttonStepModeNarrow, LV_BTN_STATE_REL, &tft_style_label_rel);
209
+      lv_btn_set_layout(buttonStepModeNarrow, LV_LAYOUT_OFF);
210
+
211
+      line3 = lv_line_create(lv_scr_act(), NULL);
212
+      lv_ex_line(line3, line_points[2]);
213
+    #endif
214
+  #endif // HAS_TRINAMIC_CONFIG
215
+
216
+  buttonBack = lv_imgbtn_create(scr, NULL);
217
+  lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_MOTOR_RETURN, "bmp_back70x40.bin", 0);
218
+  lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_REL, &bmp_para_back);
219
+  lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_PR, &bmp_para_back);
220
+  lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_PR, &tft_style_label_pre);
221
+  lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_REL, &tft_style_label_rel);
222
+
223
+  lv_obj_set_pos(buttonBack, PARA_UI_BACL_POS_X, PARA_UI_BACL_POS_Y);
224
+  lv_btn_set_layout(buttonBack, LV_LAYOUT_OFF);
225
+  label_Back = lv_label_create(buttonBack, NULL);
226
+
227
+  if (gCfgItems.multiple_language != 0) {
228
+    lv_label_set_text(label_Back, common_menu.text_back);
229
+    lv_obj_align(label_Back, buttonBack, LV_ALIGN_CENTER, 0, 0);
230
+
231
+    lv_label_set_text(labelSteps, machine_menu.StepsConf);
232
+    lv_obj_align(labelSteps, buttonSteps, LV_ALIGN_IN_LEFT_MID, 0, 0);
233
+    #if HAS_TRINAMIC_CONFIG
234
+      lv_label_set_text(labelTMCcurrent, machine_menu.TMCcurrentConf);
235
+      lv_obj_align(labelTMCcurrent, buttonTMCcurrent, LV_ALIGN_IN_LEFT_MID, 0, 0);
236
+      #if HAS_STEALTHCHOP
237
+        lv_label_set_text(labelStepMode, machine_menu.TMCStepModeConf);
238
+        lv_obj_align(labelStepMode, buttonStepMode, LV_ALIGN_IN_LEFT_MID, 0, 0);
239
+      #endif
240
+    #endif
241
+  }
242
+
243
+}
244
+
245
+void lv_clear_motor_settings() { lv_obj_del(scr); }
246
+
247
+#endif // HAS_TFT_LVGL_UI

+ 33
- 0
Marlin/src/lcd/extui/lib/mks_ui/draw_motor_settings.h View File

@@ -0,0 +1,33 @@
1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
+ *
5
+ * Based on Sprinter and grbl.
6
+ * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
7
+ *
8
+ * This program is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+#pragma once
23
+
24
+#ifdef __cplusplus
25
+extern "C" { /* C-declarations for C++ */
26
+#endif
27
+
28
+extern void lv_draw_motor_settings(void);
29
+extern void lv_clear_motor_settings();
30
+
31
+#ifdef __cplusplus
32
+} /* C-declarations for C++ */
33
+#endif

+ 65
- 70
Marlin/src/lcd/extui/lib/mks_ui/draw_move_motor.cpp View File

@@ -21,7 +21,7 @@
21 21
  */
22 22
 #include "../../../../inc/MarlinConfigPre.h"
23 23
 
24
-#if ENABLED(TFT_LVGL_UI)
24
+#if HAS_TFT_LVGL_UI
25 25
 
26 26
 #include "../../../../MarlinCore.h"
27 27
 #include "lv_conf.h"
@@ -53,10 +53,10 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
53 53
       }
54 54
       else if (event == LV_EVENT_RELEASED) {
55 55
         if (queue.length <= (BUFSIZE - 3)) {
56
-          memset(public_buf_l, 0, sizeof(public_buf_l));
56
+          ZERO(public_buf_l);
57 57
           queue.enqueue_one_P(PSTR("G91"));
58
-          sprintf(public_buf_l, "G1 X%3.1f F%d", uiCfg.move_dist, uiCfg.moveSpeed);
59
-          queue.enqueue_one_P(PSTR(public_buf_l));
58
+          sprintf_P(public_buf_l, PSTR("G1 X%3.1f F%d"), uiCfg.move_dist, uiCfg.moveSpeed);
59
+          queue.enqueue_one_now(public_buf_l);
60 60
           queue.enqueue_one_P(PSTR("G90"));
61 61
         }
62 62
       }
@@ -67,11 +67,11 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
67 67
       }
68 68
       else if (event == LV_EVENT_RELEASED) {
69 69
         if (queue.length <= (BUFSIZE - 3)) {
70
-          memset(public_buf_l, 0, sizeof(public_buf_l));
71
-          queue.enqueue_one_now(PSTR("G91"));
72
-          sprintf(public_buf_l, "G1 X-%3.1f F%d", uiCfg.move_dist, uiCfg.moveSpeed);
73
-          queue.enqueue_one_now(PSTR(public_buf_l));
74
-          queue.enqueue_one_now(PSTR("G90"));
70
+          ZERO(public_buf_l);
71
+          queue.enqueue_now_P(PSTR("G91"));
72
+          sprintf_P(public_buf_l, PSTR("G1 X-%3.1f F%d"), uiCfg.move_dist, uiCfg.moveSpeed);
73
+          queue.enqueue_one_now(public_buf_l);
74
+          queue.enqueue_now_P(PSTR("G90"));
75 75
         }
76 76
       }
77 77
       break;
@@ -81,11 +81,11 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
81 81
       }
82 82
       else if (event == LV_EVENT_RELEASED) {
83 83
         if (queue.length <= (BUFSIZE - 3)) {
84
-          memset(public_buf_l, 0, sizeof(public_buf_l));
85
-          queue.enqueue_one_now(PSTR("G91"));
86
-          sprintf(public_buf_l, "G1 Y%3.1f F%d", uiCfg.move_dist, uiCfg.moveSpeed);
87
-          queue.enqueue_one_now(PSTR(public_buf_l));
88
-          queue.enqueue_one_now(PSTR("G90"));
84
+          ZERO(public_buf_l);
85
+          queue.enqueue_now_P(PSTR("G91"));
86
+          sprintf_P(public_buf_l, PSTR("G1 Y%3.1f F%d"), uiCfg.move_dist, uiCfg.moveSpeed);
87
+          queue.enqueue_one_now(public_buf_l);
88
+          queue.enqueue_now_P(PSTR("G90"));
89 89
         }
90 90
       }
91 91
       break;
@@ -95,11 +95,11 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
95 95
       }
96 96
       else if (event == LV_EVENT_RELEASED) {
97 97
         if (queue.length <= (BUFSIZE - 3)) {
98
-          memset(public_buf_l, 0, sizeof(public_buf_l));
99
-          queue.enqueue_one_now(PSTR("G91"));
100
-          sprintf(public_buf_l, "G1 Y-%3.1f F%d", uiCfg.move_dist, uiCfg.moveSpeed);
101
-          queue.enqueue_one_now(PSTR(public_buf_l));
102
-          queue.enqueue_one_now(PSTR("G90"));
98
+          ZERO(public_buf_l);
99
+          queue.enqueue_now_P(PSTR("G91"));
100
+          sprintf_P(public_buf_l, PSTR("G1 Y-%3.1f F%d"), uiCfg.move_dist, uiCfg.moveSpeed);
101
+          queue.enqueue_one_now(public_buf_l);
102
+          queue.enqueue_now_P(PSTR("G90"));
103 103
         }
104 104
       }
105 105
       break;
@@ -109,11 +109,11 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
109 109
       }
110 110
       else if (event == LV_EVENT_RELEASED) {
111 111
         if (queue.length <= (BUFSIZE - 3)) {
112
-          memset(public_buf_l, 0, sizeof(public_buf_l));
113
-          queue.enqueue_one_now(PSTR("G91"));
114
-          sprintf(public_buf_l, "G1 Z%3.1f F%d", uiCfg.move_dist, uiCfg.moveSpeed);
115
-          queue.enqueue_one_now(PSTR(public_buf_l));
116
-          queue.enqueue_one_now(PSTR("G90"));
112
+          ZERO(public_buf_l);
113
+          queue.enqueue_now_P(PSTR("G91"));
114
+          sprintf_P(public_buf_l, PSTR("G1 Z%3.1f F%d"), uiCfg.move_dist, uiCfg.moveSpeed);
115
+          queue.enqueue_one_now(public_buf_l);
116
+          queue.enqueue_now_P(PSTR("G90"));
117 117
         }
118 118
       }
119 119
       break;
@@ -123,11 +123,11 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
123 123
       }
124 124
       else if (event == LV_EVENT_RELEASED) {
125 125
         if (queue.length <= (BUFSIZE - 3)) {
126
-          memset(public_buf_l, 0, sizeof(public_buf_l));
127
-          queue.enqueue_one_now(PSTR("G91"));
128
-          sprintf(public_buf_l, "G1 Z-%3.1f F%d", uiCfg.move_dist, uiCfg.moveSpeed);
129
-          queue.enqueue_one_now(PSTR(public_buf_l));
130
-          queue.enqueue_one_now(PSTR("G90"));
126
+          ZERO(public_buf_l);
127
+          queue.enqueue_now_P(PSTR("G91"));
128
+          sprintf_P(public_buf_l, PSTR("G1 Z-%3.1f F%d"), uiCfg.move_dist, uiCfg.moveSpeed);
129
+          queue.enqueue_one_now(public_buf_l);
130
+          queue.enqueue_now_P(PSTR("G90"));
131 131
         }
132 132
       }
133 133
       break;
@@ -154,14 +154,11 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
154 154
         draw_return_ui();
155 155
       }
156 156
       break;
157
-
158 157
   }
159 158
 }
160 159
 
161
-
162 160
 void lv_draw_move_motor(void) {
163
-  lv_obj_t  *buttonXI, *buttonXD, *buttonYI, *buttonYD;
164
-  lv_obj_t        *buttonZI, *buttonZD, *buttonBack;
161
+  lv_obj_t *buttonXI, *buttonXD, *buttonYI, *buttonYD, *buttonZI, *buttonZD, *buttonBack;
165 162
 
166 163
   if (disp_state_stack._disp_state[disp_state_stack._disp_index] != MOVE_MOTOR_UI) {
167 164
     disp_state_stack._disp_index++;
@@ -176,7 +173,7 @@ void lv_draw_move_motor(void) {
176 173
   lv_obj_clean(scr);
177 174
 
178 175
   lv_obj_t * title = lv_label_create(scr, NULL);
179
-  lv_obj_set_style(title, &tft_style_lable_rel);
176
+  lv_obj_set_style(title, &tft_style_label_rel);
180 177
   lv_obj_set_pos(title, TITLE_XPOS, TITLE_YPOS);
181 178
   lv_label_set_text(title, creat_title_text());
182 179
 
@@ -184,74 +181,73 @@ void lv_draw_move_motor(void) {
184 181
 
185 182
   LV_IMG_DECLARE(bmp_pic);
186 183
 
187
-
188 184
   /*Create an Image button*/
189
-  buttonXI = lv_imgbtn_create(scr, NULL);
190
-  buttonXD = lv_imgbtn_create(scr, NULL);
191
-  buttonYI = lv_imgbtn_create(scr, NULL);
192
-  buttonYD = lv_imgbtn_create(scr, NULL);
193
-  buttonZI = lv_imgbtn_create(scr, NULL);
194
-  buttonZD = lv_imgbtn_create(scr, NULL);
195
-  buttonV = lv_imgbtn_create(scr, NULL);
185
+  buttonXI   = lv_imgbtn_create(scr, NULL);
186
+  buttonXD   = lv_imgbtn_create(scr, NULL);
187
+  buttonYI   = lv_imgbtn_create(scr, NULL);
188
+  buttonYD   = lv_imgbtn_create(scr, NULL);
189
+  buttonZI   = lv_imgbtn_create(scr, NULL);
190
+  buttonZD   = lv_imgbtn_create(scr, NULL);
191
+  buttonV    = lv_imgbtn_create(scr, NULL);
196 192
   buttonBack = lv_imgbtn_create(scr, NULL);
197 193
 
198 194
   lv_obj_set_event_cb_mks(buttonXI, event_handler, ID_M_X_P, "bmp_xAdd.bin", 0);
199 195
   lv_imgbtn_set_src(buttonXI, LV_BTN_STATE_REL, &bmp_pic);
200 196
   lv_imgbtn_set_src(buttonXI, LV_BTN_STATE_PR, &bmp_pic);
201
-  lv_imgbtn_set_style(buttonXI, LV_BTN_STATE_PR, &tft_style_lable_pre);
202
-  lv_imgbtn_set_style(buttonXI, LV_BTN_STATE_REL, &tft_style_lable_rel);
197
+  lv_imgbtn_set_style(buttonXI, LV_BTN_STATE_PR, &tft_style_label_pre);
198
+  lv_imgbtn_set_style(buttonXI, LV_BTN_STATE_REL, &tft_style_label_rel);
203 199
   lv_obj_clear_protect(buttonXI, LV_PROTECT_FOLLOW);
204 200
   #if 1
205 201
     lv_obj_set_event_cb_mks(buttonXD, event_handler, ID_M_X_N, "bmp_xDec.bin", 0);
206 202
     lv_imgbtn_set_src(buttonXD, LV_BTN_STATE_REL, &bmp_pic);
207 203
     lv_imgbtn_set_src(buttonXD, LV_BTN_STATE_PR, &bmp_pic);
208
-    lv_imgbtn_set_style(buttonXD, LV_BTN_STATE_PR, &tft_style_lable_pre);
209
-    lv_imgbtn_set_style(buttonXD, LV_BTN_STATE_REL, &tft_style_lable_rel);
204
+    lv_imgbtn_set_style(buttonXD, LV_BTN_STATE_PR, &tft_style_label_pre);
205
+    lv_imgbtn_set_style(buttonXD, LV_BTN_STATE_REL, &tft_style_label_rel);
210 206
 
211 207
     lv_obj_set_event_cb_mks(buttonYI, event_handler, ID_M_Y_P, "bmp_yAdd.bin", 0);
212 208
     lv_imgbtn_set_src(buttonYI, LV_BTN_STATE_REL, &bmp_pic);
213 209
     lv_imgbtn_set_src(buttonYI, LV_BTN_STATE_PR, &bmp_pic);
214
-    lv_imgbtn_set_style(buttonYI, LV_BTN_STATE_PR, &tft_style_lable_pre);
215
-    lv_imgbtn_set_style(buttonYI, LV_BTN_STATE_REL, &tft_style_lable_rel);
210
+    lv_imgbtn_set_style(buttonYI, LV_BTN_STATE_PR, &tft_style_label_pre);
211
+    lv_imgbtn_set_style(buttonYI, LV_BTN_STATE_REL, &tft_style_label_rel);
216 212
 
217 213
     lv_obj_set_event_cb_mks(buttonYD, event_handler, ID_M_Y_N, "bmp_yDec.bin", 0);
218 214
     lv_imgbtn_set_src(buttonYD, LV_BTN_STATE_REL, &bmp_pic);
219 215
     lv_imgbtn_set_src(buttonYD, LV_BTN_STATE_PR, &bmp_pic);
220
-    lv_imgbtn_set_style(buttonYD, LV_BTN_STATE_PR, &tft_style_lable_pre);
221
-    lv_imgbtn_set_style(buttonYD, LV_BTN_STATE_REL, &tft_style_lable_rel);
216
+    lv_imgbtn_set_style(buttonYD, LV_BTN_STATE_PR, &tft_style_label_pre);
217
+    lv_imgbtn_set_style(buttonYD, LV_BTN_STATE_REL, &tft_style_label_rel);
222 218
 
223 219
     lv_obj_set_event_cb_mks(buttonZI, event_handler, ID_M_Z_P, "bmp_zAdd.bin", 0);
224 220
     lv_imgbtn_set_src(buttonZI, LV_BTN_STATE_REL, &bmp_pic);
225 221
     lv_imgbtn_set_src(buttonZI, LV_BTN_STATE_PR, &bmp_pic);
226
-    lv_imgbtn_set_style(buttonZI, LV_BTN_STATE_PR, &tft_style_lable_pre);
227
-    lv_imgbtn_set_style(buttonZI, LV_BTN_STATE_REL, &tft_style_lable_rel);
222
+    lv_imgbtn_set_style(buttonZI, LV_BTN_STATE_PR, &tft_style_label_pre);
223
+    lv_imgbtn_set_style(buttonZI, LV_BTN_STATE_REL, &tft_style_label_rel);
228 224
 
229 225
     lv_obj_set_event_cb_mks(buttonZD, event_handler, ID_M_Z_N, "bmp_zDec.bin", 0);
230 226
     lv_imgbtn_set_src(buttonZD, LV_BTN_STATE_REL, &bmp_pic);
231 227
     lv_imgbtn_set_src(buttonZD, LV_BTN_STATE_PR, &bmp_pic);
232
-    lv_imgbtn_set_style(buttonZD, LV_BTN_STATE_PR, &tft_style_lable_pre);
233
-    lv_imgbtn_set_style(buttonZD, LV_BTN_STATE_REL, &tft_style_lable_rel);
228
+    lv_imgbtn_set_style(buttonZD, LV_BTN_STATE_PR, &tft_style_label_pre);
229
+    lv_imgbtn_set_style(buttonZD, LV_BTN_STATE_REL, &tft_style_label_rel);
234 230
 
235
-    //lv_obj_set_event_cb_mks(buttonV, event_handler,ID_T_MORE,"bmp_More.bin",0);
231
+    // lv_obj_set_event_cb_mks(buttonV, event_handler,ID_T_MORE,"bmp_More.bin",0);
236 232
     lv_imgbtn_set_src(buttonV, LV_BTN_STATE_REL, &bmp_pic);
237 233
     lv_imgbtn_set_src(buttonV, LV_BTN_STATE_PR, &bmp_pic);
238
-    lv_imgbtn_set_style(buttonV, LV_BTN_STATE_PR, &tft_style_lable_pre);
239
-    lv_imgbtn_set_style(buttonV, LV_BTN_STATE_REL, &tft_style_lable_rel);
234
+    lv_imgbtn_set_style(buttonV, LV_BTN_STATE_PR, &tft_style_label_pre);
235
+    lv_imgbtn_set_style(buttonV, LV_BTN_STATE_REL, &tft_style_label_rel);
240 236
 
241
-    lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_M_RETURN, "bmp_Return.bin", 0);
237
+    lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_M_RETURN, "bmp_return.bin", 0);
242 238
     lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_REL, &bmp_pic);
243 239
     lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_PR, &bmp_pic);
244
-    lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_PR, &tft_style_lable_pre);
245
-    lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_REL, &tft_style_lable_rel);
246
-  #endif
240
+    lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_PR, &tft_style_label_pre);
241
+    lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_REL, &tft_style_label_rel);
242
+  #endif // if 1
247 243
   lv_obj_set_pos(buttonXI, INTERVAL_V, titleHeight);
248 244
   lv_obj_set_pos(buttonYI, BTN_X_PIXEL + INTERVAL_V * 2, titleHeight);
249 245
   lv_obj_set_pos(buttonZI, BTN_X_PIXEL * 2 + INTERVAL_V * 3, titleHeight);
250 246
   lv_obj_set_pos(buttonV, BTN_X_PIXEL * 3 + INTERVAL_V * 4, titleHeight);
251
-  lv_obj_set_pos(buttonXD, INTERVAL_V,  BTN_Y_PIXEL + INTERVAL_H + titleHeight);
247
+  lv_obj_set_pos(buttonXD, INTERVAL_V, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
252 248
   lv_obj_set_pos(buttonYD, BTN_X_PIXEL + INTERVAL_V * 2, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
253
-  lv_obj_set_pos(buttonZD, BTN_X_PIXEL * 2 + INTERVAL_V * 3,  BTN_Y_PIXEL + INTERVAL_H + titleHeight);
254
-  lv_obj_set_pos(buttonBack, BTN_X_PIXEL * 3 + INTERVAL_V * 4,  BTN_Y_PIXEL + INTERVAL_H + titleHeight);
249
+  lv_obj_set_pos(buttonZD, BTN_X_PIXEL * 2 + INTERVAL_V * 3, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
250
+  lv_obj_set_pos(buttonBack, BTN_X_PIXEL * 3 + INTERVAL_V * 4, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
255 251
 
256 252
   /*Create a label on the Image button*/
257 253
   lv_btn_set_layout(buttonXI, LV_LAYOUT_OFF);
@@ -272,7 +268,6 @@ void lv_draw_move_motor(void) {
272 268
   labelV = lv_label_create(buttonV, NULL);
273 269
   lv_obj_t * label_Back = lv_label_create(buttonBack, NULL);
274 270
 
275
-
276 271
   if (gCfgItems.multiple_language != 0) {
277 272
     lv_label_set_text(labelXI, move_menu.x_add);
278 273
     lv_obj_align(labelXI, buttonXI, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
@@ -300,14 +295,14 @@ void lv_draw_move_motor(void) {
300 295
 }
301 296
 
302 297
 void disp_move_dist() {
303
-  //char buf[30] = {0};
298
+  // char buf[30] = {0};
304 299
 
305 300
   if ((int)(10 * uiCfg.move_dist) == 1)
306
-    lv_obj_set_event_cb_mks(buttonV, event_handler, ID_M_STEP, "bmp_Step_move0_1.bin", 0);
301
+    lv_obj_set_event_cb_mks(buttonV, event_handler, ID_M_STEP, "bmp_step_move0_1.bin", 0);
307 302
   else if ((int)(10 * uiCfg.move_dist) == 10)
308
-    lv_obj_set_event_cb_mks(buttonV, event_handler, ID_M_STEP, "bmp_Step_move1.bin", 0);
303
+    lv_obj_set_event_cb_mks(buttonV, event_handler, ID_M_STEP, "bmp_step_move1.bin", 0);
309 304
   else if ((int)(10 * uiCfg.move_dist) == 100)
310
-    lv_obj_set_event_cb_mks(buttonV, event_handler, ID_M_STEP, "bmp_Step_move10.bin", 0);
305
+    lv_obj_set_event_cb_mks(buttonV, event_handler, ID_M_STEP, "bmp_step_move10.bin", 0);
311 306
   if (gCfgItems.multiple_language != 0) {
312 307
     if ((int)(10 * uiCfg.move_dist) == 1) {
313 308
       lv_label_set_text(labelV, move_menu.step_01mm);
@@ -326,4 +321,4 @@ void disp_move_dist() {
326 321
 
327 322
 void lv_clear_move_motor() { lv_obj_del(scr); }
328 323
 
329
-#endif // TFT_LVGL_UI
324
+#endif // HAS_TFT_LVGL_UI

+ 799
- 0
Marlin/src/lcd/extui/lib/mks_ui/draw_number_key.cpp View File

@@ -0,0 +1,799 @@
1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
+ *
5
+ * Based on Sprinter and grbl.
6
+ * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
7
+ *
8
+ * This program is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+#include "../../../../inc/MarlinConfigPre.h"
23
+
24
+#if HAS_TFT_LVGL_UI
25
+
26
+#include "lv_conf.h"
27
+//#include "../../lvgl/src/lv_objx/lv_imgbtn.h"
28
+//#include "../../lvgl/src/lv_objx/lv_img.h"
29
+//#include "../../lvgl/src/lv_core/lv_disp.h"
30
+//#include "../../lvgl/src/lv_core/lv_refr.h"
31
+//#include "../../MarlinCore.h"
32
+#include "draw_ui.h"
33
+
34
+#include "../../../../MarlinCore.h"
35
+#include "../../../../module/temperature.h"
36
+#include "../../../../gcode/queue.h"
37
+#if ENABLED(POWER_LOSS_RECOVERY)
38
+  #include "../../../../../feature/powerloss.h"
39
+#endif
40
+
41
+#include "../../../../gcode/gcode.h"
42
+#include "../../../../module/planner.h"
43
+
44
+#if HAS_TRINAMIC_CONFIG
45
+  #include "../../../../module/stepper/indirection.h"
46
+  #include "../../../../feature/tmc_util.h"
47
+#endif
48
+
49
+static lv_obj_t * scr;
50
+static lv_obj_t *buttonValue = NULL;
51
+static lv_obj_t *labelValue  = NULL;
52
+
53
+static char key_value[11] = {0};
54
+static uint8_t cnt        = 0;
55
+static char point_flg     = 1;
56
+
57
+#define ID_NUM_KEY1      1
58
+#define ID_NUM_KEY2      2
59
+#define ID_NUM_KEY3      3
60
+#define ID_NUM_KEY4      4
61
+#define ID_NUM_KEY5      5
62
+#define ID_NUM_KEY6      6
63
+#define ID_NUM_KEY7      7
64
+#define ID_NUM_KEY8      8
65
+#define ID_NUM_KEY9      9
66
+#define ID_NUM_KEY0     10
67
+#define ID_NUM_BACK     11
68
+#define ID_NUM_RESET    12
69
+#define ID_NUM_CONFIRM  13
70
+#define ID_NUM_POINT    14
71
+#define ID_NUM_NAGETIVE 15
72
+
73
+static void disp_key_value() {
74
+  char *temp;
75
+  #if HAS_TRINAMIC_CONFIG
76
+    float milliamps;
77
+  #endif
78
+
79
+  switch (value) {
80
+    case PrintAcceleration:
81
+      ZERO(public_buf_m);
82
+      sprintf_P(public_buf_m, PSTR("%.1f"), planner.settings.acceleration);
83
+      break;
84
+    case RetractAcceleration:
85
+      ZERO(public_buf_m);
86
+      sprintf_P(public_buf_m, PSTR("%.1f"), planner.settings.retract_acceleration);
87
+      break;
88
+    case TravelAcceleration:
89
+      ZERO(public_buf_m);
90
+      sprintf_P(public_buf_m, PSTR("%.1f"), planner.settings.travel_acceleration);
91
+      break;
92
+    case XAcceleration:
93
+      ZERO(public_buf_m);
94
+      sprintf_P(public_buf_m, PSTR("%d"), (int)planner.settings.max_acceleration_mm_per_s2[X_AXIS]);
95
+      break;
96
+    case YAcceleration:
97
+      ZERO(public_buf_m);
98
+      sprintf_P(public_buf_m, PSTR("%d"), (int)planner.settings.max_acceleration_mm_per_s2[Y_AXIS]);
99
+      break;
100
+    case ZAcceleration:
101
+      ZERO(public_buf_m);
102
+      sprintf_P(public_buf_m, PSTR("%d"), (int)planner.settings.max_acceleration_mm_per_s2[Z_AXIS]);
103
+      break;
104
+    case E0Acceleration:
105
+      ZERO(public_buf_m);
106
+      sprintf_P(public_buf_m, PSTR("%d"), (int)planner.settings.max_acceleration_mm_per_s2[E_AXIS]);
107
+      break;
108
+    case E1Acceleration:
109
+      ZERO(public_buf_m);
110
+      sprintf_P(public_buf_m, PSTR("%d"), (int)planner.settings.max_acceleration_mm_per_s2[E_AXIS_N(1)]);
111
+      break;
112
+    case XMaxFeedRate:
113
+      ZERO(public_buf_m);
114
+      sprintf_P(public_buf_m, PSTR("%.1f"), planner.settings.max_feedrate_mm_s[X_AXIS]);
115
+      break;
116
+    case YMaxFeedRate:
117
+      ZERO(public_buf_m);
118
+      sprintf_P(public_buf_m, PSTR("%.1f"), planner.settings.max_feedrate_mm_s[Y_AXIS]);
119
+      break;
120
+    case ZMaxFeedRate:
121
+      ZERO(public_buf_m);
122
+      sprintf_P(public_buf_m, PSTR("%.1f"), planner.settings.max_feedrate_mm_s[Z_AXIS]);
123
+      break;
124
+    case E0MaxFeedRate:
125
+      ZERO(public_buf_m);
126
+      sprintf_P(public_buf_m, PSTR("%.1f"), planner.settings.max_feedrate_mm_s[E_AXIS]);
127
+      break;
128
+    case E1MaxFeedRate:
129
+      ZERO(public_buf_m);
130
+      sprintf_P(public_buf_m, PSTR("%.1f"), planner.settings.max_feedrate_mm_s[E_AXIS_N(1)]);
131
+      break;
132
+
133
+    case XJerk:
134
+      #if HAS_CLASSIC_JERK
135
+        ZERO(public_buf_m);
136
+        sprintf_P(public_buf_m, PSTR("%.1f"), planner.max_jerk[X_AXIS]);
137
+      #endif
138
+      break;
139
+    case YJerk:
140
+      #if HAS_CLASSIC_JERK
141
+        ZERO(public_buf_m);
142
+        sprintf_P(public_buf_m, PSTR("%.1f"), planner.max_jerk[Y_AXIS]);
143
+      #endif
144
+      break;
145
+    case ZJerk:
146
+      #if HAS_CLASSIC_JERK
147
+        ZERO(public_buf_m);
148
+        sprintf_P(public_buf_m, PSTR("%.1f"), planner.max_jerk[Z_AXIS]);
149
+      #endif
150
+      break;
151
+    case EJerk:
152
+      #if HAS_CLASSIC_JERK
153
+        ZERO(public_buf_m);
154
+        sprintf_P(public_buf_m, PSTR("%.1f"), planner.max_jerk[E_AXIS]);
155
+      #endif
156
+      break;
157
+
158
+    case Xstep:
159
+      ZERO(public_buf_m);
160
+      sprintf_P(public_buf_m, PSTR("%.1f"), planner.settings.axis_steps_per_mm[X_AXIS]);
161
+
162
+      break;
163
+    case Ystep:
164
+      ZERO(public_buf_m);
165
+      sprintf_P(public_buf_m, PSTR("%.1f"), planner.settings.axis_steps_per_mm[Y_AXIS]);
166
+
167
+      break;
168
+    case Zstep:
169
+      ZERO(public_buf_m);
170
+      sprintf_P(public_buf_m, PSTR("%.1f"), planner.settings.axis_steps_per_mm[Z_AXIS]);
171
+
172
+      break;
173
+    case E0step:
174
+      ZERO(public_buf_m);
175
+      sprintf_P(public_buf_m, PSTR("%.1f"), planner.settings.axis_steps_per_mm[E_AXIS]);
176
+
177
+      break;
178
+    case E1step:
179
+      ZERO(public_buf_m);
180
+      sprintf_P(public_buf_m, PSTR("%.1f"), planner.settings.axis_steps_per_mm[E_AXIS_N(1)]);
181
+      break;
182
+
183
+    case Xcurrent:
184
+      #if AXIS_IS_TMC(X)
185
+        ZERO(public_buf_m);
186
+        milliamps = stepperX.getMilliamps();
187
+        sprintf_P(public_buf_m, PSTR("%.1f"), milliamps);
188
+      #endif
189
+      break;
190
+
191
+    case Ycurrent:
192
+      #if AXIS_IS_TMC(Y)
193
+        ZERO(public_buf_m);
194
+        milliamps = stepperY.getMilliamps();
195
+        sprintf_P(public_buf_m, PSTR("%.1f"), milliamps);
196
+      #endif
197
+      break;
198
+
199
+    case Zcurrent:
200
+      #if AXIS_IS_TMC(Z)
201
+        ZERO(public_buf_m);
202
+        milliamps = stepperZ.getMilliamps();
203
+        sprintf_P(public_buf_m, PSTR("%.1f"), milliamps);
204
+      #endif
205
+      break;
206
+
207
+    case E0current:
208
+      #if AXIS_IS_TMC(E0)
209
+        ZERO(public_buf_m);
210
+        milliamps = stepperE0.getMilliamps();
211
+        sprintf_P(public_buf_m, PSTR("%.1f"), milliamps);
212
+      #endif
213
+      break;
214
+
215
+    case E1current:
216
+      #if AXIS_IS_TMC(E1)
217
+        ZERO(public_buf_m);
218
+        milliamps = stepperE1.getMilliamps();
219
+        sprintf_P(public_buf_m, PSTR("%.1f"), milliamps);
220
+      #endif
221
+      break;
222
+
223
+    case pause_pos_x:
224
+      ZERO(public_buf_m);
225
+      sprintf_P(public_buf_m, PSTR("%.1f"), gCfgItems.pausePosX);
226
+      break;
227
+    case pause_pos_y:
228
+      ZERO(public_buf_m);
229
+      sprintf_P(public_buf_m, PSTR("%.1f"), gCfgItems.pausePosY);
230
+      break;
231
+    case pause_pos_z:
232
+      ZERO(public_buf_m);
233
+      sprintf_P(public_buf_m, PSTR("%.1f"), gCfgItems.pausePosZ);
234
+      break;
235
+  }
236
+  ZERO(key_value);
237
+  strcpy(key_value, public_buf_m);
238
+  cnt  = strlen(key_value);
239
+  temp = strchr(key_value, '.');
240
+  if (temp)
241
+    point_flg = 0;
242
+  else
243
+    point_flg = 1;
244
+  lv_label_set_text(labelValue, key_value);
245
+  lv_obj_align(labelValue, buttonValue, LV_ALIGN_CENTER, 0, 0);
246
+
247
+}
248
+
249
+static void set_value_confirm() {
250
+  #if HAS_TRINAMIC_CONFIG
251
+    uint16_t current_mA;
252
+  #endif
253
+  switch (value) {
254
+    case PrintAcceleration:
255
+      planner.settings.acceleration = atof(key_value);
256
+
257
+      break;
258
+    case RetractAcceleration:
259
+      planner.settings.retract_acceleration = atof(key_value);
260
+
261
+      break;
262
+    case TravelAcceleration:
263
+      planner.settings.travel_acceleration = atof(key_value);
264
+
265
+      break;
266
+    case XAcceleration:
267
+      planner.settings.max_acceleration_mm_per_s2[X_AXIS] = atof(key_value);
268
+      break;
269
+    case YAcceleration:
270
+      planner.settings.max_acceleration_mm_per_s2[Y_AXIS] = atof(key_value);
271
+      break;
272
+    case ZAcceleration:
273
+      planner.settings.max_acceleration_mm_per_s2[Z_AXIS] = atof(key_value);
274
+      break;
275
+    case E0Acceleration:
276
+      planner.settings.max_acceleration_mm_per_s2[E_AXIS] = atof(key_value);
277
+      break;
278
+    case E1Acceleration:
279
+      planner.settings.max_acceleration_mm_per_s2[E_AXIS_N(1)] = atof(key_value);
280
+      break;
281
+    case XMaxFeedRate:
282
+      planner.settings.max_feedrate_mm_s[X_AXIS] = atof(key_value);
283
+      break;
284
+    case YMaxFeedRate:
285
+      planner.settings.max_feedrate_mm_s[Y_AXIS] = atof(key_value);
286
+      break;
287
+    case ZMaxFeedRate:
288
+      planner.settings.max_feedrate_mm_s[Z_AXIS] = atof(key_value);
289
+      break;
290
+    case E0MaxFeedRate:
291
+      planner.settings.max_feedrate_mm_s[E_AXIS] = atof(key_value);
292
+      break;
293
+    case E1MaxFeedRate:
294
+      planner.settings.max_feedrate_mm_s[E_AXIS_N(1)] = atof(key_value);
295
+      break;
296
+
297
+    case XJerk:
298
+      #if HAS_CLASSIC_JERK
299
+        planner.max_jerk[X_AXIS] = atof(key_value);
300
+      #endif
301
+      break;
302
+    case YJerk:
303
+      #if HAS_CLASSIC_JERK
304
+        planner.max_jerk[Y_AXIS] = atof(key_value);
305
+      #endif
306
+      break;
307
+    case ZJerk:
308
+      #if HAS_CLASSIC_JERK
309
+        planner.max_jerk[Z_AXIS] = atof(key_value);
310
+      #endif
311
+      break;
312
+    case EJerk:
313
+      #if HAS_CLASSIC_JERK
314
+        planner.max_jerk[E_AXIS] = atof(key_value);
315
+      #endif
316
+      break;
317
+
318
+    case Xstep:
319
+      planner.settings.axis_steps_per_mm[X_AXIS] = atof(key_value);
320
+      break;
321
+    case Ystep:
322
+      planner.settings.axis_steps_per_mm[Y_AXIS] = atof(key_value);
323
+      break;
324
+    case Zstep:
325
+      planner.settings.axis_steps_per_mm[Z_AXIS] = atof(key_value);
326
+      break;
327
+    case E0step:
328
+      planner.settings.axis_steps_per_mm[E_AXIS] = atof(key_value);
329
+      break;
330
+    case E1step:
331
+      planner.settings.axis_steps_per_mm[E_AXIS_N(1)] = atof(key_value);
332
+      break;
333
+
334
+    case Xcurrent:
335
+      #if AXIS_IS_TMC(X)
336
+        current_mA = atoi(key_value);
337
+        stepperX.rms_current(current_mA);
338
+      #endif
339
+      break;
340
+
341
+    case Ycurrent:
342
+      #if AXIS_IS_TMC(Y)
343
+        current_mA = atoi(key_value);
344
+        stepperY.rms_current(current_mA);
345
+      #endif
346
+      break;
347
+
348
+    case Zcurrent:
349
+      #if AXIS_IS_TMC(Z)
350
+        current_mA = atoi(key_value);
351
+        stepperZ.rms_current(current_mA);
352
+      #endif
353
+      break;
354
+
355
+    case E0current:
356
+      #if AXIS_IS_TMC(E0)
357
+        current_mA = atoi(key_value);
358
+        stepperE0.rms_current(current_mA);
359
+      #endif
360
+      break;
361
+
362
+    case E1current:
363
+      #if AXIS_IS_TMC(E1)
364
+        current_mA = atoi(key_value);
365
+        stepperE1.rms_current(current_mA);
366
+      #endif
367
+      break;
368
+
369
+      break;
370
+    case pause_pos_x:
371
+      gCfgItems.pausePosX = atof(key_value);
372
+      update_spi_flash();
373
+      break;
374
+    case pause_pos_y:
375
+      gCfgItems.pausePosY = atof(key_value);
376
+      update_spi_flash();
377
+      break;
378
+    case pause_pos_z:
379
+      gCfgItems.pausePosZ = atof(key_value);
380
+      update_spi_flash();
381
+      break;
382
+  }
383
+  gcode.process_subcommands_now_P(PSTR("M500"));
384
+}
385
+
386
+static void event_handler(lv_obj_t * obj, lv_event_t event) {
387
+  switch (obj->mks_obj_id) {
388
+    case ID_NUM_KEY1:
389
+      if (event == LV_EVENT_CLICKED) {
390
+
391
+      }
392
+      else if (event == LV_EVENT_RELEASED) {
393
+        if (cnt <= 10) {
394
+          key_value[cnt] = (char)'1';
395
+          lv_label_set_text(labelValue, key_value);
396
+          lv_obj_align(labelValue, buttonValue, LV_ALIGN_CENTER, 0, 0);
397
+          cnt++;
398
+        }
399
+      }
400
+      break;
401
+    case ID_NUM_KEY2:
402
+      if (event == LV_EVENT_CLICKED) {
403
+
404
+      }
405
+      else if (event == LV_EVENT_RELEASED) {
406
+        if (cnt <= 10) {
407
+          key_value[cnt] = (char)'2';
408
+          lv_label_set_text(labelValue, key_value);
409
+          lv_obj_align(labelValue, buttonValue, LV_ALIGN_CENTER, 0, 0);
410
+          cnt++;
411
+        }
412
+      }
413
+      break;
414
+    case ID_NUM_KEY3:
415
+      if (event == LV_EVENT_CLICKED) {
416
+
417
+      }
418
+      else if (event == LV_EVENT_RELEASED) {
419
+        if (cnt <= 10) {
420
+          key_value[cnt] = (char)'3';
421
+          lv_label_set_text(labelValue, key_value);
422
+          lv_obj_align(labelValue, buttonValue, LV_ALIGN_CENTER, 0, 0);
423
+          cnt++;
424
+        }
425
+      }
426
+      break;
427
+    case ID_NUM_KEY4:
428
+      if (event == LV_EVENT_CLICKED) {
429
+
430
+      }
431
+      else if (event == LV_EVENT_RELEASED) {
432
+        if (cnt <= 10) {
433
+          key_value[cnt] = (char)'4';
434
+          lv_label_set_text(labelValue, key_value);
435
+          lv_obj_align(labelValue, buttonValue, LV_ALIGN_CENTER, 0, 0);
436
+          cnt++;
437
+        }
438
+      }
439
+      break;
440
+    case ID_NUM_KEY5:
441
+      if (event == LV_EVENT_CLICKED) {
442
+
443
+      }
444
+      else if (event == LV_EVENT_RELEASED) {
445
+        if (cnt <= 10) {
446
+          key_value[cnt] = (char)'5';
447
+          lv_label_set_text(labelValue, key_value);
448
+          lv_obj_align(labelValue, buttonValue, LV_ALIGN_CENTER, 0, 0);
449
+          cnt++;
450
+        }
451
+      }
452
+      break;
453
+    case ID_NUM_KEY6:
454
+      if (event == LV_EVENT_CLICKED) {
455
+
456
+      }
457
+      else if (event == LV_EVENT_RELEASED) {
458
+        if (cnt <= 10) {
459
+          key_value[cnt] = (char)'6';
460
+          lv_label_set_text(labelValue, key_value);
461
+          lv_obj_align(labelValue, buttonValue, LV_ALIGN_CENTER, 0, 0);
462
+          cnt++;
463
+        }
464
+      }
465
+      break;
466
+    case ID_NUM_KEY7:
467
+      if (event == LV_EVENT_CLICKED) {
468
+
469
+      }
470
+      else if (event == LV_EVENT_RELEASED) {
471
+        if (cnt <= 10) {
472
+          key_value[cnt] = (char)'7';
473
+          lv_label_set_text(labelValue, key_value);
474
+          lv_obj_align(labelValue, buttonValue, LV_ALIGN_CENTER, 0, 0);
475
+          cnt++;
476
+        }
477
+      }
478
+      break;
479
+    case ID_NUM_KEY8:
480
+      if (event == LV_EVENT_CLICKED) {
481
+
482
+      }
483
+      else if (event == LV_EVENT_RELEASED) {
484
+        if (cnt <= 10) {
485
+          key_value[cnt] = (char)'8';
486
+          lv_label_set_text(labelValue, key_value);
487
+          lv_obj_align(labelValue, buttonValue, LV_ALIGN_CENTER, 0, 0);
488
+          cnt++;
489
+        }
490
+      }
491
+      break;
492
+    case ID_NUM_KEY9:
493
+      if (event == LV_EVENT_CLICKED) {
494
+
495
+      }
496
+      else if (event == LV_EVENT_RELEASED) {
497
+        if (cnt <= 10) {
498
+          key_value[cnt] = (char)'9';
499
+          lv_label_set_text(labelValue, key_value);
500
+          lv_obj_align(labelValue, buttonValue, LV_ALIGN_CENTER, 0, 0);
501
+          cnt++;
502
+        }
503
+      }
504
+      break;
505
+    case ID_NUM_KEY0:
506
+      if (event == LV_EVENT_CLICKED) {
507
+
508
+      }
509
+      else if (event == LV_EVENT_RELEASED) {
510
+        if (cnt <= 10) {
511
+          key_value[cnt] = (char)'0';
512
+          lv_label_set_text(labelValue, key_value);
513
+          lv_obj_align(labelValue, buttonValue, LV_ALIGN_CENTER, 0, 0);
514
+          cnt++;
515
+        }
516
+      }
517
+      break;
518
+    case ID_NUM_BACK:
519
+      if (event == LV_EVENT_CLICKED) {
520
+
521
+      }
522
+      else if (event == LV_EVENT_RELEASED) {
523
+        if (cnt > 0)
524
+          cnt--;
525
+        if (key_value[cnt] == (char)'.') point_flg = 1;
526
+        key_value[cnt] = (char)'\0';
527
+        lv_label_set_text(labelValue, key_value);
528
+        lv_obj_align(labelValue, buttonValue, LV_ALIGN_CENTER, 0, 0);
529
+      }
530
+      break;
531
+    case ID_NUM_RESET:
532
+      if (event == LV_EVENT_CLICKED) {
533
+
534
+      }
535
+      else if (event == LV_EVENT_RELEASED) {
536
+        ZERO(key_value);
537
+        cnt            = 0;
538
+        key_value[cnt] = (char)'0';
539
+        point_flg      = 1;
540
+        lv_label_set_text(labelValue, key_value);
541
+        lv_obj_align(labelValue, buttonValue, LV_ALIGN_CENTER, 0, 0);
542
+      }
543
+      break;
544
+    case ID_NUM_POINT:
545
+      if (event == LV_EVENT_CLICKED) {
546
+
547
+      }
548
+      else if (event == LV_EVENT_RELEASED) {
549
+        if ((cnt != 0) && (point_flg == 1)) {
550
+          point_flg      = 0;
551
+          key_value[cnt] = (char)'.';
552
+          lv_label_set_text(labelValue, key_value);
553
+          lv_obj_align(labelValue, buttonValue, LV_ALIGN_CENTER, 0, 0);
554
+          cnt++;
555
+        }
556
+      }
557
+      break;
558
+    case ID_NUM_NAGETIVE:
559
+      if (event == LV_EVENT_CLICKED) {
560
+
561
+      }
562
+      else if (event == LV_EVENT_RELEASED) {
563
+        if (cnt == 0) {
564
+          key_value[cnt] = (char)'-';
565
+          lv_label_set_text(labelValue, key_value);
566
+          lv_obj_align(labelValue, buttonValue, LV_ALIGN_CENTER, 0, 0);
567
+          cnt++;
568
+        }
569
+      }
570
+      break;
571
+    case ID_NUM_CONFIRM:
572
+      if (event == LV_EVENT_CLICKED) {
573
+
574
+      }
575
+      else if (event == LV_EVENT_RELEASED) {
576
+        last_disp_state = NUMBER_KEY_UI;
577
+        if (strlen(key_value) != 0)
578
+          set_value_confirm();
579
+        lv_clear_number_key();
580
+        draw_return_ui();
581
+      }
582
+      break;
583
+  }
584
+}
585
+
586
+void lv_draw_number_key(void) {
587
+  lv_obj_t *NumberKey_1 = NULL, *NumberKey_2 = NULL, *NumberKey_3 = NULL, *NumberKey_4 = NULL, *NumberKey_5 = NULL;
588
+  lv_obj_t *NumberKey_6 = NULL, *NumberKey_7 = NULL, *NumberKey_8 = NULL, *NumberKey_9 = NULL, *NumberKey_0 = NULL;
589
+  lv_obj_t *KeyPoint = NULL, *KeyConfirm = NULL, *KeyReset = NULL, *KeyBack = NULL;
590
+  lv_obj_t *Minus = NULL;
591
+  lv_obj_t *labelKey_1 = NULL, *labelKey_2 = NULL, *labelKey_3 = NULL, *labelKey_4 = NULL, *labelKey_5 = NULL;
592
+  lv_obj_t *labelKey_6 = NULL, *labelKey_7 = NULL, *labelKey_8 = NULL, *labelKey_9 = NULL, *labelKey_0 = NULL;
593
+  lv_obj_t *labelKeyPoint = NULL, *labelKeyConfirm = NULL, *labelKeyReset = NULL, *labelKeyBack = NULL;
594
+  lv_obj_t *labelMinus = NULL;
595
+
596
+  buttonValue = NULL;
597
+  labelValue  = NULL;
598
+
599
+  if (disp_state_stack._disp_state[disp_state_stack._disp_index] != NUMBER_KEY_UI) {
600
+    disp_state_stack._disp_index++;
601
+    disp_state_stack._disp_state[disp_state_stack._disp_index] = NUMBER_KEY_UI;
602
+  }
603
+  disp_state = NUMBER_KEY_UI;
604
+
605
+  scr = lv_obj_create(NULL, NULL);
606
+
607
+  lv_obj_set_style(scr, &tft_style_scr);
608
+  lv_scr_load(scr);
609
+  lv_obj_clean(scr);
610
+
611
+  //lv_obj_t * title = lv_label_create(scr, NULL);
612
+  //lv_obj_set_style(title, &tft_style_label_rel);
613
+  //lv_obj_set_pos(title,TITLE_XPOS,TITLE_YPOS);
614
+  //lv_label_set_text(title, creat_title_text());
615
+
616
+  lv_refr_now(lv_refr_get_disp_refreshing());
617
+
618
+  //LV_IMG_DECLARE(bmp_pic);
619
+
620
+  buttonValue = lv_btn_create(scr, NULL);                               /*Add a button the current screen*/
621
+  lv_obj_set_pos(buttonValue, 92, 40);                                  /*Set its position*/
622
+  lv_obj_set_size(buttonValue, 296, 40);
623
+  lv_obj_set_event_cb_mks(buttonValue, event_handler, ID_NUM_KEY1, NULL, 0);
624
+  lv_btn_set_style(buttonValue, LV_BTN_STYLE_REL, &style_num_text);     /*Set the button's released style*/
625
+  lv_btn_set_style(buttonValue, LV_BTN_STYLE_PR, &style_num_text);      /*Set the button's pressed style*/
626
+  lv_btn_set_layout(buttonValue, LV_LAYOUT_OFF);
627
+  labelValue = lv_label_create(buttonValue, NULL);                      /*Add a label to the button*/
628
+
629
+  NumberKey_1 = lv_btn_create(scr, NULL);                               /*Add a button the current screen*/
630
+  lv_obj_set_pos(NumberKey_1, 92, 90);                                  /*Set its position*/
631
+  lv_obj_set_size(NumberKey_1, 68, 40);
632
+  lv_obj_set_event_cb_mks(NumberKey_1, event_handler, ID_NUM_KEY1, NULL, 0);
633
+  lv_btn_set_style(NumberKey_1, LV_BTN_STYLE_REL, &style_num_key_pre);  /*Set the button's released style*/
634
+  lv_btn_set_style(NumberKey_1, LV_BTN_STYLE_PR, &style_num_key_rel);   /*Set the button's pressed style*/
635
+  lv_btn_set_layout(NumberKey_1, LV_LAYOUT_OFF);
636
+  labelKey_1 = lv_label_create(NumberKey_1, NULL);                      /*Add a label to the button*/
637
+  lv_label_set_text(labelKey_1, machine_menu.key_1);
638
+  lv_obj_align(labelKey_1, NumberKey_1, LV_ALIGN_CENTER, 0, 0);
639
+
640
+  NumberKey_2 = lv_btn_create(scr, NULL);                               /*Add a button the current screen*/
641
+  lv_obj_set_pos(NumberKey_2, 168, 90);                                 /*Set its position*/
642
+  lv_obj_set_size(NumberKey_2, 68, 40);
643
+  lv_obj_set_event_cb_mks(NumberKey_2, event_handler, ID_NUM_KEY2, NULL, 0);
644
+  lv_btn_set_style(NumberKey_2, LV_BTN_STYLE_REL, &style_num_key_pre);  /*Set the button's released style*/
645
+  lv_btn_set_style(NumberKey_2, LV_BTN_STYLE_PR, &style_num_key_rel);   /*Set the button's pressed style*/
646
+  lv_btn_set_layout(NumberKey_2, LV_LAYOUT_OFF);
647
+  labelKey_2 = lv_label_create(NumberKey_2, NULL);                      /*Add a label to the button*/
648
+  lv_label_set_text(labelKey_2, machine_menu.key_2);
649
+  lv_obj_align(labelKey_2, NumberKey_2, LV_ALIGN_CENTER, 0, 0);
650
+
651
+  NumberKey_3 = lv_btn_create(scr, NULL);                               /*Add a button the current screen*/
652
+  lv_obj_set_pos(NumberKey_3, 244, 90);                                 /*Set its position*/
653
+  lv_obj_set_size(NumberKey_3, 68, 40);
654
+  lv_obj_set_event_cb_mks(NumberKey_3, event_handler, ID_NUM_KEY3, NULL, 0);
655
+  lv_btn_set_style(NumberKey_3, LV_BTN_STYLE_REL, &style_num_key_pre);  /*Set the button's released style*/
656
+  lv_btn_set_style(NumberKey_3, LV_BTN_STYLE_PR, &style_num_key_rel);   /*Set the button's pressed style*/
657
+  lv_btn_set_layout(NumberKey_3, LV_LAYOUT_OFF);
658
+  labelKey_3 = lv_label_create(NumberKey_3, NULL);                      /*Add a label to the button*/
659
+  lv_label_set_text(labelKey_3, machine_menu.key_3);
660
+  lv_obj_align(labelKey_3, NumberKey_3, LV_ALIGN_CENTER, 0, 0);
661
+
662
+  NumberKey_4 = lv_btn_create(scr, NULL);                               /*Add a button the current screen*/
663
+  lv_obj_set_pos(NumberKey_4, 92, 140);                                 /*Set its position*/
664
+  lv_obj_set_size(NumberKey_4, 68, 40);
665
+  lv_obj_set_event_cb_mks(NumberKey_4, event_handler, ID_NUM_KEY4, NULL, 0);
666
+  lv_btn_set_style(NumberKey_4, LV_BTN_STYLE_REL, &style_num_key_pre);  /*Set the button's released style*/
667
+  lv_btn_set_style(NumberKey_4, LV_BTN_STYLE_PR, &style_num_key_rel);   /*Set the button's pressed style*/
668
+  lv_btn_set_layout(NumberKey_4, LV_LAYOUT_OFF);
669
+  labelKey_4 = lv_label_create(NumberKey_4, NULL);                      /*Add a label to the button*/
670
+  lv_label_set_text(labelKey_4, machine_menu.key_4);
671
+  lv_obj_align(labelKey_4, NumberKey_4, LV_ALIGN_CENTER, 0, 0);
672
+
673
+  NumberKey_5 = lv_btn_create(scr, NULL);                               /*Add a button the current screen*/
674
+  lv_obj_set_pos(NumberKey_5, 168, 140);                                /*Set its position*/
675
+  lv_obj_set_size(NumberKey_5, 68, 40);
676
+  lv_obj_set_event_cb_mks(NumberKey_5, event_handler, ID_NUM_KEY5, NULL, 0);
677
+  lv_btn_set_style(NumberKey_5, LV_BTN_STYLE_REL, &style_num_key_pre);  /*Set the button's released style*/
678
+  lv_btn_set_style(NumberKey_5, LV_BTN_STYLE_PR, &style_num_key_rel);   /*Set the button's pressed style*/
679
+  lv_btn_set_layout(NumberKey_5, LV_LAYOUT_OFF);
680
+  labelKey_5 = lv_label_create(NumberKey_5, NULL);                      /*Add a label to the button*/
681
+  lv_label_set_text(labelKey_5, machine_menu.key_5);
682
+  lv_obj_align(labelKey_5, NumberKey_5, LV_ALIGN_CENTER, 0, 0);
683
+
684
+  NumberKey_6 = lv_btn_create(scr, NULL);                               /*Add a button the current screen*/
685
+  lv_obj_set_pos(NumberKey_6, 244, 140);                                /*Set its position*/
686
+  lv_obj_set_size(NumberKey_6, 68, 40);
687
+  lv_obj_set_event_cb_mks(NumberKey_6, event_handler, ID_NUM_KEY6, NULL, 0);
688
+  lv_btn_set_style(NumberKey_6, LV_BTN_STYLE_REL, &style_num_key_pre);  /*Set the button's released style*/
689
+  lv_btn_set_style(NumberKey_6, LV_BTN_STYLE_PR, &style_num_key_rel);   /*Set the button's pressed style*/
690
+  lv_btn_set_layout(NumberKey_6, LV_LAYOUT_OFF);
691
+  labelKey_6 = lv_label_create(NumberKey_6, NULL);                      /*Add a label to the button*/
692
+  lv_label_set_text(labelKey_6, machine_menu.key_6);
693
+  lv_obj_align(labelKey_6, NumberKey_6, LV_ALIGN_CENTER, 0, 0);
694
+
695
+  NumberKey_7 = lv_btn_create(scr, NULL);                               /*Add a button the current screen*/
696
+  lv_obj_set_pos(NumberKey_7, 92, 190);                                 /*Set its position*/
697
+  lv_obj_set_size(NumberKey_7, 68, 40);
698
+  lv_obj_set_event_cb_mks(NumberKey_7, event_handler, ID_NUM_KEY7, NULL, 0);
699
+  lv_btn_set_style(NumberKey_7, LV_BTN_STYLE_REL, &style_num_key_pre);  /*Set the button's released style*/
700
+  lv_btn_set_style(NumberKey_7, LV_BTN_STYLE_PR, &style_num_key_rel);   /*Set the button's pressed style*/
701
+  lv_btn_set_layout(NumberKey_7, LV_LAYOUT_OFF);
702
+  labelKey_7 = lv_label_create(NumberKey_7, NULL);                      /*Add a label to the button*/
703
+  lv_label_set_text(labelKey_7, machine_menu.key_7);
704
+  lv_obj_align(labelKey_7, NumberKey_7, LV_ALIGN_CENTER, 0, 0);
705
+
706
+  NumberKey_8 = lv_btn_create(scr, NULL);                               /*Add a button the current screen*/
707
+  lv_obj_set_pos(NumberKey_8, 168, 190);                                /*Set its position*/
708
+  lv_obj_set_size(NumberKey_8, 68, 40);
709
+  lv_obj_set_event_cb_mks(NumberKey_8, event_handler, ID_NUM_KEY8, NULL, 0);
710
+  lv_btn_set_style(NumberKey_8, LV_BTN_STYLE_REL, &style_num_key_pre);  /*Set the button's released style*/
711
+  lv_btn_set_style(NumberKey_8, LV_BTN_STYLE_PR, &style_num_key_rel);   /*Set the button's pressed style*/
712
+  lv_btn_set_layout(NumberKey_8, LV_LAYOUT_OFF);
713
+  labelKey_8 = lv_label_create(NumberKey_8, NULL);                      /*Add a label to the button*/
714
+  lv_label_set_text(labelKey_8, machine_menu.key_8);
715
+  lv_obj_align(labelKey_8, NumberKey_8, LV_ALIGN_CENTER, 0, 0);
716
+
717
+  NumberKey_9 = lv_btn_create(scr, NULL);                               /*Add a button the current screen*/
718
+  lv_obj_set_pos(NumberKey_9, 244, 190);                                /*Set its position*/
719
+  lv_obj_set_size(NumberKey_9, 68, 40);
720
+  lv_obj_set_event_cb_mks(NumberKey_9, event_handler, ID_NUM_KEY9, NULL, 0);
721
+  lv_btn_set_style(NumberKey_9, LV_BTN_STYLE_REL, &style_num_key_pre);  /*Set the button's released style*/
722
+  lv_btn_set_style(NumberKey_9, LV_BTN_STYLE_PR, &style_num_key_rel);   /*Set the button's pressed style*/
723
+  lv_btn_set_layout(NumberKey_9, LV_LAYOUT_OFF);
724
+  labelKey_9 = lv_label_create(NumberKey_9, NULL);                      /*Add a label to the button*/
725
+  lv_label_set_text(labelKey_9, machine_menu.key_9);
726
+  lv_obj_align(labelKey_9, NumberKey_9, LV_ALIGN_CENTER, 0, 0);
727
+
728
+  NumberKey_0 = lv_btn_create(scr, NULL);                               /*Add a button the current screen*/
729
+  lv_obj_set_pos(NumberKey_0, 92, 240);                                 /*Set its position*/
730
+  lv_obj_set_size(NumberKey_0, 68, 40);
731
+  lv_obj_set_event_cb_mks(NumberKey_0, event_handler, ID_NUM_KEY0, NULL, 0);
732
+  lv_btn_set_style(NumberKey_0, LV_BTN_STYLE_REL, &style_num_key_pre);  /*Set the button's released style*/
733
+  lv_btn_set_style(NumberKey_0, LV_BTN_STYLE_PR, &style_num_key_rel);   /*Set the button's pressed style*/
734
+  lv_btn_set_layout(NumberKey_0, LV_LAYOUT_OFF);
735
+  labelKey_0 = lv_label_create(NumberKey_0, NULL);                      /*Add a label to the button*/
736
+  lv_label_set_text(labelKey_0, machine_menu.key_0);
737
+  lv_obj_align(labelKey_0, NumberKey_0, LV_ALIGN_CENTER, 0, 0);
738
+
739
+  KeyBack = lv_btn_create(scr, NULL);                                   /*Add a button the current screen*/
740
+  lv_obj_set_pos(KeyBack, 320, 90);                                     /*Set its position*/
741
+  lv_obj_set_size(KeyBack, 68, 40);
742
+  lv_obj_set_event_cb_mks(KeyBack, event_handler, ID_NUM_BACK, NULL, 0);
743
+  lv_btn_set_style(KeyBack, LV_BTN_STYLE_REL, &style_num_key_pre);      /*Set the button's released style*/
744
+  lv_btn_set_style(KeyBack, LV_BTN_STYLE_PR, &style_num_key_rel);       /*Set the button's pressed style*/
745
+  lv_btn_set_layout(KeyBack, LV_LAYOUT_OFF);
746
+  labelKeyBack = lv_label_create(KeyBack, NULL);                        /*Add a label to the button*/
747
+  lv_label_set_text(labelKeyBack, machine_menu.key_back);
748
+  lv_obj_align(labelKeyBack, KeyBack, LV_ALIGN_CENTER, 0, 0);
749
+
750
+  KeyReset = lv_btn_create(scr, NULL);                                  /*Add a button the current screen*/
751
+  lv_obj_set_pos(KeyReset, 320, 140);                                   /*Set its position*/
752
+  lv_obj_set_size(KeyReset, 68, 40);
753
+  lv_obj_set_event_cb_mks(KeyReset, event_handler, ID_NUM_RESET, NULL, 0);
754
+  lv_btn_set_style(KeyReset, LV_BTN_STYLE_REL, &style_num_key_pre);     /*Set the button's released style*/
755
+  lv_btn_set_style(KeyReset, LV_BTN_STYLE_PR, &style_num_key_rel);      /*Set the button's pressed style*/
756
+  lv_btn_set_layout(KeyReset, LV_LAYOUT_OFF);
757
+  labelKeyReset = lv_label_create(KeyReset, NULL);                      /*Add a label to the button*/
758
+  lv_label_set_text(labelKeyReset, machine_menu.key_reset);
759
+  lv_obj_align(labelKeyReset, KeyReset, LV_ALIGN_CENTER, 0, 0);
760
+
761
+  KeyConfirm = lv_btn_create(scr, NULL);                                /*Add a button the current screen*/
762
+  lv_obj_set_pos(KeyConfirm, 320, 190);                                 /*Set its position*/
763
+  lv_obj_set_size(KeyConfirm, 68, 90);
764
+  lv_obj_set_event_cb_mks(KeyConfirm, event_handler, ID_NUM_CONFIRM, NULL, 0);
765
+  lv_btn_set_style(KeyConfirm, LV_BTN_STYLE_REL, &style_num_key_pre);   /*Set the button's released style*/
766
+  lv_btn_set_style(KeyConfirm, LV_BTN_STYLE_PR, &style_num_key_rel);    /*Set the button's pressed style*/
767
+  lv_btn_set_layout(KeyConfirm, LV_LAYOUT_OFF);
768
+  labelKeyConfirm = lv_label_create(KeyConfirm, NULL);                  /*Add a label to the button*/
769
+  lv_label_set_text(labelKeyConfirm, machine_menu.key_confirm);
770
+  lv_obj_align(labelKeyConfirm, KeyConfirm, LV_ALIGN_CENTER, 0, 0);
771
+
772
+  KeyPoint = lv_btn_create(scr, NULL);                                  /*Add a button the current screen*/
773
+  lv_obj_set_pos(KeyPoint, 244, 240);                                   /*Set its position*/
774
+  lv_obj_set_size(KeyPoint, 68, 40);
775
+  lv_obj_set_event_cb_mks(KeyPoint, event_handler, ID_NUM_POINT, NULL, 0);
776
+  lv_btn_set_style(KeyPoint, LV_BTN_STYLE_REL, &style_num_key_pre);     /*Set the button's released style*/
777
+  lv_btn_set_style(KeyPoint, LV_BTN_STYLE_PR, &style_num_key_rel);      /*Set the button's pressed style*/
778
+  lv_btn_set_layout(KeyPoint, LV_LAYOUT_OFF);
779
+  labelKeyPoint = lv_label_create(KeyPoint, NULL);                      /*Add a label to the button*/
780
+  lv_label_set_text(labelKeyPoint, machine_menu.key_point);
781
+  lv_obj_align(labelKeyPoint, KeyPoint, LV_ALIGN_CENTER, 0, 0);
782
+
783
+  Minus = lv_btn_create(scr, NULL);                                     /*Add a button the current screen*/
784
+  lv_obj_set_pos(Minus, 168, 240);                                      /*Set its position*/
785
+  lv_obj_set_size(Minus, 68, 40);
786
+  lv_obj_set_event_cb_mks(Minus, event_handler, ID_NUM_NAGETIVE, NULL, 0);
787
+  lv_btn_set_style(Minus, LV_BTN_STYLE_REL, &style_num_key_pre);        /*Set the button's released style*/
788
+  lv_btn_set_style(Minus, LV_BTN_STYLE_PR, &style_num_key_rel);         /*Set the button's pressed style*/
789
+  lv_btn_set_layout(Minus, LV_LAYOUT_OFF);
790
+  labelMinus = lv_label_create(Minus, NULL);                            /*Add a label to the button*/
791
+  lv_label_set_text(labelMinus, machine_menu.negative);
792
+  lv_obj_align(labelMinus, Minus, LV_ALIGN_CENTER, 0, 0);
793
+
794
+  disp_key_value();
795
+}
796
+
797
+void lv_clear_number_key() { lv_obj_del(scr); }
798
+
799
+#endif // HAS_TFT_LVGL_UI

+ 33
- 0
Marlin/src/lcd/extui/lib/mks_ui/draw_number_key.h View File

@@ -0,0 +1,33 @@
1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
+ *
5
+ * Based on Sprinter and grbl.
6
+ * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
7
+ *
8
+ * This program is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+#pragma once
23
+
24
+#ifdef __cplusplus
25
+extern "C" { /* C-declarations for C++ */
26
+#endif
27
+
28
+extern void lv_draw_number_key(void);
29
+extern void lv_clear_number_key();
30
+
31
+#ifdef __cplusplus
32
+} /* C-declarations for C++ */
33
+#endif

Marlin/src/lcd/extui/lib/mks_ui/draw_opration.cpp → Marlin/src/lcd/extui/lib/mks_ui/draw_operation.cpp View File

@@ -21,7 +21,7 @@
21 21
  */
22 22
 #include "../../../../inc/MarlinConfigPre.h"
23 23
 
24
-#if ENABLED(TFT_LVGL_UI)
24
+#if HAS_TFT_LVGL_UI
25 25
 
26 26
 #include "lv_conf.h"
27 27
 #include "draw_ui.h"
@@ -53,7 +53,7 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
53 53
         // nothing to do
54 54
       }
55 55
       else if (event == LV_EVENT_RELEASED) {
56
-        lv_clear_opration();
56
+        lv_clear_operation();
57 57
         lv_draw_preHeat();
58 58
       }
59 59
       break;
@@ -62,7 +62,7 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
62 62
         // nothing to do
63 63
       }
64 64
       else if (event == LV_EVENT_RELEASED) {
65
-        lv_clear_opration();
65
+        lv_clear_operation();
66 66
         lv_draw_extrusion();
67 67
       }
68 68
       break;
@@ -71,7 +71,7 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
71 71
         // nothing to do
72 72
       }
73 73
       else if (event == LV_EVENT_RELEASED) {
74
-        lv_clear_opration();
74
+        lv_clear_operation();
75 75
         lv_draw_move_motor();
76 76
       }
77 77
       break;
@@ -87,7 +87,7 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
87 87
         // nothing to do
88 88
       }
89 89
       else if (event == LV_EVENT_RELEASED) {
90
-        lv_clear_opration();
90
+        lv_clear_operation();
91 91
         lv_draw_fan();
92 92
       }
93 93
       break;
@@ -96,7 +96,7 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
96 96
         // nothing to do
97 97
       }
98 98
       else if (event == LV_EVENT_RELEASED) {
99
-        lv_clear_opration();
99
+        lv_clear_operation();
100 100
         lv_draw_change_speed();
101 101
       }
102 102
       break;
@@ -116,7 +116,7 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
116 116
       else if (event == LV_EVENT_RELEASED) {
117 117
         if (gCfgItems.finish_power_off == 1) {
118 118
           gCfgItems.finish_power_off = 0;
119
-          lv_obj_set_event_cb_mks(obj, event_handler, ID_O_POWER_OFF, "bmp_manual_off.bin", 0); //dindt find bmp_Mamual...
119
+          lv_obj_set_event_cb_mks(obj, event_handler, ID_O_POWER_OFF, "bmp_manual_off.bin", 0); // didn't find bmp_Mamual...
120 120
           lv_label_set_text(label_PowerOff, printing_more_menu.manual);
121 121
           lv_obj_align(label_PowerOff, buttonPowerOff, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
122 122
           lv_obj_refresh_ext_draw_pad(label_PowerOff);
@@ -136,7 +136,7 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
136 136
   }
137 137
 }
138 138
 
139
-void lv_draw_opration(void) {
139
+void lv_draw_operation(void) {
140 140
   lv_obj_t *buttonPreHeat, *buttonExtrusion, *buttonSpeed;
141 141
   lv_obj_t *buttonBack, *buttonFan;
142 142
   lv_obj_t *labelPreHeat, *labelExtrusion;
@@ -156,7 +156,7 @@ void lv_draw_opration(void) {
156 156
   lv_obj_clean(scr);
157 157
 
158 158
   lv_obj_t * title = lv_label_create(scr, NULL);
159
-  lv_obj_set_style(title, &tft_style_lable_rel);
159
+  lv_obj_set_style(title, &tft_style_label_rel);
160 160
   lv_obj_set_pos(title, TITLE_XPOS, TITLE_YPOS);
161 161
   lv_label_set_text(title, creat_title_text());
162 162
 
@@ -165,57 +165,59 @@ void lv_draw_opration(void) {
165 165
   LV_IMG_DECLARE(bmp_pic);
166 166
 
167 167
   /*Create an Image button*/
168
-  buttonPreHeat = lv_imgbtn_create(scr, NULL);
168
+  buttonPreHeat   = lv_imgbtn_create(scr, NULL);
169 169
   buttonExtrusion = lv_imgbtn_create(scr, NULL);
170
-  buttonFan = lv_imgbtn_create(scr, NULL);
171
-  buttonSpeed = lv_imgbtn_create(scr, NULL);
170
+  buttonFan       = lv_imgbtn_create(scr, NULL);
171
+  buttonSpeed     = lv_imgbtn_create(scr, NULL);
172 172
 
173
-  if (uiCfg.print_state != WORKING)
173
+  if (uiCfg.print_state != WORKING) {
174 174
     //buttonFilament = lv_imgbtn_create(scr, NULL);
175
-    //else
175
+    //} else {
176 176
     buttonMove = lv_imgbtn_create(scr, NULL);
177
+  }
178
+
177 179
   buttonPowerOff = lv_imgbtn_create(scr, NULL);
178
-  buttonBack = lv_imgbtn_create(scr, NULL);
180
+  buttonBack     = lv_imgbtn_create(scr, NULL);
179 181
 
180
-  lv_obj_set_event_cb_mks(buttonPreHeat, event_handler, ID_O_PRE_HEAT, "bmp_PreHeat.bin", 0);
182
+  lv_obj_set_event_cb_mks(buttonPreHeat, event_handler, ID_O_PRE_HEAT, "bmp_temp.bin", 0);
181 183
   lv_imgbtn_set_src(buttonPreHeat, LV_BTN_STATE_REL, &bmp_pic);
182 184
   lv_imgbtn_set_src(buttonPreHeat, LV_BTN_STATE_PR, &bmp_pic);
183
-  lv_imgbtn_set_style(buttonPreHeat, LV_BTN_STATE_PR, &tft_style_lable_pre);
184
-  lv_imgbtn_set_style(buttonPreHeat, LV_BTN_STATE_REL, &tft_style_lable_rel);
185
+  lv_imgbtn_set_style(buttonPreHeat, LV_BTN_STATE_PR, &tft_style_label_pre);
186
+  lv_imgbtn_set_style(buttonPreHeat, LV_BTN_STATE_REL, &tft_style_label_rel);
185 187
   lv_obj_clear_protect(buttonPreHeat, LV_PROTECT_FOLLOW);
186 188
   #if 1
187
-    lv_obj_set_event_cb_mks(buttonExtrusion, event_handler, ID_O_EXTRUCT, "bmp_Extruct.bin", 0);
189
+    lv_obj_set_event_cb_mks(buttonExtrusion, event_handler, ID_O_EXTRUCT, "bmp_extrude_opr.bin", 0);
188 190
     lv_imgbtn_set_src(buttonExtrusion, LV_BTN_STATE_REL, &bmp_pic);
189 191
     lv_imgbtn_set_src(buttonExtrusion, LV_BTN_STATE_PR, &bmp_pic);
190
-    lv_imgbtn_set_style(buttonExtrusion, LV_BTN_STATE_PR, &tft_style_lable_pre);
191
-    lv_imgbtn_set_style(buttonExtrusion, LV_BTN_STATE_REL, &tft_style_lable_rel);
192
+    lv_imgbtn_set_style(buttonExtrusion, LV_BTN_STATE_PR, &tft_style_label_pre);
193
+    lv_imgbtn_set_style(buttonExtrusion, LV_BTN_STATE_REL, &tft_style_label_rel);
192 194
 
193
-    lv_obj_set_event_cb_mks(buttonFan, event_handler, ID_O_FAN, "bmp_Fan.bin", 0);
195
+    lv_obj_set_event_cb_mks(buttonFan, event_handler, ID_O_FAN, "bmp_fan.bin", 0);
194 196
     lv_imgbtn_set_src(buttonFan, LV_BTN_STATE_REL, &bmp_pic);
195 197
     lv_imgbtn_set_src(buttonFan, LV_BTN_STATE_PR, &bmp_pic);
196
-    lv_imgbtn_set_style(buttonFan, LV_BTN_STATE_PR, &tft_style_lable_pre);
197
-    lv_imgbtn_set_style(buttonFan, LV_BTN_STATE_REL, &tft_style_lable_rel);
198
+    lv_imgbtn_set_style(buttonFan, LV_BTN_STATE_PR, &tft_style_label_pre);
199
+    lv_imgbtn_set_style(buttonFan, LV_BTN_STATE_REL, &tft_style_label_rel);
198 200
 
199
-    lv_obj_set_event_cb_mks(buttonSpeed, event_handler, ID_O_SPEED, "bmp_Speed.bin", 0);
201
+    lv_obj_set_event_cb_mks(buttonSpeed, event_handler, ID_O_SPEED, "bmp_speed.bin", 0);
200 202
     lv_imgbtn_set_src(buttonSpeed, LV_BTN_STATE_REL, &bmp_pic);
201 203
     lv_imgbtn_set_src(buttonSpeed, LV_BTN_STATE_PR, &bmp_pic);
202
-    lv_imgbtn_set_style(buttonSpeed, LV_BTN_STATE_PR, &tft_style_lable_pre);
203
-    lv_imgbtn_set_style(buttonSpeed, LV_BTN_STATE_REL, &tft_style_lable_rel);
204
+    lv_imgbtn_set_style(buttonSpeed, LV_BTN_STATE_PR, &tft_style_label_pre);
205
+    lv_imgbtn_set_style(buttonSpeed, LV_BTN_STATE_REL, &tft_style_label_rel);
204 206
 
205 207
     if (uiCfg.print_state != WORKING) {
206
-      /*{
207
-          lv_obj_set_event_cb_mks(buttonFilament, event_handler,ID_O_FILAMENT,"bmp_Filamentchange.bin",0);
208
-          lv_imgbtn_set_src(buttonFilament, LV_BTN_STATE_REL, &bmp_pic);
209
-          lv_imgbtn_set_src(buttonFilament, LV_BTN_STATE_PR, &bmp_pic);
210
-          lv_imgbtn_set_style(buttonFilament, LV_BTN_STATE_PR, &tft_style_lable_pre);
211
-          lv_imgbtn_set_style(buttonFilament, LV_BTN_STATE_REL, &tft_style_lable_rel);
212
-      }
213
-      else*/
214
-      lv_obj_set_event_cb_mks(buttonMove, event_handler, ID_O_MOV, "bmp_Mov.bin", 0);
208
+      /*
209
+        lv_obj_set_event_cb_mks(buttonFilament, event_handler,ID_O_FILAMENT,"bmp_Filamentchange.bin",0);
210
+        lv_imgbtn_set_src(buttonFilament, LV_BTN_STATE_REL, &bmp_pic);
211
+        lv_imgbtn_set_src(buttonFilament, LV_BTN_STATE_PR, &bmp_pic);
212
+        lv_imgbtn_set_style(buttonFilament, LV_BTN_STATE_PR, &tft_style_label_pre);
213
+        lv_imgbtn_set_style(buttonFilament, LV_BTN_STATE_REL, &tft_style_label_rel);
214
+      } else {
215
+      */
216
+      lv_obj_set_event_cb_mks(buttonMove, event_handler, ID_O_MOV, "bmp_move_opr.bin", 0);
215 217
       lv_imgbtn_set_src(buttonMove, LV_BTN_STATE_REL, &bmp_pic);
216 218
       lv_imgbtn_set_src(buttonMove, LV_BTN_STATE_PR, &bmp_pic);
217
-      lv_imgbtn_set_style(buttonMove, LV_BTN_STATE_PR, &tft_style_lable_pre);
218
-      lv_imgbtn_set_style(buttonMove, LV_BTN_STATE_REL, &tft_style_lable_rel);
219
+      lv_imgbtn_set_style(buttonMove, LV_BTN_STATE_PR, &tft_style_label_pre);
220
+      lv_imgbtn_set_style(buttonMove, LV_BTN_STATE_REL, &tft_style_label_rel);
219 221
     }
220 222
     if (gCfgItems.finish_power_off == 1)
221 223
       lv_obj_set_event_cb_mks(buttonPowerOff, event_handler, ID_O_POWER_OFF, "bmp_auto_off.bin", 0);
@@ -223,15 +225,15 @@ void lv_draw_opration(void) {
223 225
       lv_obj_set_event_cb_mks(buttonPowerOff, event_handler, ID_O_POWER_OFF, "bmp_manual_off.bin", 0);
224 226
     lv_imgbtn_set_src(buttonPowerOff, LV_BTN_STATE_REL, &bmp_pic);
225 227
     lv_imgbtn_set_src(buttonPowerOff, LV_BTN_STATE_PR, &bmp_pic);
226
-    lv_imgbtn_set_style(buttonPowerOff, LV_BTN_STATE_PR, &tft_style_lable_pre);
227
-    lv_imgbtn_set_style(buttonPowerOff, LV_BTN_STATE_REL, &tft_style_lable_rel);
228
+    lv_imgbtn_set_style(buttonPowerOff, LV_BTN_STATE_PR, &tft_style_label_pre);
229
+    lv_imgbtn_set_style(buttonPowerOff, LV_BTN_STATE_REL, &tft_style_label_rel);
228 230
 
229
-    lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_O_RETURN, "bmp_Return.bin", 0);
231
+    lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_O_RETURN, "bmp_return.bin", 0);
230 232
     lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_REL, &bmp_pic);
231 233
     lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_PR, &bmp_pic);
232
-    lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_PR, &tft_style_lable_pre);
233
-    lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_REL, &tft_style_lable_rel);
234
-  #endif
234
+    lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_PR, &tft_style_label_pre);
235
+    lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_REL, &tft_style_label_rel);
236
+  #endif // if 1
235 237
 
236 238
   lv_obj_set_pos(buttonPreHeat, INTERVAL_V, titleHeight);
237 239
   lv_obj_set_pos(buttonExtrusion, BTN_X_PIXEL + INTERVAL_V * 2, titleHeight);
@@ -240,17 +242,17 @@ void lv_draw_opration(void) {
240 242
   lv_obj_set_pos(buttonSpeed, BTN_X_PIXEL * 3 + INTERVAL_V * 4, titleHeight);
241 243
 
242 244
   if (uiCfg.print_state != WORKING) {
243
-    /*{
244
-            lv_obj_set_pos(buttonFilament,INTERVAL_V,BTN_Y_PIXEL+INTERVAL_H+titleHeight);
245
-    }
246
-    else*/
245
+    /*
246
+      lv_obj_set_pos(buttonFilament,INTERVAL_V,BTN_Y_PIXEL+INTERVAL_H+titleHeight);
247
+    } else {
248
+    */
247 249
     lv_obj_set_pos(buttonMove, INTERVAL_V, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
248 250
     lv_obj_set_pos(buttonPowerOff, BTN_X_PIXEL + INTERVAL_V * 2, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
249 251
   }
250 252
   else {
251 253
     lv_obj_set_pos(buttonPowerOff, INTERVAL_V, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
252 254
   }
253
-  lv_obj_set_pos(buttonBack, BTN_X_PIXEL * 3 + INTERVAL_V * 4,  BTN_Y_PIXEL + INTERVAL_H + titleHeight);
255
+  lv_obj_set_pos(buttonBack, BTN_X_PIXEL * 3 + INTERVAL_V * 4, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
254 256
 
255 257
   /*Create a label on the Image button*/
256 258
   lv_btn_set_layout(buttonPreHeat, LV_LAYOUT_OFF);
@@ -258,27 +260,29 @@ void lv_draw_opration(void) {
258 260
   lv_btn_set_layout(buttonFan, LV_LAYOUT_OFF);
259 261
   lv_btn_set_layout(buttonSpeed, LV_LAYOUT_OFF);
260 262
 
261
-  if (uiCfg.print_state != WORKING)
262
-  /*{
263
-          lv_btn_set_layout(buttonFilament, LV_LAYOUT_OFF);
264
-  }
265
-  else*/
263
+  if (uiCfg.print_state != WORKING) {
264
+    /*
265
+      lv_btn_set_layout(buttonFilament, LV_LAYOUT_OFF);
266
+    } else {
267
+    */
266 268
     lv_btn_set_layout(buttonMove, LV_LAYOUT_OFF);
269
+  }
267 270
   lv_btn_set_layout(buttonPowerOff, LV_LAYOUT_OFF);
268 271
   lv_btn_set_layout(buttonBack, LV_LAYOUT_OFF);
269 272
 
270
-  labelPreHeat = lv_label_create(buttonPreHeat, NULL);
273
+  labelPreHeat   = lv_label_create(buttonPreHeat, NULL);
271 274
   labelExtrusion = lv_label_create(buttonExtrusion, NULL);
272 275
 
273
-  label_Fan = lv_label_create(buttonFan, NULL);
276
+  label_Fan   = lv_label_create(buttonFan, NULL);
274 277
   label_Speed = lv_label_create(buttonSpeed, NULL);
275 278
 
276
-  if (uiCfg.print_state != WORKING)
277
-  /*{
278
-          label_Filament = lv_label_create(buttonFilament, NULL);
279
+  if (uiCfg.print_state != WORKING) {
280
+    /*
281
+      label_Filament = lv_label_create(buttonFilament, NULL);
282
+    } else {
283
+    */
284
+      label_Move = lv_label_create(buttonMove, NULL);
279 285
   }
280
-  else*/
281
-    label_Move = lv_label_create(buttonMove, NULL);
282 286
   label_PowerOff = lv_label_create(buttonPowerOff, NULL);
283 287
 
284 288
   label_Back = lv_label_create(buttonBack, NULL);
@@ -297,11 +301,11 @@ void lv_draw_opration(void) {
297 301
     lv_obj_align(label_Speed, buttonSpeed, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
298 302
 
299 303
     if (uiCfg.print_state != WORKING) {
300
-      /*{
301
-          lv_label_set_text(label_Filament, operation_menu.filament);
302
-          lv_obj_align(label_Filament, buttonFilament, LV_ALIGN_IN_BOTTOM_MID,0, BUTTON_TEXT_Y_OFFSET);
303
-      }
304
-      else*/
304
+      /*
305
+        lv_label_set_text(label_Filament, operation_menu.filament);
306
+        lv_obj_align(label_Filament, buttonFilament, LV_ALIGN_IN_BOTTOM_MID,0, BUTTON_TEXT_Y_OFFSET);
307
+      } else {
308
+      */
305 309
       lv_label_set_text(label_Move, operation_menu.move);
306 310
       lv_obj_align(label_Move, buttonMove, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
307 311
     }
@@ -317,6 +321,6 @@ void lv_draw_opration(void) {
317 321
   }
318 322
 }
319 323
 
320
-void lv_clear_opration() { lv_obj_del(scr); }
324
+void lv_clear_operation() { lv_obj_del(scr); }
321 325
 
322
-#endif // TFT_LVGL_UI
326
+#endif // HAS_TFT_LVGL_UI

Marlin/src/lcd/extui/lib/mks_ui/draw_opration.h → Marlin/src/lcd/extui/lib/mks_ui/draw_operation.h View File

@@ -25,8 +25,8 @@
25 25
 extern "C" { /* C-declarations for C++ */
26 26
 #endif
27 27
 
28
-extern void lv_draw_opration(void);
29
-extern void lv_clear_opration();
28
+extern void lv_draw_operation(void);
29
+extern void lv_clear_operation();
30 30
 
31 31
 //extern void disp_temp_ready_print();
32 32
 #ifdef __cplusplus

+ 2
- 2
Marlin/src/lcd/extui/lib/mks_ui/draw_pause_message.cpp View File

@@ -21,7 +21,7 @@
21 21
  */
22 22
 #include "../../../../inc/MarlinConfigPre.h"
23 23
 
24
-#if BOTH(TFT_LVGL_UI, ADVANCED_PAUSE_FEATURE)
24
+#if BOTH(HAS_TFT_LVGL_UI, ADVANCED_PAUSE_FEATURE)
25 25
 
26 26
 #include "draw_ui.h"
27 27
 #include "lv_conf.h"
@@ -52,4 +52,4 @@ void lv_draw_pause_message(const PauseMessage msg) {
52 52
   }
53 53
 }
54 54
 
55
-#endif // TFT_LVGL_UI && ADVANCED_PAUSE_FEATURE
55
+#endif // HAS_TFT_LVGL_UI && ADVANCED_PAUSE_FEATURE

+ 222
- 0
Marlin/src/lcd/extui/lib/mks_ui/draw_pause_position.cpp View File

@@ -0,0 +1,222 @@
1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
+ *
5
+ * Based on Sprinter and grbl.
6
+ * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
7
+ *
8
+ * This program is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+#include "../../../../inc/MarlinConfigPre.h"
23
+
24
+#if HAS_TFT_LVGL_UI
25
+
26
+#include "lv_conf.h"
27
+#include "draw_ui.h"
28
+
29
+#include "../../../../MarlinCore.h"
30
+#include "../../../../module/planner.h"
31
+
32
+static lv_obj_t * scr;
33
+
34
+#define ID_PAUSE_RETURN 1
35
+#define ID_PAUSE_X      2
36
+#define ID_PAUSE_Y      3
37
+#define ID_PAUSE_Z      4
38
+
39
+static void event_handler(lv_obj_t * obj, lv_event_t event) {
40
+  switch (obj->mks_obj_id) {
41
+    case ID_PAUSE_RETURN:
42
+      if (event == LV_EVENT_CLICKED) {
43
+
44
+      }
45
+      else if (event == LV_EVENT_RELEASED) {
46
+        lv_clear_pause_position();
47
+        draw_return_ui();
48
+      }
49
+      break;
50
+    case ID_PAUSE_X:
51
+      if (event == LV_EVENT_CLICKED) {
52
+
53
+      }
54
+      else if (event == LV_EVENT_RELEASED) {
55
+        value = pause_pos_x;
56
+        lv_clear_pause_position();
57
+        lv_draw_number_key();
58
+      }
59
+      break;
60
+    case ID_PAUSE_Y:
61
+      if (event == LV_EVENT_CLICKED) {
62
+
63
+      }
64
+      else if (event == LV_EVENT_RELEASED) {
65
+        value = pause_pos_y;
66
+        lv_clear_pause_position();
67
+        lv_draw_number_key();
68
+      }
69
+      break;
70
+    case ID_PAUSE_Z:
71
+      if (event == LV_EVENT_CLICKED) {
72
+
73
+      }
74
+      else if (event == LV_EVENT_RELEASED) {
75
+        value = pause_pos_z;
76
+        lv_clear_pause_position();
77
+        lv_draw_number_key();
78
+      }
79
+      break;
80
+  }
81
+}
82
+
83
+void lv_draw_pause_position(void) {
84
+  lv_obj_t *buttonBack = NULL, *label_Back = NULL;
85
+  lv_obj_t *buttonXText = NULL, *labelXText = NULL, *buttonXValue = NULL, *labelXValue = NULL;
86
+  lv_obj_t *buttonYText = NULL, *labelYText = NULL, *buttonYValue = NULL, *labelYValue = NULL;
87
+  lv_obj_t *buttonZText = NULL, *labelZText = NULL, *buttonZValue = NULL, *labelZValue = NULL;
88
+
89
+  lv_obj_t * line1 = NULL, * line2 = NULL, * line3 = NULL;
90
+  if (disp_state_stack._disp_state[disp_state_stack._disp_index] != PAUSE_POS_UI) {
91
+    disp_state_stack._disp_index++;
92
+    disp_state_stack._disp_state[disp_state_stack._disp_index] = PAUSE_POS_UI;
93
+  }
94
+  disp_state = PAUSE_POS_UI;
95
+
96
+  scr = lv_obj_create(NULL, NULL);
97
+
98
+  lv_obj_set_style(scr, &tft_style_scr);
99
+  lv_scr_load(scr);
100
+  lv_obj_clean(scr);
101
+
102
+  lv_obj_t * title = lv_label_create(scr, NULL);
103
+  lv_obj_set_style(title, &tft_style_label_rel);
104
+  lv_obj_set_pos(title, TITLE_XPOS, TITLE_YPOS);
105
+  lv_label_set_text(title, machine_menu.PausePosText);
106
+
107
+  lv_refr_now(lv_refr_get_disp_refreshing());
108
+
109
+  LV_IMG_DECLARE(bmp_para_back);
110
+  // LV_IMG_DECLARE(bmp_para_arrow);
111
+  LV_IMG_DECLARE(bmp_para_bank);
112
+
113
+  buttonXText = lv_btn_create(scr, NULL);                                 /*Add a button the current screen*/
114
+  lv_obj_set_pos(buttonXText, PARA_UI_POS_X, PARA_UI_POS_Y);              /*Set its position*/
115
+  lv_obj_set_size(buttonXText, PARA_UI_VALUE_SIZE_X, PARA_UI_SIZE_Y);     /*Set its size*/
116
+  lv_obj_set_event_cb(buttonXText, event_handler);
117
+  lv_btn_set_style(buttonXText, LV_BTN_STYLE_REL, &tft_style_label_rel);  /*Set the button's released style*/
118
+  lv_btn_set_style(buttonXText, LV_BTN_STYLE_PR, &tft_style_label_pre);   /*Set the button's pressed style*/
119
+  lv_btn_set_layout(buttonXText, LV_LAYOUT_OFF);
120
+  labelXText = lv_label_create(buttonXText, NULL);                        /*Add a label to the button*/
121
+
122
+  buttonXValue = lv_imgbtn_create(scr, NULL);
123
+  lv_obj_set_pos(buttonXValue, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y + PARA_UI_VALUE_V);
124
+  lv_obj_set_event_cb_mks(buttonXValue, event_handler, ID_PAUSE_X, "bmp_value_blank.bin", 0);
125
+  lv_imgbtn_set_src(buttonXValue, LV_BTN_STATE_REL, &bmp_para_bank);
126
+  lv_imgbtn_set_src(buttonXValue, LV_BTN_STATE_PR, &bmp_para_bank);
127
+  lv_imgbtn_set_style(buttonXValue, LV_BTN_STATE_PR, &style_para_value_pre);
128
+  lv_imgbtn_set_style(buttonXValue, LV_BTN_STATE_REL, &style_para_value_rel);
129
+  lv_btn_set_layout(buttonXValue, LV_LAYOUT_OFF);
130
+  labelXValue = lv_label_create(buttonXValue, NULL);
131
+
132
+  line1 = lv_line_create(scr, NULL);
133
+  lv_ex_line(line1, line_points[0]);
134
+
135
+  buttonYText = lv_btn_create(scr, NULL);                                 /*Add a button the current screen*/
136
+  lv_obj_set_pos(buttonYText, PARA_UI_POS_X, PARA_UI_POS_Y * 2);          /*Set its position*/
137
+  lv_obj_set_size(buttonYText, PARA_UI_VALUE_SIZE_X, PARA_UI_SIZE_Y);     /*Set its size*/
138
+  lv_obj_set_event_cb(buttonYText, event_handler);
139
+  lv_btn_set_style(buttonYText, LV_BTN_STYLE_REL, &tft_style_label_rel);  /*Set the button's released style*/
140
+  lv_btn_set_style(buttonYText, LV_BTN_STYLE_PR, &tft_style_label_pre);   /*Set the button's pressed style*/
141
+  lv_btn_set_layout(buttonYText, LV_LAYOUT_OFF);
142
+  labelYText = lv_label_create(buttonYText, NULL);                        /*Add a label to the button*/
143
+
144
+  buttonYValue = lv_imgbtn_create(scr, NULL);
145
+  lv_obj_set_pos(buttonYValue, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 2 + PARA_UI_VALUE_V);
146
+  lv_obj_set_event_cb_mks(buttonYValue, event_handler, ID_PAUSE_Y, "bmp_value_blank.bin", 0);
147
+  lv_imgbtn_set_src(buttonYValue, LV_BTN_STATE_REL, &bmp_para_bank);
148
+  lv_imgbtn_set_src(buttonYValue, LV_BTN_STATE_PR, &bmp_para_bank);
149
+  lv_imgbtn_set_style(buttonYValue, LV_BTN_STATE_PR, &style_para_value_pre);
150
+  lv_imgbtn_set_style(buttonYValue, LV_BTN_STATE_REL, &style_para_value_rel);
151
+  lv_btn_set_layout(buttonYValue, LV_LAYOUT_OFF);
152
+  labelYValue = lv_label_create(buttonYValue, NULL);
153
+
154
+  line2 = lv_line_create(scr, NULL);
155
+  lv_ex_line(line2, line_points[1]);
156
+
157
+  buttonZText = lv_btn_create(scr, NULL);                                 /*Add a button the current screen*/
158
+  lv_obj_set_pos(buttonZText, PARA_UI_POS_X, PARA_UI_POS_Y * 3);          /*Set its position*/
159
+  lv_obj_set_size(buttonZText, PARA_UI_VALUE_SIZE_X, PARA_UI_SIZE_Y);     /*Set its size*/
160
+  lv_obj_set_event_cb(buttonZText, event_handler);
161
+  lv_btn_set_style(buttonZText, LV_BTN_STYLE_REL, &tft_style_label_rel);  /*Set the button's released style*/
162
+  lv_btn_set_style(buttonZText, LV_BTN_STYLE_PR, &tft_style_label_pre);   /*Set the button's pressed style*/
163
+  lv_btn_set_layout(buttonZText, LV_LAYOUT_OFF);
164
+  labelZText = lv_label_create(buttonZText, NULL);                        /*Add a label to the button*/
165
+
166
+  buttonZValue = lv_imgbtn_create(scr, NULL);
167
+  lv_obj_set_pos(buttonZValue, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 3 + PARA_UI_VALUE_V);
168
+  lv_obj_set_event_cb_mks(buttonZValue, event_handler, ID_PAUSE_Z, "bmp_value_blank.bin", 0);
169
+  lv_imgbtn_set_src(buttonZValue, LV_BTN_STATE_REL, &bmp_para_bank);
170
+  lv_imgbtn_set_src(buttonZValue, LV_BTN_STATE_PR, &bmp_para_bank);
171
+  lv_imgbtn_set_style(buttonZValue, LV_BTN_STATE_PR, &style_para_value_pre);
172
+  lv_imgbtn_set_style(buttonZValue, LV_BTN_STATE_REL, &style_para_value_rel);
173
+  lv_btn_set_layout(buttonZValue, LV_LAYOUT_OFF);
174
+  labelZValue = lv_label_create(buttonZValue, NULL);
175
+
176
+  line3 = lv_line_create(scr, NULL);
177
+  lv_ex_line(line3, line_points[2]);
178
+
179
+  buttonBack = lv_imgbtn_create(scr, NULL);
180
+  lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_PAUSE_RETURN, "bmp_back70x40.bin", 0);
181
+  lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_REL, &bmp_para_back);
182
+  lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_PR, &bmp_para_back);
183
+  lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_PR, &tft_style_label_pre);
184
+  lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_REL, &tft_style_label_rel);
185
+
186
+  lv_obj_set_pos(buttonBack, PARA_UI_BACL_POS_X, PARA_UI_BACL_POS_Y);
187
+  lv_btn_set_layout(buttonBack, LV_LAYOUT_OFF);
188
+  label_Back = lv_label_create(buttonBack, NULL);
189
+
190
+  if (gCfgItems.multiple_language != 0) {
191
+    ZERO(public_buf_l);
192
+    sprintf_P(public_buf_l, PSTR("%.1f"), gCfgItems.pausePosX);
193
+    lv_label_set_text(labelXValue, public_buf_l);
194
+    lv_obj_align(labelXValue, buttonXValue, LV_ALIGN_CENTER, 0, 0);
195
+
196
+    ZERO(public_buf_l);
197
+    sprintf_P(public_buf_l, PSTR("%.1f"), gCfgItems.pausePosY);
198
+    lv_label_set_text(labelYValue, public_buf_l);
199
+    lv_obj_align(labelYValue, buttonYValue, LV_ALIGN_CENTER, 0, 0);
200
+
201
+    ZERO(public_buf_l);
202
+    sprintf_P(public_buf_l, PSTR("%.1f"), gCfgItems.pausePosZ);
203
+    lv_label_set_text(labelZValue, public_buf_l);
204
+    lv_obj_align(labelZValue, buttonZValue, LV_ALIGN_CENTER, 0, 0);
205
+
206
+    lv_label_set_text(labelXText, machine_menu.xPos);
207
+    lv_obj_align(labelXText, buttonXText, LV_ALIGN_IN_LEFT_MID, 0, 0);
208
+
209
+    lv_label_set_text(labelYText, machine_menu.yPos);
210
+    lv_obj_align(labelYText, buttonYText, LV_ALIGN_IN_LEFT_MID, 0, 0);
211
+
212
+    lv_label_set_text(labelZText, machine_menu.zPos);
213
+    lv_obj_align(labelZText, buttonZText, LV_ALIGN_IN_LEFT_MID, 0, 0);
214
+
215
+    lv_label_set_text(label_Back, common_menu.text_back);
216
+    lv_obj_align(label_Back, buttonBack, LV_ALIGN_CENTER, 0, 0);
217
+  }
218
+}
219
+
220
+void lv_clear_pause_position() { lv_obj_del(scr); }
221
+
222
+#endif // HAS_TFT_LVGL_UI

+ 33
- 0
Marlin/src/lcd/extui/lib/mks_ui/draw_pause_position.h View File

@@ -0,0 +1,33 @@
1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
+ *
5
+ * Based on Sprinter and grbl.
6
+ * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
7
+ *
8
+ * This program is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+#pragma once
23
+
24
+#ifdef __cplusplus
25
+extern "C" { /* C-declarations for C++ */
26
+#endif
27
+
28
+extern void lv_draw_pause_position(void);
29
+extern void lv_clear_pause_position();
30
+
31
+#ifdef __cplusplus
32
+} /* C-declarations for C++ */
33
+#endif

+ 62
- 67
Marlin/src/lcd/extui/lib/mks_ui/draw_preHeat.cpp View File

@@ -21,7 +21,7 @@
21 21
  */
22 22
 #include "../../../../inc/MarlinConfigPre.h"
23 23
 
24
-#if ENABLED(TFT_LVGL_UI)
24
+#if HAS_TFT_LVGL_UI
25 25
 
26 26
 #include "lv_conf.h"
27 27
 #include "draw_ui.h"
@@ -58,29 +58,24 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
58 58
           if (uiCfg.curSprayerChoose == 0) {
59 59
             if ((int)thermalManager.temp_hotend[uiCfg.curSprayerChoose].target > (HEATER_0_MAXTEMP - (WATCH_TEMP_INCREASE + TEMP_HYSTERESIS + 1))) {
60 60
               thermalManager.temp_hotend[uiCfg.curSprayerChoose].target = (float)HEATER_0_MAXTEMP - (WATCH_TEMP_INCREASE + TEMP_HYSTERESIS + 1);
61
-
62 61
               thermalManager.start_watching_hotend(uiCfg.curSprayerChoose);
63 62
             }
64 63
           }
65 64
           #if !defined(SINGLENOZZLE) && EXTRUDERS >= 2
66
-          else    if ((int)thermalManager.temp_hotend[uiCfg.curSprayerChoose].target > (HEATER_1_MAXTEMP - (WATCH_TEMP_INCREASE + TEMP_HYSTERESIS + 1))) {
67
-            thermalManager.temp_hotend[uiCfg.curSprayerChoose].target = (float)HEATER_1_MAXTEMP - (WATCH_TEMP_INCREASE + TEMP_HYSTERESIS + 1);
68
-
69
-            thermalManager.start_watching_hotend(uiCfg.curSprayerChoose);
70
-          }
65
+            else if ((int)thermalManager.temp_hotend[uiCfg.curSprayerChoose].target > (HEATER_1_MAXTEMP - (WATCH_TEMP_INCREASE + TEMP_HYSTERESIS + 1))) {
66
+              thermalManager.temp_hotend[uiCfg.curSprayerChoose].target = (float)HEATER_1_MAXTEMP - (WATCH_TEMP_INCREASE + TEMP_HYSTERESIS + 1);
67
+              thermalManager.start_watching_hotend(uiCfg.curSprayerChoose);
68
+            }
71 69
           #endif
72 70
         }
73 71
         #if HAS_HEATED_BED
74
-        else {
75
-
76
-          thermalManager.temp_bed.target += uiCfg.stepHeat;
77
-
78
-          if ((int)thermalManager.temp_bed.target > BED_MAXTEMP - (WATCH_BED_TEMP_INCREASE + TEMP_BED_HYSTERESIS + 1)) {
79
-            thermalManager.temp_bed.target = (float)BED_MAXTEMP - (WATCH_BED_TEMP_INCREASE + TEMP_BED_HYSTERESIS + 1);
80
-            thermalManager.start_watching_bed();
72
+          else {
73
+            thermalManager.temp_bed.target += uiCfg.stepHeat;
74
+            if ((int)thermalManager.temp_bed.target > BED_MAXTEMP - (WATCH_BED_TEMP_INCREASE + TEMP_BED_HYSTERESIS + 1)) {
75
+              thermalManager.temp_bed.target = (float)BED_MAXTEMP - (WATCH_BED_TEMP_INCREASE + TEMP_BED_HYSTERESIS + 1);
76
+              thermalManager.start_watching_bed();
77
+            }
81 78
           }
82
-
83
-        }
84 79
         #endif
85 80
         disp_desire_temp();
86 81
       }
@@ -101,16 +96,16 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
101 96
           }
102 97
         }
103 98
         #if HAS_HEATED_BED
104
-        else {
105
-          if ((int)thermalManager.temp_bed.target > uiCfg.stepHeat) {
106
-            thermalManager.temp_bed.target -= uiCfg.stepHeat;
107
-            thermalManager.start_watching_bed();
108
-          }
109 99
           else {
110
-            thermalManager.temp_bed.target = (float)0;
111
-            thermalManager.start_watching_bed();
100
+            if ((int)thermalManager.temp_bed.target > uiCfg.stepHeat) {
101
+              thermalManager.temp_bed.target -= uiCfg.stepHeat;
102
+              thermalManager.start_watching_bed();
103
+            }
104
+            else {
105
+              thermalManager.temp_bed.target = (float)0;
106
+              thermalManager.start_watching_bed();
107
+            }
112 108
           }
113
-        }
114 109
         #endif
115 110
         disp_desire_temp();
116 111
       }
@@ -131,12 +126,12 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
131 126
                 uiCfg.curTempType = 1;
132 127
               }
133 128
               else {
134
-                uiCfg.curTempType = 0;
129
+                uiCfg.curTempType      = 0;
135 130
                 uiCfg.curSprayerChoose = 0;
136 131
               }
137 132
             }
138 133
           }
139
-          else    if (uiCfg.curSprayerChoose == 0) {
134
+          else if (uiCfg.curSprayerChoose == 0) {
140 135
             if (TEMP_SENSOR_BED != 0)
141 136
               uiCfg.curTempType = 1;
142 137
             else
@@ -145,7 +140,7 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
145 140
         }
146 141
         else if (uiCfg.curTempType == 1) {
147 142
           uiCfg.curSprayerChoose = 0;
148
-          uiCfg.curTempType = 0;
143
+          uiCfg.curTempType      = 0;
149 144
         }
150 145
         disp_temp_type();
151 146
       }
@@ -174,10 +169,10 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
174 169
           thermalManager.start_watching_hotend(uiCfg.curSprayerChoose);
175 170
         }
176 171
         #if HAS_HEATED_BED
177
-        else {
178
-          thermalManager.temp_bed.target = (float)0;
179
-          thermalManager.start_watching_bed();
180
-        }
172
+          else {
173
+            thermalManager.temp_bed.target = (float)0;
174
+            thermalManager.start_watching_bed();
175
+          }
181 176
         #endif
182 177
         disp_desire_temp();
183 178
       }
@@ -211,7 +206,7 @@ void lv_draw_preHeat(void) {
211 206
   lv_obj_clean(scr);
212 207
 
213 208
   lv_obj_t * title = lv_label_create(scr, NULL);
214
-  lv_obj_set_style(title, &tft_style_lable_rel);
209
+  lv_obj_set_style(title, &tft_style_label_rel);
215 210
   lv_obj_set_pos(title, TITLE_XPOS, TITLE_YPOS);
216 211
   lv_label_set_text(title, creat_title_text());
217 212
 
@@ -220,57 +215,57 @@ void lv_draw_preHeat(void) {
220 215
   LV_IMG_DECLARE(bmp_pic);
221 216
 
222 217
   /*Create an Image button*/
223
-  buttonAdd = lv_imgbtn_create(scr, NULL);
224
-  buttonDec = lv_imgbtn_create(scr, NULL);
225
-  buttoType = lv_imgbtn_create(scr, NULL);
218
+  buttonAdd  = lv_imgbtn_create(scr, NULL);
219
+  buttonDec  = lv_imgbtn_create(scr, NULL);
220
+  buttoType  = lv_imgbtn_create(scr, NULL);
226 221
   buttonStep = lv_imgbtn_create(scr, NULL);
227
-  buttonOff = lv_imgbtn_create(scr, NULL);
222
+  buttonOff  = lv_imgbtn_create(scr, NULL);
228 223
   buttonBack = lv_imgbtn_create(scr, NULL);
229 224
 
230 225
   lv_obj_set_event_cb_mks(buttonAdd, event_handler, ID_P_ADD, "bmp_Add.bin", 0);
231 226
   lv_imgbtn_set_src(buttonAdd, LV_BTN_STATE_REL, &bmp_pic);
232 227
   lv_imgbtn_set_src(buttonAdd, LV_BTN_STATE_PR, &bmp_pic);
233
-  lv_imgbtn_set_style(buttonAdd, LV_BTN_STATE_PR, &tft_style_lable_pre);
234
-  lv_imgbtn_set_style(buttonAdd, LV_BTN_STATE_REL, &tft_style_lable_rel);
228
+  lv_imgbtn_set_style(buttonAdd, LV_BTN_STATE_PR, &tft_style_label_pre);
229
+  lv_imgbtn_set_style(buttonAdd, LV_BTN_STATE_REL, &tft_style_label_rel);
235 230
   lv_obj_clear_protect(buttonAdd, LV_PROTECT_FOLLOW);
236 231
   #if 1
237 232
     lv_obj_set_event_cb_mks(buttonDec, event_handler, ID_P_DEC, "bmp_Dec.bin", 0);
238 233
     lv_imgbtn_set_src(buttonDec, LV_BTN_STATE_REL, &bmp_pic);
239 234
     lv_imgbtn_set_src(buttonDec, LV_BTN_STATE_PR, &bmp_pic);
240
-    lv_imgbtn_set_style(buttonDec, LV_BTN_STATE_PR, &tft_style_lable_pre);
241
-    lv_imgbtn_set_style(buttonDec, LV_BTN_STATE_REL, &tft_style_lable_rel);
235
+    lv_imgbtn_set_style(buttonDec, LV_BTN_STATE_PR, &tft_style_label_pre);
236
+    lv_imgbtn_set_style(buttonDec, LV_BTN_STATE_REL, &tft_style_label_rel);
242 237
 
243 238
 
244 239
     lv_imgbtn_set_src(buttoType, LV_BTN_STATE_REL, &bmp_pic);
245 240
     lv_imgbtn_set_src(buttoType, LV_BTN_STATE_PR, &bmp_pic);
246
-    lv_imgbtn_set_style(buttoType, LV_BTN_STATE_PR, &tft_style_lable_pre);
247
-    lv_imgbtn_set_style(buttoType, LV_BTN_STATE_REL, &tft_style_lable_rel);
241
+    lv_imgbtn_set_style(buttoType, LV_BTN_STATE_PR, &tft_style_label_pre);
242
+    lv_imgbtn_set_style(buttoType, LV_BTN_STATE_REL, &tft_style_label_rel);
248 243
 
249 244
 
250 245
     lv_imgbtn_set_src(buttonStep, LV_BTN_STATE_REL, &bmp_pic);
251 246
     lv_imgbtn_set_src(buttonStep, LV_BTN_STATE_PR, &bmp_pic);
252
-    lv_imgbtn_set_style(buttonStep, LV_BTN_STATE_PR, &tft_style_lable_pre);
253
-    lv_imgbtn_set_style(buttonStep, LV_BTN_STATE_REL, &tft_style_lable_rel);
247
+    lv_imgbtn_set_style(buttonStep, LV_BTN_STATE_PR, &tft_style_label_pre);
248
+    lv_imgbtn_set_style(buttonStep, LV_BTN_STATE_REL, &tft_style_label_rel);
254 249
 
255
-    lv_obj_set_event_cb_mks(buttonOff, event_handler, ID_P_OFF, "bmp_Speed0.bin", 0);
250
+    lv_obj_set_event_cb_mks(buttonOff, event_handler, ID_P_OFF, "bmp_speed0.bin", 0);
256 251
     lv_imgbtn_set_src(buttonOff, LV_BTN_STATE_REL, &bmp_pic);
257 252
     lv_imgbtn_set_src(buttonOff, LV_BTN_STATE_PR, &bmp_pic);
258
-    lv_imgbtn_set_style(buttonOff, LV_BTN_STATE_PR, &tft_style_lable_pre);
259
-    lv_imgbtn_set_style(buttonOff, LV_BTN_STATE_REL, &tft_style_lable_rel);
253
+    lv_imgbtn_set_style(buttonOff, LV_BTN_STATE_PR, &tft_style_label_pre);
254
+    lv_imgbtn_set_style(buttonOff, LV_BTN_STATE_REL, &tft_style_label_rel);
260 255
 
261
-    lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_P_RETURN, "bmp_Return.bin", 0);
256
+    lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_P_RETURN, "bmp_return.bin", 0);
262 257
     lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_REL, &bmp_pic);
263 258
     lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_PR, &bmp_pic);
264
-    lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_PR, &tft_style_lable_pre);
265
-    lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_REL, &tft_style_lable_rel);
259
+    lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_PR, &tft_style_label_pre);
260
+    lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_REL, &tft_style_label_rel);
266 261
   #endif
267 262
 
268 263
   lv_obj_set_pos(buttonAdd, INTERVAL_V, titleHeight);
269 264
   lv_obj_set_pos(buttonDec, BTN_X_PIXEL * 3 + INTERVAL_V * 4, titleHeight);
270
-  lv_obj_set_pos(buttoType, INTERVAL_V,  BTN_Y_PIXEL + INTERVAL_H + titleHeight);
265
+  lv_obj_set_pos(buttoType, INTERVAL_V, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
271 266
   lv_obj_set_pos(buttonStep, BTN_X_PIXEL + INTERVAL_V * 2, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
272
-  lv_obj_set_pos(buttonOff, BTN_X_PIXEL * 2 + INTERVAL_V * 3,  BTN_Y_PIXEL + INTERVAL_H + titleHeight);
273
-  lv_obj_set_pos(buttonBack, BTN_X_PIXEL * 3 + INTERVAL_V * 4,  BTN_Y_PIXEL + INTERVAL_H + titleHeight);
267
+  lv_obj_set_pos(buttonOff, BTN_X_PIXEL * 2 + INTERVAL_V * 3, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
268
+  lv_obj_set_pos(buttonBack, BTN_X_PIXEL * 3 + INTERVAL_V * 4, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
274 269
 
275 270
   /*Create a label on the Image button*/
276 271
   lv_btn_set_layout(buttonAdd, LV_LAYOUT_OFF);
@@ -284,7 +279,7 @@ void lv_draw_preHeat(void) {
284 279
   lv_obj_t * labelDec = lv_label_create(buttonDec, NULL);
285 280
   labelType = lv_label_create(buttoType, NULL);
286 281
   labelStep = lv_label_create(buttonStep, NULL);
287
-  lv_obj_t * labelOff = lv_label_create(buttonOff, NULL);
282
+  lv_obj_t * labelOff   = lv_label_create(buttonOff, NULL);
288 283
   lv_obj_t * label_Back = lv_label_create(buttonBack, NULL);
289 284
 
290 285
 
@@ -306,7 +301,7 @@ void lv_draw_preHeat(void) {
306 301
   disp_step_heat();
307 302
 
308 303
   tempText1 = lv_label_create(scr, NULL);
309
-  lv_obj_set_style(tempText1, &tft_style_lable_rel);
304
+  lv_obj_set_style(tempText1, &tft_style_label_rel);
310 305
   disp_desire_temp();
311 306
 }
312 307
 
@@ -314,14 +309,14 @@ void disp_temp_type() {
314 309
 
315 310
   if (uiCfg.curTempType == 0) {
316 311
     if (uiCfg.curSprayerChoose == 1) {
317
-      lv_obj_set_event_cb_mks(buttoType, event_handler, ID_P_TYPE, "bmp_Extru2.bin", 0);
312
+      lv_obj_set_event_cb_mks(buttoType, event_handler, ID_P_TYPE, "bmp_extru2.bin", 0);
318 313
       if (gCfgItems.multiple_language != 0) {
319 314
         lv_label_set_text(labelType, preheat_menu.ext2);
320 315
         lv_obj_align(labelType, buttoType, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
321 316
       }
322 317
     }
323 318
     else {
324
-      lv_obj_set_event_cb_mks(buttoType, event_handler, ID_P_TYPE, "bmp_Extru1.bin", 0);
319
+      lv_obj_set_event_cb_mks(buttoType, event_handler, ID_P_TYPE, "bmp_extru1.bin", 0);
325 320
       if (gCfgItems.multiple_language != 0) {
326 321
         lv_label_set_text(labelType, preheat_menu.ext1);
327 322
         lv_obj_align(labelType, buttoType, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
@@ -330,7 +325,7 @@ void disp_temp_type() {
330 325
 
331 326
   }
332 327
   else {
333
-    lv_obj_set_event_cb_mks(buttoType, event_handler, ID_P_TYPE, "bmp_Bed.bin", 0);
328
+    lv_obj_set_event_cb_mks(buttoType, event_handler, ID_P_TYPE, "bmp_bed.bin", 0);
334 329
     if (gCfgItems.multiple_language != 0) {
335 330
       lv_label_set_text(labelType, preheat_menu.hotbed);
336 331
       lv_obj_align(labelType, buttoType, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
@@ -352,12 +347,12 @@ void disp_desire_temp() {
352 347
     sprintf(buf, preheat_menu.value_state, (int)thermalManager.temp_hotend[uiCfg.curSprayerChoose].celsius,  (int)thermalManager.temp_hotend[uiCfg.curSprayerChoose].target);
353 348
   }
354 349
   #if HAS_HEATED_BED
355
-  else {
356
-    strcat(public_buf_l, preheat_menu.hotbed);
357
-    sprintf(buf, preheat_menu.value_state, (int)thermalManager.temp_bed.celsius,  (int)thermalManager.temp_bed.target);
358
-  }
350
+    else {
351
+      strcat(public_buf_l, preheat_menu.hotbed);
352
+      sprintf(buf, preheat_menu.value_state, (int)thermalManager.temp_bed.celsius,  (int)thermalManager.temp_bed.target);
353
+    }
359 354
   #endif
360
-  strcat(public_buf_l, ": ");
355
+  strcat_P(public_buf_l, PSTR(": "));
361 356
   strcat(public_buf_l, buf);
362 357
   lv_label_set_text(tempText1, public_buf_l);
363 358
   lv_obj_align(tempText1, NULL, LV_ALIGN_CENTER, 0, -50);
@@ -365,11 +360,11 @@ void disp_desire_temp() {
365 360
 
366 361
 void disp_step_heat() {
367 362
   if (uiCfg.stepHeat == 1)
368
-    lv_obj_set_event_cb_mks(buttonStep, event_handler, ID_P_STEP, "bmp_Step1_degree.bin", 0);
363
+    lv_obj_set_event_cb_mks(buttonStep, event_handler, ID_P_STEP, "bmp_step1_degree.bin", 0);
369 364
   else if (uiCfg.stepHeat == 5)
370
-    lv_obj_set_event_cb_mks(buttonStep, event_handler, ID_P_STEP, "bmp_Step5_degree.bin", 0);
365
+    lv_obj_set_event_cb_mks(buttonStep, event_handler, ID_P_STEP, "bmp_step5_degree.bin", 0);
371 366
   else if (uiCfg.stepHeat == 10)
372
-    lv_obj_set_event_cb_mks(buttonStep, event_handler, ID_P_STEP, "bmp_Step10_degree.bin", 0);
367
+    lv_obj_set_event_cb_mks(buttonStep, event_handler, ID_P_STEP, "bmp_step10_degree.bin", 0);
373 368
 
374 369
   if (gCfgItems.multiple_language != 0) {
375 370
     if (uiCfg.stepHeat == 1) {
@@ -389,4 +384,4 @@ void disp_step_heat() {
389 384
 
390 385
 void lv_clear_preHeat() { lv_obj_del(scr); }
391 386
 
392
-#endif // TFT_LVGL_UI
387
+#endif // HAS_TFT_LVGL_UI

+ 129
- 127
Marlin/src/lcd/extui/lib/mks_ui/draw_print_file.cpp View File

@@ -21,7 +21,7 @@
21 21
  */
22 22
 #include "../../../../inc/MarlinConfigPre.h"
23 23
 
24
-#if ENABLED(TFT_LVGL_UI)
24
+#if HAS_TFT_LVGL_UI
25 25
 
26 26
 #include "../../../../MarlinCore.h"
27 27
 #include "lv_conf.h"
@@ -34,9 +34,8 @@
34 34
 
35 35
 static lv_obj_t * scr;
36 36
 
37
-static lv_obj_t *buttonPageUp, *buttonPageDown, *buttonBack, *buttonGcode[FILE_BTN_CNT];
38
-static lv_obj_t * labelPageUp[FILE_BTN_CNT];
39
-static lv_obj_t *buttonText[FILE_BTN_CNT];
37
+static lv_obj_t *buttonPageUp, *buttonPageDown, *buttonBack,
38
+                *buttonGcode[FILE_BTN_CNT], *labelPageUp[FILE_BTN_CNT], *buttonText[FILE_BTN_CNT];
40 39
 
41 40
 #define ID_P_UP     7
42 41
 #define ID_P_DOWN   8
@@ -53,64 +52,62 @@ uint8_t sel_id = 0;
53 52
 
54 53
 #if ENABLED(SDSUPPORT)
55 54
 
56
-static uint8_t search_file() {
57
-  int valid_name_cnt = 0;
58
-  //char tmp[SHORT_NEME_LEN*MAX_DIR_LEVEL+1];
55
+  static uint8_t search_file() {
56
+    int valid_name_cnt = 0;
57
+    //char tmp[SHORT_NEME_LEN*MAX_DIR_LEVEL+1];
59 58
 
60
-  list_file.Sd_file_cnt = 0;
61
-  //list_file.Sd_file_offset = dir_offset[curDirLever].cur_page_first_offset;
59
+    list_file.Sd_file_cnt = 0;
60
+    //list_file.Sd_file_offset = dir_offset[curDirLever].cur_page_first_offset;
62 61
 
63
-  //root2.rewind();
64
-  //SERIAL_ECHOLN(list_file.curDirPath);
62
+    //root2.rewind();
63
+    //SERIAL_ECHOLN(list_file.curDirPath);
65 64
 
66
-  if (curDirLever != 0) card.cd(list_file.curDirPath);
67
-  else card.cdroot(); //while(card.cdup());
65
+    if (curDirLever != 0) card.cd(list_file.curDirPath);
66
+    else card.cdroot(); // while(card.cdup());
68 67
 
69
-  const uint16_t fileCnt = card.get_num_Files();
68
+    const uint16_t fileCnt = card.get_num_Files();
70 69
 
71
-  for (uint16_t i = 0; i < fileCnt; i++) {
72
-    if (list_file.Sd_file_cnt == list_file.Sd_file_offset) {
73
-      const uint16_t nr = SD_ORDER(i, fileCnt);
74
-      card.getfilename_sorted(nr);
70
+    for (uint16_t i = 0; i < fileCnt; i++) {
71
+      if (list_file.Sd_file_cnt == list_file.Sd_file_offset) {
72
+        const uint16_t nr = SD_ORDER(i, fileCnt);
73
+        card.getfilename_sorted(nr);
75 74
 
76
-      if (card.flag.filenameIsDir)
77
-        /*
78
-          SERIAL_ECHOLN(card.longest_filename);
79
-        */
80
-        list_file.IsFolder[valid_name_cnt] = 1;
81
-      else
82
-        //SERIAL_ECHOLN(card.longFilename);
83
-        list_file.IsFolder[valid_name_cnt] = 0;
84
-
85
-      #if 1
86
-        //
87
-        memset(list_file.file_name[valid_name_cnt], 0, strlen(list_file.file_name[valid_name_cnt]));
88
-        strcpy(list_file.file_name[valid_name_cnt], list_file.curDirPath);
89
-        strcat(list_file.file_name[valid_name_cnt], "/");
90
-        strcat(list_file.file_name[valid_name_cnt], card.filename);
91
-        //
92
-        memset(list_file.long_name[valid_name_cnt], 0, strlen(list_file.long_name[valid_name_cnt]));
93
-        if (card.longFilename[0] == 0)
94
-          strncpy(list_file.long_name[valid_name_cnt], card.filename, strlen(card.filename));
75
+        if (card.flag.filenameIsDir)
76
+          //SERIAL_ECHOLN(card.longest_filename);
77
+          list_file.IsFolder[valid_name_cnt] = 1;
95 78
         else
96
-          strncpy(list_file.long_name[valid_name_cnt], card.longFilename, strlen(card.longFilename));
97
-
98
-        valid_name_cnt++;
99
-        if (valid_name_cnt == 1)
100
-          dir_offset[curDirLever].cur_page_first_offset = list_file.Sd_file_offset;
101
-        if (valid_name_cnt >= FILE_NUM) {
102
-          dir_offset[curDirLever].cur_page_last_offset = list_file.Sd_file_offset;
79
+          //SERIAL_ECHOLN(card.longFilename);
80
+          list_file.IsFolder[valid_name_cnt] = 0;
81
+
82
+        #if 1
83
+          //
84
+          memset(list_file.file_name[valid_name_cnt], 0, strlen(list_file.file_name[valid_name_cnt]));
85
+          strcpy(list_file.file_name[valid_name_cnt], list_file.curDirPath);
86
+          strcat_P(list_file.file_name[valid_name_cnt], PSTR("/"));
87
+          strcat(list_file.file_name[valid_name_cnt], card.filename);
88
+          //
89
+          memset(list_file.long_name[valid_name_cnt], 0, strlen(list_file.long_name[valid_name_cnt]));
90
+          if (card.longFilename[0] == 0)
91
+            strncpy(list_file.long_name[valid_name_cnt], card.filename, strlen(card.filename));
92
+          else
93
+            strncpy(list_file.long_name[valid_name_cnt], card.longFilename, strlen(card.longFilename));
94
+
95
+          valid_name_cnt++;
96
+          if (valid_name_cnt == 1)
97
+            dir_offset[curDirLever].cur_page_first_offset = list_file.Sd_file_offset;
98
+          if (valid_name_cnt >= FILE_NUM) {
99
+            dir_offset[curDirLever].cur_page_last_offset = list_file.Sd_file_offset;
100
+            list_file.Sd_file_offset++;
101
+            break;
102
+          }
103 103
           list_file.Sd_file_offset++;
104
-          break;
105
-        }
106
-        list_file.Sd_file_offset++;
107
-      #endif
104
+        #endif
105
+      }
106
+      list_file.Sd_file_cnt++;
108 107
     }
109
-    list_file.Sd_file_cnt++;
108
+    //card.closefile(false);
109
+    return valid_name_cnt;
110 110
   }
111
-  //card.closefile(false);
112
-  return valid_name_cnt;
113
-}
114 111
 
115 112
 #endif // SDSUPPORT
116 113
 
@@ -147,7 +144,7 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
147 144
     }
148 145
     else if (event == LV_EVENT_RELEASED) {
149 146
       if (dir_offset[curDirLever].curPage > 0) {
150
-        //2015.05.19
147
+        // 2015.05.19
151 148
         list_file.Sd_file_cnt = 0;
152 149
 
153 150
         if (dir_offset[curDirLever].cur_page_first_offset >= FILE_NUM)
@@ -169,7 +166,7 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
169 166
     }
170 167
     else if (event == LV_EVENT_RELEASED) {
171 168
       if (dir_offset[curDirLever].cur_page_last_offset > 0) {
172
-        list_file.Sd_file_cnt = 0;
169
+        list_file.Sd_file_cnt    = 0;
173 170
         list_file.Sd_file_offset = dir_offset[curDirLever].cur_page_last_offset + 1;
174 171
         #if ENABLED(SDSUPPORT)
175 172
           file_count = search_file();
@@ -195,9 +192,9 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
195 192
           #if ENABLED(SDSUPPORT)
196 193
             card.cdup();
197 194
           #endif
198
-          dir_offset[curDirLever].curPage = 0;
195
+          dir_offset[curDirLever].curPage               = 0;
199 196
           dir_offset[curDirLever].cur_page_first_offset = 0;
200
-          dir_offset[curDirLever].cur_page_last_offset = 0;
197
+          dir_offset[curDirLever].cur_page_last_offset  = 0;
201 198
           curDirLever--;
202 199
           list_file.Sd_file_offset = dir_offset[curDirLever].cur_page_first_offset;
203 200
           #if ENABLED(SDSUPPORT)
@@ -221,7 +218,7 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
221 218
         else if (event == LV_EVENT_RELEASED) {
222 219
           if (list_file.file_name[i][0] != 0) {
223 220
             if (list_file.IsFolder[i] == 1) {
224
-              memset(list_file.curDirPath, 0, sizeof(list_file.curDirPath));
221
+              ZERO(list_file.curDirPath);
225 222
               strcpy(list_file.curDirPath,  list_file.file_name[i]);
226 223
               curDirLever++;
227 224
               list_file.Sd_file_offset = dir_offset[curDirLever].cur_page_first_offset;
@@ -253,11 +250,11 @@ void lv_draw_print_file(void) {
253 250
   }
254 251
   disp_state = PRINT_FILE_UI;
255 252
 
256
-  curDirLever = 0;
253
+  curDirLever                     = 0;
257 254
   dir_offset[curDirLever].curPage = 0;
258 255
 
259 256
   list_file.Sd_file_offset = 0;
260
-  list_file.Sd_file_cnt = 0;
257
+  list_file.Sd_file_cnt    = 0;
261 258
 
262 259
   ZERO(dir_offset);
263 260
   ZERO(list_file.IsFolder);
@@ -300,35 +297,35 @@ void disp_gcode_icon(uint8_t file_num) {
300 297
   lv_obj_clean(scr);
301 298
 
302 299
   lv_obj_t * title = lv_label_create(scr, NULL);
303
-  lv_obj_set_style(title, &tft_style_lable_rel);
300
+  lv_obj_set_style(title, &tft_style_label_rel);
304 301
   lv_obj_set_pos(title, TITLE_XPOS, TITLE_YPOS);
305 302
   lv_label_set_text(title, creat_title_text());
306 303
 
307 304
   lv_refr_now(lv_refr_get_disp_refreshing());
308 305
 
309
-  buttonPageUp = lv_imgbtn_create(scr, NULL);
306
+  buttonPageUp   = lv_imgbtn_create(scr, NULL);
310 307
   buttonPageDown = lv_imgbtn_create(scr, NULL);
311
-  buttonBack = lv_imgbtn_create(scr, NULL);
308
+  buttonBack     = lv_imgbtn_create(scr, NULL);
312 309
 
313 310
   lv_obj_set_event_cb_mks(buttonPageUp, event_handler, ID_P_UP, "bmp_pageUp.bin", 0);
314 311
   lv_imgbtn_set_src(buttonPageUp, LV_BTN_STATE_REL, &bmp_pic_117x92);
315 312
   lv_imgbtn_set_src(buttonPageUp, LV_BTN_STATE_PR, &bmp_pic_117x92);
316
-  lv_imgbtn_set_style(buttonPageUp, LV_BTN_STATE_PR, &tft_style_lable_pre);
317
-  lv_imgbtn_set_style(buttonPageUp, LV_BTN_STATE_REL, &tft_style_lable_rel);
313
+  lv_imgbtn_set_style(buttonPageUp, LV_BTN_STATE_PR, &tft_style_label_pre);
314
+  lv_imgbtn_set_style(buttonPageUp, LV_BTN_STATE_REL, &tft_style_label_rel);
318 315
   lv_obj_clear_protect(buttonPageUp, LV_PROTECT_FOLLOW);
319 316
 
320 317
   #if 1
321 318
     lv_obj_set_event_cb_mks(buttonPageDown, event_handler, ID_P_DOWN, "bmp_pageDown.bin", 0);
322 319
     lv_imgbtn_set_src(buttonPageDown, LV_BTN_STATE_REL, &bmp_pic_117x92);
323 320
     lv_imgbtn_set_src(buttonPageDown, LV_BTN_STATE_PR, &bmp_pic_117x92);
324
-    lv_imgbtn_set_style(buttonPageDown, LV_BTN_STATE_PR, &tft_style_lable_pre);
325
-    lv_imgbtn_set_style(buttonPageDown, LV_BTN_STATE_REL, &tft_style_lable_rel);
321
+    lv_imgbtn_set_style(buttonPageDown, LV_BTN_STATE_PR, &tft_style_label_pre);
322
+    lv_imgbtn_set_style(buttonPageDown, LV_BTN_STATE_REL, &tft_style_label_rel);
326 323
 
327
-    lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_P_RETURN, "bmp_Return.bin", 0);
324
+    lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_P_RETURN, "bmp_back.bin", 0);
328 325
     lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_REL, &bmp_pic_117x92);
329 326
     lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_PR, &bmp_pic_117x92);
330
-    lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_PR, &tft_style_lable_pre);
331
-    lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_REL, &tft_style_lable_rel);
327
+    lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_PR, &tft_style_label_pre);
328
+    lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_REL, &tft_style_label_rel);
332 329
   #endif
333 330
 
334 331
   lv_obj_set_pos(buttonPageUp, OTHER_BTN_XPIEL * 3 + INTERVAL_V * 4, titleHeight);
@@ -343,7 +340,7 @@ void disp_gcode_icon(uint8_t file_num) {
343 340
 
344 341
   for (i = 0; i < FILE_BTN_CNT; i++) {
345 342
     /*
346
-    if(seq) {
343
+    if (seq) {
347 344
       j = (FILE_BTN_CNT-1) - i;
348 345
       back_flg = 1;
349 346
     }
@@ -357,8 +354,8 @@ void disp_gcode_icon(uint8_t file_num) {
357 354
     #ifdef TFT35
358 355
       buttonGcode[i] = lv_imgbtn_create(scr, NULL);
359 356
 
360
-      lv_imgbtn_set_style(buttonGcode[i], LV_BTN_STATE_PR, &tft_style_lable_pre);
361
-      lv_imgbtn_set_style(buttonGcode[i], LV_BTN_STATE_REL, &tft_style_lable_rel);
357
+      lv_imgbtn_set_style(buttonGcode[i], LV_BTN_STATE_PR, &tft_style_label_pre);
358
+      lv_imgbtn_set_style(buttonGcode[i], LV_BTN_STATE_REL, &tft_style_label_rel);
362 359
       lv_obj_clear_protect(buttonGcode[i], LV_PROTECT_FOLLOW);
363 360
       lv_btn_set_layout(buttonGcode[i], LV_LAYOUT_OFF);
364 361
 
@@ -366,7 +363,7 @@ void disp_gcode_icon(uint8_t file_num) {
366 363
       cutFileName((char *)list_file.long_name[i], 16, 8,  (char *)public_buf_m);
367 364
 
368 365
       if (list_file.IsFolder[i] == 1) {
369
-        lv_obj_set_event_cb_mks(buttonGcode[i], event_handler, (i + 1), "bmp_Dir.bin", 0);
366
+        lv_obj_set_event_cb_mks(buttonGcode[i], event_handler, (i + 1), "bmp_dir.bin", 0);
370 367
         lv_imgbtn_set_src(buttonGcode[i], LV_BTN_STATE_REL, &bmp_pic);
371 368
         lv_imgbtn_set_src(buttonGcode[i], LV_BTN_STATE_PR, &bmp_pic);
372 369
         if (i < 3)
@@ -375,7 +372,7 @@ void disp_gcode_icon(uint8_t file_num) {
375 372
           lv_obj_set_pos(buttonGcode[i], BTN_X_PIXEL * (i - 3) + INTERVAL_V * ((i - 3) + 1), BTN_Y_PIXEL + INTERVAL_H + titleHeight);
376 373
 
377 374
         labelPageUp[i] = lv_label_create(buttonGcode[i], NULL);
378
-        lv_obj_set_style(labelPageUp[i], &tft_style_lable_rel);
375
+        lv_obj_set_style(labelPageUp[i], &tft_style_label_rel);
379 376
         lv_label_set_text(labelPageUp[i], public_buf_m);
380 377
         lv_obj_align(labelPageUp[i], buttonGcode[i], LV_ALIGN_IN_BOTTOM_MID, 0, -5);
381 378
       }
@@ -389,10 +386,10 @@ void disp_gcode_icon(uint8_t file_num) {
389 386
             buttonText[i] = lv_btn_create(scr, NULL);
390 387
             //lv_obj_set_event_cb(buttonText[i], event_handler);
391 388
 
392
-            lv_btn_set_style(buttonText[i], LV_BTN_STATE_PR, &tft_style_lable_pre);
393
-            lv_btn_set_style(buttonText[i], LV_BTN_STATE_REL, &tft_style_lable_rel);
394
-            //lv_obj_set_style(buttonText[i], &tft_style_lable_pre);
395
-            //lv_obj_set_style(buttonText[i], &tft_style_lable_rel);
389
+            lv_btn_set_style(buttonText[i], LV_BTN_STATE_PR, &tft_style_label_pre);
390
+            lv_btn_set_style(buttonText[i], LV_BTN_STATE_REL, &tft_style_label_rel);
391
+            //lv_obj_set_style(buttonText[i], &tft_style_label_pre);
392
+            //lv_obj_set_style(buttonText[i], &tft_style_label_rel);
396 393
             lv_obj_clear_protect(buttonText[i], LV_PROTECT_FOLLOW);
397 394
             lv_btn_set_layout(buttonText[i], LV_LAYOUT_OFF);
398 395
             //lv_obj_set_event_cb_mks(buttonText[i], event_handler,(i+10),NULL,0);
@@ -406,10 +403,10 @@ void disp_gcode_icon(uint8_t file_num) {
406 403
             buttonText[i] = lv_btn_create(scr, NULL);
407 404
             //lv_obj_set_event_cb(buttonText[i], event_handler);
408 405
 
409
-            lv_btn_set_style(buttonText[i], LV_BTN_STATE_PR, &tft_style_lable_pre);
410
-            lv_btn_set_style(buttonText[i], LV_BTN_STATE_REL, &tft_style_lable_rel);
406
+            lv_btn_set_style(buttonText[i], LV_BTN_STATE_PR, &tft_style_label_pre);
407
+            lv_btn_set_style(buttonText[i], LV_BTN_STATE_REL, &tft_style_label_rel);
411 408
 
412
-            //lv_imgbtn_set_style(buttonText[i], LV_BTN_STATE_REL, &tft_style_lable_rel);
409
+            //lv_imgbtn_set_style(buttonText[i], LV_BTN_STATE_REL, &tft_style_label_rel);
413 410
             lv_obj_clear_protect(buttonText[i], LV_PROTECT_FOLLOW);
414 411
             lv_btn_set_layout(buttonText[i], LV_LAYOUT_OFF);
415 412
             //lv_obj_set_event_cb_mks(buttonText[i], event_handler,(i+10),NULL,0);
@@ -419,12 +416,12 @@ void disp_gcode_icon(uint8_t file_num) {
419 416
             lv_obj_set_size(buttonText[i], 100, 40);
420 417
           }
421 418
           labelPageUp[i] = lv_label_create(buttonText[i], NULL);
422
-          lv_obj_set_style(labelPageUp[i], &tft_style_lable_rel);
419
+          lv_obj_set_style(labelPageUp[i], &tft_style_label_rel);
423 420
           lv_label_set_text(labelPageUp[i], public_buf_m);
424 421
           lv_obj_align(labelPageUp[i], buttonText[i], LV_ALIGN_IN_BOTTOM_MID, 0, 0);
425 422
         }
426 423
         else {
427
-          lv_obj_set_event_cb_mks(buttonGcode[i], event_handler, (i + 1), "bmp_File.bin", 0);
424
+          lv_obj_set_event_cb_mks(buttonGcode[i], event_handler, (i + 1), "bmp_file.bin", 0);
428 425
           lv_imgbtn_set_src(buttonGcode[i], LV_BTN_STATE_REL, &bmp_pic);
429 426
           lv_imgbtn_set_src(buttonGcode[i], LV_BTN_STATE_PR, &bmp_pic);
430 427
           if (i < 3)
@@ -433,27 +430,38 @@ void disp_gcode_icon(uint8_t file_num) {
433 430
             lv_obj_set_pos(buttonGcode[i], BTN_X_PIXEL * (i - 3) + INTERVAL_V * ((i - 3) + 1), BTN_Y_PIXEL + INTERVAL_H + titleHeight);
434 431
 
435 432
           labelPageUp[i] = lv_label_create(buttonGcode[i], NULL);
436
-          lv_obj_set_style(labelPageUp[i], &tft_style_lable_rel);
433
+          lv_obj_set_style(labelPageUp[i], &tft_style_label_rel);
437 434
           lv_label_set_text(labelPageUp[i], public_buf_m);
438 435
           lv_obj_align(labelPageUp[i], buttonGcode[i], LV_ALIGN_IN_BOTTOM_MID, 0, -5);
439 436
         }
440 437
       }
441
-    #else // ifdef TFT35
442
-    #endif // ifdef TFT35
438
+    #else // !TFT35
439
+    #endif // !TFT35
443 440
   }
444 441
 }
445 442
 
446 443
 void lv_open_gcode_file(char *path) {
447 444
   #if ENABLED(SDSUPPORT)
445
+    uint32_t *ps4;
446
+    int pre_sread_cnt;
448 447
     char *cur_name;
448
+
449 449
     cur_name = strrchr(path, '/');
450
+
450 451
     card.openFileRead(cur_name);
451
-  #endif
452
+    card.read(public_buf, 512);
453
+    ps4 = (uint32_t *)strstr((char *)public_buf, ";simage:");
454
+    // Ignore the beginning message of gcode file
455
+    if (ps4) {
456
+      pre_sread_cnt = (uint32_t)ps4 - (uint32_t)((uint32_t *)(&public_buf[0]));
457
+      card.setIndex(pre_sread_cnt);
458
+    }
459
+  #endif // SDSUPPORT
452 460
 }
453 461
 
462
+
454 463
 int ascii2dec_test(char *ascii) {
455 464
   int result = 0;
456
-
457 465
   if (ascii == 0) return 0;
458 466
 
459 467
   if (*(ascii) >= '0' && *(ascii) <= '9')
@@ -468,64 +476,58 @@ int ascii2dec_test(char *ascii) {
468 476
   return result;
469 477
 }
470 478
 
471
-void lv_gcode_file_read(uint8_t *data_buf)
472
-{
473
-	#if ENABLED (SDSUPPORT)
474
-    uint16_t i=0,j=0,k=0;
475
-    uint16_t row_1=0;
479
+void lv_gcode_file_read(uint8_t *data_buf) {
480
+  #if ENABLED(SDSUPPORT)
481
+    uint16_t i = 0, j = 0, k = 0;
482
+    uint16_t row_1    = 0;
476 483
     bool ignore_start = true;
477 484
     char temp_test[200];
478 485
     volatile uint16_t *p_index;
479 486
 
480 487
     memset(public_buf, 0, 200);
481 488
 
482
-    while(card.isFileOpen())
483
-    {
484
-      if (ignore_start) card.read(temp_test, 8); //line start -> ignore
485
-      card.read(temp_test, 200); //data
486
-      //\r;;gimage: we got the bit img, so stop here
489
+    while (card.isFileOpen()) {
490
+      if (ignore_start) card.read(temp_test, 8); // line start -> ignore
491
+      card.read(temp_test, 200); // data
492
+      // \r;;gimage: we got the bit img, so stop here
487 493
       if (temp_test[1] == ';') {
488 494
         card.closefile();
489 495
         break;
490 496
       }
491
-      for(i=0;i<200;) {
492
-        public_buf[row_1*200+100*k+j] = (char)(ascii2dec_test(&temp_test[i])<<4|ascii2dec_test(&temp_test[i+1]));
497
+      for (i = 0; i < 200;) {
498
+        public_buf[row_1 * 200 + 100 * k + j] = (char)(ascii2dec_test(&temp_test[i]) << 4 | ascii2dec_test(&temp_test[i + 1]));
493 499
         j++;
494
-        i+=2;
500
+        i += 2;
495 501
       }
496 502
 
497 503
       uint16_t c = card.get();
498
-      //check if we have more data or finished the line (CR)
499
-      if (c == '\r') {
500
-        break;
501
-      }
504
+      // check if we have more data or finished the line (CR)
505
+      if (c == '\r') break;
502 506
       card.setIndex(card.getIndex());
503 507
       k++;
504
-      j=0;
508
+      j = 0;
505 509
       ignore_start = false;
506 510
     }
507
-    #if ENABLED(SPI_GRAPHICAL_TFT)
508
-      for(i=0;i<200;)
509
-      {
511
+    #if ENABLED(TFT_LVGL_UI_SPI)
512
+      for (i = 0; i < 200;) {
510 513
         p_index = (uint16_t *)(&public_buf[i]);
511 514
 
512
-            //Color = (*p_index >> 8);
515
+        //Color = (*p_index >> 8);
513 516
         //*p_index = Color | ((*p_index & 0xff) << 8);
514
-        i+=2;
515
-        if(*p_index == 0x0000)*p_index=LV_COLOR_BACKGROUND.full;
517
+        i += 2;
518
+        if (*p_index == 0x0000) *p_index = LV_COLOR_BACKGROUND.full;
516 519
       }
517 520
     #else
518
-      for(i=0;i<200;)
519
-      {
521
+      for (i = 0; i < 200;) {
520 522
         p_index = (uint16_t *)(&public_buf[i]);
521 523
         //Color = (*p_index >> 8);
522 524
         //*p_index = Color | ((*p_index & 0xff) << 8);
523
-        i+=2;
524
-        if(*p_index == 0x0000)*p_index=LV_COLOR_BACKGROUND.full; // 0x18C3; //
525
+        i += 2;
526
+        if (*p_index == 0x0000) *p_index = LV_COLOR_BACKGROUND.full; // 0x18C3; //
525 527
       }
526
-    #endif
527
-    memcpy(data_buf,public_buf,200);
528
-	#endif
528
+    #endif // TFT_LVGL_UI_SPI
529
+    memcpy(data_buf, public_buf, 200);
530
+  #endif // SDSUPPORT
529 531
 }
530 532
 
531 533
 void lv_close_gcode_file() {TERN_(SDSUPPORT, card.closefile());}
@@ -534,7 +536,7 @@ void cutFileName(char *path, int len, int bytePerLine,  char *outStr) {
534 536
   #if _LFN_UNICODE
535 537
     TCHAR *tmpFile;
536 538
     TCHAR *strIndex1 = 0, *strIndex2 = 0, *beginIndex;
537
-    TCHAR secSeg[10] = {0};
539
+    TCHAR secSeg[10]   = {0};
538 540
     TCHAR gFileTail[4] = {'~', '.', 'g', '\0'};
539 541
   #else
540 542
     char *tmpFile;
@@ -570,7 +572,7 @@ void cutFileName(char *path, int len, int bytePerLine,  char *outStr) {
570 572
         strcpy(outStr, beginIndex);
571 573
     #endif
572 574
   }
573
-  else { //gcode file
575
+  else { // gcode file
574 576
     if (strIndex2 - beginIndex > (len - 2)) {
575 577
       #if _LFN_UNICODE
576 578
         wcsncpy(outStr, (const WCHAR *)beginIndex, len - 3);
@@ -578,7 +580,7 @@ void cutFileName(char *path, int len, int bytePerLine,  char *outStr) {
578 580
       #else
579 581
         //strncpy(outStr, beginIndex, len - 3);
580 582
         strncpy(outStr, beginIndex, len - 4);
581
-        strcat(outStr, "~.g");
583
+        strcat_P(outStr, PSTR("~.g"));
582 584
       #endif
583 585
     }
584 586
     else {
@@ -587,7 +589,7 @@ void cutFileName(char *path, int len, int bytePerLine,  char *outStr) {
587 589
         wcscat(outStr, (const WCHAR *)&gFileTail[3]);
588 590
       #else
589 591
         strncpy(outStr, beginIndex, strIndex2 - beginIndex + 1);
590
-        strcat(outStr, "g");
592
+        strcat_P(outStr, PSTR("g"));
591 593
       #endif
592 594
     }
593 595
   }
@@ -595,23 +597,23 @@ void cutFileName(char *path, int len, int bytePerLine,  char *outStr) {
595 597
   #if _LFN_UNICODE
596 598
     if (wcslen(outStr) > bytePerLine) {
597 599
       wcscpy(secSeg, (const WCHAR *)&outStr[bytePerLine]);
598
-      outStr[bytePerLine] = '\n';
600
+      outStr[bytePerLine]     = '\n';
599 601
       outStr[bytePerLine + 1] = '\0';
600 602
       wcscat(outStr, (const WCHAR *)secSeg);
601 603
     }
602 604
   #else
603 605
     if ((int)strlen(outStr) > bytePerLine) {
604 606
       strcpy(secSeg, &outStr[bytePerLine]);
605
-      outStr[bytePerLine] = '\n';
607
+      outStr[bytePerLine]     = '\n';
606 608
       outStr[bytePerLine + 1] = '\0';
607 609
       strcat(outStr, secSeg);
608 610
     }
609 611
     else {
610
-      strcat(outStr, "\n");
612
+      strcat_P(outStr, PSTR("\n"));
611 613
     }
612 614
   #endif
613 615
 }
614 616
 
615 617
 void lv_clear_print_file() { lv_obj_del(scr); }
616 618
 
617
-#endif // TFT_LVGL_UI
619
+#endif // HAS_TFT_LVGL_UI

+ 112
- 112
Marlin/src/lcd/extui/lib/mks_ui/draw_printing.cpp View File

@@ -21,7 +21,7 @@
21 21
  */
22 22
 #include "../../../../inc/MarlinConfigPre.h"
23 23
 
24
-#if ENABLED(TFT_LVGL_UI)
24
+#if HAS_TFT_LVGL_UI
25 25
 
26 26
 #include "lv_conf.h"
27 27
 #include "draw_ui.h"
@@ -53,7 +53,7 @@ static lv_obj_t * buttonPause, *buttonOperat, *buttonStop;
53 53
   static lv_obj_t* labelBed;
54 54
 #endif
55 55
 
56
-#define ID_PAUSE    1
56
+#define ID_PAUSE  1
57 57
 #define ID_STOP   2
58 58
 #define ID_OPTION 3
59 59
 
@@ -74,36 +74,36 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
74 74
       else if (event == LV_EVENT_RELEASED) {
75 75
         if (gcode_preview_over != 1) {
76 76
           if (uiCfg.print_state == WORKING) {
77
-            //#if ENABLED(PARK_HEAD_ON_PAUSE)
78
-            //queue.inject_P(PSTR("M25 P\nM24"));
77
+            // #if ENABLED(PARK_HEAD_ON_PAUSE)
78
+            // queue.inject_P(PSTR("M25 P\nM24"));
79 79
             #if ENABLED(SDSUPPORT)
80
-              //queue.inject_P(PSTR("M25\nG91\nG1 Z10\nG90"));
80
+              // queue.inject_P(PSTR("M25\nG91\nG1 Z10\nG90"));
81 81
               card.pauseSDPrint();
82 82
               stop_print_time();
83 83
               uiCfg.print_state = PAUSING;
84 84
             #endif
85
-            lv_obj_set_event_cb_mks(buttonPause, event_handler, ID_PAUSE, "bmp_Pause.bin", 0);
85
+            lv_obj_set_event_cb_mks(buttonPause, event_handler, ID_PAUSE, "bmp_resume.bin", 0);
86 86
             lv_label_set_text(labelPause, printing_menu.resume);
87 87
             lv_obj_align(labelPause, buttonPause, LV_ALIGN_CENTER, 30, 0);
88 88
           }
89 89
           else if (uiCfg.print_state == PAUSED) {
90 90
             uiCfg.print_state = RESUMING;
91
-            //if (IS_SD_PAUSED())queue.inject_P(PSTR("M24"));// queue.inject_P(M24_STR);
92
-            lv_obj_set_event_cb_mks(obj, event_handler, ID_PAUSE, "bmp_Resume.bin", 0);
91
+            // if (IS_SD_PAUSED())queue.inject_P(PSTR("M24"));// queue.inject_P(M24_STR);
92
+            lv_obj_set_event_cb_mks(obj, event_handler, ID_PAUSE, "bmp_pause.bin", 0);
93 93
             lv_label_set_text(labelPause, printing_menu.pause);
94 94
             lv_obj_align(labelPause, buttonPause, LV_ALIGN_CENTER, 30, 0);
95 95
           }
96 96
           #if ENABLED(POWER_LOSS_RECOVERY)
97
-          else if (uiCfg.print_state == REPRINTING) {
98
-            uiCfg.print_state = REPRINTED;
99
-            lv_obj_set_event_cb_mks(obj, event_handler, ID_PAUSE, "bmp_Resume.bin", 0);
100
-            lv_label_set_text(labelPause, printing_menu.pause);
101
-            lv_obj_align(labelPause, buttonPause, LV_ALIGN_CENTER, 30, 0);
102
-            //recovery.resume();
103
-            print_time.minutes = recovery.info.print_job_elapsed / 60;
104
-            print_time.seconds = recovery.info.print_job_elapsed % 60;
105
-            print_time.hours = print_time.minutes / 60;
106
-          }
97
+            else if (uiCfg.print_state == REPRINTING) {
98
+              uiCfg.print_state = REPRINTED;
99
+              lv_obj_set_event_cb_mks(obj, event_handler, ID_PAUSE, "bmp_pause.bin", 0);
100
+              lv_label_set_text(labelPause, printing_menu.pause);
101
+              lv_obj_align(labelPause, buttonPause, LV_ALIGN_CENTER, 30, 0);
102
+              // recovery.resume();
103
+              print_time.minutes = recovery.info.print_job_elapsed / 60;
104
+              print_time.seconds = recovery.info.print_job_elapsed % 60;
105
+              print_time.hours   = print_time.minutes / 60;
106
+            }
107 107
           #endif
108 108
         }
109 109
       }
@@ -127,7 +127,7 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
127 127
       else if (event == LV_EVENT_RELEASED) {
128 128
         if (gcode_preview_over != 1) {
129 129
           lv_obj_del(scr);
130
-          lv_draw_opration();
130
+          lv_draw_operation();
131 131
         }
132 132
       }
133 133
       break;
@@ -146,14 +146,14 @@ void lv_draw_printing(void) {
146 146
 
147 147
   scr = lv_obj_create(NULL, NULL);
148 148
 
149
-  //static lv_style_t tool_style;
149
+  // static lv_style_t tool_style;
150 150
 
151 151
   lv_obj_set_style(scr, &tft_style_scr);
152 152
   lv_scr_load(scr);
153 153
   lv_obj_clean(scr);
154 154
 
155 155
   lv_obj_t * title = lv_label_create(scr, NULL);
156
-  lv_obj_set_style(title, &tft_style_lable_rel);
156
+  lv_obj_set_style(title, &tft_style_label_rel);
157 157
   lv_obj_set_pos(title, TITLE_XPOS, TITLE_YPOS);
158 158
   lv_label_set_text(title, creat_title_text());
159 159
 
@@ -172,74 +172,74 @@ void lv_draw_printing(void) {
172 172
   #endif
173 173
 
174 174
   buttonFanstate = lv_imgbtn_create(scr, NULL);
175
-  buttonZpos = lv_imgbtn_create(scr, NULL);
176
-  buttonPause = lv_imgbtn_create(scr, NULL);
177
-  buttonStop = lv_imgbtn_create(scr, NULL);
178
-  buttonOperat = lv_imgbtn_create(scr, NULL);
179
-  buttonTime = lv_imgbtn_create(scr, NULL);
175
+  buttonZpos     = lv_imgbtn_create(scr, NULL);
176
+  buttonPause    = lv_imgbtn_create(scr, NULL);
177
+  buttonStop     = lv_imgbtn_create(scr, NULL);
178
+  buttonOperat   = lv_imgbtn_create(scr, NULL);
179
+  buttonTime     = lv_imgbtn_create(scr, NULL);
180 180
 
181
-  lv_obj_set_event_cb_mks(buttonExt1, event_handler, 0, "bmp_Ext1_state.bin", 0);
181
+  lv_obj_set_event_cb_mks(buttonExt1, event_handler, 0, "bmp_ext1_state.bin", 0);
182 182
   lv_imgbtn_set_src(buttonExt1, LV_BTN_STATE_REL, &bmp_pic_45x45);
183 183
   lv_imgbtn_set_src(buttonExt1, LV_BTN_STATE_PR, &bmp_pic_45x45);
184
-  lv_imgbtn_set_style(buttonExt1, LV_BTN_STATE_PR, &tft_style_lable_pre);
185
-  lv_imgbtn_set_style(buttonExt1, LV_BTN_STATE_REL, &tft_style_lable_rel);
184
+  lv_imgbtn_set_style(buttonExt1, LV_BTN_STATE_PR, &tft_style_label_pre);
185
+  lv_imgbtn_set_style(buttonExt1, LV_BTN_STATE_REL, &tft_style_label_rel);
186 186
   lv_obj_clear_protect(buttonExt1, LV_PROTECT_FOLLOW);
187 187
   #if 1
188
-  if (EXTRUDERS == 2) {
189
-    lv_obj_set_event_cb_mks(buttonExt2, event_handler, 0, "bmp_Ext2_state.bin", 0);
190
-    lv_imgbtn_set_src(buttonExt2, LV_BTN_STATE_REL, &bmp_pic_45x45);
191
-    lv_imgbtn_set_src(buttonExt2, LV_BTN_STATE_PR, &bmp_pic_45x45);
192
-    lv_imgbtn_set_style(buttonExt2, LV_BTN_STATE_PR, &tft_style_lable_pre);
193
-    lv_imgbtn_set_style(buttonExt2, LV_BTN_STATE_REL, &tft_style_lable_rel);
194
-  }
195
-  #if HAS_HEATED_BED
196
-    lv_obj_set_event_cb_mks(buttonBedstate, event_handler, 0, "bmp_Bed_state.bin", 0);
197
-    lv_imgbtn_set_src(buttonBedstate, LV_BTN_STATE_REL, &bmp_pic_45x45);
198
-    lv_imgbtn_set_src(buttonBedstate, LV_BTN_STATE_PR, &bmp_pic_45x45);
199
-    lv_imgbtn_set_style(buttonBedstate, LV_BTN_STATE_PR, &tft_style_lable_pre);
200
-    lv_imgbtn_set_style(buttonBedstate, LV_BTN_STATE_REL, &tft_style_lable_rel);
201
-  #endif
188
+    if (EXTRUDERS == 2) {
189
+      lv_obj_set_event_cb_mks(buttonExt2, event_handler, 0, "bmp_ext2_state.bin", 0);
190
+      lv_imgbtn_set_src(buttonExt2, LV_BTN_STATE_REL, &bmp_pic_45x45);
191
+      lv_imgbtn_set_src(buttonExt2, LV_BTN_STATE_PR, &bmp_pic_45x45);
192
+      lv_imgbtn_set_style(buttonExt2, LV_BTN_STATE_PR, &tft_style_label_pre);
193
+      lv_imgbtn_set_style(buttonExt2, LV_BTN_STATE_REL, &tft_style_label_rel);
194
+    }
195
+    #if HAS_HEATED_BED
196
+      lv_obj_set_event_cb_mks(buttonBedstate, event_handler, 0, "bmp_bed_state.bin", 0);
197
+      lv_imgbtn_set_src(buttonBedstate, LV_BTN_STATE_REL, &bmp_pic_45x45);
198
+      lv_imgbtn_set_src(buttonBedstate, LV_BTN_STATE_PR, &bmp_pic_45x45);
199
+      lv_imgbtn_set_style(buttonBedstate, LV_BTN_STATE_PR, &tft_style_label_pre);
200
+      lv_imgbtn_set_style(buttonBedstate, LV_BTN_STATE_REL, &tft_style_label_rel);
201
+    #endif
202 202
 
203
-  lv_obj_set_event_cb_mks(buttonFanstate, event_handler, 0, "bmp_Fan_state.bin", 0);
204
-  lv_imgbtn_set_src(buttonFanstate, LV_BTN_STATE_REL, &bmp_pic_45x45);
205
-  lv_imgbtn_set_src(buttonFanstate, LV_BTN_STATE_PR, &bmp_pic_45x45);
206
-  lv_imgbtn_set_style(buttonFanstate, LV_BTN_STATE_PR, &tft_style_lable_pre);
207
-  lv_imgbtn_set_style(buttonFanstate, LV_BTN_STATE_REL, &tft_style_lable_rel);
208
-
209
-  lv_obj_set_event_cb_mks(buttonTime, event_handler, 0, "bmp_Time_state.bin", 0);
210
-  lv_imgbtn_set_src(buttonTime, LV_BTN_STATE_REL, &bmp_pic_45x45);
211
-  lv_imgbtn_set_src(buttonTime, LV_BTN_STATE_PR, &bmp_pic_45x45);
212
-  lv_imgbtn_set_style(buttonTime, LV_BTN_STATE_PR, &tft_style_lable_pre);
213
-  lv_imgbtn_set_style(buttonTime, LV_BTN_STATE_REL, &tft_style_lable_rel);
214
-
215
-  lv_obj_set_event_cb_mks(buttonZpos, event_handler, 0, "bmp_Zpos_state.bin", 0);
216
-  lv_imgbtn_set_src(buttonZpos, LV_BTN_STATE_REL, &bmp_pic_45x45);
217
-  lv_imgbtn_set_src(buttonZpos, LV_BTN_STATE_PR, &bmp_pic_45x45);
218
-  lv_imgbtn_set_style(buttonZpos, LV_BTN_STATE_PR, &tft_style_lable_pre);
219
-  lv_imgbtn_set_style(buttonZpos, LV_BTN_STATE_REL, &tft_style_lable_rel);
220
-
221
-  if (uiCfg.print_state == WORKING)
222
-    lv_obj_set_event_cb_mks(buttonPause, event_handler, ID_PAUSE, "bmp_Resume.bin", 0);
223
-  else
224
-    lv_obj_set_event_cb_mks(buttonPause, event_handler, ID_PAUSE, "bmp_Pause.bin", 0);
225
-
226
-  lv_imgbtn_set_src(buttonPause, LV_BTN_STATE_REL, &bmp_pic_150x80);
227
-  lv_imgbtn_set_src(buttonPause, LV_BTN_STATE_PR, &bmp_pic_150x80);
228
-  lv_imgbtn_set_style(buttonPause, LV_BTN_STATE_PR, &tft_style_lable_pre);
229
-  lv_imgbtn_set_style(buttonPause, LV_BTN_STATE_REL, &tft_style_lable_rel);
230
-
231
-  lv_obj_set_event_cb_mks(buttonStop, event_handler, ID_STOP, "bmp_Stop.bin", 0);
232
-  lv_imgbtn_set_src(buttonStop, LV_BTN_STATE_REL, &bmp_pic_150x80);
233
-  lv_imgbtn_set_src(buttonStop, LV_BTN_STATE_PR, &bmp_pic_150x80);
234
-  lv_imgbtn_set_style(buttonStop, LV_BTN_STATE_PR, &tft_style_lable_pre);
235
-  lv_imgbtn_set_style(buttonStop, LV_BTN_STATE_REL, &tft_style_lable_rel);
236
-
237
-  lv_obj_set_event_cb_mks(buttonOperat, event_handler, ID_OPTION, "bmp_Operate.bin", 0);
238
-  lv_imgbtn_set_src(buttonOperat, LV_BTN_STATE_REL, &bmp_pic_150x80);
239
-  lv_imgbtn_set_src(buttonOperat, LV_BTN_STATE_PR, &bmp_pic_150x80);
240
-  lv_imgbtn_set_style(buttonOperat, LV_BTN_STATE_PR, &tft_style_lable_pre);
241
-  lv_imgbtn_set_style(buttonOperat, LV_BTN_STATE_REL, &tft_style_lable_rel);
242
-  #endif
203
+    lv_obj_set_event_cb_mks(buttonFanstate, event_handler, 0, "bmp_fan_state.bin", 0);
204
+    lv_imgbtn_set_src(buttonFanstate, LV_BTN_STATE_REL, &bmp_pic_45x45);
205
+    lv_imgbtn_set_src(buttonFanstate, LV_BTN_STATE_PR, &bmp_pic_45x45);
206
+    lv_imgbtn_set_style(buttonFanstate, LV_BTN_STATE_PR, &tft_style_label_pre);
207
+    lv_imgbtn_set_style(buttonFanstate, LV_BTN_STATE_REL, &tft_style_label_rel);
208
+
209
+    lv_obj_set_event_cb_mks(buttonTime, event_handler, 0, "bmp_time_state.bin", 0);
210
+    lv_imgbtn_set_src(buttonTime, LV_BTN_STATE_REL, &bmp_pic_45x45);
211
+    lv_imgbtn_set_src(buttonTime, LV_BTN_STATE_PR, &bmp_pic_45x45);
212
+    lv_imgbtn_set_style(buttonTime, LV_BTN_STATE_PR, &tft_style_label_pre);
213
+    lv_imgbtn_set_style(buttonTime, LV_BTN_STATE_REL, &tft_style_label_rel);
214
+
215
+    lv_obj_set_event_cb_mks(buttonZpos, event_handler, 0, "bmp_zpos_state.bin", 0);
216
+    lv_imgbtn_set_src(buttonZpos, LV_BTN_STATE_REL, &bmp_pic_45x45);
217
+    lv_imgbtn_set_src(buttonZpos, LV_BTN_STATE_PR, &bmp_pic_45x45);
218
+    lv_imgbtn_set_style(buttonZpos, LV_BTN_STATE_PR, &tft_style_label_pre);
219
+    lv_imgbtn_set_style(buttonZpos, LV_BTN_STATE_REL, &tft_style_label_rel);
220
+
221
+    if (uiCfg.print_state == WORKING)
222
+      lv_obj_set_event_cb_mks(buttonPause, event_handler, ID_PAUSE, "bmp_pause.bin", 0);
223
+    else
224
+      lv_obj_set_event_cb_mks(buttonPause, event_handler, ID_PAUSE, "bmp_resume.bin", 0);
225
+
226
+    lv_imgbtn_set_src(buttonPause, LV_BTN_STATE_REL, &bmp_pic_150x80);
227
+    lv_imgbtn_set_src(buttonPause, LV_BTN_STATE_PR, &bmp_pic_150x80);
228
+    lv_imgbtn_set_style(buttonPause, LV_BTN_STATE_PR, &tft_style_label_pre);
229
+    lv_imgbtn_set_style(buttonPause, LV_BTN_STATE_REL, &tft_style_label_rel);
230
+
231
+    lv_obj_set_event_cb_mks(buttonStop, event_handler, ID_STOP, "bmp_stop.bin", 0);
232
+    lv_imgbtn_set_src(buttonStop, LV_BTN_STATE_REL, &bmp_pic_150x80);
233
+    lv_imgbtn_set_src(buttonStop, LV_BTN_STATE_PR, &bmp_pic_150x80);
234
+    lv_imgbtn_set_style(buttonStop, LV_BTN_STATE_PR, &tft_style_label_pre);
235
+    lv_imgbtn_set_style(buttonStop, LV_BTN_STATE_REL, &tft_style_label_rel);
236
+
237
+    lv_obj_set_event_cb_mks(buttonOperat, event_handler, ID_OPTION, "bmp_operate.bin", 0);
238
+    lv_imgbtn_set_src(buttonOperat, LV_BTN_STATE_REL, &bmp_pic_150x80);
239
+    lv_imgbtn_set_src(buttonOperat, LV_BTN_STATE_PR, &bmp_pic_150x80);
240
+    lv_imgbtn_set_style(buttonOperat, LV_BTN_STATE_PR, &tft_style_label_pre);
241
+    lv_imgbtn_set_style(buttonOperat, LV_BTN_STATE_REL, &tft_style_label_rel);
242
+  #endif // if 1
243 243
 
244 244
   lv_obj_set_pos(buttonExt1, 205, 136);
245 245
   if (EXTRUDERS == 2)
@@ -272,35 +272,35 @@ void lv_draw_printing(void) {
272 272
   lv_btn_set_layout(buttonOperat, LV_LAYOUT_OFF);
273 273
 
274 274
   labelExt1 = lv_label_create(scr, NULL);
275
-  lv_obj_set_style(labelExt1, &tft_style_lable_rel);
275
+  lv_obj_set_style(labelExt1, &tft_style_label_rel);
276 276
   lv_obj_set_pos(labelExt1, 250, 146);
277 277
 
278 278
   if (EXTRUDERS == 2) {
279 279
     labelExt2 = lv_label_create(scr, NULL);
280
-    lv_obj_set_style(labelExt2, &tft_style_lable_rel);
280
+    lv_obj_set_style(labelExt2, &tft_style_label_rel);
281 281
     lv_obj_set_pos(labelExt2, 395, 146);
282 282
   }
283 283
 
284 284
   #if HAS_HEATED_BED
285 285
     labelBed = lv_label_create(scr, NULL);
286
-    lv_obj_set_style(labelBed, &tft_style_lable_rel);
286
+    lv_obj_set_style(labelBed, &tft_style_label_rel);
287 287
     lv_obj_set_pos(labelBed, 250, 196);
288 288
   #endif
289 289
 
290 290
   labelFan = lv_label_create(scr, NULL);
291
-  lv_obj_set_style(labelFan, &tft_style_lable_rel);
291
+  lv_obj_set_style(labelFan, &tft_style_label_rel);
292 292
   lv_obj_set_pos(labelFan, 395, 196);
293 293
 
294 294
   labelZpos = lv_label_create(scr, NULL);
295
-  lv_obj_set_style(labelZpos, &tft_style_lable_rel);
295
+  lv_obj_set_style(labelZpos, &tft_style_label_rel);
296 296
   lv_obj_set_pos(labelZpos, 395, 96);
297 297
 
298 298
   labelTime = lv_label_create(scr, NULL);
299
-  lv_obj_set_style(labelTime, &tft_style_lable_rel);
299
+  lv_obj_set_style(labelTime, &tft_style_label_rel);
300 300
   lv_obj_set_pos(labelTime, 250, 96);
301 301
 
302
-  labelPause = lv_label_create(buttonPause, NULL);
303
-  labelStop = lv_label_create(buttonStop, NULL);
302
+  labelPause  = lv_label_create(buttonPause, NULL);
303
+  labelStop   = lv_label_create(buttonStop, NULL);
304 304
   labelOperat = lv_label_create(buttonOperat, NULL);
305 305
 
306 306
   if (gCfgItems.multiple_language != 0) {
@@ -318,11 +318,11 @@ void lv_draw_printing(void) {
318 318
   }
319 319
 
320 320
   lv_style_copy(&lv_bar_style_indic, &lv_style_pretty_color);
321
-  lv_bar_style_indic.text.color = lv_color_hex3(0xADF);
322
-  lv_bar_style_indic.image.color = lv_color_hex3(0xADF);
323
-  lv_bar_style_indic.line.color = lv_color_hex3(0xADF);
324
-  lv_bar_style_indic.body.main_color = lv_color_hex3(0xADF);
325
-  lv_bar_style_indic.body.grad_color = lv_color_hex3(0xADF);
321
+  lv_bar_style_indic.text.color        = lv_color_hex3(0xADF);
322
+  lv_bar_style_indic.image.color       = lv_color_hex3(0xADF);
323
+  lv_bar_style_indic.line.color        = lv_color_hex3(0xADF);
324
+  lv_bar_style_indic.body.main_color   = lv_color_hex3(0xADF);
325
+  lv_bar_style_indic.body.grad_color   = lv_color_hex3(0xADF);
326 326
   lv_bar_style_indic.body.border.color = lv_color_hex3(0xADF);
327 327
 
328 328
   bar1 = lv_bar_create(scr, NULL);
@@ -340,12 +340,12 @@ void lv_draw_printing(void) {
340 340
 }
341 341
 
342 342
 void disp_ext_temp() {
343
-  memset(public_buf_l, 0, sizeof(public_buf_l));
343
+  ZERO(public_buf_l);
344 344
   sprintf(public_buf_l, printing_menu.temp1, (int)thermalManager.temp_hotend[0].celsius, (int)thermalManager.temp_hotend[0].target);
345 345
   lv_label_set_text(labelExt1, public_buf_l);
346 346
 
347 347
   if (EXTRUDERS == 2) {
348
-    memset(public_buf_l, 0, sizeof(public_buf_l));
348
+    ZERO(public_buf_l);
349 349
     sprintf(public_buf_l, printing_menu.temp1, (int)thermalManager.temp_hotend[1].celsius, (int)thermalManager.temp_hotend[1].target);
350 350
     lv_label_set_text(labelExt2, public_buf_l);
351 351
   }
@@ -353,42 +353,42 @@ void disp_ext_temp() {
353 353
 
354 354
 void disp_bed_temp() {
355 355
   #if HAS_HEATED_BED
356
-    memset(public_buf_l, 0, sizeof(public_buf_l));
356
+    ZERO(public_buf_l);
357 357
     sprintf(public_buf_l, printing_menu.bed_temp, (int)thermalManager.temp_bed.celsius, (int)thermalManager.temp_bed.target);
358 358
     lv_label_set_text(labelBed, public_buf_l);
359 359
   #endif
360 360
 }
361 361
 
362 362
 void disp_fan_speed() {
363
-  memset(public_buf_l, 0, sizeof(public_buf_l));
364
-  sprintf(public_buf_l, "%3d", thermalManager.fan_speed[0]);
363
+  ZERO(public_buf_l);
364
+  sprintf_P(public_buf_l, PSTR("%3d"), thermalManager.fan_speed[0]);
365 365
   lv_label_set_text(labelFan, public_buf_l);
366 366
 }
367 367
 
368 368
 void disp_print_time() {
369
-  memset(public_buf_l, 0, sizeof(public_buf_l));
369
+  ZERO(public_buf_l);
370 370
   #if BOTH(LCD_SET_PROGRESS_MANUALLY, USE_M73_REMAINING_TIME)
371 371
     const uint32_t r = ui.get_remaining_time();
372
-    sprintf(public_buf_l, "%02d:%02d R", r / 3600, (r % 3600) / 60);
372
+    sprintf_P(public_buf_l, PSTR("%02d:%02d R"), r / 3600, (r % 3600) / 60);
373 373
   #else
374
-    sprintf(public_buf_l, "%d%d:%d%d:%d%d", print_time.hours / 10, print_time.hours % 10, print_time.minutes / 10, print_time.minutes % 10, print_time.seconds / 10, print_time.seconds % 10);
374
+    sprintf_P(public_buf_l, PSTR("%d%d:%d%d:%d%d"), print_time.hours / 10, print_time.hours % 10, print_time.minutes / 10, print_time.minutes % 10, print_time.seconds / 10, print_time.seconds % 10);
375 375
   #endif
376 376
   lv_label_set_text(labelTime, public_buf_l);
377 377
 }
378 378
 
379 379
 void disp_fan_Zpos() {
380
-  memset(public_buf_l, 0, sizeof(public_buf_l));
381
-  sprintf(public_buf_l, "%.3f", current_position[Z_AXIS]);
380
+  ZERO(public_buf_l);
381
+  sprintf_P(public_buf_l, PSTR("%.3f"), current_position[Z_AXIS]);
382 382
   lv_label_set_text(labelZpos, public_buf_l);
383 383
 }
384 384
 
385 385
 void reset_print_time() {
386
-  //print_time.days = 0;
387
-  print_time.hours = 0;
386
+  // print_time.days = 0;
387
+  print_time.hours   = 0;
388 388
   print_time.minutes = 0;
389 389
   print_time.seconds = 0;
390
-  print_time.ms_10 = 0;
391
-  //print_time.start = 1;
390
+  print_time.ms_10   = 0;
391
+  // print_time.start = 1;
392 392
 }
393 393
 
394 394
 void start_print_time() { print_time.start = 1; }
@@ -411,7 +411,7 @@ void setProBarRate() {
411 411
     #endif
412 412
     rate = (rate_tmp_r - (PREVIEW_SIZE + To_pre_view)) * 100 / (gCfgItems.curFilesize - (PREVIEW_SIZE + To_pre_view));
413 413
   }
414
-  //gCurFileState.totalSend = rate;
414
+  // gCurFileState.totalSend = rate;
415 415
 
416 416
   if (rate <= 0) return;
417 417
 
@@ -440,4 +440,4 @@ void setProBarRate() {
440 440
 
441 441
 void lv_clear_printing() { lv_obj_del(scr); }
442 442
 
443
-#endif // TFT_LVGL_UI
443
+#endif // HAS_TFT_LVGL_UI

+ 179
- 162
Marlin/src/lcd/extui/lib/mks_ui/draw_ready_print.cpp View File

@@ -21,12 +21,11 @@
21 21
  */
22 22
 #include "../../../../inc/MarlinConfigPre.h"
23 23
 
24
-#if ENABLED(TFT_LVGL_UI)
24
+#if HAS_TFT_LVGL_UI
25 25
 
26 26
 #include "draw_ready_print.h"
27 27
 #include "draw_tool.h"
28 28
 #include "lv_conf.h"
29
-#include "lvgl.h"
30 29
 //#include "../lvgl/src/lv_objx/lv_imgbtn.h"
31 30
 //#include "../lvgl/src/lv_objx/lv_img.h"
32 31
 //#include "../lvgl/src/lv_core/lv_disp.h"
@@ -35,11 +34,13 @@
35 34
 #include "mks_hardware_test.h"
36 35
 #include "draw_ui.h"
37 36
 
38
-#include <stdio.h>
37
+#include <lvgl.h>
39 38
 
40 39
 #include "../../../../MarlinCore.h"
41 40
 #include "../../../../module/temperature.h"
42 41
 
42
+#include <stdio.h>
43
+
43 44
 //static lv_obj_t *buttonPrint,*buttonTool,*buttonSet;
44 45
 static lv_obj_t * scr;
45 46
 #if ENABLED(MKS_TEST)
@@ -57,9 +58,7 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
57 58
         // nothing to do
58 59
       }
59 60
       else if (event == LV_EVENT_RELEASED) {
60
-        #if ENABLED(MKS_TEST)
61
-          curent_disp_ui = 2;
62
-        #endif
61
+
63 62
         lv_obj_del(scr);
64 63
         lv_draw_tool();
65 64
       }
@@ -85,203 +84,222 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
85 84
   }
86 85
 }
87 86
 
87
+lv_obj_t *limit_info, *det_info;
88
+lv_style_t limit_style, det_style;
89
+void disp_Limit_ok() {
90
+  limit_style.text.color.full = 0xFFFF;
91
+  lv_obj_set_style(limit_info, &limit_style);
92
+  lv_label_set_text(limit_info, "Limit:ok");
93
+}
94
+void disp_Limit_error() {
95
+  limit_style.text.color.full = 0xF800;
96
+  lv_obj_set_style(limit_info, &limit_style);
97
+  lv_label_set_text(limit_info, "Limit:error");
98
+}
88 99
 
89
-#if ENABLED(MKS_TEST)
90
-
91
-  lv_obj_t *limit_info, *det_info;
92
-  lv_style_t limit_style, det_style;
93
-  void disp_Limit_ok() {
94
-    limit_style.text.color.full = 0xFFFF;
95
-    lv_obj_set_style(limit_info, &limit_style);
96
-    lv_label_set_text(limit_info, "Limit:ok");
97
-  }
98
-  void disp_Limit_error() {
99
-    limit_style.text.color.full = 0xF800;
100
-    lv_obj_set_style(limit_info, &limit_style);
101
-    lv_label_set_text(limit_info, "Limit:error");
102
-  }
103
-
104
-  void disp_det_ok() {
105
-    det_style.text.color.full = 0xFFFF;
106
-    lv_obj_set_style(det_info, &det_style);
107
-    lv_label_set_text(det_info, "det:ok");
108
-  }
109
-  void disp_det_error() {
110
-    det_style.text.color.full = 0xF800;
111
-    lv_obj_set_style(det_info, &det_style);
112
-    lv_label_set_text(det_info, "det:error");
113
-  }
100
+void disp_det_ok() {
101
+  det_style.text.color.full = 0xFFFF;
102
+  lv_obj_set_style(det_info, &det_style);
103
+  lv_label_set_text(det_info, "det:ok");
104
+}
105
+void disp_det_error() {
106
+  det_style.text.color.full = 0xF800;
107
+  lv_obj_set_style(det_info, &det_style);
108
+  lv_label_set_text(det_info, "det:error");
109
+}
114 110
 
115
-  lv_obj_t *e1, *e2, *e3, *bed;
116
-  void disp_test() {
117
-    char buf[30] = {0};
118
-    //lv_obj_t * label_tool2 = lv_label_create(scr, NULL);
119
-    //lv_obj_set_pos(label_tool,20,50);
120
-    memset(buf, 0, sizeof(buf));
121
-    sprintf(buf, "e1:%d", (int)thermalManager.temp_hotend[0].celsius);
122
-    lv_label_set_text(e1, buf);
123
-
124
-    memset(buf, 0, sizeof(buf));
125
-    sprintf(buf, "e2:%d", (int)thermalManager.temp_hotend[1].celsius);
111
+lv_obj_t *e1, *e2, *e3, *bed;
112
+void mks_disp_test() {
113
+  char buf[30] = {0};
114
+  //lv_obj_t * label_tool2 = lv_label_create(scr, NULL);
115
+  //lv_obj_set_pos(label_tool,20,50);
116
+  ZERO(buf);
117
+  sprintf_P(buf, PSTR("e1:%d"), (int)thermalManager.temp_hotend[0].celsius);
118
+  lv_label_set_text(e1, buf);
119
+  #if HAS_MULTI_HOTEND
120
+    ZERO(buf);
121
+    sprintf_P(buf, PSTR("e2:%d"), (int)thermalManager.temp_hotend[1].celsius);
126 122
     lv_label_set_text(e2, buf);
127
-
128
-    memset(buf, 0, sizeof(buf));
129
-    sprintf(buf, "e3:%d", (int)thermalManager.temp_hotend[2].celsius);
130
-    lv_label_set_text(e3, buf);
131
-
132
-    memset(buf, 0, sizeof(buf));
133
-    sprintf(buf, "bed:%d", (int)thermalManager.temp_bed.celsius);
123
+  #endif
124
+
125
+  //ZERO(buf);
126
+  //sprintf_P(buf, PSTR("e3:%d"), (int)thermalManager.temp_hotend[2].celsius);
127
+  //lv_label_set_text(e3, buf);
128
+  #if HAS_HEATED_BED
129
+    ZERO(buf);
130
+    sprintf_P(buf, PSTR("bed:%d"), (int)thermalManager.temp_bed.celsius);
134 131
     lv_label_set_text(bed, buf);
135
-  }
136
-
137
-#endif // MKS_TEST
132
+  #endif
133
+}
138 134
 
135
+extern unsigned char bmp_public_buf[17 * 1024];
139 136
 void lv_draw_ready_print(void) {
140
-  #if ENABLED(MKS_TEST)
141
-    char buf[30] = {0};
142
-    lv_obj_t *buttonTool;
137
+  char buf[30] = {0};
138
+  lv_obj_t *buttonPrint, *buttonTool, *buttonSet;
143 139
 
144
-    static lv_style_t style_pr, style_rel;
140
+  disp_state_stack._disp_index = 0;
141
+  ZERO(disp_state_stack._disp_state);
142
+  disp_state_stack._disp_state[disp_state_stack._disp_index] = PRINT_READY_UI;
145 143
 
146
-    curent_disp_ui = 1;
144
+  disp_state = PRINT_READY_UI;
147 145
 
148
-    scr = lv_obj_create(NULL, NULL);
146
+  scr = lv_obj_create(NULL, NULL);
149 147
 
150
-    static lv_style_t ready_style;
148
+  lv_obj_set_style(scr, &tft_style_scr);
149
+  lv_scr_load(scr);
150
+  lv_obj_clean(scr);
151
+  //lv_obj_set_hidden(scr,true);
152
+  lv_refr_now(lv_refr_get_disp_refreshing());
151 153
 
152
-    lv_style_copy(&ready_style, &lv_style_scr);
153
-    //ready_style.body.main_color.full = 0X18C3;
154
-    //ready_style.body.grad_color.full = 0X18C3;
155
-    ready_style.body.main_color.full = 0X0000;
156
-    ready_style.body.grad_color.full = 0X0000;
157
-    ready_style.text.color.full = 0Xffff;
158
-    lv_obj_set_style(scr, &ready_style);
159
-    lv_scr_load(scr);
160
-    lv_obj_clean(scr);
161
-    //lv_obj_set_hidden(scr,true);
162
-    lv_refr_now(lv_refr_get_disp_refreshing());
154
+  LV_IMG_DECLARE(bmp_pic);
163 155
 
164
-    LV_IMG_DECLARE(bmp_pic);
165
-    //LV_IMG_DECLARE(bmp_pic2);
166
-    //LV_IMG_DECLARE(bmp_pic3);
167
-
168
-    //scr = lv_obj_create(NULL, NULL);
169
-    //lv_scr_load(scr);
156
+  if (mks_test_flag == 0x1e) {
157
+    //lv_obj_t * title = lv_label_create(scr, NULL);
158
+    //lv_obj_set_style(title, &tft_style_label_rel);
159
+    //lv_obj_set_pos(title,TITLE_XPOS,TITLE_YPOS);
160
+    //lv_label_set_text(title, creat_title_text());
170 161
 
171 162
     /*Create an Image button*/
163
+    //buttonPrint = lv_imgbtn_create(scr, NULL);
172 164
     buttonTool = lv_imgbtn_create(scr, NULL);
165
+    //buttonSet = lv_imgbtn_create(scr, NULL);
173 166
 
174
-    //lv_btn_setting(&style_pr,0x5d8f16,0x5d8f16);
175
-    //lv_btn_setting(&style_rel,0x5d8f16,0x5d8f16);
167
+    //lv_obj_set_event_cb_mks(buttonPrint, event_handler,ID_PRINT,"bmp_printing.bin",0);
168
+    //lv_imgbtn_set_src_mks(buttonPrint, LV_BTN_STATE_REL, &bmp_pic,(uint8_t *)"bmp_printing.bin");
169
+    //lv_imgbtn_set_src(buttonPrint, LV_BTN_STATE_REL, &bmp_pic);
170
+    //lv_imgbtn_set_src(buttonPrint, LV_BTN_STATE_PR, &bmp_pic);
171
+    //lv_imgbtn_set_style(buttonPrint, LV_BTN_STATE_PR, &tft_style_label_pre);
172
+    //lv_imgbtn_set_style(buttonPrint, LV_BTN_STATE_REL, &tft_style_label_rel);
173
+    //lv_obj_clear_protect(buttonPrint, LV_PROTECT_FOLLOW);
174
+
175
+    #if 1
176
+      //lv_obj_set_event_cb_mks(buttonSet, event_handler,ID_SET,"bmp_set.bin",0);
177
+      //lv_imgbtn_set_src_mks(buttonSet, LV_BTN_STATE_REL, &bmp_pic,(uint8_t *)"bmp_set.bin");
178
+      //lv_imgbtn_set_src(buttonSet, LV_BTN_STATE_REL, &bmp_pic);
179
+      //lv_imgbtn_set_src(buttonSet, LV_BTN_STATE_PR, &bmp_pic);
180
+      //lv_imgbtn_set_style(buttonSet, LV_BTN_STATE_PR, &tft_style_label_pre);
181
+      //lv_imgbtn_set_style(buttonSet, LV_BTN_STATE_REL, &tft_style_label_rel);
176 182
 
177
-    lv_obj_set_event_cb_mks(buttonTool, event_handler, 3, "bmp_Tool.bin", 0);
178
-    //lv_imgbtn_set_src_mks(buttonTool, LV_BTN_STATE_REL, &bmp_pic,(uint8_t *)"bmp_tool.bin");
179
-    lv_imgbtn_set_src(buttonTool, LV_BTN_STATE_REL, &bmp_pic);
180
-    lv_imgbtn_set_src(buttonTool, LV_BTN_STATE_PR, &bmp_pic);
181
-    lv_imgbtn_set_style(buttonTool, LV_BTN_STATE_PR, &style_pr);
182
-    lv_imgbtn_set_style(buttonTool, LV_BTN_STATE_REL, &style_rel);
183
+      lv_obj_set_event_cb_mks(buttonTool, event_handler, ID_TOOL, "bmp_tool.bin", 0);
184
+      //lv_imgbtn_set_src_mks(buttonTool, LV_BTN_STATE_REL, &bmp_pic,(uint8_t *)"bmp_tool.bin");
185
+      lv_imgbtn_set_src(buttonTool, LV_BTN_STATE_REL, &bmp_pic);
186
+      lv_imgbtn_set_src(buttonTool, LV_BTN_STATE_PR, &bmp_pic);
187
+      lv_imgbtn_set_style(buttonTool, LV_BTN_STATE_PR, &tft_style_label_pre);
188
+      lv_imgbtn_set_style(buttonTool, LV_BTN_STATE_REL, &tft_style_label_rel);
189
+    #endif
183 190
 
184 191
     lv_obj_set_pos(buttonTool, 360, 180);
192
+    //lv_obj_set_pos(buttonSet,180,90);
193
+    //lv_obj_set_pos(buttonPrint,340,90);
185 194
 
195
+    //lv_obj_set_pos(buttonTool,SIMPLE_FIRST_PAGE_GRAP+1,(TFT_HEIGHT-BTN_Y_PIXEL)/2+2);
196
+    //lv_obj_set_pos(buttonSet,BTN_X_PIXEL+SIMPLE_FIRST_PAGE_GRAP*2+1,(TFT_HEIGHT-BTN_Y_PIXEL)/2+2);
197
+    //lv_obj_set_pos(buttonPrint,BTN_X_PIXEL*2+SIMPLE_FIRST_PAGE_GRAP*3+1,(TFT_HEIGHT-BTN_Y_PIXEL)/2+2);
198
+
199
+    /*Create a label on the Image button*/
200
+    //lv_btn_set_layout(buttonPrint, LV_LAYOUT_OFF);
201
+    //lv_btn_set_layout(buttonSet, LV_LAYOUT_OFF);
186 202
     lv_btn_set_layout(buttonTool, LV_LAYOUT_OFF);
187 203
 
204
+    //lv_obj_t * label_print = lv_label_create(buttonPrint, NULL);
205
+    //lv_obj_t * label_set = lv_label_create(buttonSet, NULL);
188 206
     lv_obj_t * label_tool = lv_label_create(buttonTool, NULL);
207
+    if (gCfgItems.multiple_language != 0) {
208
+      //lv_label_set_text(label_print, main_menu.print);
209
+      //lv_obj_align(label_print, buttonPrint, LV_ALIGN_IN_BOTTOM_MID,0, BUTTON_TEXT_Y_OFFSET);
189 210
 
190
-    lv_obj_set_pos(label_tool, 30, 100);
191
-    lv_label_set_text(label_tool, "Back");
192
-
193
-    e1 = lv_label_create(scr, NULL);
194
-    lv_obj_set_pos(e1, 20, 20);
195
-    sprintf(buf, "e1:  %d", (int)thermalManager.temp_hotend[0].celsius);
196
-    lv_label_set_text(e1, buf);
197
-
198
-    e2 = lv_label_create(scr, NULL);
199
-    lv_obj_set_pos(e2, 20, 45);
200
-    sprintf(buf, "e1:  %d", (int)thermalManager.temp_hotend[1].celsius);
201
-    lv_label_set_text(e2, buf);
202
-
203
-    e3 = lv_label_create(scr, NULL);
204
-    lv_obj_set_pos(e3, 20, 70);
205
-    sprintf(buf, "e1:  %d", (int)thermalManager.temp_hotend[2].celsius);
206
-    lv_label_set_text(e3, buf);
207
-
208
-    bed = lv_label_create(scr, NULL);
209
-    lv_obj_set_pos(bed, 20, 95);
210
-    sprintf(buf, "bed:  %d", (int)thermalManager.temp_bed.celsius);
211
-    lv_label_set_text(bed, buf);
212
-
213
-    limit_info = lv_label_create(scr, NULL);
214
-
215
-    lv_style_copy(&limit_style, &lv_style_scr);
216
-    limit_style.body.main_color.full = 0X0000;
217
-    limit_style.body.grad_color.full = 0X0000;
218
-    limit_style.text.color.full = 0Xffff;
219
-    lv_obj_set_style(limit_info, &limit_style);
220
-
221
-    lv_obj_set_pos(limit_info, 20, 120);
222
-    lv_label_set_text(limit_info, " ");
223
-
224
-    det_info = lv_label_create(scr, NULL);
225
-
226
-    lv_style_copy(&det_style, &lv_style_scr);
227
-    det_style.body.main_color.full = 0X0000;
228
-    det_style.body.grad_color.full = 0X0000;
229
-    det_style.text.color.full = 0Xffff;
230
-    lv_obj_set_style(det_info, &det_style);
231
-
232
-    lv_obj_set_pos(det_info, 20, 145);
233
-    lv_label_set_text(det_info, " ");
234
-  #else // !MKS_TEST
235
-    lv_obj_t *buttonPrint, *buttonTool, *buttonSet;
236
-
237
-    disp_state_stack._disp_index = 0;
238
-    memset(disp_state_stack._disp_state, 0, sizeof(disp_state_stack._disp_state));
239
-    disp_state_stack._disp_state[disp_state_stack._disp_index] = PRINT_READY_UI;
240
-
241
-    disp_state = PRINT_READY_UI;
242
-
243
-    scr = lv_obj_create(NULL, NULL);
211
+      //lv_label_set_text(label_set, main_menu.set);
212
+      //lv_obj_align(label_set, buttonSet, LV_ALIGN_IN_BOTTOM_MID,0, BUTTON_TEXT_Y_OFFSET);
244 213
 
245
-    lv_obj_set_style(scr, &tft_style_scr);
246
-    lv_scr_load(scr);
247
-    lv_obj_clean(scr);
248
-    //lv_obj_set_hidden(scr,true);
249
-    lv_refr_now(lv_refr_get_disp_refreshing());
214
+      //lv_label_set_style(label_tool,LV_BTN_STATE_PR,&tft_style_label_pre);
215
+      //lv_label_set_style(label_tool,LV_BTN_STATE_REL,&tft_style_label_rel);
216
+      lv_label_set_text(label_tool, main_menu.tool);
217
+      lv_obj_align(label_tool, buttonTool, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
218
+    }
250 219
 
251
-    LV_IMG_DECLARE(bmp_pic);
220
+    #if 1
221
+      e1 = lv_label_create(scr, NULL);
222
+      lv_obj_set_pos(e1, 20, 20);
223
+      sprintf_P(buf, PSTR("e1:  %d"), (int)thermalManager.temp_hotend[0].celsius);
224
+      lv_label_set_text(e1, buf);
225
+      #if HAS_MULTI_HOTEND
226
+        e2 = lv_label_create(scr, NULL);
227
+        lv_obj_set_pos(e2, 20, 45);
228
+        sprintf_P(buf, PSTR("e1:  %d"), (int)thermalManager.temp_hotend[1].celsius);
229
+        lv_label_set_text(e2, buf);
230
+      #endif
231
+
232
+      //e3 = lv_label_create(scr, NULL);
233
+      //lv_obj_set_pos(e3,20,70);
234
+      //sprintf_P(buf, PSTR("e1:  %d"), (int)thermalManager.temp_hotend[2].celsius);
235
+      //lv_label_set_text(e3, buf);
236
+
237
+      #if HAS_HEATED_BED
238
+        bed = lv_label_create(scr, NULL);
239
+        lv_obj_set_pos(bed, 20, 95);
240
+        sprintf_P(buf, PSTR("bed:  %d"), (int)thermalManager.temp_bed.celsius);
241
+        lv_label_set_text(bed, buf);
242
+      #endif
243
+
244
+      limit_info = lv_label_create(scr, NULL);
245
+
246
+      lv_style_copy(&limit_style, &lv_style_scr);
247
+      limit_style.body.main_color.full = 0X0000;
248
+      limit_style.body.grad_color.full = 0X0000;
249
+      limit_style.text.color.full      = 0Xffff;
250
+      lv_obj_set_style(limit_info, &limit_style);
251
+
252
+      lv_obj_set_pos(limit_info, 20, 120);
253
+      lv_label_set_text(limit_info, " ");
254
+
255
+      det_info = lv_label_create(scr, NULL);
256
+
257
+      lv_style_copy(&det_style, &lv_style_scr);
258
+      det_style.body.main_color.full = 0X0000;
259
+      det_style.body.grad_color.full = 0X0000;
260
+      det_style.text.color.full      = 0Xffff;
261
+      lv_obj_set_style(det_info, &det_style);
262
+
263
+      lv_obj_set_pos(det_info, 20, 145);
264
+      lv_label_set_text(det_info, " ");
265
+    #endif // if 1
252 266
 
267
+  }
268
+  else {
253 269
     //lv_obj_t * title = lv_label_create(scr, NULL);
254
-    //lv_obj_set_style(title, &tft_style_lable_rel);
270
+    //lv_obj_set_style(title, &tft_style_label_rel);
255 271
     //lv_obj_set_pos(title,TITLE_XPOS,TITLE_YPOS);
256 272
     //lv_label_set_text(title, creat_title_text());
257 273
 
258 274
     /*Create an Image button*/
259 275
     buttonPrint = lv_imgbtn_create(scr, NULL);
260
-    buttonTool = lv_imgbtn_create(scr, NULL);
261
-    buttonSet = lv_imgbtn_create(scr, NULL);
276
+    buttonTool  = lv_imgbtn_create(scr, NULL);
277
+    buttonSet   = lv_imgbtn_create(scr, NULL);
262 278
 
263 279
     lv_obj_set_event_cb_mks(buttonPrint, event_handler, ID_PRINT, "bmp_printing.bin", 0);
264 280
     //lv_imgbtn_set_src_mks(buttonPrint, LV_BTN_STATE_REL, &bmp_pic,(uint8_t *)"bmp_printing.bin");
265 281
     lv_imgbtn_set_src(buttonPrint, LV_BTN_STATE_REL, &bmp_pic);
266 282
     lv_imgbtn_set_src(buttonPrint, LV_BTN_STATE_PR, &bmp_pic);
267
-    lv_imgbtn_set_style(buttonPrint, LV_BTN_STATE_PR, &tft_style_lable_pre);
268
-    lv_imgbtn_set_style(buttonPrint, LV_BTN_STATE_REL, &tft_style_lable_rel);
283
+    lv_imgbtn_set_style(buttonPrint, LV_BTN_STATE_PR, &tft_style_label_pre);
284
+    lv_imgbtn_set_style(buttonPrint, LV_BTN_STATE_REL, &tft_style_label_rel);
269 285
     lv_obj_clear_protect(buttonPrint, LV_PROTECT_FOLLOW);
286
+
270 287
     #if 1
271
-      lv_obj_set_event_cb_mks(buttonSet, event_handler, ID_SET, "bmp_Set.bin", 0);
288
+      lv_obj_set_event_cb_mks(buttonSet, event_handler, ID_SET, "bmp_set.bin", 0);
272 289
       //lv_imgbtn_set_src_mks(buttonSet, LV_BTN_STATE_REL, &bmp_pic,(uint8_t *)"bmp_set.bin");
273 290
       lv_imgbtn_set_src(buttonSet, LV_BTN_STATE_REL, &bmp_pic);
274 291
       lv_imgbtn_set_src(buttonSet, LV_BTN_STATE_PR, &bmp_pic);
275
-      lv_imgbtn_set_style(buttonSet, LV_BTN_STATE_PR, &tft_style_lable_pre);
276
-      lv_imgbtn_set_style(buttonSet, LV_BTN_STATE_REL, &tft_style_lable_rel);
292
+      lv_imgbtn_set_style(buttonSet, LV_BTN_STATE_PR, &tft_style_label_pre);
293
+      lv_imgbtn_set_style(buttonSet, LV_BTN_STATE_REL, &tft_style_label_rel);
277 294
 
278
-      lv_obj_set_event_cb_mks(buttonTool, event_handler, ID_TOOL, "bmp_Tool.bin", 0);
295
+      lv_obj_set_event_cb_mks(buttonTool, event_handler, ID_TOOL, "bmp_tool.bin", 0);
279 296
       //lv_imgbtn_set_src_mks(buttonTool, LV_BTN_STATE_REL, &bmp_pic,(uint8_t *)"bmp_tool.bin");
280 297
       lv_imgbtn_set_src(buttonTool, LV_BTN_STATE_REL, &bmp_pic);
281 298
       lv_imgbtn_set_src(buttonTool, LV_BTN_STATE_PR, &bmp_pic);
282
-      lv_imgbtn_set_style(buttonTool, LV_BTN_STATE_PR, &tft_style_lable_pre);
283
-      lv_imgbtn_set_style(buttonTool, LV_BTN_STATE_REL, &tft_style_lable_rel);
299
+      lv_imgbtn_set_style(buttonTool, LV_BTN_STATE_PR, &tft_style_label_pre);
300
+      lv_imgbtn_set_style(buttonTool, LV_BTN_STATE_REL, &tft_style_label_rel);
284 301
     #endif
302
+
285 303
     lv_obj_set_pos(buttonTool, 20, 90);
286 304
     lv_obj_set_pos(buttonSet, 180, 90);
287 305
     lv_obj_set_pos(buttonPrint, 340, 90);
@@ -296,24 +314,23 @@ void lv_draw_ready_print(void) {
296 314
     lv_btn_set_layout(buttonTool, LV_LAYOUT_OFF);
297 315
 
298 316
     lv_obj_t * label_print = lv_label_create(buttonPrint, NULL);
299
-    lv_obj_t * label_set = lv_label_create(buttonSet, NULL);
300
-    lv_obj_t * label_tool = lv_label_create(buttonTool, NULL);
317
+    lv_obj_t * label_set   = lv_label_create(buttonSet, NULL);
318
+    lv_obj_t * label_tool  = lv_label_create(buttonTool, NULL);
301 319
     if (gCfgItems.multiple_language != 0) {
302
-
303 320
       lv_label_set_text(label_print, main_menu.print);
304 321
       lv_obj_align(label_print, buttonPrint, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
305 322
 
306 323
       lv_label_set_text(label_set, main_menu.set);
307 324
       lv_obj_align(label_set, buttonSet, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
308 325
 
309
-      //lv_label_set_style(label_tool,LV_BTN_STATE_PR,&tft_style_lable_pre);
310
-      //lv_label_set_style(label_tool,LV_BTN_STATE_REL,&tft_style_lable_rel);
326
+      //lv_label_set_style(label_tool,LV_BTN_STATE_PR,&tft_style_label_pre);
327
+      //lv_label_set_style(label_tool,LV_BTN_STATE_REL,&tft_style_label_rel);
311 328
       lv_label_set_text(label_tool, main_menu.tool);
312 329
       lv_obj_align(label_tool, buttonTool, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
313 330
     }
314
-  #endif // !MKS_TEST
331
+  }
315 332
 }
316 333
 
317 334
 void lv_clear_ready_print() { lv_obj_del(scr); }
318 335
 
319
-#endif // TFT_LVGL_UI
336
+#endif // HAS_TFT_LVGL_UI

+ 1
- 1
Marlin/src/lcd/extui/lib/mks_ui/draw_ready_print.h View File

@@ -26,7 +26,7 @@ extern "C" { /* C-declarations for C++ */
26 26
 #endif
27 27
 
28 28
 extern void lv_draw_ready_print(void);
29
-extern void disp_test();
29
+extern void mks_disp_test();
30 30
 extern void disp_Limit_ok();
31 31
 extern void disp_Limit_error();
32 32
 extern void disp_det_error();

+ 85
- 41
Marlin/src/lcd/extui/lib/mks_ui/draw_set.cpp View File

@@ -21,7 +21,7 @@
21 21
  */
22 22
 #include "../../../../inc/MarlinConfigPre.h"
23 23
 
24
-#if ENABLED(TFT_LVGL_UI)
24
+#if HAS_TFT_LVGL_UI
25 25
 
26 26
 #include "../../../../MarlinCore.h"
27 27
 #include "draw_ready_print.h"
@@ -37,13 +37,15 @@
37 37
 
38 38
 static lv_obj_t * scr;
39 39
 
40
-#define ID_S_WIFI       1
41
-#define ID_S_FAN        2
42
-#define ID_S_ABOUT      3
43
-#define ID_S_CONTINUE   4
44
-#define ID_S_MOTOR_OFF  5
45
-#define ID_S_LANGUAGE   6
46
-#define ID_S_RETURN     7
40
+#define ID_S_WIFI         1
41
+#define ID_S_FAN          2
42
+#define ID_S_ABOUT        3
43
+#define ID_S_CONTINUE     4
44
+#define ID_S_MOTOR_OFF    5
45
+#define ID_S_LANGUAGE     6
46
+#define ID_S_MACHINE_PARA 7
47
+#define ID_S_EEPROM_SET   8
48
+#define ID_S_RETURN       9
47 49
 
48 50
 static void event_handler(lv_obj_t * obj, lv_event_t event) {
49 51
   switch (obj->mks_obj_id) {
@@ -83,7 +85,7 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
83 85
         #if HAS_SUICIDE
84 86
           suicide();
85 87
         #else
86
-          queue.enqueue_one_now(PSTR("M84"));
88
+          queue.enqueue_now_P(PSTR("M84"));
87 89
         #endif
88 90
       }
89 91
       break;
@@ -96,6 +98,24 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
96 98
         lv_draw_language();
97 99
       }
98 100
       break;
101
+    case ID_S_MACHINE_PARA:
102
+      if (event == LV_EVENT_CLICKED) {
103
+
104
+      }
105
+      else if (event == LV_EVENT_RELEASED) {
106
+        lv_obj_del(scr);
107
+        lv_draw_machine_para();
108
+      }
109
+      break;
110
+    case ID_S_EEPROM_SET:
111
+      if (event == LV_EVENT_CLICKED) {
112
+
113
+      }
114
+      else if (event == LV_EVENT_RELEASED) {
115
+        lv_obj_del(scr);
116
+        lv_draw_eeprom_settings();
117
+      }
118
+      break;
99 119
     case ID_S_RETURN:
100 120
       if (event == LV_EVENT_CLICKED) {
101 121
         // nothing to do
@@ -115,6 +135,8 @@ void lv_draw_set(void) {
115 135
   #if HAS_LANG_SELECT_SCREEN
116 136
     lv_obj_t *buttonLanguage;
117 137
   #endif
138
+  lv_obj_t *buttonMachinePara;
139
+  lv_obj_t *buttonEepromSet;
118 140
 
119 141
   if (disp_state_stack._disp_state[disp_state_stack._disp_index] != SET_UI) {
120 142
     disp_state_stack._disp_index++;
@@ -131,7 +153,7 @@ void lv_draw_set(void) {
131 153
   lv_obj_clean(scr);
132 154
 
133 155
   lv_obj_t * title = lv_label_create(scr, NULL);
134
-  lv_obj_set_style(title, &tft_style_lable_rel);
156
+  lv_obj_set_style(title, &tft_style_label_rel);
135 157
   lv_obj_set_pos(title, TITLE_XPOS, TITLE_YPOS);
136 158
   lv_label_set_text(title, creat_title_text());
137 159
 
@@ -141,72 +163,84 @@ void lv_draw_set(void) {
141 163
 
142 164
   /*Create an Image button*/
143 165
   //buttonWifi = lv_imgbtn_create(scr, NULL);
144
-  buttonFan = lv_imgbtn_create(scr, NULL);
166
+  buttonFan   = lv_imgbtn_create(scr, NULL);
145 167
   buttonAbout = lv_imgbtn_create(scr, NULL);
146 168
   //buttonContinue = lv_imgbtn_create(scr, NULL);
147 169
   buMotorOff = lv_imgbtn_create(scr, NULL);
148 170
   #if HAS_LANG_SELECT_SCREEN
149 171
     buttonLanguage = lv_imgbtn_create(scr, NULL);
150 172
   #endif
151
-  buttonBack = lv_imgbtn_create(scr, NULL);
173
+  buttonMachinePara = lv_imgbtn_create(scr, NULL);
174
+  buttonEepromSet   = lv_imgbtn_create(scr, NULL);
175
+  buttonBack        = lv_imgbtn_create(scr, NULL);
152 176
 
153 177
 
154 178
   //lv_obj_set_event_cb_mks(buttonWifi, event_handler,ID_S_WIFI,"bmp_Wifi.bin",0);
155 179
   //lv_imgbtn_set_src(buttonWifi, LV_BTN_STATE_REL, &bmp_pic);
156 180
   //lv_imgbtn_set_src(buttonWifi, LV_BTN_STATE_PR, &bmp_pic);
157
-  //lv_imgbtn_set_style(buttonWifi, LV_BTN_STATE_PR, &tft_style_lable_pre);
158
-  //lv_imgbtn_set_style(buttonWifi, LV_BTN_STATE_REL, &tft_style_lable_rel);
181
+  //lv_imgbtn_set_style(buttonWifi, LV_BTN_STATE_PR, &tft_style_label_pre);
182
+  //lv_imgbtn_set_style(buttonWifi, LV_BTN_STATE_REL, &tft_style_label_rel);
159 183
   //lv_obj_clear_protect(buttonWifi, LV_PROTECT_FOLLOW);
160 184
   #if 1
161
-    lv_obj_set_event_cb_mks(buttonFan, event_handler, ID_S_FAN, "bmp_Fan.bin", 0);
185
+    lv_obj_set_event_cb_mks(buttonFan, event_handler, ID_S_FAN, "bmp_fan.bin", 0);
162 186
     lv_imgbtn_set_src(buttonFan, LV_BTN_STATE_REL, &bmp_pic);
163 187
     lv_imgbtn_set_src(buttonFan, LV_BTN_STATE_PR, &bmp_pic);
164
-    lv_imgbtn_set_style(buttonFan, LV_BTN_STATE_PR, &tft_style_lable_pre);
165
-    lv_imgbtn_set_style(buttonFan, LV_BTN_STATE_REL, &tft_style_lable_rel);
188
+    lv_imgbtn_set_style(buttonFan, LV_BTN_STATE_PR, &tft_style_label_pre);
189
+    lv_imgbtn_set_style(buttonFan, LV_BTN_STATE_REL, &tft_style_label_rel);
166 190
 
167
-    lv_obj_set_event_cb_mks(buttonAbout, event_handler, ID_S_ABOUT, "bmp_About.bin", 0);
191
+    lv_obj_set_event_cb_mks(buttonAbout, event_handler, ID_S_ABOUT, "bmp_about.bin", 0);
168 192
     lv_imgbtn_set_src(buttonAbout, LV_BTN_STATE_REL, &bmp_pic);
169 193
     lv_imgbtn_set_src(buttonAbout, LV_BTN_STATE_PR, &bmp_pic);
170
-    lv_imgbtn_set_style(buttonAbout, LV_BTN_STATE_PR, &tft_style_lable_pre);
171
-    lv_imgbtn_set_style(buttonAbout, LV_BTN_STATE_REL, &tft_style_lable_rel);
194
+    lv_imgbtn_set_style(buttonAbout, LV_BTN_STATE_PR, &tft_style_label_pre);
195
+    lv_imgbtn_set_style(buttonAbout, LV_BTN_STATE_REL, &tft_style_label_rel);
172 196
 
173 197
     //lv_obj_set_event_cb_mks(buttonContinue, event_handler,ID_S_CONTINUE,"bmp_Breakpoint.bin",0);
174 198
     //lv_imgbtn_set_src(buttonContinue, LV_BTN_STATE_REL, &bmp_pic);
175 199
     //lv_imgbtn_set_src(buttonContinue, LV_BTN_STATE_PR, &bmp_pic);
176
-    //lv_imgbtn_set_style(buttonContinue, LV_BTN_STATE_PR, &tft_style_lable_pre);
177
-    //lv_imgbtn_set_style(buttonContinue, LV_BTN_STATE_REL, &tft_style_lable_rel);
200
+    //lv_imgbtn_set_style(buttonContinue, LV_BTN_STATE_PR, &tft_style_label_pre);
201
+    //lv_imgbtn_set_style(buttonContinue, LV_BTN_STATE_REL, &tft_style_label_rel);
178 202
     #if HAS_SUICIDE
179
-      lv_obj_set_event_cb_mks(buMotorOff, event_handler, ID_S_MOTOR_OFF, "bmp_manual_off.bin", 0);
203
+      lv_obj_set_event_cb_mks(buMotorOff, event_handler, ID_S_MOTOR_OFF, "bmp_Mamual.bin", 0);
180 204
     #else
181
-      lv_obj_set_event_cb_mks(buMotorOff, event_handler, ID_S_MOTOR_OFF, "bmp_manual_off.bin", 0);
205
+      lv_obj_set_event_cb_mks(buMotorOff, event_handler, ID_S_MOTOR_OFF, "bmp_function1.bin", 0);
182 206
     #endif
183 207
     lv_imgbtn_set_src(buMotorOff, LV_BTN_STATE_REL, &bmp_pic);
184 208
     lv_imgbtn_set_src(buMotorOff, LV_BTN_STATE_PR, &bmp_pic);
185
-    lv_imgbtn_set_style(buMotorOff, LV_BTN_STATE_PR, &tft_style_lable_pre);
186
-    lv_imgbtn_set_style(buMotorOff, LV_BTN_STATE_REL, &tft_style_lable_rel);
209
+    lv_imgbtn_set_style(buMotorOff, LV_BTN_STATE_PR, &tft_style_label_pre);
210
+    lv_imgbtn_set_style(buMotorOff, LV_BTN_STATE_REL, &tft_style_label_rel);
187 211
 
188 212
     #if HAS_LANG_SELECT_SCREEN
189
-      lv_obj_set_event_cb_mks(buttonLanguage, event_handler, ID_S_LANGUAGE, "bmp_Language.bin", 0);
213
+      lv_obj_set_event_cb_mks(buttonLanguage, event_handler, ID_S_LANGUAGE, "bmp_language.bin", 0);
190 214
       lv_imgbtn_set_src(buttonLanguage, LV_BTN_STATE_REL, &bmp_pic);
191 215
       lv_imgbtn_set_src(buttonLanguage, LV_BTN_STATE_PR, &bmp_pic);
192
-      lv_imgbtn_set_style(buttonLanguage, LV_BTN_STATE_PR, &tft_style_lable_pre);
193
-      lv_imgbtn_set_style(buttonLanguage, LV_BTN_STATE_REL, &tft_style_lable_rel);
216
+      lv_imgbtn_set_style(buttonLanguage, LV_BTN_STATE_PR, &tft_style_label_pre);
217
+      lv_imgbtn_set_style(buttonLanguage, LV_BTN_STATE_REL, &tft_style_label_rel);
194 218
     #endif
195
-
196
-    lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_S_RETURN, "bmp_Return.bin", 0);
219
+    lv_obj_set_event_cb_mks(buttonMachinePara, event_handler, ID_S_MACHINE_PARA, "bmp_machine_para.bin", 0);
220
+    lv_imgbtn_set_src(buttonMachinePara, LV_BTN_STATE_REL, &bmp_pic);
221
+    lv_imgbtn_set_src(buttonMachinePara, LV_BTN_STATE_PR, &bmp_pic);
222
+    lv_imgbtn_set_style(buttonMachinePara, LV_BTN_STATE_PR, &tft_style_label_pre);
223
+    lv_imgbtn_set_style(buttonMachinePara, LV_BTN_STATE_REL, &tft_style_label_rel);
224
+
225
+    lv_obj_set_event_cb_mks(buttonEepromSet, event_handler, ID_S_EEPROM_SET, "bmp_eeprom_settings.bin", 0);
226
+    lv_imgbtn_set_src(buttonEepromSet, LV_BTN_STATE_REL, &bmp_pic);
227
+    lv_imgbtn_set_src(buttonEepromSet, LV_BTN_STATE_PR, &bmp_pic);
228
+    lv_imgbtn_set_style(buttonEepromSet, LV_BTN_STATE_PR, &tft_style_label_pre);
229
+    lv_imgbtn_set_style(buttonEepromSet, LV_BTN_STATE_REL, &tft_style_label_rel);
230
+    lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_S_RETURN, "bmp_return.bin", 0);
197 231
     lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_REL, &bmp_pic);
198 232
     lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_PR, &bmp_pic);
199
-    lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_PR, &tft_style_lable_pre);
200
-    lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_REL, &tft_style_lable_rel);
201
-  #endif
233
+    lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_PR, &tft_style_label_pre);
234
+    lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_REL, &tft_style_label_rel);
235
+  #endif // if 1
202 236
 
203 237
   /*lv_obj_set_pos(buttonWifi,INTERVAL_V,titleHeight);
204 238
   lv_obj_set_pos(buttonFan,BTN_X_PIXEL+INTERVAL_V*2,titleHeight);
205 239
   lv_obj_set_pos(buttonAbout,BTN_X_PIXEL*2+INTERVAL_V*3,titleHeight);
206 240
   lv_obj_set_pos(buttonContinue,BTN_X_PIXEL*3+INTERVAL_V*4,titleHeight);
207
-  lv_obj_set_pos(buMotorOff,INTERVAL_V,  BTN_Y_PIXEL+INTERVAL_H+titleHeight);
241
+  lv_obj_set_pos(buMotorOff,INTERVAL_V, BTN_Y_PIXEL+INTERVAL_H+titleHeight);
208 242
   lv_obj_set_pos(buttonLanguage,BTN_X_PIXEL+INTERVAL_V*2,BTN_Y_PIXEL+INTERVAL_H+titleHeight);
209
-  lv_obj_set_pos(buttonBack,BTN_X_PIXEL*3+INTERVAL_V*4,  BTN_Y_PIXEL+INTERVAL_H+titleHeight);*/
243
+  lv_obj_set_pos(buttonBack,BTN_X_PIXEL*3+INTERVAL_V*4, BTN_Y_PIXEL+INTERVAL_H+titleHeight);*/
210 244
 
211 245
   //lv_obj_set_pos(buttonWifi,INTERVAL_V,titleHeight);
212 246
   lv_obj_set_pos(buttonFan, BTN_X_PIXEL + INTERVAL_V * 2, titleHeight);
@@ -216,7 +250,9 @@ void lv_draw_set(void) {
216 250
   #if HAS_LANG_SELECT_SCREEN
217 251
     lv_obj_set_pos(buttonLanguage, INTERVAL_V, titleHeight);
218 252
   #endif
219
-  lv_obj_set_pos(buttonBack, BTN_X_PIXEL * 3 + INTERVAL_V * 4,  BTN_Y_PIXEL + INTERVAL_H + titleHeight);
253
+  lv_obj_set_pos(buttonMachinePara, INTERVAL_V, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
254
+  lv_obj_set_pos(buttonEepromSet, BTN_X_PIXEL + INTERVAL_V * 2, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
255
+  lv_obj_set_pos(buttonBack, BTN_X_PIXEL * 3 + INTERVAL_V * 4, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
220 256
 
221 257
   /*Create a label on the Image button*/
222 258
   //lv_btn_set_layout(buttonWifi, LV_LAYOUT_OFF);
@@ -227,18 +263,21 @@ void lv_draw_set(void) {
227 263
   #if HAS_LANG_SELECT_SCREEN
228 264
     lv_btn_set_layout(buttonLanguage, LV_LAYOUT_OFF);
229 265
   #endif
266
+  lv_btn_set_layout(buttonMachinePara, LV_LAYOUT_OFF);
267
+  lv_btn_set_layout(buttonEepromSet, LV_LAYOUT_OFF);
230 268
   lv_btn_set_layout(buttonBack, LV_LAYOUT_OFF);
231 269
 
232 270
   //lv_obj_t * labelWifi= lv_label_create(buttonWifi, NULL);
233
-  lv_obj_t * labelFan = lv_label_create(buttonFan, NULL);
271
+  lv_obj_t * labelFan    = lv_label_create(buttonFan, NULL);
234 272
   lv_obj_t * label_About = lv_label_create(buttonAbout, NULL);
235 273
   //lv_obj_t * label_Continue = lv_label_create(buttonContinue, NULL);
236 274
   lv_obj_t * label_MotorOff = lv_label_create(buMotorOff, NULL);
237 275
   #if HAS_LANG_SELECT_SCREEN
238 276
     lv_obj_t * label_Language = lv_label_create(buttonLanguage, NULL);
239 277
   #endif
240
-  lv_obj_t * label_Back = lv_label_create(buttonBack, NULL);
241
-
278
+  lv_obj_t * label_MachinePara = lv_label_create(buttonMachinePara, NULL);
279
+  lv_obj_t * label_EepromSet   = lv_label_create(buttonEepromSet, NULL);
280
+  lv_obj_t * label_Back        = lv_label_create(buttonBack, NULL);
242 281
 
243 282
   if (gCfgItems.multiple_language != 0) {
244 283
     //lv_label_set_text(labelWifi, set_menu.wifi);
@@ -263,6 +302,11 @@ void lv_draw_set(void) {
263 302
       lv_label_set_text(label_Language, set_menu.language);
264 303
       lv_obj_align(label_Language, buttonLanguage, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
265 304
     #endif
305
+    lv_label_set_text(label_MachinePara, set_menu.machine_para);
306
+    lv_obj_align(label_MachinePara, buttonMachinePara, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
307
+
308
+    lv_label_set_text(label_EepromSet, set_menu.eepromSet);
309
+    lv_obj_align(label_EepromSet, buttonEepromSet, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
266 310
 
267 311
     lv_label_set_text(label_Back, common_menu.text_back);
268 312
     lv_obj_align(label_Back, buttonBack, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
@@ -271,4 +315,4 @@ void lv_draw_set(void) {
271 315
 
272 316
 void lv_clear_set() { lv_obj_del(scr); }
273 317
 
274
-#endif // TFT_LVGL_UI
318
+#endif // HAS_TFT_LVGL_UI

+ 358
- 0
Marlin/src/lcd/extui/lib/mks_ui/draw_step_settings.cpp View File

@@ -0,0 +1,358 @@
1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
+ *
5
+ * Based on Sprinter and grbl.
6
+ * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
7
+ *
8
+ * This program is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+#include "../../../../inc/MarlinConfigPre.h"
23
+
24
+#if HAS_TFT_LVGL_UI
25
+
26
+#include "lv_conf.h"
27
+#include "draw_ui.h"
28
+
29
+#include "../../../../MarlinCore.h"
30
+#include "../../../../module/planner.h"
31
+
32
+static lv_obj_t * scr;
33
+
34
+#define ID_STEP_RETURN  1
35
+#define ID_STEP_X       2
36
+#define ID_STEP_Y       3
37
+#define ID_STEP_Z       4
38
+#define ID_STEP_E0      5
39
+#define ID_STEP_E1      6
40
+#define ID_STEP_DOWN    7
41
+#define ID_STEP_UP      8
42
+
43
+static void event_handler(lv_obj_t * obj, lv_event_t event) {
44
+  switch (obj->mks_obj_id) {
45
+    case ID_STEP_RETURN:
46
+      if (event == LV_EVENT_CLICKED) {
47
+
48
+      }
49
+      else if (event == LV_EVENT_RELEASED) {
50
+        uiCfg.para_ui_page = 0;
51
+        lv_clear_step_settings();
52
+        draw_return_ui();
53
+      }
54
+      break;
55
+    case ID_STEP_X:
56
+      if (event == LV_EVENT_CLICKED) {
57
+
58
+      }
59
+      else if (event == LV_EVENT_RELEASED) {
60
+        value = Xstep;
61
+        lv_clear_step_settings();
62
+        lv_draw_number_key();
63
+      }
64
+      break;
65
+    case ID_STEP_Y:
66
+      if (event == LV_EVENT_CLICKED) {
67
+
68
+      }
69
+      else if (event == LV_EVENT_RELEASED) {
70
+        value = Ystep;
71
+        lv_clear_step_settings();
72
+        lv_draw_number_key();
73
+      }
74
+      break;
75
+    case ID_STEP_Z:
76
+      if (event == LV_EVENT_CLICKED) {
77
+
78
+      }
79
+      else if (event == LV_EVENT_RELEASED) {
80
+        value = Zstep;
81
+        lv_clear_step_settings();
82
+        lv_draw_number_key();
83
+      }
84
+      break;
85
+    case ID_STEP_E0:
86
+      if (event == LV_EVENT_CLICKED) {
87
+
88
+      }
89
+      else if (event == LV_EVENT_RELEASED) {
90
+        value = E0step;
91
+        lv_clear_step_settings();
92
+        lv_draw_number_key();
93
+      }
94
+      break;
95
+    case ID_STEP_E1:
96
+      if (event == LV_EVENT_CLICKED) {
97
+
98
+      }
99
+      else if (event == LV_EVENT_RELEASED) {
100
+        value = E1step;
101
+        lv_clear_step_settings();
102
+        lv_draw_number_key();
103
+      }
104
+      break;
105
+    case ID_STEP_UP:
106
+      if (event == LV_EVENT_CLICKED) {
107
+
108
+      }
109
+      else if (event == LV_EVENT_RELEASED) {
110
+        uiCfg.para_ui_page = 0;
111
+        lv_clear_step_settings();
112
+        lv_draw_step_settings();
113
+      }
114
+      break;
115
+    case ID_STEP_DOWN:
116
+      if (event == LV_EVENT_CLICKED) {
117
+
118
+      }
119
+      else if (event == LV_EVENT_RELEASED) {
120
+        uiCfg.para_ui_page = 1;
121
+        lv_clear_step_settings();
122
+        lv_draw_step_settings();
123
+      }
124
+      break;
125
+  }
126
+}
127
+
128
+void lv_draw_step_settings(void) {
129
+  lv_obj_t *buttonBack = NULL, *label_Back = NULL, *buttonTurnPage = NULL, *labelTurnPage = NULL;
130
+  lv_obj_t *buttonXText = NULL, *labelXText = NULL, *buttonXValue = NULL, *labelXValue = NULL;
131
+  lv_obj_t *buttonYText = NULL, *labelYText = NULL, *buttonYValue = NULL, *labelYValue = NULL;
132
+  lv_obj_t *buttonZText = NULL, *labelZText = NULL, *buttonZValue = NULL, *labelZValue = NULL;
133
+  lv_obj_t *buttonE0Text = NULL, *labelE0Text = NULL, *buttonE0Value = NULL, *labelE0Value = NULL;
134
+  lv_obj_t *buttonE1Text = NULL, *labelE1Text = NULL, *buttonE1Value = NULL, *labelE1Value = NULL;
135
+  lv_obj_t * line1 = NULL, * line2 = NULL, * line3 = NULL, * line4 = NULL;
136
+  if (disp_state_stack._disp_state[disp_state_stack._disp_index] != STEPS_UI) {
137
+    disp_state_stack._disp_index++;
138
+    disp_state_stack._disp_state[disp_state_stack._disp_index] = STEPS_UI;
139
+  }
140
+  disp_state = STEPS_UI;
141
+
142
+  scr = lv_obj_create(NULL, NULL);
143
+
144
+  lv_obj_set_style(scr, &tft_style_scr);
145
+  lv_scr_load(scr);
146
+  lv_obj_clean(scr);
147
+
148
+  lv_obj_t * title = lv_label_create(scr, NULL);
149
+  lv_obj_set_style(title, &tft_style_label_rel);
150
+  lv_obj_set_pos(title, TITLE_XPOS, TITLE_YPOS);
151
+  lv_label_set_text(title, machine_menu.StepsConfTitle);
152
+
153
+  lv_refr_now(lv_refr_get_disp_refreshing());
154
+
155
+  LV_IMG_DECLARE(bmp_para_back);
156
+  // LV_IMG_DECLARE(bmp_para_arrow);
157
+  LV_IMG_DECLARE(bmp_para_bank);
158
+
159
+  if (uiCfg.para_ui_page != 1) {
160
+    buttonXText = lv_btn_create(scr, NULL);                                 /*Add a button the current screen*/
161
+    lv_obj_set_pos(buttonXText, PARA_UI_POS_X, PARA_UI_POS_Y);              /*Set its position*/
162
+    lv_obj_set_size(buttonXText, PARA_UI_VALUE_SIZE_X, PARA_UI_SIZE_Y);     /*Set its size*/
163
+    lv_obj_set_event_cb(buttonXText, event_handler);
164
+    lv_btn_set_style(buttonXText, LV_BTN_STYLE_REL, &tft_style_label_rel);  /*Set the button's released style*/
165
+    lv_btn_set_style(buttonXText, LV_BTN_STYLE_PR, &tft_style_label_pre);   /*Set the button's pressed style*/
166
+    lv_btn_set_layout(buttonXText, LV_LAYOUT_OFF);
167
+    labelXText = lv_label_create(buttonXText, NULL);                        /*Add a label to the button*/
168
+
169
+    buttonXValue = lv_imgbtn_create(scr, NULL);
170
+    lv_obj_set_pos(buttonXValue, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y + PARA_UI_VALUE_V);
171
+    lv_obj_set_event_cb_mks(buttonXValue, event_handler, ID_STEP_X, "bmp_value_blank.bin", 0);
172
+    lv_imgbtn_set_src(buttonXValue, LV_BTN_STATE_REL, &bmp_para_bank);
173
+    lv_imgbtn_set_src(buttonXValue, LV_BTN_STATE_PR, &bmp_para_bank);
174
+    lv_imgbtn_set_style(buttonXValue, LV_BTN_STATE_PR, &style_para_value_pre);
175
+    lv_imgbtn_set_style(buttonXValue, LV_BTN_STATE_REL, &style_para_value_rel);
176
+    lv_btn_set_layout(buttonXValue, LV_LAYOUT_OFF);
177
+    labelXValue = lv_label_create(buttonXValue, NULL);
178
+
179
+    line1 = lv_line_create(scr, NULL);
180
+    lv_ex_line(line1, line_points[0]);
181
+
182
+    buttonYText = lv_btn_create(scr, NULL);                                 /*Add a button the current screen*/
183
+    lv_obj_set_pos(buttonYText, PARA_UI_POS_X, PARA_UI_POS_Y * 2);          /*Set its position*/
184
+    lv_obj_set_size(buttonYText, PARA_UI_VALUE_SIZE_X, PARA_UI_SIZE_Y);     /*Set its size*/
185
+    lv_obj_set_event_cb(buttonYText, event_handler);
186
+    lv_btn_set_style(buttonYText, LV_BTN_STYLE_REL, &tft_style_label_rel);  /*Set the button's released style*/
187
+    lv_btn_set_style(buttonYText, LV_BTN_STYLE_PR, &tft_style_label_pre);   /*Set the button's pressed style*/
188
+    lv_btn_set_layout(buttonYText, LV_LAYOUT_OFF);
189
+    labelYText = lv_label_create(buttonYText, NULL);                        /*Add a label to the button*/
190
+
191
+    buttonYValue = lv_imgbtn_create(scr, NULL);
192
+    lv_obj_set_pos(buttonYValue, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 2 + PARA_UI_VALUE_V);
193
+    lv_obj_set_event_cb_mks(buttonYValue, event_handler, ID_STEP_Y, "bmp_value_blank.bin", 0);
194
+    lv_imgbtn_set_src(buttonYValue, LV_BTN_STATE_REL, &bmp_para_bank);
195
+    lv_imgbtn_set_src(buttonYValue, LV_BTN_STATE_PR, &bmp_para_bank);
196
+    lv_imgbtn_set_style(buttonYValue, LV_BTN_STATE_PR, &style_para_value_pre);
197
+    lv_imgbtn_set_style(buttonYValue, LV_BTN_STATE_REL, &style_para_value_rel);
198
+    lv_btn_set_layout(buttonYValue, LV_LAYOUT_OFF);
199
+    labelYValue = lv_label_create(buttonYValue, NULL);
200
+
201
+    line2 = lv_line_create(scr, NULL);
202
+    lv_ex_line(line2, line_points[1]);
203
+
204
+    buttonZText = lv_btn_create(scr, NULL);                                 /*Add a button the current screen*/
205
+    lv_obj_set_pos(buttonZText, PARA_UI_POS_X, PARA_UI_POS_Y * 3);          /*Set its position*/
206
+    lv_obj_set_size(buttonZText, PARA_UI_VALUE_SIZE_X, PARA_UI_SIZE_Y);     /*Set its size*/
207
+    lv_obj_set_event_cb(buttonZText, event_handler);
208
+    lv_btn_set_style(buttonZText, LV_BTN_STYLE_REL, &tft_style_label_rel);  /*Set the button's released style*/
209
+    lv_btn_set_style(buttonZText, LV_BTN_STYLE_PR, &tft_style_label_pre);   /*Set the button's pressed style*/
210
+    lv_btn_set_layout(buttonZText, LV_LAYOUT_OFF);
211
+    labelZText = lv_label_create(buttonZText, NULL);                        /*Add a label to the button*/
212
+
213
+    buttonZValue = lv_imgbtn_create(scr, NULL);
214
+    lv_obj_set_pos(buttonZValue, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 3 + PARA_UI_VALUE_V);
215
+    lv_obj_set_event_cb_mks(buttonZValue, event_handler, ID_STEP_Z, "bmp_value_blank.bin", 0);
216
+    lv_imgbtn_set_src(buttonZValue, LV_BTN_STATE_REL, &bmp_para_bank);
217
+    lv_imgbtn_set_src(buttonZValue, LV_BTN_STATE_PR, &bmp_para_bank);
218
+    lv_imgbtn_set_style(buttonZValue, LV_BTN_STATE_PR, &style_para_value_pre);
219
+    lv_imgbtn_set_style(buttonZValue, LV_BTN_STATE_REL, &style_para_value_rel);
220
+    lv_btn_set_layout(buttonZValue, LV_LAYOUT_OFF);
221
+    labelZValue = lv_label_create(buttonZValue, NULL);
222
+
223
+    line3 = lv_line_create(scr, NULL);
224
+    lv_ex_line(line3, line_points[2]);
225
+
226
+    buttonE0Text = lv_btn_create(scr, NULL);                                /*Add a button the current screen*/
227
+    lv_obj_set_pos(buttonE0Text, PARA_UI_POS_X, PARA_UI_POS_Y * 4);         /*Set its position*/
228
+    lv_obj_set_size(buttonE0Text, PARA_UI_VALUE_SIZE_X, PARA_UI_SIZE_Y);    /*Set its size*/
229
+    lv_obj_set_event_cb(buttonE0Text, event_handler);
230
+    lv_btn_set_style(buttonE0Text, LV_BTN_STYLE_REL, &tft_style_label_rel); /*Set the button's released style*/
231
+    lv_btn_set_style(buttonE0Text, LV_BTN_STYLE_PR, &tft_style_label_pre);  /*Set the button's pressed style*/
232
+    lv_btn_set_layout(buttonE0Text, LV_LAYOUT_OFF);
233
+    labelE0Text = lv_label_create(buttonE0Text, NULL);                      /*Add a label to the button*/
234
+
235
+    buttonE0Value = lv_imgbtn_create(scr, NULL);
236
+    lv_obj_set_pos(buttonE0Value, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 4 + PARA_UI_VALUE_V);
237
+    lv_obj_set_event_cb_mks(buttonE0Value, event_handler, ID_STEP_E0, "bmp_value_blank.bin", 0);
238
+    lv_imgbtn_set_src(buttonE0Value, LV_BTN_STATE_REL, &bmp_para_bank);
239
+    lv_imgbtn_set_src(buttonE0Value, LV_BTN_STATE_PR, &bmp_para_bank);
240
+    lv_imgbtn_set_style(buttonE0Value, LV_BTN_STATE_PR, &style_para_value_pre);
241
+    lv_imgbtn_set_style(buttonE0Value, LV_BTN_STATE_REL, &style_para_value_rel);
242
+    lv_btn_set_layout(buttonE0Value, LV_LAYOUT_OFF);
243
+    labelE0Value = lv_label_create(buttonE0Value, NULL);
244
+
245
+    line4 = lv_line_create(scr, NULL);
246
+    lv_ex_line(line4, line_points[3]);
247
+
248
+    buttonTurnPage = lv_imgbtn_create(scr, NULL);
249
+    lv_obj_set_event_cb_mks(buttonTurnPage, event_handler, ID_STEP_DOWN, "bmp_back70x40.bin", 0);
250
+    lv_imgbtn_set_src(buttonTurnPage, LV_BTN_STATE_REL, &bmp_para_back);
251
+    lv_imgbtn_set_src(buttonTurnPage, LV_BTN_STATE_PR, &bmp_para_back);
252
+    lv_imgbtn_set_style(buttonTurnPage, LV_BTN_STATE_PR, &tft_style_label_pre);
253
+    lv_imgbtn_set_style(buttonTurnPage, LV_BTN_STATE_REL, &tft_style_label_rel);
254
+  }
255
+  else {
256
+    buttonE1Text = lv_btn_create(scr, NULL);                                /*Add a button the current screen*/
257
+    lv_obj_set_pos(buttonE1Text, PARA_UI_POS_X, PARA_UI_POS_Y);             /*Set its position*/
258
+    lv_obj_set_size(buttonE1Text, PARA_UI_VALUE_SIZE_X, PARA_UI_SIZE_Y);    /*Set its size*/
259
+    lv_obj_set_event_cb(buttonE1Text, event_handler);
260
+    lv_btn_set_style(buttonE1Text, LV_BTN_STYLE_REL, &tft_style_label_rel); /*Set the button's released style*/
261
+    lv_btn_set_style(buttonE1Text, LV_BTN_STYLE_PR, &tft_style_label_pre);  /*Set the button's pressed style*/
262
+    lv_btn_set_layout(buttonE1Text, LV_LAYOUT_OFF);
263
+    labelE1Text = lv_label_create(buttonE1Text, NULL);                      /*Add a label to the button*/
264
+
265
+    buttonE1Value = lv_imgbtn_create(scr, NULL);
266
+    lv_obj_set_pos(buttonE1Value, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y + PARA_UI_VALUE_V);
267
+    lv_obj_set_event_cb_mks(buttonE1Value, event_handler, ID_STEP_E1, "bmp_value_blank.bin", 0);
268
+    lv_imgbtn_set_src(buttonE1Value, LV_BTN_STATE_REL, &bmp_para_bank);
269
+    lv_imgbtn_set_src(buttonE1Value, LV_BTN_STATE_PR, &bmp_para_bank);
270
+    lv_imgbtn_set_style(buttonE1Value, LV_BTN_STATE_PR, &style_para_value_pre);
271
+    lv_imgbtn_set_style(buttonE1Value, LV_BTN_STATE_REL, &style_para_value_rel);
272
+    lv_btn_set_layout(buttonE1Value, LV_LAYOUT_OFF);
273
+    labelE1Value = lv_label_create(buttonE1Value, NULL);
274
+
275
+    line1 = lv_line_create(scr, NULL);
276
+    lv_ex_line(line1, line_points[0]);
277
+
278
+    buttonTurnPage = lv_imgbtn_create(scr, NULL);
279
+    lv_obj_set_event_cb_mks(buttonTurnPage, event_handler, ID_STEP_UP, "bmp_back70x40.bin", 0);
280
+    lv_imgbtn_set_src(buttonTurnPage, LV_BTN_STATE_REL, &bmp_para_back);
281
+    lv_imgbtn_set_src(buttonTurnPage, LV_BTN_STATE_PR, &bmp_para_back);
282
+    lv_imgbtn_set_style(buttonTurnPage, LV_BTN_STATE_PR, &tft_style_label_pre);
283
+    lv_imgbtn_set_style(buttonTurnPage, LV_BTN_STATE_REL, &tft_style_label_rel);
284
+  }
285
+
286
+  lv_obj_set_pos(buttonTurnPage, PARA_UI_TURN_PAGE_POS_X, PARA_UI_TURN_PAGE_POS_Y);
287
+  lv_btn_set_layout(buttonTurnPage, LV_LAYOUT_OFF);
288
+  labelTurnPage = lv_label_create(buttonTurnPage, NULL);
289
+
290
+  buttonBack = lv_imgbtn_create(scr, NULL);
291
+  lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_STEP_RETURN, "bmp_back70x40.bin", 0);
292
+  lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_REL, &bmp_para_back);
293
+  lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_PR, &bmp_para_back);
294
+  lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_PR, &tft_style_label_pre);
295
+  lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_REL, &tft_style_label_rel);
296
+
297
+  lv_obj_set_pos(buttonBack, PARA_UI_BACL_POS_X, PARA_UI_BACL_POS_Y);
298
+  lv_btn_set_layout(buttonBack, LV_LAYOUT_OFF);
299
+  label_Back = lv_label_create(buttonBack, NULL);
300
+
301
+  if (gCfgItems.multiple_language != 0) {
302
+    if (uiCfg.para_ui_page != 1) {
303
+      lv_label_set_text(labelXText, machine_menu.X_Steps);
304
+      lv_obj_align(labelXText, buttonXText, LV_ALIGN_IN_LEFT_MID, 0, 0);
305
+
306
+      lv_label_set_text(labelYText, machine_menu.Y_Steps);
307
+      lv_obj_align(labelYText, buttonYText, LV_ALIGN_IN_LEFT_MID, 0, 0);
308
+
309
+      lv_label_set_text(labelZText, machine_menu.Z_Steps);
310
+      lv_obj_align(labelZText, buttonZText, LV_ALIGN_IN_LEFT_MID, 0, 0);
311
+
312
+      lv_label_set_text(labelE0Text, machine_menu.E0_Steps);
313
+      lv_obj_align(labelE0Text, buttonE0Text, LV_ALIGN_IN_LEFT_MID, 0, 0);
314
+
315
+      lv_label_set_text(labelTurnPage, machine_menu.next);
316
+      lv_obj_align(labelTurnPage, buttonTurnPage, LV_ALIGN_CENTER, 0, 0);
317
+
318
+      ZERO(public_buf_l);
319
+      sprintf_P(public_buf_l, PSTR("%.1f"), planner.settings.axis_steps_per_mm[X_AXIS]);
320
+      lv_label_set_text(labelXValue, public_buf_l);
321
+      lv_obj_align(labelXValue, buttonXValue, LV_ALIGN_CENTER, 0, 0);
322
+
323
+      ZERO(public_buf_l);
324
+      sprintf_P(public_buf_l, PSTR("%.1f"), planner.settings.axis_steps_per_mm[Y_AXIS]);
325
+      lv_label_set_text(labelYValue, public_buf_l);
326
+      lv_obj_align(labelYValue, buttonYValue, LV_ALIGN_CENTER, 0, 0);
327
+
328
+      ZERO(public_buf_l);
329
+      sprintf_P(public_buf_l, PSTR("%.1f"), planner.settings.axis_steps_per_mm[Z_AXIS]);
330
+      lv_label_set_text(labelZValue, public_buf_l);
331
+      lv_obj_align(labelZValue, buttonZValue, LV_ALIGN_CENTER, 0, 0);
332
+
333
+      ZERO(public_buf_l);
334
+      sprintf_P(public_buf_l, PSTR("%.1f"), planner.settings.axis_steps_per_mm[E_AXIS]);
335
+      lv_label_set_text(labelE0Value, public_buf_l);
336
+      lv_obj_align(labelE0Value, buttonE0Value, LV_ALIGN_CENTER, 0, 0);
337
+    }
338
+    else {
339
+      lv_label_set_text(labelE1Text, machine_menu.E1_Steps);
340
+      lv_obj_align(labelE1Text, buttonE1Text, LV_ALIGN_IN_LEFT_MID, 0, 0);
341
+
342
+      lv_label_set_text(labelTurnPage, machine_menu.previous);
343
+      lv_obj_align(labelTurnPage, buttonTurnPage, LV_ALIGN_CENTER, 0, 0);
344
+
345
+      ZERO(public_buf_l);
346
+      sprintf_P(public_buf_l, PSTR("%.1f"), planner.settings.axis_steps_per_mm[E_AXIS_N(1)]);
347
+      lv_label_set_text(labelE1Value, public_buf_l);
348
+      lv_obj_align(labelE1Value, buttonE1Value, LV_ALIGN_CENTER, 0, 0);
349
+    }
350
+
351
+    lv_label_set_text(label_Back, common_menu.text_back);
352
+    lv_obj_align(label_Back, buttonBack, LV_ALIGN_CENTER, 0, 0);
353
+  }
354
+}
355
+
356
+void lv_clear_step_settings() { lv_obj_del(scr); }
357
+
358
+#endif // HAS_TFT_LVGL_UI

+ 33
- 0
Marlin/src/lcd/extui/lib/mks_ui/draw_step_settings.h View File

@@ -0,0 +1,33 @@
1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
+ *
5
+ * Based on Sprinter and grbl.
6
+ * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
7
+ *
8
+ * This program is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+#pragma once
23
+
24
+#ifdef __cplusplus
25
+extern "C" { /* C-declarations for C++ */
26
+#endif
27
+
28
+extern void lv_draw_step_settings(void);
29
+extern void lv_clear_step_settings();
30
+
31
+#ifdef __cplusplus
32
+} /* C-declarations for C++ */
33
+#endif

+ 385
- 0
Marlin/src/lcd/extui/lib/mks_ui/draw_tmc_current_settings.cpp View File

@@ -0,0 +1,385 @@
1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
+ *
5
+ * Based on Sprinter and grbl.
6
+ * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
7
+ *
8
+ * This program is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+#include "../../../../inc/MarlinConfigPre.h"
23
+
24
+#if BOTH(HAS_TFT_LVGL_UI, HAS_TRINAMIC_CONFIG)
25
+
26
+#include "lv_conf.h"
27
+#include "draw_ui.h"
28
+#include "../../../../MarlinCore.h"
29
+#include "../../../../module/planner.h"
30
+#include "../../../../module/stepper/indirection.h"
31
+#include "../../../../feature/tmc_util.h"
32
+
33
+static lv_obj_t * scr;
34
+
35
+#define ID_TMC_CURRENT_RETURN 1
36
+#define ID_TMC_CURRENT_X      2
37
+#define ID_TMC_CURRENT_Y      3
38
+#define ID_TMC_CURRENT_Z      4
39
+#define ID_TMC_CURRENT_E0     5
40
+#define ID_TMC_CURRENT_E1     6
41
+#define ID_TMC_CURRENT_DOWN   7
42
+#define ID_TMC_CURRENT_UP     8
43
+
44
+static void event_handler(lv_obj_t * obj, lv_event_t event) {
45
+  switch (obj->mks_obj_id) {
46
+    case ID_TMC_CURRENT_RETURN:
47
+      if (event == LV_EVENT_CLICKED) {
48
+
49
+      }
50
+      else if (event == LV_EVENT_RELEASED) {
51
+        uiCfg.para_ui_page = 0;
52
+        lv_clear_tmc_current_settings();
53
+        draw_return_ui();
54
+      }
55
+      break;
56
+    case ID_TMC_CURRENT_X:
57
+      if (event == LV_EVENT_CLICKED) {
58
+
59
+      }
60
+      else if (event == LV_EVENT_RELEASED) {
61
+        value = Xcurrent;
62
+        lv_clear_tmc_current_settings();
63
+        lv_draw_number_key();
64
+      }
65
+      break;
66
+    case ID_TMC_CURRENT_Y:
67
+      if (event == LV_EVENT_CLICKED) {
68
+
69
+      }
70
+      else if (event == LV_EVENT_RELEASED) {
71
+        value = Ycurrent;
72
+        lv_clear_tmc_current_settings();
73
+        lv_draw_number_key();
74
+      }
75
+      break;
76
+    case ID_TMC_CURRENT_Z:
77
+      if (event == LV_EVENT_CLICKED) {
78
+
79
+      }
80
+      else if (event == LV_EVENT_RELEASED) {
81
+        value = Zcurrent;
82
+        lv_clear_tmc_current_settings();
83
+        lv_draw_number_key();
84
+      }
85
+      break;
86
+    case ID_TMC_CURRENT_E0:
87
+      if (event == LV_EVENT_CLICKED) {
88
+
89
+      }
90
+      else if (event == LV_EVENT_RELEASED) {
91
+        value = E0current;
92
+        lv_clear_tmc_current_settings();
93
+        lv_draw_number_key();
94
+      }
95
+      break;
96
+      #if AXIS_IS_TMC(E1)
97
+        case ID_TMC_CURRENT_E1:
98
+          if (event == LV_EVENT_CLICKED) {
99
+
100
+          }
101
+          else if (event == LV_EVENT_RELEASED) {
102
+            value = E1current;
103
+            lv_clear_tmc_current_settings();
104
+            lv_draw_number_key();
105
+          }
106
+          break;
107
+
108
+        case ID_TMC_CURRENT_UP:
109
+          if (event == LV_EVENT_CLICKED) {
110
+
111
+          }
112
+          else if (event == LV_EVENT_RELEASED) {
113
+            uiCfg.para_ui_page = 0;
114
+            lv_clear_tmc_current_settings();
115
+            lv_draw_tmc_current_settings();
116
+          }
117
+          break;
118
+        case ID_TMC_CURRENT_DOWN:
119
+          if (event == LV_EVENT_CLICKED) {
120
+
121
+          }
122
+          else if (event == LV_EVENT_RELEASED) {
123
+            uiCfg.para_ui_page = 1;
124
+            lv_clear_tmc_current_settings();
125
+            lv_draw_tmc_current_settings();
126
+          }
127
+          break;
128
+      #endif
129
+  }
130
+}
131
+
132
+void lv_draw_tmc_current_settings(void) {
133
+  lv_obj_t *buttonBack = NULL, *label_Back = NULL;
134
+  lv_obj_t *buttonXText = NULL, *labelXText = NULL, *buttonXValue = NULL, *labelXValue = NULL;
135
+  lv_obj_t *buttonYText = NULL, *labelYText = NULL, *buttonYValue = NULL, *labelYValue = NULL;
136
+  lv_obj_t *buttonZText = NULL, *labelZText = NULL, *buttonZValue = NULL, *labelZValue = NULL;
137
+  lv_obj_t *buttonE0Text = NULL, *labelE0Text = NULL, *buttonE0Value = NULL, *labelE0Value = NULL;
138
+
139
+  lv_obj_t * line1 = NULL, * line2 = NULL, * line3 = NULL, * line4 = NULL;
140
+  #if AXIS_IS_TMC(E1)
141
+    lv_obj_t *buttonTurnPage = NULL, *labelTurnPage = NULL;
142
+    lv_obj_t *buttonE1Text = NULL, *labelE1Text = NULL, *buttonE1Value = NULL, *labelE1Value = NULL;
143
+  #endif
144
+  float milliamps;
145
+
146
+  if (disp_state_stack._disp_state[disp_state_stack._disp_index] != TMC_CURRENT_UI) {
147
+    disp_state_stack._disp_index++;
148
+    disp_state_stack._disp_state[disp_state_stack._disp_index] = TMC_CURRENT_UI;
149
+  }
150
+  disp_state = TMC_CURRENT_UI;
151
+
152
+  scr = lv_obj_create(NULL, NULL);
153
+
154
+  lv_obj_set_style(scr, &tft_style_scr);
155
+  lv_scr_load(scr);
156
+  lv_obj_clean(scr);
157
+
158
+  lv_obj_t * title = lv_label_create(scr, NULL);
159
+  lv_obj_set_style(title, &tft_style_label_rel);
160
+  lv_obj_set_pos(title, TITLE_XPOS, TITLE_YPOS);
161
+  lv_label_set_text(title, machine_menu.TmcCurrentConfTitle);
162
+
163
+  lv_refr_now(lv_refr_get_disp_refreshing());
164
+
165
+  LV_IMG_DECLARE(bmp_para_back);
166
+  // LV_IMG_DECLARE(bmp_para_arrow);
167
+  LV_IMG_DECLARE(bmp_para_bank);
168
+
169
+  if (uiCfg.para_ui_page != 1) {
170
+    buttonXText = lv_btn_create(scr, NULL);                                 /*Add a button the current screen*/
171
+    lv_obj_set_pos(buttonXText, PARA_UI_POS_X, PARA_UI_POS_Y);              /*Set its position*/
172
+    lv_obj_set_size(buttonXText, PARA_UI_VALUE_SIZE_X, PARA_UI_SIZE_Y);     /*Set its size*/
173
+    lv_obj_set_event_cb(buttonXText, event_handler);
174
+    lv_btn_set_style(buttonXText, LV_BTN_STYLE_REL, &tft_style_label_rel);  /*Set the button's released style*/
175
+    lv_btn_set_style(buttonXText, LV_BTN_STYLE_PR, &tft_style_label_pre);   /*Set the button's pressed style*/
176
+    lv_btn_set_layout(buttonXText, LV_LAYOUT_OFF);
177
+    labelXText = lv_label_create(buttonXText, NULL);                        /*Add a label to the button*/
178
+
179
+    buttonXValue = lv_imgbtn_create(scr, NULL);
180
+    lv_obj_set_pos(buttonXValue, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y + PARA_UI_VALUE_V);
181
+    lv_obj_set_event_cb_mks(buttonXValue, event_handler, ID_TMC_CURRENT_X, "bmp_value_blank.bin", 0);
182
+    lv_imgbtn_set_src(buttonXValue, LV_BTN_STATE_REL, &bmp_para_bank);
183
+    lv_imgbtn_set_src(buttonXValue, LV_BTN_STATE_PR, &bmp_para_bank);
184
+    lv_imgbtn_set_style(buttonXValue, LV_BTN_STATE_PR, &style_para_value_pre);
185
+    lv_imgbtn_set_style(buttonXValue, LV_BTN_STATE_REL, &style_para_value_rel);
186
+    lv_btn_set_layout(buttonXValue, LV_LAYOUT_OFF);
187
+    labelXValue = lv_label_create(buttonXValue, NULL);
188
+
189
+    line1 = lv_line_create(scr, NULL);
190
+    lv_ex_line(line1, line_points[0]);
191
+
192
+    buttonYText = lv_btn_create(scr, NULL);                                 /*Add a button the current screen*/
193
+    lv_obj_set_pos(buttonYText, PARA_UI_POS_X, PARA_UI_POS_Y * 2);          /*Set its position*/
194
+    lv_obj_set_size(buttonYText, PARA_UI_VALUE_SIZE_X, PARA_UI_SIZE_Y);     /*Set its size*/
195
+    lv_obj_set_event_cb(buttonYText, event_handler);
196
+    lv_btn_set_style(buttonYText, LV_BTN_STYLE_REL, &tft_style_label_rel);  /*Set the button's released style*/
197
+    lv_btn_set_style(buttonYText, LV_BTN_STYLE_PR, &tft_style_label_pre);   /*Set the button's pressed style*/
198
+    lv_btn_set_layout(buttonYText, LV_LAYOUT_OFF);
199
+    labelYText = lv_label_create(buttonYText, NULL);                        /*Add a label to the button*/
200
+
201
+    buttonYValue = lv_imgbtn_create(scr, NULL);
202
+    lv_obj_set_pos(buttonYValue, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 2 + PARA_UI_VALUE_V);
203
+    lv_obj_set_event_cb_mks(buttonYValue, event_handler, ID_TMC_CURRENT_Y, "bmp_value_blank.bin", 0);
204
+    lv_imgbtn_set_src(buttonYValue, LV_BTN_STATE_REL, &bmp_para_bank);
205
+    lv_imgbtn_set_src(buttonYValue, LV_BTN_STATE_PR, &bmp_para_bank);
206
+    lv_imgbtn_set_style(buttonYValue, LV_BTN_STATE_PR, &style_para_value_pre);
207
+    lv_imgbtn_set_style(buttonYValue, LV_BTN_STATE_REL, &style_para_value_rel);
208
+    lv_btn_set_layout(buttonYValue, LV_LAYOUT_OFF);
209
+    labelYValue = lv_label_create(buttonYValue, NULL);
210
+
211
+    line2 = lv_line_create(scr, NULL);
212
+    lv_ex_line(line2, line_points[1]);
213
+
214
+    buttonZText = lv_btn_create(scr, NULL);                                 /*Add a button the current screen*/
215
+    lv_obj_set_pos(buttonZText, PARA_UI_POS_X, PARA_UI_POS_Y * 3);          /*Set its position*/
216
+    lv_obj_set_size(buttonZText, PARA_UI_VALUE_SIZE_X, PARA_UI_SIZE_Y);     /*Set its size*/
217
+    lv_obj_set_event_cb(buttonZText, event_handler);
218
+    lv_btn_set_style(buttonZText, LV_BTN_STYLE_REL, &tft_style_label_rel);  /*Set the button's released style*/
219
+    lv_btn_set_style(buttonZText, LV_BTN_STYLE_PR, &tft_style_label_pre);   /*Set the button's pressed style*/
220
+    lv_btn_set_layout(buttonZText, LV_LAYOUT_OFF);
221
+    labelZText = lv_label_create(buttonZText, NULL);                        /*Add a label to the button*/
222
+
223
+    buttonZValue = lv_imgbtn_create(scr, NULL);
224
+    lv_obj_set_pos(buttonZValue, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 3 + PARA_UI_VALUE_V);
225
+    lv_obj_set_event_cb_mks(buttonZValue, event_handler, ID_TMC_CURRENT_Z, "bmp_value_blank.bin", 0);
226
+    lv_imgbtn_set_src(buttonZValue, LV_BTN_STATE_REL, &bmp_para_bank);
227
+    lv_imgbtn_set_src(buttonZValue, LV_BTN_STATE_PR, &bmp_para_bank);
228
+    lv_imgbtn_set_style(buttonZValue, LV_BTN_STATE_PR, &style_para_value_pre);
229
+    lv_imgbtn_set_style(buttonZValue, LV_BTN_STATE_REL, &style_para_value_rel);
230
+    lv_btn_set_layout(buttonZValue, LV_LAYOUT_OFF);
231
+    labelZValue = lv_label_create(buttonZValue, NULL);
232
+
233
+    line3 = lv_line_create(scr, NULL);
234
+    lv_ex_line(line3, line_points[2]);
235
+
236
+    buttonE0Text = lv_btn_create(scr, NULL);                                /*Add a button the current screen*/
237
+    lv_obj_set_pos(buttonE0Text, PARA_UI_POS_X, PARA_UI_POS_Y * 4);         /*Set its position*/
238
+    lv_obj_set_size(buttonE0Text, PARA_UI_VALUE_SIZE_X, PARA_UI_SIZE_Y);    /*Set its size*/
239
+    lv_obj_set_event_cb(buttonE0Text, event_handler);
240
+    lv_btn_set_style(buttonE0Text, LV_BTN_STYLE_REL, &tft_style_label_rel); /*Set the button's released style*/
241
+    lv_btn_set_style(buttonE0Text, LV_BTN_STYLE_PR, &tft_style_label_pre);  /*Set the button's pressed style*/
242
+    lv_btn_set_layout(buttonE0Text, LV_LAYOUT_OFF);
243
+    labelE0Text = lv_label_create(buttonE0Text, NULL);                      /*Add a label to the button*/
244
+
245
+    buttonE0Value = lv_imgbtn_create(scr, NULL);
246
+    lv_obj_set_pos(buttonE0Value, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 4 + PARA_UI_VALUE_V);
247
+    lv_obj_set_event_cb_mks(buttonE0Value, event_handler, ID_TMC_CURRENT_E0, "bmp_value_blank.bin", 0);
248
+    lv_imgbtn_set_src(buttonE0Value, LV_BTN_STATE_REL, &bmp_para_bank);
249
+    lv_imgbtn_set_src(buttonE0Value, LV_BTN_STATE_PR, &bmp_para_bank);
250
+    lv_imgbtn_set_style(buttonE0Value, LV_BTN_STATE_PR, &style_para_value_pre);
251
+    lv_imgbtn_set_style(buttonE0Value, LV_BTN_STATE_REL, &style_para_value_rel);
252
+    lv_btn_set_layout(buttonE0Value, LV_LAYOUT_OFF);
253
+    labelE0Value = lv_label_create(buttonE0Value, NULL);
254
+
255
+    line4 = lv_line_create(scr, NULL);
256
+    lv_ex_line(line4, line_points[3]);
257
+
258
+    #if AXIS_IS_TMC(E1)
259
+      buttonTurnPage = lv_imgbtn_create(scr, NULL);
260
+      lv_obj_set_event_cb_mks(buttonTurnPage, event_handler, ID_TMC_CURRENT_DOWN, "bmp_back70x40.bin", 0);
261
+      lv_imgbtn_set_src(buttonTurnPage, LV_BTN_STATE_REL, &bmp_para_back);
262
+      lv_imgbtn_set_src(buttonTurnPage, LV_BTN_STATE_PR, &bmp_para_back);
263
+      lv_imgbtn_set_style(buttonTurnPage, LV_BTN_STATE_PR, &tft_style_label_pre);
264
+      lv_imgbtn_set_style(buttonTurnPage, LV_BTN_STATE_REL, &tft_style_label_rel);
265
+    #endif
266
+  }
267
+  else {
268
+    #if AXIS_IS_TMC(E1)
269
+      buttonE1Text = lv_btn_create(scr, NULL);                                /*Add a button the current screen*/
270
+      lv_obj_set_pos(buttonE1Text, PARA_UI_POS_X, PARA_UI_POS_Y);             /*Set its position*/
271
+      lv_obj_set_size(buttonE1Text, PARA_UI_VALUE_SIZE_X, PARA_UI_SIZE_Y);    /*Set its size*/
272
+      lv_obj_set_event_cb(buttonE1Text, event_handler);
273
+      lv_btn_set_style(buttonE1Text, LV_BTN_STYLE_REL, &tft_style_label_rel); /*Set the button's released style*/
274
+      lv_btn_set_style(buttonE1Text, LV_BTN_STYLE_PR, &tft_style_label_pre);  /*Set the button's pressed style*/
275
+      lv_btn_set_layout(buttonE1Text, LV_LAYOUT_OFF);
276
+      labelE1Text = lv_label_create(buttonE1Text, NULL);                      /*Add a label to the button*/
277
+
278
+      buttonE1Value = lv_imgbtn_create(scr, NULL);
279
+      lv_obj_set_pos(buttonE1Value, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y + PARA_UI_VALUE_V);
280
+      lv_obj_set_event_cb_mks(buttonE1Value, event_handler, ID_TMC_CURRENT_E1, "bmp_value_blank.bin", 0);
281
+      lv_imgbtn_set_src(buttonE1Value, LV_BTN_STATE_REL, &bmp_para_bank);
282
+      lv_imgbtn_set_src(buttonE1Value, LV_BTN_STATE_PR, &bmp_para_bank);
283
+      lv_imgbtn_set_style(buttonE1Value, LV_BTN_STATE_PR, &style_para_value_pre);
284
+      lv_imgbtn_set_style(buttonE1Value, LV_BTN_STATE_REL, &style_para_value_rel);
285
+      lv_btn_set_layout(buttonE1Value, LV_LAYOUT_OFF);
286
+      labelE1Value = lv_label_create(buttonE1Value, NULL);
287
+
288
+      line1 = lv_line_create(scr, NULL);
289
+      lv_ex_line(line1, line_points[0]);
290
+
291
+      buttonTurnPage = lv_imgbtn_create(scr, NULL);
292
+      lv_obj_set_event_cb_mks(buttonTurnPage, event_handler, ID_TMC_CURRENT_UP, "bmp_back70x40.bin", 0);
293
+      lv_imgbtn_set_src(buttonTurnPage, LV_BTN_STATE_REL, &bmp_para_back);
294
+      lv_imgbtn_set_src(buttonTurnPage, LV_BTN_STATE_PR, &bmp_para_back);
295
+      lv_imgbtn_set_style(buttonTurnPage, LV_BTN_STATE_PR, &tft_style_label_pre);
296
+      lv_imgbtn_set_style(buttonTurnPage, LV_BTN_STATE_REL, &tft_style_label_rel);
297
+    #endif
298
+  }
299
+  #if AXIS_IS_TMC(E1)
300
+    lv_obj_set_pos(buttonTurnPage, PARA_UI_TURN_PAGE_POS_X, PARA_UI_TURN_PAGE_POS_Y);
301
+    lv_btn_set_layout(buttonTurnPage, LV_LAYOUT_OFF);
302
+    labelTurnPage = lv_label_create(buttonTurnPage, NULL);
303
+  #endif
304
+
305
+  buttonBack = lv_imgbtn_create(scr, NULL);
306
+  lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_TMC_CURRENT_RETURN, "bmp_back70x40.bin", 0);
307
+  lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_REL, &bmp_para_back);
308
+  lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_PR, &bmp_para_back);
309
+  lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_PR, &tft_style_label_pre);
310
+  lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_REL, &tft_style_label_rel);
311
+
312
+  lv_obj_set_pos(buttonBack, PARA_UI_BACL_POS_X, PARA_UI_BACL_POS_Y);
313
+  lv_btn_set_layout(buttonBack, LV_LAYOUT_OFF);
314
+  label_Back = lv_label_create(buttonBack, NULL);
315
+
316
+  if (gCfgItems.multiple_language != 0) {
317
+    if (uiCfg.para_ui_page != 1) {
318
+      lv_label_set_text(labelXText, machine_menu.X_Current);
319
+      lv_obj_align(labelXText, buttonXText, LV_ALIGN_IN_LEFT_MID, 0, 0);
320
+
321
+      lv_label_set_text(labelYText, machine_menu.Y_Current);
322
+      lv_obj_align(labelYText, buttonYText, LV_ALIGN_IN_LEFT_MID, 0, 0);
323
+
324
+      lv_label_set_text(labelZText, machine_menu.Z_Current);
325
+      lv_obj_align(labelZText, buttonZText, LV_ALIGN_IN_LEFT_MID, 0, 0);
326
+
327
+      lv_label_set_text(labelE0Text, machine_menu.E0_Current);
328
+      lv_obj_align(labelE0Text, buttonE0Text, LV_ALIGN_IN_LEFT_MID, 0, 0);
329
+      #if AXIS_IS_TMC(E1)
330
+        lv_label_set_text(labelTurnPage, machine_menu.next);
331
+        lv_obj_align(labelTurnPage, buttonTurnPage, LV_ALIGN_CENTER, 0, 0);
332
+      #endif
333
+      #if AXIS_IS_TMC(X)
334
+        milliamps = stepperX.getMilliamps();
335
+        ZERO(public_buf_l);
336
+        sprintf_P(public_buf_l, PSTR("%.1f"), milliamps);
337
+        lv_label_set_text(labelXValue, public_buf_l);
338
+        lv_obj_align(labelXValue, buttonXValue, LV_ALIGN_CENTER, 0, 0);
339
+      #endif
340
+      #if AXIS_IS_TMC(Y)
341
+        milliamps = stepperY.getMilliamps();
342
+        ZERO(public_buf_l);
343
+        sprintf_P(public_buf_l, PSTR("%.1f"), milliamps);
344
+        lv_label_set_text(labelYValue, public_buf_l);
345
+        lv_obj_align(labelYValue, buttonYValue, LV_ALIGN_CENTER, 0, 0);
346
+      #endif
347
+      #if AXIS_IS_TMC(Z)
348
+        milliamps = stepperZ.getMilliamps();
349
+        ZERO(public_buf_l);
350
+        sprintf_P(public_buf_l, PSTR("%.1f"), milliamps);
351
+        lv_label_set_text(labelZValue, public_buf_l);
352
+        lv_obj_align(labelZValue, buttonZValue, LV_ALIGN_CENTER, 0, 0);
353
+      #endif
354
+      #if AXIS_IS_TMC(E0)
355
+        milliamps = stepperE0.getMilliamps();
356
+        ZERO(public_buf_l);
357
+        sprintf_P(public_buf_l, PSTR("%.1f"), milliamps);
358
+        lv_label_set_text(labelE0Value, public_buf_l);
359
+        lv_obj_align(labelE0Value, buttonE0Value, LV_ALIGN_CENTER, 0, 0);
360
+      #endif
361
+    }
362
+    else {
363
+      #if AXIS_IS_TMC(E1)
364
+        lv_label_set_text(labelE1Text, machine_menu.E1_Current);
365
+        lv_obj_align(labelE1Text, buttonE1Text, LV_ALIGN_IN_LEFT_MID, 0, 0);
366
+
367
+        lv_label_set_text(labelTurnPage, machine_menu.previous);
368
+        lv_obj_align(labelTurnPage, buttonTurnPage, LV_ALIGN_CENTER, 0, 0);
369
+
370
+        milliamps = stepperE1.getMilliamps();
371
+        ZERO(public_buf_l);
372
+        sprintf_P(public_buf_l, PSTR("%.1f"), milliamps);
373
+        lv_label_set_text(labelE1Value, public_buf_l);
374
+        lv_obj_align(labelE1Value, buttonE1Value, LV_ALIGN_CENTER, 0, 0);
375
+      #endif
376
+    }
377
+
378
+    lv_label_set_text(label_Back, common_menu.text_back);
379
+    lv_obj_align(label_Back, buttonBack, LV_ALIGN_CENTER, 0, 0);
380
+  }
381
+}
382
+
383
+void lv_clear_tmc_current_settings() { lv_obj_del(scr); }
384
+
385
+#endif // HAS_TFT_LVGL_UI && HAS_TRINAMIC_CONFIG

+ 34
- 0
Marlin/src/lcd/extui/lib/mks_ui/draw_tmc_current_settings.h View File

@@ -0,0 +1,34 @@
1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
+ *
5
+ * Based on Sprinter and grbl.
6
+ * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
7
+ *
8
+ * This program is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+#pragma once
23
+
24
+#ifdef __cplusplus
25
+extern "C" { /* C-declarations for C++ */
26
+#endif
27
+
28
+extern void lv_draw_tmc_current_settings(void);
29
+extern void lv_clear_tmc_current_settings();
30
+
31
+#ifdef __cplusplus
32
+} /* C-declarations for C++ */
33
+#endif
34
+

+ 478
- 0
Marlin/src/lcd/extui/lib/mks_ui/draw_tmc_step_mode_settings.cpp View File

@@ -0,0 +1,478 @@
1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
+ *
5
+ * Based on Sprinter and grbl.
6
+ * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
7
+ *
8
+ * This program is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+#include "../../../../inc/MarlinConfigPre.h"
23
+
24
+#if BOTH(HAS_TFT_LVGL_UI, HAS_STEALTHCHOP)
25
+
26
+#include "lv_conf.h"
27
+#include "draw_ui.h"
28
+
29
+#include "../../../../MarlinCore.h"
30
+#include "../../../../module/planner.h"
31
+#include "../../../../module/stepper/indirection.h"
32
+#include "../../../../feature/tmc_util.h"
33
+#include "../../../../gcode/gcode.h"
34
+#include "../../../../module/planner.h"
35
+
36
+static lv_obj_t * scr;
37
+
38
+#define ID_TMC_MODE_RETURN 1
39
+#define ID_TMC_MODE_X      2
40
+#define ID_TMC_MODE_Y      3
41
+#define ID_TMC_MODE_Z      4
42
+#define ID_TMC_MODE_E0     5
43
+#define ID_TMC_MODE_E1     6
44
+#define ID_TMC_MODE_DOWN   7
45
+#define ID_TMC_MODE_UP     8
46
+
47
+static lv_obj_t *labelXState = NULL, *labelYState = NULL, *labelZState = NULL, *labelE0State = NULL;
48
+static lv_obj_t *buttonXState = NULL, *buttonYState = NULL, *buttonZState = NULL, *buttonE0State = NULL;
49
+
50
+#if AXIS_HAS_STEALTHCHOP(E1)
51
+  static lv_obj_t *labelE1State = NULL, *buttonE1State = NULL;
52
+#endif
53
+
54
+static void event_handler(lv_obj_t * obj, lv_event_t event) {
55
+  switch (obj->mks_obj_id) {
56
+    case ID_TMC_MODE_RETURN:
57
+      if (event == LV_EVENT_CLICKED) {
58
+
59
+      }
60
+      else if (event == LV_EVENT_RELEASED) {
61
+        uiCfg.para_ui_page = 0;
62
+        lv_clear_tmc_step_mode_settings();
63
+        draw_return_ui();
64
+      }
65
+      break;
66
+    case ID_TMC_MODE_X:
67
+      if (event == LV_EVENT_CLICKED) {
68
+
69
+      }
70
+      else if (event == LV_EVENT_RELEASED) {
71
+        if (stepperX.stored.stealthChop_enabled == true) {
72
+          stepperX.stored.stealthChop_enabled = false;
73
+          stepperX.refresh_stepping_mode();
74
+          lv_obj_set_event_cb_mks(buttonXState, event_handler, ID_TMC_MODE_X, "bmp_disable.bin", 0);
75
+          lv_label_set_text(labelXState, machine_menu.disable);
76
+          // lv_obj_align(labelXState, buttonE1State, LV_ALIGN_IN_LEFT_MID,0, 0);
77
+          // gcode.process_subcommands_now_P(PSTR("M500"));
78
+        }
79
+        else {
80
+          stepperX.stored.stealthChop_enabled = true;
81
+          stepperX.refresh_stepping_mode();
82
+          lv_obj_set_event_cb_mks(buttonXState, event_handler, ID_TMC_MODE_X, "bmp_enable.bin", 0);
83
+          lv_label_set_text(labelXState, machine_menu.enable);
84
+          // gcode.process_subcommands_now_P(PSTR("M500"));
85
+        }
86
+        gcode.process_subcommands_now_P(PSTR("M500"));
87
+      }
88
+      break;
89
+    case ID_TMC_MODE_Y:
90
+      if (event == LV_EVENT_CLICKED) {
91
+
92
+      }
93
+      else if (event == LV_EVENT_RELEASED) {
94
+        if (stepperY.stored.stealthChop_enabled == true) {
95
+          stepperY.stored.stealthChop_enabled = false;
96
+          stepperY.refresh_stepping_mode();
97
+          lv_obj_set_event_cb_mks(buttonYState, event_handler, ID_TMC_MODE_Y, "bmp_disable.bin", 0);
98
+          lv_label_set_text(labelYState, machine_menu.disable);
99
+          // lv_obj_align(labelXState, buttonE1State, LV_ALIGN_IN_LEFT_MID,0, 0);
100
+        }
101
+        else {
102
+          stepperY.stored.stealthChop_enabled = true;
103
+          stepperY.refresh_stepping_mode();
104
+          lv_obj_set_event_cb_mks(buttonYState, event_handler, ID_TMC_MODE_Y, "bmp_enable.bin", 0);
105
+          lv_label_set_text(labelYState, machine_menu.enable);
106
+        }
107
+        gcode.process_subcommands_now_P(PSTR("M500"));
108
+      }
109
+      break;
110
+    case ID_TMC_MODE_Z:
111
+      if (event == LV_EVENT_CLICKED) {
112
+
113
+      }
114
+      else if (event == LV_EVENT_RELEASED) {
115
+        if (stepperZ.stored.stealthChop_enabled == true) {
116
+          stepperZ.stored.stealthChop_enabled = false;
117
+          stepperZ.refresh_stepping_mode();
118
+          lv_obj_set_event_cb_mks(buttonZState, event_handler, ID_TMC_MODE_Z, "bmp_disable.bin", 0);
119
+          lv_label_set_text(labelZState, machine_menu.disable);
120
+          // lv_obj_align(labelXState, buttonE1State, LV_ALIGN_IN_LEFT_MID,0, 0);
121
+        }
122
+        else {
123
+          stepperZ.stored.stealthChop_enabled = true;
124
+          stepperZ.refresh_stepping_mode();
125
+          lv_obj_set_event_cb_mks(buttonZState, event_handler, ID_TMC_MODE_Z, "bmp_enable.bin", 0);
126
+          lv_label_set_text(labelZState, machine_menu.enable);
127
+        }
128
+        gcode.process_subcommands_now_P(PSTR("M500"));
129
+      }
130
+      break;
131
+    case ID_TMC_MODE_E0:
132
+      if (event == LV_EVENT_CLICKED) {
133
+
134
+      }
135
+      else if (event == LV_EVENT_RELEASED) {
136
+        if (stepperE0.stored.stealthChop_enabled == true) {
137
+          stepperE0.stored.stealthChop_enabled = false;
138
+          stepperE0.refresh_stepping_mode();
139
+          lv_obj_set_event_cb_mks(buttonE0State, event_handler, ID_TMC_MODE_E0, "bmp_disable.bin", 0);
140
+          lv_label_set_text(labelE0State, machine_menu.disable);
141
+          // lv_obj_align(labelXState, buttonE1State, LV_ALIGN_IN_LEFT_MID,0, 0);
142
+        }
143
+        else {
144
+          stepperE0.stored.stealthChop_enabled = true;
145
+          stepperE0.refresh_stepping_mode();
146
+          lv_obj_set_event_cb_mks(buttonE0State, event_handler, ID_TMC_MODE_E0, "bmp_enable.bin", 0);
147
+          lv_label_set_text(labelE0State, machine_menu.enable);
148
+        }
149
+        gcode.process_subcommands_now_P(PSTR("M500"));
150
+      }
151
+      break;
152
+      #if AXIS_HAS_STEALTHCHOP(E1)
153
+        case ID_TMC_MODE_E1:
154
+          if (event == LV_EVENT_CLICKED) {
155
+
156
+          }
157
+          else if (event == LV_EVENT_RELEASED) {
158
+            if (stepperE1.stored.stealthChop_enabled == true) {
159
+              stepperE1.stored.stealthChop_enabled = false;
160
+              stepperE1.refresh_stepping_mode();
161
+              lv_obj_set_event_cb_mks(buttonE1State, event_handler, ID_TMC_MODE_E1, "bmp_disable.bin", 0);
162
+              lv_label_set_text(labelE1State, machine_menu.disable);
163
+              // lv_obj_align(labelXState, buttonE1State, LV_ALIGN_IN_LEFT_MID,0, 0);
164
+            }
165
+            else {
166
+              stepperE1.stored.stealthChop_enabled = true;
167
+              stepperE1.refresh_stepping_mode();
168
+              lv_obj_set_event_cb_mks(buttonE1State, event_handler, ID_TMC_MODE_E1, "bmp_enable.bin", 0);
169
+              lv_label_set_text(labelE1State, machine_menu.enable);
170
+            }
171
+            gcode.process_subcommands_now_P(PSTR("M500"));
172
+          }
173
+          break;
174
+
175
+        case ID_TMC_MODE_UP:
176
+          if (event == LV_EVENT_CLICKED) {
177
+
178
+          }
179
+          else if (event == LV_EVENT_RELEASED) {
180
+            uiCfg.para_ui_page = 0;
181
+            lv_clear_tmc_step_mode_settings();
182
+            lv_draw_tmc_step_mode_settings();
183
+          }
184
+          break;
185
+        case ID_TMC_MODE_DOWN:
186
+          if (event == LV_EVENT_CLICKED) {
187
+
188
+          }
189
+          else if (event == LV_EVENT_RELEASED) {
190
+            uiCfg.para_ui_page = 1;
191
+            lv_clear_tmc_step_mode_settings();
192
+            lv_draw_tmc_step_mode_settings();
193
+          }
194
+          break;
195
+      #endif // if AXIS_HAS_STEALTHCHOP(E1)
196
+  }
197
+}
198
+
199
+void lv_draw_tmc_step_mode_settings(void) {
200
+  lv_obj_t *buttonBack = NULL, *label_Back = NULL;
201
+  lv_obj_t *buttonXText = NULL, *labelXText = NULL;
202
+  lv_obj_t *buttonYText = NULL, *labelYText = NULL;
203
+  lv_obj_t *buttonZText = NULL, *labelZText = NULL;
204
+  lv_obj_t *buttonE0Text = NULL, *labelE0Text = NULL;
205
+
206
+  lv_obj_t * line1 = NULL, * line2 = NULL, * line3 = NULL, * line4 = NULL;
207
+  #if AXIS_HAS_STEALTHCHOP(E1)
208
+    lv_obj_t *buttonTurnPage = NULL, *labelTurnPage = NULL;
209
+    lv_obj_t *buttonE1Text = NULL, *labelE1Text = NULL;
210
+  #endif
211
+
212
+
213
+  labelXState   = NULL;
214
+  buttonXState  = NULL;
215
+  labelYState   = NULL;
216
+  buttonYState  = NULL;
217
+  labelZState   = NULL;
218
+  buttonZState  = NULL;
219
+  labelE0State  = NULL;
220
+  buttonE0State = NULL;
221
+  #if AXIS_HAS_STEALTHCHOP(E1)
222
+    labelE1State  = NULL;
223
+    buttonE1State = NULL;
224
+  #endif
225
+
226
+  if (disp_state_stack._disp_state[disp_state_stack._disp_index] != TMC_MODE_UI) {
227
+    disp_state_stack._disp_index++;
228
+    disp_state_stack._disp_state[disp_state_stack._disp_index] = TMC_MODE_UI;
229
+  }
230
+  disp_state = TMC_MODE_UI;
231
+
232
+  scr = lv_obj_create(NULL, NULL);
233
+
234
+  lv_obj_set_style(scr, &tft_style_scr);
235
+  lv_scr_load(scr);
236
+  lv_obj_clean(scr);
237
+
238
+  lv_obj_t * title = lv_label_create(scr, NULL);
239
+  lv_obj_set_style(title, &tft_style_label_rel);
240
+  lv_obj_set_pos(title, TITLE_XPOS, TITLE_YPOS);
241
+  lv_label_set_text(title, machine_menu.TmcStepModeConfTitle);
242
+
243
+  lv_refr_now(lv_refr_get_disp_refreshing());
244
+
245
+  LV_IMG_DECLARE(bmp_para_back);
246
+  LV_IMG_DECLARE(bmp_para_state);
247
+  // LV_IMG_DECLARE(bmp_para_bank);
248
+
249
+  if (uiCfg.para_ui_page != 1) {
250
+    buttonXText = lv_btn_create(scr, NULL);                                 /*Add a button the current screen*/
251
+    lv_obj_set_pos(buttonXText, PARA_UI_POS_X, PARA_UI_POS_Y);              /*Set its position*/
252
+    lv_obj_set_size(buttonXText, PARA_UI_VALUE_SIZE_X, PARA_UI_SIZE_Y);     /*Set its size*/
253
+    lv_obj_set_event_cb(buttonXText, event_handler);
254
+    lv_btn_set_style(buttonXText, LV_BTN_STYLE_REL, &tft_style_label_rel);  /*Set the button's released style*/
255
+    lv_btn_set_style(buttonXText, LV_BTN_STYLE_PR, &tft_style_label_pre);   /*Set the button's pressed style*/
256
+    lv_btn_set_layout(buttonXText, LV_LAYOUT_OFF);
257
+    labelXText = lv_label_create(buttonXText, NULL);                        /*Add a label to the button*/
258
+
259
+    buttonXState = lv_imgbtn_create(scr, NULL);
260
+    lv_obj_set_pos(buttonXState, PARA_UI_STATE_POS_X, PARA_UI_POS_Y + PARA_UI_STATE_V);
261
+    if (stepperX.get_stealthChop_status())
262
+      lv_obj_set_event_cb_mks(buttonXState, event_handler, ID_TMC_MODE_X, "bmp_enable.bin", 0);
263
+    else
264
+      lv_obj_set_event_cb_mks(buttonXState, event_handler, ID_TMC_MODE_X, "bmp_disable.bin", 0);
265
+    lv_imgbtn_set_src(buttonXState, LV_BTN_STATE_REL, &bmp_para_state);
266
+    lv_imgbtn_set_src(buttonXState, LV_BTN_STATE_PR, &bmp_para_state);
267
+    lv_imgbtn_set_style(buttonXState, LV_BTN_STATE_PR, &tft_style_label_pre);
268
+    lv_imgbtn_set_style(buttonXState, LV_BTN_STATE_REL, &tft_style_label_rel);
269
+    lv_btn_set_layout(buttonXState, LV_LAYOUT_OFF);
270
+    labelXState = lv_label_create(buttonXState, NULL);
271
+
272
+    line1 = lv_line_create(scr, NULL);
273
+    lv_ex_line(line1, line_points[0]);
274
+
275
+    buttonYText = lv_btn_create(scr, NULL);                                 /*Add a button the current screen*/
276
+    lv_obj_set_pos(buttonYText, PARA_UI_POS_X, PARA_UI_POS_Y * 2);          /*Set its position*/
277
+    lv_obj_set_size(buttonYText, PARA_UI_VALUE_SIZE_X, PARA_UI_SIZE_Y);     /*Set its size*/
278
+    lv_obj_set_event_cb(buttonYText, event_handler);
279
+    lv_btn_set_style(buttonYText, LV_BTN_STYLE_REL, &tft_style_label_rel);  /*Set the button's released style*/
280
+    lv_btn_set_style(buttonYText, LV_BTN_STYLE_PR, &tft_style_label_pre);   /*Set the button's pressed style*/
281
+    lv_btn_set_layout(buttonYText, LV_LAYOUT_OFF);
282
+    labelYText = lv_label_create(buttonYText, NULL);                        /*Add a label to the button*/
283
+
284
+    buttonYState = lv_imgbtn_create(scr, NULL);
285
+    lv_obj_set_pos(buttonYState, PARA_UI_STATE_POS_X, PARA_UI_POS_Y * 2 + PARA_UI_STATE_V);
286
+    if (stepperY.get_stealthChop_status())
287
+      lv_obj_set_event_cb_mks(buttonYState, event_handler, ID_TMC_MODE_Y, "bmp_enable.bin", 0);
288
+    else
289
+      lv_obj_set_event_cb_mks(buttonYState, event_handler, ID_TMC_MODE_Y, "bmp_disable.bin", 0);
290
+    lv_imgbtn_set_src(buttonYState, LV_BTN_STATE_REL, &bmp_para_state);
291
+    lv_imgbtn_set_src(buttonYState, LV_BTN_STATE_PR, &bmp_para_state);
292
+    lv_imgbtn_set_style(buttonYState, LV_BTN_STATE_PR, &tft_style_label_pre);
293
+    lv_imgbtn_set_style(buttonYState, LV_BTN_STATE_REL, &tft_style_label_rel);
294
+    lv_btn_set_layout(buttonYState, LV_LAYOUT_OFF);
295
+    labelYState = lv_label_create(buttonYState, NULL);
296
+
297
+    line2 = lv_line_create(scr, NULL);
298
+    lv_ex_line(line2, line_points[1]);
299
+
300
+    buttonZText = lv_btn_create(scr, NULL);                                 /*Add a button the current screen*/
301
+    lv_obj_set_pos(buttonZText, PARA_UI_POS_X, PARA_UI_POS_Y * 3);          /*Set its position*/
302
+    lv_obj_set_size(buttonZText, PARA_UI_VALUE_SIZE_X, PARA_UI_SIZE_Y);     /*Set its size*/
303
+    lv_obj_set_event_cb(buttonZText, event_handler);
304
+    lv_btn_set_style(buttonZText, LV_BTN_STYLE_REL, &tft_style_label_rel);  /*Set the button's released style*/
305
+    lv_btn_set_style(buttonZText, LV_BTN_STYLE_PR, &tft_style_label_pre);   /*Set the button's pressed style*/
306
+    lv_btn_set_layout(buttonZText, LV_LAYOUT_OFF);
307
+    labelZText = lv_label_create(buttonZText, NULL);                        /*Add a label to the button*/
308
+
309
+    buttonZState = lv_imgbtn_create(scr, NULL);
310
+    lv_obj_set_pos(buttonZState, PARA_UI_STATE_POS_X, PARA_UI_POS_Y * 3 + PARA_UI_STATE_V);
311
+    if (stepperZ.get_stealthChop_status())
312
+      lv_obj_set_event_cb_mks(buttonZState, event_handler, ID_TMC_MODE_Z, "bmp_enable.bin", 0);
313
+    else
314
+      lv_obj_set_event_cb_mks(buttonZState, event_handler, ID_TMC_MODE_Z, "bmp_disable.bin", 0);
315
+    lv_imgbtn_set_src(buttonZState, LV_BTN_STATE_REL, &bmp_para_state);
316
+    lv_imgbtn_set_src(buttonZState, LV_BTN_STATE_PR, &bmp_para_state);
317
+    lv_imgbtn_set_style(buttonZState, LV_BTN_STATE_PR, &tft_style_label_pre);
318
+    lv_imgbtn_set_style(buttonZState, LV_BTN_STATE_REL, &tft_style_label_rel);
319
+    lv_btn_set_layout(buttonZState, LV_LAYOUT_OFF);
320
+    labelZState = lv_label_create(buttonZState, NULL);
321
+
322
+    line3 = lv_line_create(scr, NULL);
323
+    lv_ex_line(line3, line_points[2]);
324
+
325
+    buttonE0Text = lv_btn_create(scr, NULL);                                /*Add a button the current screen*/
326
+    lv_obj_set_pos(buttonE0Text, PARA_UI_POS_X, PARA_UI_POS_Y * 4);         /*Set its position*/
327
+    lv_obj_set_size(buttonE0Text, PARA_UI_VALUE_SIZE_X, PARA_UI_SIZE_Y);    /*Set its size*/
328
+    lv_obj_set_event_cb(buttonE0Text, event_handler);
329
+    lv_btn_set_style(buttonE0Text, LV_BTN_STYLE_REL, &tft_style_label_rel); /*Set the button's released style*/
330
+    lv_btn_set_style(buttonE0Text, LV_BTN_STYLE_PR, &tft_style_label_pre);  /*Set the button's pressed style*/
331
+    lv_btn_set_layout(buttonE0Text, LV_LAYOUT_OFF);
332
+    labelE0Text = lv_label_create(buttonE0Text, NULL);                      /*Add a label to the button*/
333
+
334
+    buttonE0State = lv_imgbtn_create(scr, NULL);
335
+    lv_obj_set_pos(buttonE0State, PARA_UI_STATE_POS_X, PARA_UI_POS_Y * 4 + PARA_UI_STATE_V);
336
+    if (stepperE0.get_stealthChop_status())
337
+      lv_obj_set_event_cb_mks(buttonE0State, event_handler, ID_TMC_MODE_E0, "bmp_enable.bin", 0);
338
+    else
339
+      lv_obj_set_event_cb_mks(buttonE0State, event_handler, ID_TMC_MODE_E0, "bmp_disable.bin", 0);
340
+    lv_imgbtn_set_src(buttonE0State, LV_BTN_STATE_REL, &bmp_para_state);
341
+    lv_imgbtn_set_src(buttonE0State, LV_BTN_STATE_PR, &bmp_para_state);
342
+    lv_imgbtn_set_style(buttonE0State, LV_BTN_STATE_PR, &tft_style_label_pre);
343
+    lv_imgbtn_set_style(buttonE0State, LV_BTN_STATE_REL, &tft_style_label_rel);
344
+    lv_btn_set_layout(buttonE0State, LV_LAYOUT_OFF);
345
+    labelE0State = lv_label_create(buttonE0State, NULL);
346
+
347
+    line4 = lv_line_create(scr, NULL);
348
+    lv_ex_line(line4, line_points[3]);
349
+
350
+    #if AXIS_HAS_STEALTHCHOP(E1)
351
+      buttonTurnPage = lv_imgbtn_create(scr, NULL);
352
+      lv_obj_set_event_cb_mks(buttonTurnPage, event_handler, ID_TMC_MODE_DOWN, "bmp_back70x40.bin", 0);
353
+      lv_imgbtn_set_src(buttonTurnPage, LV_BTN_STATE_REL, &bmp_para_back);
354
+      lv_imgbtn_set_src(buttonTurnPage, LV_BTN_STATE_PR, &bmp_para_back);
355
+      lv_imgbtn_set_style(buttonTurnPage, LV_BTN_STATE_PR, &tft_style_label_pre);
356
+      lv_imgbtn_set_style(buttonTurnPage, LV_BTN_STATE_REL, &tft_style_label_rel);
357
+    #endif
358
+  }
359
+  else {
360
+    #if AXIS_HAS_STEALTHCHOP(E1)
361
+      buttonE1Text = lv_btn_create(scr, NULL);                                /*Add a button the current screen*/
362
+      lv_obj_set_pos(buttonE1Text, PARA_UI_POS_X, PARA_UI_POS_Y);             /*Set its position*/
363
+      lv_obj_set_size(buttonE1Text, PARA_UI_VALUE_SIZE_X, PARA_UI_SIZE_Y);    /*Set its size*/
364
+      lv_obj_set_event_cb(buttonE1Text, event_handler);
365
+      lv_btn_set_style(buttonE1Text, LV_BTN_STYLE_REL, &tft_style_label_rel); /*Set the button's released style*/
366
+      lv_btn_set_style(buttonE1Text, LV_BTN_STYLE_PR, &tft_style_label_pre);  /*Set the button's pressed style*/
367
+      lv_btn_set_layout(buttonE1Text, LV_LAYOUT_OFF);
368
+      labelE1Text = lv_label_create(buttonE1Text, NULL);                      /*Add a label to the button*/
369
+
370
+      buttonE1State = lv_imgbtn_create(scr, NULL);
371
+      lv_obj_set_pos(buttonE1State, PARA_UI_STATE_POS_X, PARA_UI_POS_Y + PARA_UI_STATE_V);
372
+      if (stepperE1.get_stealthChop_status())
373
+        lv_obj_set_event_cb_mks(buttonE1State, event_handler, ID_TMC_MODE_E1, "bmp_enable.bin", 0);
374
+      else
375
+        lv_obj_set_event_cb_mks(buttonE1State, event_handler, ID_TMC_MODE_E1, "bmp_disable.bin", 0);
376
+      lv_imgbtn_set_src(buttonE1State, LV_BTN_STATE_REL, &bmp_para_state);
377
+      lv_imgbtn_set_src(buttonE1State, LV_BTN_STATE_PR, &bmp_para_state);
378
+      lv_imgbtn_set_style(buttonE1State, LV_BTN_STATE_PR, &tft_style_label_pre);
379
+      lv_imgbtn_set_style(buttonE1State, LV_BTN_STATE_REL, &tft_style_label_rel);
380
+      lv_btn_set_layout(buttonE1State, LV_LAYOUT_OFF);
381
+      labelE1State = lv_label_create(buttonE1State, NULL);
382
+
383
+      line1 = lv_line_create(scr, NULL);
384
+      lv_ex_line(line1, line_points[0]);
385
+
386
+      buttonTurnPage = lv_imgbtn_create(scr, NULL);
387
+      lv_obj_set_event_cb_mks(buttonTurnPage, event_handler, ID_TMC_MODE_UP, "bmp_back70x40.bin", 0);
388
+      lv_imgbtn_set_src(buttonTurnPage, LV_BTN_STATE_REL, &bmp_para_back);
389
+      lv_imgbtn_set_src(buttonTurnPage, LV_BTN_STATE_PR, &bmp_para_back);
390
+      lv_imgbtn_set_style(buttonTurnPage, LV_BTN_STATE_PR, &tft_style_label_pre);
391
+      lv_imgbtn_set_style(buttonTurnPage, LV_BTN_STATE_REL, &tft_style_label_rel);
392
+    #endif
393
+  }
394
+  #if AXIS_HAS_STEALTHCHOP(E1)
395
+    lv_obj_set_pos(buttonTurnPage, PARA_UI_TURN_PAGE_POS_X, PARA_UI_TURN_PAGE_POS_Y);
396
+    lv_btn_set_layout(buttonTurnPage, LV_LAYOUT_OFF);
397
+    labelTurnPage = lv_label_create(buttonTurnPage, NULL);
398
+  #endif
399
+
400
+  buttonBack = lv_imgbtn_create(scr, NULL);
401
+  lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_TMC_MODE_RETURN, "bmp_back70x40.bin", 0);
402
+  lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_REL, &bmp_para_back);
403
+  lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_PR, &bmp_para_back);
404
+  lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_PR, &tft_style_label_pre);
405
+  lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_REL, &tft_style_label_rel);
406
+
407
+  lv_obj_set_pos(buttonBack, PARA_UI_BACL_POS_X, PARA_UI_BACL_POS_Y);
408
+  lv_btn_set_layout(buttonBack, LV_LAYOUT_OFF);
409
+  label_Back = lv_label_create(buttonBack, NULL);
410
+
411
+  if (gCfgItems.multiple_language != 0) {
412
+    if (uiCfg.para_ui_page != 1) {
413
+      lv_label_set_text(labelXText, machine_menu.X_StepMode);
414
+      lv_obj_align(labelXText, buttonXText, LV_ALIGN_IN_LEFT_MID, 0, 0);
415
+
416
+      lv_label_set_text(labelYText, machine_menu.Y_StepMode);
417
+      lv_obj_align(labelYText, buttonYText, LV_ALIGN_IN_LEFT_MID, 0, 0);
418
+
419
+      lv_label_set_text(labelZText, machine_menu.Z_StepMode);
420
+      lv_obj_align(labelZText, buttonZText, LV_ALIGN_IN_LEFT_MID, 0, 0);
421
+
422
+      lv_label_set_text(labelE0Text, machine_menu.E0_StepMode);
423
+      lv_obj_align(labelE0Text, buttonE0Text, LV_ALIGN_IN_LEFT_MID, 0, 0);
424
+
425
+      if (stepperX.get_stealthChop_status())
426
+        lv_label_set_text(labelXState, machine_menu.enable);
427
+      else
428
+        lv_label_set_text(labelXState, machine_menu.disable);
429
+      lv_obj_align(labelXState, buttonXState, LV_ALIGN_CENTER, 0, 0);
430
+
431
+      if (stepperY.get_stealthChop_status())
432
+        lv_label_set_text(labelYState, machine_menu.enable);
433
+      else
434
+        lv_label_set_text(labelYState, machine_menu.disable);
435
+      lv_obj_align(labelYState, buttonYState, LV_ALIGN_CENTER, 0, 0);
436
+
437
+      if (stepperZ.get_stealthChop_status())
438
+        lv_label_set_text(labelZState, machine_menu.enable);
439
+      else
440
+        lv_label_set_text(labelZState, machine_menu.disable);
441
+      lv_obj_align(labelZState, buttonZState, LV_ALIGN_CENTER, 0, 0);
442
+
443
+      if (stepperE0.get_stealthChop_status())
444
+        lv_label_set_text(labelE0State, machine_menu.enable);
445
+      else
446
+        lv_label_set_text(labelE0State, machine_menu.disable);
447
+      lv_obj_align(labelE0State, buttonE0State, LV_ALIGN_CENTER, 0, 0);
448
+
449
+      #if AXIS_HAS_STEALTHCHOP(E1)
450
+        lv_label_set_text(labelTurnPage, machine_menu.next);
451
+        lv_obj_align(labelTurnPage, buttonTurnPage, LV_ALIGN_CENTER, 0, 0);
452
+      #endif
453
+    }
454
+    else {
455
+      #if AXIS_HAS_STEALTHCHOP(E1)
456
+        lv_label_set_text(labelE1Text, machine_menu.E1_StepMode);
457
+        lv_obj_align(labelE1Text, buttonE1Text, LV_ALIGN_IN_LEFT_MID, 0, 0);
458
+
459
+        if (stepperE1.get_stealthChop_status())
460
+          lv_label_set_text(labelE1State, machine_menu.enable);
461
+        else
462
+          lv_label_set_text(labelE1State, machine_menu.disable);
463
+        lv_obj_align(labelE1State, buttonE1State, LV_ALIGN_CENTER, 0, 0);
464
+
465
+        lv_label_set_text(labelTurnPage, machine_menu.previous);
466
+        lv_obj_align(labelTurnPage, buttonTurnPage, LV_ALIGN_CENTER, 0, 0);
467
+
468
+      #endif
469
+    }
470
+
471
+    lv_label_set_text(label_Back, common_menu.text_back);
472
+    lv_obj_align(label_Back, buttonBack, LV_ALIGN_CENTER, 0, 0);
473
+  }
474
+}
475
+
476
+void lv_clear_tmc_step_mode_settings() { lv_obj_del(scr); }
477
+
478
+#endif // HAS_TFT_LVGL_UI && HAS_STEALTHCHOP

+ 33
- 0
Marlin/src/lcd/extui/lib/mks_ui/draw_tmc_step_mode_settings.h View File

@@ -0,0 +1,33 @@
1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
+ *
5
+ * Based on Sprinter and grbl.
6
+ * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
7
+ *
8
+ * This program is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+#pragma once
23
+
24
+#ifdef __cplusplus
25
+extern "C" { /* C-declarations for C++ */
26
+#endif
27
+
28
+extern void lv_draw_tmc_step_mode_settings(void);
29
+extern void lv_clear_tmc_step_mode_settings();
30
+
31
+#ifdef __cplusplus
32
+} /* C-declarations for C++ */
33
+#endif

+ 57
- 60
Marlin/src/lcd/extui/lib/mks_ui/draw_tool.cpp View File

@@ -21,7 +21,7 @@
21 21
  */
22 22
 #include "../../../../inc/MarlinConfigPre.h"
23 23
 
24
-#if ENABLED(TFT_LVGL_UI)
24
+#if HAS_TFT_LVGL_UI
25 25
 
26 26
 #include "lv_conf.h"
27 27
 #include "draw_ui.h"
@@ -33,11 +33,8 @@
33 33
 #include "../../../../MarlinCore.h"
34 34
 #include "../../../../gcode/queue.h"
35 35
 
36
-//static lv_obj_t *buttonMoveZ,*buttonTest,*buttonZ0,*buttonStop,*buttonReturn;
36
+// static lv_obj_t *buttonMoveZ,*buttonTest,*buttonZ0,*buttonStop,*buttonReturn;
37 37
 static lv_obj_t * scr;
38
-#if ENABLED(MKS_TEST)
39
-  extern uint8_t curent_disp_ui;
40
-#endif
41 38
 
42 39
 #define ID_T_PRE_HEAT   1
43 40
 #define ID_T_EXTRUCT    2
@@ -128,14 +125,14 @@ void lv_draw_tool(void) {
128 125
 
129 126
   scr = lv_obj_create(NULL, NULL);
130 127
 
131
-  //static lv_style_t tool_style;
128
+  // static lv_style_t tool_style;
132 129
 
133 130
   lv_obj_set_style(scr, &tft_style_scr);
134 131
   lv_scr_load(scr);
135 132
   lv_obj_clean(scr);
136 133
 
137 134
   lv_obj_t * title = lv_label_create(scr, NULL);
138
-  lv_obj_set_style(title, &tft_style_lable_rel);
135
+  lv_obj_set_style(title, &tft_style_label_rel);
139 136
   lv_obj_set_pos(title, TITLE_XPOS, TITLE_YPOS);
140 137
   lv_label_set_text(title, creat_title_text());
141 138
 
@@ -144,74 +141,74 @@ void lv_draw_tool(void) {
144 141
   LV_IMG_DECLARE(bmp_pic);
145 142
 
146 143
   /*Create an Image button*/
147
-  buttonPreHeat = lv_imgbtn_create(scr, NULL);
144
+  buttonPreHeat   = lv_imgbtn_create(scr, NULL);
148 145
   buttonExtrusion = lv_imgbtn_create(scr, NULL);
149
-  buttonMove = lv_imgbtn_create(scr, NULL);
150
-  buttonHome = lv_imgbtn_create(scr, NULL);
151
-  buttonLevel = lv_imgbtn_create(scr, NULL);
152
-  //buttonFilament = lv_imgbtn_create(scr, NULL);
153
-  //buttonMore = lv_imgbtn_create(scr, NULL);
146
+  buttonMove      = lv_imgbtn_create(scr, NULL);
147
+  buttonHome      = lv_imgbtn_create(scr, NULL);
148
+  buttonLevel     = lv_imgbtn_create(scr, NULL);
149
+  // buttonFilament = lv_imgbtn_create(scr, NULL);
150
+  // buttonMore = lv_imgbtn_create(scr, NULL);
154 151
   buttonBack = lv_imgbtn_create(scr, NULL);
155 152
 
156
-  lv_obj_set_event_cb_mks(buttonPreHeat, event_handler, ID_T_PRE_HEAT, "bmp_PreHeat.bin", 0);
153
+  lv_obj_set_event_cb_mks(buttonPreHeat, event_handler, ID_T_PRE_HEAT, "bmp_preHeat.bin", 0);
157 154
   lv_imgbtn_set_src(buttonPreHeat, LV_BTN_STATE_REL, &bmp_pic);
158 155
   lv_imgbtn_set_src(buttonPreHeat, LV_BTN_STATE_PR, &bmp_pic);
159
-  lv_imgbtn_set_style(buttonPreHeat, LV_BTN_STATE_PR, &tft_style_lable_pre);
160
-  lv_imgbtn_set_style(buttonPreHeat, LV_BTN_STATE_REL, &tft_style_lable_rel);
156
+  lv_imgbtn_set_style(buttonPreHeat, LV_BTN_STATE_PR, &tft_style_label_pre);
157
+  lv_imgbtn_set_style(buttonPreHeat, LV_BTN_STATE_REL, &tft_style_label_rel);
161 158
   lv_obj_clear_protect(buttonPreHeat, LV_PROTECT_FOLLOW);
162 159
 
163 160
   #if 1
164
-    lv_obj_set_event_cb_mks(buttonExtrusion, event_handler, ID_T_EXTRUCT, "bmp_Extruct.bin", 0);
161
+    lv_obj_set_event_cb_mks(buttonExtrusion, event_handler, ID_T_EXTRUCT, "bmp_extruct.bin", 0);
165 162
     lv_imgbtn_set_src(buttonExtrusion, LV_BTN_STATE_REL, &bmp_pic);
166 163
     lv_imgbtn_set_src(buttonExtrusion, LV_BTN_STATE_PR, &bmp_pic);
167
-    lv_imgbtn_set_style(buttonExtrusion, LV_BTN_STATE_PR, &tft_style_lable_pre);
168
-    lv_imgbtn_set_style(buttonExtrusion, LV_BTN_STATE_REL, &tft_style_lable_rel);
164
+    lv_imgbtn_set_style(buttonExtrusion, LV_BTN_STATE_PR, &tft_style_label_pre);
165
+    lv_imgbtn_set_style(buttonExtrusion, LV_BTN_STATE_REL, &tft_style_label_rel);
169 166
 
170
-    lv_obj_set_event_cb_mks(buttonMove, event_handler, ID_T_MOV, "bmp_Mov.bin", 0);
167
+    lv_obj_set_event_cb_mks(buttonMove, event_handler, ID_T_MOV, "bmp_mov.bin", 0);
171 168
     lv_imgbtn_set_src(buttonMove, LV_BTN_STATE_REL, &bmp_pic);
172 169
     lv_imgbtn_set_src(buttonMove, LV_BTN_STATE_PR, &bmp_pic);
173
-    lv_imgbtn_set_style(buttonMove, LV_BTN_STATE_PR, &tft_style_lable_pre);
174
-    lv_imgbtn_set_style(buttonMove, LV_BTN_STATE_REL, &tft_style_lable_rel);
170
+    lv_imgbtn_set_style(buttonMove, LV_BTN_STATE_PR, &tft_style_label_pre);
171
+    lv_imgbtn_set_style(buttonMove, LV_BTN_STATE_REL, &tft_style_label_rel);
175 172
 
176
-    lv_obj_set_event_cb_mks(buttonHome, event_handler, ID_T_HOME, "bmp_Zero.bin", 0);
173
+    lv_obj_set_event_cb_mks(buttonHome, event_handler, ID_T_HOME, "bmp_zero.bin", 0);
177 174
     lv_imgbtn_set_src(buttonHome, LV_BTN_STATE_REL, &bmp_pic);
178 175
     lv_imgbtn_set_src(buttonHome, LV_BTN_STATE_PR, &bmp_pic);
179
-    lv_imgbtn_set_style(buttonHome, LV_BTN_STATE_PR, &tft_style_lable_pre);
180
-    lv_imgbtn_set_style(buttonHome, LV_BTN_STATE_REL, &tft_style_lable_rel);
176
+    lv_imgbtn_set_style(buttonHome, LV_BTN_STATE_PR, &tft_style_label_pre);
177
+    lv_imgbtn_set_style(buttonHome, LV_BTN_STATE_REL, &tft_style_label_rel);
181 178
 
182
-    lv_obj_set_event_cb_mks(buttonLevel, event_handler, ID_T_LEVELING, "bmp_Leveling.bin", 0);
179
+    lv_obj_set_event_cb_mks(buttonLevel, event_handler, ID_T_LEVELING, "bmp_leveling.bin", 0);
183 180
     lv_imgbtn_set_src(buttonLevel, LV_BTN_STATE_REL, &bmp_pic);
184 181
     lv_imgbtn_set_src(buttonLevel, LV_BTN_STATE_PR, &bmp_pic);
185
-    lv_imgbtn_set_style(buttonLevel, LV_BTN_STATE_PR, &tft_style_lable_pre);
186
-    lv_imgbtn_set_style(buttonLevel, LV_BTN_STATE_REL, &tft_style_lable_rel);
187
-
188
-    //lv_obj_set_event_cb_mks(buttonFilament, event_handler,ID_T_FILAMENT,"bmp_Filamentchange.bin",0);
189
-    //lv_imgbtn_set_src(buttonFilament, LV_BTN_STATE_REL, &bmp_pic);
190
-    //lv_imgbtn_set_src(buttonFilament, LV_BTN_STATE_PR, &bmp_pic);
191
-    //lv_imgbtn_set_style(buttonFilament, LV_BTN_STATE_PR, &tft_style_lable_pre);
192
-    //lv_imgbtn_set_style(buttonFilament, LV_BTN_STATE_REL, &tft_style_lable_rel);
193
-
194
-    //lv_obj_set_event_cb_mks(buttonMore, event_handler,ID_T_MORE,"bmp_More.bin",0);
195
-    //lv_imgbtn_set_src(buttonMore, LV_BTN_STATE_REL, &bmp_pic);
196
-    //lv_imgbtn_set_src(buttonMore, LV_BTN_STATE_PR, &bmp_pic);
197
-    //lv_imgbtn_set_style(buttonMore, LV_BTN_STATE_PR, &tft_style_lable_pre);
198
-    //lv_imgbtn_set_style(buttonMore, LV_BTN_STATE_REL, &tft_style_lable_rel);
199
-
200
-    lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_T_RETURN, "bmp_Return.bin", 0);
182
+    lv_imgbtn_set_style(buttonLevel, LV_BTN_STATE_PR, &tft_style_label_pre);
183
+    lv_imgbtn_set_style(buttonLevel, LV_BTN_STATE_REL, &tft_style_label_rel);
184
+
185
+    // lv_obj_set_event_cb_mks(buttonFilament, event_handler,ID_T_FILAMENT,"bmp_Filamentchange.bin",0);
186
+    // lv_imgbtn_set_src(buttonFilament, LV_BTN_STATE_REL, &bmp_pic);
187
+    // lv_imgbtn_set_src(buttonFilament, LV_BTN_STATE_PR, &bmp_pic);
188
+    // lv_imgbtn_set_style(buttonFilament, LV_BTN_STATE_PR, &tft_style_label_pre);
189
+    // lv_imgbtn_set_style(buttonFilament, LV_BTN_STATE_REL, &tft_style_label_rel);
190
+
191
+    // lv_obj_set_event_cb_mks(buttonMore, event_handler,ID_T_MORE,"bmp_More.bin",0);
192
+    // lv_imgbtn_set_src(buttonMore, LV_BTN_STATE_REL, &bmp_pic);
193
+    // lv_imgbtn_set_src(buttonMore, LV_BTN_STATE_PR, &bmp_pic);
194
+    // lv_imgbtn_set_style(buttonMore, LV_BTN_STATE_PR, &tft_style_label_pre);
195
+    // lv_imgbtn_set_style(buttonMore, LV_BTN_STATE_REL, &tft_style_label_rel);
196
+
197
+    lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_T_RETURN, "bmp_return.bin", 0);
201 198
     lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_REL, &bmp_pic);
202 199
     lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_PR, &bmp_pic);
203
-    lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_PR, &tft_style_lable_pre);
204
-    lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_REL, &tft_style_lable_rel);
205
-  #endif
200
+    lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_PR, &tft_style_label_pre);
201
+    lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_REL, &tft_style_label_rel);
202
+  #endif // if 1
206 203
 
207 204
   lv_obj_set_pos(buttonPreHeat, INTERVAL_V, titleHeight);
208 205
   lv_obj_set_pos(buttonExtrusion, BTN_X_PIXEL + INTERVAL_V * 2, titleHeight);
209 206
   lv_obj_set_pos(buttonMove, BTN_X_PIXEL * 2 + INTERVAL_V * 3, titleHeight);
210 207
   lv_obj_set_pos(buttonHome, BTN_X_PIXEL * 3 + INTERVAL_V * 4, titleHeight);
211
-  lv_obj_set_pos(buttonLevel, INTERVAL_V,  BTN_Y_PIXEL + INTERVAL_H + titleHeight);
212
-  //lv_obj_set_pos(buttonFilament,BTN_X_PIXEL+INTERVAL_V*2,BTN_Y_PIXEL+INTERVAL_H+titleHeight);
213
-  //lv_obj_set_pos(buttonMore,BTN_X_PIXEL*2+INTERVAL_V*3,  BTN_Y_PIXEL+INTERVAL_H+titleHeight);
214
-  lv_obj_set_pos(buttonBack, BTN_X_PIXEL * 3 + INTERVAL_V * 4,  BTN_Y_PIXEL + INTERVAL_H + titleHeight);
208
+  lv_obj_set_pos(buttonLevel, INTERVAL_V, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
209
+  // lv_obj_set_pos(buttonFilament,BTN_X_PIXEL+INTERVAL_V*2,BTN_Y_PIXEL+INTERVAL_H+titleHeight);
210
+  // lv_obj_set_pos(buttonMore,BTN_X_PIXEL*2+INTERVAL_V*3, BTN_Y_PIXEL+INTERVAL_H+titleHeight);
211
+  lv_obj_set_pos(buttonBack, BTN_X_PIXEL * 3 + INTERVAL_V * 4, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
215 212
 
216 213
   /*Create a label on the Image button*/
217 214
   lv_btn_set_layout(buttonPreHeat, LV_LAYOUT_OFF);
@@ -219,15 +216,15 @@ void lv_draw_tool(void) {
219 216
   lv_btn_set_layout(buttonMove, LV_LAYOUT_OFF);
220 217
   lv_btn_set_layout(buttonHome, LV_LAYOUT_OFF);
221 218
   lv_btn_set_layout(buttonLevel, LV_LAYOUT_OFF);
222
-  //lv_btn_set_layout(buttonFilament, LV_LAYOUT_OFF);
223
-  //lv_btn_set_layout(buttonMore, LV_LAYOUT_OFF);
219
+  // lv_btn_set_layout(buttonFilament, LV_LAYOUT_OFF);
220
+  // lv_btn_set_layout(buttonMore, LV_LAYOUT_OFF);
224 221
   lv_btn_set_layout(buttonBack, LV_LAYOUT_OFF);
225 222
 
226
-  lv_obj_t * labelPreHeat = lv_label_create(buttonPreHeat, NULL);
223
+  lv_obj_t * labelPreHeat   = lv_label_create(buttonPreHeat, NULL);
227 224
   lv_obj_t * labelExtrusion = lv_label_create(buttonExtrusion, NULL);
228
-  lv_obj_t * label_Move = lv_label_create(buttonMove, NULL);
229
-  lv_obj_t * label_Home = lv_label_create(buttonHome, NULL);
230
-  lv_obj_t * label_Level = lv_label_create(buttonLevel, NULL);
225
+  lv_obj_t * label_Move     = lv_label_create(buttonMove, NULL);
226
+  lv_obj_t * label_Home     = lv_label_create(buttonHome, NULL);
227
+  lv_obj_t * label_Level    = lv_label_create(buttonLevel, NULL);
231 228
   //lv_obj_t * label_Filament = lv_label_create(buttonFilament, NULL);
232 229
   //lv_obj_t * label_More = lv_label_create(buttonMore, NULL);
233 230
   lv_obj_t * label_Back = lv_label_create(buttonBack, NULL);
@@ -254,11 +251,11 @@ void lv_draw_tool(void) {
254 251
     lv_label_set_text(label_Level, tool_menu.TERN(AUTO_BED_LEVELING_BILINEAR, autoleveling, leveling));
255 252
     lv_obj_align(label_Level, buttonLevel, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
256 253
 
257
-    //lv_label_set_text(label_Filament, tool_menu.filament);
258
-    //lv_obj_align(label_Filament, buttonFilament, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
254
+    // lv_label_set_text(label_Filament, tool_menu.filament);
255
+    // lv_obj_align(label_Filament, buttonFilament, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
259 256
 
260
-    //lv_label_set_text(label_More, tool_menu.more);
261
-    //lv_obj_align(label_More, buttonMore, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
257
+    // lv_label_set_text(label_More, tool_menu.more);
258
+    // lv_obj_align(label_More, buttonMore, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
262 259
 
263 260
     lv_label_set_text(label_Back, common_menu.text_back);
264 261
     lv_obj_align(label_Back, buttonBack, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
@@ -267,4 +264,4 @@ void lv_draw_tool(void) {
267 264
 
268 265
 void lv_clear_tool() { lv_obj_del(scr); }
269 266
 
270
-#endif // TFT_LVGL_UI
267
+#endif // HAS_TFT_LVGL_UI

+ 616
- 351
Marlin/src/lcd/extui/lib/mks_ui/draw_ui.cpp
File diff suppressed because it is too large
View File


+ 111
- 16
Marlin/src/lcd/extui/lib/mks_ui/draw_ui.h View File

@@ -22,16 +22,17 @@
22 22
 #pragma once
23 23
 
24 24
 #ifdef __cplusplus
25
-extern "C" { /* C-declarations for C++ */
25
+  extern "C" { /* C-declarations for C++ */
26 26
 #endif
27 27
 
28
+#include <lvgl.h>
29
+
28 30
 #include <stdint.h>
29 31
 #include <string.h>
30
-#include "lvgl.h"
31 32
 
32
-//the colors of the last MKS Ui
33
+// the colors of the last MKS Ui
33 34
 #undef LV_COLOR_BACKGROUND
34
-#define LV_COLOR_BACKGROUND LV_COLOR_MAKE(0x1A, 0x1A, 0x1A) //LV_COLOR_MAKE(0x00, 0x00, 0x00)
35
+#define LV_COLOR_BACKGROUND LV_COLOR_MAKE(0x1A, 0x1A, 0x1A) // LV_COLOR_MAKE(0x00, 0x00, 0x00)
35 36
 
36 37
 #include "tft_multi_language.h"
37 38
 #include "draw_ready_print.h"
@@ -41,7 +42,7 @@ extern "C" { /* C-declarations for C++ */
41 42
 #include "draw_print_file.h"
42 43
 #include "draw_dialog.h"
43 44
 #include "draw_printing.h"
44
-#include "draw_opration.h"
45
+#include "draw_operation.h"
45 46
 #include "draw_preHeat.h"
46 47
 #include "draw_extrusion.h"
47 48
 #include "draw_home.h"
@@ -51,7 +52,22 @@ extern "C" { /* C-declarations for C++ */
51 52
 #include "draw_change_speed.h"
52 53
 #include "draw_manuaLevel.h"
53 54
 #include "draw_error_message.h"
54
-#include "printer_opration.h"
55
+#include "printer_operation.h"
56
+#include "draw_machine_para.h"
57
+#include "draw_machine_settings.h"
58
+#include "draw_motor_settings.h"
59
+#include "draw_advance_settings.h"
60
+#include "draw_acceleration_settings.h"
61
+#include "draw_number_key.h"
62
+#include "draw_jerk_settings.h"
63
+#include "draw_pause_position.h"
64
+#include "draw_step_settings.h"
65
+#include "draw_tmc_current_settings.h"
66
+#include "draw_eeprom_settings.h"
67
+#include "draw_max_feedrate_settings.h"
68
+#include "draw_tmc_step_mode_settings.h"
69
+
70
+#include "../../inc/MarlinConfigPre.h"
55 71
 
56 72
 #define TFT35
57 73
 
@@ -70,8 +86,8 @@ extern "C" { /* C-declarations for C++ */
70 86
 
71 87
   #define BUTTON_TEXT_Y_OFFSET    -20
72 88
 
73
-  #define TITLE_XPOS          3    //TFT_screen.title_xpos
74
-  #define TITLE_YPOS          5    //TFT_screen.title_ypos
89
+  #define TITLE_XPOS          3    // TFT_screen.title_xpos
90
+  #define TITLE_YPOS          5    // TFT_screen.title_ypos
75 91
 
76 92
   #define FILE_BTN_CNT        6
77 93
 
@@ -81,17 +97,39 @@ extern "C" { /* C-declarations for C++ */
81 97
   #define FILE_PRE_PIC_X_OFFSET 8
82 98
   #define FILE_PRE_PIC_Y_OFFSET 0
83 99
 
84
-  #define PREVIEW_LITTLE_PIC_SIZE   40910//400*100+9*101+1
85
-  #define PREVIEW_SIZE      202720//(PREVIEW_LITTLE_PIC_SIZE+800*200+201*9+1)
100
+  #define PREVIEW_LITTLE_PIC_SIZE  40910  // 400*100+9*101+1
101
+  #define PREVIEW_SIZE      202720        // (PREVIEW_LITTLE_PIC_SIZE+800*200+201*9+1)
86 102
 
87 103
   #define GCFG_FLAG_VALUE   0xEE
88 104
 
89
-#else
105
+  // machine parameter ui
106
+  #define PARA_UI_POS_X            10
107
+  #define PARA_UI_POS_Y            50
108
+
109
+  #define PARA_UI_SIZE_X          450
110
+  #define PARA_UI_SIZE_Y           40
111
+
112
+  #define PARA_UI_ARROW_V          12
113
+
114
+  #define PARA_UI_BACL_POS_X      400
115
+  #define PARA_UI_BACL_POS_Y      270
116
+
117
+  #define PARA_UI_TURN_PAGE_POS_X 320
118
+  #define PARA_UI_TURN_PAGE_POS_Y 270
119
+
120
+  #define PARA_UI_VALUE_SIZE_X    370
121
+  #define PARA_UI_VALUE_POS_X     400
122
+  #define PARA_UI_VALUE_V           5
123
+
124
+  #define PARA_UI_STATE_POS_X     380
125
+  #define PARA_UI_STATE_V           2
126
+
127
+#else // ifdef TFT35
90 128
 
91 129
   #define TFT_WIDTH     320
92 130
   #define TFT_HEIGHT    240
93 131
 
94
-#endif
132
+#endif // ifdef TFT35
95 133
 
96 134
 extern char public_buf_m[100];
97 135
 extern char public_buf_l[30];
@@ -104,6 +142,9 @@ typedef struct {
104 142
   uint8_t from_flash_pic;
105 143
   uint8_t finish_power_off;
106 144
   uint8_t pause_reprint;
145
+  float pausePosX;
146
+  float pausePosY;
147
+  float pausePosZ;
107 148
   uint32_t curFilesize;
108 149
 } CFG_ITMES;
109 150
 
@@ -111,7 +152,8 @@ typedef struct {
111 152
   uint8_t curTempType : 1,
112 153
           curSprayerChoose : 3,
113 154
           stepHeat : 4;
114
-  uint8_t leveling_first_time : 1;
155
+  uint8_t leveling_first_time : 1,
156
+          para_ui_page : 1;
115 157
   uint8_t extruStep;
116 158
   uint8_t extruSpeed;
117 159
   uint8_t print_state;
@@ -185,7 +227,11 @@ typedef enum {
185 227
   ENABLE_INVERT_UI,
186 228
   NUMBER_KEY_UI,
187 229
   BABY_STEP_UI,
188
-  ERROR_MESSAGE_UI
230
+  ERROR_MESSAGE_UI,
231
+  PAUSE_POS_UI,
232
+  TMC_CURRENT_UI,
233
+  TMC_MODE_UI,
234
+  EEPROM_SETTINGS_UI
189 235
 } DISP_STATE;
190 236
 
191 237
 typedef struct {
@@ -203,6 +249,46 @@ typedef struct {
203 249
 } PRINT_TIME;
204 250
 extern PRINT_TIME print_time;
205 251
 
252
+typedef enum {
253
+  PrintAcceleration,
254
+  RetractAcceleration,
255
+  TravelAcceleration,
256
+  XAcceleration,
257
+  YAcceleration,
258
+  ZAcceleration,
259
+  E0Acceleration,
260
+  E1Acceleration,
261
+
262
+  XMaxFeedRate,
263
+  YMaxFeedRate,
264
+  ZMaxFeedRate,
265
+  E0MaxFeedRate,
266
+  E1MaxFeedRate,
267
+
268
+  XJerk,
269
+  YJerk,
270
+  ZJerk,
271
+  EJerk,
272
+
273
+  Xstep,
274
+  Ystep,
275
+  Zstep,
276
+  E0step,
277
+  E1step,
278
+
279
+  Xcurrent,
280
+  Ycurrent,
281
+  Zcurrent,
282
+  E0current,
283
+  E1current,
284
+
285
+  pause_pos_x,
286
+  pause_pos_y,
287
+  pause_pos_z
288
+
289
+}value_state;
290
+extern value_state value;
291
+
206 292
 extern CFG_ITMES gCfgItems;
207 293
 extern UI_CFG uiCfg;
208 294
 extern DISP_STATE disp_state;
@@ -210,8 +296,16 @@ extern DISP_STATE last_disp_state;
210 296
 extern DISP_STATE_STACK disp_state_stack;
211 297
 
212 298
 extern lv_style_t tft_style_scr;
213
-extern lv_style_t tft_style_lable_pre;
214
-extern lv_style_t tft_style_lable_rel;
299
+extern lv_style_t tft_style_label_pre;
300
+extern lv_style_t tft_style_label_rel;
301
+extern lv_style_t style_line;
302
+extern lv_style_t style_para_value_pre;
303
+extern lv_style_t style_para_value_rel;
304
+extern lv_style_t style_num_key_pre;
305
+extern lv_style_t style_num_key_rel;
306
+extern lv_style_t style_num_text;
307
+
308
+extern lv_point_t line_points[4][2];
215 309
 
216 310
 extern void gCfgItems_init();
217 311
 extern void ui_cfg_init();
@@ -230,6 +324,7 @@ extern void gCfg_to_spiFlah();
230 324
 extern void print_time_count();
231 325
 
232 326
 extern void LV_TASK_HANDLER();
327
+extern void lv_ex_line(lv_obj_t * line, lv_point_t *points);
233 328
 
234 329
 #ifdef __cplusplus
235 330
 } /* C-declarations for C++ */

+ 8
- 8
Marlin/src/lcd/extui/lib/mks_ui/gb2312_puhui16.cpp View File

@@ -21,11 +21,12 @@
21 21
  */
22 22
 #include "../../../../inc/MarlinConfigPre.h"
23 23
 
24
-#if ENABLED(TFT_LVGL_UI)
24
+#if HAS_TFT_LVGL_UI
25 25
 
26
-#include "../../../../MarlinCore.h"
27
-#include "lvgl.h"
28 26
 #include "pic_manager.h"
27
+#include <lvgl.h>
28
+
29
+#include "../../../../inc/MarlinConfig.h"
29 30
 
30 31
 #if HAS_SPI_FLASH_FONT
31 32
 
@@ -46,10 +47,10 @@ typedef struct {
46 47
 } glyph_dsc_t;
47 48
 
48 49
 static x_header_t __g_xbf_hd = { .min = 0, .max = 0, .bpp = 0 };
49
-static uint8_t __g_font_buf[75];
50
+static uint8_t __g_font_buf[63];
50 51
 
51 52
 static uint8_t *__user_font_getdata(int offset, int size) {
52
-  //memset(__g_font_buf,0,sizeof(__g_font_buf));
53
+  //ZERO(__g_font_buf);
53 54
   get_spi_flash_data((char *)__g_font_buf, offset, size);
54 55
   return __g_font_buf;
55 56
   //return &buf_test[offset];
@@ -106,10 +107,9 @@ lv_font_t gb2312_puhui32;
106 107
 void init_gb2312_font() {
107 108
   gb2312_puhui32.get_glyph_bitmap = __user_font_get_bitmap;
108 109
   gb2312_puhui32.get_glyph_dsc = __user_font_get_glyph_dsc;
109
-  gb2312_puhui32.line_height = 25;
110
+  gb2312_puhui32.line_height = 21;
110 111
   gb2312_puhui32.base_line = 0;
111 112
 }
112 113
 
113 114
 #endif // HAS_SPI_FLASH_FONT
114
-
115
-#endif // TFT_LVGL_UI
115
+#endif // HAS_TFT_LVGL_UI

+ 106
- 74
Marlin/src/lcd/extui/lib/mks_ui/mks_hardware_test.cpp View File

@@ -21,63 +21,69 @@
21 21
  */
22 22
 #include "../../../../inc/MarlinConfigPre.h"
23 23
 
24
-#if ENABLED(TFT_LVGL_UI)
24
+#if HAS_TFT_LVGL_UI
25
+
26
+#if ENABLED(TFT_LVGL_UI_SPI)
27
+  #include "SPI_TFT.h"
28
+#endif
25 29
 
26 30
 #include "tft_lvgl_configuration.h"
27
-#include "lvgl.h"
28 31
 #include "draw_ready_print.h"
29 32
 #include "W25Qxx.h"
30 33
 #include "mks_hardware_test.h"
34
+#include "draw_ui.h"
35
+#include "pic_manager.h"
36
+#include <lvgl.h>
31 37
 
32 38
 #include "../../../../MarlinCore.h"
33 39
 #include "../../../../module/temperature.h"
34 40
 #include "../../../../feature/touch/xpt2046.h"
41
+#include "../../../../sd/cardreader.h"
35 42
 
36
-#include "pic_manager.h"
37
-
38
-#if ENABLED(MKS_TEST)
39
-
40
-  extern uint8_t curent_disp_ui;
41
-
42
-  uint8_t pw_det_sta, pw_off_sta, mt_det_sta, mt_det2_sta, mt_det3_sta;
43
-  uint8_t endstopx1_sta, endstopx2_sta, endstopy1_sta, endstopy2_sta, endstopz1_sta, endstopz2_sta;
44
-  void test_gpio_readlevel_L() {
43
+uint8_t pw_det_sta, pw_off_sta, mt_det_sta, mt_det2_sta, mt_det3_sta;
44
+uint8_t endstopx1_sta, endstopx2_sta, endstopy1_sta, endstopy2_sta, endstopz1_sta, endstopz2_sta;
45
+void test_gpio_readlevel_L() {
46
+  #if ENABLED(MKS_TEST)
45 47
     volatile uint32_t itest;
46
-    WRITE(WIFI_IO2_PIN, HIGH);
48
+    WRITE(WIFI_IO0_PIN, HIGH);
47 49
     itest = 10000;
48 50
     while (itest--);
49 51
     pw_det_sta = (READ(POWER_LOSS_PIN) == 0);
50 52
     pw_off_sta = (READ(PS_ON_PIN) == 0);
51
-    mt_det_sta = (READ(FIL_RUNOUT_PIN) == 0);
52
-    mt_det2_sta = (READ(FIL_RUNOUT_2_PIN) == 0);
53
-    mt_det3_sta = (READ(FIL_RUNOUT_3_PIN) == 0);
53
+    mt_det_sta = (READ(MT_DET_1_PIN) == 0);
54
+    mt_det2_sta = (READ(MT_DET_2_PIN) == 0);
55
+    //mt_det3_sta = (READ(FIL_RUNOUT_3_PIN) == 0);
54 56
     endstopx1_sta = (READ(X_MIN_PIN) == 0);
55 57
     endstopx2_sta = (READ(X_MAX_PIN) == 0);
56 58
     endstopy1_sta = (READ(Y_MIN_PIN) == 0);
57 59
     endstopy2_sta = (READ(Y_MAX_PIN) == 0);
58 60
     endstopz1_sta = (READ(Z_MIN_PIN) == 0);
59 61
     endstopz2_sta = (READ(Z_MAX_PIN) == 0);
60
-  }
62
+  #endif
63
+}
61 64
 
62
-  void test_gpio_readlevel_H() {
65
+void test_gpio_readlevel_H() {
66
+  #if ENABLED(MKS_TEST)
63 67
     volatile uint32_t itest;
64
-    WRITE(WIFI_IO2_PIN, LOW);
68
+    WRITE(WIFI_IO0_PIN, LOW);
65 69
     itest = 10000;
66 70
     while (itest--);
67 71
     pw_det_sta = (READ(POWER_LOSS_PIN) == 1);
68 72
     pw_off_sta = (READ(PS_ON_PIN) == 1);
69
-    mt_det_sta = (READ(FIL_RUNOUT_PIN) == 1);
70
-    mt_det2_sta = (READ(FIL_RUNOUT_2_PIN) == 1);
71
-    mt_det3_sta = (READ(FIL_RUNOUT_3_PIN) == 1);
73
+    mt_det_sta = (READ(MT_DET_1_PIN) == 1);
74
+    mt_det2_sta = (READ(MT_DET_2_PIN) == 1);
75
+    //mt_det3_sta = (READ(MT_DET_3_PIN) == 1);
72 76
     endstopx1_sta = (READ(X_MIN_PIN) == 1);
73 77
     endstopx2_sta = (READ(X_MAX_PIN) == 1);
74 78
     endstopy1_sta = (READ(Y_MIN_PIN) == 1);
75 79
     endstopy2_sta = (READ(Y_MAX_PIN) == 1);
76 80
     endstopz1_sta = (READ(Z_MIN_PIN) == 1);
77 81
     endstopz2_sta = (READ(Z_MAX_PIN) == 1);
78
-  }
82
+  #endif
83
+}
79 84
 
80
-  void init_Tst_GPIO() {
85
+void init_test_gpio() {
86
+  #ifdef MKS_TEST
81 87
     SET_INPUT_PULLUP(X_MIN_PIN);
82 88
     SET_INPUT_PULLUP(X_MAX_PIN);
83 89
     SET_INPUT_PULLUP(Y_MIN_PIN);
@@ -85,70 +91,77 @@
85 91
     SET_INPUT_PULLUP(Z_MIN_PIN);
86 92
     SET_INPUT_PULLUP(Z_MAX_PIN);
87 93
 
88
-    SET_OUTPUT(WIFI_IO2_PIN);
94
+    SET_OUTPUT(WIFI_IO0_PIN);
89 95
 
90
-    SET_INPUT_PULLUP(FIL_RUNOUT_PIN);
91
-    SET_INPUT_PULLUP(FIL_RUNOUT_2_PIN);
92
-    SET_INPUT_PULLUP(FIL_RUNOUT_3_PIN);
96
+    SET_INPUT_PULLUP(MT_DET_1_PIN);
97
+    SET_INPUT_PULLUP(MT_DET_2_PIN);
98
+    //SET_INPUT_PULLUP(MT_DET_3_PIN);
93 99
 
94 100
     SET_INPUT_PULLUP(POWER_LOSS_PIN);
95 101
     SET_INPUT_PULLUP(PS_ON_PIN);
96 102
 
97 103
     SET_INPUT_PULLUP(SERVO0_PIN);
98 104
 
99
-    SET_OUTPUT(E0_ENABLE_PIN);
100 105
     SET_OUTPUT(X_ENABLE_PIN);
106
+    SET_OUTPUT(Y_ENABLE_PIN);
107
+    SET_OUTPUT(Z_ENABLE_PIN);
108
+    SET_OUTPUT(E0_ENABLE_PIN);
109
+    SET_OUTPUT(E1_ENABLE_PIN);
101 110
 
102 111
     WRITE(X_ENABLE_PIN, LOW);
103 112
     WRITE(Y_ENABLE_PIN, LOW);
104 113
     WRITE(Z_ENABLE_PIN, LOW);
105 114
     WRITE(E0_ENABLE_PIN, LOW);
106 115
     WRITE(E1_ENABLE_PIN, LOW);
107
-    WRITE(E2_ENABLE_PIN, LOW);
108
-  }
116
+    //WRITE(E2_ENABLE_PIN, LOW);
117
+  #endif
118
+}
109 119
 
110
-  void mks_test_beeper() {
120
+void mks_test_beeper() {
121
+  #ifdef MKS_TEST
111 122
     WRITE(BEEPER_PIN, HIGH);
112 123
     delay(100);
113 124
     WRITE(BEEPER_PIN, LOW);
114 125
     delay(100);
115
-  }
126
+  #endif
127
+}
116 128
 
117
-  void Test_GPIO() {
118
-    init_Tst_GPIO();
129
+void mks_gpio_test(){
130
+  #if ENABLED(MKS_TEST)
131
+    init_test_gpio();
119 132
 
120 133
     test_gpio_readlevel_L();
121 134
     test_gpio_readlevel_H();
122 135
     test_gpio_readlevel_L();
123
-    if ((pw_det_sta == 1) && (mt_det_sta == 1) && (mt_det2_sta == 1) && (mt_det3_sta == 1)) {
124
-      if (curent_disp_ui == 1) disp_det_ok();
125
-    }
126
-    else if (curent_disp_ui == 1) disp_det_error();
127
-    if ((endstopx1_sta == 1)
128
-        && (endstopx2_sta == 1)
129
-        && (endstopy1_sta == 1)
130
-        && (endstopy2_sta == 1)
131
-        && (endstopz1_sta == 1)
132
-        && (endstopz2_sta == 1)
133
-        ) {
134
-      if (curent_disp_ui == 1) disp_Limit_ok();
135
-    }
136
-    else if (curent_disp_ui == 1)
137
-      disp_Limit_error();
138
-      //mks_test_beeper();
136
+    if ((pw_det_sta == 1) && (mt_det_sta == 1) && (mt_det2_sta == 1)) // &&(mt_det3_sta == 1))
137
+      disp_det_ok();
138
+    else
139
+      disp_det_error();
139 140
 
140
-  }
141
+    if ( (endstopx1_sta == 1)
142
+      && (endstopx2_sta == 1)
143
+      && (endstopy1_sta == 1)
144
+      && (endstopy2_sta == 1)
145
+      && (endstopz1_sta == 1)
146
+      && (endstopz2_sta == 1)
147
+    )
148
+      disp_Limit_ok();
149
+    else
150
+      disp_Limit_error();
151
+    #endif
152
+}
141 153
 
142
-  void mks_test() {
154
+void mks_hardware_test(){
155
+  #if ENABLED(MKS_TEST)
143 156
     if (millis() % 2000 < 1000) {
144 157
       WRITE(X_DIR_PIN, LOW);
145 158
       WRITE(Y_DIR_PIN, LOW);
146 159
       WRITE(Z_DIR_PIN, LOW);
147 160
       WRITE(E0_DIR_PIN, LOW);
148 161
       WRITE(E1_DIR_PIN, LOW);
149
-      WRITE(E2_DIR_PIN, LOW);
162
+      //WRITE(E2_DIR_PIN, LOW);
150 163
       thermalManager.fan_speed[0] = 255;
151
-      WRITE(HEATER_2_PIN, HIGH); // HE2
164
+      //WRITE(HEATER_2_PIN, HIGH); // HE2
152 165
       WRITE(HEATER_1_PIN, HIGH); // HE1
153 166
       WRITE(HEATER_0_PIN, HIGH); // HE0
154 167
       WRITE(HEATER_BED_PIN, HIGH); // HOT-BED
@@ -159,28 +172,29 @@
159 172
       WRITE(Z_DIR_PIN, HIGH);
160 173
       WRITE(E0_DIR_PIN, HIGH);
161 174
       WRITE(E1_DIR_PIN, HIGH);
162
-      WRITE(E2_DIR_PIN, HIGH);
175
+      //WRITE(E2_DIR_PIN, HIGH);
163 176
       thermalManager.fan_speed[0] = 0;
164
-      WRITE(HEATER_2_PIN, LOW); // HE2
177
+      //WRITE(HEATER_2_PIN, LOW); // HE2
165 178
       WRITE(HEATER_1_PIN, LOW); // HE1
166 179
       WRITE(HEATER_0_PIN, LOW); // HE0
167 180
       WRITE(HEATER_BED_PIN, LOW); // HOT-BED
168 181
     }
169
-    if ((endstopx1_sta == 1) && (endstopx2_sta == 1)
170
-        && (endstopy1_sta == 1) && (endstopy2_sta == 1)
171
-        && (endstopz1_sta == 1) && (endstopz2_sta == 1)
172
-        ) {
173 182
 
183
+    if ( (endstopx1_sta == 1) && (endstopx2_sta == 1)
184
+      && (endstopy1_sta == 1) && (endstopy2_sta == 1)
185
+      && (endstopz1_sta == 1) && (endstopz2_sta == 1)
186
+    ) {
187
+      // nothing here
174 188
     }
175 189
     else {
176
-      mks_test_beeper();
190
+      //mks_test_beeper();
177 191
     }
178 192
 
179
-    if (curent_disp_ui == 1)
180
-      disp_test();
181
-  }
193
+    if (disp_state == PRINT_READY_UI)
194
+      mks_disp_test();
182 195
 
183
-#endif // MKS_TEST
196
+  #endif
197
+}
184 198
 
185 199
 static const uint16_t ASCII_Table_16x24[] PROGMEM = {
186 200
   // Space ' '
@@ -568,8 +582,10 @@ static const uint16_t ASCII_Table_16x24[] PROGMEM = {
568 582
 void disp_char_1624(uint16_t x, uint16_t y, uint8_t c, uint16_t charColor, uint16_t bkColor) {
569 583
   for (uint16_t i = 0; i < 24; i++) {
570 584
     const uint16_t tmp_char = pgm_read_word(&ASCII_Table_16x24[((c - 0x20) * 24) + i]);
571
-    for (uint16_t j = 0; j < 16; j++)
572
-      tft_set_point(x + j, y + i, ((tmp_char >> j) & 0x01) ? charColor : bkColor);
585
+    for (uint16_t j = 0; j < 16; j++) {
586
+      TERN(TFT_LVGL_UI_SPI, SPI_TFT.SetPoint, tft_set_point)
587
+        (x + j, y + i, ((tmp_char >> j) & 0x01) ? charColor : bkColor);
588
+    }
573 589
   }
574 590
 }
575 591
 
@@ -582,14 +598,30 @@ void disp_string(uint16_t x, uint16_t y, const char * string, uint16_t charColor
582 598
 }
583 599
 
584 600
 //static lv_obj_t * scr_test;
585
-void disp_pic_update() {
586
-  LCD_Clear(0x0000);
587
-  disp_string(120, 150, "PIC Updating...", 0xFFFF, 0x0000);
601
+void disp_assets_update() {
602
+  #if DISABLED(TFT_LVGL_UI_SPI)
603
+    LCD_Clear(0x0000);
604
+  #endif
605
+  disp_string(100, 150, "Assets Updating...", 0xFFFF, 0x0000);
588 606
 }
589 607
 
590
-void disp_font_update() {
591
-  LCD_Clear(0x0000);
592
-  disp_string(120, 150, "FONT Updating...", 0xFFFF, 0x0000);
608
+void disp_assets_update_progress(const char *msg) {
609
+  char buf[30];
610
+  memset(buf, ' ', COUNT(buf));
611
+  strncpy(buf, msg, strlen(msg));
612
+  buf[COUNT(buf)-1] = '\0';
613
+  disp_string(100, 200, buf, 0xFFFF, 0x0000);
593 614
 }
594 615
 
595
-#endif // TFT_LVGL_UI
616
+uint8_t mks_test_flag = 0;
617
+const char *MKSTestPath = "MKS_TEST";
618
+
619
+#if ENABLED(SDSUPPORT)
620
+  void mks_test_get() {
621
+    SdFile dir, root = card.getroot();
622
+    if (dir.open(&root, MKSTestPath, O_RDONLY))
623
+      mks_test_flag = 0x1e;
624
+  }
625
+#endif
626
+
627
+#endif // HAS_TFT_LVGL_UI

+ 7
- 5
Marlin/src/lcd/extui/lib/mks_ui/mks_hardware_test.h View File

@@ -21,11 +21,13 @@
21 21
  */
22 22
 #pragma once
23 23
 
24
-#include "lvgl.h"
24
+#include <lvgl.h>
25 25
 
26
-void Test_GPIO();
26
+void mks_gpio_test();
27 27
 void disp_char_1624(uint16_t x, uint16_t y, uint8_t c, uint16_t charColor, uint16_t bkColor);
28 28
 void disp_string(uint16_t x, uint16_t y, const char * string, uint16_t charColor, uint16_t bkColor);
29
-void mks_test();
30
-void disp_pic_update();
31
-void disp_font_update();
29
+void mks_hardware_test();
30
+void disp_assets_update();
31
+void disp_assets_update_progress(const char *msg);
32
+void mks_test_get();
33
+extern uint8_t mks_test_flag;

+ 130
- 147
Marlin/src/lcd/extui/lib/mks_ui/pic_manager.cpp View File

@@ -21,7 +21,7 @@
21 21
  */
22 22
 #include "../../../../inc/MarlinConfigPre.h"
23 23
 
24
-#if ENABLED(TFT_LVGL_UI)
24
+#if HAS_TFT_LVGL_UI
25 25
 
26 26
 #include "../../../../MarlinCore.h"
27 27
 
@@ -40,7 +40,7 @@ extern unsigned char bmp_public_buf[17 * 1024];
40 40
   extern char *createFilename(char * const buffer, const dir_t &p);
41 41
 #endif
42 42
 
43
-static char assets[][30] = {
43
+static char assets[][LONG_FILENAME_LENGTH] = {
44 44
   //homing screen
45 45
   "bmp_Zero.bin",
46 46
   "bmp_zeroX.bin",
@@ -90,7 +90,7 @@ static char assets[][30] = {
90 90
   //select file screen
91 91
   "bmp_pageUp.bin",
92 92
   "bmp_pageDown.bin",
93
-  //"bmp_Back.bin", //TODO: why two back buttons? Why not just one? (return / back)
93
+  "bmp_Back.bin", //TODO: why two back buttons? Why not just one? (return / back)
94 94
   "bmp_Dir.bin",
95 95
   "bmp_File.bin",
96 96
 
@@ -164,14 +164,18 @@ static char assets[][30] = {
164 164
     "bmp_French_sel.bin",
165 165
     "bmp_Italy.bin",
166 166
     "bmp_Italy_sel.bin",
167
-  #endif //HAS_LANG_SELECT_SCREEN
167
+  #endif // HAS_LANG_SELECT_SCREEN
168 168
 
169
-  //gcode preview
169
+  // gcode preview
170 170
   #if HAS_GCODE_DEFAULT_VIEW_IN_FLASH
171 171
     "bmp_preview.bin",
172 172
   #endif
173 173
 
174
-  //settings screen
174
+  #if HAS_LOGO_IN_FLASH
175
+    "bmp_logo.bin",
176
+  #endif
177
+
178
+  // settings screen
175 179
   "bmp_About.bin",
176 180
   //"bmp_Language.bin",
177 181
   //"bmp_Fan.bin",
@@ -182,14 +186,27 @@ static char assets[][30] = {
182 186
   "bmp_Set.bin",
183 187
   "bmp_Tool.bin",
184 188
 
185
-  //base icons
189
+  #if ENABLED(HAS_STEALTHCHOP)
190
+    //"bmp_back70x40.bin",
191
+    "bmp_disable.bin",
192
+    "bmp_enable.bin",
193
+  #endif
194
+
195
+  // settings screen
196
+  "bmp_eeprom_settings.bin",
197
+  "bmp_machine_para.bin",
198
+  "bmp_function1.bin",
199
+
200
+  // base icons
201
+  "bmp_arrow.bin",
202
+  "bmp_back70x40.bin",
203
+  "bmp_value_blank.bin",
186 204
   "bmp_Return.bin"
187 205
 };
188 206
 
189 207
 #if HAS_SPI_FLASH_FONT
190
-  static char fonts[][50] = {
191
-    "GBK16.bin",
192
-    "UNIGBK.bin",
208
+  static char fonts[][LONG_FILENAME_LENGTH] = {
209
+    "FontUNIGBK.bin",
193 210
   };
194 211
 #endif
195 212
 
@@ -220,22 +237,19 @@ uint32_t lv_get_pic_addr(uint8_t *Pname) {
220 237
         addr = PIC_DATA_ADDR_TFT35 + i * PER_PIC_MAX_SPACE_TFT35;
221 238
       else
222 239
         addr = PIC_DATA_ADDR_TFT32 + i * PER_PIC_MAX_SPACE_TFT32;
223
-      return (addr + 4);//The purpose of adding 4 is to remove 4-byte picture header information.
240
+      return addr;
224 241
     }
225 242
   }
226 243
 
227 244
   return addr;
228 245
 }
229 246
 
230
-const char *picPath = "mks_pic";
231
-const char *bakPath = "bak_pic";
232
-
233
-const char *fontPath = "mks_font";
234
-const char *bakFont = "bak_font";
247
+const char *assetsPath = "assets";
248
+const char *bakPath = "_assets";
235 249
 
236 250
 void spiFlashErase_PIC() {
237 251
   volatile uint32_t pic_sectorcnt = 0;
238
-  for (pic_sectorcnt = 0; pic_sectorcnt < TERN(MKS_TEST, 2, PIC_SIZE_xM * 1024 / 64); pic_sectorcnt++)
252
+  for (pic_sectorcnt = 0; pic_sectorcnt < PIC_SIZE_xM * 1024 / 64; pic_sectorcnt++)
239 253
     W25QXX.SPI_FLASH_BlockErase(PICINFOADDR + pic_sectorcnt * 64 * 1024);
240 254
 }
241 255
 
@@ -347,103 +361,123 @@ uint8_t public_buf[512];
347 361
     longName[j] = '\0';
348 362
   }
349 363
 
350
-  void UpdatePic() {
351
-    char *fn;
352
-    unsigned char logoFlag;
364
+  static int8_t arrayFindStr(const char arr[][LONG_FILENAME_LENGTH], uint8_t arraySize, const char* str) {
365
+    for (uint8_t a = 0; a < arraySize; a++) {
366
+      if (strcasecmp(arr[a], str) == 0)
367
+        return a;
368
+    }
369
+    return -1;
370
+  }
371
+
372
+  #define ASSET_TYPE_ICON       0
373
+  #define ASSET_TYPE_LOGO       1
374
+  #define ASSET_TYPE_TITLE_LOGO 2
375
+  #define ASSET_TYPE_G_PREVIEW  3
376
+  #define ASSET_TYPE_FONT       4
377
+  static void loadAsset(SdFile &dir, dir_t& entry, const char *fn, int8_t assetType) {
378
+    SdFile file;
379
+    char dosFilename[FILENAME_LENGTH];
380
+    createFilename(dosFilename, entry);
381
+    if (!file.open(&dir, dosFilename, O_READ)) {
382
+      #if ENABLED(MARLIN_DEV_MODE)
383
+        SERIAL_ECHOLNPAIR("Error opening Asset: ", fn);
384
+      #endif
385
+      return;
386
+    }
387
+
388
+    disp_assets_update_progress(fn);
353 389
     uint16_t pbr;
354 390
     uint32_t pfileSize;
355 391
     uint32_t totalSizeLoaded = 0;
356 392
     uint32_t Pic_Write_Addr;
393
+    pfileSize = file.fileSize();
394
+    totalSizeLoaded += pfileSize;
395
+    if (assetType == ASSET_TYPE_LOGO) {
396
+      while (1) {
397
+        pbr = file.read(public_buf, BMP_WRITE_BUF_LEN);
398
+        Pic_Logo_Write((uint8_t *)fn, public_buf, pbr); //
399
+        if (pbr < BMP_WRITE_BUF_LEN) break;
400
+      }
401
+    }
402
+    else if (assetType == ASSET_TYPE_TITLE_LOGO) {
403
+      while (1) {
404
+        pbr = file.read(public_buf, BMP_WRITE_BUF_LEN);
405
+        Pic_TitleLogo_Write((uint8_t *)fn, public_buf, pbr); //
406
+        if (pbr < BMP_WRITE_BUF_LEN) break;
407
+      }
408
+    }
409
+    else if (assetType == ASSET_TYPE_G_PREVIEW) {
410
+      while (1) {
411
+        pbr = file.read(public_buf, BMP_WRITE_BUF_LEN);
412
+        default_view_Write(public_buf, pbr); //
413
+        if (pbr < BMP_WRITE_BUF_LEN) break;
414
+      }
415
+    }
416
+    else if (assetType == ASSET_TYPE_ICON) {
417
+      Pic_Write_Addr = Pic_Info_Write((uint8_t *)fn, pfileSize);
418
+      while (1) {
419
+        pbr = file.read(public_buf, BMP_WRITE_BUF_LEN);
420
+        W25QXX.SPI_FLASH_BufferWrite(public_buf, Pic_Write_Addr, pbr);
421
+        Pic_Write_Addr += pbr;
422
+        if (pbr < BMP_WRITE_BUF_LEN) break;
423
+      }
424
+    }
425
+    else if (assetType == ASSET_TYPE_FONT) {
426
+      Pic_Write_Addr = UNIGBK_FLASH_ADDR;
427
+      while (1) {
428
+        pbr = file.read(public_buf, BMP_WRITE_BUF_LEN);
429
+        W25QXX.SPI_FLASH_BufferWrite(public_buf, Pic_Write_Addr, pbr);
430
+        Pic_Write_Addr += pbr;
431
+        if (pbr < BMP_WRITE_BUF_LEN) break;
432
+      }
433
+    }
434
+
435
+    file.close();
436
+
437
+    #if ENABLED(MARLIN_DEV_MODE)
438
+      SERIAL_ECHOLNPAIR("Asset added: ", fn);
439
+    #endif
440
+  }
357 441
 
442
+  void UpdateAssets() {
358 443
     SdFile dir, root = card.getroot();
359
-    if (dir.open(&root, picPath, O_RDONLY)) {
444
+    if (dir.open(&root, assetsPath, O_RDONLY)) {
360 445
 
361
-      disp_pic_update();
446
+      disp_assets_update();
362 447
       spiFlashErase_PIC();
448
+      #if HAS_SPI_FLASH_FONT
449
+        spiFlashErase_FONT();
450
+      #endif
363 451
 
364 452
       dir_t d;
365 453
       while (dir.readDir(&d, card.longFilename) > 0) {
366 454
         // if we dont get a long name, but gets a short one, try it
367
-        if (card.longFilename[0] == 0 && d.name[0] != 0) {
455
+        if (card.longFilename[0] == 0 && d.name[0] != 0)
368 456
           dosName2LongName((const char*)d.name, card.longFilename);
369
-        }
457
+        if (card.longFilename[0] == 0) continue;
458
+        if (card.longFilename[0] == '.') continue;
370 459
 
371
-        if (card.longFilename[0] == 0)
372
-          continue;
373
-        if (card.longFilename[0] == '.')
374
-          continue;
460
+        uint8_t a = arrayFindStr(assets, COUNT(assets), card.longFilename);
461
+        if (a >= 0 && a < COUNT(assets)) {
462
+          uint8_t assetType = ASSET_TYPE_ICON;
463
+          if (strstr(assets[a], "_logo"))
464
+            assetType = ASSET_TYPE_LOGO;
465
+          else if (strstr(assets[a], "_titlelogo"))
466
+            assetType = ASSET_TYPE_TITLE_LOGO;
467
+          else if (strstr(assets[a], "_preview"))
468
+            assetType = ASSET_TYPE_G_PREVIEW;
375 469
 
376
-        uint8_t a = -1;
377
-        for(a = 0; a < COUNT(assets); a++) {
378
-          if (strcasecmp(assets[a], card.longFilename) == 0) {
379
-            break;
380
-          }
381
-        }
382
-        if (a < 0 || a >= COUNT(assets)) continue;
470
+          loadAsset(dir, d, assets[a], assetType);
383 471
 
384
-        fn = assets[a];
385
-        char dosFilename[FILENAME_LENGTH];
386
-        createFilename(dosFilename, d);
387
-
388
-        SdFile file;
389
-        if (!file.open(&dir, dosFilename, O_READ)) {
390
-          #if ENABLED(MARLIN_DEV_MODE)
391
-            SERIAL_ECHOLNPAIR("Error opening Asset: ", fn);
392
-          #endif
393 472
           continue;
394 473
         }
395 474
 
396
-        if (strstr(fn, "_logo"))
397
-          logoFlag = 1;
398
-        else if (strstr(fn, "_titlelogo"))
399
-          logoFlag = 2;
400
-        else if (strstr(fn, "_preview"))
401
-          logoFlag = 3;
402
-        else
403
-          logoFlag = 0;
404
-
405
-        pfileSize = file.fileSize();
406
-        totalSizeLoaded += pfileSize;
407
-        if (logoFlag == 1) {
408
-          while (1) {
409
-            pbr = file.read(public_buf, BMP_WRITE_BUF_LEN);
410
-            Pic_Logo_Write((uint8_t *)fn, public_buf, pbr); //
411
-            if (pbr < BMP_WRITE_BUF_LEN)
412
-              break;
413
-          }
414
-        }
415
-        else if (logoFlag == 2) {
416
-          while (1) {
417
-            pbr = file.read(public_buf, BMP_WRITE_BUF_LEN);
418
-            Pic_TitleLogo_Write((uint8_t *)fn, public_buf, pbr); //
419
-            if (pbr < BMP_WRITE_BUF_LEN)
420
-              break;
421
-          }
422
-        }
423
-        else if (logoFlag == 3) {
424
-          while (1) {
425
-            pbr = file.read(public_buf, BMP_WRITE_BUF_LEN);
426
-            default_view_Write(public_buf, pbr); //
427
-            if (pbr < BMP_WRITE_BUF_LEN)
428
-              break;
429
-          }
430
-        }
431
-        else {
432
-          Pic_Write_Addr = Pic_Info_Write((uint8_t *)fn, pfileSize);
433
-          while (1) {
434
-            pbr = file.read(public_buf, BMP_WRITE_BUF_LEN);
435
-            W25QXX.SPI_FLASH_BufferWrite(public_buf, Pic_Write_Addr, pbr);
436
-            Pic_Write_Addr += pbr;
437
-            if (pbr < BMP_WRITE_BUF_LEN)
438
-              break;
475
+        #if HAS_SPI_FLASH_FONT
476
+          a = arrayFindStr(fonts, COUNT(fonts), card.longFilename);
477
+          if (a >= 0 && a < COUNT(fonts)) {
478
+            loadAsset(dir, d, fonts[a], ASSET_TYPE_FONT);
439 479
           }
440
-        }
441
-
442
-        #if ENABLED(MARLIN_DEV_MODE)
443
-          SERIAL_ECHOLNPAIR("Asset added: ", fn);
444 480
         #endif
445
-
446
-        file.close();
447 481
       }
448 482
       dir.rename(&root, bakPath);
449 483
     }
@@ -452,62 +486,12 @@ uint8_t public_buf[512];
452 486
     #if ENABLED(MARLIN_DEV_MODE)
453 487
       uint8_t pic_counter = 0;
454 488
       W25QXX.SPI_FLASH_BufferRead(&pic_counter, PIC_COUNTER_ADDR, 1);
455
-      SERIAL_ECHOLNPAIR("Total assets loaded: ", pic_counter, ", Total size: ", totalSizeLoaded);
489
+      SERIAL_ECHOLNPAIR("Total assets loaded: ", pic_counter);
456 490
     #endif
457 491
   }
458 492
 
459 493
   #if HAS_SPI_FLASH_FONT
460
-
461 494
     void spi_flash_read_test() { W25QXX.SPI_FLASH_BufferRead(public_buf, UNIGBK_FLASH_ADDR, BMP_WRITE_BUF_LEN); }
462
-
463
-    void UpdateFont() {
464
-      char *fn;
465
-      uint16_t pbr;
466
-      uint32_t flashaddr = 0;
467
-
468
-      SdFile dir, root = card.getroot();
469
-      if (dir.open(&root, fontPath, O_RDONLY)) {
470
-
471
-        disp_font_update();
472
-        spiFlashErase_FONT();
473
-
474
-        dir_t d;
475
-        while (dir.readDir(&d, card.longFilename) > 0) {
476
-          if (card.longFilename[0] == 0)
477
-            break;
478
-
479
-          if (card.longFilename[0] == '.')
480
-            continue;
481
-
482
-          fn = card.longFilename;
483
-
484
-          if (strstr(fn, ".bin")) {
485
-            char dosFilename[FILENAME_LENGTH];
486
-            createFilename(dosFilename, d);
487
-            //strcat(public_buf, dosFilename);
488
-
489
-            SdFile file;
490
-            if (file.open(&dir, dosFilename, O_READ)) {
491
-
492
-              flashaddr = UNIGBK_FLASH_ADDR;
493
-              pbr = 0;
494
-              while (1) {
495
-                flashaddr += pbr;
496
-                pbr = file.read(public_buf, BMP_WRITE_BUF_LEN);
497
-                W25QXX.SPI_FLASH_BufferWrite(public_buf, flashaddr, pbr);
498
-                if (pbr < BMP_WRITE_BUF_LEN) break;
499
-              }
500
-              file.close();
501
-            }
502
-
503
-          }
504
-        }
505
-
506
-        dir.rename(&root, bakFont);
507
-        dir.close();
508
-      }
509
-    }
510
-
511 495
   #endif // HAS_SPI_FLASH_FONT
512 496
 
513 497
 #endif // SDSUPPORT
@@ -552,6 +536,7 @@ void lv_pic_test(uint8_t *P_Rbuff, uint32_t addr, uint32_t size) {
552 536
 
553 537
 uint32_t logo_addroffset = 0;
554 538
 void Pic_Logo_Read(uint8_t *LogoName, uint8_t *Logo_Rbuff, uint32_t LogoReadsize) {
539
+  W25QXX.init(SPI_QUARTER_SPEED);
555 540
   W25QXX.SPI_FLASH_BufferRead(Logo_Rbuff, PIC_LOGO_ADDR + logo_addroffset, LogoReadsize);
556 541
   logo_addroffset += LogoReadsize;
557 542
   if (logo_addroffset >= LOGO_MAX_SIZE_TFT35)
@@ -561,7 +546,6 @@ void Pic_Logo_Read(uint8_t *LogoName, uint8_t *Logo_Rbuff, uint32_t LogoReadsize
561 546
 uint32_t default_view_addroffset = 0;
562 547
 void default_view_Read(uint8_t *default_view_Rbuff, uint32_t default_view_Readsize) {
563 548
   W25QXX.init(SPI_QUARTER_SPEED);
564
-
565 549
   W25QXX.SPI_FLASH_BufferRead(default_view_Rbuff, DEFAULT_VIEW_ADDR_TFT35 + default_view_addroffset, default_view_Readsize);
566 550
   default_view_addroffset += default_view_Readsize;
567 551
   if (default_view_addroffset >= DEFAULT_VIEW_MAX_SIZE)
@@ -572,7 +556,6 @@ void default_view_Read(uint8_t *default_view_Rbuff, uint32_t default_view_Readsi
572 556
   uint32_t flash_view_addroffset = 0;
573 557
   void flash_view_Read(uint8_t *flash_view_Rbuff, uint32_t flash_view_Readsize) {
574 558
     W25QXX.init(SPI_QUARTER_SPEED);
575
-
576 559
     W25QXX.SPI_FLASH_BufferRead(flash_view_Rbuff, BAK_VIEW_ADDR_TFT35 + flash_view_addroffset, flash_view_Readsize);
577 560
     flash_view_addroffset += flash_view_Readsize;
578 561
     if (flash_view_addroffset >= FLASH_VIEW_MAX_SIZE)
@@ -580,4 +563,4 @@ void default_view_Read(uint8_t *default_view_Rbuff, uint32_t default_view_Readsi
580 563
   }
581 564
 #endif
582 565
 
583
-#endif // TFT_LVGL_UI
566
+#endif // HAS_TFT_LVGL_UI

+ 46
- 37
Marlin/src/lcd/extui/lib/mks_ui/pic_manager.h View File

@@ -25,29 +25,33 @@
25 25
 extern "C" { /* C-declarations for C++ */
26 26
 #endif
27 27
 
28
+#include "../../inc/MarlinConfigPre.h"
29
+
30
+#include <lvgl.h>
31
+
28 32
 #include <stdint.h>
29 33
 #include <string.h>
30
-#include "lvgl.h"
31
-
32
-#include "../../inc/MarlinConfigPre.h"
33 34
 
34 35
 #ifndef HAS_SPI_FLASH_FONT
35
-  #define HAS_SPI_FLASH_FONT              0 //disabled until fix the font load code
36
+  #define HAS_SPI_FLASH_FONT              1 // Disabled until fix the font load code
36 37
 #endif
37 38
 #ifndef HAS_GCODE_PREVIEW
38 39
   #define HAS_GCODE_PREVIEW               1
39 40
 #endif
40 41
 #ifndef HAS_LANG_SELECT_SCREEN
41
-  #define HAS_LANG_SELECT_SCREEN               0
42
+  #define HAS_LANG_SELECT_SCREEN          1
42 43
 #endif
43 44
 #ifndef HAS_BAK_VIEW_IN_FLASH
44
-  #define HAS_BAK_VIEW_IN_FLASH               1
45
+  #define HAS_BAK_VIEW_IN_FLASH           1
45 46
 #endif
46 47
 #ifndef HAS_GCODE_DEFAULT_VIEW_IN_FLASH
47
-  #define HAS_GCODE_DEFAULT_VIEW_IN_FLASH               1
48
+  #define HAS_GCODE_DEFAULT_VIEW_IN_FLASH 1
49
+#endif
50
+#ifndef HAS_LOGO_IN_FLASH
51
+  #define HAS_LOGO_IN_FLASH 1
48 52
 #endif
49 53
 #ifndef SPI_FLASH_SIZE
50
-  #define SPI_FLASH_SIZE                  0x1000000 // 16MB
54
+  #define SPI_FLASH_SIZE                0x1000000 // 16MB
51 55
 #endif
52 56
 
53 57
 #define PIC_MAX_CN           100    // Maximum number of pictures
@@ -66,48 +70,52 @@ extern "C" { /* C-declarations for C++ */
66 70
 #if SPI_FLASH_SIZE == 0x200000
67 71
   //pic
68 72
   //Robin_pro pic addr
69
-  #define PIC_NAME_ADDR                   0x001000      // Pic information addr
70
-  #define PIC_SIZE_ADDR                   0x001800      // Pic size information addr
71
-  #define PIC_COUNTER_ADDR                0x002000      // Pic total number
72
-  #define PER_PIC_SAVE_ADDR               0x000000      // Storage address of each picture
73
-  #define PIC_LOGO_ADDR                   0x000000      // Logo addr
74
-  #define PIC_DATA_ADDR                   0x003000    //
73
+  #define PIC_NAME_ADDR                 0x001000      // Pic information addr
74
+  #define PIC_SIZE_ADDR                 0x001800      // Pic size information addr
75
+  #define PIC_COUNTER_ADDR              0x002000      // Pic total number
76
+  #define PER_PIC_SAVE_ADDR             0x000000      // Storage address of each picture
77
+  #define PIC_LOGO_ADDR                 0x000000      // Logo addr
78
+  #define PIC_DATA_ADDR                 0x003000      //
75 79
 
76 80
   // TFT35
77
-  #define DEFAULT_VIEW_ADDR_TFT35         0x1ea070
78
-  #define BAK_VIEW_ADDR_TFT35             (DEFAULT_VIEW_ADDR_TFT35+90*1024)
79
-  #define PIC_ICON_LOGO_ADDR_TFT35        (BAK_VIEW_ADDR_TFT35+80*1024)
80
-  #define PIC_DATA_ADDR_TFT35             0x003000 // (PIC_ICON_LOGO_ADDR_TFT35+350*1024) //0xC5800
81
+  #define DEFAULT_VIEW_ADDR_TFT35       0x1ea070
82
+  #define BAK_VIEW_ADDR_TFT35           (DEFAULT_VIEW_ADDR_TFT35+90*1024)
83
+  #define PIC_ICON_LOGO_ADDR_TFT35      (BAK_VIEW_ADDR_TFT35+80*1024)
84
+  #define PIC_DATA_ADDR_TFT35           0x003000 // (PIC_ICON_LOGO_ADDR_TFT35+350*1024) //0xC5800
81 85
 
82
-  #define PIC_DATA_ADDR_TFT32             0x00F000
83
-  #define PIC_ICON_LOGO_ADDR_TFT32        0x5D8000
84
-  #define PIC_OTHER_SIZE_ADDR_TFT32       0x5EE000
86
+  #define PIC_DATA_ADDR_TFT32           0x00F000
87
+  #define PIC_ICON_LOGO_ADDR_TFT32      0x5D8000
88
+  #define PIC_OTHER_SIZE_ADDR_TFT32     0x5EE000
89
+
90
+  // font
91
+  #define FONTINFOADDR                  0x183000 // 6M -- font addr
92
+  #define UNIGBK_FLASH_ADDR            (FONTINFOADDR+4096) // 4*1024
85 93
 
86 94
 #else
87 95
   //pic
88 96
   //Robin_pro pic addr
89
-  #define PIC_NAME_ADDR                   0x003000      // Pic information addr
90
-  #define PIC_SIZE_ADDR                   0x007000      // Pic size information addr
91
-  #define PIC_COUNTER_ADDR                0x008000      // Pic total number
92
-  #define PER_PIC_SAVE_ADDR               0x009000      // Storage address of each picture
93
-  #define PIC_LOGO_ADDR                   0x00A000      // Logo addr
94
-  //#define PIC_DATA_ADDR                 0x02F000      //
97
+  #define PIC_NAME_ADDR                 0x003000      // Pic information addr
98
+  #define PIC_SIZE_ADDR                 0x007000      // Pic size information addr
99
+  #define PIC_COUNTER_ADDR              0x008000      // Pic total number
100
+  //#define PER_PIC_SAVE_ADDR           0x009000      // Storage address of each picture
101
+  #define PIC_LOGO_ADDR                 0x009000      // Logo addr
102
+  //#define PIC_DATA_ADDR               0x02F000      //
95 103
 
96 104
   // TFT35
97
-  #define DEFAULT_VIEW_ADDR_TFT35         0xC5800
98
-  #define BAK_VIEW_ADDR_TFT35             (DEFAULT_VIEW_ADDR_TFT35+90*1024)
99
-  #define PIC_ICON_LOGO_ADDR_TFT35        (BAK_VIEW_ADDR_TFT35+80*1024)
100
-  #define PIC_DATA_ADDR_TFT35             (PIC_ICON_LOGO_ADDR_TFT35+350*1024) //0xC5800
105
+  #define DEFAULT_VIEW_ADDR_TFT35       0xC5800
106
+  #define BAK_VIEW_ADDR_TFT35           (DEFAULT_VIEW_ADDR_TFT35+90*1024)
107
+  #define PIC_ICON_LOGO_ADDR_TFT35      (BAK_VIEW_ADDR_TFT35+80*1024)
108
+  #define PIC_DATA_ADDR_TFT35           (PIC_ICON_LOGO_ADDR_TFT35+350*1024) //0xC5800
101 109
 
102 110
   // TFT32
103
-  #define PIC_DATA_ADDR_TFT32             0x02F000
104
-  #define PIC_ICON_LOGO_ADDR_TFT32        0x5D8000
105
-  #define PIC_OTHER_SIZE_ADDR_TFT32       0x5EE000
111
+  #define PIC_DATA_ADDR_TFT32           0x02F000
112
+  #define PIC_ICON_LOGO_ADDR_TFT32      0x5D8000
113
+  #define PIC_OTHER_SIZE_ADDR_TFT32     0x5EE000
106 114
 
107 115
   // font
108
-  #define FONTINFOADDR                    0x600000 // 6M -- font addr
109
-  #define UNIGBK_FLASH_ADDR              (FONTINFOADDR+4096) // 4*1024
110
-  #define GBK_FLASH_ADDR                 (UNIGBK_FLASH_ADDR+180224) // 176*1024
116
+  #define FONTINFOADDR                  0x600000 // 6M -- font addr
117
+  #define UNIGBK_FLASH_ADDR            (FONTINFOADDR+4096) // 4*1024
118
+  #define GBK_FLASH_ADDR               (UNIGBK_FLASH_ADDR+180224) // 176*1024
111 119
 
112 120
 #endif
113 121
 
@@ -137,6 +145,7 @@ typedef struct pic_msg PIC_MSG;
137 145
 #define FONT_SIZE_xM  2
138 146
 
139 147
 extern void Pic_Read(uint8_t *Pname, uint8_t *P_Rbuff);
148
+extern void Pic_Logo_Read(uint8_t *LogoName,uint8_t *Logo_Rbuff,uint32_t LogoReadsize);
140 149
 extern void lv_pic_test(uint8_t *P_Rbuff, uint32_t addr, uint32_t size);
141 150
 extern uint32_t lv_get_pic_addr(uint8_t *Pname);
142 151
 extern void get_spi_flash_data(const char *rec_buf, int offset, int size);

+ 217
- 0
Marlin/src/lcd/extui/lib/mks_ui/printer_operation.cpp View File

@@ -0,0 +1,217 @@
1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
+ *
5
+ * Based on Sprinter and grbl.
6
+ * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
7
+ *
8
+ * This program is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+#include "../../../../inc/MarlinConfigPre.h"
23
+
24
+#if HAS_TFT_LVGL_UI
25
+
26
+#include "../../../../MarlinCore.h"
27
+
28
+#include "lv_conf.h"
29
+#include "draw_ui.h"
30
+#include "../../../../module/temperature.h"
31
+#include "../../../../module/motion.h"
32
+#include "../../../../sd/cardreader.h"
33
+#include "../../../../gcode/queue.h"
34
+
35
+#if ENABLED(POWER_LOSS_RECOVERY)
36
+  #include "../../../../feature/powerloss.h"
37
+#endif
38
+
39
+#include "../../../../gcode/gcode.h"
40
+#include "../../../../module/planner.h"
41
+
42
+extern uint32_t To_pre_view;
43
+extern uint8_t flash_preview_begin, default_preview_flg, gcode_preview_over;
44
+
45
+void printer_state_polling() {
46
+  if (uiCfg.print_state == PAUSING) {
47
+    #if ENABLED(SDSUPPORT)
48
+      if (!planner.has_blocks_queued() && card.getIndex() > MIN_FILE_PRINTED)
49
+        uiCfg.waitEndMoves++;
50
+
51
+      if (uiCfg.waitEndMoves > 20) {
52
+        uiCfg.waitEndMoves = 0;
53
+        planner.synchronize();
54
+        gcode.process_subcommands_now_P(PSTR("M25"));
55
+        if (gCfgItems.pausePosZ != (float)-1) {
56
+          gcode.process_subcommands_now_P(PSTR("G91"));
57
+          ZERO(public_buf_l);
58
+          sprintf_P(public_buf_l, PSTR("G1 Z%.1f"), gCfgItems.pausePosZ);
59
+          gcode.process_subcommands_now(public_buf_l);
60
+          gcode.process_subcommands_now_P(PSTR("G90"));
61
+        }
62
+        if (gCfgItems.pausePosX != (float)-1 && gCfgItems.pausePosY != (float)-1) {
63
+          ZERO(public_buf_l);
64
+          sprintf_P(public_buf_l, PSTR("G1 X%.1f Y%.1f"), gCfgItems.pausePosX, gCfgItems.pausePosY);
65
+          gcode.process_subcommands_now(public_buf_l);
66
+        }
67
+        uiCfg.print_state = PAUSED;
68
+
69
+        // #if ENABLED(POWER_LOSS_RECOVERY)
70
+        //  if (recovery.enabled) recovery.save(true);
71
+        // #endif
72
+        gCfgItems.pause_reprint = 1;
73
+        update_spi_flash();
74
+      }
75
+    #endif
76
+  }
77
+  else
78
+    uiCfg.waitEndMoves = 0;
79
+
80
+  if (uiCfg.print_state == PAUSED) {
81
+  }
82
+
83
+  if (uiCfg.print_state == RESUMING) {
84
+    if (IS_SD_PAUSED()) {
85
+      gcode.process_subcommands_now_P(PSTR("M24\nG91\nG1 Z-5\nG90"));
86
+      uiCfg.print_state = WORKING;
87
+      start_print_time();
88
+
89
+      gCfgItems.pause_reprint = 0;
90
+      update_spi_flash();
91
+    }
92
+  }
93
+  #if ENABLED(POWER_LOSS_RECOVERY)
94
+    if (uiCfg.print_state == REPRINTED) {
95
+      ZERO(public_buf_m);
96
+      #if HAS_HOTEND
97
+        HOTEND_LOOP() {
98
+          const int16_t et = recovery.info.target_temperature[e];
99
+          if (et) {
100
+            #if HAS_MULTI_HOTEND
101
+              sprintf_P(public_buf_m, PSTR("T%i"), e);
102
+              gcode.process_subcommands_now(public_buf_m);
103
+            #endif
104
+            sprintf_P(public_buf_m, PSTR("M109 S%i"), et);
105
+            gcode.process_subcommands_now(public_buf_m);
106
+          }
107
+        }
108
+      #endif
109
+
110
+      if (gCfgItems.pause_reprint == 1) {
111
+        gcode.process_subcommands_now_P(PSTR("G91\nG1 Z-5\nG90"));
112
+      }
113
+      recovery.resume();
114
+
115
+      uiCfg.print_state = WORKING;
116
+      start_print_time();
117
+
118
+      gCfgItems.pause_reprint = 0;
119
+      update_spi_flash();
120
+    }
121
+  #endif
122
+
123
+  if (uiCfg.print_state == WORKING)
124
+    filament_check();
125
+}
126
+
127
+void filament_pin_setup() {
128
+  #if PIN_EXISTS(MT_DET_1)
129
+    pinMode(MT_DET_1_PIN, INPUT_PULLUP);
130
+  #endif
131
+  #if PIN_EXISTS(MT_DET_2)
132
+    pinMode(MT_DET_2_PIN, INPUT_PULLUP);
133
+  #endif
134
+  #if PIN_EXISTS(MT_DET_3)
135
+    pinMode(MT_DET_3_PIN, INPUT_PULLUP);
136
+  #endif
137
+}
138
+
139
+void filament_check() {
140
+  const int FIL_DELAY = 20;
141
+  #if PIN_EXISTS(MT_DET_1)
142
+    static int fil_det_count_1 = 0;
143
+    if (!READ(MT_DET_1_PIN) && !MT_DET_PIN_INVERTING)
144
+      fil_det_count_1++;
145
+    else if (READ(MT_DET_1_PIN) && MT_DET_PIN_INVERTING)
146
+      fil_det_count_1++;
147
+    else if (fil_det_count_1 > 0)
148
+      fil_det_count_1--;
149
+
150
+    if (!READ(MT_DET_1_PIN) && !MT_DET_PIN_INVERTING)
151
+      fil_det_count_1++;
152
+    else if (READ(MT_DET_1_PIN) && MT_DET_PIN_INVERTING)
153
+      fil_det_count_1++;
154
+    else if (fil_det_count_1 > 0)
155
+      fil_det_count_1--;
156
+  #endif
157
+
158
+  #if PIN_EXISTS(MT_DET_2)
159
+    static int fil_det_count_2 = 0;
160
+    if (!READ(MT_DET_2_PIN) && !MT_DET_PIN_INVERTING)
161
+      fil_det_count_2++;
162
+    else if (READ(MT_DET_2_PIN) && MT_DET_PIN_INVERTING)
163
+      fil_det_count_2++;
164
+    else if (fil_det_count_2 > 0)
165
+      fil_det_count_2--;
166
+
167
+    if (!READ(MT_DET_2_PIN) && !MT_DET_PIN_INVERTING)
168
+      fil_det_count_2++;
169
+    else if (READ(MT_DET_2_PIN) && MT_DET_PIN_INVERTING)
170
+      fil_det_count_2++;
171
+    else if (fil_det_count_2 > 0)
172
+      fil_det_count_2--;
173
+  #endif
174
+
175
+  #if PIN_EXISTS(MT_DET_3)
176
+    static int fil_det_count_3 = 0;
177
+    if (!READ(MT_DET_3_PIN) && !MT_DET_PIN_INVERTING)
178
+      fil_det_count_3++;
179
+    else if (READ(MT_DET_3_PIN) && MT_DET_PIN_INVERTING)
180
+      fil_det_count_3++;
181
+    else if (fil_det_count_3 > 0)
182
+      fil_det_count_3--;
183
+
184
+    if (!READ(MT_DET_3_PIN) && !MT_DET_PIN_INVERTING)
185
+      fil_det_count_3++;
186
+    else if (READ(MT_DET_3_PIN) && MT_DET_PIN_INVERTING)
187
+      fil_det_count_3++;
188
+    else if (fil_det_count_3 > 0)
189
+      fil_det_count_3--;
190
+  #endif
191
+
192
+  if (false
193
+    #if PIN_EXISTS(MT_DET_1)
194
+      || fil_det_count_1 >= FIL_DELAY
195
+    #endif
196
+    #if PIN_EXISTS(MT_DET_2)
197
+      || fil_det_count_2 >= FIL_DELAY
198
+    #endif
199
+    #if PIN_EXISTS(MT_DET_3)
200
+      || fil_det_count_3 >= FIL_DELAY
201
+    #endif
202
+  ) {
203
+    clear_cur_ui();
204
+    card.pauseSDPrint();
205
+    stop_print_time();
206
+    uiCfg.print_state = PAUSING;
207
+
208
+    if (gCfgItems.from_flash_pic == 1)
209
+      flash_preview_begin = 1;
210
+    else
211
+      default_preview_flg = 1;
212
+
213
+    lv_draw_printing();
214
+  }
215
+}
216
+
217
+#endif // HAS_TFT_LVGL_UI

Marlin/src/lcd/extui/lib/mks_ui/printer_opration.h → Marlin/src/lcd/extui/lib/mks_ui/printer_operation.h View File


+ 0
- 209
Marlin/src/lcd/extui/lib/mks_ui/printer_opration.cpp View File

@@ -1,209 +0,0 @@
1
-/**
2
- * Marlin 3D Printer Firmware
3
- * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
- *
5
- * Based on Sprinter and grbl.
6
- * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
7
- *
8
- * This program is free software: you can redistribute it and/or modify
9
- * it under the terms of the GNU General Public License as published by
10
- * the Free Software Foundation, either version 3 of the License, or
11
- * (at your option) any later version.
12
- *
13
- * This program is distributed in the hope that it will be useful,
14
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
- * GNU General Public License for more details.
17
- *
18
- * You should have received a copy of the GNU General Public License
19
- * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20
- *
21
- */
22
-#include "../../../../inc/MarlinConfigPre.h"
23
-
24
-#if ENABLED(TFT_LVGL_UI)
25
-
26
-  #include "../../../../MarlinCore.h"
27
-
28
-  #include "lv_conf.h"
29
-  #include "draw_ui.h"
30
-  #include "../../../../module/temperature.h"
31
-  #include "../../../../module/motion.h"
32
-  #include "../../../../sd/cardreader.h"
33
-  #include "../../../../gcode/queue.h"
34
-
35
-  #if ENABLED(POWER_LOSS_RECOVERY)
36
-    #include "../../../../feature/powerloss.h"
37
-  #endif
38
-
39
-  #include "../../../../gcode/gcode.h"
40
-  #include "../../../../module/planner.h"
41
-
42
-  extern uint32_t To_pre_view;
43
-  extern uint8_t flash_preview_begin, default_preview_flg, gcode_preview_over;
44
-
45
-  void printer_state_polling() {
46
-    if (uiCfg.print_state == PAUSING) {
47
-      #if ENABLED(SDSUPPORT)
48
-        if (!planner.has_blocks_queued() && card.getIndex() > MIN_FILE_PRINTED) //���� �ļ��� M109��M190ָ��
49
-          uiCfg.waitEndMoves++;
50
-
51
-        if (uiCfg.waitEndMoves > 20) {
52
-          uiCfg.waitEndMoves = 0;
53
-          planner.synchronize();
54
-          gcode.process_subcommands_now_P(PSTR("M25\nG91\nG1 Z5\nG90"));
55
-
56
-          uiCfg.print_state = PAUSED;
57
-
58
-          //#if ENABLED(POWER_LOSS_RECOVERY)
59
-          //  if (recovery.enabled) recovery.save(true);
60
-          //#endif
61
-          gCfgItems.pause_reprint = 1;
62
-          update_spi_flash();
63
-        }
64
-      #endif
65
-    }
66
-    else {
67
-      uiCfg.waitEndMoves = 0;
68
-    }
69
-
70
-    if (uiCfg.print_state == PAUSED) {
71
-
72
-    }
73
-
74
-    if (uiCfg.print_state == RESUMING) {
75
-      if (IS_SD_PAUSED()) {
76
-        gcode.process_subcommands_now_P(PSTR("G91\nG1 Z-5\nG90\nM24"));
77
-        uiCfg.print_state = WORKING;
78
-        start_print_time();
79
-
80
-        gCfgItems.pause_reprint = 0;
81
-        update_spi_flash();
82
-      }
83
-    }
84
-    #if ENABLED(POWER_LOSS_RECOVERY)
85
-    if (uiCfg.print_state == REPRINTED) {
86
-      memset(public_buf_m, 0, sizeof(public_buf_m));
87
-      #if HOTENDS
88
-      HOTEND_LOOP() {
89
-        const int16_t et = recovery.info.target_temperature[e];
90
-        if (et) {
91
-          #if HOTENDS > 1
92
-            sprintf_P(public_buf_m, PSTR("T%i"), e);
93
-            gcode.process_subcommands_now(public_buf_m);
94
-          #endif
95
-          sprintf_P(public_buf_m, PSTR("M109 S%i"), et);
96
-          gcode.process_subcommands_now(public_buf_m);
97
-        }
98
-      }
99
-      #endif
100
-
101
-      if (gCfgItems.pause_reprint == 1)
102
-        gcode.process_subcommands_now_P(PSTR("G91\nG1 Z-5\nG90"));
103
-      recovery.resume();
104
-
105
-      uiCfg.print_state = WORKING;
106
-      start_print_time();
107
-
108
-      gCfgItems.pause_reprint = 0;
109
-      update_spi_flash();
110
-    }
111
-    #endif
112
-
113
-    if (uiCfg.print_state == WORKING)
114
-      filament_check();
115
-  }
116
-
117
-  void filament_pin_setup() {
118
-    #if PIN_EXISTS(MT_DET_1)
119
-      pinMode(MT_DET_1_PIN, INPUT_PULLUP);
120
-    #endif
121
-    #if PIN_EXISTS(MT_DET_2)
122
-      pinMode(MT_DET_2_PIN, INPUT_PULLUP);
123
-    #endif
124
-    #if PIN_EXISTS(MT_DET_3)
125
-      pinMode(MT_DET_3_PIN, INPUT_PULLUP);
126
-    #endif
127
-  }
128
-
129
-  void filament_check() {
130
-    const int FIL_DELAY = 20;
131
-    #if PIN_EXISTS(MT_DET_1)
132
-      static int fil_det_count_1 = 0;
133
-      if (!READ(MT_DET_1_PIN) && !MT_DET_PIN_INVERTING)
134
-        fil_det_count_1++;
135
-      else if (READ(MT_DET_1_PIN) && MT_DET_PIN_INVERTING)
136
-        fil_det_count_1++;
137
-      else if (fil_det_count_1 > 0)
138
-        fil_det_count_1--;
139
-
140
-      if (!READ(MT_DET_1_PIN) && !MT_DET_PIN_INVERTING)
141
-        fil_det_count_1++;
142
-      else if (READ(MT_DET_1_PIN) && MT_DET_PIN_INVERTING)
143
-        fil_det_count_1++;
144
-      else if (fil_det_count_1 > 0)
145
-        fil_det_count_1--;
146
-    #endif
147
-
148
-    #if PIN_EXISTS(MT_DET_2)
149
-      static int fil_det_count_2 = 0;
150
-      if (!READ(MT_DET_2_PIN) && !MT_DET_PIN_INVERTING)
151
-        fil_det_count_2++;
152
-      else if (READ(MT_DET_2_PIN) && MT_DET_PIN_INVERTING)
153
-        fil_det_count_2++;
154
-      else if (fil_det_count_2 > 0)
155
-        fil_det_count_2--;
156
-
157
-      if (!READ(MT_DET_2_PIN) && !MT_DET_PIN_INVERTING)
158
-        fil_det_count_2++;
159
-      else if (READ(MT_DET_2_PIN) && MT_DET_PIN_INVERTING)
160
-        fil_det_count_2++;
161
-      else if (fil_det_count_2 > 0)
162
-        fil_det_count_2--;
163
-    #endif
164
-
165
-    #if PIN_EXISTS(MT_DET_3)
166
-      static int fil_det_count_3 = 0;
167
-      if (!READ(MT_DET_3_PIN) && !MT_DET_PIN_INVERTING)
168
-        fil_det_count_3++;
169
-      else if (READ(MT_DET_3_PIN) && MT_DET_PIN_INVERTING)
170
-        fil_det_count_3++;
171
-      else if (fil_det_count_3 > 0)
172
-        fil_det_count_3--;
173
-
174
-      if (!READ(MT_DET_3_PIN) && !MT_DET_PIN_INVERTING)
175
-        fil_det_count_3++;
176
-      else if (READ(MT_DET_3_PIN) && MT_DET_PIN_INVERTING)
177
-        fil_det_count_3++;
178
-      else if (fil_det_count_3 > 0)
179
-        fil_det_count_3--;
180
-    #endif
181
-
182
-    if (
183
-      #if PIN_EXISTS(MT_DET_1)
184
-        fil_det_count_1 >= FIL_DELAY
185
-      #else
186
-        false
187
-      #endif
188
-      #if PIN_EXISTS(MT_DET_2)
189
-        || fil_det_count_2 >= FIL_DELAY
190
-      #endif
191
-      #if PIN_EXISTS(MT_DET_3)
192
-        || fil_det_count_3 >= FIL_DELAY
193
-      #endif
194
-      ) {
195
-      clear_cur_ui();
196
-      card.pauseSDPrint();
197
-      stop_print_time();
198
-      uiCfg.print_state = PAUSING;
199
-
200
-      if (gCfgItems.from_flash_pic == 1)
201
-        flash_preview_begin = 1;
202
-      else
203
-        default_preview_flg = 1;
204
-
205
-      lv_draw_printing();
206
-    }
207
-  }
208
-
209
-#endif // TFT_LVGL_UI

+ 53
- 23
Marlin/src/lcd/extui/lib/mks_ui/tft_Language_en.h View File

@@ -22,13 +22,13 @@
22 22
 #pragma once
23 23
 
24 24
 //****************英文***************************//
25
-#define MACHINE_CONFIG_EN              "Machine\nSettings"
25
+#define MACHINE_CONFIG_EN              "Config"
26 26
 
27 27
 #define NEXT_EN                 "Next"
28 28
 #define PREVIOUS_EN             "Previous"
29 29
 #define DEFAULT_EN              "Default"
30 30
 #define KEY_BACK_EN             "Del"
31
-#define KEY_REST_EN             "Rest"
31
+#define KEY_REST_EN             "Reset"
32 32
 #define KEY_CONFIRM_EN          "Confirm"
33 33
 
34 34
 #define KEYBOARD_KEY0_EN "0"
@@ -44,12 +44,11 @@
44 44
 #define KEYBOARD_KEY_POINT_EN "."
45 45
 #define KEYBOARD_KEY_NEGATIVE_EN "-"
46 46
 
47
-#define MACHINE_PARA_EN             "Machine\nsettings"
48
-#define MACHINE_PARA_TITLE_EN       "Machine settings"
49
-#define MACHINE_TYPE_CNOFIG_EN      "Machine"
50
-#define TEMPERATURE_CONFIG_EN       "Temperature"
51
-#define MOTOR_CONFIG_EN             "Motor"
52
-#define ADVANCE_CONFIG_EN           "Adavance"
47
+#define MACHINE_PARA_TITLE_EN       "Config"
48
+#define MACHINE_TYPE_CNOFIG_EN      "Machine settings"
49
+#define TEMPERATURE_CONFIG_EN       "Temperature settings"
50
+#define MOTOR_CONFIG_EN             "Motor settings"
51
+#define ADVANCE_CONFIG_EN           "Adavance settings"
53 52
 
54 53
 #define MACHINE_CONFIG_TITLE_EN     "Machine Settings"
55 54
 #define MACHINE_TYPE_EN             "Machine type"
@@ -158,6 +157,8 @@
158 157
 #define ACCELERATION_CONF_EN            "Acceleration settings"
159 158
 #define JERKCONF_EN                     "Jerk settings"
160 159
 #define STEPSCONF_EN                    "Steps settings"
160
+#define TMC_CURRENT_EN                  "TMC Current settings"
161
+#define TMC_STEP_MODE_EN                "TMC Step mode settings"
161 162
 #define MOTORDIRCONF_EN                 "Motor direction settings"
162 163
 #define HOMEFEEDRATECONF_EN             "Home speed setting"
163 164
 
@@ -191,6 +192,20 @@
191 192
 #define E0_STEPS_EN                     "E0-axis steps"
192 193
 #define E1_STEPS_EN                     "E1-axis steps"
193 194
 
195
+#define TMC_CURRENT_CONF_TITLE_EN       "Machine Settings>TMC current settings"
196
+#define X_TMC_CURRENT_EN                "X axis current (mA)"
197
+#define Y_TMC_CURRENT_EN                "Y axis current (mA)"
198
+#define Z_TMC_CURRENT_EN                "Z axis current (mA)"
199
+#define E0_TMC_CURRENT_EN               "E0 axis current (mA)"
200
+#define E1_TMC_CURRENT_EN               "E1 axis current (mA)"
201
+
202
+#define TMC_MODE_CONF_TITLE_EN          "Machine Settings>TMC step mode settings"
203
+#define X_TMC_MODE_EN                   "Whether X axis enable stealthChop modes"
204
+#define Y_TMC_MODE_EN                   "Whether Y axis enable stealthChop modes"
205
+#define Z_TMC_MODE_EN                   "Whether Z axis enable stealthChop modes"
206
+#define E0_TMC_MODE_EN                  "Whether E0 axis enable stealthChop modes"
207
+#define E1_TMC_MODE_EN                  "Whether E1 axis enable stealthChop modes"
208
+
194 209
 #define MOTORDIR_CONF_TITLE_EN          "Machine Settings>Motor direction"
195 210
 #define X_MOTORDIR_EN                   "X-axis motor direction invert"
196 211
 #define Y_MOTORDIR_EN                   "Y-axis motor direction invert"
@@ -223,6 +238,11 @@
223 238
 #define Z_ENABLE_PINS_INVERT_EN         "Z_ENABLE_PIN_INVERT"
224 239
 #define E_ENABLE_PINS_INVERT_EN         "E_ENABLE_PIN_INVERT"
225 240
 
241
+#define PAUSE_POSITION_EN    "Printing pause position settings"
242
+#define PAUSE_POSITION_X_EN  "X axis position (Absolute position,-1 invalid)"
243
+#define PAUSE_POSITION_Y_EN  "Y axis position (Absolute position,-1 invalid)"
244
+#define PAUSE_POSITION_Z_EN  "Z axis position (Relative position,-1 invalid)"
245
+
226 246
 #define TOOL_TEXT_EN            "Tool"
227 247
 #define PREHEAT_TEXT_EN         "Preheat"
228 248
 #define MOVE_TEXT_EN            "Move"
@@ -299,6 +319,8 @@
299 319
 #define MOTOR_OFF_TEXT_EN             "Motor-off"
300 320
 #define MOTOR_OFF_XY_TEXT_EN          "Off-XY"
301 321
 #define SHUTDOWN_TEXT_EN              "Shutdown"
322
+#define MACHINE_PARA_EN               "Config"
323
+#define EEPROM_SETTINGS_EN            "Eeprom Set"
302 324
 
303 325
 #define U_DISK_TEXT_EN                "USB"
304 326
 #define SD_CARD_TEXT_EN               "SD"
@@ -368,8 +390,8 @@
368 390
 #define FILAMENT_DIALOG_UNLOAD_COMPLETE_TIPS_EN "Unload filament completed,\nclick <confirm> for return!"
369 391
 
370 392
 
371
-#define PRE_HEAT_EXT_TEXT_EN                "E"
372
-#define PRE_HEAT_BED_TEXT_EN                "Bed"
393
+#define PRE_HEAT_EXT_TEXT_EN            "E"
394
+#define PRE_HEAT_BED_TEXT_EN            "Bed"
373 395
 
374 396
 #define FILE_LOADING_EN                 "Loading......"
375 397
 #if 0
@@ -703,16 +725,24 @@
703 725
 #define PRINTING_OPERATION_OTHER_LANGUGE    "Operation"
704 726
 #define PRINTING_PAUSE_OTHER_LANGUGE        "Pause"
705 727
 
706
-#define MESSEGE_PAUSING_EN          "Parking..."
707
-#define MESSEGE_CHANGING_EN         "Wait for filament change to start"
708
-#define MESSEGE_UNLOAD_EN           "Wait for filament unload"
709
-#define MESSEGE_WAITING_EN          "Press Button to resume print"
710
-#define MESSEGE_INSERT_EN           "Insert filament and press button to continue"
711
-#define MESSEGE_LOAD_EN             "Wait for filament load"
712
-#define MESSEGE_PURGE_EN            "Wait for filament purge"
713
-#define MESSEGE_RESUME_EN           "Wait for print to resume..."
714
-#define MESSEGE_HEAT_EN             "Press button to heat nozzle"
715
-#define MESSEGE_HEATING_EN          "Nozzle heating Please wait..."
716
-#define MESSEGE_OPTION_EN           "Purge more or continue print?"
717
-#define MESSEGE_PURGE_MORE_EN       "Purge"
718
-#define MESSEGE_CONTINUE_PRINT_EN   "Print"
728
+#define MESSAGE_PAUSING_EN        "Parking..."
729
+#define MESSAGE_CHANGING_EN       "Wait for filament change to start"
730
+#define MESSAGE_UNLOAD_EN         "Wait for filament unload"
731
+#define MESSAGE_WAITING_EN        "Press Button to resume print"
732
+#define MESSAGE_INSERT_EN         "Insert filament and press button to continue"
733
+#define MESSAGE_LOAD_EN           "Wait for filament load"
734
+#define MESSAGE_PURGE_EN          "Wait for filament purge"
735
+#define MESSAGE_RESUME_EN         "Wait for print to resume..."
736
+#define MESSAGE_HEAT_EN           "Press button to heat nozzle"
737
+#define MESSAGE_HEATING_EN        "Nozzle heating Please wait..."
738
+#define MESSAGE_OPTION_EN         "Purge more or continue print?"
739
+#define MESSAGE_PURGE_MORE_EN     "Purge"
740
+#define MESSAGE_CONTINUE_PRINT_EN "Print"
741
+#define EEPROM_SETTINGS_TITLE_EN  "EEPROM Settings"
742
+#define EEPROM_SETTINGS_STORE_EN  "Store settings to EEPROM"
743
+#define EEPROM_SETTINGS_READ_EN   "Read settings from EEPROM"
744
+#define EEPROM_SETTINGS_REVERT_EN "Revert settings to factory defaults"
745
+
746
+#define EEPROM_STORE_TIPS_EN  "Store settings to EEPROM?"
747
+#define EEPROM_READ_TIPS_EN   "Read settings from EEPROM?"
748
+#define EEPROM_REVERT_TIPS_EN "Revert settings to factory defaults?"

+ 35
- 25
Marlin/src/lcd/extui/lib/mks_ui/tft_Language_fr.h View File

@@ -98,6 +98,8 @@
98 98
 #define MOTOR_OFF_TEXT_FR             "M-hors"
99 99
 #define MOTOR_OFF_XY_TEXT_FR          "M-hors-XY"
100 100
 #define SHUTDOWN_TEXT_FR              "Eteindre"
101
+#define MACHINE_PARA_FR               "Config"
102
+#define EEPROM_SETTINGS_FR            "Eeprom Set"
101 103
 
102 104
 #define U_DISK_TEXT_FR                "Clé usb"
103 105
 #define SD_CARD_TEXT_FR               "Carte SD"
@@ -249,28 +251,36 @@
249 251
 #define DIALOG_CANCEL_PRINT_FR        "Arrêter?"
250 252
 
251 253
 #define DIALOG_STOP_FR                "Arrêter"
252
-#define DIALOG_REPRINT_FROM_BREAKPOINT_FR   "Continuer?"
253
-//#define DIALOG_UNBIND_PRINTER_FR          "Non lié?"
254
-#define DIALOG_ERROR_TIPS1_FR               "Erreur:error:Aucun fichier, \nvérifiez à nouveau."
255
-#define DIALOG_ERROR_TIPS2_FR               "Erreur:La opération a échoué. \nVerifiez que le baudrate de l'écran et de \nla carte mère soient identique!"
256
-#define DIALOG_ERROR_TIPS3_FR               "Erreur: le nom du fichier ou le \nchemin d'accès est trop long."
257
-#define DIALOG_UNBIND_PRINTER_FR            "Unbind the printer?"
258
-#define DIALOG_FILAMENT_NO_PRESS_FR         "Filament detection switch is not pressed"
259
-#define DIALOG_PRINT_FINISH_FR              "L'impression est terminée!"
260
-#define DIALOG_PRINT_TIME_FR                "Temps d'impression: "
261
-#define DIALOG_REPRINT_FR                   "Print again"
262
-#define DIALOG_WIFI_ENABLE_TIPS_FR          "The wifi module is being configured,\nplease wait a moment....."
263
-
264
-#define MESSEGE_PAUSING_FR          "Parking..."
265
-#define MESSEGE_CHANGING_FR         "Attente filament pour démarrer"
266
-#define MESSEGE_UNLOAD_FR           "Attente retrait du filament"
267
-#define MESSEGE_WAITING_FR          "Presser bouton,pour reprendre"
268
-#define MESSEGE_INSERT_FR           "Insérer filament et app. bouton pour continuer..."
269
-#define MESSEGE_LOAD_FR             "Attente chargement filament"
270
-#define MESSEGE_PURGE_FR            "Attente Purge filament"
271
-#define MESSEGE_RESUME_FR           "Attente reprise impression"
272
-#define MESSEGE_HEAT_FR             "Presser le bouton pour chauffer..."
273
-#define MESSEGE_HEATING_FR          "Buse en chauffe Patienter SVP..."
274
-#define MESSEGE_OPTION_FR           "Purger davantage ou continuer l'impression?"
275
-#define MESSEGE_PURGE_MORE_FR       "Purge"
276
-#define MESSEGE_CONTINUE_PRINT_FR   "Impression"
254
+#define DIALOG_REPRINT_FROM_BREAKPOINT_FR "Continuer?"
255
+//#define DIALOG_UNBIND_PRINTER_FR    "Non lié?"
256
+#define DIALOG_ERROR_TIPS1_FR         "Erreur:error:Aucun fichier, \nvérifiez à nouveau."
257
+#define DIALOG_ERROR_TIPS2_FR         "Erreur:La opération a échoué. \nVerifiez que le baudrate de l'écran et de \nla carte mère soient identique!"
258
+#define DIALOG_ERROR_TIPS3_FR         "Erreur: le nom du fichier ou le \nchemin d'accès est trop long."
259
+#define DIALOG_UNBIND_PRINTER_FR      "Unbind the printer?"
260
+#define DIALOG_FILAMENT_NO_PRESS_FR   "Filament detection switch is not pressed"
261
+#define DIALOG_PRINT_FINISH_FR        "L'impression est terminée!"
262
+#define DIALOG_PRINT_TIME_FR          "Temps d'impression: "
263
+#define DIALOG_REPRINT_FR             "Print again"
264
+#define DIALOG_WIFI_ENABLE_TIPS_FR    "The wifi module is being configured,\nplease wait a moment....."
265
+
266
+#define MESSAGE_PAUSING_FR        "Parking..."
267
+#define MESSAGE_CHANGING_FR       "Attente filament pour démarrer"
268
+#define MESSAGE_UNLOAD_FR         "Attente retrait du filament"
269
+#define MESSAGE_WAITING_FR        "Presser bouton,pour reprendre"
270
+#define MESSAGE_INSERT_FR         "Insérer filament et app. bouton pour continuer..."
271
+#define MESSAGE_LOAD_FR           "Attente chargement filament"
272
+#define MESSAGE_PURGE_FR          "Attente Purge filament"
273
+#define MESSAGE_RESUME_FR         "Attente reprise impression"
274
+#define MESSAGE_HEAT_FR           "Presser le bouton pour chauffer..."
275
+#define MESSAGE_HEATING_FR        "Buse en chauffe Patienter SVP..."
276
+#define MESSAGE_OPTION_FR         "Purger davantage ou continuer l'impression?"
277
+#define MESSAGE_PURGE_MORE_FR     "Purge"
278
+#define MESSAGE_CONTINUE_PRINT_FR "Impression"
279
+#define EEPROM_SETTINGS_TITLE_FR  "Paramètres EEPROM"
280
+#define EEPROM_SETTINGS_STORE_FR  "Stocker les paramètres dans l'EEPROM"
281
+#define EEPROM_SETTINGS_READ_FR   "Lire les paramètres de l'EEPROM"
282
+#define EEPROM_SETTINGS_REVERT_FR "Rétablir les paramètres par défaut d'usine"
283
+
284
+#define EEPROM_STORE_TIPS_FR  "Stocker les paramètres dans l'EEPROM?"
285
+#define EEPROM_READ_TIPS_FR   "Lire les paramètres de l'EEPROM?"
286
+#define EEPROM_REVERT_TIPS_FR "Rétablir les paramètres par défaut d'usine?"

+ 224
- 214
Marlin/src/lcd/extui/lib/mks_ui/tft_Language_it.h View File

@@ -22,250 +22,260 @@
22 22
 #pragma once
23 23
 
24 24
 //****************意大利语***************************//
25
-#define TOOL_TEXT_IT            "Strumento"
26
-#define PREHEAT_TEXT_IT         "Prerisc"
27
-#define MOVE_TEXT_IT                "Muovi"
28
-#define HOME_TEXT_IT            "Home"
29
-#define PRINT_TEXT_IT               "Stampa"
30
-#define EXTRUDE_TEXT_IT         "Estrude"
31
-#define LEVELING_TEXT_IT        "Leveling"
32
-#define AUTO_LEVELING_TEXT_IT   "AutoLevel"
33
-#define SET_TEXT_IT                     "Imposta"
34
-#define MORE_TEXT_IT            "Di più"
25
+#define TOOL_TEXT_IT                  "Strumento"
26
+#define PREHEAT_TEXT_IT               "Prerisc"
27
+#define MOVE_TEXT_IT                  "Muovi"
28
+#define HOME_TEXT_IT                  "Home"
29
+#define PRINT_TEXT_IT                 "Stampa"
30
+#define EXTRUDE_TEXT_IT               "Estrude"
31
+#define LEVELING_TEXT_IT              "Leveling"
32
+#define AUTO_LEVELING_TEXT_IT         "AutoLevel"
33
+#define SET_TEXT_IT                   "Imposta"
34
+#define MORE_TEXT_IT                  "Di più"
35 35
 
36
-#define ADD_TEXT_IT                         "Aumentare"
37
-#define DEC_TEXT_IT                         "Ridurre"
38
-#define EXTRUDER_1_TEXT_IT              "Estrude1"
39
-#define EXTRUDER_2_TEXT_IT              "Estrude2"
40
-#define HEATBED_TEXT_IT                 "Piano"
41
-#define TEXT_1C_IT                              "1℃"
42
-#define TEXT_5C_IT                              "5℃"
43
-#define TEXT_10C_IT                             "10℃"
44
-#define CLOSE_TEXT_IT                   "Spento"
36
+#define ADD_TEXT_IT                   "Aumentare"
37
+#define DEC_TEXT_IT                   "Ridurre"
38
+#define EXTRUDER_1_TEXT_IT            "Estrude1"
39
+#define EXTRUDER_2_TEXT_IT            "Estrude2"
40
+#define HEATBED_TEXT_IT               "Piano"
41
+#define TEXT_1C_IT                    "1℃"
42
+#define TEXT_5C_IT                    "5℃"
43
+#define TEXT_10C_IT                   "10℃"
44
+#define CLOSE_TEXT_IT                 "Spento"
45 45
 
46
-#define BACK_TEXT_IT                                    "Indietro"
46
+#define BACK_TEXT_IT                  "Indietro"
47 47
 
48
-#define TOOL_PREHEAT_IT            "Prerisc"
49
-#define TOOL_EXTRUDE_IT             "Estrude"
50
-#define TOOL_MOVE_IT                "Muovi"
51
-#define TOOL_HOME_IT                "Home"
52
-#define TOOL_LEVELING_IT               "Leveling"
48
+#define TOOL_PREHEAT_IT               "Prerisc"
49
+#define TOOL_EXTRUDE_IT               "Estrude"
50
+#define TOOL_MOVE_IT                  "Muovi"
51
+#define TOOL_HOME_IT                  "Home"
52
+#define TOOL_LEVELING_IT              "Leveling"
53 53
 #define TOOL_AUTO_LEVELING_IT         "Autolevel"
54
-#define TOOL_FILAMENT_IT                "Filamento"
55
-#define TOOL_MORE_IT                    "Di più"
54
+#define TOOL_FILAMENT_IT              "Filamento"
55
+#define TOOL_MORE_IT                  "Di più"
56 56
 
57
-#define AXIS_X_ADD_TEXT_IT                              "X+"
58
-#define AXIS_X_DEC_TEXT_IT                              "X-"
59
-#define AXIS_Y_ADD_TEXT_IT                              "Y+"
60
-#define AXIS_Y_DEC_TEXT_IT                              "Y-"
61
-#define AXIS_Z_ADD_TEXT_IT                              "Z+"
62
-#define AXIS_Z_DEC_TEXT_IT                              "Z-"
63
-#define TEXT_01MM_IT                                    "0.1mm"
64
-#define TEXT_1MM_IT                                             "1mm"
65
-#define TEXT_10MM_IT                                    "10mm"
57
+#define AXIS_X_ADD_TEXT_IT            "X+"
58
+#define AXIS_X_DEC_TEXT_IT            "X-"
59
+#define AXIS_Y_ADD_TEXT_IT            "Y+"
60
+#define AXIS_Y_DEC_TEXT_IT            "Y-"
61
+#define AXIS_Z_ADD_TEXT_IT            "Z+"
62
+#define AXIS_Z_DEC_TEXT_IT            "Z-"
63
+#define TEXT_01MM_IT                  "0.1mm"
64
+#define TEXT_1MM_IT                   "1mm"
65
+#define TEXT_10MM_IT                  "10mm"
66 66
 
67
-#define HOME_X_TEXT_IT                                  "X"
68
-#define HOME_Y_TEXT_IT                                  "Y"
69
-#define HOME_Z_TEXT_IT                                  "Z"
70
-#define HOME_ALL_TEXT_IT                                "All"
71
-#define HOME_STOPMOVE_IT                "Quickstop"
67
+#define HOME_X_TEXT_IT                "X"
68
+#define HOME_Y_TEXT_IT                "Y"
69
+#define HOME_Z_TEXT_IT                "Z"
70
+#define HOME_ALL_TEXT_IT              "All"
71
+#define HOME_STOPMOVE_IT              "Quickstop"
72 72
 
73
-#define PAGE_UP_TEXT_IT                                 "Pagina su"
74
-#define PAGE_DOWN_TEXT_IT                               "Pagina giù"
73
+#define PAGE_UP_TEXT_IT               "Pagina su"
74
+#define PAGE_DOWN_TEXT_IT             "Pagina giù"
75 75
 
76
-#define EXTRUDER_IN_TEXT_IT                 "Estru"
77
-#define EXTRUDER_OUT_TEXT_IT                "Ritra"
78
-#define EXTRUDE_1MM_TEXT_IT                         "1mm"
79
-#define EXTRUDE_5MM_TEXT_IT                         "5mm"
80
-#define EXTRUDE_10MM_TEXT_IT                "10mm"
81
-#define EXTRUDE_LOW_SPEED_TEXT_IT               "Bassa"
82
-#define EXTRUDE_MEDIUM_SPEED_TEXT_IT    "Media"
83
-#define EXTRUDE_HIGH_SPEED_TEXT_IT              "Alta"
76
+#define EXTRUDER_IN_TEXT_IT           "Estru"
77
+#define EXTRUDER_OUT_TEXT_IT          "Ritra"
78
+#define EXTRUDE_1MM_TEXT_IT           "1mm"
79
+#define EXTRUDE_5MM_TEXT_IT           "5mm"
80
+#define EXTRUDE_10MM_TEXT_IT          "10mm"
81
+#define EXTRUDE_LOW_SPEED_TEXT_IT     "Bassa"
82
+#define EXTRUDE_MEDIUM_SPEED_TEXT_IT  "Media"
83
+#define EXTRUDE_HIGH_SPEED_TEXT_IT    "Alta"
84 84
 
85
-#define LEVELING_POINT1_TEXT_IT                         "Primo"
86
-#define LEVELING_POINT2_TEXT_IT                         "Secondo"
87
-#define LEVELING_POINT3_TEXT_IT                     "Terzo"
88
-#define LEVELING_POINT4_TEXT_IT                         "Quarto"
89
-#define LEVELING_POINT5_TEXT_IT                         "Quinto"
85
+#define LEVELING_POINT1_TEXT_IT       "Primo"
86
+#define LEVELING_POINT2_TEXT_IT       "Secondo"
87
+#define LEVELING_POINT3_TEXT_IT       "Terzo"
88
+#define LEVELING_POINT4_TEXT_IT       "Quarto"
89
+#define LEVELING_POINT5_TEXT_IT       "Quinto"
90 90
 
91
-#define FILESYS_TEXT_IT                                         "FileSys"
92
-#define WIFI_TEXT_IT                                        "WIFI"
93
-#define FAN_TEXT_IT                                                     "Ventola"
94
-#define ABOUT_TEXT_IT                                           "Circa"
95
-#define BREAK_POINT_TEXT_IT                                     "Continua"
96
-#define FILAMENT_TEXT_IT                                        "Filamento"
97
-#define LANGUAGE_TEXT_IT                                        "Lingua"
98
-#define MOTOR_OFF_TEXT_IT                                       "Motor off"
99
-#define MOTOR_OFF_XY_TEXT_IT    "Off-XY"
100
-#define SHUTDOWN_TEXT_IT                                        "Spento"
91
+#define FILESYS_TEXT_IT               "FileSys"
92
+#define WIFI_TEXT_IT                  "WIFI"
93
+#define FAN_TEXT_IT                   "Ventola"
94
+#define ABOUT_TEXT_IT                 "Circa"
95
+#define BREAK_POINT_TEXT_IT           "Continua"
96
+#define FILAMENT_TEXT_IT              "Filamento"
97
+#define LANGUAGE_TEXT_IT              "Lingua"
98
+#define MOTOR_OFF_TEXT_IT             "Motor off"
99
+#define MOTOR_OFF_XY_TEXT_IT          "Off-XY"
100
+#define SHUTDOWN_TEXT_IT              "Spento"
101
+#define MACHINE_PARA_IT               "Config"
102
+#define EEPROM_SETTINGS_IT            "Eeprom Set"
101 103
 
102
-#define U_DISK_TEXT_IT                                          "USB"
103
-#define SD_CARD_TEXT_IT                                         "SD"
104
-#define WIFI_NAME_TEXT_IT                                       "WIFI: "
105
-#define WIFI_KEY_TEXT_IT                                        "KEY: "
106
-#define WIFI_IP_TEXT_IT                                         "IP: "
107
-#define WIFI_AP_TEXT_IT                                         "Stato: AP"
108
-#define WIFI_STA_TEXT_IT                                        "Stato: STA"
109
-#define WIFI_CONNECTED_TEXT_IT                          "Connesso"
110
-#define WIFI_DISCONNECTED_TEXT_IT                       "Disconnesso"
111
-#define WIFI_EXCEPTION_TEXT_IT                          "Eccezione"
112
-#define WIFI_RECONNECT_TEXT_IT         "Reconnect"
113
-#define CLOUD_TEXT_IT                                           "Cloud"
114
-#define CLOUD_BIND_IT                                           "Legato"
115
-#define CLOUD_UNBIND_IT                                         "Libero"
116
-#define CLOUD_DISCONNECTED_IT                           "Disconnesso"
117
-#define CLOUD_UNBINDING_IT                                      "Libero"
118
-#define CLOUD_UNBINDED_IT                                       "Sciolto"
119
-#define CLOUD_BINDED_IT                                         "Legato"
120
-#define CLOUD_DISABLE_IT                                        "Disable"
104
+#define U_DISK_TEXT_IT                "USB"
105
+#define SD_CARD_TEXT_IT               "SD"
106
+#define WIFI_NAME_TEXT_IT             "WIFI: "
107
+#define WIFI_KEY_TEXT_IT              "KEY: "
108
+#define WIFI_IP_TEXT_IT               "IP: "
109
+#define WIFI_AP_TEXT_IT               "Stato: AP"
110
+#define WIFI_STA_TEXT_IT              "Stato: STA"
111
+#define WIFI_CONNECTED_TEXT_IT        "Connesso"
112
+#define WIFI_DISCONNECTED_TEXT_IT     "Disconnesso"
113
+#define WIFI_EXCEPTION_TEXT_IT        "Eccezione"
114
+#define WIFI_RECONNECT_TEXT_IT        "Reconnect"
115
+#define CLOUD_TEXT_IT                 "Cloud"
116
+#define CLOUD_BIND_IT                 "Legato"
117
+#define CLOUD_UNBIND_IT               "Libero"
118
+#define CLOUD_DISCONNECTED_IT         "Disconnesso"
119
+#define CLOUD_UNBINDING_IT            "Libero"
120
+#define CLOUD_UNBINDED_IT             "Sciolto"
121
+#define CLOUD_BINDED_IT               "Legato"
122
+#define CLOUD_DISABLE_IT              "Disable"
121 123
 
122
-#define FAN_ADD_TEXT_IT                                         "Aumentare"
123
-#define FAN_DEC_TEXT_IT                                         "Ridurre"
124
-#define FAN_OPEN_TEXT_IT                                        "100%"
125
-#define FAN_HALF_TEXT_IT                                        "50%"
126
-#define FAN_CLOSE_TEXT_IT                                       "Spento"
127
-#define FAN_TIPS1_TEXT_IT                                       "Ventola"
128
-#define FAN_TIPS2_TEXT_IT                                       "Ventola\n0"
124
+#define FAN_ADD_TEXT_IT               "Aumentare"
125
+#define FAN_DEC_TEXT_IT               "Ridurre"
126
+#define FAN_OPEN_TEXT_IT              "100%"
127
+#define FAN_HALF_TEXT_IT              "50%"
128
+#define FAN_CLOSE_TEXT_IT             "Spento"
129
+#define FAN_TIPS1_TEXT_IT             "Ventola"
130
+#define FAN_TIPS2_TEXT_IT             "Ventola\n0"
129 131
 
130
-#define FILAMENT_IN_TEXT_IT                                     "Inser"
131
-#define FILAMENT_OUT_TEXT_IT                            "Estra"
132
-#define FILAMENT_EXT0_TEXT_IT                           "Estrude1"
133
-#define FILAMENT_EXT1_TEXT_IT                           "Estrude2"
134
-#define FILAMENT_HEAT_TEXT_IT                       "Preriscaldamento"
135
-#define FILAMENT_STOP_TEXT_IT                           "Stop"
136
-//#define FILAMENT_CHANGE_TEXT_IT       "Filamento"
137
-#define FILAMENT_TIPS2_TEXT_IT                          "T:"
138
-#define FILAMENT_TIPS3_TEXT_IT                          "Inserimento del filamento..."
139
-#define FILAMENT_TIPS4_TEXT_IT                          "Estrazione del filamento..."
140
-#define FILAMENT_TIPS5_TEXT_IT                          "Temp is too low to go,please heat"
141
-#define FILAMENT_TIPS6_TEXT_IT                          "Completato"
132
+#define FILAMENT_IN_TEXT_IT           "Inser"
133
+#define FILAMENT_OUT_TEXT_IT          "Estra"
134
+#define FILAMENT_EXT0_TEXT_IT         "Estrude1"
135
+#define FILAMENT_EXT1_TEXT_IT         "Estrude2"
136
+#define FILAMENT_HEAT_TEXT_IT         "Preriscaldamento"
137
+#define FILAMENT_STOP_TEXT_IT         "Stop"
138
+//#define FILAMENT_CHANGE_TEXT_IT     "Filamento"
139
+#define FILAMENT_TIPS2_TEXT_IT        "T:"
140
+#define FILAMENT_TIPS3_TEXT_IT        "Inserimento del filamento..."
141
+#define FILAMENT_TIPS4_TEXT_IT        "Estrazione del filamento..."
142
+#define FILAMENT_TIPS5_TEXT_IT        "Temp is too low to go,please heat"
143
+#define FILAMENT_TIPS6_TEXT_IT        "Completato"
142 144
 
143 145
 #if 0
144
-  #define FILAMENT_REPLAYS_IDLE_TEXT_IT         "Please click <Estru> or <Ritra> \nto replace filament!"
145
-  #define FILAMENT_CHANGE_TEXT_IT                               "Please click <Estru> or <Ritra>,\nAfter pinter pause."
146
-  #define FILAMENT_DIALOG_LOAD_HEAT_TIPS_IT             "Heating up the nozzle,please wait..."
147
-  #define FILAMENT_DIALOG_UNLOAD_HEAT_TIPS_IT           "Heating up the nozzle,please wait..."
148
-  #define FILAMENT_DIALOG_LOAD_CONFIRM1_TIPS_IT           "Heat completed,please load filament to extruder,and click <Conferma> for start loading."
149
-  #define FILAMENT_DIALOG_LOAD_CONFIRM2_TIPS_IT           "Please load filament to extruder,and click <Conferma> for start loading."
150
-  #define FILAMENT_DIALOG_UNLOAD_CONFIRM_TIPS_IT          "Heat completed,please click <Conferma> for start unloading.!"
151
-  #define FILAMENT_DIALOG_LOADING_TIPS_IT                 "Is loading ,please wait!"
152
-  #define FILAMENT_DIALOG_UNLOADING_TIPS_IT               "Is unloading,please wait!"
153
-  #define FILAMENT_DIALOG_LOAD_COMPLETE_TIPS_IT           "Load filament completed,click <Conferma> for return!"
154
-  #define FILAMENT_DIALOG_UNLOAD_COMPLETE_TIPS_IT         "Unload filament completed,click <Conferma> for return!"
146
+  #define FILAMENT_REPLAYS_IDLE_TEXT_IT           "Please click <Estru> or <Ritra> \nto replace filament!"
147
+  #define FILAMENT_CHANGE_TEXT_IT                 "Please click <Estru> or <Ritra>,\nAfter pinter pause."
148
+  #define FILAMENT_DIALOG_LOAD_HEAT_TIPS_IT       "Heating up the nozzle,please wait..."
149
+  #define FILAMENT_DIALOG_UNLOAD_HEAT_TIPS_IT     "Heating up the nozzle,please wait..."
150
+  #define FILAMENT_DIALOG_LOAD_CONFIRM1_TIPS_IT   "Heat completed,please load filament to extruder,and click <Conferma> for start loading."
151
+  #define FILAMENT_DIALOG_LOAD_CONFIRM2_TIPS_IT   "Please load filament to extruder,and click <Conferma> for start loading."
152
+  #define FILAMENT_DIALOG_UNLOAD_CONFIRM_TIPS_IT  "Heat completed,please click <Conferma> for start unloading.!"
153
+  #define FILAMENT_DIALOG_LOADING_TIPS_IT         "Is loading ,please wait!"
154
+  #define FILAMENT_DIALOG_UNLOADING_TIPS_IT       "Is unloading,please wait!"
155
+  #define FILAMENT_DIALOG_LOAD_COMPLETE_TIPS_IT   "Load filament completed,click <Conferma> for return!"
156
+  #define FILAMENT_DIALOG_UNLOAD_COMPLETE_TIPS_IT "Unload filament completed,click <Conferma> for return!"
155 157
 #endif
156
-#define FILAMENT_CHANGE_TEXT_IT                               "Please click <Load> \nor <unload>,After \npinter pause."
157
-#define FILAMENT_DIALOG_LOAD_HEAT_TIPS_IT             "Heating up the nozzle,please wait..."
158
-#define FILAMENT_DIALOG_UNLOAD_HEAT_TIPS_IT           "Heating up the nozzle,please wait..."
159
-#define FILAMENT_DIALOG_LOAD_CONFIRM1_TIPS_IT           "Heat completed,please load filament \nto extruder,and click <confirm> \nfor start loading."
160
-#define FILAMENT_DIALOG_LOAD_CONFIRM2_TIPS_IT           "Please load filament to extruder,\nand click <confirm> for start loading."
161
-#define FILAMENT_DIALOG_UNLOAD_CONFIRM_TIPS_IT          "Heat completed,please \nclick <confirm> for start unloading.!"
162
-#define FILAMENT_DIALOG_LOADING_TIPS_IT                 "Is loading ,please wait!"
163
-#define FILAMENT_DIALOG_UNLOADING_TIPS_IT               "Is unloading,please wait!"
164
-#define FILAMENT_DIALOG_LOAD_COMPLETE_TIPS_IT           "Load filament completed,\nclick <confirm> for return!"
165
-#define FILAMENT_DIALOG_UNLOAD_COMPLETE_TIPS_IT         "Unload filament completed,\nclick <confirm> for return!"
158
+#define FILAMENT_CHANGE_TEXT_IT                 "Please click <Load> \nor <unload>,After \npinter pause."
159
+#define FILAMENT_DIALOG_LOAD_HEAT_TIPS_IT       "Heating up the nozzle,please wait..."
160
+#define FILAMENT_DIALOG_UNLOAD_HEAT_TIPS_IT     "Heating up the nozzle,please wait..."
161
+#define FILAMENT_DIALOG_LOAD_CONFIRM1_TIPS_IT   "Heat completed,please load filament \nto extruder,and click <confirm> \nfor start loading."
162
+#define FILAMENT_DIALOG_LOAD_CONFIRM2_TIPS_IT   "Please load filament to extruder,\nand click <confirm> for start loading."
163
+#define FILAMENT_DIALOG_UNLOAD_CONFIRM_TIPS_IT  "Heat completed,please \nclick <confirm> for start unloading.!"
164
+#define FILAMENT_DIALOG_LOADING_TIPS_IT         "Is loading ,please wait!"
165
+#define FILAMENT_DIALOG_UNLOADING_TIPS_IT       "Is unloading,please wait!"
166
+#define FILAMENT_DIALOG_LOAD_COMPLETE_TIPS_IT   "Load filament completed,\nclick <confirm> for return!"
167
+#define FILAMENT_DIALOG_UNLOAD_COMPLETE_TIPS_IT "Unload filament completed,\nclick <confirm> for return!"
166 168
 
167 169
 
168
-#define PRE_HEAT_EXT_TEXT_IT                            "E"
169
-#define PRE_HEAT_BED_TEXT_IT                            "Piano"
170
+#define PRE_HEAT_EXT_TEXT_IT              "E"
171
+#define PRE_HEAT_BED_TEXT_IT              "Piano"
170 172
 
171
-#define FILE_LOADING_IT                                 "Caricamento......"
173
+#define FILE_LOADING_IT                   "Caricamento......"
172 174
 #if 0
173
-  #define NO_FILE_AND_CHECK_IT                "Nessun file trovato! Inserisci la scheda SD o il disco U!"
175
+  #define NO_FILE_AND_CHECK_IT              "Nessun file trovato! Inserisci la scheda SD o il disco U!"
174 176
 #endif
175
-#define NO_FILE_AND_CHECK_IT                            "Nessun file,\n          per favore controllare di nuovo!"
177
+#define NO_FILE_AND_CHECK_IT              "Nessun file,\n          per favore controllare di nuovo!"
176 178
 
177
-#define NO_FILE_IT                                              "Nessun file!"
179
+#define NO_FILE_IT                        "Nessun file!"
178 180
 
179
-#define EXTRUDER_TEMP_TEXT_IT                           "Temper"
180
-#define EXTRUDER_E_LENGTH1_TEXT_IT          "Estrude1"
181
-#define EXTRUDER_E_LENGTH2_TEXT_IT          "Estrude2"
182
-#define EXTRUDER_E_LENGTH3_TEXT_IT          "Estrude3"
181
+#define EXTRUDER_TEMP_TEXT_IT             "Temper"
182
+#define EXTRUDER_E_LENGTH1_TEXT_IT        "Estrude1"
183
+#define EXTRUDER_E_LENGTH2_TEXT_IT        "Estrude2"
184
+#define EXTRUDER_E_LENGTH3_TEXT_IT        "Estrude3"
183 185
 
184
-#define ABOUT_TYPE_TEXT_IT                                      "Type: "
185
-#define ABOUT_VERSION_TEXT_IT                           "Firmware: "
186
-#define ABOUT_WIFI_TEXT_IT                                      "WiFi: "
186
+#define ABOUT_TYPE_TEXT_IT                "Type: "
187
+#define ABOUT_VERSION_TEXT_IT             "Firmware: "
188
+#define ABOUT_WIFI_TEXT_IT                "WiFi: "
187 189
 
188
-#define PRINTING_OPERATION_IT                           "Opzioni"
189
-#define PRINTING_PAUSE_IT                                       "Pause"
190
-#define PRINTING_TEMP_IT                                        "Temp."
191
-#define PRINTING_CHANGESPEED_IT                         "Velocità"
192
-#define PRINTING_RESUME_IT                                      "Recupero"
193
-#define PRINTING_STOP_IT                                        "Stop"
194
-#define PRINTING_MORE_IT                                        "Di più"
195
-#define PRINTING_EXTRUDER_IT                        "Estrude"
196
-#define PRINTING_MOVE_IT              "Muovi"
190
+#define PRINTING_OPERATION_IT             "Opzioni"
191
+#define PRINTING_PAUSE_IT                 "Pause"
192
+#define PRINTING_TEMP_IT                  "Temp."
193
+#define PRINTING_CHANGESPEED_IT           "Velocità"
194
+#define PRINTING_RESUME_IT                "Recupero"
195
+#define PRINTING_STOP_IT                  "Stop"
196
+#define PRINTING_MORE_IT                  "Di più"
197
+#define PRINTING_EXTRUDER_IT              "Estrude"
198
+#define PRINTING_MOVE_IT                  "Muovi"
197 199
 
198
-#define EXTRUDER_SPEED_IT                                       "Estrude"
199
-#define MOVE_SPEED_IT                                           "Muovi"
200
-#define EXTRUDER_SPEED_STATE_IT                         "Estrusione"
201
-#define MOVE_SPEED_STATE_IT                                     "Movimento"
202
-#define STEP_1PERCENT_IT                                        "1%"
203
-#define STEP_5PERCENT_IT                                        "5%"
204
-#define STEP_10PERCENT_IT                                       "10%"
200
+#define EXTRUDER_SPEED_IT                 "Estrude"
201
+#define MOVE_SPEED_IT                     "Muovi"
202
+#define EXTRUDER_SPEED_STATE_IT           "Estrusione"
203
+#define MOVE_SPEED_STATE_IT               "Movimento"
204
+#define STEP_1PERCENT_IT                  "1%"
205
+#define STEP_5PERCENT_IT                  "5%"
206
+#define STEP_10PERCENT_IT                 "10%"
205 207
 
206
-#define ZOFFSET_IT                          "Z Offset"
207
-#define ZOFFSET_INC_IT                      "Add"
208
-#define ZOFFSET_DEC_IT                      "Dec"
208
+#define ZOFFSET_IT                        "Z Offset"
209
+#define ZOFFSET_INC_IT                    "Add"
210
+#define ZOFFSET_DEC_IT                    "Dec"
209 211
 
210
-#define TITLE_READYPRINT_IT                                             "Pronto"
211
-#define TITLE_PREHEAT_IT                                                "Preris"
212
-#define TITLE_MOVE_IT                                                   "Muovi"
213
-#define TITLE_HOME_IT                                                   "Home"
214
-#define TITLE_EXTRUDE_IT                                                "Estrude"
215
-#define TITLE_LEVELING_IT                                               "Livella"
216
-#define TITLE_SET_IT                                                    "Impostare"
217
-#define TITLE_MORE_IT                                                   "Di più"
218
-#define TITLE_CHOOSEFILE_IT                                             "File"
219
-#define TITLE_PRINTING_IT                                               "Stampa"
220
-#define TITLE_OPERATION_IT                                              "Opzioni"
221
-#define TITLE_ADJUST_IT                                                 "Regolare"
222
-#define TITLE_WIRELESS_IT                                               "Wireless"
223
-#define TITLE_FILAMENT_IT                                               "Filamento"
224
-#define TITLE_ABOUT_IT                                                  "Circa"
225
-#define TITLE_FAN_IT                                                    "Ventola"
226
-#define TITLE_LANGUAGE_IT                                               "Lingua"
227
-#define TITLE_PAUSE_IT                                                  "Pausa"
228
-#define TITLE_CHANGESPEED_IT                                "Velocità"
229
-#define TITLE_CLOUD_TEXT_IT                                     "Cloud"
230
-#define TITLE_DIALOG_CONFIRM_IT                         "Confirm"
231
-#define TITLE_FILESYS_IT                                                        "FileSys"
232
-#define TITLE_ZOFFSET_IT                          "Z Offset"
212
+#define TITLE_READYPRINT_IT               "Pronto"
213
+#define TITLE_PREHEAT_IT                  "Preris"
214
+#define TITLE_MOVE_IT                     "Muovi"
215
+#define TITLE_HOME_IT                     "Home"
216
+#define TITLE_EXTRUDE_IT                  "Estrude"
217
+#define TITLE_LEVELING_IT                 "Livella"
218
+#define TITLE_SET_IT                      "Impostare"
219
+#define TITLE_MORE_IT                     "Di più"
220
+#define TITLE_CHOOSEFILE_IT               "File"
221
+#define TITLE_PRINTING_IT                 "Stampa"
222
+#define TITLE_OPERATION_IT                "Opzioni"
223
+#define TITLE_ADJUST_IT                   "Regolare"
224
+#define TITLE_WIRELESS_IT                 "Wireless"
225
+#define TITLE_FILAMENT_IT                 "Filamento"
226
+#define TITLE_ABOUT_IT                    "Circa"
227
+#define TITLE_FAN_IT                      "Ventola"
228
+#define TITLE_LANGUAGE_IT                 "Lingua"
229
+#define TITLE_PAUSE_IT                    "Pausa"
230
+#define TITLE_CHANGESPEED_IT              "Velocità"
231
+#define TITLE_CLOUD_TEXT_IT               "Cloud"
232
+#define TITLE_DIALOG_CONFIRM_IT           "Confirm"
233
+#define TITLE_FILESYS_IT                  "FileSys"
234
+#define TITLE_ZOFFSET_IT                  "Z Offset"
233 235
 
234
-#define AUTO_SHUTDOWN_IT                                        "Auto"
235
-#define MANUAL_SHUTDOWN_IT                                      "Manuale"
236
+#define AUTO_SHUTDOWN_IT                  "Auto"
237
+#define MANUAL_SHUTDOWN_IT                "Manuale"
236 238
 
237
-#define DIALOG_CONFIRM_IT                                       "Conferma"
238
-#define DIALOG_CANCLE_IT                                        "Cancella"
239
-#define DIALOG_OK_IT                                            "OK"
240
-#define DIALOG_RESET_IT                                         "Resettare"
241
-#define DIALOG_RETRY_IT                                         "Riprovare"
242
-#define DIALOG_DISABLE_IT                                       "Disable"
243
-#define DIALOG_PRINT_MODEL_IT                           "Gcode stampa?"
244
-#define DIALOG_CANCEL_PRINT_IT                          "Stop stampa?"
245
-#define DIALOG_STOP_IT                          "Stop"
246
-#define DIALOG_REPRINT_FROM_BREAKPOINT_IT       "Continua a stampare dal \npunto di interruzione?"
247
-//#define DIALOG_UNBIND_PRINTER_IT    "Libero?"
248
-#define DIALOG_ERROR_TIPS1_IT                   "Errore: nessun file, \nper favore controllare di nuovo."
249
-#define DIALOG_ERROR_TIPS2_IT                   "Errore: operazione non riuscita, \nsi prega di controllare se il baudrate del \ndisplay è lo stesso scheda madre"
250
-#define DIALOG_ERROR_TIPS3_IT                   "Errore: il nome del file o il \npercorso è troppo lungo!"
251
-#define DIALOG_CLOSE_MACHINE_IT                 "Closing machine......"
252
-#define DIALOG_UNBIND_PRINTER_IT                "Unbind the printer?"
253
-#define DIALOG_FILAMENT_NO_PRESS_IT         "Filament detection switch is not pressed"
254
-#define DIALOG_PRINT_FINISH_IT              "La stampa è completa!"
239
+#define DIALOG_CONFIRM_IT                 "Conferma"
240
+#define DIALOG_CANCLE_IT                  "Cancella"
241
+#define DIALOG_OK_IT                      "OK"
242
+#define DIALOG_RESET_IT                   "Resettare"
243
+#define DIALOG_RETRY_IT                   "Riprovare"
244
+#define DIALOG_DISABLE_IT                 "Disable"
245
+#define DIALOG_PRINT_MODEL_IT             "Gcode stampa?"
246
+#define DIALOG_CANCEL_PRINT_IT            "Stop stampa?"
247
+#define DIALOG_STOP_IT                    "Stop"
248
+#define DIALOG_REPRINT_FROM_BREAKPOINT_IT "Continua a stampare dal \npunto di interruzione?"
249
+//#define DIALOG_UNBIND_PRINTER_IT        "Libero?"
250
+#define DIALOG_ERROR_TIPS1_IT             "Errore: nessun file, \nper favore controllare di nuovo."
251
+#define DIALOG_ERROR_TIPS2_IT             "Errore: operazione non riuscita, \nsi prega di controllare se il baudrate del \ndisplay è lo stesso scheda madre"
252
+#define DIALOG_ERROR_TIPS3_IT             "Errore: il nome del file o il \npercorso è troppo lungo!"
253
+#define DIALOG_CLOSE_MACHINE_IT           "Closing machine......"
254
+#define DIALOG_UNBIND_PRINTER_IT          "Unbind the printer?"
255
+#define DIALOG_FILAMENT_NO_PRESS_IT       "Filament detection switch is not pressed"
256
+#define DIALOG_PRINT_FINISH_IT            "La stampa è completa!"
255 257
 #define DIALOG_PRINT_TIME_IT              "Tempo di stampa: "
256 258
 #define DIALOG_REPRINT_IT                 "Print again"
257
-#define DIALOG_WIFI_ENABLE_TIPS_IT "The wifi module is being configured,\nplease wait a moment....."
259
+#define DIALOG_WIFI_ENABLE_TIPS_IT        "The wifi module is being configured,\nplease wait a moment....."
258 260
 
259
-#define MESSEGE_PAUSING_IT                      "Parcheggiando..."
260
-#define MESSEGE_CHANGING_IT                     "Attendere avvio del cambio di filamento"
261
-#define MESSEGE_UNLOAD_IT                       "Attendere l'espulsione del filamento"
262
-#define MESSEGE_WAITING_IT                      "Premi per riprendere la stampa"
263
-#define MESSEGE_INSERT_IT                       "Inserisci il filamento e premi per continuare"
264
-#define MESSEGE_LOAD_IT                 "Attendere il caricamento del filamento"
265
-#define MESSEGE_PURGE_IT                        "Attendere lo spurgo del filamento"
266
-#define MESSEGE_RESUME_IT                       "Attendere la ripresa della stampa..."
267
-#define MESSEGE_HEAT_IT                 "Premi per riscaldare ugello"
268
-#define MESSEGE_HEATING_IT                      "Riscaldam. ugello Attendere prego..."
269
-#define MESSEGE_OPTION_IT                       "Eliminare di più o continuare a stampare?"
270
-#define MESSEGE_PURGE_MORE_IT   "Epurazione"
271
-#define MESSEGE_CONTINUE_PRINT_IT   "Stampa"
261
+#define MESSAGE_PAUSING_IT                "Parcheggiando..."
262
+#define MESSAGE_CHANGING_IT               "Attendere avvio del cambio di filamento"
263
+#define MESSAGE_UNLOAD_IT                 "Attendere l'espulsione del filamento"
264
+#define MESSAGE_WAITING_IT                "Premi per riprendere la stampa"
265
+#define MESSAGE_INSERT_IT                 "Inserisci il filamento e premi per continuare"
266
+#define MESSAGE_LOAD_IT                   "Attendere il caricamento del filamento"
267
+#define MESSAGE_PURGE_IT                  "Attendere lo spurgo del filamento"
268
+#define MESSAGE_RESUME_IT                 "Attendere la ripresa della stampa..."
269
+#define MESSAGE_HEAT_IT                   "Premi per riscaldare ugello"
270
+#define MESSAGE_HEATING_IT                "Riscaldam. ugello Attendere prego..."
271
+#define MESSAGE_OPTION_IT                 "Eliminare di più o continuare a stampare?"
272
+#define MESSAGE_PURGE_MORE_IT             "Epurazione"
273
+#define MESSAGE_CONTINUE_PRINT_IT         "Stampa"
274
+#define EEPROM_SETTINGS_TITLE_IT          "Impostazioni EEPROM"
275
+#define EEPROM_SETTINGS_STORE_IT          "Memorizzare le impostazioni su EEPROM"
276
+#define EEPROM_SETTINGS_READ_IT           "Leggi le impostazioni dalla EEPROM"
277
+#define EEPROM_SETTINGS_REVERT_IT         "Ripristina le impostazioni predefinite di fabbrica"
278
+
279
+#define EEPROM_STORE_TIPS_IT              "Memorizzare le impostazioni su EEPROM?"
280
+#define EEPROM_READ_TIPS_IT               "Leggi le impostazioni dalla EEPROM?"
281
+#define EEPROM_REVERT_TIPS_IT             "Ripristinare le impostazioni predefinite?"

+ 23
- 13
Marlin/src/lcd/extui/lib/mks_ui/tft_Language_ru.h View File

@@ -98,6 +98,8 @@
98 98
 #define MOTOR_OFF_TEXT_RU               "отклмотор"
99 99
 #define MOTOR_OFF_XY_TEXT_RU            "Off-XY"
100 100
 #define SHUTDOWN_TEXT_RU                "выключение"
101
+#define MACHINE_PARA_RU                 "конфиг"
102
+#define EEPROM_SETTINGS_RU              "Eeprom Set"
101 103
 
102 104
 #define U_DISK_TEXT_RU                  "U диск"
103 105
 #define SD_CARD_TEXT_RU                 "SD диск"
@@ -257,16 +259,24 @@
257 259
 #define DIALOG_REPRINT_RU                   "Print again"
258 260
 #define DIALOG_WIFI_ENABLE_TIPS_RU          "The wifi module is being configured,\nplease wait a moment....."
259 261
 
260
-#define MESSEGE_PAUSING_RU                  "Стоянка..."
261
-#define MESSEGE_CHANGING_RU                 "Подождите, пока начнется смена филамента"
262
-#define MESSEGE_UNLOAD_RU                   "Дождитесь выгрузки нити"
263
-#define MESSEGE_WAITING_RU                  "Нажмите кнопку,чтобы возобновить печать"
264
-#define MESSEGE_INSERT_RU                   "Вставьте нить и нажмите кнопку,чтобы продолжить"
265
-#define MESSEGE_LOAD_RU                     "Дождитесь загрузки нити"
266
-#define MESSEGE_PURGE_RU                    "Дождитесь чистки нити"
267
-#define MESSEGE_RESUME_RU                   "Подождите,пока печать возобновится ..."
268
-#define MESSEGE_HEAT_RU                     "Нажмите кнопку, чтобы нагреть форсунку"
269
-#define MESSEGE_HEATING_RU                  "Подогрев форсунки Пожалуйста, подождите ..."
270
-#define MESSEGE_OPTION_RU                   "Очистить больше или продолжить печать?"
271
-#define MESSEGE_PURGE_MORE_RU               "чистка"
272
-#define MESSEGE_CONTINUE_PRINT_RU           "Распечатать"
262
+#define MESSAGE_PAUSING_RU            "Стоянка..."
263
+#define MESSAGE_CHANGING_RU           "Подождите, пока начнется смена филамента"
264
+#define MESSAGE_UNLOAD_RU             "Дождитесь выгрузки нити"
265
+#define MESSAGE_WAITING_RU            "Нажмите кнопку,чтобы возобновить печать"
266
+#define MESSAGE_INSERT_RU             "Вставьте нить и нажмите кнопку,чтобы продолжить"
267
+#define MESSAGE_LOAD_RU               "Дождитесь загрузки нити"
268
+#define MESSAGE_PURGE_RU              "Дождитесь чистки нити"
269
+#define MESSAGE_RESUME_RU             "Подождите,пока печать возобновится ..."
270
+#define MESSAGE_HEAT_RU               "Нажмите кнопку, чтобы нагреть форсунку"
271
+#define MESSAGE_HEATING_RU            "Подогрев форсунки Пожалуйста, подождите ..."
272
+#define MESSAGE_OPTION_RU             "Очистить больше или продолжить печать?"
273
+#define MESSAGE_PURGE_MORE_RU         "чистка"
274
+#define MESSAGE_CONTINUE_PRINT_RU     "Распечатать"
275
+#define EEPROM_SETTINGS_TITLE_RU      "Настройки EEPROM"
276
+#define EEPROM_SETTINGS_STORE_RU      "Сохранение настроек в EEPROM"
277
+#define EEPROM_SETTINGS_READ_RU       "Чтение настроек из EEPROM"
278
+#define EEPROM_SETTINGS_REVERT_RU     "Восстановить заводские настройки по умолчанию"
279
+
280
+#define EEPROM_STORE_TIPS_RU          "Сохранить настройки в EEPROM?"
281
+#define EEPROM_READ_TIPS_RU           "Читать настройки из EEPROM?"
282
+#define EEPROM_REVERT_TIPS_RU         "Revert settings to factory defaults?"

+ 228
- 13
Marlin/src/lcd/extui/lib/mks_ui/tft_Language_s_cn.h View File

@@ -22,6 +22,211 @@
22 22
 #pragma once
23 23
 
24 24
 //*************简体中文***********************//
25
+#define NEXT_CN                       "下一页"
26
+#define PREVIOUS_CN                   "上一页"
27
+#define DEFAULT_CN                    "默认值"
28
+#define KEY_BACK_CN                   "退格"
29
+#define KEY_REST_CN                   "重置"
30
+#define KEY_CONFIRM_CN                "确定"
31
+
32
+#define MACHINE_PARA_TITLE_CN         "机器参数"
33
+#define MACHINE_TYPE_CNOFIG_CN        "机器设置"
34
+#define TEMPERATURE_CONFIG_CN         "温度设置"
35
+#define MOTOR_CONFIG_CN               "电机设置"
36
+#define ADVANCE_CONFIG_CN             "高级设置"
37
+
38
+#define MACHINE_CONFIG_TITLE_CN       "机器参数>机器配置"
39
+#define MACHINE_TYPE_CN               "机型选择"
40
+#define MACHINE_STROKE_CN             "行程设置"
41
+#define MACHINE_HOMEDIR_CN            "归零方向"
42
+#define MACHINE_ENDSTOP_TYPE_CN       "限位开关类型"
43
+#define MACHINE_FILAMENT_CONFIG_CN    "换料设置"
44
+#define MACHINE_LEVELING_CONFIG_CN    "调平设置"
45
+
46
+#define MACHINE_TYPE_CONFIG_TITLE_CN  "机器参数>机型选择"
47
+#define MACHINE_TYPE_XYZ_CN           "XYZ机型"
48
+#define MACHINE_TYPE_DELTA_CN         "Delta机型"
49
+#define MACHINE_TYPE_COREXY_CN        "Corexy机型"
50
+
51
+#define MACHINE_STROKE_CONF_TITLE_CN  "机器参数>机器行程"
52
+#define X_MAX_LENGTH_CN               "X轴最大行程"
53
+#define Y_MAX_LENGTH_CN               "Y轴最大行程"
54
+#define Z_MAX_LENGTH_CN               "Z轴最大行程"
55
+
56
+#define X_MIN_LENGTH_CN               "X轴最小行程"
57
+#define Y_MIN_LENGTH_CN               "Y轴最小行程"
58
+#define Z_MIN_LENGTH_CN               "Z轴最小行程"
59
+
60
+#define HOME_DIR_CONF_TITLE_CN        "机器参数>归零方向"
61
+#define HOME_DIR_X_CN                 "X轴归零方向"
62
+#define HOME_DIR_Y_CN                 "Y轴归零方向"
63
+#define HOME_DIR_Z_CN                 "Z轴归零方向"
64
+#define HOME_MIN_CN                   "MIN"
65
+#define HOME_MAX_CN                   "MAX"
66
+
67
+#define ENDSTOP_CONF_TITLE_CN         "机器参数>限位开关"
68
+#define MIN_ENDSTOP_X_CN              "X轴最小限位"
69
+#define MIN_ENDSTOP_Y_CN              "Y轴最小限位"
70
+#define MIN_ENDSTOP_Z_CN              "Z轴最小限位"
71
+#define MAX_ENDSTOP_X_CN              "X轴最大限位"
72
+#define MAX_ENDSTOP_Y_CN              "Y轴最大限位"
73
+#define MAX_ENDSTOP_Z_CN              "Z轴最大限位"
74
+#define ENDSTOP_FIL_CN                "断料开关类型"
75
+#define ENDSTOP_LEVEL_CN              "调平开关类型"
76
+#define ENDSTOP_OPENED_CN             "常开"
77
+#define ENDSTOP_CLOSED_CN             "常闭"
78
+
79
+#define FILAMENT_CONF_TITLE_CN        "换料设置"
80
+#define FILAMENT_IN_TEMPERATURE_CN    "进料温度"
81
+#define FILAMENT_IN_LENGTH_CN         "进料长度"
82
+#define FILAMENT_IN_SPEED_CN          "进料速度"
83
+#define FILAMENT_OUT_TEMPERATURE_CN   "退料温度"
84
+#define FILAMENT_OUT_LENGTH_CN        "退料长度"
85
+#define FILAMENT_OUT_SPEED_CN         "退料速度"
86
+
87
+#define LEVELING_CONF_TITLE_CN        "调平设置"
88
+#define LEVELING_PARA_CONF_CN         "调平设置"
89
+#define LEVELING_DELTA_CN             "delta机型设置"
90
+#define LEVELING_XYZ_CN               "手动调平坐标设置"
91
+
92
+#define LEVELING_PARA_CONF_TITLE_CN   "调平参数"
93
+#define AUTO_LEVELING_ENABLE_CN       "自动调平"
94
+#define BLTOUCH_LEVELING_ENABLE_CN    "启动BLtouch"
95
+#define PROBE_PORT_CN                 "调平探针接口"
96
+#define PROBE_X_OFFSET_CN             "探针X方向偏移"
97
+#define PROBE_Y_OFFSET_CN             "探针Y方向偏移"
98
+#define PROBE_Z_OFFSET_CN             "探针Z方向偏移"
99
+#define PROBE_XY_SPEED_CN             "探针XY方向移动速度"
100
+#define PROBE_Z_SPEED_CN              "探针Z方向移动速度"
101
+#define ENABLE_CN                     "是"
102
+#define DISABLE_CN                    "否"
103
+#define Z_MIN_CN                      "ZMin"
104
+#define Z_MAX_CN                      "ZMax"
105
+
106
+#define DELTA_LEVEL_CONF_TITLE_CN     "Delta机器参数"
107
+#define DELTA_LEVEL_CONF_CN           "Delta机器调平"
108
+#define DELTA_MACHINE_RADIUS_CN       "机器半径"
109
+#define DELTA_DIAGONAL_ROD_CN         "机器杆长"
110
+#define DELTA_PRINT_RADIUS_CN         "打印半径"
111
+#define DELTA_HEIGHT_CN               "打印高度"
112
+#define SMOOTH_ROD_OFFSET_CN          "滑块偏移"
113
+#define EFFECTOR_OFFSET_CN            "效应器偏移"
114
+#define CALIBRATION_RADIUS_CN         "调平半径"
115
+
116
+#define XYZ_LEVEL_CONF_TITLE_CN       "XYZ机器参数"
117
+#define PROBE_REACH_MAX_LEFT_CN       "探针达到最左位置"
118
+#define PROBE_REACH_MAX_RIGHT_CN      "探针达到最右位置"
119
+#define PROBE_REACH_MAX_FRONT_CN      "探针达到最前位置"
120
+#define PROBE_REACH_MAX_BACK_CN       "探针达到最后位置"
121
+
122
+#define TEMPERATURE_CONF_TITLE_CN     "机器参数>温度设置"
123
+#define NOZZLE_CONF_CN                "喷头设置"
124
+#define HOTBED_CONF_CN                "热床设置"
125
+#define PREHEAT_TEMPER_CN             "预设温度"
126
+
127
+#define NOZZLE_CONF_TITLE_CN          "机器参数>喷头设置"
128
+#define NOZZLECNT_CN                  "喷头数量"
129
+#define NOZZLE_TYPE_CN                "E0温感类型"
130
+#define NOZZLE_ADJUST_TYPE_CN         "PID调温"
131
+#define NOZZLE_MIN_TEMPERATURE_CN     "最低温度"
132
+#define NOZZLE_MAX_TEMPERATURE_CN     "最高温度"
133
+#define EXTRUD_MIN_TEMPER_CN          "最低挤出温度"
134
+
135
+#define HOTBED_CONF_TITLE_CN          "机器参数>热床设置"
136
+#define HOTBED_ADJUST_CN              "PID调温"
137
+#define HOTBED_MIN_TEMPERATURE_CN     "最低温度"
138
+#define HOTBED_MAX_TEMPERATURE_CN     "最高温度"
139
+
140
+#define MOTOR_CONF_TITLE_CN           "机器参数>电机设置"
141
+#define MAXFEEDRATE_CONF_CN           "最大速度设置"
142
+#define ACCELERATION_CONF_CN          "加速度设置"
143
+#define JERKCONF_CN                   "突变速度设置"
144
+#define STEPSCONF_CN                  "脉冲设置"
145
+#define TMC_CURRENT_CN                "TMC 驱动电流设置"
146
+#define TMC_STEP_MODE_CN              "TMC 驱动模式设置"
147
+#define MOTORDIRCONF_CN               "电机方向设置"
148
+#define HOMEFEEDRATECONF_CN           "归零速度设置"
149
+
150
+#define MAXFEEDRATE_CONF_TITLE_CN     "机器参数>最大速度"
151
+#define X_MAXFEEDRATE_CN              "X轴最大速度"
152
+#define Y_MAXFEEDRATE_CN              "Y轴最大速度"
153
+#define Z_MAXFEEDRATE_CN              "Z轴最大速度"
154
+#define E0_MAXFEEDRATE_CN             "E0轴最大速度"
155
+#define E1_MAXFEEDRATE_CN             "E1轴最大速度"
156
+
157
+#define ACCELERATION_CONF_TITLE_CN    "机器参数>加速度"
158
+#define PRINT_ACCELERATION_CN         "打印加速度"
159
+#define RETRACT_ACCELERATION_CN       "回抽加速度"
160
+#define TRAVEL_ACCELERATION_CN        "空载加速度"
161
+#define X_ACCELERATION_CN             "X轴加速度"
162
+#define Y_ACCELERATION_CN             "Y轴加速度"
163
+#define Z_ACCELERATION_CN             "Z轴加速度"
164
+#define E0_ACCELERATION_CN            "E0轴加速度"
165
+#define E1_ACCELERATION_CN            "E1轴加速度"
166
+
167
+#define JERK_CONF_TITLE_CN            "机器参数>突变速度"
168
+#define X_JERK_CN                     "X轴突变速度"
169
+#define Y_JERK_CN                     "Y轴突变速度"
170
+#define Z_JERK_CN                     "Z轴突变速度"
171
+#define E_JERK_CN                     "E轴突变速度"
172
+
173
+#define STEPS_CONF_TITLE_CN           "机器参数>脉冲设置"
174
+#define X_STEPS_CN                    "X轴脉冲"
175
+#define Y_STEPS_CN                    "Y轴脉冲"
176
+#define Z_STEPS_CN                    "Z轴脉冲"
177
+#define E0_STEPS_CN                   "E0轴脉冲"
178
+#define E1_STEPS_CN                   "E1轴脉冲"
179
+
180
+#define TMC_CURRENT_CONF_TITLE_CN   "机器参数>TMC电流设置"
181
+#define X_TMC_CURRENT_CN            "X轴电流(毫安)"
182
+#define Y_TMC_CURRENT_CN            "Y轴电流(毫安)"
183
+#define Z_TMC_CURRENT_CN            "Z轴电流(毫安)"
184
+#define E0_TMC_CURRENT_CN           "E0轴电流(毫安)"
185
+#define E1_TMC_CURRENT_CN           "E1轴电流(毫安)"
186
+
187
+#define TMC_MODE_CONF_TITLE_CN  "机器参数>TMC模式设置"
188
+#define X_TMC_MODE_CN           "X轴是否使能静音模式"
189
+#define Y_TMC_MODE_CN           "Y轴是否使能静音模式"
190
+#define Z_TMC_MODE_CN           "Z轴是否使能静音模式"
191
+#define E0_TMC_MODE_CN          "E0轴是否使能静音模式"
192
+#define E1_TMC_MODE_CN          "E1轴是否使能静音模式"
193
+
194
+#define MOTORDIR_CONF_TITLE_CN          "机器参数>电机方向"
195
+#define X_MOTORDIR_CN                   "X轴电机方向"
196
+#define Y_MOTORDIR_CN                   "Y轴电机方向"
197
+#define Z_MOTORDIR_CN                   "Z轴电机方向"
198
+#define E0_MOTORDIR_CN                  "E0轴电机方向"
199
+#define E1_MOTORDIR_CN                  "E1轴电机方向"
200
+#define INVERT_P_CN                     "正向"
201
+#define INVERT_N_CN                     "反向"
202
+
203
+#define HOMEFEEDRATE_CONF_TITLE_CN      "机器参数>归零速度"
204
+#define X_HOMESPEED_CN                  "XY轴归零速度"
205
+#define Y_HOMESPEED_CN                  "Y轴归零速度"
206
+#define Z_HOMESPEED_CN                  "Z轴归零速度"
207
+
208
+#define ADVANCED_CONF_TITLE_CN          "机器参数>高级设置"
209
+#define PWROFF_DECTION_CN               "断电检测模块"
210
+#define PWROFF_AFTER_PRINT_CN           "启动打完关机功能"
211
+#define HAVE_UPS_CN                     "机器配备UPS电源"
212
+#define Z2_AND_Z2ENDSTOP_CONF_CN        "双Z轴双限位功能设置"
213
+#define ENABLE_PINS_CONF_CN             "电机使能脚电平设置"
214
+
215
+#define Z2_AND_Z2ENDSTOP_CONF_TITLE_CN  "双z双限位设置"
216
+#define Z2_ENABLE_CN                    "启用Z2轴"
217
+#define Z2_ENDSTOP_CN                   "启用Z2限位"
218
+#define Z2_PORT_CN                      "Z2限位接口"
219
+
220
+#define ENABLE_PINS_CONF_TITLE_CN       "电机使能脚电平"
221
+#define X_ENABLE_PINS_INVERT_CN         "X轴电机使能电平"
222
+#define Y_ENABLE_PINS_INVERT_CN         "Y轴电机使能电平"
223
+#define Z_ENABLE_PINS_INVERT_CN         "Z轴电机使能电平"
224
+#define E_ENABLE_PINS_INVERT_CN         "E轴电机使能电平"
225
+
226
+#define PAUSE_POSITION_CN    "打印暂停位置设置"
227
+#define PAUSE_POSITION_X_CN  "X轴暂停位置(绝对位置,-1无效)"
228
+#define PAUSE_POSITION_Y_CN  "Y轴暂停位置(绝对位置,-1无效)"
229
+#define PAUSE_POSITION_Z_CN  "Z轴暂停位置(相对位置,-1无效)"
25 230
 #define TOOL_TEXT_CN                "工具"
26 231
 #define PREHEAT_TEXT_CN             "预热"
27 232
 #define MOVE_TEXT_CN                "移动"
@@ -98,6 +303,8 @@
98 303
 #define MOTOR_OFF_TEXT_CN         "关闭电机"
99 304
 #define MOTOR_OFF_XY_TEXT_CN      "关闭XY"
100 305
 #define SHUTDOWN_TEXT_CN          "关机"
306
+#define MACHINE_PARA_CN           "机器参数"
307
+#define EEPROM_SETTINGS_CN        "Eeprom设置"
101 308
 
102 309
 #define U_DISK_TEXT_CN            "U盘"
103 310
 #define SD_CARD_TEXT_CN           "SD卡"
@@ -249,16 +456,24 @@
249 456
 #define PRINTING_OPERATION_GBK      "操作"
250 457
 #define PRINTING_PAUSE_GBK          "暂停"
251 458
 
252
-#define MESSEGE_PAUSING_CN          "暂停中..."
253
-#define MESSEGE_CHANGING_CN         "等待换料开始..."
254
-#define MESSEGE_UNLOAD_CN           "退料中,请稍等..."
255
-#define MESSEGE_WAITING_CN          "点击按钮恢复打印"
256
-#define MESSEGE_INSERT_CN           "装载耗材后,点击按钮开始打印"
257
-#define MESSEGE_LOAD_CN             "进料中,请稍等..."
258
-#define MESSEGE_PURGE_CN            "等待挤出..."
259
-#define MESSEGE_RESUME_CN           "等待恢复打印..."
260
-#define MESSEGE_HEAT_CN             "按下按钮,加热喷头"
261
-#define MESSEGE_HEATING_CN          "喷头加热中,请等待..."
262
-#define MESSEGE_OPTION_CN           "挤出更多还是继续打印?"
263
-#define MESSEGE_PURGE_MORE_CN       "挤出"
264
-#define MESSEGE_CONTINUE_PRINT_CN   "打印"
459
+#define MESSAGE_PAUSING_CN        "暂停中..."
460
+#define MESSAGE_CHANGING_CN       "等待换料开始..."
461
+#define MESSAGE_UNLOAD_CN         "退料中,请稍等..."
462
+#define MESSAGE_WAITING_CN        "点击按钮恢复打印"
463
+#define MESSAGE_INSERT_CN         "装载耗材后,点击按钮开始打印"
464
+#define MESSAGE_LOAD_CN           "进料中,请稍等..."
465
+#define MESSAGE_PURGE_CN          "等待挤出..."
466
+#define MESSAGE_RESUME_CN         "等待恢复打印..."
467
+#define MESSAGE_HEAT_CN           "按下按钮,加热喷头"
468
+#define MESSAGE_HEATING_CN        "喷头加热中,请等待..."
469
+#define MESSAGE_OPTION_CN         "挤出更多还是继续打印?"
470
+#define MESSAGE_PURGE_MORE_CN     "挤出"
471
+#define MESSAGE_CONTINUE_PRINT_CN "打印"
472
+#define EEPROM_SETTINGS_TITLE_CN  "EEPROM 设置"
473
+#define EEPROM_SETTINGS_STORE_CN  "保存参数至EEPROM"
474
+#define EEPROM_SETTINGS_READ_CN   "读取EEPROM参数"
475
+#define EEPROM_SETTINGS_REVERT_CN "恢复默认参数"
476
+
477
+#define EEPROM_STORE_TIPS_CN  "是否保存参数到EEPROM?"
478
+#define EEPROM_READ_TIPS_CN   "是否使用EEPROM参数?"
479
+#define EEPROM_REVERT_TIPS_CN "是否恢复默认参数?"

+ 29
- 19
Marlin/src/lcd/extui/lib/mks_ui/tft_Language_sp.h View File

@@ -98,6 +98,8 @@
98 98
 #define MOTOR_OFF_TEXT_SP       "Apagar motor"
99 99
 #define MOTOR_OFF_XY_TEXT_SP    "Off-XY"
100 100
 #define SHUTDOWN_TEXT_SP        "Apagar"
101
+#define MACHINE_PARA_SP         "Config"
102
+#define EEPROM_SETTINGS_SP      "Eeprom Set"
101 103
 
102 104
 #define U_DISK_TEXT_SP              "PENDRIVE"
103 105
 #define SD_CARD_TEXT_SP             "SD"
@@ -245,9 +247,9 @@
245 247
 #define DIALOG_PRINT_MODEL_SP       "¿Está seguro?"
246 248
 #define DIALOG_CANCEL_PRINT_SP      "¿Está seguro que desea detener la impresión?"
247 249
 
248
-#define DIALOG_RETRY_SP               "Reintentar"
249
-#define DIALOG_STOP_SP                "Stop"
250
-#define DIALOG_REPRINT_FROM_BREAKPOINT_SP   "Reprint from breakpoint?"
250
+#define DIALOG_RETRY_SP             "Reintentar"
251
+#define DIALOG_STOP_SP              "Stop"
252
+#define DIALOG_REPRINT_FROM_BREAKPOINT_SP "Reprint from breakpoint?"
251 253
 //#define DIALOG_UNBIND_PRINTER_SP    "Unbind the printer?"
252 254
 #define DIALOG_ERROR_TIPS1_SP         "Error:archivo no encontrado, \npor favor insertar SD o disco USB."
253 255
 #define DIALOG_ERROR_TIPS2_SP         "error:transacción fallida, \nconfigurar  baudrate del \ndisplay para la placa base!"
@@ -260,20 +262,28 @@
260 262
 #define DIALOG_REPRINT_SP             "Print again"
261 263
 #define DIALOG_WIFI_ENABLE_TIPS_SP    "The wifi module is being configured,\nplease wait a moment....."
262 264
 
263
-#define PRINTING_SP                 "Imprimiendo"
264
-#define PRINTING_AJUSTES_SP         "Ajustes"
265
-#define PRINTING_PAUSAR_SP          "Pausar"
265
+#define PRINTING_SP               "Imprimiendo"
266
+#define PRINTING_AJUSTES_SP       "Ajustes"
267
+#define PRINTING_PAUSAR_SP        "Pausar"
268
+
269
+#define MESSAGE_PAUSING_SP        "Aparcando..."
270
+#define MESSAGE_CHANGING_SP       "Esperando para iniciar el cambio de filamento"
271
+#define MESSAGE_UNLOAD_SP         "Espere para liberar el filamento"
272
+#define MESSAGE_WAITING_SP        "Pulsar el botón para reanudar impresión"
273
+#define MESSAGE_INSERT_SP         "Inserte el filamento y pulse el botón para continuar..."
274
+#define MESSAGE_LOAD_SP           "Espere para purgar el filamento"
275
+#define MESSAGE_PURGE_SP          "Espere para purgar el filamento"
276
+#define MESSAGE_RESUME_SP         "Esperando impresora para reanudar..."
277
+#define MESSAGE_HEAT_SP           "Pulse el botón para calentar la boquilla"
278
+#define MESSAGE_HEATING_SP        "Calentando boquilla Espere por favor..."
279
+#define MESSAGE_OPTION_SP         "¿Purgar más o continuar con la impresión?"
280
+#define MESSAGE_PURGE_MORE_SP     "Purga"
281
+#define MESSAGE_CONTINUE_PRINT_SP "Impresión"
282
+#define EEPROM_SETTINGS_TITLE_SP  "Configuraciones EEPROM"
283
+#define EEPROM_SETTINGS_STORE_SP  "Guardar configuración en EEPROM"
284
+#define EEPROM_SETTINGS_READ_SP   "Leer la configuración de EEPROM"
285
+#define EEPROM_SETTINGS_REVERT_SP "Revert settings to factory defaults"
266 286
 
267
-#define MESSEGE_PAUSING_SP          "Aparcando..."
268
-#define MESSEGE_CHANGING_SP         "Esperando para iniciar el cambio de filamento"
269
-#define MESSEGE_UNLOAD_SP           "Espere para liberar el filamento"
270
-#define MESSEGE_WAITING_SP          "Pulsar el botón para reanudar impresión"
271
-#define MESSEGE_INSERT_SP           "Inserte el filamento y pulse el botón para continuar..."
272
-#define MESSEGE_LOAD_SP             "Espere para purgar el filamento"
273
-#define MESSEGE_PURGE_SP            "Espere para purgar el filamento"
274
-#define MESSEGE_RESUME_SP           "Esperando impresora para reanudar..."
275
-#define MESSEGE_HEAT_SP             "Pulse el botón para calentar la boquilla"
276
-#define MESSEGE_HEATING_SP          "Calentando boquilla Espere por favor..."
277
-#define MESSEGE_OPTION_SP           "¿Purgar más o continuar con la impresión?"
278
-#define MESSEGE_PURGE_MORE_SP       "Purga"
279
-#define MESSEGE_CONTINUE_PRINT_SP   "Impresión"
287
+#define EEPROM_STORE_TIPS_SP  "¿Guardar ajustes en EEPROM?"
288
+#define EEPROM_READ_TIPS_SP   "Leer la configuración de EEPROM?"
289
+#define EEPROM_REVERT_TIPS_SP "Revert settings to factory defaults?"

+ 480
- 0
Marlin/src/lcd/extui/lib/mks_ui/tft_Language_t_cn.h View File

@@ -0,0 +1,480 @@
1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
+ *
5
+ * Based on Sprinter and grbl.
6
+ * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
7
+ *
8
+ * This program is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+#pragma once
23
+
24
+//***************繁体中文**********************//
25
+#define NEXT_T_CN                       "下一頁"
26
+#define PREVIOUS_T_CN                   "上一頁"
27
+#define DEFAULT_T_CN                    "默認值"
28
+#define KEY_BACK_T_CN                   "退格"
29
+#define KEY_REST_T_CN                   "重置"
30
+#define KEY_CONFIRM_T_CN                "確定"
31
+
32
+#define MACHINE_PARA_TITLE_T_CN         "機器參數"
33
+#define MACHINE_TYPE_CNOFIG_T_CN        "機器設置"
34
+#define TEMPERATURE_CONFIG_T_CN         "溫度設置"
35
+#define MOTOR_CONFIG_T_CN               "電機設置"
36
+#define ADVANCE_CONFIG_T_CN             "高級設置"
37
+
38
+#define MACHINE_CONFIG_TITLE_T_CN       "機器參數>機器配置"
39
+#define MACHINE_TYPE_T_CN               "機型選擇"
40
+#define MACHINE_STROKE_T_CN             "行程設置"
41
+#define MACHINE_HOMEDIR_T_CN            "歸零方向"
42
+#define MACHINE_ENDSTOP_TYPE_T_CN       "限位開關類型"
43
+#define MACHINE_FILAMENT_CONFIG_T_CN    "換料設置"
44
+#define MACHINE_LEVELING_CONFIG_T_CN    "調平設置"
45
+
46
+#define MACHINE_TYPE_CONFIG_TITLE_T_CN  "機器參數>機型選擇"
47
+#define MACHINE_TYPE_XYZ_T_CN           "XYZ機型"
48
+#define MACHINE_TYPE_DELTA_T_CN         "Delta機型"
49
+#define MACHINE_TYPE_COREXY_T_CN        "Corexy機型"
50
+
51
+#define MACHINE_STROKE_CONF_TITLE_T_CN  "機器參數>機器行程"
52
+#define X_MAX_LENGTH_T_CN               "X軸最大行程"
53
+#define Y_MAX_LENGTH_T_CN               "Y軸最大行程"
54
+#define Z_MAX_LENGTH_T_CN               "Z軸最大行程"
55
+
56
+#define X_MIN_LENGTH_T_CN               "X軸最小行程"
57
+#define Y_MIN_LENGTH_T_CN               "Y軸最小行程"
58
+#define Z_MIN_LENGTH_T_CN               "Z軸最小行程"
59
+
60
+#define HOME_DIR_CONF_TITLE_T_CN        "機器參數>歸零方向"
61
+#define HOME_DIR_X_T_CN                 "X軸歸零方向"
62
+#define HOME_DIR_Y_T_CN                 "Y軸歸零方向"
63
+#define HOME_DIR_Z_T_CN                 "Z軸歸零方向"
64
+#define HOME_MIN_T_CN                   "MIN"
65
+#define HOME_MAX_T_CN                   "MAX"
66
+
67
+#define ENDSTOP_CONF_TITLE_T_CN         "機器參數>限位開關"
68
+#define MIN_ENDSTOP_X_T_CN              "X軸最小限位"
69
+#define MIN_ENDSTOP_Y_T_CN              "Y軸最小限位"
70
+#define MIN_ENDSTOP_Z_T_CN              "Z軸最小限位"
71
+#define MAX_ENDSTOP_X_T_CN              "X軸最大限位"
72
+#define MAX_ENDSTOP_Y_T_CN              "Y軸最大限位"
73
+#define MAX_ENDSTOP_Z_T_CN              "Z軸最大限位"
74
+#define ENDSTOP_FIL_T_CN                "斷料開關類型"
75
+#define ENDSTOP_LEVEL_T_CN              "調平開關類型"
76
+#define ENDSTOP_OPENED_T_CN             "常開"
77
+#define ENDSTOP_CLOSED_T_CN             "常閉"
78
+
79
+#define FILAMENT_CONF_TITLE_T_CN        "換料設置"
80
+#define FILAMENT_IN_TEMPERATURE_T_CN    "進料溫度"
81
+#define FILAMENT_IN_LENGTH_T_CN         "進料長度"
82
+#define FILAMENT_IN_SPEED_T_CN          "進料速度"
83
+#define FILAMENT_OUT_TEMPERATURE_T_CN   "退料溫度"
84
+#define FILAMENT_OUT_LENGTH_T_CN        "退料長度"
85
+#define FILAMENT_OUT_SPEED_T_CN         "退料速度"
86
+
87
+#define LEVELING_CONF_TITLE_T_CN        "調平設置"
88
+#define LEVELING_PARA_CONF_T_CN         "調平設置"
89
+#define LEVELING_DELTA_T_CN             "delta機型設置"
90
+#define LEVELING_XYZ_T_CN               "手動調平坐標設置"
91
+
92
+#define LEVELING_PARA_CONF_TITLE_T_CN   "調平參數"
93
+#define AUTO_LEVELING_ENABLE_T_CN       "自動調平"
94
+#define BLTOUCH_LEVELING_ENABLE_T_CN    "啟動BLtouch"
95
+#define PROBE_PORT_T_CN                 "調平探針接口"
96
+#define PROBE_X_OFFSET_T_CN             "探針X方向偏移"
97
+#define PROBE_Y_OFFSET_T_CN             "探针Y方向偏移"
98
+#define PROBE_Z_OFFSET_T_CN             "探针Z方向偏移"
99
+#define PROBE_XY_SPEED_T_CN             "探针XY方向移動速度"
100
+#define PROBE_Z_SPEED_T_CN              "探针Z方向移動速度"
101
+#define ENABLE_T_CN                     "是"
102
+#define DISABLE_T_CN                    "否"
103
+#define Z_MIN_T_CN                      "ZMin"
104
+#define Z_MAX_T_CN                      "ZMax"
105
+
106
+#define DELTA_LEVEL_CONF_TITLE_T_CN     "Delta機器參數"
107
+#define DELTA_LEVEL_CONF_T_CN           "Delta機器調平"
108
+#define DELTA_MACHINE_RADIUS_T_CN       "機器半徑"
109
+#define DELTA_DIAGONAL_ROD_T_CN         "機器桿長"
110
+#define DELTA_PRINT_RADIUS_T_CN         "打印半徑"
111
+#define DELTA_HEIGHT_T_CN               "打印高度"
112
+#define SMOOTH_ROD_OFFSET_T_CN          "滑塊偏移"
113
+#define EFFECTOR_OFFSET_T_CN            "效應器偏移"
114
+#define CALIBRATION_RADIUS_T_CN         "調平半徑"
115
+
116
+#define XYZ_LEVEL_CONF_TITLE_T_CN       "XYZ機器參數"
117
+#define PROBE_REACH_MAX_LEFT_T_CN       "探针達到最左位置"
118
+#define PROBE_REACH_MAX_RIGHT_T_CN      "探针達到最右位置"
119
+#define PROBE_REACH_MAX_FRONT_T_CN      "探针達到最前位置"
120
+#define PROBE_REACH_MAX_BACK_T_CN       "探针達到最後位置"
121
+
122
+#define TEMPERATURE_CONF_TITLE_T_CN     "機器參數>溫度設置"
123
+#define NOZZLE_CONF_T_CN                "噴頭設置"
124
+#define HOTBED_CONF_T_CN                "熱床設置"
125
+#define PREHEAT_TEMPER_T_CN             "預設溫度"
126
+
127
+#define NOZZLE_CONF_TITLE_T_CN          "機器參數>噴頭設置"
128
+#define NOZZLECNT_T_CN                  "噴頭數量"
129
+#define NOZZLE_TYPE_T_CN                "E0溫感類型"
130
+#define NOZZLE_ADJUST_TYPE_T_CN         "PID調溫"
131
+#define NOZZLE_MIN_TEMPERATURE_T_CN     "最低溫度"
132
+#define NOZZLE_MAX_TEMPERATURE_T_CN     "最高溫度"
133
+#define EXTRUD_MIN_TEMPER_T_CN          "最低擠出溫度"
134
+
135
+#define HOTBED_CONF_TITLE_T_CN          "機器參數>熱床設置"
136
+#define HOTBED_ADJUST_T_CN              "PID調溫"
137
+#define HOTBED_MIN_TEMPERATURE_T_CN     "最低溫度"
138
+#define HOTBED_MAX_TEMPERATURE_T_CN     "最高溫度"
139
+
140
+#define MOTOR_CONF_TITLE_T_CN           "機器參數>電機設置"
141
+#define MAXFEEDRATE_CONF_T_CN           "最大速度設置"
142
+#define ACCELERATION_CONF_T_CN          "加速度設置"
143
+#define JERKCONF_T_CN                   "突變速度設置"
144
+#define STEPSCONF_T_CN                  "脈沖設置"
145
+#define TMC_CURRENT_T_CN                "TMC 驅動電流設置"
146
+#define TMC_STEP_MODE_T_CN              "TMC 驅動模式設置"
147
+#define MOTORDIRCONF_T_CN               "電機方向設置"
148
+#define HOMEFEEDRATECONF_T_CN           "歸零速度設置"
149
+
150
+#define MAXFEEDRATE_CONF_TITLE_T_CN     "機器參數>最大速度"
151
+#define X_MAXFEEDRATE_T_CN              "X軸最大速度"
152
+#define Y_MAXFEEDRATE_T_CN              "Y軸最大速度"
153
+#define Z_MAXFEEDRATE_T_CN              "Z軸最大速度"
154
+#define E0_MAXFEEDRATE_T_CN             "E0軸最大速度"
155
+#define E1_MAXFEEDRATE_T_CN             "E1軸最大速度"
156
+
157
+#define ACCELERATION_CONF_TITLE_T_CN    "機器參數>加速度"
158
+#define PRINT_ACCELERATION_T_CN         "打印加速度"
159
+#define RETRACT_ACCELERATION_T_CN       "回抽加速度"
160
+#define TRAVEL_ACCELERATION_T_CN        "空載加速度"
161
+#define X_ACCELERATION_T_CN             "X軸加速度"
162
+#define Y_ACCELERATION_T_CN             "Y軸加速度"
163
+#define Z_ACCELERATION_T_CN             "Z軸加速度"
164
+#define E0_ACCELERATION_T_CN            "E0軸加速度"
165
+#define E1_ACCELERATION_T_CN            "E1軸加速度"
166
+
167
+#define JERK_CONF_TITLE_T_CN            "機器參數>突變速度"
168
+#define X_JERK_T_CN                     "X軸突變速度"
169
+#define Y_JERK_T_CN                     "Y軸突變速度"
170
+#define Z_JERK_T_CN                     "Z軸突變速度"
171
+#define E_JERK_T_CN                     "E軸突變速度"
172
+
173
+#define STEPS_CONF_TITLE_T_CN           "機器參數>脈衝設置"
174
+#define X_STEPS_T_CN                    "X軸脈沖"
175
+#define Y_STEPS_T_CN                    "Y軸脈沖"
176
+#define Z_STEPS_T_CN                    "Z軸脈沖"
177
+#define E0_STEPS_T_CN                   "E0軸脈沖"
178
+#define E1_STEPS_T_CN                   "E1軸脈沖"
179
+
180
+#define TMC_CURRENT_CONF_TITLE_T_CN     "機器參數>TMC電流設置"
181
+#define X_TMC_CURRENT_T_CN              "X軸電流(毫安)"
182
+#define Y_TMC_CURRENT_T_CN              "Y軸電流(毫安)"
183
+#define Z_TMC_CURRENT_T_CN              "Z軸電流(毫安)"
184
+#define E0_TMC_CURRENT_T_CN             "E0軸電流(毫安)"
185
+#define E1_TMC_CURRENT_T_CN             "E1軸電流(毫安)"
186
+
187
+#define TMC_MODE_CONF_TITLE_T_CN        "機器參數>TMC模式設置"
188
+#define X_TMC_MODE_T_CN                 "X軸是否使能靜音模式"
189
+#define Y_TMC_MODE_T_CN                 "Y軸是否使能靜音模式"
190
+#define Z_TMC_MODE_T_CN                 "Z軸是否使能靜音模式"
191
+#define E0_TMC_MODE_T_CN                "E0軸是否使能靜音模式"
192
+#define E1_TMC_MODE_T_CN                "E1軸是否使能靜音模式"
193
+
194
+#define MOTORDIR_CONF_TITLE_T_CN        "機器參數>電機方向"
195
+#define X_MOTORDIR_T_CN                 "X軸電機方向"
196
+#define Y_MOTORDIR_T_CN                 "Y軸電機方向"
197
+#define Z_MOTORDIR_T_CN                 "Z軸電機方向"
198
+#define E0_MOTORDIR_T_CN                "E0軸電機方向"
199
+#define E1_MOTORDIR_T_CN                "E1軸電機方向"
200
+#define INVERT_P_T_CN                   "正向"
201
+#define INVERT_N_T_CN                   "反向"
202
+
203
+#define HOMEFEEDRATE_CONF_TITLE_T_CN    "機器參數>歸零速度"
204
+#define X_HOMESPEED_T_CN                "XY軸歸零速度"
205
+#define Y_HOMESPEED_T_CN                "Y軸歸零速度"
206
+#define Z_HOMESPEED_T_CN                "Z軸歸零速度"
207
+
208
+#define ADVANCED_CONF_TITLE_T_CN        "機器參數>高級設置"
209
+#define PWROFF_DECTION_T_CN             "斷電檢測模塊"
210
+#define PWROFF_AFTER_PRINT_T_CN         "啟動打完關機功能"
211
+#define HAVE_UPS_T_CN                   "機器配備UPS電壓"
212
+#define Z2_AND_Z2ENDSTOP_CONF_T_CN      "雙z軸雙限位功能設置"
213
+#define ENABLE_PINS_CONF_T_CN           "電機使能腳電平設置"
214
+
215
+#define Z2_AND_Z2ENDSTOP_CONF_TITLE_T_CN  "雙z軸雙限位設置"
216
+#define Z2_ENABLE_T_CN                    "啟用Z2軸"
217
+#define Z2_ENDSTOP_T_CN                   "啟用Z2限位"
218
+#define Z2_PORT_T_CN                      "Z2限位接口"
219
+
220
+#define ENABLE_PINS_CONF_TITLE_T_CN     "電機使能腳電平"
221
+#define X_ENABLE_PINS_INVERT_T_CN       "X軸電機使能電平"
222
+#define Y_ENABLE_PINS_INVERT_T_CN       "Y軸電機使能電平"
223
+#define Z_ENABLE_PINS_INVERT_T_CN       "Z軸電機使能電平"
224
+#define E_ENABLE_PINS_INVERT_T_CN       "E軸電機使能電平"
225
+
226
+#define PAUSE_POSITION_T_CN             "打印暫停位置設置"
227
+#define PAUSE_POSITION_X_T_CN           "X軸暫停位置(絕對位置,-1無效)"
228
+#define PAUSE_POSITION_Y_T_CN           "Y軸暫停位置(絕對位置,-1無效)"
229
+#define PAUSE_POSITION_Z_T_CN           "Z軸暫停位置(相對位置,-1無效)"
230
+
231
+#define TOOL_TEXT_T_CN                  "工具"
232
+#define PREHEAT_TEXT_T_CN               "預熱"
233
+#define  MOVE_TEXT_T_CN                 "移動"
234
+#define HOME_TEXT_T_CN                  "回零"
235
+#define PRINT_TEXT_T_CN                 "打印"
236
+#define EXTRUDE_TEXT_T_CN               "擠出"
237
+#define LEVELING_TEXT_T_CN              "調平"
238
+#define AUTO_LEVELING_TEXT_T_CN         "自動調平"
239
+#define SET_TEXT_T_CN                   "設置"
240
+#define MORE_TEXT_T_CN                  "更多"
241
+
242
+#define ADD_TEXT_T_CN                   "增加"
243
+#define DEC_TEXT_T_CN                   "減少"
244
+#define EXTRUDER_1_TEXT_T_CN            "噴頭1"
245
+#define EXTRUDER_2_TEXT_T_CN            "噴頭2"
246
+#define HEATBED_TEXT_T_CN               "熱床"
247
+#define TEXT_1C_T_CN                    "1℃"
248
+#define TEXT_5C_T_CN                    "5℃"
249
+#define TEXT_10C_T_CN                   "10℃"
250
+#define CLOSE_TEXT_T_CN                 "關閉"
251
+
252
+#define BACK_TEXT_T_CN                  "返回"
253
+
254
+#define TOOL_PREHEAT_T_CN               "預熱"
255
+#define TOOL_EXTRUDE_T_CN               "擠出"
256
+#define TOOL_MOVE_T_CN                  "移動"
257
+#define TOOL_HOME_T_CN                  "回零"
258
+#define TOOL_LEVELING_T_CN              "調平"
259
+#define TOOL_AUTO_LEVELING_T_CN         "自動調平"
260
+#define TOOL_FILAMENT_T_CN              "換料"
261
+#define TOOL_MORE_T_CN                  "更多"
262
+
263
+#define AXIS_X_ADD_TEXT_T_CN            "X+"
264
+#define AXIS_X_DEC_TEXT_T_CN            "X-"
265
+#define AXIS_Y_ADD_TEXT_T_CN            "Y+"
266
+#define AXIS_Y_DEC_TEXT_T_CN            "Y-"
267
+#define AXIS_Z_ADD_TEXT_T_CN            "Z+"
268
+#define AXIS_Z_DEC_TEXT_T_CN            "Z-"
269
+#define TEXT_01MM_T_CN                  "0.1mm"
270
+#define TEXT_1MM_T_CN                   "1mm"
271
+#define TEXT_10MM_T_CN                  "10mm"
272
+
273
+#define HOME_X_TEXT_T_CN                "X"
274
+#define HOME_Y_TEXT_T_CN                "Y"
275
+#define HOME_Z_TEXT_T_CN                "Z"
276
+#define HOME_ALL_TEXT_T_CN              "回零"
277
+#define HOME_STOPMOVE_T_CN              "急停"
278
+
279
+#define PAGE_UP_TEXT_T_CN               "上一頁"
280
+#define PAGE_DOWN_TEXT_T_CN             "下一頁"
281
+
282
+#define EXTRUDER_IN_TEXT_T_CN           "進料"
283
+#define EXTRUDER_OUT_TEXT_T_CN          "退料"
284
+#define EXTRUDE_1MM_TEXT_T_CN           "1mm"
285
+#define EXTRUDE_5MM_TEXT_T_CN           "5mm"
286
+#define EXTRUDE_10MM_TEXT_T_CN          "10mm"
287
+#define EXTRUDE_LOW_SPEED_TEXT_T_CN     "低速"
288
+#define EXTRUDE_MEDIUM_SPEED_TEXT_T_CN  "常速"
289
+#define EXTRUDE_HIGH_SPEED_TEXT_T_CN    "高速"
290
+
291
+#define LEVELING_POINT1_TEXT_T_CN       "第一點"
292
+#define LEVELING_POINT2_TEXT_T_CN       "第二點"
293
+#define LEVELING_POINT3_TEXT_T_CN       "第三點"
294
+#define LEVELING_POINT4_TEXT_T_CN       "第四點"
295
+#define LEVELING_POINT5_TEXT_T_CN       "第五點"
296
+
297
+#define FILESYS_TEXT_T_CN               "文件系統"
298
+#define WIFI_TEXT_T_CN                  "WIFI"
299
+#define FAN_TEXT_T_CN                   "風扇"
300
+#define ABOUT_TEXT_T_CN                 "關於"
301
+#define BREAK_POINT_TEXT_T_CN           "斷點續打"
302
+#define FILAMENT_TEXT_T_CN              "換料"
303
+#define LANGUAGE_TEXT_T_CN              "語言"
304
+#define MOTOR_OFF_TEXT_T_CN             "關閉電機"
305
+#define MOTOR_OFF_XY_TEXT_T_CN          "關閉XY"
306
+#define SHUTDOWN_TEXT_T_CN              "關機"
307
+#define MACHINE_PARA_T_CN               "機器參數"
308
+#define EEPROM_SETTINGS_T_CN            "Eeprom設置"
309
+
310
+#define U_DISK_TEXT_T_CN                "U盤"
311
+#define SD_CARD_TEXT_T_CN               "SD卡"
312
+#define WIFI_NAME_TEXT_T_CN             "無線網絡:"
313
+#define WIFI_KEY_TEXT_T_CN              "密碼: "
314
+#define WIFI_IP_TEXT_T_CN               "IP: "
315
+#define WIFI_AP_TEXT_T_CN               "狀態: AP"
316
+#define WIFI_STA_TEXT_T_CN              "狀態: STA"
317
+#define WIFI_CONNECTED_TEXT_T_CN        "已連接"
318
+#define WIFI_DISCONNECTED_TEXT_T_CN     "未連接"
319
+#define WIFI_EXCEPTION_TEXT_T_CN        "模塊異常"
320
+#define CLOUD_TEXT_T_CN                 "雲服務"
321
+#define CLOUD_BIND_T_CN                 "已綁定"
322
+#define CLOUD_UNBIND_T_CN               "解綁"
323
+#define CLOUD_UNBINDING_T_CN            "解绑中"
324
+#define CLOUD_DISCONNECTED_T_CN         "未連接"
325
+#define CLOUD_UNBINDED_T_CN             "未綁定"
326
+#define CLOUD_BINDED_T_CN               "已綁定"
327
+#define CLOUD_DISABLE_T_CN              "已禁用"
328
+
329
+#define FAN_ADD_TEXT_T_CN               "增加"
330
+#define FAN_DEC_TEXT_T_CN               "減少"
331
+#define FAN_OPEN_TEXT_T_CN              "100%"
332
+#define FAN_HALF_TEXT_T_CN              "50%"
333
+#define FAN_CLOSE_TEXT_T_CN             "關閉"
334
+#define FAN_TIPS1_TEXT_T_CN             "風扇"
335
+#define FAN_TIPS2_TEXT_T_CN             "FAN\nClose"
336
+
337
+#define FILAMENT_IN_TEXT_T_CN           "進料"
338
+#define FILAMENT_OUT_TEXT_T_CN          "退料"
339
+#define FILAMENT_EXT0_TEXT_T_CN         "噴頭1"
340
+#define FILAMENT_EXT1_TEXT_T_CN         "噴頭2"
341
+#define FILAMENT_HEAT_TEXT_T_CN         "預熱"
342
+#define FILAMENT_STOP_TEXT_T_CN         "停止"
343
+//#define FILAMENT_CHANGE_TEXT_T_CN     "準備換料"
344
+#define FILAMENT_TIPS2_TEXT_T_CN        "T:"
345
+#define FILAMENT_TIPS3_TEXT_T_CN        "正在進料"
346
+#define FILAMENT_TIPS4_TEXT_T_CN        "正在退料"
347
+#define FILAMENT_TIPS5_TEXT_T_CN        "溫度太低,請先預熱"
348
+#define FILAMENT_TIPS6_TEXT_T_CN        "換料完成"
349
+
350
+#if 0
351
+  #define FILAMENT_REPLAYS_IDLE_TEXT_T_CN "請按<進料>或<退料>進行換料!"
352
+  #define FILAMENT_CHANGE_TEXT_T_CN       "待打印機暫停后,請按<進料>或<退料>進行換料!"
353
+#endif
354
+
355
+  #define FILAMENT_CHANGE_TEXT_T_CN       "待打印機暫停后,\n請按<進料>或<退料>"
356
+
357
+#define FILAMENT_DIALOG_LOAD_HEAT_TIPS_T_CN       "準備進料,正在加熱,請稍等"
358
+#define FILAMENT_DIALOG_UNLOAD_HEAT_TIPS_T_CN     "準備退料,正在加熱,請稍等"
359
+#define FILAMENT_DIALOG_LOAD_CONFIRM1_TIPS_T_CN   "加熱完成,請裝載耗材后,按<確定>開始進料"
360
+#define FILAMENT_DIALOG_LOAD_CONFIRM2_TIPS_T_CN   "請裝載耗,按<確定>開始進料!"
361
+#define FILAMENT_DIALOG_UNLOAD_CONFIRM_TIPS_T_CN  "加熱完成,请按<確定>開始退料!"
362
+#define FILAMENT_DIALOG_LOADING_TIPS_T_CN         "正在進料,请等待耗材加載完成!"
363
+#define FILAMENT_DIALOG_UNLOADING_TIPS_T_CN       "正在退料,请等待耗材卸載完成!"
364
+#define FILAMENT_DIALOG_LOAD_COMPLETE_TIPS_T_CN   "進料完成,请按<確定>返回"
365
+#define FILAMENT_DIALOG_UNLOAD_COMPLETE_TIPS_T_CN "退料完成,请按<確定>返回"
366
+
367
+#define PRE_HEAT_EXT_TEXT_T_CN        "噴頭"
368
+#define PRE_HEAT_BED_TEXT_T_CN        "熱床"
369
+
370
+#define FILE_LOADING_T_CN             "正在載入......"
371
+#define NO_FILE_AND_CHECK_T_CN        "無文件!請插入sd卡/u盤!"
372
+#define NO_FILE_T_CN                  "無文件!"
373
+
374
+#define EXTRUDER_TEMP_TEXT_T_CN       "溫度"
375
+#define EXTRUDER_E_LENGTH1_TEXT_T_CN  "噴頭"
376
+#define EXTRUDER_E_LENGTH2_TEXT_T_CN  "噴頭"
377
+#define EXTRUDER_E_LENGTH3_TEXT_T_CN  "噴頭"
378
+
379
+#define ABOUT_TYPE_TEXT_T_CN          "Type: "
380
+#define ABOUT_VERSION_TEXT_T_CN       "Firmware: "
381
+#define ABOUT_WIFI_TEXT_T_CN          "Wifi: "
382
+
383
+#define PRINTING_OPERATION_T_CN       "操作"
384
+#define PRINTING_PAUSE_T_CN           "暫停"
385
+#define PRINTING_TEMP_T_CN            "溫度"
386
+#define PRINTING_CHANGESPEED_T_CN     "變速"
387
+#define PRINTING_RESUME_T_CN          "恢復"
388
+#define PRINTING_STOP_T_CN            "停止"
389
+#define PRINTING_MORE_T_CN            "更多"
390
+#define PRINTING_EXTRUDER_T_CN        "擠出"
391
+#define PRINTING_MOVE_T_CN            "移動"
392
+
393
+#define EXTRUDER_SPEED_T_CN           "擠出"
394
+#define MOVE_SPEED_T_CN               "移動"
395
+#define EXTRUDER_SPEED_STATE_T_CN     "擠出速度"
396
+#define MOVE_SPEED_STATE_T_CN         "移動速度"
397
+#define STEP_1PERCENT_T_CN            "1%%"
398
+#define STEP_5PERCENT_T_CN            "5%%"
399
+#define STEP_10PERCENT_T_CN           "10%%"
400
+
401
+#define ZOFFSET_T_CN                  "Z Offset"
402
+#define ZOFFSET_INC_T_CN              "增加"
403
+#define ZOFFSET_DEC_T_CN              "減少"
404
+
405
+#define TITLE_READYPRINT_T_CN         "準備打印"
406
+#define TITLE_PREHEAT_T_CN            "預熱"
407
+#define TITLE_MOVE_T_CN               "移動"
408
+#define TITLE_HOME_T_CN               "回零"
409
+#define TITLE_EXTRUDE_T_CN            "擠出"
410
+#define TITLE_LEVELING_T_CN           "調平"
411
+#define TITLE_SET_T_CN                "設置"
412
+#define TITLE_MORE_T_CN               "更多"
413
+#define TITLE_CHOOSEFILE_T_CN         "選擇文件"
414
+#define TITLE_PRINTING_T_CN           "正在打印"
415
+#define TITLE_OPERATION_T_CN          "操作"
416
+#define TITLE_ADJUST_T_CN             "調整"
417
+#define  TITLE_WIRELESS_T_CN          "無線網絡"
418
+#define  TITLE_FILAMENT_T_CN          "換料"
419
+#define TITLE_ABOUT_T_CN              "關於"
420
+#define TITLE_FAN_T_CN                "風扇"
421
+#define TITLE_LANGUAGE_T_CN           "語言"
422
+#define TITLE_PAUSE_T_CN              "暫停"
423
+#define TITLE_CHANGESPEED_T_CN        "變速"
424
+#define TITLE_CLOUD_TEXT_T_CN         "雲服務"
425
+#define TITLE_DIALOG_CONFIRM_T_CN     "確認"
426
+#define TITLE_FILESYS_T_CN            "文件系統"
427
+#define TITLE_ZOFFSET_T_CN            "Z Offset"
428
+
429
+#define AUTO_SHUTDOWN_T_CN            "自動關機"
430
+#define MANUAL_SHUTDOWN_T_CN          "手動關機"
431
+
432
+#define DIALOG_CONFIRM_T_CN           "確定"
433
+#define DIALOG_CANCLE_T_CN            "取消"
434
+#define DIALOG_OK_T_CN                "確認"
435
+#define DIALOG_RESET_T_CN             "重設"
436
+#define DIALOG_RETRY_T_CN             "重試"
437
+#define DIALOG_DISABLE_T_CN           "禁用"
438
+#define DIALOG_PRINT_MODEL_T_CN       "打印模型?"
439
+#define DIALOG_CANCEL_PRINT_T_CN      "停止打印?"
440
+#define DIALOG_RETRY_T_CN             "重試"
441
+#define DIALOG_STOP_T_CN              "停止"
442
+#define DIALOG_REPRINT_FROM_BREAKPOINT_T_CN "從斷點續打?"
443
+//#define DIALOG_UNBIND_PRINTER_T_CN    "解除綁定?"
444
+#define DIALOG_ERROR_TIPS1_T_CN       "錯誤:找不到文件,請插入sd卡/u盤!"
445
+#define DIALOG_ERROR_TIPS2_T_CN       "錯誤:通信失敗,請檢查波特率或主板硬件!"
446
+#define DIALOG_ERROR_TIPS3_T_CN       "錯誤:文件名或文件路徑太長!"
447
+#define DIALOG_CLOSE_MACHINE_T_CN     "正在關機......"
448
+#define DIALOG_UNBIND_PRINTER_T_CN    "解除綁定?"
449
+#define DIALOG_FILAMENT_NO_PRESS_T_CN "請先裝載耗材!"
450
+#define DIALOG_PRINT_FINISH_T_CN      "打印完成!"
451
+#define DIALOG_PRINT_TIME_T_CN        "打印時間: "
452
+#define DIALOG_REPRINT_T_CN           "再打印壹次"
453
+#define DIALOG_WIFI_ENABLE_TIPS_T_CN  "wifi模塊正在配置中,請稍等......"
454
+
455
+#define TEXT_VALUE_T_CN               "%d℃/%d℃"
456
+#define EXTRUDE_TEXT_VALUE_T_T_CN     ": %d℃"
457
+#define WIFI_RECONNECT_TEXT_T_CN      "重新連接"
458
+
459
+#define MESSAGE_PAUSING_T_CN          "暫停中..."
460
+#define MESSAGE_CHANGING_T_CN         "等待換料開始..."
461
+#define MESSAGE_UNLOAD_T_CN           "退料中,請稍等..."
462
+#define MESSAGE_WAITING_T_CN          "點擊按鈕恢復打印"
463
+#define MESSAGE_INSERT_T_CN           "裝載耗材後,點擊按鈕開始打印"
464
+#define MESSAGE_LOAD_T_CN             "進料中,請稍等..."
465
+#define MESSAGE_PURGE_T_CN            "等待擠出..."
466
+#define MESSAGE_RESUME_T_CN           "等待恢復打印..."
467
+#define MESSAGE_HEAT_T_CN             "按下按鈕,加熱噴頭"
468
+#define MESSAGE_HEATING_T_CN          "噴頭加熱中,請等待..."
469
+#define MESSAGE_OPTION_T_CN           "擠出更多還是繼續打印"
470
+#define MESSAGE_PURGE_MORE_T_CN       "擠出"
471
+#define MESSAGE_CONTINUE_PRINT_T_CN   "打印"
472
+
473
+#define EEPROM_SETTINGS_TITLE_T_CN    "EEPROM 設置"
474
+#define EEPROM_SETTINGS_STORE_T_CN    "保存參數至EEPROM"
475
+#define EEPROM_SETTINGS_READ_T_CN     "讀取EEPROM參數"
476
+#define EEPROM_SETTINGS_REVERT_T_CN   "恢復默認參數"
477
+
478
+#define EEPROM_STORE_TIPS_T_CN        "是否保存參數到EEPROM?"
479
+#define EEPROM_READ_TIPS_T_CN         "是否使用EEPROM參數?"
480
+#define EEPROM_REVERT_TIPS_T_CN       "是否恢復默認參數?"

+ 2
- 2
Marlin/src/lcd/extui/lib/mks_ui/tft_fsmc.cpp View File

@@ -22,7 +22,7 @@
22 22
 
23 23
 #include "../../../../inc/MarlinConfig.h"
24 24
 
25
-#if ENABLED(TFT_LVGL_UI)
25
+#if HAS_TFT_LVGL_UI
26 26
 
27 27
   #if defined(ARDUINO_ARCH_STM32F1) && PIN_EXISTS(FSMC_CS) // FSMC on 100/144 pins SoCs
28 28
 
@@ -270,4 +270,4 @@
270 270
 
271 271
     #endif // LCD_USE_DMA_FSMC
272 272
   #endif // ARDUINO_ARCH_STM32F1 && FSMC_CS_PIN
273
-#endif // TFT_LVGL_UI
273
+#endif // HAS_TFT_LVGL_UI

+ 85
- 101
Marlin/src/lcd/extui/lib/mks_ui/tft_lvgl_configuration.cpp View File

@@ -21,25 +21,28 @@
21 21
  */
22 22
 
23 23
 /**
24
- * @file lcd_lvgl_configuration.c
24
+ * @file tft_lvgl_configuration.cpp
25 25
  * @date    2020-02-21
26 26
  */
27 27
 
28 28
 #include "../../../../inc/MarlinConfigPre.h"
29 29
 
30
-#if ENABLED(TFT_LVGL_UI)
30
+#if HAS_TFT_LVGL_UI
31 31
 
32
-#include "../../../../MarlinCore.h"
32
+#if ENABLED(TFT_LVGL_UI_SPI)
33
+  #include "SPI_TFT.h"
34
+#endif
33 35
 
34 36
 #include "tft_lvgl_configuration.h"
35
-#include "lvgl.h"
36
-#include "../../../../feature/touch/xpt2046.h"
37 37
 #include "draw_ready_print.h"
38 38
 #include "W25Qxx.h"
39 39
 #include "pic_manager.h"
40
-
41 40
 #include "mks_hardware_test.h"
42 41
 #include "draw_ui.h"
42
+#include <lvgl.h>
43
+
44
+#include "../../../../MarlinCore.h"
45
+#include "../../../../feature/touch/xpt2046.h"
43 46
 
44 47
 #if ENABLED(POWER_LOSS_RECOVERY)
45 48
   #include "../../../../feature/powerloss.h"
@@ -47,26 +50,13 @@
47 50
 
48 51
 #include <SPI.h>
49 52
 
50
-#if ENABLED(SPI_GRAPHICAL_TFT)
51
-  #include "SPI_TFT.h"
52
-#endif
53
-
54
-extern void LCD_IO_Init(uint8_t cs, uint8_t rs);
55
-extern void LCD_IO_WriteData(uint16_t RegValue);
56
-extern void LCD_IO_WriteReg(uint16_t Reg);
57
-extern void LCD_IO_WriteSequence(uint16_t *data, uint16_t length);
58
-extern void LCD_IO_WriteMultiple(uint16_t color, uint32_t count);
59
-
60 53
 #if HAS_SPI_FLASH_FONT
61 54
   extern void init_gb2312_font();
62 55
 #endif
63 56
 
64 57
 static lv_disp_buf_t disp_buf;
65 58
 #if ENABLED(SDSUPPORT)
66
-  extern void UpdatePic();
67
-  #if HAS_SPI_FLASH_FONT
68
-    extern void UpdateFont();
69
-  #endif
59
+  extern void UpdateAssets();
70 60
 #endif
71 61
 uint16_t DeviceCode = 0x9488;
72 62
 extern uint8_t sel_id;
@@ -96,6 +86,13 @@ void SysTick_Callback() {
96 86
   print_time_count();
97 87
 }
98 88
 
89
+#if DISABLED(TFT_LVGL_UI_SPI)
90
+
91
+extern void LCD_IO_Init(uint8_t cs, uint8_t rs);
92
+extern void LCD_IO_WriteData(uint16_t RegValue);
93
+extern void LCD_IO_WriteReg(uint16_t Reg);
94
+
95
+extern void LCD_IO_WriteMultiple(uint16_t color, uint32_t count);
99 96
 void tft_set_cursor(uint16_t x, uint16_t y) {
100 97
   LCD_IO_WriteReg(0x002A);
101 98
   LCD_IO_WriteData(x >> 8);
@@ -133,9 +130,9 @@ void tft_set_point(uint16_t x, uint16_t y, uint16_t point) {
133 130
   if ((x > 480) || (y > 320)) return;
134 131
   //}
135 132
   //**if ( (x>320)||(y>240) ) return;
136
-  tft_set_cursor(x, y); /*设置光标位置*/
133
+  tft_set_cursor(x, y);
137 134
 
138
-  LCD_WriteRAM_Prepare();   /* 开始写入GRAM*/
135
+  LCD_WriteRAM_Prepare();
139 136
   //LCD_WriteRAM(point);
140 137
   LCD_IO_WriteData(point);
141 138
 }
@@ -143,7 +140,7 @@ void tft_set_point(uint16_t x, uint16_t y, uint16_t point) {
143 140
 void LCD_WriteReg(uint16_t LCD_Reg, uint16_t LCD_RegValue) {
144 141
   /* Write 16-bit Index, then Write Reg */
145 142
   ClrCs
146
-    LCD_IO_WriteReg(LCD_Reg);
143
+  LCD_IO_WriteReg(LCD_Reg);
147 144
   /* Write 16-bit Reg */
148 145
   LCD_IO_WriteData(LCD_RegValue);
149 146
   SetCs
@@ -265,7 +262,6 @@ void LCD_Clear(uint16_t Color) {
265 262
 
266 263
 extern uint16_t ILI9488_ReadRAM();
267 264
 
268
-#if DISABLED(SPI_GRAPHICAL_TFT)
269 265
 
270 266
 void init_tft() {
271 267
   uint16_t i;
@@ -356,12 +352,10 @@ void init_tft() {
356 352
 
357 353
     LCD_IO_WriteReg(0x0036);
358 354
     //ILI9488_WriteData(0x0068);
359
-    //if (gCfgItems.overturn_180 != 0xEE)
360
-    //{
355
+    //if (gCfgItems.overturn_180 != 0xEE) {
361 356
     LCD_IO_WriteData(0x0068);
362 357
     //}
363
-    //else
364
-    //{
358
+    //else {
365 359
     //ILI9488_WriteData(0x00A8);
366 360
     //}
367 361
 
@@ -406,16 +400,22 @@ void init_tft() {
406 400
   }
407 401
 }
408 402
 
409
-#endif // if DISABLED(SPI_GRAPHICAL_TFT)
403
+#endif // !TFT_LVGL_UI_SPI
410 404
 
411 405
 extern uint8_t bmp_public_buf[17 * 1024];
406
+
412 407
 void tft_lvgl_init() {
408
+
413 409
   //uint16_t test_id=0;
414 410
   W25QXX.init(SPI_QUARTER_SPEED);
415 411
   //test_id=W25QXX.W25QXX_ReadID();
416 412
 
413
+  gCfgItems_init();
414
+  ui_cfg_init();
415
+  disp_language_init();
416
+
417 417
   //init tft first!
418
-  #if ENABLED(SPI_GRAPHICAL_TFT)
418
+  #if ENABLED(TFT_LVGL_UI_SPI)
419 419
     SPI_TFT.spi_init(SPI_FULL_SPEED);
420 420
     SPI_TFT.LCD_init();
421 421
   #else
@@ -423,20 +423,13 @@ void tft_lvgl_init() {
423 423
   #endif
424 424
 
425 425
   #if ENABLED(SDSUPPORT)
426
-    UpdatePic();
427
-    #if HAS_SPI_FLASH_FONT
428
-      UpdateFont();
429
-    #endif
426
+    UpdateAssets();
430 427
   #endif
428
+  mks_test_get();
431 429
 
432
-  gCfgItems_init();
433
-  ui_cfg_init();
434
-  disp_language_init();
435 430
   //spi_flash_read_test();
436 431
 
437
-  #if ENABLED(TOUCH_BUTTONS)
438
-    touch.init();
439
-  #endif
432
+  TERN_(TOUCH_BUTTONS, touch.init());
440 433
 
441 434
   lv_init();
442 435
 
@@ -465,33 +458,32 @@ void tft_lvgl_init() {
465 458
   filament_pin_setup();
466 459
 
467 460
   #if ENABLED(POWER_LOSS_RECOVERY)
468
-  if (recovery.valid()) {
469
-    if (gCfgItems.from_flash_pic == 1)
470
-      flash_preview_begin = 1;
471
-    else
472
-      default_preview_flg = 1;
461
+    if (recovery.valid()) {
462
+      if (gCfgItems.from_flash_pic == 1)
463
+        flash_preview_begin = 1;
464
+      else
465
+        default_preview_flg = 1;
473 466
 
474
-    uiCfg.print_state = REPRINTING;
467
+      uiCfg.print_state = REPRINTING;
475 468
 
476
-    memset(public_buf_m, 0, sizeof(public_buf_m));
477
-    strncpy(public_buf_m, recovery.info.sd_filename, sizeof(public_buf_m));
478
-    card.printLongPath(public_buf_m);
469
+      ZERO(public_buf_m);
470
+      strncpy(public_buf_m, recovery.info.sd_filename, sizeof(public_buf_m));
471
+      card.printLongPath(public_buf_m);
479 472
 
480
-    strncpy(list_file.long_name[sel_id], card.longFilename, sizeof(list_file.long_name[sel_id]));
473
+      strncpy(list_file.long_name[sel_id], card.longFilename, sizeof(list_file.long_name[sel_id]));
481 474
 
482
-    lv_draw_printing();
483
-  }
484
-  else
475
+      lv_draw_printing();
476
+    }
477
+    else
485 478
   #endif
486
-  lv_draw_ready_print();
479
+    lv_draw_ready_print();
487 480
 
488
-  #if ENABLED(MKS_TEST)
489
-    Test_GPIO();
490
-  #endif
481
+  if (mks_test_flag == 0x1E)
482
+    mks_gpio_test();
491 483
 }
492 484
 
493 485
 void my_disp_flush(lv_disp_drv_t * disp, const lv_area_t * area, lv_color_t * color_p) {
494
-  #if ENABLED(SPI_GRAPHICAL_TFT)
486
+  #if ENABLED(TFT_LVGL_UI_SPI)
495 487
     uint16_t i, width, height;
496 488
     uint16_t clr_temp;
497 489
     uint8_t tbuf[480 * 2];
@@ -525,7 +517,9 @@ void my_disp_flush(lv_disp_drv_t * disp, const lv_area_t * area, lv_color_t * co
525 517
     lv_disp_flush_ready(disp);       /* Indicate you are ready with the flushing*/
526 518
 
527 519
     W25QXX.init(SPI_QUARTER_SPEED);
528
-  #else
520
+
521
+  #else // !TFT_LVGL_UI_SPI
522
+
529 523
     #if 1
530 524
       uint16_t i, width, height;
531 525
       uint16_t clr_temp;
@@ -543,7 +537,8 @@ void my_disp_flush(lv_disp_drv_t * disp, const lv_area_t * area, lv_color_t * co
543 537
 
544 538
       lv_disp_flush_ready(disp);       /* Indicate you are ready with the flushing*/
545 539
     #endif
546
-  #endif // SPI_GRAPHICAL_TFT
540
+
541
+  #endif // !TFT_LVGL_UI_SPI
547 542
 }
548 543
 
549 544
 #define TICK_CYCLE 1
@@ -554,7 +549,7 @@ unsigned int getTickDiff(unsigned int curTick, unsigned int lastTick) {
554 549
   return TICK_CYCLE * (lastTick <= curTick ? (curTick - lastTick) : (0xFFFFFFFF - lastTick + curTick));
555 550
 }
556 551
 
557
-#if ENABLED(SPI_GRAPHICAL_TFT)
552
+#if ENABLED(TFT_LVGL_UI_SPI)
558 553
 
559 554
   #ifndef USE_XPT2046
560 555
     #define USE_XPT2046       1
@@ -564,12 +559,12 @@ unsigned int getTickDiff(unsigned int curTick, unsigned int lastTick) {
564 559
   #endif
565 560
 
566 561
   #if USE_XPT2046
567
-    #define XPT2046_HOR_RES   480
568
-    #define XPT2046_VER_RES   320
569
-    #define XPT2046_X_MIN     201
570
-    #define XPT2046_Y_MIN     164
571
-    #define XPT2046_X_MAX     3919
572
-    #define XPT2046_Y_MAX     3776
562
+    #define XPT2046_HOR_RES 480
563
+    #define XPT2046_VER_RES 320
564
+    #define XPT2046_X_MIN   201
565
+    #define XPT2046_Y_MIN   164
566
+    #define XPT2046_X_MAX  3919
567
+    #define XPT2046_Y_MAX  3776
573 568
     #define XPT2046_AVG       4
574 569
     #define XPT2046_INV       1
575 570
   #endif
@@ -579,34 +574,34 @@ unsigned int getTickDiff(unsigned int curTick, unsigned int lastTick) {
579 574
   #ifndef USE_XPT2046
580 575
     #define USE_XPT2046       1
581 576
     #ifndef XPT2046_XY_SWAP
582
-      #define XPT2046_XY_SWAP   1
577
+      #define XPT2046_XY_SWAP 1
583 578
     #endif
584 579
     #ifndef XPT2046_X_INV
585
-      #define XPT2046_X_INV     0
580
+      #define XPT2046_X_INV   0
586 581
     #endif
587 582
     #ifndef XPT2046_Y_INV
588
-      #define XPT2046_Y_INV     1
583
+      #define XPT2046_Y_INV   1
589 584
     #endif
590 585
   #endif
591 586
 
592 587
   #if USE_XPT2046
593 588
     #ifndef XPT2046_HOR_RES
594
-      #define XPT2046_HOR_RES   480
589
+      #define XPT2046_HOR_RES 480
595 590
     #endif
596 591
     #ifndef XPT2046_VER_RES
597
-      #define XPT2046_VER_RES   320
592
+      #define XPT2046_VER_RES 320
598 593
     #endif
599 594
     #ifndef XPT2046_X_MIN
600
-      #define XPT2046_X_MIN     201
595
+      #define XPT2046_X_MIN   201
601 596
     #endif
602 597
     #ifndef XPT2046_Y_MIN
603
-      #define XPT2046_Y_MIN     164
598
+      #define XPT2046_Y_MIN   164
604 599
     #endif
605 600
     #ifndef XPT2046_X_MAX
606
-      #define XPT2046_X_MAX     3919
601
+      #define XPT2046_X_MAX  3919
607 602
     #endif
608 603
     #ifndef XPT2046_Y_MAX
609
-      #define XPT2046_Y_MAX     3776
604
+      #define XPT2046_Y_MAX  3776
610 605
     #endif
611 606
     #ifndef XPT2046_AVG
612 607
       #define XPT2046_AVG       4
@@ -637,39 +632,25 @@ static void xpt2046_corr(uint16_t *x, uint16_t *y) {
637 632
   #endif
638 633
 }
639 634
 
640
-#define  times  4
635
+#define times 4
641 636
 #define CHX   0x90
642 637
 #define CHY   0xD0
643 638
 
644 639
 int SPI2_ReadWrite2Bytes(void) {
645
-  volatile uint16_t ans = 0;
646
-  uint16_t temp = 0;
647
-  #if ENABLED(SPI_GRAPHICAL_TFT)
648
-    temp = SPI_TFT.spi_read_write_byte(0xFF);
649
-    ans = temp << 8;
650
-    temp = SPI_TFT.spi_read_write_byte(0xFF);
651
-    ans |= temp;
652
-    ans >>= 3;
653
-  #else
654
-    temp = W25QXX.spi_flash_read_write_byte(0xFF);
655
-    ans = temp << 8;
656
-    temp = W25QXX.spi_flash_read_write_byte(0xFF);
657
-    ans |= temp;
658
-    ans >>= 3;
659
-  #endif
660
-  return ans & 0x0FFF;
640
+  #define SPI_READ_WRITE_BYTE(B) TERN(TFT_LVGL_UI_SPI, SPI_TFT.spi_read_write_byte, W25QXX.spi_flash_read_write_byte)(B)
641
+  const uint16_t t1 = SPI_READ_WRITE_BYTE(0xFF),
642
+                 t2 = SPI_READ_WRITE_BYTE(0xFF);
643
+  return (((t1 << 8) | t2) >> 3) & 0x0FFF;
661 644
 }
662 645
 
663 646
 uint16_t x_addata[times], y_addata[times];
664 647
 void XPT2046_Rd_Addata(uint16_t *X_Addata, uint16_t *Y_Addata) {
665 648
   uint16_t i, j, k;
666 649
 
667
-  #if ENABLED(SPI_GRAPHICAL_TFT)
668
-    SPI_TFT.spi_init(SPI_QUARTER_SPEED);
669
-  #endif
650
+  TERN(TFT_LVGL_UI_SPI, SPI_TFT.spi_init, W25QXX.init)(SPI_SPEED_6);
670 651
 
671 652
   for (i = 0; i < times; i++) {
672
-    #if ENABLED(SPI_GRAPHICAL_TFT)
653
+    #if ENABLED(TFT_LVGL_UI_SPI)
673 654
       OUT_WRITE(TOUCH_CS_PIN, LOW);
674 655
       SPI_TFT.spi_read_write_byte(CHX);
675 656
       y_addata[i] = SPI2_ReadWrite2Bytes();
@@ -692,6 +673,7 @@ void XPT2046_Rd_Addata(uint16_t *X_Addata, uint16_t *Y_Addata) {
692 673
     #endif
693 674
 
694 675
   }
676
+  TERN(TFT_LVGL_UI_SPI,,W25QXX.init(SPI_QUARTER_SPEED));
695 677
 
696 678
   for (i = 0; i < times; i++)
697 679
     for (j = i + 1; j < times; j++)
@@ -726,8 +708,10 @@ void XPT2046_Rd_Addata(uint16_t *X_Addata, uint16_t *Y_Addata) {
726 708
 #define ADC_VALID_OFFSET  10
727 709
 
728 710
 uint8_t TOUCH_PressValid(uint16_t _usX, uint16_t _usY) {
729
-  if (   (_usX <= ADC_VALID_OFFSET) || (_usY <= ADC_VALID_OFFSET)
730
-      || (_usX >= 4095 - ADC_VALID_OFFSET) || (_usY >= 4095 - ADC_VALID_OFFSET)
711
+  if ( (_usX <= ADC_VALID_OFFSET)
712
+    || (_usY <= ADC_VALID_OFFSET)
713
+    || (_usX >= 4095 - ADC_VALID_OFFSET)
714
+    || (_usY >= 4095 - ADC_VALID_OFFSET)
731 715
   ) return 0;
732 716
   return 1;
733 717
 }
@@ -754,7 +738,7 @@ bool my_touchpad_read(lv_indev_drv_t * indev_driver, lv_indev_data_t * data) {
754 738
 
755 739
       data->state = LV_INDEV_STATE_PR;
756 740
 
757
-      /*Set the coordinates (if released use the last pressed coordinates)*/
741
+      /* Set the coordinates (if released use the last pressed coordinates) */
758 742
 
759 743
       // SERIAL_ECHOLNPAIR("antes X: ", last_x, ", y: ", last_y);
760 744
       xpt2046_corr((uint16_t *)&last_x, (uint16_t *)&last_y);
@@ -774,4 +758,4 @@ bool my_touchpad_read(lv_indev_drv_t * indev_driver, lv_indev_data_t * data) {
774 758
   return false; /*Return `false` because we are not buffering and no more data to read*/
775 759
 }
776 760
 
777
-#endif // TFT_LVGL_UI
761
+#endif // HAS_TFT_LVGL_UI

+ 1
- 1
Marlin/src/lcd/extui/lib/mks_ui/tft_lvgl_configuration.h View File

@@ -30,7 +30,7 @@
30 30
 //extern "C" {
31 31
 //#endif
32 32
 
33
-#include "lvgl.h"
33
+#include <lvgl.h>
34 34
 
35 35
 void tft_lvgl_init();
36 36
 void my_disp_flush(lv_disp_drv_t * disp, const lv_area_t * area, lv_color_t * color_p);

+ 2139
- 1428
Marlin/src/lcd/extui/lib/mks_ui/tft_multi_language.cpp
File diff suppressed because it is too large
View File


+ 274
- 10
Marlin/src/lcd/extui/lib/mks_ui/tft_multi_language.h View File

@@ -48,6 +48,228 @@ extern void disp_language_init();
48 48
 #define MULTI_LANGUAGE_ENABLE   1
49 49
 #define MULTI_LANGUAGE_DISABLE  0
50 50
 
51
+typedef struct machine_common_disp{
52
+  const char *default_value;
53
+
54
+  const char *next;
55
+  const char *previous;
56
+
57
+  const char *MachineConfigTitle;
58
+  const char *MachineType;
59
+  const char *Stroke;
60
+  const char *HomeDir;
61
+  const char *EndStopType;
62
+  const char *FilamentConf;
63
+  const char *LevelingConf;
64
+
65
+  const char *MachineTypeConfTitle;
66
+  const char *xyz;
67
+  const char *delta;
68
+  const char *corexy;
69
+
70
+  const char *StrokeConfTitle;
71
+  const char *xStroke;
72
+  const char *yStroke;
73
+  const char *zStroke;
74
+
75
+  const char *xmin;
76
+  const char *ymin;
77
+  const char *zmin;
78
+
79
+  const char *HomeDirConfTitle;
80
+  const char *xHomeDir;
81
+  const char *yHomeDir;
82
+  const char *zHomeDir;
83
+  const char *min;
84
+  const char *max;
85
+
86
+  const char *EndstopConfTitle;
87
+  const char *xEndstop_min;
88
+  const char *yEndstop_min;
89
+  const char *zEndstop_min;
90
+  const char *xEndstop_max;
91
+  const char *yEndstop_max;
92
+  const char *zEndstop_max;
93
+  const char *FilamentEndstop;
94
+  const char *LevelingEndstop;
95
+  const char *opened;
96
+  const char *closed;
97
+
98
+  const char *FilamentConfTitle;
99
+  const char *InTemperature;
100
+  const char *InLength;
101
+  const char *InSpeed;
102
+  const char *OutTemperature;
103
+  const char *OutLength;
104
+  const char *OutSpeed;
105
+
106
+  const char *LevelingParaConfTitle;
107
+  const char *LevelingParaConf;
108
+  const char *DeltaLevelConf;
109
+  const char *XYZLevelconf;
110
+
111
+  const char *LevelingSubConfTitle;
112
+  const char *AutoLevelEnable;
113
+  const char *BLtouchEnable;
114
+  const char *ProbePort;
115
+  const char *ProbeXoffset;
116
+  const char *ProbeYoffset;
117
+  const char *ProbeZoffset;
118
+  const char *ProbeXYspeed;
119
+  const char *ProbeZspeed;
120
+  const char *enable;
121
+  const char *disable;
122
+  const char *z_min;
123
+  const char *z_max;
124
+
125
+  const char *LevelingSubDeltaConfTitle;
126
+  const char *MachineRadius;
127
+  const char *DiagonalRod;
128
+  const char *PrintableRadius;
129
+  const char *DeltaHeight;
130
+  const char *SmoothRodOffset;
131
+  const char *EffectorOffset;
132
+  const char *CalibrationRadius;
133
+
134
+  const char *LevelingSubXYZConfTitle;
135
+  //const char *Level_positon1;
136
+  //const char *Level_positon2;
137
+  //const char *Level_positon3;
138
+  //const char *Level_positon4;
139
+
140
+  const char *TemperatureConfTitle;
141
+  const char *NozzleConf;
142
+  const char *HotBedConf;
143
+  const char *PreheatTemperConf;
144
+
145
+  const char *NozzleCnt;
146
+  const char *NozzleConfTitle;
147
+  const char *NozzleType;
148
+  const char *NozzleAdjustType;
149
+  const char *NozzleMinTemperature;
150
+  const char *NozzleMaxTemperature;
151
+  const char *Extrude_Min_Temper;
152
+
153
+  const char *HotbedEnable;
154
+  const char *HotbedConfTitle;
155
+  const char *HotbedAjustType;
156
+  const char *HotbedMinTemperature;
157
+  const char *HotbedMaxTemperature;
158
+
159
+  const char *MotorConfTitle;
160
+  const char *MaxFeedRateConf;
161
+  const char *AccelerationConf;
162
+  const char *JerkConf;
163
+  const char *StepsConf;
164
+  const char *MotorDirConf;
165
+  const char *HomeFeedRateConf;
166
+  const char *TMCcurrentConf;
167
+  const char *TMCStepModeConf;
168
+
169
+  const char *MaxFeedRateConfTitle;
170
+  const char *XMaxFeedRate;
171
+  const char *YMaxFeedRate;
172
+  const char *ZMaxFeedRate;
173
+  const char *E0MaxFeedRate;
174
+  const char *E1MaxFeedRate;
175
+
176
+  const char *AccelerationConfTitle;
177
+  const char *PrintAcceleration;
178
+  const char *RetractAcceleration;
179
+  const char *TravelAcceleration;
180
+  const char *X_Acceleration;
181
+  const char *Y_Acceleration;
182
+  const char *Z_Acceleration;
183
+  const char *E0_Acceleration;
184
+  const char *E1_Acceleration;
185
+
186
+  const char *JerkConfTitle;
187
+  const char *X_Jerk;
188
+  const char *Y_Jerk;
189
+  const char *Z_Jerk;
190
+  const char *E_Jerk;
191
+
192
+  const char *StepsConfTitle;
193
+  const char *X_Steps;
194
+  const char *Y_Steps;
195
+  const char *Z_Steps;
196
+  const char *E0_Steps;
197
+  const char *E1_Steps;
198
+
199
+  const char *TmcCurrentConfTitle;
200
+  const char *X_Current;
201
+  const char *Y_Current;
202
+  const char *Z_Current;
203
+  const char *E0_Current;
204
+  const char *E1_Current;
205
+
206
+  const char *TmcStepModeConfTitle;
207
+  const char *X_StepMode;
208
+  const char *Y_StepMode;
209
+  const char *Z_StepMode;
210
+  const char *E0_StepMode;
211
+  const char *E1_StepMode;
212
+
213
+  const char *MotorDirConfTitle;
214
+  const char *X_MotorDir;
215
+  const char *Y_MotorDir;
216
+  const char *Z_MotorDir;
217
+  const char *E0_MotorDir;
218
+  const char *E1_MotorDir;
219
+  const char *Invert_1;
220
+  const char *Invert_0;
221
+
222
+  const char *HomeFeedRateConfTitle;
223
+  const char *XY_HomeFeedRate;
224
+  const char *Y_HomeFeedRate;
225
+  const char *Z_HomeFeedRate;
226
+
227
+  const char *AdvancedConfTitle;
228
+  const char *PwrOffDection;
229
+  const char *PwrOffAfterPrint;
230
+  const char *HaveUps;
231
+  const char *Z2andZ2Endstop;
232
+  const char *EnablePinsInvert;
233
+  const char *PausePosition;
234
+
235
+  const char *Z2ConfTitle;
236
+  const char *Z2Enable;
237
+  const char *Z2EndstopEnable;
238
+  const char *Z2Port;
239
+
240
+  const char *EnablePinsInvertTitle;
241
+  const char *XInvert;
242
+  const char *YInvert;
243
+  const char *ZInvert;
244
+  const char *EInvert;
245
+
246
+  const char *key_1;
247
+  const char *key_2;
248
+  const char *key_3;
249
+  const char *key_4;
250
+  const char *key_5;
251
+  const char *key_6;
252
+  const char *key_7;
253
+  const char *key_8;
254
+  const char *key_9;
255
+  const char *key_0;
256
+  const char *key_point;
257
+  const char *key_back;
258
+  const char *key_reset;
259
+  const char *key_confirm;
260
+  const char *negative;
261
+  const char *low_level;
262
+  const char *high_level;
263
+
264
+  const char *PausePosText;
265
+  const char *xPos;
266
+  const char *yPos;
267
+  const char *zPos;
268
+
269
+} machine_common_def;
270
+
271
+extern machine_common_def machine_menu;
272
+
51 273
 typedef struct common_menu_disp {
52 274
   const char *text_back;
53 275
   const char *dialog_confirm_title;
@@ -59,6 +281,7 @@ typedef struct common_menu_disp {
59 281
   const char *next;
60 282
   const char *previous;
61 283
 } common_menu_def;
284
+
62 285
 extern common_menu_def common_menu;
63 286
 
64 287
 typedef struct main_menu_disp {
@@ -76,6 +299,7 @@ typedef struct main_menu_disp {
76 299
   const char *more;
77 300
   const char *machine_para;
78 301
 } main_menu_def;
302
+
79 303
 extern main_menu_def main_menu;
80 304
 
81 305
 typedef struct preheat_menu_disp {
@@ -96,7 +320,8 @@ typedef struct preheat_menu_disp {
96 320
 
97 321
   const char *dialog_tips;
98 322
 
99
-}preheat_menu_def;
323
+} preheat_menu_def;
324
+
100 325
 extern preheat_menu_def preheat_menu;
101 326
 
102 327
 typedef struct move_menu_disp {
@@ -114,6 +339,7 @@ typedef struct move_menu_disp {
114 339
   const char *step_10mm;
115 340
   const char *back;
116 341
 } move_menu_def;
342
+
117 343
 extern move_menu_def move_menu;
118 344
 
119 345
 typedef struct home_menu_disp {
@@ -125,6 +351,7 @@ typedef struct home_menu_disp {
125 351
   const char *stopmove;
126 352
   const char *back;
127 353
 } home_menu_def;
354
+
128 355
 extern home_menu_def home_menu;
129 356
 
130 357
 typedef struct file_menu_disp {
@@ -137,7 +364,8 @@ typedef struct file_menu_disp {
137 364
   const char *no_file;
138 365
   const char *no_file_and_check;
139 366
 
140
-}file_menu_def;
367
+} file_menu_def;
368
+
141 369
 extern file_menu_def file_menu;
142 370
 
143 371
 typedef struct extrude_menu_disp {
@@ -160,6 +388,7 @@ typedef struct extrude_menu_disp {
160 388
   const char *temp_value;
161 389
   const char *temper_text;
162 390
 } extrude_menu_def;
391
+
163 392
 extern extrude_menu_def extrude_menu;
164 393
 
165 394
 typedef struct leveling_menu_disp {
@@ -172,6 +401,7 @@ typedef struct leveling_menu_disp {
172 401
 
173 402
   char *back;
174 403
 } leveling_menu_def;
404
+
175 405
 extern leveling_menu_def leveling_menu;
176 406
 
177 407
 typedef struct set_menu_disp {
@@ -187,8 +417,10 @@ typedef struct set_menu_disp {
187 417
   const char *shutdown;
188 418
   const char *language;
189 419
   const char *machine_para;
420
+  const char *eepromSet;
190 421
   const char *back;
191 422
 } set_menu_def;
423
+
192 424
 extern set_menu_def set_menu;
193 425
 
194 426
 typedef struct filesys_menu_disp {
@@ -198,6 +430,7 @@ typedef struct filesys_menu_disp {
198 430
   const char *usb_sys;
199 431
   const char *back;
200 432
 } filesys_menu_def;
433
+
201 434
 extern filesys_menu_def filesys_menu;
202 435
 
203 436
 typedef struct more_menu_disp {
@@ -205,6 +438,7 @@ typedef struct more_menu_disp {
205 438
   const char *zoffset;
206 439
   const char *back;
207 440
 } more_menu_def;
441
+
208 442
 extern more_menu_def more_menu;
209 443
 
210 444
 typedef struct wifi_menu_disp {
@@ -221,6 +455,7 @@ typedef struct wifi_menu_disp {
221 455
   const char *back;
222 456
   const char *reconnect;
223 457
 } wifi_menu_def;
458
+
224 459
 extern wifi_menu_def wifi_menu;
225 460
 
226 461
 typedef struct cloud_menu_disp {
@@ -236,6 +471,7 @@ typedef struct cloud_menu_disp {
236 471
   const char *back;
237 472
   const char *unbind_printer_tips;
238 473
 } cloud_menu_def;
474
+
239 475
 extern cloud_menu_def cloud_menu;
240 476
 
241 477
 typedef struct about_menu_disp {
@@ -249,6 +485,7 @@ typedef struct about_menu_disp {
249 485
   const char *type_robin_mini;
250 486
   const char *back;
251 487
 } about_menu_def;
488
+
252 489
 extern about_menu_def about_menu;
253 490
 
254 491
 typedef struct fan_menu_disp {
@@ -263,6 +500,7 @@ typedef struct fan_menu_disp {
263 500
   const char *state;
264 501
   const char *state_value;
265 502
 } fan_menu_def;
503
+
266 504
 extern fan_menu_def fan_menu;
267 505
 
268 506
 typedef struct filament_menu_disp {
@@ -290,6 +528,7 @@ typedef struct filament_menu_disp {
290 528
   const char *filament_dialog_ok;
291 529
   const char *filament_dialog_back;
292 530
 } filament_menu_def;
531
+
293 532
 extern filament_menu_def filament_menu;
294 533
 
295 534
 typedef struct language_menu {
@@ -310,6 +549,7 @@ typedef struct language_menu {
310 549
   const char *up;
311 550
   const char *back;
312 551
 } language_menu_def;
552
+
313 553
 extern language_menu_def language_menu;
314 554
 
315 555
 typedef struct printing_menu_disp {
@@ -323,6 +563,7 @@ typedef struct printing_menu_disp {
323 563
   const char *resume;
324 564
   const char *stop;
325 565
 } printing_menu_def;
566
+
326 567
 extern printing_menu_def printing_menu;
327 568
 
328 569
 typedef struct operation_menu_disp {
@@ -341,6 +582,7 @@ typedef struct operation_menu_disp {
341 582
   const char *back;
342 583
   const char *babystep;
343 584
 } operation_menu_def;
585
+
344 586
 extern operation_menu_def operation_menu;
345 587
 
346 588
 typedef struct pause_menu_disp {
@@ -352,6 +594,7 @@ typedef struct pause_menu_disp {
352 594
   const char *filament;
353 595
   const char *more;
354 596
 } pause_menu_def;
597
+
355 598
 extern pause_menu_def pause_menu;
356 599
 
357 600
 typedef struct speed_menu_disp {
@@ -367,6 +610,7 @@ typedef struct speed_menu_disp {
367 610
   const char *move_speed;
368 611
   const char *extrude_speed;
369 612
 } speed_menu_def;
613
+
370 614
 extern speed_menu_def speed_menu;
371 615
 
372 616
 typedef struct printing_more_menu_disp {
@@ -378,6 +622,7 @@ typedef struct printing_more_menu_disp {
378 622
   const char *speed;
379 623
   const char *back;
380 624
 } printing_more_menu_def;
625
+
381 626
 extern printing_more_menu_def printing_more_menu;
382 627
 
383 628
 typedef struct dialog_menu_disp {
@@ -392,6 +637,7 @@ typedef struct dialog_menu_disp {
392 637
   const char *tip1_print_file;
393 638
   const char *tip2_stop_file;
394 639
 } dialog_menu_def;
640
+
395 641
 extern dialog_menu_def dialog_menu;
396 642
 
397 643
 typedef struct print_file_dialog_disp {
@@ -412,6 +658,7 @@ typedef struct print_file_dialog_disp {
412 658
   const char *reprint;
413 659
   const char *wifi_enable_tips;
414 660
 } print_file_dialog_menu_def;
661
+
415 662
 extern print_file_dialog_menu_def print_file_dialog_menu;
416 663
 
417 664
 typedef struct zoffset_menu_disp {
@@ -423,6 +670,7 @@ typedef struct zoffset_menu_disp {
423 670
   const char *step1;
424 671
   const char *back;
425 672
 } zoffset_menu_def;
673
+
426 674
 extern zoffset_menu_def zoffset_menu;
427 675
 
428 676
 typedef struct tool_menu_disp {
@@ -437,6 +685,7 @@ typedef struct tool_menu_disp {
437 685
   const char *more;
438 686
   const char *back;
439 687
 } tool_menu_def;
688
+
440 689
 extern tool_menu_def tool_menu;
441 690
 
442 691
 typedef struct MachinePara_menu_disp {
@@ -447,6 +696,7 @@ typedef struct MachinePara_menu_disp {
447 696
   const char *AdvanceSetting;
448 697
   //const char *back;
449 698
 } MachinePara_menu_def;
699
+
450 700
 extern MachinePara_menu_def MachinePara_menu;
451 701
 
452 702
 typedef struct MachineSettings_menu_disp {
@@ -459,6 +709,7 @@ typedef struct MachineSettings_menu_disp {
459 709
   const char *leveling;
460 710
   const char *back;
461 711
 } MachineSettings_menu_def;
712
+
462 713
 extern MachineSettings_menu_def MachineSettings_menu;
463 714
 
464 715
 typedef struct TemperatureSettings_menu_disp {
@@ -468,6 +719,7 @@ typedef struct TemperatureSettings_menu_disp {
468 719
   const char *preheat;
469 720
   const char *back;
470 721
 } TemperatureSettings_menu_def;
722
+
471 723
 extern TemperatureSettings_menu_def TemperatureSettings_menu;
472 724
 
473 725
 typedef struct pause_msg_disp {
@@ -485,23 +737,35 @@ typedef struct pause_msg_disp {
485 737
   const char *purgeMore;
486 738
   const char *continuePrint;
487 739
 } pause_msg_def;
740
+
488 741
 extern pause_msg_def pause_msg_menu;
489 742
 
743
+typedef struct eeprom_disp{
744
+  const char *title;
745
+  const char *store;
746
+  const char *read;
747
+  const char *revert;
748
+  const char *storeTips;
749
+  const char *readTips;
750
+  const char *revertTips;
751
+} eeprom_def;
752
+
753
+extern eeprom_def eeprom_menu;
490 754
 /*****************************************/
491 755
 //********************************************//
492 756
 //#if defined(TFT70)
493 757
 //
494 758
 //#elif defined(TFT35)
495
-#define TEXT_VALUE                  "%d/%d"
759
+#define TEXT_VALUE          "%d/%d"
496 760
 //#endif
497 761
 
498
-#define TEXT_VALUE_T                  ": %d℃"
499
-#define TEXT_VALUE_mm                 ": %dmm"
500
-#define TEXT_VALUE_cm                 ": %dcm"
501
-#define TEXT_VALUE_m                  ": %dm"
762
+#define TEXT_VALUE_T        ": %d℃"
763
+#define TEXT_VALUE_mm       ": %dmm"
764
+#define TEXT_VALUE_cm       ": %dcm"
765
+#define TEXT_VALUE_m        ": %dm"
502 766
 
503
-#define TEMP_UNIT_SYBOL               "%d℃"
504
-#define FLOAT_TEMP_UNIT_SYBOL               "%.1f℃"
767
+#define TEMP_UNIT_SYBOL       "%d℃"
768
+#define FLOAT_TEMP_UNIT_SYBOL "%.1f℃"
505 769
 
506 770
 #define TEXT_1C             "1℃"
507 771
 #define TEXT_5C             "5℃"
@@ -533,7 +797,7 @@ extern pause_msg_def pause_msg_menu;
533 797
 #define LANGUAGE_JP         "日本語"
534 798
 #define LANGUAGE_GE         "Deutsch"
535 799
 #define LANGUAGE_FR         "français"
536
-#define LANGUAGE_IT         "Italia"
800
+#define LANGUAGE_IT         "Italiano"
537 801
 #define LANGUAGE_PR         "português"
538 802
 #define LANGUAGE_KR         "Korean"
539 803
 #define LANGUAGE_BR         "Brazil"

+ 1
- 5
Marlin/src/module/motion.cpp View File

@@ -1098,11 +1098,7 @@ void prepare_line_to_destination() {
1098 1098
 }
1099 1099
 
1100 1100
 uint8_t axes_need_homing(uint8_t axis_bits/*=0x07*/) {
1101
-  #if ENABLED(HOME_AFTER_DEACTIVATE)
1102
-    #define HOMED_FLAGS axis_known_position
1103
-  #else
1104
-    #define HOMED_FLAGS axis_homed
1105
-  #endif
1101
+  #define HOMED_FLAGS TERN(HOME_AFTER_DEACTIVATE, axis_known_position, axis_homed)
1106 1102
   // Clear test bits that are homed
1107 1103
   if (TEST(axis_bits, X_AXIS) && TEST(HOMED_FLAGS, X_AXIS)) CBI(axis_bits, X_AXIS);
1108 1104
   if (TEST(axis_bits, Y_AXIS) && TEST(HOMED_FLAGS, Y_AXIS)) CBI(axis_bits, Y_AXIS);

+ 1
- 1
Marlin/src/module/stepper.cpp View File

@@ -2551,7 +2551,7 @@ void Stepper::init() {
2551 2551
     AXIS_INIT(Z, Z);
2552 2552
   #endif
2553 2553
 
2554
-  #if E_STEPPERS > 0 && HAS_E0_STEP
2554
+  #if E_STEPPERS && HAS_E0_STEP
2555 2555
     E_AXIS_INIT(0);
2556 2556
   #endif
2557 2557
   #if E_STEPPERS > 1 && HAS_E1_STEP

+ 2
- 2
Marlin/src/module/stepper/indirection.h View File

@@ -865,14 +865,14 @@ void reset_stepper_drivers();    // Called by settings.load / settings.reset
865 865
 #endif
866 866
 
867 867
 #ifndef ENABLE_AXIS_E0
868
-  #if E_STEPPERS > 0 && HAS_E0_ENABLE
868
+  #if E_STEPPERS && HAS_E0_ENABLE
869 869
     #define  ENABLE_AXIS_E0() ENABLE_STEPPER_E0()
870 870
   #else
871 871
     #define  ENABLE_AXIS_E0() NOOP
872 872
   #endif
873 873
 #endif
874 874
 #ifndef DISABLE_AXIS_E0
875
-  #if E_STEPPERS > 0 && HAS_E0_ENABLE
875
+  #if E_STEPPERS && HAS_E0_ENABLE
876 876
     #define DISABLE_AXIS_E0() DISABLE_STEPPER_E0()
877 877
   #else
878 878
     #define DISABLE_AXIS_E0() NOOP

+ 3
- 1
Marlin/src/pins/pins.h View File

@@ -507,7 +507,9 @@
507 507
 #elif MB(MKS_ROBIN_MINI)
508 508
   #include "stm32f1/pins_MKS_ROBIN_MINI.h"      // STM32F1                                env:mks_robin_mini
509 509
 #elif MB(MKS_ROBIN_NANO)
510
-  #include "stm32f1/pins_MKS_ROBIN_NANO.h"      // STM32F1                                env:mks_robin_nano
510
+  #include "stm32f1/pins_MKS_ROBIN_NANO.h"      // STM32F1                                env:mks_robin_nano env:mks_robin_nano35
511
+#elif MB(MKS_ROBIN_NANO_V2)
512
+  #include "stm32f1/pins_MKS_ROBIN_NANO_V2.h"   // STM32F1                                env:mks_robin_nano env:mks_robin_nano35
511 513
 #elif MB(MKS_ROBIN_LITE)
512 514
   #include "stm32f1/pins_MKS_ROBIN_LITE.h"      // STM32F1                                env:mks_robin_lite
513 515
 #elif MB(BTT_SKR_MINI_V1_1)

+ 8
- 3
Marlin/src/pins/sam/pins_RADDS.h View File

@@ -32,6 +32,14 @@
32 32
 #define BOARD_INFO_NAME "RADDS"
33 33
 
34 34
 //
35
+// EEPROM
36
+//
37
+#if EITHER(NO_EEPROM_SELECTED, I2C_EEPROM)
38
+  #define I2C_EEPROM
39
+  #define MARLIN_EEPROM_SIZE 0x2000               // 8KB
40
+#endif
41
+
42
+//
35 43
 // Servos
36 44
 //
37 45
 #if !HAS_CUTTER
@@ -205,9 +213,6 @@
205 213
   #define FIL_RUNOUT_PIN                      39  // SERVO2_PIN
206 214
 #endif
207 215
 
208
-#define I2C_EEPROM
209
-#define MARLIN_EEPROM_SIZE 0x2000                 // 8KB
210
-
211 216
 //
212 217
 // M3/M4/M5 - Spindle/Laser Control
213 218
 //

+ 2
- 1
Marlin/src/pins/stm32f1/pins_CHITU3D_V5.h View File

@@ -144,12 +144,13 @@
144 144
 
145 145
 #define SPI_FLASH_SIZE 0x200000                   // 2MB
146 146
 
147
-#if ENABLED(TFT_LVGL_UI)
147
+#if HAS_TFT_LVGL_UI
148 148
   #define HAS_SPI_FLASH_FONT 0
149 149
   #define HAS_GCODE_PREVIEW 1
150 150
   #define HAS_GCODE_DEFAULT_VIEW_IN_FLASH 0
151 151
   #define HAS_LANG_SELECT_SCREEN 0
152 152
   #define HAS_BAK_VIEW_IN_FLASH 0
153
+  #define HAS_LOGO_IN_FLASH 0
153 154
 
154 155
   //SPI 2
155 156
   #define W25QXX_CS_PIN                     PB12

+ 2
- 1
Marlin/src/pins/stm32f1/pins_CHITU3D_V6.h View File

@@ -150,12 +150,13 @@
150 150
 
151 151
 #define SPI_FLASH_SIZE 0x200000                   // 2MB
152 152
 
153
-#if ENABLED(TFT_LVGL_UI)
153
+#if HAS_TFT_LVGL_UI
154 154
   #define HAS_SPI_FLASH_FONT 0
155 155
   #define HAS_GCODE_PREVIEW 1
156 156
   #define HAS_GCODE_DEFAULT_VIEW_IN_FLASH 0
157 157
   #define HAS_LANG_SELECT_SCREEN 0
158 158
   #define HAS_BAK_VIEW_IN_FLASH 0
159
+  #define HAS_LOGO_IN_FLASH 0
159 160
 
160 161
   //SPI 2
161 162
   #define W25QXX_CS_PIN                     PB12

+ 77
- 73
Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO.h View File

@@ -45,7 +45,7 @@
45 45
   #define FLASH_EEPROM_EMULATION
46 46
   #define EEPROM_PAGE_SIZE     (0x800U) // 2KB
47 47
   #define EEPROM_START_ADDRESS (0x8000000UL + (STM32_FLASH_SIZE) * 1024UL - (EEPROM_PAGE_SIZE) * 2UL)
48
-  #define MARLIN_EEPROM_SIZE   EEPROM_PAGE_SIZE  // 2KB
48
+  #define MARLIN_EEPROM_SIZE    EEPROM_PAGE_SIZE  // 2KB
49 49
 #endif
50 50
 
51 51
 #define ENABLE_SPI2
@@ -123,8 +123,8 @@
123 123
 //
124 124
 // Misc. Functions
125 125
 //
126
-//#define POWER_LOSS_PIN                    PA2   // PW_DET
127
-//#define PS_ON_PIN                         PA3   // PW_OFF
126
+#define POWER_LOSS_PIN                      PA2   // PW_DET
127
+#define PS_ON_PIN                           PA3   // PW_OFF
128 128
 
129 129
 //#define SUICIDE_PIN                       PB2   // Enable MKSPWC support ROBIN NANO v1.2 ONLY
130 130
 //#define SUICIDE_PIN_INVERTING false
@@ -132,13 +132,16 @@
132 132
 //#define KILL_PIN                          PA2   // Enable MKSPWC support ROBIN NANO v1.2 ONLY
133 133
 //#define KILL_PIN_INVERTING true                 // Enable MKSPWC support ROBIN NANO v1.2 ONLY
134 134
 
135
-//#define SERVO0_PIN                        PA8   // Enable BLTOUCH support ROBIN NANO v1.2 ONLY
135
+#define SERVO0_PIN                          PA8   // Enable BLTOUCH support ROBIN NANO v1.2 ONLY
136 136
 
137 137
 //#define LED_PIN                           PB2
138 138
 
139 139
 #define MT_DET_1_PIN                        PA4
140
+#define MT_DET_2_PIN                        PE6
140 141
 #define MT_DET_PIN_INVERTING false
141 142
 
143
+#define WIFI_IO0_PIN                        PC13
144
+
142 145
 //
143 146
 // SD Card
144 147
 //
@@ -162,76 +165,28 @@
162 165
  * to let the bootloader init the screen.
163 166
  */
164 167
 
165
-#if ENABLED(SPI_GRAPHICAL_TFT)
168
+#if ENABLED(TFT_LVGL_UI_SPI)
166 169
 
167
-  #if HAS_SPI_LCD
170
+  #define SPI_TFT_CS_PIN                    PD11
171
+  #define SPI_TFT_SCK_PIN                   PA5
172
+  #define SPI_TFT_MISO_PIN                  PA6
173
+  #define SPI_TFT_MOSI_PIN                  PA7
174
+  #define SPI_TFT_DC_PIN                    PD10
175
+  #define SPI_TFT_RST_PIN                   PC6
168 176
 
169
-    #define BEEPER_PIN                      PC5
170
-    #define BTN_ENC                         PE13
171
-    #define LCD_PINS_ENABLE                 PD13
172
-    #define LCD_PINS_RS                     PC6
173
-    #define BTN_EN1                         PE8
174
-    #define BTN_EN2                         PE11
175
-    #define LCD_BACKLIGHT_PIN               -1
177
+  #define LCD_BACKLIGHT_PIN                 PD13
176 178
 
177
-    // MKS MINI12864 and MKS LCD12864B; If using MKS LCD12864A (Need to remove RPK2 resistor)
178
-    #if ENABLED(MKS_MINI_12864)
179
-      #define LCD_BACKLIGHT_PIN             -1
180
-      #define LCD_RESET_PIN                 -1
181
-      #define DOGLCD_A0                     PD11
182
-      #define DOGLCD_CS                     PE15
183
-      #define DOGLCD_SCK                    PA5
184
-      #define DOGLCD_MOSI                   PA7
185
-
186
-      // Required for MKS_MINI_12864 with this board
187
-      #define MKS_LCD12864B
188
-      #undef SHOW_BOOTSCREEN
189
-
190
-    #else                                         // !MKS_MINI_12864
191
-
192
-      #define LCD_PINS_D4                   PE14
193
-      #if ENABLED(ULTIPANEL)
194
-        #define LCD_PINS_D5                 PE15
195
-        #define LCD_PINS_D6                 PD11
196
-        #define LCD_PINS_D7                 PD10
197
-      #endif
198
-
199
-      #ifndef BOARD_ST7920_DELAY_1
200
-        #define BOARD_ST7920_DELAY_1     DELAY_NS(125)
201
-      #endif
202
-      #ifndef BOARD_ST7920_DELAY_2
203
-        #define BOARD_ST7920_DELAY_2     DELAY_NS(125)
204
-      #endif
205
-      #ifndef BOARD_ST7920_DELAY_3
206
-        #define BOARD_ST7920_DELAY_3     DELAY_NS(125)
207
-      #endif
208
-
209
-    #endif // !MKS_MINI_12864
210
-
211
-  #else
212
-
213
-    #define SPI_TFT_CS_PIN                  PD11
214
-    #define SPI_TFT_SCK_PIN                 PA5
215
-    #define SPI_TFT_MISO_PIN                PA6
216
-    #define SPI_TFT_MOSI_PIN                PA7
217
-    #define SPI_TFT_DC_PIN                  PD10
218
-    #define SPI_TFT_RST_PIN                 PC6
219
-
220
-    #define LCD_BACKLIGHT_PIN               PD13
221
-
222
-    #define TOUCH_CS_PIN                    PE14  // SPI1_NSS
223
-    #define TOUCH_SCK_PIN                   PA5   // SPI1_SCK
224
-    #define TOUCH_MISO_PIN                  PA6   // SPI1_MISO
225
-    #define TOUCH_MOSI_PIN                  PA7   // SPI1_MOSI
226
-
227
-    #define BTN_EN1                         PE8
228
-    #define BTN_EN2                         PE11
229
-    #define BEEPER_PIN                      PC5
230
-    #define BTN_ENC                         PE13
231
-
232
-  #endif // HAS_SPI_LCD
233
-
234
-#elif ENABLED(TFT_LVGL_UI)
179
+  #define TOUCH_CS_PIN                      PE14  // SPI1_NSS
180
+  #define TOUCH_SCK_PIN                     PA5   // SPI1_SCK
181
+  #define TOUCH_MISO_PIN                    PA6   // SPI1_MISO
182
+  #define TOUCH_MOSI_PIN                    PA7   // SPI1_MOSI
183
+
184
+  #define BTN_EN1                           PE8
185
+  #define BTN_EN2                           PE11
186
+  #define BEEPER_PIN                        PC5
187
+  #define BTN_ENC                           PE13
188
+
189
+#elif ENABLED(TFT_LVGL_UI_FSMC)
235 190
 
236 191
   #define FSMC_CS_PIN                       PD7   // NE4
237 192
   #define FSMC_RS_PIN                       PD11  // A0
@@ -243,7 +198,11 @@
243 198
 
244 199
   #define LCD_BACKLIGHT_PIN                 PD13
245 200
 
246
-#elif ENABLED(FSMC_GRAPHICAL_TFT)
201
+#endif
202
+
203
+#if ENABLED(FSMC_GRAPHICAL_TFT)
204
+  //#define DOGLCD_MOSI                     -1    // prevent redefine Conditionals_post.h
205
+  //#define DOGLCD_SCK                      -1
247 206
 
248 207
   #define FSMC_CS_PIN                       PD7   // NE4
249 208
   #define FSMC_RS_PIN                       PD11  // A0
@@ -257,9 +216,54 @@
257 216
     #define TOUCH_MISO_PIN                  PB14  // SPI2_MISO
258 217
     #define TOUCH_MOSI_PIN                  PB15  // SPI2_MOSI
259 218
   #endif
260
-
261 219
 #endif
262 220
 
221
+#if HAS_SPI_LCD
222
+
223
+  #define BEEPER_PIN                        PC5
224
+  #define BTN_ENC                           PE13
225
+  #define LCD_PINS_ENABLE                   PD13
226
+  #define LCD_PINS_RS                       PC6
227
+  #define BTN_EN1                           PE8
228
+  #define BTN_EN2                           PE11
229
+  #define LCD_BACKLIGHT_PIN                 -1
230
+
231
+  // MKS MINI12864 and MKS LCD12864B; If using MKS LCD12864A (Need to remove RPK2 resistor)
232
+  #if ENABLED(MKS_MINI_12864)
233
+    #define LCD_BACKLIGHT_PIN               -1
234
+    #define LCD_RESET_PIN                   -1
235
+    #define DOGLCD_A0                       PD11
236
+    #define DOGLCD_CS                       PE15
237
+    #define DOGLCD_SCK                      PA5
238
+    #define DOGLCD_MOSI                     PA7
239
+
240
+    // Required for MKS_MINI_12864 with this board
241
+    #define MKS_LCD12864B
242
+    #undef SHOW_BOOTSCREEN
243
+
244
+  #else                                           // !MKS_MINI_12864
245
+
246
+    #define LCD_PINS_D4                     PE14
247
+    #if ENABLED(ULTIPANEL)
248
+      #define LCD_PINS_D5                   PE15
249
+      #define LCD_PINS_D6                   PD11
250
+      #define LCD_PINS_D7                   PD10
251
+    #endif
252
+
253
+    #ifndef BOARD_ST7920_DELAY_1
254
+      #define BOARD_ST7920_DELAY_1 DELAY_NS(125)
255
+    #endif
256
+    #ifndef BOARD_ST7920_DELAY_2
257
+      #define BOARD_ST7920_DELAY_2 DELAY_NS(125)
258
+    #endif
259
+    #ifndef BOARD_ST7920_DELAY_3
260
+      #define BOARD_ST7920_DELAY_3 DELAY_NS(125)
261
+    #endif
262
+
263
+  #endif // !MKS_MINI_12864
264
+
265
+#endif // HAS_SPI_LCD
266
+
263 267
 #define SPI_FLASH
264 268
 #if ENABLED(SPI_FLASH)
265 269
   #define W25QXX_CS_PIN                     PB12

+ 325
- 0
Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_V2.h View File

@@ -0,0 +1,325 @@
1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
+ *
5
+ * Based on Sprinter and grbl.
6
+ * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
7
+ *
8
+ * This program is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+#pragma once
23
+
24
+/**
25
+ * MKS Robin nano (STM32F130VET6) board pin assignments
26
+ */
27
+
28
+#ifndef __STM32F1__
29
+  #error "Oops! Select an STM32F1 board in 'Tools > Board.'"
30
+#elif HOTENDS > 2 || E_STEPPERS > 2
31
+  #error "MKS Robin nano supports up to 2 hotends / E-steppers. Comment out this line to continue."
32
+#endif
33
+
34
+#define BOARD_INFO_NAME "MKS Robin nano V2.0"
35
+
36
+//
37
+// Release PB4 (Y_ENABLE_PIN) from JTAG NRST role
38
+//
39
+
40
+//#define DISABLE_DEBUG
41
+
42
+//
43
+// EEPROM
44
+//
45
+//#define FLASH_EEPROM_EMULATION
46
+//#define SDCARD_EEPROM_EMULATION
47
+
48
+#if EITHER(NO_EEPROM_SELECTED, I2C_EEPROM)
49
+  #define I2C_EEPROM                              // EEPROM on I2C-0
50
+  #define MARLIN_EEPROM_SIZE 0x1000               // 4KB
51
+#endif
52
+
53
+//
54
+// Note: MKS Robin board is using SPI2 interface.
55
+//
56
+//#define SPI_MODULE 2
57
+#define ENABLE_SPI2
58
+
59
+//
60
+// Limit Switches
61
+//
62
+#define X_DIAG_PIN                          PA15
63
+#define Y_DIAG_PIN                          PA12
64
+#define Z_DIAG_PIN                          PA11
65
+#define E0_DIAG_PIN                         PC4
66
+#define E1_DIAG_PIN                         PE7
67
+
68
+#define X_STOP_PIN                          PA15
69
+#define Y_STOP_PIN                          PA12
70
+#define Z_MIN_PIN                           PA11
71
+#define Z_MAX_PIN                           PC4
72
+
73
+//
74
+// Steppers
75
+//
76
+#define X_ENABLE_PIN                        PE4
77
+#define X_STEP_PIN                          PE3
78
+#define X_DIR_PIN                           PE2
79
+#ifndef X_CS_PIN
80
+  #define X_CS_PIN                          PD5
81
+#endif
82
+
83
+#define Y_ENABLE_PIN                        PE1
84
+#define Y_STEP_PIN                          PE0
85
+#define Y_DIR_PIN                           PB9
86
+#ifndef Y_CS_PIN
87
+  #define Y_CS_PIN                          PD7
88
+#endif
89
+
90
+#define Z_ENABLE_PIN                        PB8
91
+#define Z_STEP_PIN                          PB5
92
+#define Z_DIR_PIN                           PB4
93
+#ifndef Z_CS_PIN
94
+  #define Z_CS_PIN                          PD4
95
+#endif
96
+
97
+#define E0_ENABLE_PIN                       PB3
98
+#define E0_STEP_PIN                         PD6
99
+#define E0_DIR_PIN                          PD3
100
+#ifndef E0_CS_PIN
101
+  #define E0_CS_PIN                         PD9
102
+#endif
103
+
104
+#define E1_ENABLE_PIN                       PA3
105
+#define E1_STEP_PIN                         PD15
106
+#define E1_DIR_PIN                          PA1
107
+#ifndef E1_CS_PIN
108
+  #define E1_CS_PIN                         PD8
109
+#endif
110
+
111
+//
112
+// Software SPI pins for TMC2130 stepper drivers
113
+//
114
+#if ENABLED(TMC_USE_SW_SPI)
115
+  #ifndef TMC_SW_MOSI
116
+    #define TMC_SW_MOSI                     PD14
117
+  #endif
118
+  #ifndef TMC_SW_MISO
119
+    #define TMC_SW_MISO                     PD1
120
+  #endif
121
+  #ifndef TMC_SW_SCK
122
+    #define TMC_SW_SCK                      PD0
123
+  #endif
124
+#endif
125
+
126
+#if HAS_TMC_UART
127
+  /**
128
+   * TMC2208/TMC2209 stepper drivers
129
+   *
130
+   * Hardware serial communication ports.
131
+   * If undefined software serial is used according to the pins below
132
+   */
133
+  //#define X_HARDWARE_SERIAL  Serial
134
+  //#define X2_HARDWARE_SERIAL Serial1
135
+  //#define Y_HARDWARE_SERIAL  Serial1
136
+  //#define Y2_HARDWARE_SERIAL Serial1
137
+  //#define Z_HARDWARE_SERIAL  Serial1
138
+  //#define Z2_HARDWARE_SERIAL Serial1
139
+  //#define E0_HARDWARE_SERIAL Serial1
140
+  //#define E1_HARDWARE_SERIAL Serial1
141
+  //#define E2_HARDWARE_SERIAL Serial1
142
+  //#define E3_HARDWARE_SERIAL Serial1
143
+  //#define E4_HARDWARE_SERIAL Serial1
144
+
145
+  //
146
+  // Software serial
147
+  //
148
+
149
+  #define X_SERIAL_TX_PIN                   PD5
150
+  #define X_SERIAL_RX_PIN                   PD5
151
+
152
+  #define Y_SERIAL_TX_PIN                   PD7
153
+  #define Y_SERIAL_RX_PIN                   PD7
154
+
155
+  #define Z_SERIAL_TX_PIN                   PD4
156
+  #define Z_SERIAL_RX_PIN                   PD4
157
+
158
+  #define E0_SERIAL_TX_PIN                  PD9
159
+  #define E0_SERIAL_RX_PIN                  PD9
160
+
161
+  #define E1_SERIAL_TX_PIN                  PD8
162
+  #define E1_SERIAL_RX_PIN                  PD8
163
+
164
+  // Reduce baud rate to improve software serial reliability
165
+  #define TMC_BAUD_RATE 19200
166
+#endif // TMC2208 || TMC2209
167
+
168
+//
169
+// Temperature Sensors
170
+//
171
+#define TEMP_0_PIN                          PC1   // TH1
172
+#define TEMP_1_PIN                          PC2   // TH2
173
+#define TEMP_BED_PIN                        PC0   // TB1
174
+
175
+//
176
+// Heaters / Fans
177
+//
178
+#define HEATER_0_PIN                        PC3   // HEATER1
179
+#define HEATER_1_PIN                        PB0   // HEATER2
180
+#define HEATER_BED_PIN                      PA0   // HOT BED
181
+
182
+#define FAN_PIN                             PB1   // FAN
183
+
184
+//
185
+// Thermocouples
186
+//
187
+//#define MAX6675_SS_PIN                    PE5   // TC1 - CS1
188
+//#define MAX6675_SS_PIN                    PE6   // TC2 - CS2
189
+
190
+//
191
+// Misc. Functions
192
+//
193
+#define POWER_LOSS_PIN                      PA2   // PW_DET
194
+#define PS_ON_PIN                           PA3   // PW_OFF
195
+
196
+//#define SUICIDE_PIN                       PB2   // Enable MKSPWC support ROBIN NANO v1.2 ONLY
197
+//#define SUICIDE_PIN_INVERTING false
198
+
199
+//#define KILL_PIN                          PA2   // Enable MKSPWC support ROBIN NANO v1.2 ONLY
200
+//#define KILL_PIN_INVERTING true                 // Enable MKSPWC support ROBIN NANO v1.2 ONLY
201
+
202
+#define SERVO0_PIN                          PA8   // Enable BLTOUCH support ROBIN NANO v1.2 ONLY
203
+
204
+//#define LED_PIN                           PB2
205
+
206
+#define MT_DET_1_PIN                        PA4
207
+#define MT_DET_2_PIN                        PE6
208
+#define MT_DET_PIN_INVERTING false
209
+
210
+#define WIFI_IO0_PIN                        PC13
211
+
212
+//
213
+// SD Card
214
+//
215
+#ifndef SDCARD_CONNECTION
216
+  #define SDCARD_CONNECTION              ONBOARD
217
+#endif
218
+
219
+#define SDIO_SUPPORT
220
+#define SDIO_CLOCK 4500000                        // 4.5 MHz
221
+#define SD_DETECT_PIN                       PD12
222
+#define ONBOARD_SD_CS_PIN                   PC11
223
+
224
+//
225
+// LCD / Controller
226
+//
227
+#define BEEPER_PIN                          PC5
228
+
229
+/**
230
+ * Note: MKS Robin TFT screens use various TFT controllers.
231
+ * If the screen stays white, disable 'LCD_RESET_PIN'
232
+ * to let the bootloader init the screen.
233
+ */
234
+
235
+#if ENABLED(TFT_LVGL_UI_SPI)
236
+
237
+  #define SPI_TFT_CS_PIN                    PD11
238
+  #define SPI_TFT_SCK_PIN                   PA5
239
+  #define SPI_TFT_MISO_PIN                  PA6
240
+  #define SPI_TFT_MOSI_PIN                  PA7
241
+  #define SPI_TFT_DC_PIN                    PD10
242
+  #define SPI_TFT_RST_PIN                   PC6
243
+
244
+  #define LCD_BACKLIGHT_PIN                 PD13
245
+
246
+  #define TOUCH_CS_PIN                      PE14  // SPI1_NSS
247
+  #define TOUCH_SCK_PIN                     PA5   // SPI1_SCK
248
+  #define TOUCH_MISO_PIN                    PA6   // SPI1_MISO
249
+  #define TOUCH_MOSI_PIN                    PA7   // SPI1_MOSI
250
+
251
+  #define BTN_EN1                           PE8
252
+  #define BTN_EN2                           PE11
253
+  #define BEEPER_PIN                        PC5
254
+  #define BTN_ENC                           PE13
255
+
256
+#else
257
+  #if ENABLED(TFT_LITTLE_VGL_UI)
258
+  //FSMC LCD
259
+  #define FSMC_CS_PIN                       PD7   // NE4
260
+  #define FSMC_RS_PIN                       PD11  // A0
261
+
262
+  #define TOUCH_CS_PIN                      PA7   // SPI2_NSS
263
+  #define TOUCH_SCK_PIN                     PB13  // SPI2_SCK
264
+  #define TOUCH_MISO_PIN                    PB14  // SPI2_MISO
265
+  #define TOUCH_MOSI_PIN                    PB15  // SPI2_MOSI
266
+
267
+  #define LCD_BACKLIGHT_PIN                 PD13
268
+
269
+  #endif // TFT_LITTLE_VGL_UI
270
+
271
+#endif // TFT_LVGL_UI_SPI
272
+
273
+#if HAS_SPI_LCD
274
+
275
+  #define BEEPER_PIN                        PC5
276
+  #define BTN_ENC                           PE13
277
+  #define LCD_PINS_ENABLE                   PD13
278
+  #define LCD_PINS_RS                       PC6
279
+  #define BTN_EN1                           PE8
280
+  #define BTN_EN2                           PE11
281
+  #define LCD_BACKLIGHT_PIN                 -1
282
+
283
+  // MKS MINI12864 and MKS LCD12864B; If using MKS LCD12864A (Need to remove RPK2 resistor)
284
+  #if ENABLED(MKS_MINI_12864)
285
+    #define LCD_BACKLIGHT_PIN               -1
286
+    #define LCD_RESET_PIN                   -1
287
+    #define DOGLCD_A0                       PD11
288
+    #define DOGLCD_CS                       PE15
289
+    #define DOGLCD_SCK                      PA5
290
+    #define DOGLCD_MOSI                     PA7
291
+
292
+    // Required for MKS_MINI_12864 with this board
293
+    #define MKS_LCD12864B
294
+    #undef SHOW_BOOTSCREEN
295
+
296
+  #else                                           // !MKS_MINI_12864
297
+
298
+    #define LCD_PINS_D4                     PE14
299
+    #if ENABLED(ULTIPANEL)
300
+      #define LCD_PINS_D5                   PE15
301
+      #define LCD_PINS_D6                   PD11
302
+      #define LCD_PINS_D7                   PD10
303
+    #endif
304
+
305
+    #ifndef BOARD_ST7920_DELAY_1
306
+      #define BOARD_ST7920_DELAY_1 DELAY_NS(125)
307
+    #endif
308
+    #ifndef BOARD_ST7920_DELAY_2
309
+      #define BOARD_ST7920_DELAY_2 DELAY_NS(125)
310
+    #endif
311
+    #ifndef BOARD_ST7920_DELAY_3
312
+      #define BOARD_ST7920_DELAY_3 DELAY_NS(125)
313
+    #endif
314
+
315
+  #endif // !MKS_MINI_12864
316
+
317
+#endif // HAS_SPI_LCD
318
+
319
+#define SPI_FLASH
320
+#if ENABLED(SPI_FLASH)
321
+  #define W25QXX_CS_PIN                     PB12
322
+  #define W25QXX_MOSI_PIN                   PB15
323
+  #define W25QXX_MISO_PIN                   PB14
324
+  #define W25QXX_SCK_PIN                    PB13
325
+#endif

+ 46
- 0
buildroot/share/PlatformIO/scripts/download_mks_assets.py View File

@@ -0,0 +1,46 @@
1
+Import("env")
2
+import os
3
+import requests
4
+import zipfile
5
+import tempfile
6
+import shutil
7
+
8
+url = "https://github.com/makerbase-mks/Mks-Robin-Nano-Marlin2.0-Firmware/archive/master.zip"
9
+zip_path = os.path.join(env.Dictionary("PROJECT_LIBDEPS_DIR"), "mks-assets.zip")
10
+assets_path = os.path.join(env.Dictionary("PROJECT_BUILD_DIR"), env.Dictionary("PIOENV"), "assets")
11
+
12
+def download_mks_assets():
13
+	print("Downloading MKS Assets")
14
+	r = requests.get(url, stream=True)
15
+	# the user may have a very clean workspace,
16
+	# so create the PROJECT_LIBDEPS_DIR directory if not exits
17
+	if os.path.exists(env.Dictionary("PROJECT_LIBDEPS_DIR")) == False:
18
+		os.mkdir(env.Dictionary("PROJECT_LIBDEPS_DIR"))
19
+	with open(zip_path, 'wb') as fd:
20
+		for chunk in r.iter_content(chunk_size=128):
21
+			fd.write(chunk)
22
+
23
+def copy_mks_assets():
24
+	print("Copying MKS Assets")
25
+	output_path = tempfile.mkdtemp()
26
+	zip_obj = zipfile.ZipFile(zip_path, 'r')
27
+	zip_obj.extractall(output_path)
28
+	zip_obj.close()
29
+	if os.path.exists(assets_path) == True and os.path.isdir(assets_path) == False:
30
+		os.unlink(assets_path)
31
+	if os.path.exists(assets_path) == False:
32
+		os.mkdir(assets_path)
33
+	base_path = ''
34
+	for filename in os.listdir(output_path):
35
+		base_path = filename
36
+	for filename in os.listdir(os.path.join(output_path, base_path, 'Firmware', 'mks_font')):
37
+		shutil.copy(os.path.join(output_path, base_path, 'Firmware', 'mks_font', filename), assets_path)
38
+	for filename in os.listdir(os.path.join(output_path, base_path, 'Firmware', 'mks_pic')):
39
+		shutil.copy(os.path.join(output_path, base_path, 'Firmware', 'mks_pic', filename), assets_path)
40
+	shutil.rmtree(output_path, ignore_errors=True)
41
+
42
+if os.path.exists(zip_path) == False:
43
+	download_mks_assets()
44
+
45
+if os.path.exists(assets_path) == False:
46
+	copy_mks_assets()

+ 18
- 5
platformio.ini View File

@@ -37,8 +37,9 @@ lib_deps           =
37 37
 # Feature Dependencies
38 38
 #
39 39
 [features]
40
-TFT_LVGL_UI         = MKS-LittlevGL=https://github.com/makerbase-mks/MKS-LittlevGL/archive/master.zip
40
+HAS_TFT_LVGL_UI     = lvgl=https://github.com/makerbase-mks/MKS-LittlevGL/archive/master.zip
41 41
                       src_filter=+<src/lcd/extui/lib/mks_ui>
42
+                      extra_scripts=download_mks_assets.py
42 43
 HAS_TRINAMIC_CONFIG = TMCStepper@~0.7.1
43 44
 SR_LCD_3W_NL        = SailfishLCD=https://github.com/mikeshub/SailfishLCD/archive/master.zip
44 45
 DIGIPOT_MCP4...     = SlowSoftI2CMaster
@@ -525,7 +526,7 @@ build_flags       = ${common_stm32f1.build_flags}
525 526
   -DMCU_STM32F103VE -DARDUINO_GENERIC_STM32F103V -DARDUINO_ARCH_STM32F1 -DBOARD_generic_stm32f103v
526 527
   -DDEBUG_LEVEL=DEBUG_NONE -DCONFIG_MAPLE_MINI_NO_DISABLE_DEBUG=1 -DVECT_TAB_ADDR=0x8000000
527 528
   -DERROR_LED_PORT=GPIOE -DERROR_LED_PIN=6
528
-upload_protocol = serial
529
+upload_protocol   = serial
529 530
 
530 531
 #
531 532
 # Longer 3D board in Alfawise U20 (STM32F103VET6)
@@ -555,7 +556,7 @@ build_flags   = ${common_stm32f1.build_flags}
555 556
   -DMCU_STM32F103VE
556 557
 
557 558
 #
558
-# MKS Robin Nano (STM32F103VET6) - Emulated Graphical 128x64 (DOGM) UI
559
+# MKS Robin Nano (STM32F103VET6) - Emulated Graphical 128x64 (DOGM) UI and LVGL UI
559 560
 #
560 561
 [env:mks_robin_nano]
561 562
 platform      = ${common_stm32f1.platform}
@@ -568,6 +569,18 @@ build_flags   = ${common_stm32f1.build_flags}
568 569
   -DMCU_STM32F103VE -DSS_TIMER=4
569 570
 
570 571
 #
572
+# MKS Robin Nano v2.0 (STM32F103VET6) - LVGL UI
573
+#
574
+[env:mks_robin_nano35_v2]
575
+platform        = ${common_stm32f1.platform}
576
+extends         = env:mks_robin_nano
577
+extra_scripts   = ${common.extra_scripts}
578
+  buildroot/share/PlatformIO/scripts/mks_robin_nano35.py
579
+lib_deps        = ${common_stm32f1.lib_deps}
580
+debug_tool      = jlink
581
+upload_protocol = jlink
582
+
583
+#
571 584
 # MKS Robin (STM32F103ZET6)
572 585
 #
573 586
 [env:mks_robin]
@@ -753,8 +766,8 @@ extra_scripts     = ${common.extra_scripts}
753 766
 # FYSETC S6 (STM32F446VET6 ARM Cortex-M4)
754 767
 #
755 768
 [env:FYSETC_S6]
756
-platform      = ${common_stm32.platform}
757
-extends       = common_stm32
769
+platform          = ${common_stm32.platform}
770
+extends           = common_stm32
758 771
 platform_packages = ${common_stm32.platform_packages}
759 772
    tool-stm32duino
760 773
 board             = fysetc_s6

Loading…
Cancel
Save