Browse Source

Add MKS UI (TFT_LITTLE_VGL_UI) (#18071)

makerbase 4 years ago
parent
commit
642112d3eb
No account linked to committer's email address
70 changed files with 16162 additions and 10 deletions
  1. 10
    0
      Marlin/Configuration.h
  2. 16
    0
      Marlin/src/MarlinCore.cpp
  3. 2
    0
      Marlin/src/inc/Conditionals_LCD.h
  4. 271
    0
      Marlin/src/lcd/extui/lib/mks_ui/SPI_TFT.cpp
  5. 55
    0
      Marlin/src/lcd/extui/lib/mks_ui/SPI_TFT.h
  6. 395
    0
      Marlin/src/lcd/extui/lib/mks_ui/W25Qxx.cpp
  7. 127
    0
      Marlin/src/lcd/extui/lib/mks_ui/W25Qxx.h
  8. 127
    0
      Marlin/src/lcd/extui/lib/mks_ui/draw_about.cpp
  9. 34
    0
      Marlin/src/lcd/extui/lib/mks_ui/draw_about.h
  10. 336
    0
      Marlin/src/lcd/extui/lib/mks_ui/draw_change_speed.cpp
  11. 40
    0
      Marlin/src/lcd/extui/lib/mks_ui/draw_change_speed.h
  12. 343
    0
      Marlin/src/lcd/extui/lib/mks_ui/draw_dialog.cpp
  13. 79
    0
      Marlin/src/lcd/extui/lib/mks_ui/draw_dialog.h
  14. 84
    0
      Marlin/src/lcd/extui/lib/mks_ui/draw_error_message.cpp
  15. 34
    0
      Marlin/src/lcd/extui/lib/mks_ui/draw_error_message.h
  16. 378
    0
      Marlin/src/lcd/extui/lib/mks_ui/draw_extrusion.cpp
  17. 39
    0
      Marlin/src/lcd/extui/lib/mks_ui/draw_extrusion.h
  18. 247
    0
      Marlin/src/lcd/extui/lib/mks_ui/draw_fan.cpp
  19. 35
    0
      Marlin/src/lcd/extui/lib/mks_ui/draw_fan.h
  20. 283
    0
      Marlin/src/lcd/extui/lib/mks_ui/draw_home.cpp
  21. 34
    0
      Marlin/src/lcd/extui/lib/mks_ui/draw_home.h
  22. 370
    0
      Marlin/src/lcd/extui/lib/mks_ui/draw_language.cpp
  23. 34
    0
      Marlin/src/lcd/extui/lib/mks_ui/draw_language.h
  24. 284
    0
      Marlin/src/lcd/extui/lib/mks_ui/draw_manuaLevel.cpp
  25. 34
    0
      Marlin/src/lcd/extui/lib/mks_ui/draw_manuaLevel.h
  26. 329
    0
      Marlin/src/lcd/extui/lib/mks_ui/draw_move_motor.cpp
  27. 35
    0
      Marlin/src/lcd/extui/lib/mks_ui/draw_move_motor.h
  28. 322
    0
      Marlin/src/lcd/extui/lib/mks_ui/draw_opration.cpp
  29. 34
    0
      Marlin/src/lcd/extui/lib/mks_ui/draw_opration.h
  30. 55
    0
      Marlin/src/lcd/extui/lib/mks_ui/draw_pause_message.cpp
  31. 33
    0
      Marlin/src/lcd/extui/lib/mks_ui/draw_pause_message.h
  32. 392
    0
      Marlin/src/lcd/extui/lib/mks_ui/draw_preHeat.cpp
  33. 37
    0
      Marlin/src/lcd/extui/lib/mks_ui/draw_preHeat.h
  34. 595
    0
      Marlin/src/lcd/extui/lib/mks_ui/draw_print_file.cpp
  35. 65
    0
      Marlin/src/lcd/extui/lib/mks_ui/draw_print_file.h
  36. 435
    0
      Marlin/src/lcd/extui/lib/mks_ui/draw_printing.cpp
  37. 52
    0
      Marlin/src/lcd/extui/lib/mks_ui/draw_printing.h
  38. 319
    0
      Marlin/src/lcd/extui/lib/mks_ui/draw_ready_print.cpp
  39. 39
    0
      Marlin/src/lcd/extui/lib/mks_ui/draw_ready_print.h
  40. 258
    0
      Marlin/src/lcd/extui/lib/mks_ui/draw_set.cpp
  41. 34
    0
      Marlin/src/lcd/extui/lib/mks_ui/draw_set.h
  42. 270
    0
      Marlin/src/lcd/extui/lib/mks_ui/draw_tool.cpp
  43. 34
    0
      Marlin/src/lcd/extui/lib/mks_ui/draw_tool.h
  44. 1181
    0
      Marlin/src/lcd/extui/lib/mks_ui/draw_ui.cpp
  45. 229
    0
      Marlin/src/lcd/extui/lib/mks_ui/draw_ui.h
  46. 111
    0
      Marlin/src/lcd/extui/lib/mks_ui/gb2312_puhui16.cpp
  47. 594
    0
      Marlin/src/lcd/extui/lib/mks_ui/mks_hardware_test.cpp
  48. 31
    0
      Marlin/src/lcd/extui/lib/mks_ui/mks_hardware_test.h
  49. 736
    0
      Marlin/src/lcd/extui/lib/mks_ui/pic_manager.cpp
  50. 120
    0
      Marlin/src/lcd/extui/lib/mks_ui/pic_manager.h
  51. 218
    0
      Marlin/src/lcd/extui/lib/mks_ui/printer_opration.cpp
  52. 36
    0
      Marlin/src/lcd/extui/lib/mks_ui/printer_opration.h
  53. 718
    0
      Marlin/src/lcd/extui/lib/mks_ui/tft_Language_en.h
  54. 276
    0
      Marlin/src/lcd/extui/lib/mks_ui/tft_Language_fr.h
  55. 271
    0
      Marlin/src/lcd/extui/lib/mks_ui/tft_Language_it.h
  56. 272
    0
      Marlin/src/lcd/extui/lib/mks_ui/tft_Language_ru.h
  57. 264
    0
      Marlin/src/lcd/extui/lib/mks_ui/tft_Language_s_cn.h
  58. 279
    0
      Marlin/src/lcd/extui/lib/mks_ui/tft_Language_sp.h
  59. 0
    0
      Marlin/src/lcd/extui/lib/mks_ui/tft_Language_t_cn.h
  60. 273
    0
      Marlin/src/lcd/extui/lib/mks_ui/tft_fsmc.cpp
  61. 30
    0
      Marlin/src/lcd/extui/lib/mks_ui/tft_fsmc.h
  62. 791
    0
      Marlin/src/lcd/extui/lib/mks_ui/tft_lvgl_configuration.cpp
  63. 46
    0
      Marlin/src/lcd/extui/lib/mks_ui/tft_lvgl_configuration.h
  64. 1903
    0
      Marlin/src/lcd/extui/lib/mks_ui/tft_multi_language.cpp
  65. 584
    0
      Marlin/src/lcd/extui/lib/mks_ui/tft_multi_language.h
  66. 2
    2
      Marlin/src/module/thermistor/thermistor_22.h
  67. 2
    2
      Marlin/src/module/thermistor/thermistor_23.h
  68. 109
    5
      Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO.h
  69. 40
    0
      buildroot/share/PlatformIO/scripts/mks_robin_nano35.py
  70. 17
    1
      platformio.ini

+ 10
- 0
Marlin/Configuration.h View File

@@ -2116,11 +2116,21 @@
2116 2116
 //
2117 2117
 //#define FSMC_GRAPHICAL_TFT
2118 2118
 
2119
+//
2120
+// TFT Little VGL UI
2121
+//
2122
+//#define TFT_LITTLE_VGL_UI
2123
+
2119 2124
 //=============================================================================
2120 2125
 //============================  Other Controllers  ============================
2121 2126
 //=============================================================================
2122 2127
 
2123 2128
 //
2129
+// Robin nano v2.0 SPI touch screen
2130
+//
2131
+//#define SPI_GRAPHICAL_TFT
2132
+
2133
+//
2124 2134
 // ADS7843/XPT2046 ADC Touchscreen such as ILI9341 2.8
2125 2135
 //
2126 2136
 //#define TOUCH_BUTTONS

+ 16
- 0
Marlin/src/MarlinCore.cpp View File

@@ -59,6 +59,12 @@
59 59
 #include "gcode/parser.h"
60 60
 #include "gcode/queue.h"
61 61
 
62
+#if ENABLED(TFT_LITTLE_VGL_UI)
63
+  #include "lvgl.h"
64
+  #include "lcd/extui/lib/mks_ui/inc/tft_lvgl_configuration.h"
65
+  #include "lcd/extui/lib/mks_ui/inc/draw_ui.h"
66
+#endif
67
+
62 68
 #if ENABLED(DIRECT_STEPPING)
63 69
   #include "feature/direct_stepping.h"
64 70
 #endif
@@ -726,6 +732,10 @@ void idle(TERN_(ADVANCED_PAUSE_FEATURE, bool no_stepper_sleep/*=false*/)) {
726 732
 
727 733
   // Direct Stepping
728 734
   TERN_(DIRECT_STEPPING, page_manager.write_responses());
735
+
736
+  #if ENABLED(TFT_LITTLE_VGL_UI)
737
+    LV_TASK_HANDLER();
738
+  #endif
729 739
 }
730 740
 
731 741
 /**
@@ -1141,6 +1151,10 @@ void setup() {
1141 1151
     SETUP_RUN(page_manager.init());
1142 1152
   #endif
1143 1153
 
1154
+  #if ENABLED(TFT_LITTLE_VGL_UI)
1155
+    SETUP_RUN(tft_lvgl_init());
1156
+  #endif
1157
+
1144 1158
   marlin_state = MF_RUNNING;
1145 1159
 
1146 1160
   SETUP_LOG("setup() completed.");
@@ -1173,5 +1187,7 @@ void loop() {
1173 1187
 
1174 1188
     endstops.event_handler();
1175 1189
 
1190
+    TERN_(TFT_LITTLE_VGL_UI, printer_state_polling());
1191
+
1176 1192
   } while (ENABLED(__AVR__)); // Loop forever on slower (AVR) boards
1177 1193
 }

+ 2
- 0
Marlin/src/inc/Conditionals_LCD.h View File

@@ -241,6 +241,8 @@
241 241
   #define DOGLCD
242 242
   #define IS_ULTIPANEL
243 243
   #define DELAYED_BACKLIGHT_INIT
244
+#elif ENABLED(SPI_GRAPHICAL_TFT)
245
+  #define DELAYED_BACKLIGHT_INIT
244 246
 #endif
245 247
 
246 248
 /**

+ 271
- 0
Marlin/src/lcd/extui/lib/mks_ui/SPI_TFT.cpp View File

@@ -0,0 +1,271 @@
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 <http://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+
23
+#include "../../../../inc/MarlinConfigPre.h"
24
+
25
+#if ENABLED(SPI_GRAPHICAL_TFT)
26
+
27
+  #include <SPI.h>
28
+  #include "../../../../inc/MarlinConfig.h"
29
+  #include "SPI_TFT.h"
30
+
31
+  TFT SPI_TFT;
32
+
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
51
+
52
+// 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
+  }
78
+
79
+  uint8_t TFT::spi_Rec() {
80
+    uint8_t returnByte = SPI.transfer(ff);
81
+    return returnByte;
82
+  }
83
+
84
+  uint8_t TFT::spi_read_write_byte(uint8_t data) {
85
+    uint8_t returnByte = SPI.transfer(data);
86
+    return returnByte;
87
+  }
88
+
89
+/**
90
+ * @brief  Receive a number of bytes from the SPI port to a buffer
91
+ *
92
+ * @param  buf   Pointer to starting address of buffer to write to.
93
+ * @param  nbyte Number of bytes to receive.
94
+ * @return Nothing
95
+ *
96
+ * @details Uses DMA
97
+ */
98
+  void TFT::spi_Read(uint8_t* buf, uint16_t nbyte) {SPI.dmaTransfer(0, const_cast<uint8_t*>(buf), nbyte);}
99
+
100
+/**
101
+ * @brief  Send a single byte on SPI port
102
+ *
103
+ * @param  b Byte to send
104
+ *
105
+ * @details
106
+ */
107
+  void TFT::spi_Send(uint8_t b) {SPI.send(b);}
108
+
109
+/**
110
+ * @brief  Write token and then write from 512 byte buffer to SPI (for SD card)
111
+ *
112
+ * @param  buf   Pointer with buffer start address
113
+ * @return Nothing
114
+ *
115
+ * @details Use DMA
116
+ */
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
+  }
121
+
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);
147
+  }
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);
160
+  }
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;
241
+
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;
257
+    }
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
+      // }
267
+    }
268
+    SPI_TFT_CS_H;
269
+  }
270
+
271
+#endif // SPI_GRAPHICAL_TFT

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

@@ -0,0 +1,55 @@
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 <http://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+#pragma once
23
+
24
+#include <stdint.h>
25
+
26
+#define SPI_TFT_CS_H  OUT_WRITE(SPI_TFT_CS_PIN, HIGH)
27
+#define SPI_TFT_CS_L  OUT_WRITE(SPI_TFT_CS_PIN, LOW)
28
+
29
+#define SPI_TFT_DC_H  OUT_WRITE(SPI_TFT_DC_PIN, HIGH)
30
+#define SPI_TFT_DC_L  OUT_WRITE(SPI_TFT_DC_PIN, LOW)
31
+
32
+#define SPI_TFT_RST_H OUT_WRITE(SPI_TFT_RST_PIN, HIGH)
33
+#define SPI_TFT_RST_L OUT_WRITE(SPI_TFT_RST_PIN, LOW)
34
+
35
+#define SPI_TFT_BLK_H OUT_WRITE(LCD_BACKLIGHT_PIN, HIGH)
36
+#define SPI_TFT_BLK_L OUT_WRITE(LCD_BACKLIGHT_PIN, LOW)
37
+
38
+class TFT {
39
+public:
40
+  void spi_init(uint8_t spiRate);
41
+  uint8_t spi_Rec();
42
+  uint8_t spi_read_write_byte(uint8_t data);
43
+  void spi_Read(uint8_t* buf, uint16_t nbyte);
44
+  void spi_Send(uint8_t b);
45
+  void spi_SendBlock(uint8_t token, const uint8_t* buf);
46
+  void LCD_WR_REG(uint8_t cmd);
47
+  void LCD_WR_DATA(uint8_t data);
48
+  void SetCursor(uint16_t x, uint16_t y);
49
+  void SetWindows(uint16_t x, uint16_t y, uint16_t with, uint16_t height);
50
+  void LCD_init();
51
+  void LCD_clear(uint16_t color);
52
+  void LCD_WriteRAM_Prepare();
53
+};
54
+
55
+extern TFT SPI_TFT;

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

@@ -0,0 +1,395 @@
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 <http://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+#include "../../../../inc/MarlinConfigPre.h"
23
+
24
+#if 1 // ENABLED(SPI_FLASH)
25
+#if ENABLED(TFT_LITTLE_VGL_UI)
26
+
27
+#include <SPI.h>
28
+#include "../../../../inc/MarlinConfig.h"
29
+
30
+#include "W25Qxx.h"
31
+
32
+#ifndef SPI_FLASH_MISO_PIN
33
+  #define SPI_FLASH_MISO_PIN W25QXX_MISO_PIN
34
+#endif
35
+#ifndef SPI_FLASH_MOSI_PIN
36
+  #define SPI_FLASH_MOSI_PIN W25QXX_MOSI_PIN
37
+#endif
38
+#ifndef SPI_FLASH_SCK_PIN
39
+  #define SPI_FLASH_SCK_PIN  W25QXX_SCK_PIN
40
+#endif
41
+#ifndef SPI_FLASH_CS_PIN
42
+  #define SPI_FLASH_CS_PIN   W25QXX_CS_PIN
43
+#endif
44
+
45
+#define W25QXX_CS_H OUT_WRITE(SPI_FLASH_CS_PIN, HIGH)
46
+#define W25QXX_CS_L OUT_WRITE(SPI_FLASH_CS_PIN, LOW)
47
+
48
+ext_FLASH W25QXX;
49
+
50
+void ext_FLASH::init(uint8_t spiRate) {
51
+
52
+  OUT_WRITE(SPI_FLASH_CS_PIN, HIGH);
53
+
54
+  /**
55
+   * STM32F1 APB2 = 72MHz, APB1 = 36MHz, max SPI speed of this MCU if 18Mhz
56
+   * STM32F1 has 3 SPI ports, SPI1 in APB2, SPI2/SPI3 in APB1
57
+   * so the minimum prescale of SPI1 is DIV4, SPI2/SPI3 is DIV2
58
+   */
59
+  #if SPI_DEVICE == 1
60
+    #define SPI_CLOCK_MAX SPI_CLOCK_DIV4
61
+  #else
62
+    #define SPI_CLOCK_MAX SPI_CLOCK_DIV2
63
+  #endif
64
+  uint8_t clock;
65
+  switch (spiRate) {
66
+    case SPI_FULL_SPEED:    clock = SPI_CLOCK_MAX;  break;
67
+    case SPI_HALF_SPEED:    clock = SPI_CLOCK_DIV4; break;
68
+    case SPI_QUARTER_SPEED: clock = SPI_CLOCK_DIV8; break;
69
+    case SPI_EIGHTH_SPEED:  clock = SPI_CLOCK_DIV16; break;
70
+    case SPI_SPEED_5:       clock = SPI_CLOCK_DIV32; break;
71
+    case SPI_SPEED_6:       clock = SPI_CLOCK_DIV64; break;
72
+    default:                clock = SPI_CLOCK_DIV2;// Default from the SPI library
73
+  }
74
+  SPI.setModule(SPI_DEVICE);
75
+  SPI.begin();
76
+  SPI.setClockDivider(clock);
77
+  SPI.setBitOrder(MSBFIRST);
78
+  SPI.setDataMode(SPI_MODE0);
79
+}
80
+
81
+/**
82
+ * @brief  Receive a single byte from the SPI port.
83
+ *
84
+ * @return Byte received
85
+ *
86
+ * @details
87
+ */
88
+uint8_t ext_FLASH::spi_flash_Rec() {
89
+  uint8_t returnByte = SPI.transfer(ff);
90
+  return returnByte;
91
+}
92
+
93
+uint8_t ext_FLASH::spi_flash_read_write_byte(uint8_t data) {
94
+  uint8_t returnByte = SPI.transfer(data);
95
+  return returnByte;
96
+}
97
+
98
+/**
99
+ * @brief  Receive a number of bytes from the SPI port to a buffer
100
+ *
101
+ * @param  buf   Pointer to starting address of buffer to write to.
102
+ * @param  nbyte Number of bytes to receive.
103
+ * @return Nothing
104
+ *
105
+ * @details Uses DMA
106
+ */
107
+void ext_FLASH::spi_flash_Read(uint8_t* buf, uint16_t nbyte) { SPI.dmaTransfer(0, const_cast<uint8_t*>(buf), nbyte); }
108
+
109
+/**
110
+ * @brief  Send a single byte on SPI port
111
+ *
112
+ * @param  b Byte to send
113
+ *
114
+ * @details
115
+ */
116
+void ext_FLASH::spi_flash_Send(uint8_t b) { SPI.send(b); }
117
+
118
+/**
119
+ * @brief  Write token and then write from 512 byte buffer to SPI (for SD card)
120
+ *
121
+ * @param  buf   Pointer with buffer start address
122
+ * @return Nothing
123
+ *
124
+ * @details Use DMA
125
+ */
126
+void ext_FLASH::spi_flash_SendBlock(uint8_t token, const uint8_t* buf) {
127
+  SPI.send(token);
128
+  SPI.dmaSend(const_cast<uint8_t*>(buf), 512);
129
+}
130
+
131
+uint16_t ext_FLASH::W25QXX_ReadID(void) {
132
+  uint16_t Temp = 0;
133
+  W25QXX_CS_L;
134
+  spi_flash_Send(0x90);//���Ͷ�ȡID����
135
+  spi_flash_Send(0x00);
136
+  spi_flash_Send(0x00);
137
+  spi_flash_Send(0x00);
138
+  Temp |= spi_flash_Rec() << 8;
139
+  Temp |= spi_flash_Rec();
140
+  W25QXX_CS_H;
141
+  return Temp;
142
+}
143
+
144
+void ext_FLASH::SPI_FLASH_WriteEnable(void) {
145
+  /* Select the FLASH: Chip Select low */
146
+  W25QXX_CS_L;
147
+  /* Send "Write Enable" instruction */
148
+  spi_flash_Send(W25X_WriteEnable);
149
+  /* Deselect the FLASH: Chip Select high */
150
+  W25QXX_CS_H;
151
+}
152
+
153
+/*******************************************************************************
154
+* Function Name  : SPI_FLASH_WaitForWriteEnd
155
+* Description    : Polls the status of the Write In Progress (WIP) flag in the
156
+*                  FLASH's status  register  and  loop  until write  opertaion
157
+*                  has completed.
158
+* Input          : None
159
+* Output         : None
160
+* Return         : None
161
+*******************************************************************************/
162
+void ext_FLASH::SPI_FLASH_WaitForWriteEnd(void) {
163
+  uint8_t FLASH_Status = 0;
164
+
165
+  /* Select the FLASH: Chip Select low */
166
+  W25QXX_CS_L;
167
+  /* Send "Read Status Register" instruction */
168
+  spi_flash_Send(W25X_ReadStatusReg);
169
+
170
+  /* Loop as long as the memory is busy with a write cycle */
171
+  do
172
+    /* Send a dummy byte to generate the clock needed by the FLASH
173
+    and put the value of the status register in FLASH_Status variable */
174
+    FLASH_Status = spi_flash_Rec();
175
+  while ((FLASH_Status & WIP_Flag) == 0x01); /* Write in progress */
176
+
177
+  /* Deselect the FLASH: Chip Select high */
178
+  W25QXX_CS_H;
179
+}
180
+
181
+void ext_FLASH::SPI_FLASH_SectorErase(uint32_t SectorAddr) {
182
+  /* Send write enable instruction */
183
+  SPI_FLASH_WriteEnable();
184
+
185
+  /* Sector Erase */
186
+  /* Select the FLASH: Chip Select low */
187
+  W25QXX_CS_L;
188
+  /* Send Sector Erase instruction */
189
+  spi_flash_Send(W25X_SectorErase);
190
+  /* Send SectorAddr high nibble address byte */
191
+  spi_flash_Send((SectorAddr & 0xFF0000) >> 16);
192
+  /* Send SectorAddr medium nibble address byte */
193
+  spi_flash_Send((SectorAddr & 0xFF00) >> 8);
194
+  /* Send SectorAddr low nibble address byte */
195
+  spi_flash_Send(SectorAddr & 0xFF);
196
+  /* Deselect the FLASH: Chip Select high */
197
+
198
+  W25QXX_CS_H;
199
+  /* Wait the end of Flash writing */
200
+  SPI_FLASH_WaitForWriteEnd();
201
+}
202
+
203
+void ext_FLASH::SPI_FLASH_BlockErase(uint32_t BlockAddr) {
204
+  SPI_FLASH_WriteEnable();
205
+  W25QXX_CS_L;
206
+  /* Send Sector Erase instruction */
207
+  spi_flash_Send(W25X_BlockErase);
208
+  /* Send SectorAddr high nibble address byte */
209
+  spi_flash_Send((BlockAddr & 0xFF0000) >> 16);
210
+  /* Send SectorAddr medium nibble address byte */
211
+  spi_flash_Send((BlockAddr & 0xFF00) >> 8);
212
+  /* Send SectorAddr low nibble address byte */
213
+  spi_flash_Send(BlockAddr & 0xFF);
214
+
215
+  W25QXX_CS_H;
216
+
217
+  SPI_FLASH_WaitForWriteEnd();
218
+}
219
+
220
+/*******************************************************************************
221
+* Function Name  : SPI_FLASH_BulkErase
222
+* Description    : Erases the entire FLASH.
223
+* Input          : None
224
+* Output         : None
225
+* Return         : None
226
+*******************************************************************************/
227
+void ext_FLASH::SPI_FLASH_BulkErase(void) {
228
+  /* Send write enable instruction */
229
+  SPI_FLASH_WriteEnable();
230
+
231
+  /* Bulk Erase */
232
+  /* Select the FLASH: Chip Select low */
233
+  W25QXX_CS_L;
234
+
235
+  /* Send Bulk Erase instruction  */
236
+  spi_flash_Send(W25X_ChipErase);
237
+  /* Deselect the FLASH: Chip Select high */
238
+  W25QXX_CS_H;
239
+  /* Wait the end of Flash writing */
240
+  SPI_FLASH_WaitForWriteEnd();
241
+}
242
+
243
+/*******************************************************************************
244
+* Function Name  : SPI_FLASH_PageWrite
245
+* Description    : Writes more than one byte to the FLASH with a single WRITE
246
+*                  cycle(Page WRITE sequence). The number of byte can't exceed
247
+*                  the FLASH page size.
248
+* Input          : - pBuffer : pointer to the buffer  containing the data to be
249
+*                    written to the FLASH.
250
+*                  - WriteAddr : FLASH's internal address to write to.
251
+*                  - NumByteToWrite : number of bytes to write to the FLASH,
252
+*                    must be equal or less than "SPI_FLASH_PageSize" value.
253
+* Output         : None
254
+* Return         : None
255
+*******************************************************************************/
256
+void ext_FLASH::SPI_FLASH_PageWrite(uint8_t* pBuffer, uint32_t WriteAddr, uint16_t NumByteToWrite) {
257
+  /* Enable the write access to the FLASH */
258
+  SPI_FLASH_WriteEnable();
259
+
260
+  /* Select the FLASH: Chip Select low */
261
+  W25QXX_CS_L;
262
+  /* Send "Write to Memory " instruction */
263
+  spi_flash_Send(W25X_PageProgram);
264
+  /* Send WriteAddr high nibble address byte to write to */
265
+  spi_flash_Send((WriteAddr & 0xFF0000) >> 16);
266
+  /* Send WriteAddr medium nibble address byte to write to */
267
+  spi_flash_Send((WriteAddr & 0xFF00) >> 8);
268
+  /* Send WriteAddr low nibble address byte to write to */
269
+  spi_flash_Send(WriteAddr & 0xFF);
270
+
271
+  NOMORE(NumByteToWrite, SPI_FLASH_PerWritePageSize);
272
+
273
+  /* while there is data to be written on the FLASH */
274
+  while (NumByteToWrite--) {
275
+    /* Send the current byte */
276
+    spi_flash_Send(*pBuffer);
277
+    /* Point on the next byte to be written */
278
+    pBuffer++;
279
+  }
280
+
281
+  /* Deselect the FLASH: Chip Select high */
282
+  W25QXX_CS_H;
283
+
284
+  /* Wait the end of Flash writing */
285
+  SPI_FLASH_WaitForWriteEnd();
286
+}
287
+
288
+/*******************************************************************************
289
+* Function Name  : SPI_FLASH_BufferWrite
290
+* Description    : Writes block of data to the FLASH. In this function, the
291
+*                  number of WRITE cycles are reduced, using Page WRITE sequence.
292
+* Input          : - pBuffer : pointer to the buffer  containing the data to be
293
+*                    written to the FLASH.
294
+*                  - WriteAddr : FLASH's internal address to write to.
295
+*                  - NumByteToWrite : number of bytes to write to the FLASH.
296
+* Output         : None
297
+* Return         : None
298
+*******************************************************************************/
299
+void ext_FLASH::SPI_FLASH_BufferWrite(uint8_t* pBuffer, uint32_t WriteAddr, uint16_t NumByteToWrite) {
300
+  uint8_t NumOfPage = 0, NumOfSingle = 0, Addr = 0, count = 0, temp = 0;
301
+
302
+  Addr = WriteAddr % SPI_FLASH_PageSize;
303
+  count = SPI_FLASH_PageSize - Addr;
304
+  NumOfPage = NumByteToWrite / SPI_FLASH_PageSize;
305
+  NumOfSingle = NumByteToWrite % SPI_FLASH_PageSize;
306
+
307
+  if (Addr == 0) { /* WriteAddr is SPI_FLASH_PageSize aligned  */
308
+    if (NumOfPage == 0) { /* NumByteToWrite < SPI_FLASH_PageSize */
309
+      SPI_FLASH_PageWrite(pBuffer, WriteAddr, NumByteToWrite);
310
+    }
311
+    else { /* NumByteToWrite > SPI_FLASH_PageSize */
312
+      while (NumOfPage--) {
313
+        SPI_FLASH_PageWrite(pBuffer, WriteAddr, SPI_FLASH_PageSize);
314
+        WriteAddr += SPI_FLASH_PageSize;
315
+        pBuffer += SPI_FLASH_PageSize;
316
+      }
317
+      SPI_FLASH_PageWrite(pBuffer, WriteAddr, NumOfSingle);
318
+    }
319
+  }
320
+  else { /* WriteAddr is not SPI_FLASH_PageSize aligned  */
321
+    if (NumOfPage == 0) { /* NumByteToWrite < SPI_FLASH_PageSize */
322
+      if (NumOfSingle > count) { /* (NumByteToWrite + WriteAddr) > SPI_FLASH_PageSize */
323
+        temp = NumOfSingle - count;
324
+        SPI_FLASH_PageWrite(pBuffer, WriteAddr, count);
325
+        WriteAddr += count;
326
+        pBuffer += count;
327
+        SPI_FLASH_PageWrite(pBuffer, WriteAddr, temp);
328
+      }
329
+      else {
330
+        SPI_FLASH_PageWrite(pBuffer, WriteAddr, NumByteToWrite);
331
+      }
332
+    }
333
+    else { /* NumByteToWrite > SPI_FLASH_PageSize */
334
+      NumByteToWrite -= count;
335
+      NumOfPage = NumByteToWrite / SPI_FLASH_PageSize;
336
+      NumOfSingle = NumByteToWrite % SPI_FLASH_PageSize;
337
+
338
+      SPI_FLASH_PageWrite(pBuffer, WriteAddr, count);
339
+      WriteAddr += count;
340
+      pBuffer += count;
341
+
342
+      while (NumOfPage--) {
343
+        SPI_FLASH_PageWrite(pBuffer, WriteAddr, SPI_FLASH_PageSize);
344
+        WriteAddr += SPI_FLASH_PageSize;
345
+        pBuffer += SPI_FLASH_PageSize;
346
+      }
347
+
348
+      if (NumOfSingle != 0)
349
+        SPI_FLASH_PageWrite(pBuffer, WriteAddr, NumOfSingle);
350
+    }
351
+  }
352
+}
353
+
354
+/*******************************************************************************
355
+* Function Name  : SPI_FLASH_BufferRead
356
+* Description    : Reads a block of data from the FLASH.
357
+* Input          : - pBuffer : pointer to the buffer that receives the data read
358
+*                    from the FLASH.
359
+*                  - ReadAddr : FLASH's internal address to read from.
360
+*                  - NumByteToRead : number of bytes to read from the FLASH.
361
+* Output         : None
362
+* Return         : None
363
+*******************************************************************************/
364
+void ext_FLASH::SPI_FLASH_BufferRead(uint8_t* pBuffer, uint32_t ReadAddr, uint16_t NumByteToRead) {
365
+  /* Select the FLASH: Chip Select low */
366
+  W25QXX_CS_L;
367
+
368
+  /* Send "Read from Memory " instruction */
369
+  spi_flash_Send(W25X_ReadData);
370
+
371
+  /* Send ReadAddr high nibble address byte to read from */
372
+  spi_flash_Send((ReadAddr & 0xFF0000) >> 16);
373
+  /* Send ReadAddr medium nibble address byte to read from */
374
+  spi_flash_Send((ReadAddr & 0xFF00) >> 8);
375
+  /* Send ReadAddr low nibble address byte to read from */
376
+  spi_flash_Send(ReadAddr & 0xFF);
377
+
378
+  if (NumByteToRead < 33) {
379
+    while (NumByteToRead--) { /* while there is data to be read */
380
+      /* Read a byte from the FLASH */
381
+      *pBuffer = spi_flash_Rec();
382
+      /* Point to the next location where the byte read will be saved */
383
+      pBuffer++;
384
+    }
385
+  }
386
+  else {
387
+    spi_flash_Read(pBuffer, NumByteToRead);
388
+  }
389
+  W25QXX_CS_H;
390
+}
391
+
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
+
394
+#endif // TFT_LITTLE_VGL_UI
395
+#endif // 1 ... SPI_FLASH

+ 127
- 0
Marlin/src/lcd/extui/lib/mks_ui/W25Qxx.h View File

@@ -0,0 +1,127 @@
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 <http://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+#pragma once
23
+
24
+//#ifdef __cplusplus
25
+//extern "C" { /* C-declarations for C++ */
26
+//#endif
27
+
28
+#include <stdint.h>
29
+
30
+#define W25X_WriteEnable        0x06
31
+#define W25X_WriteDisable       0x04
32
+#define W25X_ReadStatusReg      0x05
33
+#define W25X_WriteStatusReg     0x01
34
+#define W25X_ReadData           0x03
35
+#define W25X_FastReadData       0x0B
36
+#define W25X_FastReadDual       0x3B
37
+#define W25X_PageProgram        0x02
38
+#define W25X_BlockErase         0xD8
39
+#define W25X_SectorErase        0x20
40
+#define W25X_ChipErase          0xC7
41
+#define W25X_PowerDown          0xB9
42
+#define W25X_ReleasePowerDown   0xAB
43
+#define W25X_DeviceID           0xAB
44
+#define W25X_ManufactDeviceID   0x90
45
+#define W25X_JedecDeviceID      0x9F
46
+
47
+#define WIP_Flag                0x01  /* Write In Progress (WIP) flag */
48
+
49
+#define Dummy_Byte              0xA5
50
+
51
+#define SPI_FLASH_SectorSize         4096
52
+#define SPI_FLASH_PageSize           256
53
+#define SPI_FLASH_PerWritePageSize   256
54
+
55
+#if 0
56
+
57
+  #define PIC_NAME_MAX_LEN        50
58
+
59
+  #define LOGO_MAX_SIZE           (300*1024)//logo���ֵ
60
+  #define TITLELOGO_MAX_SIZE      (150*1024)//logo���ֵ
61
+  #define DEFAULT_VIEW_MAX_SIZE   (200*200*2)
62
+  #define FLASH_VIEW_MAX_SIZE     (200*200*2)
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  //ͼƬ���ݴ洢��ַ
71
+
72
+  #define DEFAULT_VIEW_ADDR       0XC5800
73
+  #define BAK_VIEW_ADDR           (DEFAULT_VIEW_ADDR+90*1024)
74
+  #define PIC_ICON_LOGO_ADDR      (BAK_VIEW_ADDR+80*1024)
75
+
76
+  #define PIC_DATA_ADDR           (PIC_ICON_LOGO_ADDR+350*1024) //ͼƬ���ݴ洢��ַ//(800*240)
77
+
78
+  // �ֿ�
79
+  #define FONTINFOADDR            0x600000 // 6M�Ժ��ַΪ�ֿ�
80
+  #define UNIGBK_FLASH_ADDR       (FONTINFOADDR+4096) // 4*1024
81
+  #define GBK_FLASH_ADDR          (UNIGBK_FLASH_ADDR+180224) // 176*1024
82
+
83
+  #define PER_PIC_MAX_SPACE       (32*1024) // Ϊ�˷�ֹ����Խ������⣬ÿ��СͼƬ�����仮��Ӧ��ȡ�ܹ�����4K��ֵ
84
+
85
+  //
86
+  union union32 {
87
+    uint8_t bytes[4];
88
+    uint32_t dwords;
89
+  };
90
+  // ͼƬ��Ϣ�ṹ��
91
+  struct pic_msg {
92
+    uint8_t name[PIC_NAME_MAX_LEN];
93
+    union union32 size;
94
+  };
95
+
96
+  typedef struct pic_msg PIC_MSG;
97
+
98
+#endif // if 0
99
+
100
+class ext_FLASH {
101
+public:
102
+  void init(uint8_t spiRate);
103
+  static uint8_t spi_flash_Rec();
104
+  static uint8_t spi_flash_read_write_byte(uint8_t data);
105
+  static void spi_flash_Read(uint8_t* buf, uint16_t nbyte);
106
+  static void spi_flash_Send(uint8_t b);
107
+  static void spi_flash_SendBlock(uint8_t token, const uint8_t* buf);
108
+  static uint16_t W25QXX_ReadID(void);
109
+  static void SPI_FLASH_WriteEnable(void);
110
+  static void SPI_FLASH_WaitForWriteEnd(void);
111
+  static void SPI_FLASH_SectorErase(uint32_t SectorAddr);
112
+  static void SPI_FLASH_BlockErase(uint32_t BlockAddr);
113
+  static void SPI_FLASH_BulkErase(void);
114
+  static void SPI_FLASH_PageWrite(uint8_t* pBuffer, uint32_t WriteAddr, uint16_t NumByteToWrite);
115
+  static void SPI_FLASH_BufferWrite(uint8_t* pBuffer, uint32_t WriteAddr, uint16_t NumByteToWrite);
116
+  static void SPI_FLASH_BufferRead(uint8_t* pBuffer, uint32_t ReadAddr, uint16_t NumByteToRead);
117
+  //uint32_t lv_get_pic_addr(uint8_t *Pname);
118
+  void lv_pic_read(uint8_t *P_Rbuff, uint32_t addr, uint32_t size);
119
+};
120
+
121
+extern ext_FLASH W25QXX;
122
+
123
+//extern uint32_t lv_get_pic_addr(uint8_t *Pname);
124
+
125
+//#ifdef __cplusplus
126
+//} /* C-declarations for C++ */
127
+//#endif

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

@@ -0,0 +1,127 @@
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 <http://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+#include "../../../../inc/MarlinConfigPre.h"
23
+
24
+#if ENABLED(TFT_LITTLE_VGL_UI)
25
+
26
+#include "lv_conf.h"
27
+#include "draw_ui.h"
28
+//#include "../lvgl/src/lv_objx/lv_imgbtn.h"
29
+//#include "../lvgl/src/lv_objx/lv_img.h"
30
+//#include "../lvgl/src/lv_core/lv_disp.h"
31
+//#include "../lvgl/src/lv_core/lv_refr.h"
32
+
33
+#include "../../../../MarlinCore.h"
34
+#include "../../../../module/temperature.h"
35
+
36
+static lv_obj_t * scr;
37
+static lv_obj_t * fw_type, *board, *fw_version;
38
+
39
+#define ID_A_RETURN   1
40
+
41
+static void event_handler(lv_obj_t * obj, lv_event_t event) {
42
+  switch (obj->mks_obj_id) {
43
+    case ID_A_RETURN:
44
+      if (event == LV_EVENT_CLICKED) {
45
+        // do nothing
46
+      }
47
+      else if (event == LV_EVENT_RELEASED) {
48
+        clear_cur_ui();
49
+        draw_return_ui();
50
+      }
51
+      break;
52
+  }
53
+}
54
+
55
+void lv_draw_about(void) {
56
+  lv_obj_t *buttonBack, *label_Back;
57
+  if (disp_state_stack._disp_state[disp_state_stack._disp_index] != ABOUT_UI) {
58
+    disp_state_stack._disp_index++;
59
+    disp_state_stack._disp_state[disp_state_stack._disp_index] = ABOUT_UI;
60
+  }
61
+  disp_state = ABOUT_UI;
62
+
63
+  scr = lv_obj_create(NULL, NULL);
64
+
65
+  lv_obj_set_style(scr, &tft_style_scr);
66
+  lv_scr_load(scr);
67
+  lv_obj_clean(scr);
68
+
69
+  lv_obj_t * title = lv_label_create(scr, NULL);
70
+  lv_obj_set_style(title, &tft_style_lable_rel);
71
+  lv_obj_set_pos(title, TITLE_XPOS, TITLE_YPOS);
72
+  lv_label_set_text(title, creat_title_text());
73
+
74
+  lv_refr_now(lv_refr_get_disp_refreshing());
75
+
76
+  LV_IMG_DECLARE(bmp_pic);
77
+
78
+  /*Create an Image button*/
79
+  buttonBack = lv_imgbtn_create(scr, NULL);
80
+
81
+  #if 1
82
+    lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_A_RETURN, "bmp_Return.bin", 0);
83
+    lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_REL, &bmp_pic);
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);
87
+  #endif
88
+
89
+  lv_obj_set_pos(buttonBack, BTN_X_PIXEL * 3 + INTERVAL_V * 4,  BTN_Y_PIXEL + INTERVAL_H + titleHeight);
90
+  lv_btn_set_layout(buttonBack, LV_LAYOUT_OFF);
91
+  /*Create a label on the Image button*/
92
+
93
+  label_Back = lv_label_create(buttonBack, NULL);
94
+
95
+  if (gCfgItems.multiple_language != 0) {
96
+    lv_label_set_text(label_Back, common_menu.text_back);
97
+    lv_obj_align(label_Back, buttonBack, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
98
+  }
99
+
100
+  fw_version = lv_label_create(scr, NULL);
101
+  lv_obj_set_style(fw_version, &tft_style_lable_rel);
102
+  lv_label_set_text(fw_version, "Version: V_2.0.5.3");
103
+  lv_obj_align(fw_version, NULL, LV_ALIGN_CENTER, 0, -60);
104
+
105
+  fw_type = lv_label_create(scr, NULL);
106
+  lv_obj_set_style(fw_type, &tft_style_lable_rel);
107
+  #if (MOTHERBOARD == BOARD_MKS_ROBIN_PRO)
108
+    lv_label_set_text(fw_type, "Firmware: Robin_Pro35");
109
+  #elif (MOTHERBOARD == BOARD_MKS_ROBIN_NANO)
110
+    lv_label_set_text(fw_type, "Firmware: Robin_Nano35");
111
+  #endif
112
+  lv_obj_align(fw_type, NULL, LV_ALIGN_CENTER, 0, -20);
113
+
114
+  board = lv_label_create(scr, NULL);
115
+  lv_obj_set_style(board, &tft_style_lable_rel);
116
+  #if (MOTHERBOARD == BOARD_MKS_ROBIN_PRO)
117
+    lv_label_set_text(board, "Board: MKS Robin pro");
118
+  #elif (MOTHERBOARD == BOARD_MKS_ROBIN_NANO)
119
+    lv_label_set_text(board, "Board: MKS Robin nano");
120
+  #endif
121
+
122
+  lv_obj_align(board, NULL, LV_ALIGN_CENTER, 0, 20);
123
+}
124
+
125
+void lv_clear_about() { lv_obj_del(scr); }
126
+
127
+#endif // TFT_LITTLE_VGL_UI

+ 34
- 0
Marlin/src/lcd/extui/lib/mks_ui/draw_about.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 <http://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_about(void);
29
+extern void lv_clear_about();
30
+
31
+//extern void disp_temp_ready_print();
32
+#ifdef __cplusplus
33
+} /* C-declarations for C++ */
34
+#endif

+ 336
- 0
Marlin/src/lcd/extui/lib/mks_ui/draw_change_speed.cpp View File

@@ -0,0 +1,336 @@
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 <http://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+#include "../../../../inc/MarlinConfigPre.h"
23
+
24
+#if ENABLED(TFT_LITTLE_VGL_UI)
25
+
26
+#include "lv_conf.h"
27
+#include "draw_ui.h"
28
+//#include "../lvgl/src/lv_objx/lv_imgbtn.h"
29
+//#include "../lvgl/src/lv_objx/lv_img.h"
30
+//#include "../lvgl/src/lv_core/lv_disp.h"
31
+//#include "../lvgl/src/lv_core/lv_refr.h"
32
+
33
+#include "../../../../MarlinCore.h"
34
+#include "../../../../module/temperature.h"
35
+#include "../../../../module/planner.h"
36
+
37
+static lv_obj_t * scr;
38
+static lv_obj_t * labelStep, *buttonStep, *buttonMov, *buttonExt;
39
+static lv_obj_t * labelMov, *labelExt;
40
+static lv_obj_t * printSpeedText;
41
+
42
+#define ID_C_ADD    1
43
+#define ID_C_DEC    2
44
+#define ID_C_MOVE   3
45
+#define ID_C_EXT    4
46
+#define ID_C_STEP   5
47
+#define ID_C_RETURN   6
48
+
49
+static uint8_t speedType;
50
+
51
+static void event_handler(lv_obj_t * obj, lv_event_t event) {
52
+  switch (obj->mks_obj_id) {
53
+    case ID_C_ADD:
54
+      if (event == LV_EVENT_CLICKED) {
55
+        // nothing to do
56
+      }
57
+      else if (event == LV_EVENT_RELEASED) {
58
+        if (speedType == 0) {
59
+          if (feedrate_percentage < MAX_EXT_SPEED_PERCENT - uiCfg.stepPrintSpeed)
60
+            feedrate_percentage += uiCfg.stepPrintSpeed;
61
+          else
62
+            feedrate_percentage = MAX_EXT_SPEED_PERCENT;
63
+        }
64
+        else if (speedType == 1) {
65
+          if (planner.flow_percentage[0] < MAX_EXT_SPEED_PERCENT - uiCfg.stepPrintSpeed)
66
+            planner.flow_percentage[0] += uiCfg.stepPrintSpeed;
67
+          else
68
+            planner.flow_percentage[0] = MAX_EXT_SPEED_PERCENT;
69
+          //planner.e_factor[0]= planner.flow_percentage[0]*0.01;
70
+          //planner.flow_percentage[1] = planner.flow_percentage[0];
71
+          //planner.e_factor[1]= planner.flow_percentage[1]*0.01;
72
+          planner.refresh_e_factor(0);
73
+          if (EXTRUDERS == 2) {
74
+            planner.flow_percentage[1] = planner.flow_percentage[0];
75
+            planner.refresh_e_factor(1);
76
+          }
77
+        }
78
+        disp_print_speed();
79
+      }
80
+      break;
81
+    case ID_C_DEC:
82
+      if (event == LV_EVENT_CLICKED) {
83
+        // nothing to do
84
+      }
85
+      else if (event == LV_EVENT_RELEASED) {
86
+        if (speedType == 0) {
87
+          if (feedrate_percentage > MIN_EXT_SPEED_PERCENT + uiCfg.stepPrintSpeed)
88
+            feedrate_percentage -= uiCfg.stepPrintSpeed;
89
+          else
90
+            feedrate_percentage = MIN_EXT_SPEED_PERCENT;
91
+        }
92
+        else if (speedType == 1) {
93
+          if (planner.flow_percentage[0] > MIN_EXT_SPEED_PERCENT + uiCfg.stepPrintSpeed)
94
+            planner.flow_percentage[0] -= uiCfg.stepPrintSpeed;
95
+          else
96
+            planner.flow_percentage[0] = MIN_EXT_SPEED_PERCENT;
97
+          //planner.e_factor[0]= planner.flow_percentage[0] * 0.01;
98
+          //planner.flow_percentage[1] = planner.flow_percentage[0];
99
+          //planner.e_factor[1]= planner.flow_percentage[1] * 0.01;
100
+          planner.refresh_e_factor(0);
101
+          if (EXTRUDERS == 2) {
102
+            planner.flow_percentage[1] = planner.flow_percentage[0];
103
+            planner.refresh_e_factor(1);
104
+          }
105
+        }
106
+        disp_print_speed();
107
+      }
108
+      break;
109
+    case ID_C_MOVE:
110
+      if (event == LV_EVENT_CLICKED) {
111
+        // nothing to do
112
+      }
113
+      else if (event == LV_EVENT_RELEASED) {
114
+        speedType = 0;
115
+        disp_speed_type();
116
+        disp_print_speed();
117
+      }
118
+      break;
119
+    case ID_C_EXT:
120
+      if (event == LV_EVENT_CLICKED) {
121
+        // nothing to do
122
+      }
123
+      else if (event == LV_EVENT_RELEASED) {
124
+        speedType = 1;
125
+        disp_speed_type();
126
+        disp_print_speed();
127
+      }
128
+      break;
129
+    case ID_C_STEP:
130
+      if (event == LV_EVENT_CLICKED) {
131
+
132
+      }
133
+      else if (event == LV_EVENT_RELEASED) {
134
+        if (uiCfg.stepPrintSpeed == 1)
135
+          uiCfg.stepPrintSpeed = 5;
136
+        else if (uiCfg.stepPrintSpeed == 5)
137
+          uiCfg.stepPrintSpeed = 10;
138
+        else
139
+          uiCfg.stepPrintSpeed = 1;
140
+        disp_speed_step();
141
+      }
142
+      break;
143
+    case ID_C_RETURN:
144
+      if (event == LV_EVENT_CLICKED) {
145
+        // nothing to do
146
+      }
147
+      else if (event == LV_EVENT_RELEASED) {
148
+        clear_cur_ui();
149
+        draw_return_ui();
150
+      }
151
+      break;
152
+  }
153
+}
154
+
155
+void lv_draw_change_speed(void) {
156
+  lv_obj_t *buttonAdd, *buttonDec;
157
+  lv_obj_t *buttonBack;
158
+
159
+  if (disp_state_stack._disp_state[disp_state_stack._disp_index] != CHANGE_SPEED_UI) {
160
+    disp_state_stack._disp_index++;
161
+    disp_state_stack._disp_state[disp_state_stack._disp_index] = CHANGE_SPEED_UI;
162
+  }
163
+  disp_state = CHANGE_SPEED_UI;
164
+
165
+  scr = lv_obj_create(NULL, NULL);
166
+
167
+  lv_obj_set_style(scr, &tft_style_scr);
168
+  lv_scr_load(scr);
169
+  lv_obj_clean(scr);
170
+
171
+  lv_obj_t * title = lv_label_create(scr, NULL);
172
+  lv_obj_set_style(title, &tft_style_lable_rel);
173
+  lv_obj_set_pos(title, TITLE_XPOS, TITLE_YPOS);
174
+  lv_label_set_text(title, creat_title_text());
175
+
176
+  lv_refr_now(lv_refr_get_disp_refreshing());
177
+
178
+  LV_IMG_DECLARE(bmp_pic);
179
+
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);
185
+  buttonStep = lv_imgbtn_create(scr, NULL);
186
+  buttonBack = lv_imgbtn_create(scr, NULL);
187
+
188
+  lv_obj_set_event_cb_mks(buttonAdd, event_handler, ID_C_ADD, "bmp_Add.bin", 0);
189
+  lv_imgbtn_set_src(buttonAdd, LV_BTN_STATE_REL, &bmp_pic);
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);
193
+  lv_obj_clear_protect(buttonAdd, LV_PROTECT_FOLLOW);
194
+
195
+  #if 1
196
+    lv_obj_set_event_cb_mks(buttonDec, event_handler, ID_C_DEC, "bmp_Dec.bin", 0);
197
+    lv_imgbtn_set_src(buttonDec, LV_BTN_STATE_REL, &bmp_pic);
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
+
202
+
203
+    lv_imgbtn_set_src(buttonMov, LV_BTN_STATE_REL, &bmp_pic);
204
+    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);
207
+
208
+    lv_imgbtn_set_src(buttonExt, LV_BTN_STATE_REL, &bmp_pic);
209
+    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);
212
+
213
+    lv_imgbtn_set_src(buttonStep, LV_BTN_STATE_REL, &bmp_pic);
214
+    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);
217
+
218
+    lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_C_RETURN, "bmp_Return.bin", 0);
219
+    lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_REL, &bmp_pic);
220
+    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);
223
+  #endif
224
+
225
+  lv_obj_set_pos(buttonAdd, INTERVAL_V, titleHeight);
226
+  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);
228
+  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);
231
+
232
+  /*Create a label on the Image button*/
233
+  lv_btn_set_layout(buttonAdd, LV_LAYOUT_OFF);
234
+  lv_btn_set_layout(buttonDec, LV_LAYOUT_OFF);
235
+  lv_btn_set_layout(buttonMov, LV_LAYOUT_OFF);
236
+  lv_btn_set_layout(buttonExt, LV_LAYOUT_OFF);
237
+  lv_btn_set_layout(buttonStep, LV_LAYOUT_OFF);
238
+  lv_btn_set_layout(buttonBack, LV_LAYOUT_OFF);
239
+
240
+  lv_obj_t * labelAdd = lv_label_create(buttonAdd, NULL);
241
+  lv_obj_t * labelDec = lv_label_create(buttonDec, NULL);
242
+  labelMov = lv_label_create(buttonMov, NULL);
243
+  labelExt = lv_label_create(buttonExt, NULL);
244
+  labelStep = lv_label_create(buttonStep, NULL);
245
+  lv_obj_t * label_Back = lv_label_create(buttonBack, NULL);
246
+
247
+  if (gCfgItems.multiple_language != 0) {
248
+    lv_label_set_text(labelAdd, speed_menu.add);
249
+    lv_obj_align(labelAdd, buttonAdd, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
250
+
251
+    lv_label_set_text(labelDec, speed_menu.dec);
252
+    lv_obj_align(labelDec, buttonDec, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
253
+
254
+    lv_label_set_text(label_Back, common_menu.text_back);
255
+    lv_obj_align(label_Back, buttonBack, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
256
+  }
257
+  disp_speed_type();
258
+  disp_speed_step();
259
+
260
+  printSpeedText = lv_label_create(scr, NULL);
261
+  lv_obj_set_style(printSpeedText, &tft_style_lable_rel);
262
+  disp_print_speed();
263
+}
264
+
265
+void disp_speed_step() {
266
+  if (uiCfg.stepPrintSpeed == 1)
267
+    lv_obj_set_event_cb_mks(buttonStep, event_handler, ID_C_STEP, "bmp_Step1_percent.bin", 0);
268
+  else if (uiCfg.stepPrintSpeed == 5)
269
+    lv_obj_set_event_cb_mks(buttonStep, event_handler, ID_C_STEP, "bmp_Step5_percent.bin", 0);
270
+  else if (uiCfg.stepPrintSpeed == 10)
271
+    lv_obj_set_event_cb_mks(buttonStep, event_handler, ID_C_STEP, "bmp_Step10_percent.bin", 0);
272
+
273
+  if (gCfgItems.multiple_language != 0) {
274
+    if (uiCfg.stepPrintSpeed == 1) {
275
+      lv_label_set_text(labelStep, speed_menu.step_1percent);
276
+      lv_obj_align(labelStep, buttonStep, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
277
+    }
278
+    else if (uiCfg.stepPrintSpeed == 5) {
279
+      lv_label_set_text(labelStep, speed_menu.step_5percent);
280
+      lv_obj_align(labelStep, buttonStep, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
281
+    }
282
+    else if (uiCfg.stepPrintSpeed == 10) {
283
+      lv_label_set_text(labelStep, speed_menu.step_10percent);
284
+      lv_obj_align(labelStep, buttonStep, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
285
+    }
286
+  }
287
+}
288
+
289
+void disp_print_speed() {
290
+  char buf[30] = {0};
291
+
292
+  public_buf_l[0] = '\0';
293
+
294
+  if (speedType == 0) { //move
295
+    strcat(public_buf_l, speed_menu.move_speed);
296
+    strcat(public_buf_l, ": ");
297
+    sprintf(buf, "%d%%", feedrate_percentage);
298
+    strcat(public_buf_l, buf);
299
+  }
300
+  else if (speedType == 1) { // e1
301
+    strcat(public_buf_l, speed_menu.extrude_speed);
302
+    strcat(public_buf_l, ": ");
303
+    sprintf(buf, "%d%%", planner.flow_percentage[0]);
304
+    strcat(public_buf_l, buf);
305
+  }
306
+  lv_label_set_text(printSpeedText, public_buf_l);
307
+  lv_obj_align(printSpeedText, NULL, LV_ALIGN_CENTER, 0, -65);
308
+}
309
+
310
+void disp_speed_type() {
311
+  switch (speedType) {
312
+    case 1:
313
+      lv_obj_set_event_cb_mks(buttonExt, event_handler, ID_C_EXT, "bmp_Extruct_speed_sel.bin", 0);
314
+      lv_obj_set_event_cb_mks(buttonMov, event_handler, ID_C_MOVE, "bmp_Mov_speed.bin", 0);
315
+      break;
316
+
317
+    default:
318
+      lv_obj_set_event_cb_mks(buttonExt, event_handler, ID_C_EXT, "bmp_Extruct_speed.bin", 0);
319
+      lv_obj_set_event_cb_mks(buttonMov, event_handler, ID_C_MOVE, "bmp_Mov_speed_sel.bin", 0);
320
+      break;
321
+  }
322
+  lv_obj_refresh_ext_draw_pad(buttonExt);
323
+  lv_obj_refresh_ext_draw_pad(buttonMov);
324
+
325
+  if (gCfgItems.multiple_language != 0) {
326
+    lv_label_set_text(labelMov, speed_menu.move);
327
+    lv_obj_align(labelMov, buttonMov, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
328
+
329
+    lv_label_set_text(labelExt, speed_menu.extrude);
330
+    lv_obj_align(labelExt, buttonExt, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
331
+  }
332
+}
333
+
334
+void lv_clear_change_speed() { lv_obj_del(scr); }
335
+
336
+#endif // TFT_LITTLE_VGL_UI

+ 40
- 0
Marlin/src/lcd/extui/lib/mks_ui/draw_change_speed.h View File

@@ -0,0 +1,40 @@
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 <http://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+#pragma once
23
+
24
+#ifdef __cplusplus
25
+extern "C" { /* C-declarations for C++ */
26
+#endif
27
+
28
+#define MIN_EXT_SPEED_PERCENT    10
29
+#define MAX_EXT_SPEED_PERCENT   999
30
+
31
+extern void lv_draw_change_speed(void);
32
+extern void lv_clear_change_speed();
33
+extern void disp_speed_step();
34
+extern void disp_print_speed();
35
+extern void disp_speed_type();
36
+
37
+//extern void disp_temp_ready_print();
38
+#ifdef __cplusplus
39
+} /* C-declarations for C++ */
40
+#endif

+ 343
- 0
Marlin/src/lcd/extui/lib/mks_ui/draw_dialog.cpp View File

@@ -0,0 +1,343 @@
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 <http://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+
23
+/**
24
+ * draw_dialog.cpp
25
+ */
26
+
27
+#include "../../../../inc/MarlinConfigPre.h"
28
+
29
+#if ENABLED(TFT_LITTLE_VGL_UI)
30
+
31
+#include "lv_conf.h"
32
+#include "draw_ui.h"
33
+//#include "../lvgl/src/lv_objx/lv_imgbtn.h"
34
+//#include "../lvgl/src/lv_objx/lv_img.h"
35
+//#include "../lvgl/src/lv_core/lv_disp.h"
36
+//#include "../lvgl/src/lv_core/lv_refr.h"
37
+
38
+#include "../../../../MarlinCore.h"
39
+#include "../../../../sd/cardreader.h"
40
+#include "../../../../gcode/queue.h"
41
+#include "../../../../module/temperature.h"
42
+#include "../../../../module/planner.h"
43
+
44
+#if ENABLED(POWER_LOSS_RECOVERY)
45
+  #include "../../../../feature/powerloss.h"
46
+#endif
47
+
48
+#if ENABLED(PARK_HEAD_ON_PAUSE)
49
+  #include "../../../../feature/pause.h"
50
+#endif
51
+
52
+static lv_obj_t * scr;
53
+extern uint8_t sel_id;
54
+extern uint8_t once_flag;
55
+extern uint8_t gcode_preview_over;
56
+uint8_t DialogType;
57
+
58
+static void btn_ok_event_cb(lv_obj_t * btn, lv_event_t event) {
59
+  if (event == LV_EVENT_CLICKED) {
60
+    // nothing to do
61
+  }
62
+  else if (event == LV_EVENT_RELEASED) {
63
+    if (DialogType == DIALOG_TYPE_PRINT_FILE) {
64
+      preview_gcode_prehandle(list_file.file_name[sel_id]);
65
+      reset_print_time();
66
+      start_print_time();
67
+
68
+      uiCfg.print_state = WORKING;
69
+      lv_clear_dialog();
70
+      lv_draw_printing();
71
+
72
+      #if ENABLED(SDSUPPORT)
73
+      if (gcode_preview_over != 1) {
74
+        char *cur_name;
75
+        cur_name = strrchr(list_file.file_name[sel_id], '/');
76
+
77
+        SdFile file, *curDir;
78
+        card.endFilePrint();
79
+        const char * const fname = card.diveToFile(true, curDir, cur_name);
80
+        if (!fname) return;
81
+        if (file.open(curDir, fname, O_READ)) {
82
+          gCfgItems.curFilesize = file.fileSize();
83
+          file.close();
84
+          update_spi_flash();
85
+        }
86
+        card.openFileRead(cur_name);
87
+        if (card.isFileOpen()) {
88
+          feedrate_percentage = 100;
89
+          //saved_feedrate_percentage = feedrate_percentage;
90
+          planner.flow_percentage[0] = 100;
91
+          planner.e_factor[0] = planner.flow_percentage[0] * 0.01f;
92
+          #if EXTRUDERS == 2
93
+            planner.flow_percentage[1] = 100;
94
+            planner.e_factor[1] = planner.flow_percentage[1] * 0.01f;
95
+          #endif
96
+          card.startFileprint();
97
+          #if ENABLED(POWER_LOSS_RECOVERY)
98
+            recovery.prepare();
99
+          #endif
100
+          once_flag = 0;
101
+        }
102
+      }
103
+      #endif
104
+    }
105
+    else if (DialogType == DIALOG_TYPE_STOP) {
106
+      stop_print_time();
107
+      lv_clear_dialog();
108
+      lv_draw_ready_print();
109
+
110
+      #if ENABLED(SDSUPPORT)
111
+        //card.endFilePrint();
112
+        //wait_for_heatup = false;
113
+        uiCfg.print_state = IDLE;
114
+        card.flag.abort_sd_printing = true;
115
+        //queue.clear();
116
+        //quickstop_stepper();
117
+        //print_job_timer.stop();
118
+        //thermalManager.disable_all_heaters();
119
+
120
+        //#if ENABLED(POWER_LOSS_RECOVERY)
121
+        //recovery.purge();
122
+        //#endif
123
+        //queue.enqueue_one_now(PSTR("G91"));
124
+        //queue.enqueue_one_now(PSTR("G1 Z10"));
125
+        //queue.enqueue_one_now(PSTR("G90"));
126
+        //queue.enqueue_one_now(PSTR("G28 X0 Y0"));
127
+        //queue.inject_P(PSTR("G91\nG1 Z10\nG90\nG28 X0 Y0\nM84\nM107"));
128
+      #endif
129
+    }
130
+    else if (DialogType == DIALOG_TYPE_FINISH_PRINT) {
131
+      clear_cur_ui();
132
+      lv_draw_ready_print();
133
+    }
134
+    #if ENABLED(ADVANCED_PAUSE_FEATURE)
135
+      else if (DialogType == DIALOG_PAUSE_MESSAGE_WAITING
136
+            || DialogType == DIALOG_PAUSE_MESSAGE_INSERT
137
+            || DialogType == DIALOG_PAUSE_MESSAGE_HEAT
138
+      ) {
139
+        wait_for_user = false;
140
+      }
141
+      else if (DialogType == DIALOG_PAUSE_MESSAGE_OPTION) {
142
+        pause_menu_response = PAUSE_RESPONSE_EXTRUDE_MORE;
143
+      }
144
+      else if (DialogType == DIALOG_PAUSE_MESSAGE_RESUME) {
145
+        clear_cur_ui();
146
+        draw_return_ui();
147
+      }
148
+    #endif
149
+  }
150
+}
151
+
152
+static void btn_cancel_event_cb(lv_obj_t * btn, lv_event_t event) {
153
+  if (event == LV_EVENT_CLICKED) {
154
+    // nothing to do
155
+  }
156
+  else if (event == LV_EVENT_RELEASED) {
157
+    if (DialogType == DIALOG_PAUSE_MESSAGE_OPTION) {
158
+      #if ENABLED(ADVANCED_PAUSE_FEATURE)
159
+        pause_menu_response = PAUSE_RESPONSE_RESUME_PRINT;
160
+      #endif
161
+    }
162
+    else {
163
+      clear_cur_ui();
164
+      draw_return_ui();
165
+    }
166
+  }
167
+}
168
+
169
+void lv_draw_dialog(uint8_t type) {
170
+
171
+  if (disp_state_stack._disp_state[disp_state_stack._disp_index] != DIALOG_UI) {
172
+    disp_state_stack._disp_index++;
173
+    disp_state_stack._disp_state[disp_state_stack._disp_index] = DIALOG_UI;
174
+  }
175
+  disp_state = DIALOG_UI;
176
+
177
+  DialogType = type;
178
+
179
+  scr = lv_obj_create(NULL, NULL);
180
+
181
+
182
+  lv_obj_set_style(scr, &tft_style_scr);
183
+  lv_scr_load(scr);
184
+  lv_obj_clean(scr);
185
+
186
+  lv_obj_t * title = lv_label_create(scr, NULL);
187
+  lv_obj_set_style(title, &tft_style_lable_rel);
188
+  lv_obj_set_pos(title, TITLE_XPOS, TITLE_YPOS);
189
+  lv_label_set_text(title, creat_title_text());
190
+
191
+  lv_refr_now(lv_refr_get_disp_refreshing());
192
+
193
+  //LV_IMG_DECLARE(bmp_pic);
194
+
195
+  static lv_style_t style_btn_rel;                                   // A variable to store the released style
196
+  lv_style_copy(&style_btn_rel, &lv_style_plain);                    // Initialize from a built-in style
197
+  style_btn_rel.body.border.color = lv_color_hex3(0x269);
198
+  style_btn_rel.body.border.width = 1;
199
+  style_btn_rel.body.main_color = lv_color_hex3(0xADF);
200
+  style_btn_rel.body.grad_color = lv_color_hex3(0x46B);
201
+  style_btn_rel.body.shadow.width = 4;
202
+  style_btn_rel.body.shadow.type = LV_SHADOW_BOTTOM;
203
+  style_btn_rel.body.radius = LV_RADIUS_CIRCLE;
204
+  style_btn_rel.text.color = lv_color_hex3(0xDEF);
205
+  style_btn_rel.text.font = &gb2312_puhui32;
206
+
207
+  static lv_style_t style_btn_pr;                                    // A variable to store the pressed style
208
+  lv_style_copy(&style_btn_pr, &style_btn_rel);                      // Initialize from the released style
209
+  style_btn_pr.body.border.color = lv_color_hex3(0x46B);
210
+  style_btn_pr.body.main_color = lv_color_hex3(0x8BD);
211
+  style_btn_pr.body.grad_color = lv_color_hex3(0x24A);
212
+  style_btn_pr.body.shadow.width = 2;
213
+  style_btn_pr.text.color = lv_color_hex3(0xBCD);
214
+  style_btn_pr.text.font = &gb2312_puhui32;
215
+
216
+  lv_obj_t * labelDialog = lv_label_create(scr, NULL);
217
+  lv_obj_set_style(labelDialog, &tft_style_lable_rel);
218
+
219
+  if (DialogType == DIALOG_TYPE_FINISH_PRINT || DialogType == DIALOG_PAUSE_MESSAGE_RESUME) {
220
+    lv_obj_t * btnOk = lv_btn_create(scr, NULL);                     // Add a button the current screen
221
+    lv_obj_set_pos(btnOk, BTN_OK_X + 90, BTN_OK_Y);                  // Set its position
222
+    lv_obj_set_size(btnOk, 100, 50);                                 // Set its size
223
+    lv_obj_set_event_cb(btnOk, btn_ok_event_cb);
224
+    lv_btn_set_style(btnOk, LV_BTN_STYLE_REL, &style_btn_rel);       // Set the button's released style
225
+    lv_btn_set_style(btnOk, LV_BTN_STYLE_PR, &style_btn_pr);         // Set the button's pressed style
226
+    lv_obj_t * labelOk = lv_label_create(btnOk, NULL);               // Add a label to the button
227
+    lv_label_set_text(labelOk, print_file_dialog_menu.confirm);      // Set the labels text
228
+  }
229
+  else if (DialogType == DIALOG_PAUSE_MESSAGE_WAITING
230
+           || DialogType == DIALOG_PAUSE_MESSAGE_INSERT
231
+           || DialogType == DIALOG_PAUSE_MESSAGE_HEAT) {
232
+    lv_obj_t * btnOk = lv_btn_create(scr, NULL);                     // Add a button the current screen
233
+    lv_obj_set_pos(btnOk, BTN_OK_X + 90, BTN_OK_Y);                  // Set its position
234
+    lv_obj_set_size(btnOk, 100, 50);                                 // Set its size
235
+    lv_obj_set_event_cb(btnOk, btn_ok_event_cb);
236
+    lv_btn_set_style(btnOk, LV_BTN_STYLE_REL, &style_btn_rel);       // Set the button's released style
237
+    lv_btn_set_style(btnOk, LV_BTN_STYLE_PR, &style_btn_pr);         // Set the button's pressed style
238
+    lv_obj_t * labelOk = lv_label_create(btnOk, NULL);               // Add a label to the button
239
+    lv_label_set_text(labelOk, print_file_dialog_menu.confirm);      // Set the labels text
240
+  }
241
+  else if (DialogType == DIALOG_PAUSE_MESSAGE_PAUSING
242
+        || DialogType == DIALOG_PAUSE_MESSAGE_CHANGING
243
+        || DialogType == DIALOG_PAUSE_MESSAGE_UNLOAD
244
+        || DialogType == DIALOG_PAUSE_MESSAGE_LOAD
245
+        || DialogType == DIALOG_PAUSE_MESSAGE_PURGE
246
+        || DialogType == DIALOG_PAUSE_MESSAGE_RESUME
247
+        || DialogType == DIALOG_PAUSE_MESSAGE_HEATING
248
+  ) {
249
+    // nothing to do
250
+  }
251
+  else {
252
+    lv_obj_t * btnOk = lv_btn_create(scr, NULL);                     // Add a button the current screen
253
+    lv_obj_set_pos(btnOk, BTN_OK_X, BTN_OK_Y);                       // Set its position
254
+    lv_obj_set_size(btnOk, 100, 50);                                 // Set its size
255
+    lv_obj_set_event_cb(btnOk, btn_ok_event_cb);
256
+    lv_btn_set_style(btnOk, LV_BTN_STYLE_REL, &style_btn_rel);       // Set the button's released style
257
+    lv_btn_set_style(btnOk, LV_BTN_STYLE_PR, &style_btn_pr);         // Set the button's pressed style
258
+    lv_obj_t * labelOk = lv_label_create(btnOk, NULL);               // Add a label to the button
259
+
260
+    lv_obj_t * btnCancel = lv_btn_create(scr, NULL);                 // Add a button the current screen
261
+    lv_obj_set_pos(btnCancel, BTN_CANCEL_X, BTN_CANCEL_Y);           // Set its position
262
+    lv_obj_set_size(btnCancel, 100, 50);                             // Set its size
263
+    lv_obj_set_event_cb(btnCancel, btn_cancel_event_cb);
264
+    lv_btn_set_style(btnCancel, LV_BTN_STYLE_REL, &style_btn_rel);   // Set the button's released style
265
+    lv_btn_set_style(btnCancel, LV_BTN_STYLE_PR, &style_btn_pr);     // Set the button's pressed style
266
+    lv_obj_t * labelCancel = lv_label_create(btnCancel, NULL);       // Add a label to the button
267
+
268
+    if (DialogType == DIALOG_PAUSE_MESSAGE_OPTION) {
269
+      lv_label_set_text(labelOk, pause_msg_menu.purgeMore);          // Set the labels text
270
+      lv_label_set_text(labelCancel, pause_msg_menu.continuePrint);
271
+    }
272
+    else {
273
+      lv_label_set_text(labelOk, print_file_dialog_menu.confirm);    // Set the labels text
274
+      lv_label_set_text(labelCancel, print_file_dialog_menu.cancle);
275
+    }
276
+  }
277
+  if (DialogType == DIALOG_TYPE_PRINT_FILE) {
278
+    lv_label_set_text(labelDialog, print_file_dialog_menu.print_file);
279
+    lv_obj_align(labelDialog, NULL, LV_ALIGN_CENTER, 0, -20);
280
+
281
+    lv_obj_t * labelFile = lv_label_create(scr, NULL);
282
+    lv_obj_set_style(labelFile, &tft_style_lable_rel);
283
+
284
+    lv_label_set_text(labelFile, list_file.long_name[sel_id]);
285
+    lv_obj_align(labelFile, NULL, LV_ALIGN_CENTER, 0, -60);
286
+  }
287
+  else if (DialogType == DIALOG_TYPE_STOP) {
288
+    lv_label_set_text(labelDialog, print_file_dialog_menu.cancle_print);
289
+    lv_obj_align(labelDialog, NULL, LV_ALIGN_CENTER, 0, -20);
290
+  }
291
+  else if (DialogType == DIALOG_TYPE_FINISH_PRINT) {
292
+    lv_label_set_text(labelDialog, print_file_dialog_menu.print_finish);
293
+    lv_obj_align(labelDialog, NULL, LV_ALIGN_CENTER, 0, -20);
294
+  }
295
+  else if (DialogType == DIALOG_PAUSE_MESSAGE_PAUSING) {
296
+    lv_label_set_text(labelDialog, pause_msg_menu.pausing);
297
+    lv_obj_align(labelDialog, NULL, LV_ALIGN_CENTER, 0, -20);
298
+  }
299
+  else if (DialogType == DIALOG_PAUSE_MESSAGE_CHANGING) {
300
+    lv_label_set_text(labelDialog, pause_msg_menu.changing);
301
+    lv_obj_align(labelDialog, NULL, LV_ALIGN_CENTER, 0, -20);
302
+  }
303
+  else if (DialogType == DIALOG_PAUSE_MESSAGE_UNLOAD) {
304
+    lv_label_set_text(labelDialog, pause_msg_menu.unload);
305
+    lv_obj_align(labelDialog, NULL, LV_ALIGN_CENTER, 0, -20);
306
+  }
307
+  else if (DialogType == DIALOG_PAUSE_MESSAGE_WAITING) {
308
+    lv_label_set_text(labelDialog, pause_msg_menu.waiting);
309
+    lv_obj_align(labelDialog, NULL, LV_ALIGN_CENTER, 0, -20);
310
+  }
311
+  else if (DialogType == DIALOG_PAUSE_MESSAGE_INSERT) {
312
+    lv_label_set_text(labelDialog, pause_msg_menu.insert);
313
+    lv_obj_align(labelDialog, NULL, LV_ALIGN_CENTER, 0, -20);
314
+  }
315
+  else if (DialogType == DIALOG_PAUSE_MESSAGE_LOAD) {
316
+    lv_label_set_text(labelDialog, pause_msg_menu.load);
317
+    lv_obj_align(labelDialog, NULL, LV_ALIGN_CENTER, 0, -20);
318
+  }
319
+  else if (DialogType == DIALOG_PAUSE_MESSAGE_PURGE) {
320
+    lv_label_set_text(labelDialog, pause_msg_menu.purge);
321
+    lv_obj_align(labelDialog, NULL, LV_ALIGN_CENTER, 0, -20);
322
+  }
323
+  else if (DialogType == DIALOG_PAUSE_MESSAGE_RESUME) {
324
+    lv_label_set_text(labelDialog, pause_msg_menu.resume);
325
+    lv_obj_align(labelDialog, NULL, LV_ALIGN_CENTER, 0, -20);
326
+  }
327
+  else if (DialogType == DIALOG_PAUSE_MESSAGE_HEAT) {
328
+    lv_label_set_text(labelDialog, pause_msg_menu.heat);
329
+    lv_obj_align(labelDialog, NULL, LV_ALIGN_CENTER, 0, -20);
330
+  }
331
+  else if (DialogType == DIALOG_PAUSE_MESSAGE_HEATING) {
332
+    lv_label_set_text(labelDialog, pause_msg_menu.heating);
333
+    lv_obj_align(labelDialog, NULL, LV_ALIGN_CENTER, 0, -20);
334
+  }
335
+  else if (DialogType == DIALOG_PAUSE_MESSAGE_OPTION) {
336
+    lv_label_set_text(labelDialog, pause_msg_menu.option);
337
+    lv_obj_align(labelDialog, NULL, LV_ALIGN_CENTER, 0, -20);
338
+  }
339
+}
340
+
341
+void lv_clear_dialog() { lv_obj_del(scr); }
342
+
343
+#endif // TFT_LITTLE_VGL_UI

+ 79
- 0
Marlin/src/lcd/extui/lib/mks_ui/draw_dialog.h View File

@@ -0,0 +1,79 @@
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 <http://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+#pragma once
23
+
24
+#ifdef __cplusplus
25
+extern "C" { /* C-declarations for C++ */
26
+#endif
27
+
28
+#define DIALOG_TYPE_STOP                             0
29
+#define DIALOG_TYPE_PRINT_FILE                       1
30
+#define DIALOG_TYPE_REPRINT_NO_FILE                  2
31
+
32
+#define DIALOG_TYPE_M80_FAIL                         3  //**
33
+#define DIALOG_TYPE_MESSEGE_ERR1                     4  //**
34
+
35
+#define DIALOG_TYPE_UPDATE_ESP_FIRMARE               5
36
+#define DIALOG_TYPE_UPDATE_ESP_DATA                  6
37
+#define DIALOG_TYPE_UPLOAD_FILE                      7
38
+#define DIALOG_TYPE_UNBIND                           8
39
+
40
+#define DIALOG_TYPE_FILAMENT_LOAD_HEAT               9
41
+#define DIALOG_TYPE_FILAMENT_HEAT_LOAD_COMPLETED    10
42
+#define DIALOG_TYPE_FILAMENT_LOADING                11
43
+#define DIALOG_TYPE_FILAMENT_LOAD_COMPLETED         12
44
+#define DIALOG_TYPE_FILAMENT_UNLOAD_HEAT            13
45
+#define DIALOG_TYPE_FILAMENT_HEAT_UNLOAD_COMPLETED  14
46
+#define DIALOG_TYPE_FILAMENT_UNLOADING              15
47
+#define DIALOG_TYPE_FILAMENT_UNLOAD_COMPLETED       16
48
+
49
+#define DIALOG_TYPE_FILE_LOADING                    17  //**
50
+
51
+#define DIALOG_TYPE_FILAMENT_NO_PRESS               18
52
+#define DIALOG_TYPE_FINISH_PRINT                    19
53
+
54
+#define WIFI_ENABLE_TIPS                            20
55
+
56
+#define DIALOG_PAUSE_MESSAGE_PAUSING                21
57
+#define DIALOG_PAUSE_MESSAGE_CHANGING               22
58
+#define DIALOG_PAUSE_MESSAGE_UNLOAD                 23
59
+#define DIALOG_PAUSE_MESSAGE_WAITING                24
60
+#define DIALOG_PAUSE_MESSAGE_INSERT                 25
61
+#define DIALOG_PAUSE_MESSAGE_LOAD                   26
62
+#define DIALOG_PAUSE_MESSAGE_PURGE                  27
63
+#define DIALOG_PAUSE_MESSAGE_RESUME                 28
64
+#define DIALOG_PAUSE_MESSAGE_HEAT                   29
65
+#define DIALOG_PAUSE_MESSAGE_HEATING                30
66
+#define DIALOG_PAUSE_MESSAGE_OPTION                 31
67
+
68
+#define BTN_OK_X      100
69
+#define BTN_OK_Y      180
70
+#define BTN_CANCEL_X  280
71
+#define BTN_CANCEL_Y  180
72
+
73
+extern void lv_draw_dialog(uint8_t type);
74
+extern void lv_clear_dialog();
75
+
76
+//extern void disp_temp_ready_print();
77
+#ifdef __cplusplus
78
+} /* C-declarations for C++ */
79
+#endif

+ 84
- 0
Marlin/src/lcd/extui/lib/mks_ui/draw_error_message.cpp View File

@@ -0,0 +1,84 @@
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 <http://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+#include "../../../../inc/MarlinConfigPre.h"
23
+
24
+#if ENABLED(TFT_LITTLE_VGL_UI)
25
+
26
+#include "lv_conf.h"
27
+#include "draw_ui.h"
28
+#include "tft_lvgl_configuration.h"
29
+#include "mks_hardware_test.h"
30
+//#include "../lvgl/src/lv_objx/lv_imgbtn.h"
31
+//#include "../lvgl/src/lv_objx/lv_img.h"
32
+//#include "../lvgl/src/lv_core/lv_disp.h"
33
+//#include "../lvgl/src/lv_core/lv_refr.h"
34
+
35
+#include "../../../../MarlinCore.h"
36
+
37
+static lv_obj_t * scr;
38
+
39
+void lv_draw_error_message(PGM_P const msg) {
40
+  #if 0
41
+    static lv_obj_t * message = NULL, *kill_message = NULL, *reset_tips = NULL;
42
+    if (disp_state_stack._disp_state[disp_state_stack._disp_index] != ERROR_MESSAGE_UI) {
43
+      disp_state_stack._disp_index++;
44
+      disp_state_stack._disp_state[disp_state_stack._disp_index] = ERROR_MESSAGE_UI;
45
+    }
46
+    disp_state = ERROR_MESSAGE_UI;
47
+
48
+    scr = lv_obj_create(NULL, NULL);
49
+
50
+    lv_obj_set_style(scr, &tft_style_scr);
51
+    lv_scr_load(scr);
52
+    lv_obj_clean(scr);
53
+
54
+    lv_refr_now(lv_refr_get_disp_refreshing());
55
+
56
+    if (msg) {
57
+      message = lv_label_create(scr, NULL);
58
+      lv_obj_set_style(message, &tft_style_lable_rel);
59
+      lv_label_set_text(message, msg);
60
+      lv_obj_align(message, NULL, LV_ALIGN_CENTER, 0, -50);
61
+    }
62
+
63
+    kill_message = lv_label_create(scr, NULL);
64
+    lv_obj_set_style(kill_message, &tft_style_lable_rel);
65
+    lv_label_set_text(kill_message, "PRINTER HALTED");
66
+    lv_obj_align(kill_message, NULL, LV_ALIGN_CENTER, 0, -10);
67
+
68
+    reset_tips = lv_label_create(scr, NULL);
69
+    lv_obj_set_style(reset_tips, &tft_style_lable_rel);
70
+    lv_label_set_text(reset_tips, "Please Reset");
71
+    lv_obj_align(reset_tips, NULL, LV_ALIGN_CENTER, 0, 30);
72
+
73
+    lv_task_handler();
74
+  #endif
75
+  LCD_Clear(0x0000);
76
+  if (msg) disp_string((TFT_WIDTH - strlen(msg) * 16) / 2, 100, msg, 0xFFFF, 0x0000);
77
+  disp_string((TFT_WIDTH - strlen("PRINTER HALTED") * 16) / 2, 140, "PRINTER HALTED", 0xFFFF, 0x0000);
78
+  disp_string((TFT_WIDTH - strlen("Please Reset") * 16) / 2, 180, "Please Reset", 0xFFFF, 0x0000);
79
+
80
+}
81
+
82
+void lv_clear_error_message() { lv_obj_del(scr); }
83
+
84
+#endif // TFT_LITTLE_VGL_UI

+ 34
- 0
Marlin/src/lcd/extui/lib/mks_ui/draw_error_message.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 <http://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_error_message(PGM_P const msg);
29
+extern void lv_clear_error_message();
30
+
31
+//extern void disp_temp_ready_print();
32
+#ifdef __cplusplus
33
+} /* C-declarations for C++ */
34
+#endif

+ 378
- 0
Marlin/src/lcd/extui/lib/mks_ui/draw_extrusion.cpp View File

@@ -0,0 +1,378 @@
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 <http://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+#include "../../../../inc/MarlinConfigPre.h"
23
+
24
+#if ENABLED(TFT_LITTLE_VGL_UI)
25
+
26
+#include "lv_conf.h"
27
+#include "draw_ui.h"
28
+//#include "../lvgl/src/lv_objx/lv_imgbtn.h"
29
+//#include "../lvgl/src/lv_objx/lv_img.h"
30
+//#include "../lvgl/src/lv_core/lv_disp.h"
31
+//#include "../lvgl/src/lv_core/lv_refr.h"
32
+
33
+#include "../../../../MarlinCore.h"
34
+#include "../../../../module/temperature.h"
35
+#include "../../../../gcode/queue.h"
36
+
37
+static lv_obj_t * scr;
38
+static lv_obj_t * buttoType, *buttonStep, *buttonSpeed;
39
+static lv_obj_t * labelType;
40
+static lv_obj_t * labelStep;
41
+static lv_obj_t * labelSpeed;
42
+static lv_obj_t * tempText;
43
+static lv_obj_t * ExtruText;
44
+
45
+#define ID_E_ADD    1
46
+#define ID_E_DEC    2
47
+#define ID_E_TYPE   3
48
+#define ID_E_STEP   4
49
+#define ID_E_SPEED  5
50
+#define ID_E_RETURN 6
51
+
52
+static int32_t extructAmount;
53
+
54
+static void event_handler(lv_obj_t * obj, lv_event_t event) {
55
+  switch (obj->mks_obj_id) {
56
+    case ID_E_ADD:
57
+      if (event == LV_EVENT_CLICKED) {
58
+        // nothing to do
59
+      }
60
+      else if (event == LV_EVENT_RELEASED) {
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"));
67
+          extructAmount += uiCfg.extruStep;
68
+          disp_extru_amount();
69
+        }
70
+      }
71
+      break;
72
+    case ID_E_DEC:
73
+      if (event == LV_EVENT_CLICKED) {
74
+        // nothing to do
75
+      }
76
+      else if (event == LV_EVENT_RELEASED) {
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"));
83
+          extructAmount -= uiCfg.extruStep;
84
+          disp_extru_amount();
85
+        }
86
+      }
87
+      break;
88
+    case ID_E_TYPE:
89
+      if (event == LV_EVENT_CLICKED) {
90
+        // nothing to do
91
+      }
92
+      else if (event == LV_EVENT_RELEASED) {
93
+        if (EXTRUDERS == 2) {
94
+          if (uiCfg.curSprayerChoose == 0) {
95
+            uiCfg.curSprayerChoose = 1;
96
+            queue.inject_P(PSTR("T1"));
97
+          }
98
+          else {
99
+            uiCfg.curSprayerChoose = 0;
100
+            queue.inject_P(PSTR("T0"));
101
+          }
102
+        }
103
+        else {
104
+          uiCfg.curSprayerChoose = 0;
105
+        }
106
+        extructAmount = 0;
107
+        disp_hotend_temp();
108
+        disp_ext_type();
109
+        disp_extru_amount();
110
+      }
111
+      break;
112
+    case ID_E_STEP:
113
+      if (event == LV_EVENT_CLICKED) {
114
+        // nothing to do
115
+      }
116
+      else if (event == LV_EVENT_RELEASED) {
117
+        switch (abs(uiCfg.extruStep)) {
118
+          case  1: uiCfg.extruStep = 5; break;
119
+          case  5: uiCfg.extruStep = 10; break;
120
+          case 10: uiCfg.extruStep = 1; break;
121
+          default: break;
122
+        }
123
+        disp_ext_step();
124
+      }
125
+      break;
126
+    case ID_E_SPEED:
127
+      if (event == LV_EVENT_CLICKED) {
128
+        // nothing to do
129
+      }
130
+      else if (event == LV_EVENT_RELEASED) {
131
+        switch (uiCfg.extruSpeed) {
132
+          case  1: uiCfg.extruSpeed = 10; break;
133
+          case 10: uiCfg.extruSpeed = 20; break;
134
+          case 20: uiCfg.extruSpeed = 1; break;
135
+          default: break;
136
+        }
137
+        disp_ext_speed();
138
+      }
139
+      break;
140
+    case ID_E_RETURN:
141
+      if (event == LV_EVENT_CLICKED) {
142
+        // nothing to do
143
+      }
144
+      else if (event == LV_EVENT_RELEASED) {
145
+        clear_cur_ui();
146
+        draw_return_ui();
147
+      }
148
+      break;
149
+  }
150
+}
151
+
152
+
153
+void lv_draw_extrusion(void) {
154
+  lv_obj_t *buttonAdd, *buttonDec, *buttonBack;
155
+
156
+  if (disp_state_stack._disp_state[disp_state_stack._disp_index] != EXTRUSION_UI) {
157
+    disp_state_stack._disp_index++;
158
+    disp_state_stack._disp_state[disp_state_stack._disp_index] = EXTRUSION_UI;
159
+  }
160
+  disp_state = EXTRUSION_UI;
161
+
162
+  scr = lv_obj_create(NULL, NULL);
163
+
164
+  lv_obj_set_style(scr, &tft_style_scr);
165
+  lv_scr_load(scr);
166
+  lv_obj_clean(scr);
167
+
168
+  lv_obj_t * title = lv_label_create(scr, NULL);
169
+  lv_obj_set_style(title, &tft_style_lable_rel);
170
+  lv_obj_set_pos(title, TITLE_XPOS, TITLE_YPOS);
171
+  lv_label_set_text(title, creat_title_text());
172
+
173
+  lv_refr_now(lv_refr_get_disp_refreshing());
174
+
175
+  LV_IMG_DECLARE(bmp_pic);
176
+
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);
182
+  buttonSpeed = lv_imgbtn_create(scr, NULL);
183
+  buttonBack = lv_imgbtn_create(scr, NULL);
184
+
185
+  lv_obj_set_event_cb_mks(buttonAdd, event_handler, ID_E_ADD, "bmp_In.bin", 0);
186
+  lv_imgbtn_set_src(buttonAdd, LV_BTN_STATE_REL, &bmp_pic);
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);
190
+  lv_obj_clear_protect(buttonAdd, LV_PROTECT_FOLLOW);
191
+
192
+  #if 1
193
+    lv_obj_set_event_cb_mks(buttonDec, event_handler, ID_E_DEC, "bmp_Out.bin", 0);
194
+    lv_imgbtn_set_src(buttonDec, LV_BTN_STATE_REL, &bmp_pic);
195
+    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);
198
+
199
+    lv_imgbtn_set_src(buttoType, LV_BTN_STATE_REL, &bmp_pic);
200
+    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);
203
+
204
+    lv_imgbtn_set_src(buttonStep, LV_BTN_STATE_REL, &bmp_pic);
205
+    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);
208
+
209
+    lv_imgbtn_set_src(buttonSpeed, LV_BTN_STATE_REL, &bmp_pic);
210
+    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);
213
+
214
+    lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_E_RETURN, "bmp_Return.bin", 0);
215
+    lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_REL, &bmp_pic);
216
+    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);
219
+  #endif
220
+
221
+  lv_obj_set_pos(buttonAdd, INTERVAL_V, titleHeight);
222
+  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);
224
+  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);
227
+
228
+  /*Create a label on the Image button*/
229
+  lv_btn_set_layout(buttonAdd, LV_LAYOUT_OFF);
230
+  lv_btn_set_layout(buttonDec, LV_LAYOUT_OFF);
231
+  lv_btn_set_layout(buttoType, LV_LAYOUT_OFF);
232
+  lv_btn_set_layout(buttonStep, LV_LAYOUT_OFF);
233
+  lv_btn_set_layout(buttonSpeed, LV_LAYOUT_OFF);
234
+  lv_btn_set_layout(buttonBack, LV_LAYOUT_OFF);
235
+
236
+  lv_obj_t * labelAdd = lv_label_create(buttonAdd, NULL);
237
+  lv_obj_t * labelDec = lv_label_create(buttonDec, NULL);
238
+  labelType = lv_label_create(buttoType, NULL);
239
+  labelStep = lv_label_create(buttonStep, NULL);
240
+  labelSpeed = lv_label_create(buttonSpeed, NULL);
241
+  lv_obj_t * label_Back = lv_label_create(buttonBack, NULL);
242
+
243
+  if (gCfgItems.multiple_language != 0) {
244
+    lv_label_set_text(labelAdd, extrude_menu.in);
245
+    lv_obj_align(labelAdd, buttonAdd, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
246
+
247
+    lv_label_set_text(labelDec, extrude_menu.out);
248
+    lv_obj_align(labelDec, buttonDec, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
249
+
250
+    lv_label_set_text(label_Back, common_menu.text_back);
251
+    lv_obj_align(label_Back, buttonBack, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
252
+  }
253
+
254
+  disp_ext_type();
255
+  disp_ext_step();
256
+  disp_ext_speed();
257
+
258
+  tempText = lv_label_create(scr, NULL);
259
+  lv_obj_set_style(tempText, &tft_style_lable_rel);
260
+  disp_hotend_temp();
261
+
262
+  ExtruText = lv_label_create(scr, NULL);
263
+  lv_obj_set_style(ExtruText, &tft_style_lable_rel);
264
+  disp_extru_amount();
265
+}
266
+
267
+void disp_ext_type() {
268
+  if (uiCfg.curSprayerChoose == 1) {
269
+    lv_obj_set_event_cb_mks(buttoType, event_handler, ID_E_TYPE, "bmp_Extru2.bin", 0);
270
+    if (gCfgItems.multiple_language != 0) {
271
+      lv_label_set_text(labelType, extrude_menu.ext2);
272
+      lv_obj_align(labelType, buttoType, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
273
+    }
274
+  }
275
+  else {
276
+    lv_obj_set_event_cb_mks(buttoType, event_handler, ID_E_TYPE, "bmp_Extru1.bin", 0);
277
+    if (gCfgItems.multiple_language != 0) {
278
+      lv_label_set_text(labelType, extrude_menu.ext1);
279
+      lv_obj_align(labelType, buttoType, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
280
+    }
281
+  }
282
+}
283
+
284
+void disp_ext_speed() {
285
+  if (uiCfg.extruSpeed == 20)
286
+    lv_obj_set_event_cb_mks(buttonSpeed, event_handler, ID_E_SPEED, "bmp_Speed_high.bin", 0);
287
+  else if (uiCfg.extruSpeed == 1)
288
+    lv_obj_set_event_cb_mks(buttonSpeed, event_handler, ID_E_SPEED, "bmp_Speed_slow.bin", 0);
289
+  else
290
+    lv_obj_set_event_cb_mks(buttonSpeed, event_handler, ID_E_SPEED, "bmp_Speed_normal.bin", 0);
291
+
292
+  if (gCfgItems.multiple_language != 0) {
293
+    if (uiCfg.extruSpeed == 20) {
294
+      lv_label_set_text(labelSpeed, extrude_menu.high);
295
+      lv_obj_align(labelSpeed, buttonSpeed, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
296
+    }
297
+    else if (uiCfg.extruSpeed == 1) {
298
+      lv_label_set_text(labelSpeed, extrude_menu.low);
299
+      lv_obj_align(labelSpeed, buttonSpeed, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
300
+    }
301
+    else {
302
+      lv_label_set_text(labelSpeed, extrude_menu.normal);
303
+      lv_obj_align(labelSpeed, buttonSpeed, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
304
+    }
305
+  }
306
+}
307
+
308
+void disp_hotend_temp() {
309
+  char buf[20] = {0};
310
+  public_buf_l[0] = '\0';
311
+  strcat(public_buf_l, extrude_menu.temper_text);
312
+  sprintf(buf, extrude_menu.temp_value, (int)thermalManager.temp_hotend[uiCfg.curSprayerChoose].celsius,  (int)thermalManager.temp_hotend[uiCfg.curSprayerChoose].target);
313
+  strcat(public_buf_l, buf);
314
+  lv_label_set_text(tempText, public_buf_l);
315
+  lv_obj_align(tempText, NULL, LV_ALIGN_CENTER, 0, -50);
316
+}
317
+
318
+void disp_extru_amount() {
319
+  char buf1[10] = {0};
320
+
321
+  public_buf_l[0] = '\0';
322
+
323
+  if (extructAmount < 999 && extructAmount > -99) {
324
+    sprintf(buf1, extrude_menu.count_value_mm, extructAmount);
325
+    if (uiCfg.curSprayerChoose < 1)
326
+      strcat(public_buf_l, extrude_menu.ext1);
327
+    else
328
+      strcat(public_buf_l, extrude_menu.ext2);
329
+    strcat(public_buf_l, buf1);
330
+  }
331
+  else if (extructAmount < 9999 && extructAmount > -999) {
332
+    sprintf(buf1, extrude_menu.count_value_cm, extructAmount / 10);
333
+    if (uiCfg.curSprayerChoose < 1)
334
+      strcat(public_buf_l, extrude_menu.ext1);
335
+    else
336
+      strcat(public_buf_l, extrude_menu.ext2);
337
+    strcat(public_buf_l, buf1);
338
+  }
339
+  else {
340
+    sprintf(buf1, extrude_menu.count_value_m, extructAmount / 1000);
341
+    if (uiCfg.curSprayerChoose < 1)
342
+      strcat(public_buf_l, extrude_menu.ext1);
343
+    else
344
+      strcat(public_buf_l, extrude_menu.ext2);
345
+    strcat(public_buf_l, buf1);
346
+  }
347
+
348
+  lv_label_set_text(ExtruText, public_buf_l);
349
+  lv_obj_align(ExtruText, NULL, LV_ALIGN_CENTER, 0, -75);
350
+}
351
+
352
+void disp_ext_step() {
353
+  if (uiCfg.extruStep == 1)
354
+    lv_obj_set_event_cb_mks(buttonStep, event_handler, ID_E_STEP, "bmp_Step1_mm.bin", 0);
355
+  else if (uiCfg.extruStep == 5)
356
+    lv_obj_set_event_cb_mks(buttonStep, event_handler, ID_E_STEP, "bmp_Step5_mm.bin", 0);
357
+  else if (uiCfg.extruStep == 10)
358
+    lv_obj_set_event_cb_mks(buttonStep, event_handler, ID_E_STEP, "bmp_Step10_mm.bin", 0);
359
+
360
+  if (gCfgItems.multiple_language != 0) {
361
+    if (uiCfg.extruStep == 1) {
362
+      lv_label_set_text(labelStep, extrude_menu.step_1mm);
363
+      lv_obj_align(labelStep, buttonStep, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
364
+    }
365
+    else if (uiCfg.extruStep == 5) {
366
+      lv_label_set_text(labelStep, extrude_menu.step_5mm);
367
+      lv_obj_align(labelStep, buttonStep, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
368
+    }
369
+    else if (uiCfg.extruStep == 10) {
370
+      lv_label_set_text(labelStep, extrude_menu.step_10mm);
371
+      lv_obj_align(labelStep, buttonStep, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
372
+    }
373
+  }
374
+}
375
+
376
+void lv_clear_extrusion() { lv_obj_del(scr); }
377
+
378
+#endif // TFT_LITTLE_VGL_UI

+ 39
- 0
Marlin/src/lcd/extui/lib/mks_ui/draw_extrusion.h View File

@@ -0,0 +1,39 @@
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 <http://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_extrusion(void);
29
+extern void lv_clear_extrusion();
30
+extern void disp_ext_type();
31
+extern void disp_ext_step();
32
+extern void disp_ext_speed();
33
+extern void disp_hotend_temp();
34
+extern void disp_extru_amount();
35
+
36
+//extern void disp_temp_ready_print();
37
+#ifdef __cplusplus
38
+} /* C-declarations for C++ */
39
+#endif

+ 247
- 0
Marlin/src/lcd/extui/lib/mks_ui/draw_fan.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 <http://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+#include "../../../../inc/MarlinConfigPre.h"
23
+
24
+#if ENABLED(TFT_LITTLE_VGL_UI)
25
+
26
+#include "../../../../MarlinCore.h"
27
+#include "lv_conf.h"
28
+//#include "../lvgl/src/lv_objx/lv_imgbtn.h"
29
+//#include "../lvgl/src/lv_objx/lv_img.h"
30
+//#include "../lvgl/src/lv_core/lv_disp.h"
31
+//#include "../lvgl/src/lv_core/lv_refr.h"
32
+#include "../../../../../Configuration.h"
33
+#include "draw_ui.h"
34
+#include "../../../../module/temperature.h"
35
+#include "../../../../gcode/queue.h"
36
+
37
+static lv_obj_t * scr;
38
+static lv_obj_t * fanText;
39
+
40
+#define ID_F_ADD     1
41
+#define ID_F_DEC     2
42
+#define ID_F_HIGH    3
43
+#define ID_F_MID     4
44
+#define ID_F_OFF     5
45
+#define ID_F_RETURN  6
46
+
47
+static uint8_t fanSpeed;
48
+
49
+static void event_handler(lv_obj_t * obj, lv_event_t event) {
50
+  switch (obj->mks_obj_id) {
51
+    case ID_F_ADD:
52
+      if (event == LV_EVENT_CLICKED) {
53
+        // nothing to do
54
+      }
55
+      else if (event == LV_EVENT_RELEASED) {
56
+        if (fanSpeed + 1 <= 255) {
57
+          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));
61
+        }
62
+      }
63
+      break;
64
+    case ID_F_DEC:
65
+      if (event == LV_EVENT_CLICKED) {
66
+        // nothing to do
67
+      }
68
+      else if (event == LV_EVENT_RELEASED) {
69
+        if (fanSpeed > 0) {
70
+          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));
74
+        }
75
+      }
76
+
77
+      break;
78
+    case ID_F_HIGH:
79
+      if (event == LV_EVENT_CLICKED) {
80
+        // nothing to do
81
+      }
82
+      else if (event == LV_EVENT_RELEASED) {
83
+        queue.enqueue_one_now(PSTR("M106 S255"));
84
+      }
85
+      break;
86
+    case ID_F_MID:
87
+      if (event == LV_EVENT_CLICKED) {
88
+        // nothing to do
89
+      }
90
+      else if (event == LV_EVENT_RELEASED) {
91
+        queue.enqueue_one_now(PSTR("M106 S127"));
92
+      }
93
+      break;
94
+    case ID_F_OFF:
95
+      if (event == LV_EVENT_CLICKED) {
96
+        // nothing to do
97
+      }
98
+      else if (event == LV_EVENT_RELEASED) {
99
+        queue.enqueue_one_now(PSTR("M107"));
100
+      }
101
+      break;
102
+    case ID_F_RETURN:
103
+      if (event == LV_EVENT_CLICKED) {
104
+        // nothing to do
105
+      }
106
+      else if (event == LV_EVENT_RELEASED) {
107
+        clear_cur_ui();
108
+        draw_return_ui();
109
+      }
110
+      break;
111
+  }
112
+}
113
+
114
+
115
+void lv_draw_fan(void) {
116
+  lv_obj_t *buttonAdd, *buttonDec, *buttonHigh, *buttonMid;
117
+  lv_obj_t *buttonOff, *buttonBack;
118
+
119
+  if (disp_state_stack._disp_state[disp_state_stack._disp_index] != FAN_UI) {
120
+    disp_state_stack._disp_index++;
121
+    disp_state_stack._disp_state[disp_state_stack._disp_index] = FAN_UI;
122
+  }
123
+  disp_state = FAN_UI;
124
+
125
+  scr = lv_obj_create(NULL, NULL);
126
+
127
+  lv_obj_set_style(scr, &tft_style_scr);
128
+  lv_scr_load(scr);
129
+  lv_obj_clean(scr);
130
+
131
+  lv_obj_t * title = lv_label_create(scr, NULL);
132
+  lv_obj_set_style(title, &tft_style_lable_rel);
133
+  lv_obj_set_pos(title, TITLE_XPOS, TITLE_YPOS);
134
+  lv_label_set_text(title, creat_title_text());
135
+
136
+  lv_refr_now(lv_refr_get_disp_refreshing());
137
+
138
+  LV_IMG_DECLARE(bmp_pic);
139
+
140
+  /*Create an Image button*/
141
+  buttonAdd = lv_imgbtn_create(scr, NULL);
142
+  buttonDec = lv_imgbtn_create(scr, NULL);
143
+  buttonHigh = lv_imgbtn_create(scr, NULL);
144
+  buttonMid = lv_imgbtn_create(scr, NULL);
145
+  buttonOff = lv_imgbtn_create(scr, NULL);
146
+  buttonBack = lv_imgbtn_create(scr, NULL);
147
+
148
+  lv_obj_set_event_cb_mks(buttonAdd, event_handler, ID_F_ADD, "bmp_Add.bin", 0);
149
+  lv_imgbtn_set_src(buttonAdd, LV_BTN_STATE_REL, &bmp_pic);
150
+  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);
153
+  lv_obj_clear_protect(buttonAdd, LV_PROTECT_FOLLOW);
154
+  #if 1
155
+    lv_obj_set_event_cb_mks(buttonDec, event_handler, ID_F_DEC, "bmp_Dec.bin", 0);
156
+    lv_imgbtn_set_src(buttonDec, LV_BTN_STATE_REL, &bmp_pic);
157
+    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);
160
+
161
+    lv_obj_set_event_cb_mks(buttonHigh, event_handler, ID_F_HIGH, "bmp_Speed255.bin", 0);
162
+    lv_imgbtn_set_src(buttonHigh, LV_BTN_STATE_REL, &bmp_pic);
163
+    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);
166
+
167
+    lv_obj_set_event_cb_mks(buttonMid, event_handler, ID_F_MID, "bmp_Speed127.bin", 0);
168
+    lv_imgbtn_set_src(buttonMid, LV_BTN_STATE_REL, &bmp_pic);
169
+    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);
172
+
173
+    lv_obj_set_event_cb_mks(buttonOff, event_handler, ID_F_OFF, "bmp_Speed0.bin", 0);
174
+    lv_imgbtn_set_src(buttonOff, LV_BTN_STATE_REL, &bmp_pic);
175
+    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);
178
+
179
+    lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_F_RETURN, "bmp_Return.bin", 0);
180
+    lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_REL, &bmp_pic);
181
+    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);
184
+  #endif
185
+
186
+  lv_obj_set_pos(buttonAdd, INTERVAL_V, titleHeight);
187
+  lv_obj_set_pos(buttonDec, BTN_X_PIXEL * 3 + INTERVAL_V * 4, titleHeight);
188
+  lv_obj_set_pos(buttonHigh, INTERVAL_V, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
189
+  lv_obj_set_pos(buttonMid, BTN_X_PIXEL + INTERVAL_V * 2, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
190
+  lv_obj_set_pos(buttonOff, BTN_X_PIXEL * 2 + INTERVAL_V * 3, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
191
+  lv_obj_set_pos(buttonBack, BTN_X_PIXEL * 3 + INTERVAL_V * 4, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
192
+
193
+  /*Create a label on the Image button*/
194
+  lv_btn_set_layout(buttonAdd, LV_LAYOUT_OFF);
195
+  lv_btn_set_layout(buttonDec, LV_LAYOUT_OFF);
196
+  lv_btn_set_layout(buttonHigh, LV_LAYOUT_OFF);
197
+  lv_btn_set_layout(buttonMid, LV_LAYOUT_OFF);
198
+  lv_btn_set_layout(buttonOff, LV_LAYOUT_OFF);
199
+  lv_btn_set_layout(buttonBack, LV_LAYOUT_OFF);
200
+
201
+  lv_obj_t * labelAdd = lv_label_create(buttonAdd, NULL);
202
+  lv_obj_t * labelDec = lv_label_create(buttonDec, NULL);
203
+  lv_obj_t * labelHigh = lv_label_create(buttonHigh, NULL);
204
+  lv_obj_t * labelMid = lv_label_create(buttonMid, NULL);
205
+  lv_obj_t * labelOff = lv_label_create(buttonOff, NULL);
206
+  lv_obj_t * label_Back = lv_label_create(buttonBack, NULL);
207
+
208
+
209
+  if (gCfgItems.multiple_language != 0) {
210
+    lv_label_set_text(labelAdd, fan_menu.add);
211
+    lv_obj_align(labelAdd, buttonAdd, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
212
+
213
+    lv_label_set_text(labelDec, fan_menu.dec);
214
+    lv_obj_align(labelDec, buttonDec, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
215
+
216
+    lv_label_set_text(labelHigh, fan_menu.full);
217
+    lv_obj_align(labelHigh, buttonHigh, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
218
+
219
+    lv_label_set_text(labelMid, fan_menu.half);
220
+    lv_obj_align(labelMid, buttonMid, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
221
+
222
+    lv_label_set_text(labelOff, fan_menu.off);
223
+    lv_obj_align(labelOff, buttonOff, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
224
+
225
+    lv_label_set_text(label_Back, common_menu.text_back);
226
+    lv_obj_align(label_Back, buttonBack, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
227
+  }
228
+
229
+  fanText = lv_label_create(scr, NULL);
230
+  lv_obj_set_style(fanText, &tft_style_lable_rel);
231
+  disp_fan_value();
232
+}
233
+
234
+void disp_fan_value() {
235
+  char buf1[10] = {0};
236
+  public_buf_l[0] = '\0';
237
+  strcat(public_buf_l, fan_menu.state);
238
+  strcat(public_buf_l, ": ");
239
+  sprintf(buf1, "%3d", thermalManager.fan_speed[0]);
240
+  strcat(public_buf_l, buf1);
241
+  lv_label_set_text(fanText, public_buf_l);
242
+  lv_obj_align(fanText, NULL, LV_ALIGN_CENTER, 0, -65);
243
+}
244
+
245
+void lv_clear_fan() { lv_obj_del(scr); }
246
+
247
+#endif // TFT_LITTLE_VGL_UI

+ 35
- 0
Marlin/src/lcd/extui/lib/mks_ui/draw_fan.h View File

@@ -0,0 +1,35 @@
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 <http://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_fan(void);
29
+extern void lv_clear_fan();
30
+extern void disp_fan_value();
31
+
32
+//extern void disp_temp_ready_print();
33
+#ifdef __cplusplus
34
+} /* C-declarations for C++ */
35
+#endif

+ 283
- 0
Marlin/src/lcd/extui/lib/mks_ui/draw_home.cpp View File

@@ -0,0 +1,283 @@
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 <http://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+#include "../../../../inc/MarlinConfigPre.h"
23
+
24
+#if ENABLED(TFT_LITTLE_VGL_UI)
25
+
26
+#include "../../../../MarlinCore.h"
27
+#include "draw_ready_print.h"
28
+#include "draw_set.h"
29
+#include "lv_conf.h"
30
+//#include "../lvgl/src/lv_objx/lv_imgbtn.h"
31
+//#include "../lvgl/src/lv_objx/lv_img.h"
32
+//#include "../lvgl/src/lv_core/lv_disp.h"
33
+//#include "../lvgl/src/lv_core/lv_refr.h"
34
+#include "draw_ui.h"
35
+#include "../../../../gcode/queue.h"
36
+
37
+static lv_obj_t * scr;
38
+
39
+#define ID_H_ALL      1
40
+#define ID_H_X        2
41
+#define ID_H_Y        3
42
+#define ID_H_Z        4
43
+#define ID_H_RETURN   5
44
+#define ID_H_OFF_ALL  6
45
+#define ID_H_OFF_XY   7
46
+
47
+static void event_handler(lv_obj_t * obj, lv_event_t event) {
48
+  switch (obj->mks_obj_id) {
49
+    case ID_H_ALL:
50
+      if (event == LV_EVENT_CLICKED) {
51
+
52
+
53
+      }
54
+      else if (event == LV_EVENT_RELEASED) {
55
+        queue.inject_P(PSTR("G28"));
56
+      }
57
+      break;
58
+    case ID_H_X:
59
+      if (event == LV_EVENT_CLICKED) {
60
+
61
+
62
+      }
63
+      else if (event == LV_EVENT_RELEASED) {
64
+        queue.inject_P(PSTR("G28 X0"));
65
+      }
66
+      break;
67
+    case ID_H_Y:
68
+      if (event == LV_EVENT_CLICKED) {
69
+
70
+
71
+      }
72
+      else if (event == LV_EVENT_RELEASED) {
73
+        queue.inject_P(PSTR("G28 Y0"));
74
+      }
75
+      break;
76
+    case ID_H_Z:
77
+      if (event == LV_EVENT_CLICKED) {
78
+
79
+
80
+      }
81
+      else if (event == LV_EVENT_RELEASED) {
82
+        queue.inject_P(PSTR("G28 Z0"));
83
+      }
84
+      break;
85
+    case ID_H_OFF_ALL:
86
+      if (event == LV_EVENT_CLICKED) {
87
+
88
+
89
+      }
90
+      else if (event == LV_EVENT_RELEASED) {
91
+        queue.inject_P(PSTR("M84"));
92
+      }
93
+      break;
94
+    case ID_H_OFF_XY:
95
+      if (event == LV_EVENT_CLICKED) {
96
+
97
+
98
+      }
99
+      else if (event == LV_EVENT_RELEASED) {
100
+        queue.inject_P(PSTR("M84 X Y"));
101
+      }
102
+      break;
103
+    case ID_H_RETURN:
104
+      if (event == LV_EVENT_CLICKED) {
105
+
106
+      }
107
+      else if (event == LV_EVENT_RELEASED) {
108
+        lv_obj_del(scr);
109
+        lv_draw_tool();
110
+      }
111
+      break;
112
+
113
+  }
114
+}
115
+
116
+
117
+void lv_draw_home(void) {
118
+  lv_obj_t *buttonHomeAll, *buttonHomeX, *buttonHomeY, *buttonHomeZ;
119
+  lv_obj_t *buttonBack;
120
+  lv_obj_t *buttonOffAll, *buttonOffXY;
121
+
122
+  if (disp_state_stack._disp_state[disp_state_stack._disp_index] != ZERO_UI) {
123
+    disp_state_stack._disp_index++;
124
+    disp_state_stack._disp_state[disp_state_stack._disp_index] = ZERO_UI;
125
+  }
126
+  disp_state = ZERO_UI;
127
+
128
+  scr = lv_obj_create(NULL, NULL);
129
+
130
+  //static lv_style_t tool_style;
131
+
132
+  lv_obj_set_style(scr, &tft_style_scr);
133
+  lv_scr_load(scr);
134
+  lv_obj_clean(scr);
135
+
136
+  lv_obj_t * title = lv_label_create(scr, NULL);
137
+  lv_obj_set_style(title, &tft_style_lable_rel);
138
+  lv_obj_set_pos(title, TITLE_XPOS, TITLE_YPOS);
139
+  lv_label_set_text(title, creat_title_text());
140
+
141
+  lv_refr_now(lv_refr_get_disp_refreshing());
142
+
143
+  LV_IMG_DECLARE(bmp_pic);
144
+
145
+  /*Create an Image button*/
146
+  //buttonWifi = lv_imgbtn_create(scr, NULL);
147
+  buttonHomeAll = lv_imgbtn_create(scr, NULL);
148
+  buttonHomeX = lv_imgbtn_create(scr, NULL);
149
+  //buttonContinue = lv_imgbtn_create(scr, NULL);
150
+  buttonHomeY = lv_imgbtn_create(scr, NULL);
151
+  buttonHomeZ = lv_imgbtn_create(scr, NULL);
152
+  buttonBack = lv_imgbtn_create(scr, NULL);
153
+  buttonOffAll = lv_imgbtn_create(scr, NULL);
154
+  buttonOffXY = lv_imgbtn_create(scr, NULL);
155
+
156
+  //lv_obj_set_event_cb_mks(buttonWifi, event_handler,ID_S_WIFI,"bmp_Wifi.bin",0);
157
+  //lv_imgbtn_set_src(buttonWifi, LV_BTN_STATE_REL, &bmp_pic);
158
+  //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);
161
+  //lv_obj_clear_protect(buttonWifi, LV_PROTECT_FOLLOW);
162
+  #if 1
163
+    lv_obj_set_event_cb_mks(buttonHomeAll, event_handler, ID_H_ALL, "bmp_Zero.bin", 0);
164
+    lv_imgbtn_set_src(buttonHomeAll, LV_BTN_STATE_REL, &bmp_pic);
165
+    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);
168
+
169
+    lv_obj_set_event_cb_mks(buttonHomeX, event_handler, ID_H_X, "bmp_zeroX.bin", 0);
170
+    lv_imgbtn_set_src(buttonHomeX, LV_BTN_STATE_REL, &bmp_pic);
171
+    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);
174
+
175
+    //lv_obj_set_event_cb_mks(buttonContinue, event_handler,ID_S_CONTINUE,"bmp_Breakpoint.bin",0);
176
+    //lv_imgbtn_set_src(buttonContinue, LV_BTN_STATE_REL, &bmp_pic);
177
+    //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);
180
+
181
+    lv_obj_set_event_cb_mks(buttonHomeY, event_handler, ID_H_Y, "bmp_zeroY.bin", 0);
182
+    lv_imgbtn_set_src(buttonHomeY, LV_BTN_STATE_REL, &bmp_pic);
183
+    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);
186
+
187
+    lv_obj_set_event_cb_mks(buttonHomeZ, event_handler, ID_H_Z, "bmp_zeroZ.bin", 0);
188
+    lv_imgbtn_set_src(buttonHomeZ, LV_BTN_STATE_REL, &bmp_pic);
189
+    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);
192
+
193
+    lv_obj_set_event_cb_mks(buttonOffAll, event_handler, ID_H_OFF_ALL, "bmp_Motor_off.bin", 0);
194
+    lv_imgbtn_set_src(buttonOffAll, LV_BTN_STATE_REL, &bmp_pic);
195
+    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);
198
+
199
+    lv_obj_set_event_cb_mks(buttonOffXY, event_handler, ID_H_OFF_XY, "bmp_Motor_off.bin", 0);
200
+    lv_imgbtn_set_src(buttonOffXY, LV_BTN_STATE_REL, &bmp_pic);
201
+    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);
204
+
205
+    lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_H_RETURN, "bmp_Return.bin", 0);
206
+    lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_REL, &bmp_pic);
207
+    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);
210
+  #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);
220
+  lv_obj_set_pos(buttonHomeX, BTN_X_PIXEL + INTERVAL_V * 2, titleHeight);
221
+  lv_obj_set_pos(buttonHomeY, BTN_X_PIXEL * 2 + INTERVAL_V * 3, titleHeight);
222
+  //lv_obj_set_pos(buttonContinue,BTN_X_PIXEL*3+INTERVAL_V*4,titleHeight);
223
+  lv_obj_set_pos(buttonHomeZ, BTN_X_PIXEL * 3 + INTERVAL_V * 4, titleHeight);
224
+  lv_obj_set_pos(buttonHomeAll, INTERVAL_V, titleHeight);
225
+  lv_obj_set_pos(buttonOffAll, INTERVAL_V, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
226
+  lv_obj_set_pos(buttonOffXY, BTN_X_PIXEL + INTERVAL_V * 2, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
227
+  lv_obj_set_pos(buttonBack, BTN_X_PIXEL * 3 + INTERVAL_V * 4, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
228
+
229
+  /*Create a label on the Image button*/
230
+  //lv_btn_set_layout(buttonWifi, LV_LAYOUT_OFF);
231
+  lv_btn_set_layout(buttonHomeAll, LV_LAYOUT_OFF);
232
+  lv_btn_set_layout(buttonHomeX, LV_LAYOUT_OFF);
233
+  //lv_btn_set_layout(buttonContinue, LV_LAYOUT_OFF);
234
+  lv_btn_set_layout(buttonHomeY, LV_LAYOUT_OFF);
235
+  lv_btn_set_layout(buttonHomeZ, LV_LAYOUT_OFF);
236
+  lv_btn_set_layout(buttonOffAll, LV_LAYOUT_OFF);
237
+  lv_btn_set_layout(buttonOffXY, LV_LAYOUT_OFF);
238
+  lv_btn_set_layout(buttonBack, LV_LAYOUT_OFF);
239
+
240
+  //lv_obj_t * labelWifi= lv_label_create(buttonWifi, NULL);
241
+  lv_obj_t * labelHomeAll = lv_label_create(buttonHomeAll, NULL);
242
+  lv_obj_t * labelHomeX = lv_label_create(buttonHomeX, NULL);
243
+  //lv_obj_t * label_Continue = lv_label_create(buttonContinue, NULL);
244
+  lv_obj_t * labelHomeY = lv_label_create(buttonHomeY, NULL);
245
+  lv_obj_t * labelHomeZ = lv_label_create(buttonHomeZ, NULL);
246
+  lv_obj_t * labelOffAll = lv_label_create(buttonOffAll, NULL);
247
+  lv_obj_t * labelOffXY = lv_label_create(buttonOffXY, NULL);
248
+  lv_obj_t * label_Back = lv_label_create(buttonBack, NULL);
249
+
250
+
251
+  if (gCfgItems.multiple_language != 0) {
252
+    //lv_label_set_text(labelWifi, set_menu.wifi);
253
+    //lv_obj_align(labelWifi, buttonWifi, LV_ALIGN_IN_BOTTOM_MID,0, BUTTON_TEXT_Y_OFFSET);
254
+
255
+    lv_label_set_text(labelHomeAll, home_menu.home_all);
256
+    lv_obj_align(labelHomeAll, buttonHomeAll, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
257
+
258
+    lv_label_set_text(labelHomeX, home_menu.home_x);
259
+    lv_obj_align(labelHomeX, buttonHomeX, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
260
+
261
+    //lv_label_set_text(label_Continue, set_menu.breakpoint);
262
+    //lv_obj_align(label_Continue, buttonContinue, LV_ALIGN_IN_BOTTOM_MID,0, BUTTON_TEXT_Y_OFFSET);
263
+
264
+    lv_label_set_text(labelHomeY, home_menu.home_y);
265
+    lv_obj_align(labelHomeY, buttonHomeY, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
266
+
267
+    lv_label_set_text(labelHomeZ, home_menu.home_z);
268
+    lv_obj_align(labelHomeZ, buttonHomeZ, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
269
+
270
+    lv_label_set_text(labelOffAll, set_menu.motoroff);
271
+    lv_obj_align(labelOffAll, buttonOffAll, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
272
+
273
+    lv_label_set_text(labelOffXY, set_menu.motoroffXY);
274
+    lv_obj_align(labelOffXY, buttonOffXY, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
275
+
276
+    lv_label_set_text(label_Back, common_menu.text_back);
277
+    lv_obj_align(label_Back, buttonBack, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
278
+  }
279
+}
280
+
281
+void lv_clear_home() { lv_obj_del(scr); }
282
+
283
+#endif // TFT_LITTLE_VGL_UI

+ 34
- 0
Marlin/src/lcd/extui/lib/mks_ui/draw_home.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 <http://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_home(void);
29
+extern void lv_clear_home();
30
+
31
+//extern void disp_temp_ready_print();
32
+#ifdef __cplusplus
33
+} /* C-declarations for C++ */
34
+#endif

+ 370
- 0
Marlin/src/lcd/extui/lib/mks_ui/draw_language.cpp View File

@@ -0,0 +1,370 @@
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 <http://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+#include "../../../../inc/MarlinConfigPre.h"
23
+
24
+#if ENABLED(TFT_LITTLE_VGL_UI)
25
+
26
+#include "lv_conf.h"
27
+#include "draw_ui.h"
28
+//#include "../lvgl/src/lv_objx/lv_imgbtn.h"
29
+//#include "../lvgl/src/lv_objx/lv_img.h"
30
+//#include "../lvgl/src/lv_core/lv_disp.h"
31
+//#include "../lvgl/src/lv_core/lv_refr.h"
32
+
33
+#include "../../../../MarlinCore.h"
34
+#include <string.h>
35
+
36
+//static lv_obj_t *buttonMoveZ,*buttonTest,*buttonZ0,*buttonStop,*buttonReturn;
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
46
+
47
+#define SELECTED                        1
48
+#define UNSELECTED                      0
49
+
50
+static void disp_language(uint8_t language, uint8_t state);
51
+
52
+static lv_obj_t * scr;
53
+static lv_obj_t *buttonCN, *buttonT_CN, *buttonEN, *buttonRU;
54
+static lv_obj_t *buttonES, *buttonFR, *buttonIT, *buttonBack;
55
+
56
+static void event_handler(lv_obj_t * obj, lv_event_t event) {
57
+  switch (obj->mks_obj_id) {
58
+    case ID_CN:
59
+      if (event == LV_EVENT_CLICKED) {
60
+        // nothing to do
61
+      }
62
+      else if (event == LV_EVENT_RELEASED) {
63
+        disp_language(gCfgItems.language, UNSELECTED);
64
+        lv_obj_set_event_cb_mks(buttonCN, event_handler, ID_CN, "bmp_Simple_cn_sel.bin", 0);
65
+        gCfgItems.language = LANG_SIMPLE_CHINESE;
66
+        gCfg_to_spiFlah();
67
+        disp_language_init();
68
+      }
69
+      break;
70
+    case ID_T_CN:
71
+      if (event == LV_EVENT_CLICKED) {
72
+        // nothing to do
73
+      }
74
+      else if (event == LV_EVENT_RELEASED) {
75
+        disp_language(gCfgItems.language, UNSELECTED);
76
+        lv_obj_set_event_cb_mks(buttonT_CN, event_handler, ID_T_CN, "bmp_Tradition_cn_sel.bin", 0);
77
+        gCfgItems.language = LANG_COMPLEX_CHINESE;
78
+        gCfg_to_spiFlah();
79
+        disp_language_init();
80
+      }
81
+      break;
82
+    case ID_EN:
83
+      if (event == LV_EVENT_CLICKED) {
84
+        // nothing to do
85
+      }
86
+      else if (event == LV_EVENT_RELEASED) {
87
+        disp_language(gCfgItems.language, UNSELECTED);
88
+        lv_obj_set_event_cb_mks(buttonEN, event_handler, ID_EN, "bmp_English_sel.bin", 0);
89
+        gCfgItems.language = LANG_ENGLISH;
90
+        gCfg_to_spiFlah();
91
+        disp_language_init();
92
+      }
93
+      break;
94
+    case ID_RU:
95
+      if (event == LV_EVENT_CLICKED) {
96
+        // nothing to do
97
+      }
98
+      else if (event == LV_EVENT_RELEASED) {
99
+        disp_language(gCfgItems.language, UNSELECTED);
100
+        lv_obj_set_event_cb_mks(buttonRU, event_handler, ID_RU, "bmp_Russian_sel.bin", 0);
101
+        gCfgItems.language = LANG_RUSSIAN;
102
+        gCfg_to_spiFlah();
103
+        disp_language_init();
104
+      }
105
+      break;
106
+    case ID_ES:
107
+      if (event == LV_EVENT_CLICKED) {
108
+        // nothing to do
109
+      }
110
+      else if (event == LV_EVENT_RELEASED) {
111
+        disp_language(gCfgItems.language, UNSELECTED);
112
+        lv_obj_set_event_cb_mks(buttonES, event_handler, ID_ES, "bmp_Spanish_sel.bin", 0);
113
+        gCfgItems.language = LANG_SPANISH;
114
+        gCfg_to_spiFlah();
115
+        disp_language_init();
116
+      }
117
+      break;
118
+    case ID_FR:
119
+      if (event == LV_EVENT_CLICKED) {
120
+        // nothing to do
121
+      }
122
+      else if (event == LV_EVENT_RELEASED) {
123
+        disp_language(gCfgItems.language, UNSELECTED);
124
+        lv_obj_set_event_cb_mks(buttonFR, event_handler, ID_FR, "bmp_French_sel.bin", 0);
125
+        gCfgItems.language = LANG_FRENCH;
126
+        gCfg_to_spiFlah();
127
+        disp_language_init();
128
+      }
129
+      break;
130
+    case ID_IT:
131
+      if (event == LV_EVENT_CLICKED) {
132
+        // nothing to do
133
+      }
134
+      else if (event == LV_EVENT_RELEASED) {
135
+        disp_language(gCfgItems.language, UNSELECTED);
136
+        lv_obj_set_event_cb_mks(buttonIT, event_handler, ID_FR, "bmp_Italy_sel.bin", 0);
137
+        gCfgItems.language = LANG_ITALY;
138
+        gCfg_to_spiFlah();
139
+        disp_language_init();
140
+      }
141
+      break;
142
+    case ID_L_RETURN:
143
+      if (event == LV_EVENT_CLICKED) {
144
+
145
+      }
146
+      else if (event == LV_EVENT_RELEASED) {
147
+
148
+        buttonCN = NULL;
149
+        buttonT_CN = NULL;
150
+        buttonEN = NULL;
151
+        buttonRU = NULL;
152
+        buttonES = NULL;
153
+        buttonFR = NULL;
154
+        buttonFR = NULL;
155
+        buttonIT = NULL;
156
+        buttonBack = NULL;
157
+
158
+        lv_obj_del(scr);
159
+        lv_draw_set();
160
+      }
161
+      break;
162
+
163
+  }
164
+}
165
+
166
+static void disp_language(uint8_t language, uint8_t state) {
167
+  uint16_t id;
168
+  lv_obj_t *obj;
169
+
170
+  public_buf_l[0] = '\0';
171
+
172
+  switch (language) {
173
+
174
+    case LANG_SIMPLE_CHINESE:
175
+      id = ID_CN;
176
+      strcat(public_buf_l, "bmp_Simple_cn");
177
+      obj = buttonCN;
178
+
179
+      break;
180
+    case LANG_COMPLEX_CHINESE:
181
+      id = ID_T_CN;
182
+      strcat(public_buf_l, "bmp_Tradition_cn");
183
+      obj = buttonT_CN;
184
+      break;
185
+    case LANG_ENGLISH:
186
+      id = ID_EN;
187
+      strcat(public_buf_l, "bmp_English");
188
+      obj = buttonEN;
189
+      break;
190
+    case LANG_RUSSIAN:
191
+      id = ID_RU;
192
+      strcat(public_buf_l, "bmp_Russian");
193
+      obj = buttonRU;
194
+      break;
195
+    case LANG_SPANISH:
196
+      id = ID_ES;
197
+      strcat(public_buf_l, "bmp_Spanish");
198
+      obj = buttonES;
199
+      break;
200
+    case LANG_FRENCH:
201
+      id = ID_FR;
202
+      strcat(public_buf_l, "bmp_French");
203
+      obj = buttonFR;
204
+      break;
205
+    case LANG_ITALY:
206
+      id = ID_IT;
207
+      strcat(public_buf_l, "bmp_Italy");
208
+      obj = buttonIT;
209
+      break;
210
+    default:
211
+      id = ID_CN;
212
+      strcat(public_buf_l, "bmp_Simple_cn");
213
+      obj = buttonCN;
214
+      break;
215
+  }
216
+
217
+  if (state == SELECTED) strcat(public_buf_l, "_sel.bin");
218
+  else strcat(public_buf_l, ".bin");
219
+
220
+  lv_obj_set_event_cb_mks(obj, event_handler, id, public_buf_l, 0);
221
+
222
+  if (state == UNSELECTED) lv_obj_refresh_ext_draw_pad(obj);
223
+}
224
+
225
+void lv_draw_language(void) {
226
+
227
+  if (disp_state_stack._disp_state[disp_state_stack._disp_index] != LANGUAGE_UI) {
228
+    disp_state_stack._disp_index++;
229
+    disp_state_stack._disp_state[disp_state_stack._disp_index] = LANGUAGE_UI;
230
+  }
231
+  disp_state = LANGUAGE_UI;
232
+
233
+  scr = lv_obj_create(NULL, NULL);
234
+
235
+  //static lv_style_t tool_style;
236
+
237
+  lv_obj_set_style(scr, &tft_style_scr);
238
+  lv_scr_load(scr);
239
+  lv_obj_clean(scr);
240
+
241
+  lv_obj_t * title = lv_label_create(scr, NULL);
242
+  lv_obj_set_style(title, &tft_style_lable_rel);
243
+  lv_obj_set_pos(title, TITLE_XPOS, TITLE_YPOS);
244
+  lv_label_set_text(title, creat_title_text());
245
+
246
+  lv_refr_now(lv_refr_get_disp_refreshing());
247
+
248
+  LV_IMG_DECLARE(bmp_pic);
249
+
250
+  /*Create an Image button*/
251
+  buttonCN = lv_imgbtn_create(scr, NULL);
252
+  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);
258
+  buttonBack = lv_imgbtn_create(scr, NULL);
259
+
260
+
261
+  lv_obj_set_event_cb_mks(buttonCN, event_handler, ID_CN, "bmp_Simple_cn.bin", 0);
262
+  lv_imgbtn_set_src(buttonCN, LV_BTN_STATE_REL, &bmp_pic);
263
+  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);
266
+  lv_obj_clear_protect(buttonCN, LV_PROTECT_FOLLOW);
267
+  #if 1
268
+    lv_obj_set_event_cb_mks(buttonT_CN, event_handler, ID_T_CN, "bmp_Tradition_cn.bin", 0);
269
+    lv_imgbtn_set_src(buttonT_CN, LV_BTN_STATE_REL, &bmp_pic);
270
+    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);
273
+
274
+    lv_obj_set_event_cb_mks(buttonEN, event_handler, ID_EN, "bmp_English.bin", 0);
275
+    lv_imgbtn_set_src(buttonEN, LV_BTN_STATE_REL, &bmp_pic);
276
+    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);
279
+
280
+    lv_obj_set_event_cb_mks(buttonRU, event_handler, ID_RU, "bmp_Russian.bin", 0);
281
+    lv_imgbtn_set_src(buttonRU, LV_BTN_STATE_REL, &bmp_pic);
282
+    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);
285
+
286
+    lv_obj_set_event_cb_mks(buttonES, event_handler, ID_ES, "bmp_Spanish.bin", 0);
287
+    lv_imgbtn_set_src(buttonES, LV_BTN_STATE_REL, &bmp_pic);
288
+    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);
291
+
292
+    lv_obj_set_event_cb_mks(buttonFR, event_handler, ID_FR, "bmp_French.bin", 0);
293
+    lv_imgbtn_set_src(buttonFR, LV_BTN_STATE_REL, &bmp_pic);
294
+    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);
297
+
298
+    lv_obj_set_event_cb_mks(buttonIT, event_handler, ID_IT, "bmp_Italy.bin", 0);
299
+    lv_imgbtn_set_src(buttonIT, LV_BTN_STATE_REL, &bmp_pic);
300
+    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);
303
+
304
+    lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_L_RETURN, "bmp_Return.bin", 0);
305
+    lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_REL, &bmp_pic);
306
+    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
310
+
311
+  lv_obj_set_pos(buttonCN, INTERVAL_V, titleHeight);
312
+  lv_obj_set_pos(buttonT_CN, BTN_X_PIXEL + INTERVAL_V * 2, titleHeight);
313
+  lv_obj_set_pos(buttonEN, BTN_X_PIXEL * 2 + INTERVAL_V * 3, titleHeight);
314
+  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);
316
+  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);
319
+
320
+  /*Create a label on the Image button*/
321
+  lv_btn_set_layout(buttonCN, LV_LAYOUT_OFF);
322
+  lv_btn_set_layout(buttonT_CN, LV_LAYOUT_OFF);
323
+  lv_btn_set_layout(buttonEN, LV_LAYOUT_OFF);
324
+  lv_btn_set_layout(buttonRU, LV_LAYOUT_OFF);
325
+  lv_btn_set_layout(buttonES, LV_LAYOUT_OFF);
326
+  lv_btn_set_layout(buttonFR, LV_LAYOUT_OFF);
327
+  lv_btn_set_layout(buttonIT, LV_LAYOUT_OFF);
328
+  lv_btn_set_layout(buttonBack, LV_LAYOUT_OFF);
329
+
330
+  lv_obj_t * label_CN = lv_label_create(buttonCN, NULL);
331
+  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);
337
+  lv_obj_t * label_Back = lv_label_create(buttonBack, NULL);
338
+
339
+  disp_language(gCfgItems.language, SELECTED);
340
+
341
+  if (gCfgItems.multiple_language != 0) {
342
+    lv_label_set_text(label_CN, language_menu.chinese_s);
343
+    lv_obj_align(label_CN, buttonCN, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
344
+
345
+    lv_label_set_text(label_T_CN, language_menu.chinese_t);
346
+    lv_obj_align(label_T_CN, buttonT_CN, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
347
+
348
+    lv_label_set_text(label_EN, language_menu.english);
349
+    lv_obj_align(label_EN, buttonEN, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
350
+
351
+    lv_label_set_text(label_RU, language_menu.russian);
352
+    lv_obj_align(label_RU, buttonRU, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
353
+
354
+    lv_label_set_text(label_ES, language_menu.spanish);
355
+    lv_obj_align(label_ES, buttonES, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
356
+
357
+    lv_label_set_text(label_FR, language_menu.french);
358
+    lv_obj_align(label_FR, buttonFR, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
359
+
360
+    lv_label_set_text(label_IT, language_menu.italy);
361
+    lv_obj_align(label_IT, buttonIT, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
362
+
363
+    lv_label_set_text(label_Back, common_menu.text_back);
364
+    lv_obj_align(label_Back, buttonBack, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
365
+  }
366
+}
367
+
368
+void lv_clear_language() { lv_obj_del(scr); }
369
+
370
+#endif // TFT_LITTLE_VGL_UI

+ 34
- 0
Marlin/src/lcd/extui/lib/mks_ui/draw_language.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 <http://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_language(void);
29
+extern void lv_clear_language();
30
+
31
+//extern void disp_temp_ready_print();
32
+#ifdef __cplusplus
33
+} /* C-declarations for C++ */
34
+#endif

+ 284
- 0
Marlin/src/lcd/extui/lib/mks_ui/draw_manuaLevel.cpp View File

@@ -0,0 +1,284 @@
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 <http://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+#include "../../../../inc/MarlinConfigPre.h"
23
+
24
+#if ENABLED(TFT_LITTLE_VGL_UI)
25
+
26
+#include "../../../../MarlinCore.h"
27
+#include "lv_conf.h"
28
+//#include "../lvgl/src/lv_objx/lv_imgbtn.h"
29
+//#include "../lvgl/src/lv_objx/lv_img.h"
30
+//#include "../lvgl/src/lv_core/lv_disp.h"
31
+//#include "../lvgl/src/lv_core/lv_refr.h"
32
+#include "draw_ui.h"
33
+#include "../../../../gcode/queue.h"
34
+
35
+//static lv_obj_t *buttonMoveZ,*buttonTest,*buttonZ0,*buttonStop,*buttonReturn;
36
+static lv_obj_t * scr;
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
45
+
46
+static void event_handler(lv_obj_t * obj, lv_event_t event) {
47
+  switch (obj->mks_obj_id) {
48
+    case ID_M_POINT1:
49
+      if (event == LV_EVENT_CLICKED) {
50
+        // nothing to do
51
+      }
52
+      else if (event == LV_EVENT_RELEASED) {
53
+
54
+        if (queue.length == 0) {
55
+          if (uiCfg.leveling_first_time) {
56
+            queue.enqueue_one_P(PSTR("G28"));
57
+            uiCfg.leveling_first_time = 0;
58
+          }
59
+
60
+          queue.enqueue_one_P(PSTR("G1 Z10"));
61
+
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"));
66
+        }
67
+      }
68
+      break;
69
+    case ID_M_POINT2:
70
+      if (event == LV_EVENT_CLICKED) {
71
+        // nothing to do
72
+      }
73
+      else if (event == LV_EVENT_RELEASED) {
74
+        if (queue.length == 0) {
75
+          if (uiCfg.leveling_first_time) {
76
+            queue.enqueue_one_P(PSTR("G28"));
77
+            uiCfg.leveling_first_time = 0;
78
+          }
79
+
80
+          queue.enqueue_one_P(PSTR("G1 Z10"));
81
+
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"));
86
+        }
87
+      }
88
+      break;
89
+    case ID_M_POINT3:
90
+      if (event == LV_EVENT_CLICKED) {
91
+        // nothing to do
92
+      }
93
+      else if (event == LV_EVENT_RELEASED) {
94
+        if (queue.length == 0) {
95
+          if (uiCfg.leveling_first_time) {
96
+            queue.enqueue_one_P(PSTR("G28"));
97
+            uiCfg.leveling_first_time = 0;
98
+          }
99
+
100
+          queue.enqueue_one_P(PSTR("G1 Z10"));
101
+
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"));
106
+        }
107
+      }
108
+
109
+      break;
110
+    case ID_M_POINT4:
111
+      if (event == LV_EVENT_CLICKED) {
112
+        // nothing to do
113
+      }
114
+      else if (event == LV_EVENT_RELEASED) {
115
+        if (queue.length == 0) {
116
+          if (uiCfg.leveling_first_time) {
117
+            queue.enqueue_one_P(PSTR("G28"));
118
+            uiCfg.leveling_first_time = 0;
119
+          }
120
+
121
+          queue.enqueue_one_P(PSTR("G1 Z10"));
122
+
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"));
127
+        }
128
+      }
129
+      break;
130
+    case ID_M_POINT5:
131
+      if (event == LV_EVENT_CLICKED) {
132
+        // nothing to do
133
+      }
134
+      else if (event == LV_EVENT_RELEASED) {
135
+        if (queue.length == 0) {
136
+          if (uiCfg.leveling_first_time) {
137
+            queue.enqueue_one_P(PSTR("G28"));
138
+            uiCfg.leveling_first_time = 0;
139
+          }
140
+
141
+          queue.enqueue_one_P(PSTR("G1 Z10"));
142
+
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"));
147
+        }
148
+      }
149
+
150
+      break;
151
+    case ID_MANUAL_RETURN:
152
+      if (event == LV_EVENT_CLICKED) {
153
+        // nothing to do
154
+      }
155
+      else if (event == LV_EVENT_RELEASED) {
156
+        lv_clear_manualLevel();
157
+        lv_draw_tool();
158
+      }
159
+      break;
160
+
161
+  }
162
+}
163
+
164
+
165
+void lv_draw_manualLevel(void) {
166
+  lv_obj_t *buttonPoint1, *buttonPoint2, *buttonPoint3, *buttonPoint4, *buttonPoint5;
167
+  lv_obj_t *buttonBack;
168
+
169
+  if (disp_state_stack._disp_state[disp_state_stack._disp_index] != LEVELING_UI) {
170
+    disp_state_stack._disp_index++;
171
+    disp_state_stack._disp_state[disp_state_stack._disp_index] = LEVELING_UI;
172
+  }
173
+  disp_state = LEVELING_UI;
174
+
175
+  scr = lv_obj_create(NULL, NULL);
176
+
177
+  //static lv_style_t tool_style;
178
+
179
+  lv_obj_set_style(scr, &tft_style_scr);
180
+  lv_scr_load(scr);
181
+  lv_obj_clean(scr);
182
+
183
+  lv_obj_t * title = lv_label_create(scr, NULL);
184
+  lv_obj_set_style(title, &tft_style_lable_rel);
185
+  lv_obj_set_pos(title, TITLE_XPOS, TITLE_YPOS);
186
+  lv_label_set_text(title, creat_title_text());
187
+
188
+  lv_refr_now(lv_refr_get_disp_refreshing());
189
+
190
+  LV_IMG_DECLARE(bmp_pic);
191
+
192
+  /*Create an Image button*/
193
+  buttonPoint1 = lv_imgbtn_create(scr, NULL);
194
+  buttonPoint2 = lv_imgbtn_create(scr, NULL);
195
+  buttonPoint3 = lv_imgbtn_create(scr, NULL);
196
+  buttonPoint4 = lv_imgbtn_create(scr, NULL);
197
+  buttonPoint5 = lv_imgbtn_create(scr, NULL);
198
+  buttonBack = lv_imgbtn_create(scr, NULL);
199
+
200
+  lv_obj_set_event_cb_mks(buttonPoint1, event_handler, ID_M_POINT1, "bmp_Leveling1.bin", 0);
201
+  lv_imgbtn_set_src(buttonPoint1, LV_BTN_STATE_REL, &bmp_pic);
202
+  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);
205
+  lv_obj_clear_protect(buttonPoint1, LV_PROTECT_FOLLOW);
206
+  #if 1
207
+    lv_obj_set_event_cb_mks(buttonPoint2, event_handler, ID_M_POINT2, "bmp_Leveling2.bin", 0);
208
+    lv_imgbtn_set_src(buttonPoint2, LV_BTN_STATE_REL, &bmp_pic);
209
+    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);
212
+
213
+    lv_obj_set_event_cb_mks(buttonPoint3, event_handler, ID_M_POINT3, "bmp_Leveling3.bin", 0);
214
+    lv_imgbtn_set_src(buttonPoint3, LV_BTN_STATE_REL, &bmp_pic);
215
+    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);
218
+
219
+    lv_obj_set_event_cb_mks(buttonPoint4, event_handler, ID_M_POINT4, "bmp_Leveling4.bin", 0);
220
+    lv_imgbtn_set_src(buttonPoint4, LV_BTN_STATE_REL, &bmp_pic);
221
+    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);
224
+
225
+    lv_obj_set_event_cb_mks(buttonPoint5, event_handler, ID_M_POINT5, "bmp_Leveling5.bin", 0);
226
+    lv_imgbtn_set_src(buttonPoint5, LV_BTN_STATE_REL, &bmp_pic);
227
+    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);
230
+
231
+    lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_MANUAL_RETURN, "bmp_Return.bin", 0);
232
+    lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_REL, &bmp_pic);
233
+    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);
236
+  #endif
237
+
238
+  lv_obj_set_pos(buttonPoint1, INTERVAL_V, titleHeight);
239
+  lv_obj_set_pos(buttonPoint2, BTN_X_PIXEL + INTERVAL_V * 2, titleHeight);
240
+  lv_obj_set_pos(buttonPoint3, BTN_X_PIXEL * 2 + INTERVAL_V * 3, titleHeight);
241
+  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);
244
+
245
+  /*Create a label on the Image button*/
246
+  lv_btn_set_layout(buttonPoint1, LV_LAYOUT_OFF);
247
+  lv_btn_set_layout(buttonPoint2, LV_LAYOUT_OFF);
248
+  lv_btn_set_layout(buttonPoint3, LV_LAYOUT_OFF);
249
+  lv_btn_set_layout(buttonPoint4, LV_LAYOUT_OFF);
250
+  lv_btn_set_layout(buttonPoint5, LV_LAYOUT_OFF);
251
+  lv_btn_set_layout(buttonBack, LV_LAYOUT_OFF);
252
+
253
+  lv_obj_t * label_Point1 = lv_label_create(buttonPoint1, NULL);
254
+  lv_obj_t * label_Point2 = lv_label_create(buttonPoint2, NULL);
255
+  lv_obj_t * label_Point3 = lv_label_create(buttonPoint3, NULL);
256
+  lv_obj_t * label_Point4 = lv_label_create(buttonPoint4, NULL);
257
+  lv_obj_t * label_Point5 = lv_label_create(buttonPoint5, NULL);
258
+  lv_obj_t * label_Back = lv_label_create(buttonBack, NULL);
259
+
260
+
261
+  if (gCfgItems.multiple_language != 0) {
262
+    lv_label_set_text(label_Point1, leveling_menu.position1);
263
+    lv_obj_align(label_Point1, buttonPoint1, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
264
+
265
+    lv_label_set_text(label_Point2, leveling_menu.position2);
266
+    lv_obj_align(label_Point2, buttonPoint2, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
267
+
268
+    lv_label_set_text(label_Point3, leveling_menu.position3);
269
+    lv_obj_align(label_Point3, buttonPoint3, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
270
+
271
+    lv_label_set_text(label_Point4, leveling_menu.position4);
272
+    lv_obj_align(label_Point4, buttonPoint4, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
273
+
274
+    lv_label_set_text(label_Point5, leveling_menu.position5);
275
+    lv_obj_align(label_Point5, buttonPoint5, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
276
+
277
+    lv_label_set_text(label_Back, common_menu.text_back);
278
+    lv_obj_align(label_Back, buttonBack, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
279
+  }
280
+}
281
+
282
+void lv_clear_manualLevel() { lv_obj_del(scr); }
283
+
284
+#endif // TFT_LITTLE_VGL_UI

+ 34
- 0
Marlin/src/lcd/extui/lib/mks_ui/draw_manuaLevel.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 <http://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_manualLevel(void);
29
+extern void lv_clear_manualLevel();
30
+
31
+//extern void disp_temp_ready_print();
32
+#ifdef __cplusplus
33
+} /* C-declarations for C++ */
34
+#endif

+ 329
- 0
Marlin/src/lcd/extui/lib/mks_ui/draw_move_motor.cpp View File

@@ -0,0 +1,329 @@
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 <http://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+#include "../../../../inc/MarlinConfigPre.h"
23
+
24
+#if ENABLED(TFT_LITTLE_VGL_UI)
25
+
26
+#include "../../../../MarlinCore.h"
27
+#include "lv_conf.h"
28
+//#include "../lvgl/src/lv_objx/lv_imgbtn.h"
29
+//#include "../lvgl/src/lv_objx/lv_img.h"
30
+//#include "../lvgl/src/lv_core/lv_disp.h"
31
+//#include "../lvgl/src/lv_core/lv_refr.h"
32
+#include "draw_ui.h"
33
+#include "../../../../gcode/queue.h"
34
+
35
+static lv_obj_t * scr;
36
+
37
+static lv_obj_t * labelV, *buttonV;
38
+
39
+#define ID_M_X_P    1
40
+#define ID_M_X_N    2
41
+#define ID_M_Y_P    3
42
+#define ID_M_Y_N    4
43
+#define ID_M_Z_P    5
44
+#define ID_M_Z_N    6
45
+#define ID_M_STEP   7
46
+#define ID_M_RETURN 8
47
+
48
+static void event_handler(lv_obj_t * obj, lv_event_t event) {
49
+  switch (obj->mks_obj_id) {
50
+    case ID_M_X_P:
51
+      if (event == LV_EVENT_CLICKED) {
52
+        // nothing to do
53
+      }
54
+      else if (event == LV_EVENT_RELEASED) {
55
+        if (queue.length <= (BUFSIZE - 3)) {
56
+          memset(public_buf_l, 0, sizeof(public_buf_l));
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));
60
+          queue.enqueue_one_P(PSTR("G90"));
61
+        }
62
+      }
63
+      break;
64
+    case ID_M_X_N:
65
+      if (event == LV_EVENT_CLICKED) {
66
+        // nothing to do
67
+      }
68
+      else if (event == LV_EVENT_RELEASED) {
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"));
75
+        }
76
+      }
77
+      break;
78
+    case ID_M_Y_P:
79
+      if (event == LV_EVENT_CLICKED) {
80
+        // nothing to do
81
+      }
82
+      else if (event == LV_EVENT_RELEASED) {
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"));
89
+        }
90
+      }
91
+      break;
92
+    case ID_M_Y_N:
93
+      if (event == LV_EVENT_CLICKED) {
94
+        // nothing to do
95
+      }
96
+      else if (event == LV_EVENT_RELEASED) {
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"));
103
+        }
104
+      }
105
+      break;
106
+    case ID_M_Z_P:
107
+      if (event == LV_EVENT_CLICKED) {
108
+        // nothing to do
109
+      }
110
+      else if (event == LV_EVENT_RELEASED) {
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"));
117
+        }
118
+      }
119
+      break;
120
+    case ID_M_Z_N:
121
+      if (event == LV_EVENT_CLICKED) {
122
+        // nothing to do
123
+      }
124
+      else if (event == LV_EVENT_RELEASED) {
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"));
131
+        }
132
+      }
133
+      break;
134
+    case ID_M_STEP:
135
+      if (event == LV_EVENT_CLICKED) {
136
+        // nothing to do
137
+      }
138
+      else if (event == LV_EVENT_RELEASED) {
139
+        if (abs(10 * (int)uiCfg.move_dist) == 100)
140
+          uiCfg.move_dist = 0.1;
141
+        else
142
+          uiCfg.move_dist *= (float)10;
143
+
144
+        disp_move_dist();
145
+      }
146
+
147
+      break;
148
+    case ID_M_RETURN:
149
+      if (event == LV_EVENT_CLICKED) {
150
+        // nothing to do
151
+      }
152
+      else if (event == LV_EVENT_RELEASED) {
153
+        clear_cur_ui();
154
+        draw_return_ui();
155
+      }
156
+      break;
157
+
158
+  }
159
+}
160
+
161
+
162
+void lv_draw_move_motor(void) {
163
+  lv_obj_t  *buttonXI, *buttonXD, *buttonYI, *buttonYD;
164
+  lv_obj_t        *buttonZI, *buttonZD, *buttonBack;
165
+
166
+  if (disp_state_stack._disp_state[disp_state_stack._disp_index] != MOVE_MOTOR_UI) {
167
+    disp_state_stack._disp_index++;
168
+    disp_state_stack._disp_state[disp_state_stack._disp_index] = MOVE_MOTOR_UI;
169
+  }
170
+  disp_state = MOVE_MOTOR_UI;
171
+
172
+  scr = lv_obj_create(NULL, NULL);
173
+
174
+  lv_obj_set_style(scr, &tft_style_scr);
175
+  lv_scr_load(scr);
176
+  lv_obj_clean(scr);
177
+
178
+  lv_obj_t * title = lv_label_create(scr, NULL);
179
+  lv_obj_set_style(title, &tft_style_lable_rel);
180
+  lv_obj_set_pos(title, TITLE_XPOS, TITLE_YPOS);
181
+  lv_label_set_text(title, creat_title_text());
182
+
183
+  lv_refr_now(lv_refr_get_disp_refreshing());
184
+
185
+  LV_IMG_DECLARE(bmp_pic);
186
+
187
+
188
+  /*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);
196
+  buttonBack = lv_imgbtn_create(scr, NULL);
197
+
198
+  lv_obj_set_event_cb_mks(buttonXI, event_handler, ID_M_X_P, "bmp_xAdd.bin", 0);
199
+  lv_imgbtn_set_src(buttonXI, LV_BTN_STATE_REL, &bmp_pic);
200
+  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);
203
+  lv_obj_clear_protect(buttonXI, LV_PROTECT_FOLLOW);
204
+  #if 1
205
+    lv_obj_set_event_cb_mks(buttonXD, event_handler, ID_M_X_N, "bmp_xDec.bin", 0);
206
+    lv_imgbtn_set_src(buttonXD, LV_BTN_STATE_REL, &bmp_pic);
207
+    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);
210
+
211
+    lv_obj_set_event_cb_mks(buttonYI, event_handler, ID_M_Y_P, "bmp_yAdd.bin", 0);
212
+    lv_imgbtn_set_src(buttonYI, LV_BTN_STATE_REL, &bmp_pic);
213
+    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);
216
+
217
+    lv_obj_set_event_cb_mks(buttonYD, event_handler, ID_M_Y_N, "bmp_yDec.bin", 0);
218
+    lv_imgbtn_set_src(buttonYD, LV_BTN_STATE_REL, &bmp_pic);
219
+    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);
222
+
223
+    lv_obj_set_event_cb_mks(buttonZI, event_handler, ID_M_Z_P, "bmp_zAdd.bin", 0);
224
+    lv_imgbtn_set_src(buttonZI, LV_BTN_STATE_REL, &bmp_pic);
225
+    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);
228
+
229
+    lv_obj_set_event_cb_mks(buttonZD, event_handler, ID_M_Z_N, "bmp_zDec.bin", 0);
230
+    lv_imgbtn_set_src(buttonZD, LV_BTN_STATE_REL, &bmp_pic);
231
+    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);
234
+
235
+    //lv_obj_set_event_cb_mks(buttonV, event_handler,ID_T_MORE,"bmp_More.bin",0);
236
+    lv_imgbtn_set_src(buttonV, LV_BTN_STATE_REL, &bmp_pic);
237
+    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);
240
+
241
+    lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_M_RETURN, "bmp_Return.bin", 0);
242
+    lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_REL, &bmp_pic);
243
+    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
247
+  lv_obj_set_pos(buttonXI, INTERVAL_V, titleHeight);
248
+  lv_obj_set_pos(buttonYI, BTN_X_PIXEL + INTERVAL_V * 2, titleHeight);
249
+  lv_obj_set_pos(buttonZI, BTN_X_PIXEL * 2 + INTERVAL_V * 3, titleHeight);
250
+  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);
252
+  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);
255
+
256
+  /*Create a label on the Image button*/
257
+  lv_btn_set_layout(buttonXI, LV_LAYOUT_OFF);
258
+  lv_btn_set_layout(buttonXD, LV_LAYOUT_OFF);
259
+  lv_btn_set_layout(buttonYI, LV_LAYOUT_OFF);
260
+  lv_btn_set_layout(buttonYD, LV_LAYOUT_OFF);
261
+  lv_btn_set_layout(buttonZI, LV_LAYOUT_OFF);
262
+  lv_btn_set_layout(buttonZD, LV_LAYOUT_OFF);
263
+  lv_btn_set_layout(buttonV, LV_LAYOUT_OFF);
264
+  lv_btn_set_layout(buttonBack, LV_LAYOUT_OFF);
265
+
266
+  lv_obj_t * labelXI = lv_label_create(buttonXI, NULL);
267
+  lv_obj_t * labelXD = lv_label_create(buttonXD, NULL);
268
+  lv_obj_t * labelYI = lv_label_create(buttonYI, NULL);
269
+  lv_obj_t * labelYD = lv_label_create(buttonYD, NULL);
270
+  lv_obj_t * labelZI = lv_label_create(buttonZI, NULL);
271
+  lv_obj_t * labelZD = lv_label_create(buttonZD, NULL);
272
+  labelV = lv_label_create(buttonV, NULL);
273
+  lv_obj_t * label_Back = lv_label_create(buttonBack, NULL);
274
+
275
+
276
+  if (gCfgItems.multiple_language != 0) {
277
+    lv_label_set_text(labelXI, move_menu.x_add);
278
+    lv_obj_align(labelXI, buttonXI, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
279
+
280
+    lv_label_set_text(labelXD, move_menu.x_dec);
281
+    lv_obj_align(labelXD, buttonXD, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
282
+
283
+    lv_label_set_text(labelYI, move_menu.y_add);
284
+    lv_obj_align(labelYI, buttonYI, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
285
+
286
+    lv_label_set_text(labelYD, move_menu.y_dec);
287
+    lv_obj_align(labelYD, buttonYD, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
288
+
289
+    lv_label_set_text(labelZI, move_menu.z_add);
290
+    lv_obj_align(labelZI, buttonZI, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
291
+
292
+    lv_label_set_text(labelZD, move_menu.z_dec);
293
+    lv_obj_align(labelZD, buttonZD, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
294
+
295
+    lv_label_set_text(label_Back, common_menu.text_back);
296
+    lv_obj_align(label_Back, buttonBack, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
297
+  }
298
+
299
+  disp_move_dist();
300
+}
301
+
302
+void disp_move_dist() {
303
+  //char buf[30] = {0};
304
+
305
+  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);
307
+  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);
309
+  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);
311
+  if (gCfgItems.multiple_language != 0) {
312
+    if ((int)(10 * uiCfg.move_dist) == 1) {
313
+      lv_label_set_text(labelV, move_menu.step_01mm);
314
+      lv_obj_align(labelV, buttonV, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
315
+    }
316
+    else if ((int)(10 * uiCfg.move_dist) == 10) {
317
+      lv_label_set_text(labelV, move_menu.step_1mm);
318
+      lv_obj_align(labelV, buttonV, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
319
+    }
320
+    else if ((int)(10 * uiCfg.move_dist) == 100) {
321
+      lv_label_set_text(labelV, move_menu.step_10mm);
322
+      lv_obj_align(labelV, buttonV, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
323
+    }
324
+  }
325
+}
326
+
327
+void lv_clear_move_motor() { lv_obj_del(scr); }
328
+
329
+#endif // TFT_LITTLE_VGL_UI

+ 35
- 0
Marlin/src/lcd/extui/lib/mks_ui/draw_move_motor.h View File

@@ -0,0 +1,35 @@
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 <http://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_move_motor(void);
29
+extern void lv_clear_move_motor();
30
+extern void disp_move_dist();
31
+
32
+//extern void disp_temp_ready_print();
33
+#ifdef __cplusplus
34
+} /* C-declarations for C++ */
35
+#endif

+ 322
- 0
Marlin/src/lcd/extui/lib/mks_ui/draw_opration.cpp View File

@@ -0,0 +1,322 @@
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 <http://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+#include "../../../../inc/MarlinConfigPre.h"
23
+
24
+#if ENABLED(TFT_LITTLE_VGL_UI)
25
+
26
+#include "lv_conf.h"
27
+#include "draw_ui.h"
28
+//#include "../lvgl/src/lv_objx/lv_imgbtn.h"
29
+//#include "../lvgl/src/lv_objx/lv_img.h"
30
+//#include "../lvgl/src/lv_core/lv_disp.h"
31
+//#include "../lvgl/src/lv_core/lv_refr.h"
32
+
33
+#include "../../../../MarlinCore.h"
34
+
35
+static lv_obj_t * scr;
36
+
37
+#define ID_O_PRE_HEAT   1
38
+#define ID_O_EXTRUCT    2
39
+#define ID_O_MOV        3
40
+#define ID_O_FILAMENT   4
41
+#define ID_O_SPEED      5
42
+#define ID_O_RETURN     6
43
+#define ID_O_FAN        7
44
+#define ID_O_POWER_OFF  8
45
+
46
+static lv_obj_t *label_PowerOff;
47
+static lv_obj_t *buttonPowerOff;
48
+
49
+static void event_handler(lv_obj_t * obj, lv_event_t event) {
50
+  switch (obj->mks_obj_id) {
51
+    case ID_O_PRE_HEAT:
52
+      if (event == LV_EVENT_CLICKED) {
53
+        // nothing to do
54
+      }
55
+      else if (event == LV_EVENT_RELEASED) {
56
+        lv_clear_opration();
57
+        lv_draw_preHeat();
58
+      }
59
+      break;
60
+    case ID_O_EXTRUCT:
61
+      if (event == LV_EVENT_CLICKED) {
62
+        // nothing to do
63
+      }
64
+      else if (event == LV_EVENT_RELEASED) {
65
+        lv_clear_opration();
66
+        lv_draw_extrusion();
67
+      }
68
+      break;
69
+    case ID_O_MOV:
70
+      if (event == LV_EVENT_CLICKED) {
71
+        // nothing to do
72
+      }
73
+      else if (event == LV_EVENT_RELEASED) {
74
+        lv_clear_opration();
75
+        lv_draw_move_motor();
76
+      }
77
+      break;
78
+    case ID_O_FILAMENT:
79
+      if (event == LV_EVENT_CLICKED) {
80
+        // nothing to do
81
+      }
82
+      else if (event == LV_EVENT_RELEASED) {
83
+      }
84
+      break;
85
+    case ID_O_FAN:
86
+      if (event == LV_EVENT_CLICKED) {
87
+        // nothing to do
88
+      }
89
+      else if (event == LV_EVENT_RELEASED) {
90
+        lv_clear_opration();
91
+        lv_draw_fan();
92
+      }
93
+      break;
94
+    case ID_O_SPEED:
95
+      if (event == LV_EVENT_CLICKED) {
96
+        // nothing to do
97
+      }
98
+      else if (event == LV_EVENT_RELEASED) {
99
+        lv_clear_opration();
100
+        lv_draw_change_speed();
101
+      }
102
+      break;
103
+    case ID_O_RETURN:
104
+      if (event == LV_EVENT_CLICKED) {
105
+        // nothing to do
106
+      }
107
+      else if (event == LV_EVENT_RELEASED) {
108
+        clear_cur_ui();
109
+        draw_return_ui();
110
+      }
111
+      break;
112
+    case ID_O_POWER_OFF:
113
+      if (event == LV_EVENT_CLICKED) {
114
+        // nothing to do
115
+      }
116
+      else if (event == LV_EVENT_RELEASED) {
117
+        if (gCfgItems.finish_power_off == 1) {
118
+          gCfgItems.finish_power_off = 0;
119
+          lv_obj_set_event_cb_mks(obj, event_handler, ID_O_POWER_OFF, "bmp_Mamual.bin", 0);
120
+          lv_label_set_text(label_PowerOff, printing_more_menu.manual);
121
+          lv_obj_align(label_PowerOff, buttonPowerOff, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
122
+          lv_obj_refresh_ext_draw_pad(label_PowerOff);
123
+          update_spi_flash();
124
+        }
125
+        else {
126
+          gCfgItems.finish_power_off = 1;
127
+          lv_obj_set_event_cb_mks(obj, event_handler, ID_O_POWER_OFF, "bmp_Auto.bin", 0);
128
+          lv_label_set_text(label_PowerOff, printing_more_menu.auto_close);
129
+          lv_obj_align(label_PowerOff, buttonPowerOff, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
130
+          lv_obj_refresh_ext_draw_pad(label_PowerOff);
131
+          update_spi_flash();
132
+        }
133
+      }
134
+      break;
135
+
136
+  }
137
+}
138
+
139
+void lv_draw_opration(void) {
140
+  lv_obj_t *buttonPreHeat, *buttonExtrusion, *buttonSpeed;
141
+  lv_obj_t *buttonBack, *buttonFan;
142
+  lv_obj_t *labelPreHeat, *labelExtrusion;
143
+  lv_obj_t *label_Back, *label_Speed, *label_Fan;
144
+  lv_obj_t *buttonMove = NULL, *label_Move = NULL;
145
+
146
+  if (disp_state_stack._disp_state[disp_state_stack._disp_index] != OPERATE_UI) {
147
+    disp_state_stack._disp_index++;
148
+    disp_state_stack._disp_state[disp_state_stack._disp_index] = OPERATE_UI;
149
+  }
150
+  disp_state = OPERATE_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_lable_rel);
160
+  lv_obj_set_pos(title, TITLE_XPOS, TITLE_YPOS);
161
+  lv_label_set_text(title, creat_title_text());
162
+
163
+  lv_refr_now(lv_refr_get_disp_refreshing());
164
+
165
+  LV_IMG_DECLARE(bmp_pic);
166
+
167
+  /*Create an Image button*/
168
+  buttonPreHeat = lv_imgbtn_create(scr, NULL);
169
+  buttonExtrusion = lv_imgbtn_create(scr, NULL);
170
+  buttonFan = lv_imgbtn_create(scr, NULL);
171
+  buttonSpeed = lv_imgbtn_create(scr, NULL);
172
+
173
+  if (uiCfg.print_state != WORKING)
174
+    //buttonFilament = lv_imgbtn_create(scr, NULL);
175
+    //else
176
+    buttonMove = lv_imgbtn_create(scr, NULL);
177
+  buttonPowerOff = lv_imgbtn_create(scr, NULL);
178
+  buttonBack = lv_imgbtn_create(scr, NULL);
179
+
180
+  lv_obj_set_event_cb_mks(buttonPreHeat, event_handler, ID_O_PRE_HEAT, "bmp_PreHeat.bin", 0);
181
+  lv_imgbtn_set_src(buttonPreHeat, LV_BTN_STATE_REL, &bmp_pic);
182
+  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_obj_clear_protect(buttonPreHeat, LV_PROTECT_FOLLOW);
186
+  #if 1
187
+    lv_obj_set_event_cb_mks(buttonExtrusion, event_handler, ID_O_EXTRUCT, "bmp_Extruct.bin", 0);
188
+    lv_imgbtn_set_src(buttonExtrusion, LV_BTN_STATE_REL, &bmp_pic);
189
+    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
+
193
+    lv_obj_set_event_cb_mks(buttonFan, event_handler, ID_O_FAN, "bmp_Fan.bin", 0);
194
+    lv_imgbtn_set_src(buttonFan, LV_BTN_STATE_REL, &bmp_pic);
195
+    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
+
199
+    lv_obj_set_event_cb_mks(buttonSpeed, event_handler, ID_O_SPEED, "bmp_Speed.bin", 0);
200
+    lv_imgbtn_set_src(buttonSpeed, LV_BTN_STATE_REL, &bmp_pic);
201
+    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
+
205
+    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);
215
+      lv_imgbtn_set_src(buttonMove, LV_BTN_STATE_REL, &bmp_pic);
216
+      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
+    }
220
+    if (gCfgItems.finish_power_off == 1)
221
+      lv_obj_set_event_cb_mks(buttonPowerOff, event_handler, ID_O_POWER_OFF, "bmp_Auto.bin", 0);
222
+    else
223
+      lv_obj_set_event_cb_mks(buttonPowerOff, event_handler, ID_O_POWER_OFF, "bmp_Mamual.bin", 0);
224
+    lv_imgbtn_set_src(buttonPowerOff, LV_BTN_STATE_REL, &bmp_pic);
225
+    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
+
229
+    lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_O_RETURN, "bmp_Return.bin", 0);
230
+    lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_REL, &bmp_pic);
231
+    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
235
+
236
+  lv_obj_set_pos(buttonPreHeat, INTERVAL_V, titleHeight);
237
+  lv_obj_set_pos(buttonExtrusion, BTN_X_PIXEL + INTERVAL_V * 2, titleHeight);
238
+
239
+  lv_obj_set_pos(buttonFan, BTN_X_PIXEL * 2 + INTERVAL_V * 3, titleHeight);
240
+  lv_obj_set_pos(buttonSpeed, BTN_X_PIXEL * 3 + INTERVAL_V * 4, titleHeight);
241
+
242
+  if (uiCfg.print_state != WORKING) {
243
+    /*{
244
+            lv_obj_set_pos(buttonFilament,INTERVAL_V,BTN_Y_PIXEL+INTERVAL_H+titleHeight);
245
+    }
246
+    else*/
247
+    lv_obj_set_pos(buttonMove, INTERVAL_V, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
248
+    lv_obj_set_pos(buttonPowerOff, BTN_X_PIXEL + INTERVAL_V * 2, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
249
+  }
250
+  else {
251
+    lv_obj_set_pos(buttonPowerOff, INTERVAL_V, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
252
+  }
253
+  lv_obj_set_pos(buttonBack, BTN_X_PIXEL * 3 + INTERVAL_V * 4,  BTN_Y_PIXEL + INTERVAL_H + titleHeight);
254
+
255
+  /*Create a label on the Image button*/
256
+  lv_btn_set_layout(buttonPreHeat, LV_LAYOUT_OFF);
257
+  lv_btn_set_layout(buttonExtrusion, LV_LAYOUT_OFF);
258
+  lv_btn_set_layout(buttonFan, LV_LAYOUT_OFF);
259
+  lv_btn_set_layout(buttonSpeed, LV_LAYOUT_OFF);
260
+
261
+  if (uiCfg.print_state != WORKING)
262
+  /*{
263
+          lv_btn_set_layout(buttonFilament, LV_LAYOUT_OFF);
264
+  }
265
+  else*/
266
+    lv_btn_set_layout(buttonMove, LV_LAYOUT_OFF);
267
+  lv_btn_set_layout(buttonPowerOff, LV_LAYOUT_OFF);
268
+  lv_btn_set_layout(buttonBack, LV_LAYOUT_OFF);
269
+
270
+  labelPreHeat = lv_label_create(buttonPreHeat, NULL);
271
+  labelExtrusion = lv_label_create(buttonExtrusion, NULL);
272
+
273
+  label_Fan = lv_label_create(buttonFan, NULL);
274
+  label_Speed = lv_label_create(buttonSpeed, NULL);
275
+
276
+  if (uiCfg.print_state != WORKING)
277
+  /*{
278
+          label_Filament = lv_label_create(buttonFilament, NULL);
279
+  }
280
+  else*/
281
+    label_Move = lv_label_create(buttonMove, NULL);
282
+  label_PowerOff = lv_label_create(buttonPowerOff, NULL);
283
+
284
+  label_Back = lv_label_create(buttonBack, NULL);
285
+
286
+  if (gCfgItems.multiple_language != 0) {
287
+    lv_label_set_text(labelPreHeat, operation_menu.temp);
288
+    lv_obj_align(labelPreHeat, buttonPreHeat, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
289
+
290
+    lv_label_set_text(labelExtrusion, operation_menu.extr);
291
+    lv_obj_align(labelExtrusion, buttonExtrusion, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
292
+
293
+    lv_label_set_text(label_Fan, operation_menu.fan);
294
+    lv_obj_align(label_Fan, buttonFan, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
295
+
296
+    lv_label_set_text(label_Speed, operation_menu.speed);
297
+    lv_obj_align(label_Speed, buttonSpeed, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
298
+
299
+    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*/
305
+      lv_label_set_text(label_Move, operation_menu.move);
306
+      lv_obj_align(label_Move, buttonMove, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
307
+    }
308
+
309
+    if (gCfgItems.finish_power_off == 1)
310
+      lv_label_set_text(label_PowerOff, printing_more_menu.auto_close);
311
+    else
312
+      lv_label_set_text(label_PowerOff, printing_more_menu.manual);
313
+    lv_obj_align(label_PowerOff, buttonPowerOff, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
314
+
315
+    lv_label_set_text(label_Back, common_menu.text_back);
316
+    lv_obj_align(label_Back, buttonBack, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
317
+  }
318
+}
319
+
320
+void lv_clear_opration() { lv_obj_del(scr); }
321
+
322
+#endif // TFT_LITTLE_VGL_UI

+ 34
- 0
Marlin/src/lcd/extui/lib/mks_ui/draw_opration.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 <http://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_opration(void);
29
+extern void lv_clear_opration();
30
+
31
+//extern void disp_temp_ready_print();
32
+#ifdef __cplusplus
33
+} /* C-declarations for C++ */
34
+#endif

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

@@ -0,0 +1,55 @@
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 <http://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+#include "../../../../inc/MarlinConfigPre.h"
23
+
24
+#if BOTH(TFT_LITTLE_VGL_UI, ADVANCED_PAUSE_FEATURE)
25
+
26
+#include "draw_ui.h"
27
+#include "lv_conf.h"
28
+//#include "../lvgl/src/lv_objx/lv_imgbtn.h"
29
+//#include "../lvgl/src/lv_objx/lv_img.h"
30
+//#include "../lvgl/src/lv_core/lv_disp.h"
31
+//#include "../lvgl/src/lv_core/lv_refr.h"
32
+
33
+#include "../../../../MarlinCore.h"
34
+#include "../../../../feature/pause.h"
35
+
36
+void lv_draw_pause_message(const PauseMessage msg) {
37
+  switch (msg) {
38
+    case PAUSE_MESSAGE_PAUSING:  clear_cur_ui(); lv_draw_dialog(DIALOG_PAUSE_MESSAGE_PAUSING); break;
39
+    case PAUSE_MESSAGE_CHANGING: clear_cur_ui(); lv_draw_dialog(DIALOG_PAUSE_MESSAGE_CHANGING); break;
40
+    case PAUSE_MESSAGE_UNLOAD:   clear_cur_ui(); lv_draw_dialog(DIALOG_PAUSE_MESSAGE_UNLOAD); break;
41
+    case PAUSE_MESSAGE_WAITING:  clear_cur_ui(); lv_draw_dialog(DIALOG_PAUSE_MESSAGE_WAITING); break;
42
+    case PAUSE_MESSAGE_INSERT:   clear_cur_ui(); lv_draw_dialog(DIALOG_PAUSE_MESSAGE_INSERT); break;
43
+    case PAUSE_MESSAGE_LOAD:     clear_cur_ui(); lv_draw_dialog(DIALOG_PAUSE_MESSAGE_LOAD); break;
44
+    case PAUSE_MESSAGE_PURGE:    clear_cur_ui(); lv_draw_dialog(DIALOG_PAUSE_MESSAGE_PURGE); break;
45
+    case PAUSE_MESSAGE_RESUME:   clear_cur_ui(); lv_draw_dialog(DIALOG_PAUSE_MESSAGE_RESUME); break;
46
+    case PAUSE_MESSAGE_HEAT:     clear_cur_ui(); lv_draw_dialog(DIALOG_PAUSE_MESSAGE_HEAT); break;
47
+    case PAUSE_MESSAGE_HEATING:  clear_cur_ui(); lv_draw_dialog(DIALOG_PAUSE_MESSAGE_HEATING); break;
48
+    case PAUSE_MESSAGE_OPTION:   pause_menu_response = PAUSE_RESPONSE_WAIT_FOR;
49
+      clear_cur_ui(); lv_draw_dialog(DIALOG_PAUSE_MESSAGE_OPTION); break;
50
+    case PAUSE_MESSAGE_STATUS:
51
+    default: break;
52
+  }
53
+}
54
+
55
+#endif // TFT_LITTLE_VGL_UI && ADVANCED_PAUSE_FEATURE

+ 33
- 0
Marlin/src/lcd/extui/lib/mks_ui/draw_pause_message.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 <http://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_message(const PauseMessage msg);
29
+
30
+//extern void disp_temp_ready_print();
31
+#ifdef __cplusplus
32
+} /* C-declarations for C++ */
33
+#endif

+ 392
- 0
Marlin/src/lcd/extui/lib/mks_ui/draw_preHeat.cpp View File

@@ -0,0 +1,392 @@
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 <http://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+#include "../../../../inc/MarlinConfigPre.h"
23
+
24
+#if ENABLED(TFT_LITTLE_VGL_UI)
25
+
26
+#include "lv_conf.h"
27
+#include "draw_ui.h"
28
+//#include "../lvgl/src/lv_objx/lv_imgbtn.h"
29
+//#include "../lvgl/src/lv_objx/lv_img.h"
30
+//#include "../lvgl/src/lv_core/lv_disp.h"
31
+//#include "../lvgl/src/lv_core/lv_refr.h"
32
+
33
+#include "../../../../MarlinCore.h"
34
+#include "../../../../module/temperature.h"
35
+
36
+static lv_obj_t * scr;
37
+static lv_obj_t *buttoType, *buttonStep;
38
+static lv_obj_t * labelType;
39
+static lv_obj_t * labelStep;
40
+static lv_obj_t * tempText1;
41
+
42
+#define ID_P_ADD    1
43
+#define ID_P_DEC    2
44
+#define ID_P_TYPE   3
45
+#define ID_P_STEP   4
46
+#define ID_P_OFF    5
47
+#define ID_P_RETURN 6
48
+
49
+static void event_handler(lv_obj_t * obj, lv_event_t event) {
50
+  switch (obj->mks_obj_id) {
51
+    case ID_P_ADD:
52
+      if (event == LV_EVENT_CLICKED) {
53
+        // nothing to do
54
+      }
55
+      else if (event == LV_EVENT_RELEASED) {
56
+        if (uiCfg.curTempType == 0) {
57
+          thermalManager.temp_hotend[uiCfg.curSprayerChoose].target += uiCfg.stepHeat;
58
+          if (uiCfg.curSprayerChoose == 0) {
59
+            if ((int)thermalManager.temp_hotend[uiCfg.curSprayerChoose].target > (HEATER_0_MAXTEMP - (WATCH_TEMP_INCREASE + TEMP_HYSTERESIS + 1))) {
60
+              thermalManager.temp_hotend[uiCfg.curSprayerChoose].target = (float)HEATER_0_MAXTEMP - (WATCH_TEMP_INCREASE + TEMP_HYSTERESIS + 1);
61
+
62
+              thermalManager.start_watching_hotend(uiCfg.curSprayerChoose);
63
+            }
64
+          }
65
+          #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
+          }
71
+          #endif
72
+        }
73
+        #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();
81
+          }
82
+
83
+        }
84
+        #endif
85
+        disp_desire_temp();
86
+      }
87
+      break;
88
+    case ID_P_DEC:
89
+      if (event == LV_EVENT_CLICKED) {
90
+        // nothing to do
91
+      }
92
+      else if (event == LV_EVENT_RELEASED) {
93
+        if (uiCfg.curTempType == 0) {
94
+          if ((int)thermalManager.temp_hotend[uiCfg.curSprayerChoose].target > uiCfg.stepHeat) {
95
+            thermalManager.temp_hotend[uiCfg.curSprayerChoose].target -= uiCfg.stepHeat;
96
+            thermalManager.start_watching_hotend(uiCfg.curSprayerChoose);
97
+          }
98
+          else {
99
+            thermalManager.temp_hotend[uiCfg.curSprayerChoose].target = (float)0;
100
+            thermalManager.start_watching_hotend(uiCfg.curSprayerChoose);
101
+          }
102
+        }
103
+        #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
+          else {
110
+            thermalManager.temp_bed.target = (float)0;
111
+            thermalManager.start_watching_bed();
112
+          }
113
+        }
114
+        #endif
115
+        disp_desire_temp();
116
+      }
117
+
118
+      break;
119
+    case ID_P_TYPE:
120
+      if (event == LV_EVENT_CLICKED) {
121
+        // nothing to do
122
+      }
123
+      else if (event == LV_EVENT_RELEASED) {
124
+        if (uiCfg.curTempType == 0) {
125
+          if (EXTRUDERS == 2) {
126
+            if (uiCfg.curSprayerChoose == 0) {
127
+              uiCfg.curSprayerChoose = 1;
128
+            }
129
+            else if (uiCfg.curSprayerChoose == 1) {
130
+              if (TEMP_SENSOR_BED != 0) {
131
+                uiCfg.curTempType = 1;
132
+              }
133
+              else {
134
+                uiCfg.curTempType = 0;
135
+                uiCfg.curSprayerChoose = 0;
136
+              }
137
+            }
138
+          }
139
+          else    if (uiCfg.curSprayerChoose == 0) {
140
+            if (TEMP_SENSOR_BED != 0)
141
+              uiCfg.curTempType = 1;
142
+            else
143
+              uiCfg.curTempType = 0;
144
+          }
145
+        }
146
+        else if (uiCfg.curTempType == 1) {
147
+          uiCfg.curSprayerChoose = 0;
148
+          uiCfg.curTempType = 0;
149
+        }
150
+        disp_temp_type();
151
+      }
152
+      break;
153
+    case ID_P_STEP:
154
+      if (event == LV_EVENT_CLICKED) {
155
+        // nothing to do
156
+      }
157
+      else if (event == LV_EVENT_RELEASED) {
158
+        switch (uiCfg.stepHeat) {
159
+          case  1: uiCfg.stepHeat =  5; break;
160
+          case  5: uiCfg.stepHeat = 10; break;
161
+          case 10: uiCfg.stepHeat =  1; break;
162
+          default: break;
163
+        }
164
+        disp_step_heat();
165
+      }
166
+      break;
167
+    case ID_P_OFF:
168
+      if (event == LV_EVENT_CLICKED) {
169
+        // nothing to do
170
+      }
171
+      else if (event == LV_EVENT_RELEASED) {
172
+        if (uiCfg.curTempType == 0) {
173
+          thermalManager.temp_hotend[uiCfg.curSprayerChoose].target = (float)0;
174
+          thermalManager.start_watching_hotend(uiCfg.curSprayerChoose);
175
+        }
176
+        #if HAS_HEATED_BED
177
+        else {
178
+          thermalManager.temp_bed.target = (float)0;
179
+          thermalManager.start_watching_bed();
180
+        }
181
+        #endif
182
+        disp_desire_temp();
183
+      }
184
+      break;
185
+    case ID_P_RETURN:
186
+      if (event == LV_EVENT_CLICKED) {
187
+        // nothing to do
188
+      }
189
+      else if (event == LV_EVENT_RELEASED) {
190
+        clear_cur_ui();
191
+        draw_return_ui();
192
+      }
193
+      break;
194
+  }
195
+}
196
+
197
+void lv_draw_preHeat(void) {
198
+  lv_obj_t *buttonAdd, *buttonDec;
199
+  lv_obj_t *buttonOff, *buttonBack;
200
+
201
+  if (disp_state_stack._disp_state[disp_state_stack._disp_index] != PRE_HEAT_UI) {
202
+    disp_state_stack._disp_index++;
203
+    disp_state_stack._disp_state[disp_state_stack._disp_index] = PRE_HEAT_UI;
204
+  }
205
+  disp_state = PRE_HEAT_UI;
206
+
207
+  scr = lv_obj_create(NULL, NULL);
208
+
209
+  lv_obj_set_style(scr, &tft_style_scr);
210
+  lv_scr_load(scr);
211
+  lv_obj_clean(scr);
212
+
213
+  lv_obj_t * title = lv_label_create(scr, NULL);
214
+  lv_obj_set_style(title, &tft_style_lable_rel);
215
+  lv_obj_set_pos(title, TITLE_XPOS, TITLE_YPOS);
216
+  lv_label_set_text(title, creat_title_text());
217
+
218
+  lv_refr_now(lv_refr_get_disp_refreshing());
219
+
220
+  LV_IMG_DECLARE(bmp_pic);
221
+
222
+  /*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);
226
+  buttonStep = lv_imgbtn_create(scr, NULL);
227
+  buttonOff = lv_imgbtn_create(scr, NULL);
228
+  buttonBack = lv_imgbtn_create(scr, NULL);
229
+
230
+  lv_obj_set_event_cb_mks(buttonAdd, event_handler, ID_P_ADD, "bmp_Add.bin", 0);
231
+  lv_imgbtn_set_src(buttonAdd, LV_BTN_STATE_REL, &bmp_pic);
232
+  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);
235
+  lv_obj_clear_protect(buttonAdd, LV_PROTECT_FOLLOW);
236
+  #if 1
237
+    lv_obj_set_event_cb_mks(buttonDec, event_handler, ID_P_DEC, "bmp_Dec.bin", 0);
238
+    lv_imgbtn_set_src(buttonDec, LV_BTN_STATE_REL, &bmp_pic);
239
+    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);
242
+
243
+
244
+    lv_imgbtn_set_src(buttoType, LV_BTN_STATE_REL, &bmp_pic);
245
+    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);
248
+
249
+
250
+    lv_imgbtn_set_src(buttonStep, LV_BTN_STATE_REL, &bmp_pic);
251
+    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);
254
+
255
+    lv_obj_set_event_cb_mks(buttonOff, event_handler, ID_P_OFF, "bmp_Speed0.bin", 0);
256
+    lv_imgbtn_set_src(buttonOff, LV_BTN_STATE_REL, &bmp_pic);
257
+    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);
260
+
261
+    lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_P_RETURN, "bmp_Return.bin", 0);
262
+    lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_REL, &bmp_pic);
263
+    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);
266
+  #endif
267
+
268
+  lv_obj_set_pos(buttonAdd, INTERVAL_V, titleHeight);
269
+  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);
271
+  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);
274
+
275
+  /*Create a label on the Image button*/
276
+  lv_btn_set_layout(buttonAdd, LV_LAYOUT_OFF);
277
+  lv_btn_set_layout(buttonDec, LV_LAYOUT_OFF);
278
+  lv_btn_set_layout(buttoType, LV_LAYOUT_OFF);
279
+  lv_btn_set_layout(buttonStep, LV_LAYOUT_OFF);
280
+  lv_btn_set_layout(buttonOff, LV_LAYOUT_OFF);
281
+  lv_btn_set_layout(buttonBack, LV_LAYOUT_OFF);
282
+
283
+  lv_obj_t * labelAdd = lv_label_create(buttonAdd, NULL);
284
+  lv_obj_t * labelDec = lv_label_create(buttonDec, NULL);
285
+  labelType = lv_label_create(buttoType, NULL);
286
+  labelStep = lv_label_create(buttonStep, NULL);
287
+  lv_obj_t * labelOff = lv_label_create(buttonOff, NULL);
288
+  lv_obj_t * label_Back = lv_label_create(buttonBack, NULL);
289
+
290
+
291
+  if (gCfgItems.multiple_language != 0) {
292
+    lv_label_set_text(labelAdd, preheat_menu.add);
293
+    lv_obj_align(labelAdd, buttonAdd, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
294
+
295
+    lv_label_set_text(labelDec, preheat_menu.dec);
296
+    lv_obj_align(labelDec, buttonDec, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
297
+
298
+    lv_label_set_text(labelOff, preheat_menu.off);
299
+    lv_obj_align(labelOff, buttonOff, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
300
+
301
+    lv_label_set_text(label_Back, common_menu.text_back);
302
+    lv_obj_align(label_Back, buttonBack, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
303
+  }
304
+
305
+  disp_temp_type();
306
+  disp_step_heat();
307
+
308
+  tempText1 = lv_label_create(scr, NULL);
309
+  lv_obj_set_style(tempText1, &tft_style_lable_rel);
310
+  disp_desire_temp();
311
+}
312
+
313
+void disp_temp_type() {
314
+
315
+  if (uiCfg.curTempType == 0) {
316
+    if (uiCfg.curSprayerChoose == 1) {
317
+      lv_obj_set_event_cb_mks(buttoType, event_handler, ID_P_TYPE, "bmp_Extru2.bin", 0);
318
+      if (gCfgItems.multiple_language != 0) {
319
+        lv_label_set_text(labelType, preheat_menu.ext2);
320
+        lv_obj_align(labelType, buttoType, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
321
+      }
322
+    }
323
+    else {
324
+      lv_obj_set_event_cb_mks(buttoType, event_handler, ID_P_TYPE, "bmp_Extru1.bin", 0);
325
+      if (gCfgItems.multiple_language != 0) {
326
+        lv_label_set_text(labelType, preheat_menu.ext1);
327
+        lv_obj_align(labelType, buttoType, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
328
+      }
329
+    }
330
+
331
+  }
332
+  else {
333
+    lv_obj_set_event_cb_mks(buttoType, event_handler, ID_P_TYPE, "bmp_Bed.bin", 0);
334
+    if (gCfgItems.multiple_language != 0) {
335
+      lv_label_set_text(labelType, preheat_menu.hotbed);
336
+      lv_obj_align(labelType, buttoType, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
337
+    }
338
+  }
339
+
340
+}
341
+
342
+void disp_desire_temp() {
343
+  char buf[20] = {0};
344
+
345
+  public_buf_l[0] = '\0';
346
+
347
+  if (uiCfg.curTempType == 0) {
348
+    if (uiCfg.curSprayerChoose < 1)
349
+      strcat(public_buf_l, preheat_menu.ext1);
350
+    else
351
+      strcat(public_buf_l, preheat_menu.ext2);
352
+    sprintf(buf, preheat_menu.value_state, (int)thermalManager.temp_hotend[uiCfg.curSprayerChoose].celsius,  (int)thermalManager.temp_hotend[uiCfg.curSprayerChoose].target);
353
+  }
354
+  #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
+  }
359
+  #endif
360
+  strcat(public_buf_l, ": ");
361
+  strcat(public_buf_l, buf);
362
+  lv_label_set_text(tempText1, public_buf_l);
363
+  lv_obj_align(tempText1, NULL, LV_ALIGN_CENTER, 0, -50);
364
+}
365
+
366
+void disp_step_heat() {
367
+  if (uiCfg.stepHeat == 1)
368
+    lv_obj_set_event_cb_mks(buttonStep, event_handler, ID_P_STEP, "bmp_Step1_degree.bin", 0);
369
+  else if (uiCfg.stepHeat == 5)
370
+    lv_obj_set_event_cb_mks(buttonStep, event_handler, ID_P_STEP, "bmp_Step5_degree.bin", 0);
371
+  else if (uiCfg.stepHeat == 10)
372
+    lv_obj_set_event_cb_mks(buttonStep, event_handler, ID_P_STEP, "bmp_Step10_degree.bin", 0);
373
+
374
+  if (gCfgItems.multiple_language != 0) {
375
+    if (uiCfg.stepHeat == 1) {
376
+      lv_label_set_text(labelStep, preheat_menu.step_1c);
377
+      lv_obj_align(labelStep, buttonStep, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
378
+    }
379
+    else if (uiCfg.stepHeat == 5) {
380
+      lv_label_set_text(labelStep, preheat_menu.step_5c);
381
+      lv_obj_align(labelStep, buttonStep, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
382
+    }
383
+    else if (uiCfg.stepHeat == 10) {
384
+      lv_label_set_text(labelStep, preheat_menu.step_10c);
385
+      lv_obj_align(labelStep, buttonStep, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
386
+    }
387
+  }
388
+}
389
+
390
+void lv_clear_preHeat() { lv_obj_del(scr); }
391
+
392
+#endif // TFT_LITTLE_VGL_UI

+ 37
- 0
Marlin/src/lcd/extui/lib/mks_ui/draw_preHeat.h View File

@@ -0,0 +1,37 @@
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 <http://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_preHeat(void);
29
+extern void lv_clear_preHeat();
30
+extern void disp_temp_type();
31
+extern void disp_step_heat();
32
+extern void disp_desire_temp();
33
+
34
+//extern void disp_temp_ready_print();
35
+#ifdef __cplusplus
36
+} /* C-declarations for C++ */
37
+#endif

+ 595
- 0
Marlin/src/lcd/extui/lib/mks_ui/draw_print_file.cpp View File

@@ -0,0 +1,595 @@
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 <http://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+#include "../../../../inc/MarlinConfigPre.h"
23
+
24
+#if ENABLED(TFT_LITTLE_VGL_UI)
25
+
26
+#include "../../../../MarlinCore.h"
27
+#include "lv_conf.h"
28
+//#include "../lvgl/src/lv_objx/lv_imgbtn.h"
29
+//#include "../lvgl/src/lv_objx/lv_img.h"
30
+//#include "../lvgl/src/lv_core/lv_disp.h"
31
+//#include "../lvgl/src/lv_core/lv_refr.h"
32
+#include "draw_ui.h"
33
+#include "../../../../sd/cardreader.h"
34
+
35
+static lv_obj_t * scr;
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];
40
+
41
+#define ID_P_UP     7
42
+#define ID_P_DOWN   8
43
+#define ID_P_RETURN 9
44
+
45
+int8_t curDirLever = 0;
46
+LIST_FILE list_file;
47
+DIR_OFFSET dir_offset[10];
48
+
49
+extern uint8_t public_buf[512];
50
+extern char public_buf_m[100];
51
+
52
+uint8_t sel_id = 0;
53
+
54
+#if ENABLED(SDSUPPORT)
55
+
56
+static uint8_t search_file() {
57
+  int valid_name_cnt = 0;
58
+  //char tmp[SHORT_NEME_LEN*MAX_DIR_LEVEL+1];
59
+
60
+  list_file.Sd_file_cnt = 0;
61
+  //list_file.Sd_file_offset = dir_offset[curDirLever].cur_page_first_offset;
62
+
63
+  //root2.rewind();
64
+  //SERIAL_ECHOLN(list_file.curDirPath);
65
+
66
+  if (curDirLever != 0) card.cd(list_file.curDirPath);
67
+  else card.cdroot(); //while(card.cdup());
68
+
69
+  const uint16_t fileCnt = card.get_num_Files();
70
+
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);
75
+
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));
95
+        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;
103
+          list_file.Sd_file_offset++;
104
+          break;
105
+        }
106
+        list_file.Sd_file_offset++;
107
+      #endif
108
+    }
109
+    list_file.Sd_file_cnt++;
110
+  }
111
+  //card.closefile(false);
112
+  return valid_name_cnt;
113
+}
114
+
115
+#endif // SDSUPPORT
116
+
117
+uint8_t have_pre_pic(char *path) {
118
+  #if ENABLED(SDSUPPORT)
119
+    char *ps1, *ps2, *cur_name = strrchr(path, '/');
120
+
121
+    card.openFileRead(cur_name);
122
+    card.read(public_buf, 512);
123
+    ps1 = strstr((char *)public_buf, ";simage:");
124
+    card.read(public_buf, 512);
125
+    ps2 = strstr((char *)public_buf, ";simage:");
126
+    if (ps1 || ps2) {
127
+      card.closefile();
128
+      return 1;
129
+    }
130
+    card.closefile();
131
+  #endif
132
+
133
+  return 0;
134
+}
135
+
136
+LV_IMG_DECLARE(bmp_pic_117x92);
137
+LV_IMG_DECLARE(bmp_pic_100x100);
138
+LV_IMG_DECLARE(bmp_pic);
139
+LV_IMG_DECLARE(bmp_pic_100x40);
140
+
141
+static void event_handler(lv_obj_t * obj, lv_event_t event) {
142
+  uint8_t i, file_count = 0;
143
+  //switch (obj->mks_obj_id)
144
+  //{
145
+  if (obj->mks_obj_id == ID_P_UP) {
146
+    if (event == LV_EVENT_CLICKED) {
147
+    }
148
+    else if (event == LV_EVENT_RELEASED) {
149
+      if (dir_offset[curDirLever].curPage > 0) {
150
+        //2015.05.19
151
+        list_file.Sd_file_cnt = 0;
152
+
153
+        if (dir_offset[curDirLever].cur_page_first_offset >= FILE_NUM)
154
+          list_file.Sd_file_offset = dir_offset[curDirLever].cur_page_first_offset - FILE_NUM;
155
+
156
+        #if ENABLED(SDSUPPORT)
157
+          file_count = search_file();
158
+        #endif
159
+        if (file_count != 0) {
160
+          dir_offset[curDirLever].curPage--;
161
+          lv_obj_del(scr);
162
+          disp_gcode_icon(file_count);
163
+        }
164
+      }
165
+    }
166
+  }
167
+  else if (obj->mks_obj_id == ID_P_DOWN) {
168
+    if (event == LV_EVENT_CLICKED) {
169
+    }
170
+    else if (event == LV_EVENT_RELEASED) {
171
+      if (dir_offset[curDirLever].cur_page_last_offset > 0) {
172
+        list_file.Sd_file_cnt = 0;
173
+        list_file.Sd_file_offset = dir_offset[curDirLever].cur_page_last_offset + 1;
174
+        #if ENABLED(SDSUPPORT)
175
+          file_count = search_file();
176
+        #endif
177
+        if (file_count != 0) {
178
+          dir_offset[curDirLever].curPage++;
179
+          lv_obj_del(scr);
180
+          disp_gcode_icon(file_count);
181
+        }
182
+        if (file_count < FILE_NUM)
183
+          dir_offset[curDirLever].cur_page_last_offset = 0;
184
+      }
185
+    }
186
+  }
187
+  else if (obj->mks_obj_id == ID_P_RETURN) {
188
+    if (event == LV_EVENT_CLICKED) {
189
+    }
190
+    else if (event == LV_EVENT_RELEASED) {
191
+      if (curDirLever > 0) {
192
+        int8_t *ch = (int8_t *)strrchr(list_file.curDirPath, '/');
193
+        if (ch) {
194
+          *ch = 0;
195
+          #if ENABLED(SDSUPPORT)
196
+            card.cdup();
197
+          #endif
198
+          dir_offset[curDirLever].curPage = 0;
199
+          dir_offset[curDirLever].cur_page_first_offset = 0;
200
+          dir_offset[curDirLever].cur_page_last_offset = 0;
201
+          curDirLever--;
202
+          list_file.Sd_file_offset = dir_offset[curDirLever].cur_page_first_offset;
203
+          #if ENABLED(SDSUPPORT)
204
+            file_count = search_file();
205
+          #endif
206
+          lv_obj_del(scr);
207
+          disp_gcode_icon(file_count);
208
+        }
209
+      }
210
+      else {
211
+        lv_obj_del(scr);
212
+        lv_draw_ready_print();
213
+      }
214
+    }
215
+  }
216
+  else {
217
+    for (i = 0; i < FILE_BTN_CNT; i++) {
218
+      if (obj->mks_obj_id == (i + 1)) {
219
+        if (event == LV_EVENT_CLICKED) {
220
+        }
221
+        else if (event == LV_EVENT_RELEASED) {
222
+          if (list_file.file_name[i][0] != 0) {
223
+            if (list_file.IsFolder[i] == 1) {
224
+              memset(list_file.curDirPath, 0, sizeof(list_file.curDirPath));
225
+              strcpy(list_file.curDirPath,  list_file.file_name[i]);
226
+              curDirLever++;
227
+              list_file.Sd_file_offset = dir_offset[curDirLever].cur_page_first_offset;
228
+              #if ENABLED(SDSUPPORT)
229
+                file_count = search_file();
230
+              #endif
231
+              lv_obj_del(scr);
232
+              disp_gcode_icon(file_count);
233
+            }
234
+            else {
235
+              sel_id = i;
236
+              lv_obj_del(scr);
237
+              lv_draw_dialog(DIALOG_TYPE_PRINT_FILE);
238
+            }
239
+            break;
240
+          }
241
+        }
242
+      }
243
+    }
244
+  }
245
+}
246
+
247
+void lv_draw_print_file(void) {
248
+  //uint8_t i;
249
+  uint8_t file_count;
250
+  if (disp_state_stack._disp_state[disp_state_stack._disp_index] != PRINT_FILE_UI) {
251
+    disp_state_stack._disp_index++;
252
+    disp_state_stack._disp_state[disp_state_stack._disp_index] = PRINT_FILE_UI;
253
+  }
254
+  disp_state = PRINT_FILE_UI;
255
+
256
+  curDirLever = 0;
257
+  dir_offset[curDirLever].curPage = 0;
258
+
259
+  list_file.Sd_file_offset = 0;
260
+  list_file.Sd_file_cnt = 0;
261
+
262
+  ZERO(dir_offset);
263
+  ZERO(list_file.IsFolder);
264
+  ZERO(list_file.curDirPath);
265
+
266
+  list_file.Sd_file_offset = dir_offset[curDirLever].cur_page_first_offset;
267
+  #if ENABLED(SDSUPPORT)
268
+    card.mount();
269
+    file_count = search_file();
270
+  #endif
271
+  disp_gcode_icon(file_count);
272
+
273
+  //lv_obj_t * labelPageUp = lv_label_create(buttonPageUp, NULL);
274
+  //lv_obj_t * labelPageDown = lv_label_create(buttonPageDown, NULL);
275
+  //lv_obj_t * label_Back = lv_label_create(buttonBack, NULL);
276
+
277
+  /*
278
+  if (gCfgItems.multiple_language != 0) {
279
+    lv_label_set_text(labelPageUp, tool_menu.preheat);
280
+    lv_obj_align(labelPageUp, buttonPageUp, LV_ALIGN_IN_BOTTOM_MID,0, BUTTON_TEXT_Y_OFFSET);
281
+
282
+    lv_label_set_text(labelPageDown, tool_menu.extrude);
283
+    lv_obj_align(labelPageDown, buttonPageDown, LV_ALIGN_IN_BOTTOM_MID,0, BUTTON_TEXT_Y_OFFSET);
284
+
285
+    lv_label_set_text(label_Back, common_menu.text_back);
286
+    lv_obj_align(label_Back, buttonBack, LV_ALIGN_IN_BOTTOM_MID,0, BUTTON_TEXT_Y_OFFSET);
287
+  }
288
+  */
289
+}
290
+
291
+void disp_gcode_icon(uint8_t file_num) {
292
+  uint8_t i;
293
+
294
+  scr = lv_obj_create(NULL, NULL);
295
+
296
+  //static lv_style_t tool_style;
297
+
298
+  lv_obj_set_style(scr, &tft_style_scr);
299
+  lv_scr_load(scr);
300
+  lv_obj_clean(scr);
301
+
302
+  lv_obj_t * title = lv_label_create(scr, NULL);
303
+  lv_obj_set_style(title, &tft_style_lable_rel);
304
+  lv_obj_set_pos(title, TITLE_XPOS, TITLE_YPOS);
305
+  lv_label_set_text(title, creat_title_text());
306
+
307
+  lv_refr_now(lv_refr_get_disp_refreshing());
308
+
309
+  buttonPageUp = lv_imgbtn_create(scr, NULL);
310
+  buttonPageDown = lv_imgbtn_create(scr, NULL);
311
+  buttonBack = lv_imgbtn_create(scr, NULL);
312
+
313
+  lv_obj_set_event_cb_mks(buttonPageUp, event_handler, ID_P_UP, "bmp_pageUp.bin", 0);
314
+  lv_imgbtn_set_src(buttonPageUp, LV_BTN_STATE_REL, &bmp_pic_117x92);
315
+  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);
318
+  lv_obj_clear_protect(buttonPageUp, LV_PROTECT_FOLLOW);
319
+
320
+  #if 1
321
+    lv_obj_set_event_cb_mks(buttonPageDown, event_handler, ID_P_DOWN, "bmp_pageDown.bin", 0);
322
+    lv_imgbtn_set_src(buttonPageDown, LV_BTN_STATE_REL, &bmp_pic_117x92);
323
+    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);
326
+
327
+    lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_P_RETURN, "bmp_Back.bin", 0);
328
+    lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_REL, &bmp_pic_117x92);
329
+    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);
332
+  #endif
333
+
334
+  lv_obj_set_pos(buttonPageUp, OTHER_BTN_XPIEL * 3 + INTERVAL_V * 4, titleHeight);
335
+  lv_obj_set_pos(buttonPageDown, OTHER_BTN_XPIEL * 3 + INTERVAL_V * 4, titleHeight + OTHER_BTN_YPIEL + INTERVAL_H);
336
+  lv_obj_set_pos(buttonBack, OTHER_BTN_XPIEL * 3 + INTERVAL_V * 4, titleHeight + OTHER_BTN_YPIEL * 2 + INTERVAL_H * 2);
337
+
338
+  /*Create a label on the Image button*/
339
+
340
+  lv_btn_set_layout(buttonPageUp, LV_LAYOUT_OFF);
341
+  lv_btn_set_layout(buttonPageDown, LV_LAYOUT_OFF);
342
+  lv_btn_set_layout(buttonBack, LV_LAYOUT_OFF);
343
+
344
+  for (i = 0; i < FILE_BTN_CNT; i++) {
345
+    /*
346
+    if(seq) {
347
+      j = (FILE_BTN_CNT-1) - i;
348
+      back_flg = 1;
349
+    }
350
+    else {
351
+      j = i;
352
+      back_flg = 0;
353
+    }
354
+    */
355
+    if (i >= file_num) break;
356
+
357
+    #ifdef TFT35
358
+      buttonGcode[i] = lv_imgbtn_create(scr, NULL);
359
+
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);
362
+      lv_obj_clear_protect(buttonGcode[i], LV_PROTECT_FOLLOW);
363
+      lv_btn_set_layout(buttonGcode[i], LV_LAYOUT_OFF);
364
+
365
+      ZERO(public_buf_m);
366
+      cutFileName((char *)list_file.long_name[i], 16, 8,  (char *)public_buf_m);
367
+
368
+      if (list_file.IsFolder[i] == 1) {
369
+        lv_obj_set_event_cb_mks(buttonGcode[i], event_handler, (i + 1), "bmp_Dir.bin", 0);
370
+        lv_imgbtn_set_src(buttonGcode[i], LV_BTN_STATE_REL, &bmp_pic);
371
+        lv_imgbtn_set_src(buttonGcode[i], LV_BTN_STATE_PR, &bmp_pic);
372
+        if (i < 3)
373
+          lv_obj_set_pos(buttonGcode[i], BTN_X_PIXEL * i + INTERVAL_V * (i + 1), titleHeight);
374
+        else
375
+          lv_obj_set_pos(buttonGcode[i], BTN_X_PIXEL * (i - 3) + INTERVAL_V * ((i - 3) + 1), BTN_Y_PIXEL + INTERVAL_H + titleHeight);
376
+
377
+        labelPageUp[i] = lv_label_create(buttonGcode[i], NULL);
378
+        lv_obj_set_style(labelPageUp[i], &tft_style_lable_rel);
379
+        lv_label_set_text(labelPageUp[i], public_buf_m);
380
+        lv_obj_align(labelPageUp[i], buttonGcode[i], LV_ALIGN_IN_BOTTOM_MID, 0, -5);
381
+      }
382
+      else {
383
+        if (have_pre_pic((char *)list_file.file_name[i])) {
384
+          lv_obj_set_event_cb_mks(buttonGcode[i], event_handler, (i + 1), list_file.file_name[i], 1);
385
+          lv_imgbtn_set_src(buttonGcode[i], LV_BTN_STATE_REL, &bmp_pic_100x100);
386
+          lv_imgbtn_set_src(buttonGcode[i], LV_BTN_STATE_PR, &bmp_pic_100x100);
387
+          if (i < 3) {
388
+            lv_obj_set_pos(buttonGcode[i], BTN_X_PIXEL * i + INTERVAL_V * (i + 1) + FILE_PRE_PIC_X_OFFSET, titleHeight + FILE_PRE_PIC_Y_OFFSET);
389
+            buttonText[i] = lv_btn_create(scr, NULL);
390
+            //lv_obj_set_event_cb(buttonText[i], event_handler);
391
+
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);
396
+            lv_obj_clear_protect(buttonText[i], LV_PROTECT_FOLLOW);
397
+            lv_btn_set_layout(buttonText[i], LV_LAYOUT_OFF);
398
+            //lv_obj_set_event_cb_mks(buttonText[i], event_handler,(i+10),NULL,0);
399
+            //lv_imgbtn_set_src(buttonText[i], LV_BTN_STATE_REL, &bmp_pic_100x40);
400
+            //lv_imgbtn_set_src(buttonText[i], LV_BTN_STATE_PR, &bmp_pic_100x40);
401
+            lv_obj_set_pos(buttonText[i], BTN_X_PIXEL * i + INTERVAL_V * (i + 1) + FILE_PRE_PIC_X_OFFSET, titleHeight + FILE_PRE_PIC_Y_OFFSET + 100);
402
+            lv_obj_set_size(buttonText[i], 100, 40);
403
+          }
404
+          else {
405
+            lv_obj_set_pos(buttonGcode[i], BTN_X_PIXEL * (i - 3) + INTERVAL_V * ((i - 3) + 1) + FILE_PRE_PIC_X_OFFSET, BTN_Y_PIXEL + INTERVAL_H + titleHeight + FILE_PRE_PIC_Y_OFFSET);
406
+            buttonText[i] = lv_btn_create(scr, NULL);
407
+            //lv_obj_set_event_cb(buttonText[i], event_handler);
408
+
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);
411
+
412
+            //lv_imgbtn_set_style(buttonText[i], LV_BTN_STATE_REL, &tft_style_lable_rel);
413
+            lv_obj_clear_protect(buttonText[i], LV_PROTECT_FOLLOW);
414
+            lv_btn_set_layout(buttonText[i], LV_LAYOUT_OFF);
415
+            //lv_obj_set_event_cb_mks(buttonText[i], event_handler,(i+10),NULL,0);
416
+            //lv_imgbtn_set_src(buttonText[i], LV_BTN_STATE_REL, &bmp_pic_100x40);
417
+            //lv_imgbtn_set_src(buttonText[i], LV_BTN_STATE_PR, &bmp_pic_100x40);
418
+            lv_obj_set_pos(buttonText[i], BTN_X_PIXEL * (i - 3) + INTERVAL_V * ((i - 3) + 1) + FILE_PRE_PIC_X_OFFSET, BTN_Y_PIXEL + INTERVAL_H + titleHeight + FILE_PRE_PIC_Y_OFFSET + 100);
419
+            lv_obj_set_size(buttonText[i], 100, 40);
420
+          }
421
+          labelPageUp[i] = lv_label_create(buttonText[i], NULL);
422
+          lv_obj_set_style(labelPageUp[i], &tft_style_lable_rel);
423
+          lv_label_set_text(labelPageUp[i], public_buf_m);
424
+          lv_obj_align(labelPageUp[i], buttonText[i], LV_ALIGN_IN_BOTTOM_MID, 0, 0);
425
+        }
426
+        else {
427
+          lv_obj_set_event_cb_mks(buttonGcode[i], event_handler, (i + 1), "bmp_File.bin", 0);
428
+          lv_imgbtn_set_src(buttonGcode[i], LV_BTN_STATE_REL, &bmp_pic);
429
+          lv_imgbtn_set_src(buttonGcode[i], LV_BTN_STATE_PR, &bmp_pic);
430
+          if (i < 3)
431
+            lv_obj_set_pos(buttonGcode[i], BTN_X_PIXEL * i + INTERVAL_V * (i + 1), titleHeight);
432
+          else
433
+            lv_obj_set_pos(buttonGcode[i], BTN_X_PIXEL * (i - 3) + INTERVAL_V * ((i - 3) + 1), BTN_Y_PIXEL + INTERVAL_H + titleHeight);
434
+
435
+          labelPageUp[i] = lv_label_create(buttonGcode[i], NULL);
436
+          lv_obj_set_style(labelPageUp[i], &tft_style_lable_rel);
437
+          lv_label_set_text(labelPageUp[i], public_buf_m);
438
+          lv_obj_align(labelPageUp[i], buttonGcode[i], LV_ALIGN_IN_BOTTOM_MID, 0, -5);
439
+        }
440
+      }
441
+    #else // ifdef TFT35
442
+    #endif // ifdef TFT35
443
+  }
444
+}
445
+
446
+void lv_open_gcode_file(char *path) {
447
+  #if ENABLED(SDSUPPORT)
448
+    //uint32_t read;
449
+    uint32_t *ps4;
450
+    int pre_sread_cnt;
451
+    char *cur_name;
452
+
453
+    cur_name = strrchr(path, '/');
454
+
455
+    card.openFileRead(cur_name);
456
+    card.read(public_buf, 512);
457
+    ps4 = (uint32_t *)strstr((char *)public_buf, ";simage:");
458
+
459
+    if (ps4) {
460
+      pre_sread_cnt = (uint32_t)ps4 - (uint32_t)((uint32_t *)(&public_buf[0]));
461
+      card.setIndex(pre_sread_cnt + 8);
462
+    }
463
+  #endif
464
+}
465
+
466
+int ascii2dec_test(char *ascii) {
467
+  int result = 0;
468
+
469
+  if (ascii == 0) return 0;
470
+
471
+  if (*(ascii) >= '0' && *(ascii) <= '9')
472
+    result = *(ascii) - '0';
473
+  else if (*(ascii) >= 'a' && *(ascii) <= 'f')
474
+    result = *(ascii) - 'a' + 0x0a;
475
+  else if (*(ascii) >= 'A' && *(ascii) <= 'F')
476
+    result = *(ascii) - 'A' + 0x0a;
477
+  else
478
+    return 0;
479
+
480
+  return result;
481
+}
482
+
483
+void lv_gcode_file_read(uint8_t *data_buf) {
484
+  #if ENABLED(SDSUPPORT)
485
+    uint16_t i = 0, j = 0, k = 0;
486
+    //uint32_t read;
487
+    uint16_t row_1 = 0;
488
+    char temp_test[200];
489
+
490
+    while (1) {
491
+      card.read(temp_test, 200);
492
+      for (i = 0; i < 200;) {
493
+        public_buf[row_1 * 200 + 100 * k + j] = (char)(ascii2dec_test(&temp_test[i]) << 4 | ascii2dec_test(&temp_test[i + 1]));
494
+        j++;
495
+        i += 2;
496
+      }
497
+      k++;
498
+      j = 0;
499
+      if (k >= 2) {
500
+        k = 0;
501
+        card.read(temp_test, 9);
502
+        break;
503
+      }
504
+    }
505
+    memcpy(data_buf, public_buf, 200);
506
+  #endif
507
+}
508
+
509
+void lv_close_gcode_file() {TERN_(SDSUPPORT, card.closefile());}
510
+
511
+void cutFileName(char *path, int len, int bytePerLine,  char *outStr) {
512
+  #if _LFN_UNICODE
513
+    TCHAR *tmpFile;
514
+    TCHAR *strIndex1 = 0, *strIndex2 = 0, *beginIndex;
515
+    TCHAR secSeg[10] = {0};
516
+    TCHAR gFileTail[4] = {'~', '.', 'g', '\0'};
517
+  #else
518
+    char *tmpFile;
519
+    char *strIndex1 = 0, *strIndex2 = 0, *beginIndex;
520
+    char secSeg[10] = {0};
521
+  #endif
522
+
523
+  if (path == 0 || len <= 3 || outStr == 0) return;
524
+
525
+  tmpFile = path;
526
+  #if _LFN_UNICODE
527
+    strIndex1 = (WCHAR *)wcsstr((const WCHAR *)tmpFile, (const WCHAR *)'/');
528
+    strIndex2 = (WCHAR *)wcsstr((const WCHAR *)tmpFile, (const WCHAR *)'.');
529
+  #else
530
+    strIndex1 = (char *)strrchr(tmpFile, '/');
531
+    strIndex2 = (char *)strrchr(tmpFile, '.');
532
+  #endif
533
+
534
+  beginIndex = (strIndex1 != 0
535
+                // && (strIndex2 != 0) && (strIndex1 < strIndex2)
536
+                ) ? strIndex1 + 1 : tmpFile;
537
+
538
+  if (strIndex2 == 0 || (strIndex1 > strIndex2)) { // not gcode file
539
+    #if _LFN_UNICODE
540
+      if (wcslen(beginIndex) > len)
541
+        wcsncpy(outStr, beginIndex, len);
542
+      else
543
+        wcscpy(outStr, beginIndex);
544
+    #else
545
+      if ((int)strlen(beginIndex) > len)
546
+        strncpy(outStr, beginIndex, len);
547
+      else
548
+        strcpy(outStr, beginIndex);
549
+    #endif
550
+  }
551
+  else { //gcode file
552
+    if (strIndex2 - beginIndex > (len - 2)) {
553
+      #if _LFN_UNICODE
554
+        wcsncpy(outStr, (const WCHAR *)beginIndex, len - 3);
555
+        wcscat(outStr, (const WCHAR *)gFileTail);
556
+      #else
557
+        //strncpy(outStr, beginIndex, len - 3);
558
+        strncpy(outStr, beginIndex, len - 4);
559
+        strcat(outStr, "~.g");
560
+      #endif
561
+    }
562
+    else {
563
+      #if _LFN_UNICODE
564
+        wcsncpy(outStr, (const WCHAR *)beginIndex, strIndex2 - beginIndex + 1);
565
+        wcscat(outStr, (const WCHAR *)&gFileTail[3]);
566
+      #else
567
+        strncpy(outStr, beginIndex, strIndex2 - beginIndex + 1);
568
+        strcat(outStr, "g");
569
+      #endif
570
+    }
571
+  }
572
+
573
+  #if _LFN_UNICODE
574
+    if (wcslen(outStr) > bytePerLine) {
575
+      wcscpy(secSeg, (const WCHAR *)&outStr[bytePerLine]);
576
+      outStr[bytePerLine] = '\n';
577
+      outStr[bytePerLine + 1] = '\0';
578
+      wcscat(outStr, (const WCHAR *)secSeg);
579
+    }
580
+  #else
581
+    if ((int)strlen(outStr) > bytePerLine) {
582
+      strcpy(secSeg, &outStr[bytePerLine]);
583
+      outStr[bytePerLine] = '\n';
584
+      outStr[bytePerLine + 1] = '\0';
585
+      strcat(outStr, secSeg);
586
+    }
587
+    else {
588
+      strcat(outStr, "\n");
589
+    }
590
+  #endif
591
+}
592
+
593
+void lv_clear_print_file() { lv_obj_del(scr); }
594
+
595
+#endif // TFT_LITTLE_VGL_UI

+ 65
- 0
Marlin/src/lcd/extui/lib/mks_ui/draw_print_file.h View File

@@ -0,0 +1,65 @@
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 <http://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+#pragma once
23
+
24
+#ifdef __cplusplus
25
+extern "C" { /* C-declarations for C++ */
26
+#endif
27
+
28
+typedef struct {
29
+  int cur_page_first_offset;
30
+  int cur_page_last_offset;
31
+  int curPage;
32
+} DIR_OFFSET;
33
+extern DIR_OFFSET dir_offset[10];
34
+
35
+#define FILE_NUM 6
36
+#define SHORT_NEME_LEN 13
37
+#define NAME_CUT_LEN 23
38
+
39
+#define MAX_DIR_LEVEL  10
40
+
41
+typedef struct {
42
+  //char longName[FILE_NUM][LONG_FILENAME_LENGTH];
43
+  char file_name[FILE_NUM][SHORT_NEME_LEN * MAX_DIR_LEVEL + 1];
44
+  char curDirPath[SHORT_NEME_LEN * MAX_DIR_LEVEL + 1];
45
+  char long_name[FILE_NUM][SHORT_NEME_LEN * 2 + 1];
46
+  char IsFolder[FILE_NUM];
47
+  char Sd_file_cnt;
48
+  char sd_file_index;
49
+  char Sd_file_offset;
50
+} LIST_FILE;
51
+extern LIST_FILE list_file;
52
+
53
+extern void disp_gcode_icon(uint8_t file_num);
54
+extern void lv_draw_print_file(void);
55
+extern void lv_open_gcode_file(char *path);
56
+extern void lv_gcode_file_read(uint8_t *data_buf);
57
+extern void lv_close_gcode_file();
58
+extern void cutFileName(char *path, int len, int bytePerLine,  char *outStr);
59
+extern int ascii2dec_test(char *ascii);
60
+extern void lv_clear_print_file();
61
+
62
+//extern void disp_temp_ready_print();
63
+#ifdef __cplusplus
64
+} /* C-declarations for C++ */
65
+#endif

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

@@ -0,0 +1,435 @@
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 <http://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+#include "../../../../inc/MarlinConfigPre.h"
23
+
24
+#if ENABLED(TFT_LITTLE_VGL_UI)
25
+
26
+#include "lv_conf.h"
27
+#include "draw_ui.h"
28
+//#include "../lvgl/src/lv_objx/lv_imgbtn.h"
29
+//#include "../lvgl/src/lv_objx/lv_img.h"
30
+//#include "../lvgl/src/lv_core/lv_disp.h"
31
+//#include "../lvgl/src/lv_core/lv_refr.h"
32
+
33
+#include "../../../../MarlinCore.h"
34
+#include "../../../../module/temperature.h"
35
+#include "../../../../module/motion.h"
36
+#include "../../../../sd/cardreader.h"
37
+#include "../../../../gcode/queue.h"
38
+
39
+#if ENABLED(POWER_LOSS_RECOVERY)
40
+  #include "../../../../feature/powerloss.h"
41
+#endif
42
+
43
+static lv_obj_t * scr;
44
+static lv_obj_t * labelExt1, * labelExt2, * labelFan, * labelZpos, * labelTime;
45
+static lv_obj_t * labelPause, * labelStop, * labelOperat;
46
+static lv_obj_t * bar1;
47
+static lv_obj_t * buttonPause, *buttonOperat, *buttonStop;
48
+
49
+#if HAS_HEATED_BED
50
+  static lv_obj_t* labelBed;
51
+#endif
52
+
53
+#define ID_PAUSE    1
54
+#define ID_STOP   2
55
+#define ID_OPTION 3
56
+
57
+lv_style_t lv_bar_style_indic;
58
+
59
+uint8_t once_flag = 0;
60
+extern uint32_t To_pre_view;
61
+extern uint8_t flash_preview_begin;
62
+extern uint8_t default_preview_flg;
63
+extern uint8_t gcode_preview_over;
64
+
65
+static void event_handler(lv_obj_t * obj, lv_event_t event) {
66
+  switch (obj->mks_obj_id) {
67
+    case ID_PAUSE:
68
+      if (event == LV_EVENT_CLICKED) {
69
+        // nothing to do
70
+      }
71
+      else if (event == LV_EVENT_RELEASED) {
72
+        if (gcode_preview_over != 1) {
73
+          if (uiCfg.print_state == WORKING) {
74
+            //#if ENABLED(PARK_HEAD_ON_PAUSE)
75
+            //queue.inject_P(PSTR("M25 P\nM24"));
76
+            #if ENABLED(SDSUPPORT)
77
+              //queue.inject_P(PSTR("M25\nG91\nG1 Z10\nG90"));
78
+              card.pauseSDPrint();
79
+              stop_print_time();
80
+              uiCfg.print_state = PAUSING;
81
+            #endif
82
+            lv_obj_set_event_cb_mks(buttonPause, event_handler, ID_PAUSE, "bmp_Pause.bin", 0);
83
+            lv_label_set_text(labelPause, printing_menu.resume);
84
+            lv_obj_align(labelPause, buttonPause, LV_ALIGN_CENTER, 30, 0);
85
+          }
86
+          else if (uiCfg.print_state == PAUSED) {
87
+            uiCfg.print_state = RESUMING;
88
+            //if (IS_SD_PAUSED())queue.inject_P(PSTR("M24"));// queue.inject_P(M24_STR);
89
+            lv_obj_set_event_cb_mks(obj, event_handler, ID_PAUSE, "bmp_Resume.bin", 0);
90
+            lv_label_set_text(labelPause, printing_menu.pause);
91
+            lv_obj_align(labelPause, buttonPause, LV_ALIGN_CENTER, 30, 0);
92
+          }
93
+          #if ENABLED(POWER_LOSS_RECOVERY)
94
+          else if (uiCfg.print_state == REPRINTING) {
95
+            uiCfg.print_state = REPRINTED;
96
+            lv_obj_set_event_cb_mks(obj, event_handler, ID_PAUSE, "bmp_Resume.bin", 0);
97
+            lv_label_set_text(labelPause, printing_menu.pause);
98
+            lv_obj_align(labelPause, buttonPause, LV_ALIGN_CENTER, 30, 0);
99
+            //recovery.resume();
100
+            print_time.minutes = recovery.info.print_job_elapsed / 60;
101
+            print_time.seconds = recovery.info.print_job_elapsed % 60;
102
+            print_time.hours = print_time.minutes / 60;
103
+          }
104
+          #endif
105
+        }
106
+      }
107
+      break;
108
+
109
+    case ID_STOP:
110
+      if (event == LV_EVENT_CLICKED) {
111
+        // nothing to do
112
+      }
113
+      else if (event == LV_EVENT_RELEASED) {
114
+        if (gcode_preview_over != 1) {
115
+          lv_obj_del(scr);
116
+          lv_draw_dialog(DIALOG_TYPE_STOP);
117
+        }
118
+      }
119
+      break;
120
+    case ID_OPTION:
121
+      if (event == LV_EVENT_CLICKED) {
122
+        // nothing to do
123
+      }
124
+      else if (event == LV_EVENT_RELEASED) {
125
+        if (gcode_preview_over != 1) {
126
+          lv_obj_del(scr);
127
+          lv_draw_opration();
128
+        }
129
+      }
130
+      break;
131
+  }
132
+}
133
+
134
+void lv_draw_printing(void) {
135
+  lv_obj_t *buttonExt1, *buttonExt2, *buttonFanstate, *buttonZpos, *buttonTime;
136
+  TERN_(HAS_HEATED_BED, lv_obj_t * buttonBedstate);
137
+
138
+  disp_state_stack._disp_index = 0;
139
+  ZERO(disp_state_stack._disp_state);
140
+  disp_state_stack._disp_state[disp_state_stack._disp_index] = PRINTING_UI;
141
+
142
+  disp_state = PRINTING_UI;
143
+
144
+  scr = lv_obj_create(NULL, NULL);
145
+
146
+  //static lv_style_t tool_style;
147
+
148
+  lv_obj_set_style(scr, &tft_style_scr);
149
+  lv_scr_load(scr);
150
+  lv_obj_clean(scr);
151
+
152
+  lv_obj_t * title = lv_label_create(scr, NULL);
153
+  lv_obj_set_style(title, &tft_style_lable_rel);
154
+  lv_obj_set_pos(title, TITLE_XPOS, TITLE_YPOS);
155
+  lv_label_set_text(title, creat_title_text());
156
+
157
+  lv_refr_now(lv_refr_get_disp_refreshing());
158
+
159
+  LV_IMG_DECLARE(bmp_pic_150x80);
160
+  LV_IMG_DECLARE(bmp_pic_45x45);
161
+
162
+  /*Create an Image button*/
163
+  buttonExt1 = lv_imgbtn_create(scr, NULL);
164
+  if (EXTRUDERS == 2)
165
+    buttonExt2 = lv_imgbtn_create(scr, NULL);
166
+
167
+  #if HAS_HEATED_BED
168
+    buttonBedstate = lv_imgbtn_create(scr, NULL);
169
+  #endif
170
+
171
+  buttonFanstate = lv_imgbtn_create(scr, NULL);
172
+  buttonZpos = lv_imgbtn_create(scr, NULL);
173
+  buttonPause = lv_imgbtn_create(scr, NULL);
174
+  buttonStop = lv_imgbtn_create(scr, NULL);
175
+  buttonOperat = lv_imgbtn_create(scr, NULL);
176
+  buttonTime = lv_imgbtn_create(scr, NULL);
177
+
178
+  lv_obj_set_event_cb_mks(buttonExt1, event_handler, 0, "bmp_Ext1_state.bin", 0);
179
+  lv_imgbtn_set_src(buttonExt1, LV_BTN_STATE_REL, &bmp_pic_45x45);
180
+  lv_imgbtn_set_src(buttonExt1, LV_BTN_STATE_PR, &bmp_pic_45x45);
181
+  lv_imgbtn_set_style(buttonExt1, LV_BTN_STATE_PR, &tft_style_lable_pre);
182
+  lv_imgbtn_set_style(buttonExt1, LV_BTN_STATE_REL, &tft_style_lable_rel);
183
+  lv_obj_clear_protect(buttonExt1, LV_PROTECT_FOLLOW);
184
+  #if 1
185
+  if (EXTRUDERS == 2) {
186
+    lv_obj_set_event_cb_mks(buttonExt2, event_handler, 0, "bmp_Ext2_state.bin", 0);
187
+    lv_imgbtn_set_src(buttonExt2, LV_BTN_STATE_REL, &bmp_pic_45x45);
188
+    lv_imgbtn_set_src(buttonExt2, LV_BTN_STATE_PR, &bmp_pic_45x45);
189
+    lv_imgbtn_set_style(buttonExt2, LV_BTN_STATE_PR, &tft_style_lable_pre);
190
+    lv_imgbtn_set_style(buttonExt2, LV_BTN_STATE_REL, &tft_style_lable_rel);
191
+  }
192
+  #if HAS_HEATED_BED
193
+    lv_obj_set_event_cb_mks(buttonBedstate, event_handler, 0, "bmp_Bed_state.bin", 0);
194
+    lv_imgbtn_set_src(buttonBedstate, LV_BTN_STATE_REL, &bmp_pic_45x45);
195
+    lv_imgbtn_set_src(buttonBedstate, LV_BTN_STATE_PR, &bmp_pic_45x45);
196
+    lv_imgbtn_set_style(buttonBedstate, LV_BTN_STATE_PR, &tft_style_lable_pre);
197
+    lv_imgbtn_set_style(buttonBedstate, LV_BTN_STATE_REL, &tft_style_lable_rel);
198
+  #endif
199
+
200
+  lv_obj_set_event_cb_mks(buttonFanstate, event_handler, 0, "bmp_Fan_state.bin", 0);
201
+  lv_imgbtn_set_src(buttonFanstate, LV_BTN_STATE_REL, &bmp_pic_45x45);
202
+  lv_imgbtn_set_src(buttonFanstate, LV_BTN_STATE_PR, &bmp_pic_45x45);
203
+  lv_imgbtn_set_style(buttonFanstate, LV_BTN_STATE_PR, &tft_style_lable_pre);
204
+  lv_imgbtn_set_style(buttonFanstate, LV_BTN_STATE_REL, &tft_style_lable_rel);
205
+
206
+  lv_obj_set_event_cb_mks(buttonTime, event_handler, 0, "bmp_Time_state.bin", 0);
207
+  lv_imgbtn_set_src(buttonTime, LV_BTN_STATE_REL, &bmp_pic_45x45);
208
+  lv_imgbtn_set_src(buttonTime, LV_BTN_STATE_PR, &bmp_pic_45x45);
209
+  lv_imgbtn_set_style(buttonTime, LV_BTN_STATE_PR, &tft_style_lable_pre);
210
+  lv_imgbtn_set_style(buttonTime, LV_BTN_STATE_REL, &tft_style_lable_rel);
211
+
212
+  lv_obj_set_event_cb_mks(buttonZpos, event_handler, 0, "bmp_Zpos_state.bin", 0);
213
+  lv_imgbtn_set_src(buttonZpos, LV_BTN_STATE_REL, &bmp_pic_45x45);
214
+  lv_imgbtn_set_src(buttonZpos, LV_BTN_STATE_PR, &bmp_pic_45x45);
215
+  lv_imgbtn_set_style(buttonZpos, LV_BTN_STATE_PR, &tft_style_lable_pre);
216
+  lv_imgbtn_set_style(buttonZpos, LV_BTN_STATE_REL, &tft_style_lable_rel);
217
+
218
+  if (uiCfg.print_state == WORKING)
219
+    lv_obj_set_event_cb_mks(buttonPause, event_handler, ID_PAUSE, "bmp_Resume.bin", 0);
220
+  else
221
+    lv_obj_set_event_cb_mks(buttonPause, event_handler, ID_PAUSE, "bmp_Pause.bin", 0);
222
+
223
+  lv_imgbtn_set_src(buttonPause, LV_BTN_STATE_REL, &bmp_pic_150x80);
224
+  lv_imgbtn_set_src(buttonPause, LV_BTN_STATE_PR, &bmp_pic_150x80);
225
+  lv_imgbtn_set_style(buttonPause, LV_BTN_STATE_PR, &tft_style_lable_pre);
226
+  lv_imgbtn_set_style(buttonPause, LV_BTN_STATE_REL, &tft_style_lable_rel);
227
+
228
+  lv_obj_set_event_cb_mks(buttonStop, event_handler, ID_STOP, "bmp_Stop.bin", 0);
229
+  lv_imgbtn_set_src(buttonStop, LV_BTN_STATE_REL, &bmp_pic_150x80);
230
+  lv_imgbtn_set_src(buttonStop, LV_BTN_STATE_PR, &bmp_pic_150x80);
231
+  lv_imgbtn_set_style(buttonStop, LV_BTN_STATE_PR, &tft_style_lable_pre);
232
+  lv_imgbtn_set_style(buttonStop, LV_BTN_STATE_REL, &tft_style_lable_rel);
233
+
234
+  lv_obj_set_event_cb_mks(buttonOperat, event_handler, ID_OPTION, "bmp_Operate.bin", 0);
235
+  lv_imgbtn_set_src(buttonOperat, LV_BTN_STATE_REL, &bmp_pic_150x80);
236
+  lv_imgbtn_set_src(buttonOperat, LV_BTN_STATE_PR, &bmp_pic_150x80);
237
+  lv_imgbtn_set_style(buttonOperat, LV_BTN_STATE_PR, &tft_style_lable_pre);
238
+  lv_imgbtn_set_style(buttonOperat, LV_BTN_STATE_REL, &tft_style_lable_rel);
239
+  #endif
240
+
241
+  lv_obj_set_pos(buttonExt1, 205, 136);
242
+  if (EXTRUDERS == 2)
243
+    lv_obj_set_pos(buttonExt2, 350, 136);
244
+
245
+  #if HAS_HEATED_BED
246
+    lv_obj_set_pos(buttonBedstate, 205, 186);
247
+  #endif
248
+
249
+  lv_obj_set_pos(buttonFanstate, 350, 186);
250
+  lv_obj_set_pos(buttonTime, 205, 86);
251
+  lv_obj_set_pos(buttonZpos, 350, 86);
252
+  lv_obj_set_pos(buttonPause, 5, 240);
253
+  lv_obj_set_pos(buttonStop, 165, 240);
254
+  lv_obj_set_pos(buttonOperat, 325, 240);
255
+
256
+  /*Create a label on the Image button*/
257
+  lv_btn_set_layout(buttonExt1, LV_LAYOUT_OFF);
258
+  if (EXTRUDERS == 2)
259
+    lv_btn_set_layout(buttonExt2, LV_LAYOUT_OFF);
260
+
261
+  #if HAS_HEATED_BED
262
+    lv_btn_set_layout(buttonBedstate, LV_LAYOUT_OFF);
263
+  #endif
264
+
265
+  lv_btn_set_layout(buttonFanstate, LV_LAYOUT_OFF);
266
+  lv_btn_set_layout(buttonZpos, LV_LAYOUT_OFF);
267
+  lv_btn_set_layout(buttonPause, LV_LAYOUT_OFF);
268
+  lv_btn_set_layout(buttonStop, LV_LAYOUT_OFF);
269
+  lv_btn_set_layout(buttonOperat, LV_LAYOUT_OFF);
270
+
271
+  labelExt1 = lv_label_create(scr, NULL);
272
+  lv_obj_set_style(labelExt1, &tft_style_lable_rel);
273
+  lv_obj_set_pos(labelExt1, 250, 146);
274
+
275
+  if (EXTRUDERS == 2) {
276
+    labelExt2 = lv_label_create(scr, NULL);
277
+    lv_obj_set_style(labelExt2, &tft_style_lable_rel);
278
+    lv_obj_set_pos(labelExt2, 395, 146);
279
+  }
280
+
281
+  #if HAS_HEATED_BED
282
+    labelBed = lv_label_create(scr, NULL);
283
+    lv_obj_set_style(labelBed, &tft_style_lable_rel);
284
+    lv_obj_set_pos(labelBed, 250, 196);
285
+  #endif
286
+
287
+  labelFan = lv_label_create(scr, NULL);
288
+  lv_obj_set_style(labelFan, &tft_style_lable_rel);
289
+  lv_obj_set_pos(labelFan, 395, 196);
290
+
291
+  labelZpos = lv_label_create(scr, NULL);
292
+  lv_obj_set_style(labelZpos, &tft_style_lable_rel);
293
+  lv_obj_set_pos(labelZpos, 395, 96);
294
+
295
+  labelTime = lv_label_create(scr, NULL);
296
+  lv_obj_set_style(labelTime, &tft_style_lable_rel);
297
+  lv_obj_set_pos(labelTime, 250, 96);
298
+
299
+  labelPause = lv_label_create(buttonPause, NULL);
300
+  labelStop = lv_label_create(buttonStop, NULL);
301
+  labelOperat = lv_label_create(buttonOperat, NULL);
302
+
303
+  if (gCfgItems.multiple_language != 0) {
304
+    if (uiCfg.print_state == WORKING)
305
+      lv_label_set_text(labelPause, printing_menu.pause);
306
+    else
307
+      lv_label_set_text(labelPause, printing_menu.resume);
308
+    lv_obj_align(labelPause, buttonPause, LV_ALIGN_CENTER, 30, 0);
309
+
310
+    lv_label_set_text(labelStop, printing_menu.stop);
311
+    lv_obj_align(labelStop, buttonStop, LV_ALIGN_CENTER, 30, 0);
312
+
313
+    lv_label_set_text(labelOperat, printing_menu.option);
314
+    lv_obj_align(labelOperat, buttonOperat, LV_ALIGN_CENTER, 30, 0);
315
+  }
316
+
317
+  lv_style_copy(&lv_bar_style_indic, &lv_style_pretty_color);
318
+  lv_bar_style_indic.text.color = lv_color_hex3(0xADF);
319
+  lv_bar_style_indic.image.color = lv_color_hex3(0xADF);
320
+  lv_bar_style_indic.line.color = lv_color_hex3(0xADF);
321
+  lv_bar_style_indic.body.main_color = lv_color_hex3(0xADF);
322
+  lv_bar_style_indic.body.grad_color = lv_color_hex3(0xADF);
323
+  lv_bar_style_indic.body.border.color = lv_color_hex3(0xADF);
324
+
325
+  bar1 = lv_bar_create(scr, NULL);
326
+  lv_obj_set_pos(bar1, 205, 36);
327
+  lv_obj_set_size(bar1, 270, 40);
328
+  lv_bar_set_style(bar1, LV_BAR_STYLE_INDIC, &lv_bar_style_indic);
329
+  lv_bar_set_anim_time(bar1, 1000);
330
+  lv_bar_set_value(bar1, 0, LV_ANIM_ON);
331
+
332
+  disp_ext_temp();
333
+  disp_bed_temp();
334
+  disp_fan_speed();
335
+  disp_print_time();
336
+  disp_fan_Zpos();
337
+}
338
+
339
+void disp_ext_temp() {
340
+  memset(public_buf_l, 0, sizeof(public_buf_l));
341
+  sprintf(public_buf_l, printing_menu.temp1, (int)thermalManager.temp_hotend[0].celsius, (int)thermalManager.temp_hotend[0].target);
342
+  lv_label_set_text(labelExt1, public_buf_l);
343
+
344
+  if (EXTRUDERS == 2) {
345
+    memset(public_buf_l, 0, sizeof(public_buf_l));
346
+    sprintf(public_buf_l, printing_menu.temp1, (int)thermalManager.temp_hotend[1].celsius, (int)thermalManager.temp_hotend[1].target);
347
+    lv_label_set_text(labelExt2, public_buf_l);
348
+  }
349
+}
350
+
351
+void disp_bed_temp() {
352
+  #if HAS_HEATED_BED
353
+    memset(public_buf_l, 0, sizeof(public_buf_l));
354
+    sprintf(public_buf_l, printing_menu.bed_temp, (int)thermalManager.temp_bed.celsius, (int)thermalManager.temp_bed.target);
355
+    lv_label_set_text(labelBed, public_buf_l);
356
+  #endif
357
+}
358
+
359
+void disp_fan_speed() {
360
+  memset(public_buf_l, 0, sizeof(public_buf_l));
361
+  sprintf(public_buf_l, "%3d", thermalManager.fan_speed[0]);
362
+  lv_label_set_text(labelFan, public_buf_l);
363
+}
364
+
365
+void disp_print_time() {
366
+  memset(public_buf_l, 0, sizeof(public_buf_l));
367
+  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);
368
+  lv_label_set_text(labelTime, public_buf_l);
369
+}
370
+
371
+void disp_fan_Zpos() {
372
+  memset(public_buf_l, 0, sizeof(public_buf_l));
373
+  sprintf(public_buf_l, "%.3f", current_position[Z_AXIS]);
374
+  lv_label_set_text(labelZpos, public_buf_l);
375
+}
376
+
377
+void reset_print_time() {
378
+  //print_time.days = 0;
379
+  print_time.hours = 0;
380
+  print_time.minutes = 0;
381
+  print_time.seconds = 0;
382
+  print_time.ms_10 = 0;
383
+  //print_time.start = 1;
384
+}
385
+
386
+void start_print_time() { print_time.start = 1; }
387
+
388
+void stop_print_time() { print_time.start = 0; }
389
+
390
+void setProBarRate() {
391
+  int rate;
392
+  volatile long long rate_tmp_r;
393
+
394
+  if (gCfgItems.from_flash_pic != 1) {
395
+    #if ENABLED(SDSUPPORT)
396
+      rate_tmp_r = (long long)card.getIndex() * 100;
397
+    #endif
398
+    rate = rate_tmp_r / gCfgItems.curFilesize;
399
+  }
400
+  else {
401
+    #if ENABLED(SDSUPPORT)
402
+      rate_tmp_r = (long long)card.getIndex();
403
+    #endif
404
+    rate = (rate_tmp_r - (PREVIEW_SIZE + To_pre_view)) * 100 / (gCfgItems.curFilesize - (PREVIEW_SIZE + To_pre_view));
405
+  }
406
+  //gCurFileState.totalSend = rate;
407
+
408
+  if (rate <= 0) return;
409
+
410
+  if (disp_state == PRINTING_UI) {
411
+    lv_bar_set_value(bar1, rate, LV_ANIM_ON);
412
+
413
+    if (marlin_state == MF_SD_COMPLETE) {
414
+      if (once_flag == 0) {
415
+        stop_print_time();
416
+
417
+        flash_preview_begin = 0;
418
+        default_preview_flg = 0;
419
+        lv_clear_printing();
420
+        lv_draw_dialog(DIALOG_TYPE_FINISH_PRINT);
421
+
422
+        once_flag = 1;
423
+
424
+        #if HAS_SUICIDE
425
+          if (gCfgItems.finish_power_off == 1)
426
+            suicide();
427
+        #endif
428
+      }
429
+    }
430
+  }
431
+}
432
+
433
+void lv_clear_printing() { lv_obj_del(scr); }
434
+
435
+#endif // TFT_LITTLE_VGL_UI

+ 52
- 0
Marlin/src/lcd/extui/lib/mks_ui/draw_printing.h View File

@@ -0,0 +1,52 @@
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 <http://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+#pragma once
23
+
24
+#ifdef __cplusplus
25
+extern "C" { /* C-declarations for C++ */
26
+#endif
27
+
28
+#define IDLE        0
29
+#define WORKING     1
30
+#define PAUSING     2
31
+#define PAUSED      3
32
+#define REPRINTING  4
33
+#define REPRINTED   5
34
+#define RESUMING    6
35
+#define STOP        7
36
+
37
+extern void lv_draw_printing(void);
38
+extern void lv_clear_printing();
39
+extern void disp_ext_temp();
40
+extern void disp_bed_temp();
41
+extern void disp_fan_speed();
42
+extern void disp_print_time();
43
+extern void disp_fan_Zpos();
44
+extern void reset_print_time();
45
+extern void start_print_time();
46
+extern void stop_print_time();
47
+extern void setProBarRate();
48
+
49
+//extern void disp_temp_ready_print();
50
+#ifdef __cplusplus
51
+} /* C-declarations for C++ */
52
+#endif

+ 319
- 0
Marlin/src/lcd/extui/lib/mks_ui/draw_ready_print.cpp View File

@@ -0,0 +1,319 @@
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 <http://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+#include "../../../../inc/MarlinConfigPre.h"
23
+
24
+#if ENABLED(TFT_LITTLE_VGL_UI)
25
+
26
+#include "draw_ready_print.h"
27
+#include "draw_tool.h"
28
+#include "lv_conf.h"
29
+#include "lvgl.h"
30
+//#include "../lvgl/src/lv_objx/lv_imgbtn.h"
31
+//#include "../lvgl/src/lv_objx/lv_img.h"
32
+//#include "../lvgl/src/lv_core/lv_disp.h"
33
+//#include "../lvgl/src/lv_core/lv_refr.h"
34
+#include "tft_lvgl_configuration.h"
35
+#include "mks_hardware_test.h"
36
+#include "draw_ui.h"
37
+
38
+#include <stdio.h>
39
+
40
+#include "../../../../MarlinCore.h"
41
+#include "../../../../module/temperature.h"
42
+
43
+//static lv_obj_t *buttonPrint,*buttonTool,*buttonSet;
44
+static lv_obj_t * scr;
45
+#if ENABLED(MKS_TEST)
46
+  uint8_t curent_disp_ui = 0;
47
+#endif
48
+
49
+#define ID_TOOL   1
50
+#define ID_SET    2
51
+#define ID_PRINT  3
52
+
53
+static void event_handler(lv_obj_t * obj, lv_event_t event) {
54
+  switch (obj->mks_obj_id) {
55
+    case ID_TOOL:
56
+      if (event == LV_EVENT_CLICKED) {
57
+        // nothing to do
58
+      }
59
+      else if (event == LV_EVENT_RELEASED) {
60
+        #if ENABLED(MKS_TEST)
61
+          curent_disp_ui = 2;
62
+        #endif
63
+        lv_obj_del(scr);
64
+        lv_draw_tool();
65
+      }
66
+      break;
67
+    case ID_SET:
68
+      if (event == LV_EVENT_CLICKED) {
69
+        // nothing to do
70
+      }
71
+      else if (event == LV_EVENT_RELEASED) {
72
+        lv_obj_del(scr);
73
+        lv_draw_set();
74
+      }
75
+      break;
76
+    case ID_PRINT:
77
+      if (event == LV_EVENT_CLICKED) {
78
+        // nothing to do
79
+      }
80
+      else if (event == LV_EVENT_RELEASED) {
81
+        lv_obj_del(scr);
82
+        lv_draw_print_file();
83
+      }
84
+      break;
85
+  }
86
+}
87
+
88
+
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
+  }
114
+
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);
126
+    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);
134
+    lv_label_set_text(bed, buf);
135
+  }
136
+
137
+#endif // MKS_TEST
138
+
139
+void lv_draw_ready_print(void) {
140
+  #if ENABLED(MKS_TEST)
141
+    char buf[30] = {0};
142
+    lv_obj_t *buttonTool;
143
+
144
+    static lv_style_t style_pr, style_rel;
145
+
146
+    curent_disp_ui = 1;
147
+
148
+    scr = lv_obj_create(NULL, NULL);
149
+
150
+    static lv_style_t ready_style;
151
+
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());
163
+
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);
170
+
171
+    /*Create an Image button*/
172
+    buttonTool = lv_imgbtn_create(scr, NULL);
173
+
174
+    //lv_btn_setting(&style_pr,0x5d8f16,0x5d8f16);
175
+    //lv_btn_setting(&style_rel,0x5d8f16,0x5d8f16);
176
+
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
+
184
+    lv_obj_set_pos(buttonTool, 360, 180);
185
+
186
+    lv_btn_set_layout(buttonTool, LV_LAYOUT_OFF);
187
+
188
+    lv_obj_t * label_tool = lv_label_create(buttonTool, NULL);
189
+
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);
244
+
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());
250
+
251
+    LV_IMG_DECLARE(bmp_pic);
252
+
253
+    //lv_obj_t * title = lv_label_create(scr, NULL);
254
+    //lv_obj_set_style(title, &tft_style_lable_rel);
255
+    //lv_obj_set_pos(title,TITLE_XPOS,TITLE_YPOS);
256
+    //lv_label_set_text(title, creat_title_text());
257
+
258
+    /*Create an Image button*/
259
+    buttonPrint = lv_imgbtn_create(scr, NULL);
260
+    buttonTool = lv_imgbtn_create(scr, NULL);
261
+    buttonSet = lv_imgbtn_create(scr, NULL);
262
+
263
+    lv_obj_set_event_cb_mks(buttonPrint, event_handler, ID_PRINT, "bmp_Print.bin", 0);
264
+    //lv_imgbtn_set_src_mks(buttonPrint, LV_BTN_STATE_REL, &bmp_pic,(uint8_t *)"bmp_printing.bin");
265
+    lv_imgbtn_set_src(buttonPrint, LV_BTN_STATE_REL, &bmp_pic);
266
+    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);
269
+    lv_obj_clear_protect(buttonPrint, LV_PROTECT_FOLLOW);
270
+    #if 1
271
+      lv_obj_set_event_cb_mks(buttonSet, event_handler, ID_SET, "bmp_Set.bin", 0);
272
+      //lv_imgbtn_set_src_mks(buttonSet, LV_BTN_STATE_REL, &bmp_pic,(uint8_t *)"bmp_set.bin");
273
+      lv_imgbtn_set_src(buttonSet, LV_BTN_STATE_REL, &bmp_pic);
274
+      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);
277
+
278
+      lv_obj_set_event_cb_mks(buttonTool, event_handler, ID_TOOL, "bmp_Tool.bin", 0);
279
+      //lv_imgbtn_set_src_mks(buttonTool, LV_BTN_STATE_REL, &bmp_pic,(uint8_t *)"bmp_tool.bin");
280
+      lv_imgbtn_set_src(buttonTool, LV_BTN_STATE_REL, &bmp_pic);
281
+      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);
284
+    #endif
285
+    lv_obj_set_pos(buttonTool, 20, 90);
286
+    lv_obj_set_pos(buttonSet, 180, 90);
287
+    lv_obj_set_pos(buttonPrint, 340, 90);
288
+
289
+    //lv_obj_set_pos(buttonTool,SIMPLE_FIRST_PAGE_GRAP+1,(TFT_HEIGHT-BTN_Y_PIXEL)/2+2);
290
+    //lv_obj_set_pos(buttonSet,BTN_X_PIXEL+SIMPLE_FIRST_PAGE_GRAP*2+1,(TFT_HEIGHT-BTN_Y_PIXEL)/2+2);
291
+    //lv_obj_set_pos(buttonPrint,BTN_X_PIXEL*2+SIMPLE_FIRST_PAGE_GRAP*3+1,(TFT_HEIGHT-BTN_Y_PIXEL)/2+2);
292
+
293
+    /*Create a label on the Image button*/
294
+    lv_btn_set_layout(buttonPrint, LV_LAYOUT_OFF);
295
+    lv_btn_set_layout(buttonSet, LV_LAYOUT_OFF);
296
+    lv_btn_set_layout(buttonTool, LV_LAYOUT_OFF);
297
+
298
+    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);
301
+    if (gCfgItems.multiple_language != 0) {
302
+
303
+      lv_label_set_text(label_print, main_menu.print);
304
+      lv_obj_align(label_print, buttonPrint, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
305
+
306
+      lv_label_set_text(label_set, main_menu.set);
307
+      lv_obj_align(label_set, buttonSet, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
308
+
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);
311
+      lv_label_set_text(label_tool, main_menu.tool);
312
+      lv_obj_align(label_tool, buttonTool, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
313
+    }
314
+  #endif // !MKS_TEST
315
+}
316
+
317
+void lv_clear_ready_print() { lv_obj_del(scr); }
318
+
319
+#endif // TFT_LITTLE_VGL_UI

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

@@ -0,0 +1,39 @@
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 <http://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_ready_print(void);
29
+extern void disp_test();
30
+extern void disp_Limit_ok();
31
+extern void disp_Limit_error();
32
+extern void disp_det_error();
33
+extern void disp_det_ok();
34
+extern void lv_clear_ready_print();
35
+
36
+//extern void disp_temp_ready_print();
37
+#ifdef __cplusplus
38
+} /* C-declarations for C++ */
39
+#endif

+ 258
- 0
Marlin/src/lcd/extui/lib/mks_ui/draw_set.cpp View File

@@ -0,0 +1,258 @@
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 <http://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+#include "../../../../inc/MarlinConfigPre.h"
23
+
24
+#if ENABLED(TFT_LITTLE_VGL_UI)
25
+
26
+#include "../../../../MarlinCore.h"
27
+#include "draw_ready_print.h"
28
+#include "draw_set.h"
29
+#include "lv_conf.h"
30
+//#include "../lvgl/src/lv_objx/lv_imgbtn.h"
31
+//#include "../lvgl/src/lv_objx/lv_img.h"
32
+//#include "../lvgl/src/lv_core/lv_disp.h"
33
+//#include "../lvgl/src/lv_core/lv_refr.h"
34
+#include "draw_ui.h"
35
+#include "../../../../gcode/queue.h"
36
+
37
+static lv_obj_t * scr;
38
+
39
+#define ID_S_WIFI       1
40
+#define ID_S_FAN        2
41
+#define ID_S_ABOUT      3
42
+#define ID_S_CONTINUE   4
43
+#define ID_S_MOTOR_OFF  5
44
+#define ID_S_LANGUAGE   6
45
+#define ID_S_RETURN     7
46
+
47
+static void event_handler(lv_obj_t * obj, lv_event_t event) {
48
+  switch (obj->mks_obj_id) {
49
+    case ID_S_WIFI:
50
+      if (event == LV_EVENT_CLICKED) {
51
+        // nothing to do
52
+      }
53
+      else if (event == LV_EVENT_RELEASED) {
54
+      }
55
+      break;
56
+    case ID_S_FAN:
57
+      if (event == LV_EVENT_CLICKED) {
58
+        // nothing to do
59
+      }
60
+      else if (event == LV_EVENT_RELEASED) {
61
+        lv_obj_del(scr);
62
+        lv_draw_fan();
63
+      }
64
+      break;
65
+    case ID_S_ABOUT:
66
+      if (event == LV_EVENT_CLICKED) {
67
+        // nothing to do
68
+      }
69
+      else if (event == LV_EVENT_RELEASED) {
70
+        lv_obj_del(scr);
71
+        lv_draw_about();
72
+      }
73
+      break;
74
+    case ID_S_CONTINUE:
75
+
76
+      break;
77
+    case ID_S_MOTOR_OFF:
78
+      if (event == LV_EVENT_CLICKED) {
79
+        // nothing to do
80
+      }
81
+      else if (event == LV_EVENT_RELEASED) {
82
+        #if HAS_SUICIDE
83
+          suicide();
84
+        #else
85
+          queue.enqueue_one_now(PSTR("M84"));
86
+        #endif
87
+      }
88
+      break;
89
+    case ID_S_LANGUAGE:
90
+      if (event == LV_EVENT_CLICKED) {
91
+        // nothing to do
92
+      }
93
+      else if (event == LV_EVENT_RELEASED) {
94
+        lv_obj_del(scr);
95
+        lv_draw_language();
96
+      }
97
+      break;
98
+    case ID_S_RETURN:
99
+      if (event == LV_EVENT_CLICKED) {
100
+        // nothing to do
101
+      }
102
+      else if (event == LV_EVENT_RELEASED) {
103
+        lv_obj_del(scr);
104
+        lv_draw_ready_print();
105
+      }
106
+      break;
107
+
108
+  }
109
+}
110
+
111
+void lv_draw_set(void) {
112
+  lv_obj_t *buttonFan, *buttonAbout;
113
+  lv_obj_t *buMotorOff, *buttonLanguage, *buttonBack;
114
+
115
+  if (disp_state_stack._disp_state[disp_state_stack._disp_index] != SET_UI) {
116
+    disp_state_stack._disp_index++;
117
+    disp_state_stack._disp_state[disp_state_stack._disp_index] = SET_UI;
118
+  }
119
+  disp_state = SET_UI;
120
+
121
+  scr = lv_obj_create(NULL, NULL);
122
+
123
+  //static lv_style_t tool_style;
124
+
125
+  lv_obj_set_style(scr, &tft_style_scr);
126
+  lv_scr_load(scr);
127
+  lv_obj_clean(scr);
128
+
129
+  lv_obj_t * title = lv_label_create(scr, NULL);
130
+  lv_obj_set_style(title, &tft_style_lable_rel);
131
+  lv_obj_set_pos(title, TITLE_XPOS, TITLE_YPOS);
132
+  lv_label_set_text(title, creat_title_text());
133
+
134
+  lv_refr_now(lv_refr_get_disp_refreshing());
135
+
136
+  LV_IMG_DECLARE(bmp_pic);
137
+
138
+  /*Create an Image button*/
139
+  //buttonWifi = lv_imgbtn_create(scr, NULL);
140
+  buttonFan = lv_imgbtn_create(scr, NULL);
141
+  buttonAbout = lv_imgbtn_create(scr, NULL);
142
+  //buttonContinue = lv_imgbtn_create(scr, NULL);
143
+  buMotorOff = lv_imgbtn_create(scr, NULL);
144
+  buttonLanguage = lv_imgbtn_create(scr, NULL);
145
+  buttonBack = lv_imgbtn_create(scr, NULL);
146
+
147
+
148
+  //lv_obj_set_event_cb_mks(buttonWifi, event_handler,ID_S_WIFI,"bmp_Wifi.bin",0);
149
+  //lv_imgbtn_set_src(buttonWifi, LV_BTN_STATE_REL, &bmp_pic);
150
+  //lv_imgbtn_set_src(buttonWifi, LV_BTN_STATE_PR, &bmp_pic);
151
+  //lv_imgbtn_set_style(buttonWifi, LV_BTN_STATE_PR, &tft_style_lable_pre);
152
+  //lv_imgbtn_set_style(buttonWifi, LV_BTN_STATE_REL, &tft_style_lable_rel);
153
+  //lv_obj_clear_protect(buttonWifi, LV_PROTECT_FOLLOW);
154
+  #if 1
155
+    lv_obj_set_event_cb_mks(buttonFan, event_handler, ID_S_FAN, "bmp_Fan.bin", 0);
156
+    lv_imgbtn_set_src(buttonFan, LV_BTN_STATE_REL, &bmp_pic);
157
+    lv_imgbtn_set_src(buttonFan, LV_BTN_STATE_PR, &bmp_pic);
158
+    lv_imgbtn_set_style(buttonFan, LV_BTN_STATE_PR, &tft_style_lable_pre);
159
+    lv_imgbtn_set_style(buttonFan, LV_BTN_STATE_REL, &tft_style_lable_rel);
160
+
161
+    lv_obj_set_event_cb_mks(buttonAbout, event_handler, ID_S_ABOUT, "bmp_About.bin", 0);
162
+    lv_imgbtn_set_src(buttonAbout, LV_BTN_STATE_REL, &bmp_pic);
163
+    lv_imgbtn_set_src(buttonAbout, LV_BTN_STATE_PR, &bmp_pic);
164
+    lv_imgbtn_set_style(buttonAbout, LV_BTN_STATE_PR, &tft_style_lable_pre);
165
+    lv_imgbtn_set_style(buttonAbout, LV_BTN_STATE_REL, &tft_style_lable_rel);
166
+
167
+    //lv_obj_set_event_cb_mks(buttonContinue, event_handler,ID_S_CONTINUE,"bmp_Breakpoint.bin",0);
168
+    //lv_imgbtn_set_src(buttonContinue, LV_BTN_STATE_REL, &bmp_pic);
169
+    //lv_imgbtn_set_src(buttonContinue, LV_BTN_STATE_PR, &bmp_pic);
170
+    //lv_imgbtn_set_style(buttonContinue, LV_BTN_STATE_PR, &tft_style_lable_pre);
171
+    //lv_imgbtn_set_style(buttonContinue, LV_BTN_STATE_REL, &tft_style_lable_rel);
172
+    #if HAS_SUICIDE
173
+      lv_obj_set_event_cb_mks(buMotorOff, event_handler, ID_S_MOTOR_OFF, "bmp_Mamual.bin", 0);
174
+    #else
175
+      lv_obj_set_event_cb_mks(buMotorOff, event_handler, ID_S_MOTOR_OFF, "bmp_Motor_off.bin", 0);
176
+    #endif
177
+    lv_imgbtn_set_src(buMotorOff, LV_BTN_STATE_REL, &bmp_pic);
178
+    lv_imgbtn_set_src(buMotorOff, LV_BTN_STATE_PR, &bmp_pic);
179
+    lv_imgbtn_set_style(buMotorOff, LV_BTN_STATE_PR, &tft_style_lable_pre);
180
+    lv_imgbtn_set_style(buMotorOff, LV_BTN_STATE_REL, &tft_style_lable_rel);
181
+
182
+    lv_obj_set_event_cb_mks(buttonLanguage, event_handler, ID_S_LANGUAGE, "bmp_Language.bin", 0);
183
+    lv_imgbtn_set_src(buttonLanguage, LV_BTN_STATE_REL, &bmp_pic);
184
+    lv_imgbtn_set_src(buttonLanguage, LV_BTN_STATE_PR, &bmp_pic);
185
+    lv_imgbtn_set_style(buttonLanguage, LV_BTN_STATE_PR, &tft_style_lable_pre);
186
+    lv_imgbtn_set_style(buttonLanguage, LV_BTN_STATE_REL, &tft_style_lable_rel);
187
+
188
+    lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_S_RETURN, "bmp_Return.bin", 0);
189
+    lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_REL, &bmp_pic);
190
+    lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_PR, &bmp_pic);
191
+    lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_PR, &tft_style_lable_pre);
192
+    lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_REL, &tft_style_lable_rel);
193
+  #endif
194
+
195
+  /*lv_obj_set_pos(buttonWifi,INTERVAL_V,titleHeight);
196
+  lv_obj_set_pos(buttonFan,BTN_X_PIXEL+INTERVAL_V*2,titleHeight);
197
+  lv_obj_set_pos(buttonAbout,BTN_X_PIXEL*2+INTERVAL_V*3,titleHeight);
198
+  lv_obj_set_pos(buttonContinue,BTN_X_PIXEL*3+INTERVAL_V*4,titleHeight);
199
+  lv_obj_set_pos(buMotorOff,INTERVAL_V,  BTN_Y_PIXEL+INTERVAL_H+titleHeight);
200
+  lv_obj_set_pos(buttonLanguage,BTN_X_PIXEL+INTERVAL_V*2,BTN_Y_PIXEL+INTERVAL_H+titleHeight);
201
+  lv_obj_set_pos(buttonBack,BTN_X_PIXEL*3+INTERVAL_V*4,  BTN_Y_PIXEL+INTERVAL_H+titleHeight);*/
202
+
203
+  //lv_obj_set_pos(buttonWifi,INTERVAL_V,titleHeight);
204
+  lv_obj_set_pos(buttonFan, BTN_X_PIXEL + INTERVAL_V * 2, titleHeight);
205
+  lv_obj_set_pos(buttonAbout, BTN_X_PIXEL * 2 + INTERVAL_V * 3, titleHeight);
206
+  //lv_obj_set_pos(buttonContinue,BTN_X_PIXEL*3+INTERVAL_V*4,titleHeight);
207
+  lv_obj_set_pos(buMotorOff, BTN_X_PIXEL * 3 + INTERVAL_V * 4, titleHeight);
208
+  lv_obj_set_pos(buttonLanguage, INTERVAL_V, titleHeight);
209
+  lv_obj_set_pos(buttonBack, BTN_X_PIXEL * 3 + INTERVAL_V * 4,  BTN_Y_PIXEL + INTERVAL_H + titleHeight);
210
+
211
+  /*Create a label on the Image button*/
212
+  //lv_btn_set_layout(buttonWifi, LV_LAYOUT_OFF);
213
+  lv_btn_set_layout(buttonFan, LV_LAYOUT_OFF);
214
+  lv_btn_set_layout(buttonAbout, LV_LAYOUT_OFF);
215
+  //lv_btn_set_layout(buttonContinue, LV_LAYOUT_OFF);
216
+  lv_btn_set_layout(buMotorOff, LV_LAYOUT_OFF);
217
+  lv_btn_set_layout(buttonLanguage, LV_LAYOUT_OFF);
218
+  lv_btn_set_layout(buttonBack, LV_LAYOUT_OFF);
219
+
220
+  //lv_obj_t * labelWifi= lv_label_create(buttonWifi, NULL);
221
+  lv_obj_t * labelFan = lv_label_create(buttonFan, NULL);
222
+  lv_obj_t * label_About = lv_label_create(buttonAbout, NULL);
223
+  //lv_obj_t * label_Continue = lv_label_create(buttonContinue, NULL);
224
+  lv_obj_t * label_MotorOff = lv_label_create(buMotorOff, NULL);
225
+  lv_obj_t * label_Language = lv_label_create(buttonLanguage, NULL);
226
+  lv_obj_t * label_Back = lv_label_create(buttonBack, NULL);
227
+
228
+
229
+  if (gCfgItems.multiple_language != 0) {
230
+    //lv_label_set_text(labelWifi, set_menu.wifi);
231
+    //lv_obj_align(labelWifi, buttonWifi, LV_ALIGN_IN_BOTTOM_MID,0, BUTTON_TEXT_Y_OFFSET);
232
+
233
+    lv_label_set_text(labelFan, set_menu.fan);
234
+    lv_obj_align(labelFan, buttonFan, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
235
+
236
+    lv_label_set_text(label_About, set_menu.about);
237
+    lv_obj_align(label_About, buttonAbout, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
238
+
239
+    //lv_label_set_text(label_Continue, set_menu.breakpoint);
240
+    //lv_obj_align(label_Continue, buttonContinue, LV_ALIGN_IN_BOTTOM_MID,0, BUTTON_TEXT_Y_OFFSET);
241
+    #if HAS_SUICIDE
242
+      lv_label_set_text(label_MotorOff, set_menu.shutdown);
243
+    #else
244
+      lv_label_set_text(label_MotorOff, set_menu.motoroff);
245
+    #endif
246
+    lv_obj_align(label_MotorOff, buMotorOff, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
247
+
248
+    lv_label_set_text(label_Language, set_menu.language);
249
+    lv_obj_align(label_Language, buttonLanguage, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
250
+
251
+    lv_label_set_text(label_Back, common_menu.text_back);
252
+    lv_obj_align(label_Back, buttonBack, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
253
+  }
254
+}
255
+
256
+void lv_clear_set() { lv_obj_del(scr); }
257
+
258
+#endif // TFT_LITTLE_VGL_UI

+ 34
- 0
Marlin/src/lcd/extui/lib/mks_ui/draw_set.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 <http://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_set(void);
29
+extern void lv_clear_set();
30
+
31
+//extern void disp_temp_ready_print();
32
+#ifdef __cplusplus
33
+} /* C-declarations for C++ */
34
+#endif

+ 270
- 0
Marlin/src/lcd/extui/lib/mks_ui/draw_tool.cpp View File

@@ -0,0 +1,270 @@
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 <http://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+#include "../../../../inc/MarlinConfigPre.h"
23
+
24
+#if ENABLED(TFT_LITTLE_VGL_UI)
25
+
26
+#include "lv_conf.h"
27
+#include "draw_ui.h"
28
+//#include "../lvgl/src/lv_objx/lv_imgbtn.h"
29
+//#include "../lvgl/src/lv_objx/lv_img.h"
30
+//#include "../lvgl/src/lv_core/lv_disp.h"
31
+//#include "../lvgl/src/lv_core/lv_refr.h"
32
+
33
+#include "../../../../MarlinCore.h"
34
+#include "../../../../gcode/queue.h"
35
+
36
+//static lv_obj_t *buttonMoveZ,*buttonTest,*buttonZ0,*buttonStop,*buttonReturn;
37
+static lv_obj_t * scr;
38
+#if ENABLED(MKS_TEST)
39
+  extern uint8_t curent_disp_ui;
40
+#endif
41
+
42
+#define ID_T_PRE_HEAT   1
43
+#define ID_T_EXTRUCT    2
44
+#define ID_T_MOV        3
45
+#define ID_T_HOME       4
46
+#define ID_T_LEVELING   5
47
+#define ID_T_FILAMENT   6
48
+#define ID_T_MORE       7
49
+#define ID_T_RETURN     8
50
+
51
+static void event_handler(lv_obj_t * obj, lv_event_t event) {
52
+  switch (obj->mks_obj_id) {
53
+    case ID_T_PRE_HEAT:
54
+      if (event == LV_EVENT_CLICKED) {
55
+        // nothing to do
56
+      }
57
+      else if (event == LV_EVENT_RELEASED) {
58
+        lv_clear_tool();
59
+        lv_draw_preHeat();
60
+      }
61
+      break;
62
+    case ID_T_EXTRUCT:
63
+      if (event == LV_EVENT_CLICKED) {
64
+        // nothing to do
65
+      }
66
+      else if (event == LV_EVENT_RELEASED) {
67
+        lv_clear_tool();
68
+        lv_draw_extrusion();
69
+      }
70
+      break;
71
+    case ID_T_MOV:
72
+      if (event == LV_EVENT_CLICKED) {
73
+        // nothing to do
74
+      }
75
+      else if (event == LV_EVENT_RELEASED) {
76
+        lv_clear_tool();
77
+        lv_draw_move_motor();
78
+      }
79
+      break;
80
+    case ID_T_HOME:
81
+      if (event == LV_EVENT_CLICKED) {
82
+        // nothing to do
83
+      }
84
+      else if (event == LV_EVENT_RELEASED) {
85
+        lv_clear_tool();
86
+        lv_draw_home();
87
+      }
88
+      break;
89
+    case ID_T_LEVELING:
90
+      if (event == LV_EVENT_CLICKED) {
91
+        // nothing to do
92
+      }
93
+      else if (event == LV_EVENT_RELEASED) {
94
+        #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
95
+          queue.enqueue_one_P(PSTR("G28"));
96
+          queue.enqueue_one_P(PSTR("G29"));
97
+        #else
98
+          uiCfg.leveling_first_time = 1;
99
+          lv_clear_tool();
100
+          lv_draw_manualLevel();
101
+        #endif
102
+      }
103
+      break;
104
+    case ID_T_FILAMENT: break;
105
+    case ID_T_MORE: break;
106
+    case ID_T_RETURN:
107
+      if (event == LV_EVENT_CLICKED) {
108
+        // nothing to do
109
+      }
110
+      else if (event == LV_EVENT_RELEASED) {
111
+        TERN_(MKS_TEST, curent_disp_ui = 1);
112
+        lv_obj_del(scr);
113
+        lv_draw_ready_print();
114
+      }
115
+      break;
116
+  }
117
+}
118
+
119
+void lv_draw_tool(void) {
120
+  lv_obj_t *buttonPreHeat, *buttonExtrusion, *buttonMove, *buttonHome, *buttonLevel;
121
+  lv_obj_t *buttonBack;
122
+
123
+  if (disp_state_stack._disp_state[disp_state_stack._disp_index] != TOOL_UI) {
124
+    disp_state_stack._disp_index++;
125
+    disp_state_stack._disp_state[disp_state_stack._disp_index] = TOOL_UI;
126
+  }
127
+  disp_state = TOOL_UI;
128
+
129
+  scr = lv_obj_create(NULL, NULL);
130
+
131
+  //static lv_style_t tool_style;
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_lable_rel);
139
+  lv_obj_set_pos(title, TITLE_XPOS, TITLE_YPOS);
140
+  lv_label_set_text(title, creat_title_text());
141
+
142
+  lv_refr_now(lv_refr_get_disp_refreshing());
143
+
144
+  LV_IMG_DECLARE(bmp_pic);
145
+
146
+  /*Create an Image button*/
147
+  buttonPreHeat = lv_imgbtn_create(scr, NULL);
148
+  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);
154
+  buttonBack = lv_imgbtn_create(scr, NULL);
155
+
156
+  lv_obj_set_event_cb_mks(buttonPreHeat, event_handler, ID_T_PRE_HEAT, "bmp_PreHeat.bin", 0);
157
+  lv_imgbtn_set_src(buttonPreHeat, LV_BTN_STATE_REL, &bmp_pic);
158
+  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);
161
+  lv_obj_clear_protect(buttonPreHeat, LV_PROTECT_FOLLOW);
162
+
163
+  #if 1
164
+    lv_obj_set_event_cb_mks(buttonExtrusion, event_handler, ID_T_EXTRUCT, "bmp_Extruct.bin", 0);
165
+    lv_imgbtn_set_src(buttonExtrusion, LV_BTN_STATE_REL, &bmp_pic);
166
+    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);
169
+
170
+    lv_obj_set_event_cb_mks(buttonMove, event_handler, ID_T_MOV, "bmp_Mov.bin", 0);
171
+    lv_imgbtn_set_src(buttonMove, LV_BTN_STATE_REL, &bmp_pic);
172
+    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);
175
+
176
+    lv_obj_set_event_cb_mks(buttonHome, event_handler, ID_T_HOME, "bmp_Zero.bin", 0);
177
+    lv_imgbtn_set_src(buttonHome, LV_BTN_STATE_REL, &bmp_pic);
178
+    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);
181
+
182
+    lv_obj_set_event_cb_mks(buttonLevel, event_handler, ID_T_LEVELING, "bmp_Leveling.bin", 0);
183
+    lv_imgbtn_set_src(buttonLevel, LV_BTN_STATE_REL, &bmp_pic);
184
+    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);
201
+    lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_REL, &bmp_pic);
202
+    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
206
+
207
+  lv_obj_set_pos(buttonPreHeat, INTERVAL_V, titleHeight);
208
+  lv_obj_set_pos(buttonExtrusion, BTN_X_PIXEL + INTERVAL_V * 2, titleHeight);
209
+  lv_obj_set_pos(buttonMove, BTN_X_PIXEL * 2 + INTERVAL_V * 3, titleHeight);
210
+  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);
215
+
216
+  /*Create a label on the Image button*/
217
+  lv_btn_set_layout(buttonPreHeat, LV_LAYOUT_OFF);
218
+  lv_btn_set_layout(buttonExtrusion, LV_LAYOUT_OFF);
219
+  lv_btn_set_layout(buttonMove, LV_LAYOUT_OFF);
220
+  lv_btn_set_layout(buttonHome, LV_LAYOUT_OFF);
221
+  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);
224
+  lv_btn_set_layout(buttonBack, LV_LAYOUT_OFF);
225
+
226
+  lv_obj_t * labelPreHeat = lv_label_create(buttonPreHeat, NULL);
227
+  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);
231
+  //lv_obj_t * label_Filament = lv_label_create(buttonFilament, NULL);
232
+  //lv_obj_t * label_More = lv_label_create(buttonMore, NULL);
233
+  lv_obj_t * label_Back = lv_label_create(buttonBack, NULL);
234
+
235
+  if (gCfgItems.multiple_language != 0) {
236
+    lv_label_set_text(labelPreHeat, tool_menu.preheat);
237
+    lv_obj_align(labelPreHeat, buttonPreHeat, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
238
+
239
+    lv_label_set_text(labelExtrusion, tool_menu.extrude);
240
+    lv_obj_align(labelExtrusion, buttonExtrusion, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
241
+
242
+    lv_label_set_text(label_Move, tool_menu.move);
243
+    lv_obj_align(label_Move, buttonMove, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
244
+
245
+    lv_label_set_text(label_Home, tool_menu.home);
246
+    lv_obj_align(label_Home, buttonHome, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
247
+
248
+    /*
249
+    if (gCfgItems.leveling_mode != 2) {
250
+      lv_label_set_text(label_Level, gCfgItems.leveling_mode == 1 ? tool_menu.autoleveling : tool_menu.leveling);
251
+      lv_obj_align(label_Level, buttonLevel, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
252
+    }
253
+    */
254
+    lv_label_set_text(label_Level, tool_menu.TERN(AUTO_BED_LEVELING_BILINEAR, autoleveling, leveling));
255
+    lv_obj_align(label_Level, buttonLevel, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
256
+
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);
259
+
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);
262
+
263
+    lv_label_set_text(label_Back, common_menu.text_back);
264
+    lv_obj_align(label_Back, buttonBack, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
265
+  }
266
+}
267
+
268
+void lv_clear_tool() { lv_obj_del(scr); }
269
+
270
+#endif // TFT_LITTLE_VGL_UI

+ 34
- 0
Marlin/src/lcd/extui/lib/mks_ui/draw_tool.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 <http://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_tool(void);
29
+extern void lv_clear_tool();
30
+
31
+//extern void disp_temp_ready_print();
32
+#ifdef __cplusplus
33
+} /* C-declarations for C++ */
34
+#endif

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


+ 229
- 0
Marlin/src/lcd/extui/lib/mks_ui/draw_ui.h View File

@@ -0,0 +1,229 @@
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 <http://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+#pragma once
23
+
24
+#ifdef __cplusplus
25
+extern "C" { /* C-declarations for C++ */
26
+#endif
27
+
28
+#include <stdint.h>
29
+#include <string.h>
30
+#include "lvgl.h"
31
+#include "inc/tft_multi_language.h"
32
+#include "inc/draw_ready_print.h"
33
+#include "inc/draw_language.h"
34
+#include "inc/draw_set.h"
35
+#include "inc/draw_tool.h"
36
+#include "inc/draw_print_file.h"
37
+#include "inc/draw_dialog.h"
38
+#include "inc/draw_printing.h"
39
+#include "inc/draw_opration.h"
40
+#include "inc/draw_preHeat.h"
41
+#include "inc/draw_extrusion.h"
42
+#include "inc/draw_home.h"
43
+#include "inc/draw_move_motor.h"
44
+#include "inc/draw_fan.h"
45
+#include "inc/draw_about.h"
46
+#include "inc/draw_change_speed.h"
47
+#include "inc/draw_manuaLevel.h"
48
+#include "inc/draw_error_message.h"
49
+#include "inc/printer_opration.h"
50
+
51
+#define TFT35
52
+
53
+#ifdef TFT35
54
+
55
+  #define TFT_WIDTH         480
56
+  #define TFT_HEIGHT        320
57
+
58
+  #define titleHeight        36   // TFT_screen.title_high
59
+  #define INTERVAL_H          2   // TFT_screen.gap_h // 2
60
+  #define INTERVAL_V          2   // TFT_screen.gap_v // 2
61
+  #define BTN_X_PIXEL       117   // TFT_screen.btn_x_pixel
62
+  #define BTN_Y_PIXEL       140   // TFT_screen.btn_y_pixel
63
+
64
+  #define SIMPLE_FIRST_PAGE_GRAP   30
65
+
66
+  #define BUTTON_TEXT_Y_OFFSET    -20
67
+
68
+  #define TITLE_XPOS          3    //TFT_screen.title_xpos
69
+  #define TITLE_YPOS          5    //TFT_screen.title_ypos
70
+
71
+  #define FILE_BTN_CNT        6
72
+
73
+  #define OTHER_BTN_XPIEL   117
74
+  #define OTHER_BTN_YPIEL    92
75
+
76
+  #define FILE_PRE_PIC_X_OFFSET 8
77
+  #define FILE_PRE_PIC_Y_OFFSET 0
78
+
79
+  #define PREVIEW_LITTLE_PIC_SIZE   40910//400*100+9*101+1
80
+  #define PREVIEW_SIZE      202720//(PREVIEW_LITTLE_PIC_SIZE+800*200+201*9+1)
81
+
82
+  #define GCFG_FLAG_VALUE   0xEE
83
+
84
+#else
85
+
86
+  #define TFT_WIDTH     320
87
+  #define TFT_HEIGHT    240
88
+
89
+#endif
90
+
91
+extern char public_buf_m[100];
92
+extern char public_buf_l[30];
93
+
94
+typedef struct {
95
+  uint8_t spi_flash_flag;
96
+  uint8_t multiple_language;
97
+  uint8_t language;
98
+  uint8_t leveling_mode;
99
+  uint8_t from_flash_pic;
100
+  uint8_t finish_power_off;
101
+  uint8_t pause_reprint;
102
+  uint32_t curFilesize;
103
+} CFG_ITMES;
104
+
105
+typedef struct {
106
+  uint8_t curTempType : 1,
107
+          curSprayerChoose : 3,
108
+          stepHeat : 4;
109
+  uint8_t leveling_first_time : 1;
110
+  uint8_t extruStep;
111
+  uint8_t extruSpeed;
112
+  uint8_t print_state;
113
+  uint8_t stepPrintSpeed;
114
+  uint8_t waitEndMoves;
115
+  uint16_t moveSpeed;
116
+  float move_dist;
117
+} UI_CFG;
118
+
119
+typedef enum {
120
+  MAIN_UI,
121
+  PRINT_READY_UI,
122
+  PRINT_FILE_UI,
123
+  PRINTING_UI,
124
+  MOVE_MOTOR_UI,
125
+  OPERATE_UI,
126
+  PAUSE_UI,
127
+  EXTRUSION_UI,
128
+  FAN_UI,
129
+  PRE_HEAT_UI,
130
+  CHANGE_SPEED_UI,
131
+  TEMP_UI,
132
+  SET_UI,
133
+  ZERO_UI,
134
+  SPRAYER_UI,
135
+  MACHINE_UI,
136
+  LANGUAGE_UI,
137
+  ABOUT_UI,
138
+  LOG_UI,
139
+  DISK_UI,
140
+  CALIBRATE_UI,
141
+  DIALOG_UI,
142
+  WIFI_UI,
143
+  MORE_UI,
144
+  FILETRANSFER_UI,
145
+  FILETRANSFERSTATE_UI,
146
+  PRINT_MORE_UI,
147
+  FILAMENTCHANGE_UI,
148
+  LEVELING_UI,
149
+  MESHLEVELING_UI,
150
+  BIND_UI,
151
+  ZOFFSET_UI,
152
+  TOOL_UI,
153
+  HARDWARE_TEST_UI,
154
+  WIFI_LIST_UI,
155
+  KEY_BOARD_UI,
156
+  TIPS_UI,
157
+  MACHINE_PARA_UI,
158
+  MACHINE_SETTINGS_UI,
159
+  TEMPERATURE_SETTINGS_UI,
160
+  MOTOR_SETTINGS_UI,
161
+  MACHINETYPE_UI,
162
+  STROKE_UI,
163
+  HOME_DIR_UI,
164
+  ENDSTOP_TYPE_UI,
165
+  FILAMENT_SETTINGS_UI,
166
+  LEVELING_SETTIGNS_UI,
167
+  LEVELING_PARA_UI,
168
+  DELTA_LEVELING_PARA_UI,
169
+  XYZ_LEVELING_PARA_UI,
170
+  MAXFEEDRATE_UI,
171
+  STEPS_UI,
172
+  ACCELERATION_UI,
173
+  JERK_UI,
174
+  MOTORDIR_UI,
175
+  HOMESPEED_UI,
176
+  NOZZLE_CONFIG_UI,
177
+  HOTBED_CONFIG_UI,
178
+  ADVANCED_UI,
179
+  DOUBLE_Z_UI,
180
+  ENABLE_INVERT_UI,
181
+  NUMBER_KEY_UI,
182
+  BABY_STEP_UI,
183
+  ERROR_MESSAGE_UI
184
+} DISP_STATE;
185
+
186
+typedef struct {
187
+  DISP_STATE _disp_state[100];
188
+  int _disp_index;
189
+} DISP_STATE_STACK;
190
+
191
+typedef struct {
192
+  int16_t days;
193
+  uint16_t hours;
194
+  uint8_t minutes;
195
+  volatile int8_t seconds;
196
+  int8_t ms_10;
197
+  int8_t start;
198
+} PRINT_TIME;
199
+extern PRINT_TIME print_time;
200
+
201
+extern CFG_ITMES gCfgItems;
202
+extern UI_CFG uiCfg;
203
+extern DISP_STATE disp_state;
204
+extern DISP_STATE last_disp_state;
205
+extern DISP_STATE_STACK disp_state_stack;
206
+
207
+extern lv_style_t tft_style_scr;
208
+extern lv_style_t tft_style_lable_pre;
209
+extern lv_style_t tft_style_lable_rel;
210
+
211
+extern void gCfgItems_init();
212
+extern void ui_cfg_init();
213
+extern void tft_style_init();
214
+extern char *creat_title_text(void);
215
+extern void preview_gcode_prehandle(char *path);
216
+extern void update_spi_flash();
217
+extern void disp_pre_gcode(int xpos_pixel, int ypos_pixel);
218
+extern void GUI_RefreshPage();
219
+extern void clear_cur_ui();
220
+extern void draw_return_ui();
221
+extern void sd_detection();
222
+extern void gCfg_to_spiFlah();
223
+extern void print_time_count();
224
+
225
+extern void LV_TASK_HANDLER();
226
+
227
+#ifdef __cplusplus
228
+} /* C-declarations for C++ */
229
+#endif

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

@@ -0,0 +1,111 @@
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 <http://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+#include "../../../../inc/MarlinConfigPre.h"
23
+
24
+#if ENABLED(TFT_LITTLE_VGL_UI)
25
+
26
+#include "../../../../MarlinCore.h"
27
+#include "lvgl.h"
28
+#include "pic_manager.h"
29
+
30
+typedef struct {
31
+  uint16_t min;
32
+  uint16_t max;
33
+  uint8_t bpp;
34
+  uint8_t reserved[3];
35
+} x_header_t;
36
+
37
+typedef struct {
38
+  uint32_t pos;
39
+} x_table_t;
40
+
41
+typedef struct {
42
+  uint8_t adv_w;
43
+  uint8_t box_w;
44
+} glyph_dsc_t;
45
+
46
+static x_header_t __g_xbf_hd = { .min = 0, .max = 0, .bpp = 0 };
47
+static uint8_t __g_font_buf[75];
48
+
49
+static uint8_t *__user_font_getdata(int offset, int size) {
50
+  //memset(__g_font_buf,0,sizeof(__g_font_buf));
51
+  get_spi_flash_data((char *)__g_font_buf, offset, size);
52
+  return __g_font_buf;
53
+  //return &buf_test[offset];
54
+}
55
+
56
+static const uint8_t * __user_font_get_bitmap(const lv_font_t * font, uint32_t unicode_letter) {
57
+  if (__g_xbf_hd.max == 0) {
58
+    uint8_t *p = __user_font_getdata(0, sizeof(x_header_t));
59
+    memcpy(&__g_xbf_hd, p, sizeof(x_header_t));
60
+  }
61
+  if (unicode_letter > __g_xbf_hd.max || unicode_letter < __g_xbf_hd.min)
62
+    return NULL;
63
+  uint32_t unicode_offset = sizeof(x_header_t) + (unicode_letter - __g_xbf_hd.min) * 4;
64
+  uint32_t *p_pos = (uint32_t *)__user_font_getdata(unicode_offset, 4);
65
+  if (p_pos[0] != 0) {
66
+    uint32_t pos = p_pos[0];
67
+    //glyph_dsc_t * gdsc = (glyph_dsc_t*)__user_font_getdata(pos, 2);
68
+    __user_font_getdata(pos, 2);
69
+    //return __user_font_getdata(pos+2, gdsc->box_w*__g_xbf_hd.bpp/8);
70
+    return __user_font_getdata(pos + 2, sizeof(__g_font_buf));
71
+  }
72
+  return NULL;
73
+}
74
+
75
+static bool __user_font_get_glyph_dsc(const lv_font_t * font, lv_font_glyph_dsc_t * dsc_out, uint32_t unicode_letter, uint32_t unicode_letter_next) {
76
+  if (__g_xbf_hd.max == 0) {
77
+    uint8_t *p = __user_font_getdata(0, sizeof(x_header_t));
78
+    memcpy(&__g_xbf_hd, p, sizeof(x_header_t));
79
+  }
80
+  if (unicode_letter > __g_xbf_hd.max || unicode_letter < __g_xbf_hd.min)
81
+    return NULL;
82
+  uint32_t unicode_offset = sizeof(x_header_t) + (unicode_letter - __g_xbf_hd.min) * 4;
83
+  uint32_t *p_pos = (uint32_t *)__user_font_getdata(unicode_offset, 4);
84
+  if (p_pos[0] != 0) {
85
+    glyph_dsc_t * gdsc = (glyph_dsc_t*)__user_font_getdata(p_pos[0], 2);
86
+    dsc_out->adv_w = gdsc->adv_w;
87
+    dsc_out->box_h = font->line_height;
88
+    dsc_out->box_w = gdsc->box_w;
89
+    dsc_out->ofs_x = 0;
90
+    dsc_out->ofs_y = 0;
91
+    dsc_out->bpp = __g_xbf_hd.bpp;
92
+    return true;
93
+  }
94
+  return false;
95
+}
96
+
97
+/*lv_font_t gb2312_puhui32 = {
98
+.get_glyph_bitmap = __user_font_get_bitmap,
99
+.get_glyph_dsc = __user_font_get_glyph_dsc,
100
+.line_height = 25,
101
+.base_line = 0,
102
+};*/
103
+lv_font_t gb2312_puhui32;
104
+void init_gb2312_font() {
105
+  gb2312_puhui32.get_glyph_bitmap = __user_font_get_bitmap;
106
+  gb2312_puhui32.get_glyph_dsc = __user_font_get_glyph_dsc;
107
+  gb2312_puhui32.line_height = 25;
108
+  gb2312_puhui32.base_line = 0;
109
+}
110
+
111
+#endif // TFT_LITTLE_VGL_UI

+ 594
- 0
Marlin/src/lcd/extui/lib/mks_ui/mks_hardware_test.cpp View File

@@ -0,0 +1,594 @@
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 <http://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+#include "../../../../inc/MarlinConfigPre.h"
23
+
24
+#if ENABLED(TFT_LITTLE_VGL_UI)
25
+
26
+#include "tft_lvgl_configuration.h"
27
+#include "lvgl.h"
28
+#include "draw_ready_print.h"
29
+#include "W25Qxx.h"
30
+#include "pic_manager.h"
31
+#include "mks_hardware_test.h"
32
+
33
+#include "../../../../MarlinCore.h"
34
+#include "../../../../module/temperature.h"
35
+#include "../../../../feature/touch/xpt2046.h"
36
+
37
+#if ENABLED(MKS_TEST)
38
+
39
+  extern uint8_t curent_disp_ui;
40
+
41
+  uint8_t pw_det_sta, pw_off_sta, mt_det_sta, mt_det2_sta, mt_det3_sta;
42
+  uint8_t endstopx1_sta, endstopx2_sta, endstopy1_sta, endstopy2_sta, endstopz1_sta, endstopz2_sta;
43
+  void test_gpio_readlevel_L() {
44
+    volatile uint32_t itest;
45
+    WRITE(WIFI_IO2_PIN, HIGH);
46
+    itest = 10000;
47
+    while (itest--);
48
+    pw_det_sta = (READ(POWER_LOSS_PIN) == 0);
49
+    pw_off_sta = (READ(PS_ON_PIN) == 0);
50
+    mt_det_sta = (READ(FIL_RUNOUT_PIN) == 0);
51
+    mt_det2_sta = (READ(FIL_RUNOUT_2_PIN) == 0);
52
+    mt_det3_sta = (READ(FIL_RUNOUT_3_PIN) == 0);
53
+    endstopx1_sta = (READ(X_MIN_PIN) == 0);
54
+    endstopx2_sta = (READ(X_MAX_PIN) == 0);
55
+    endstopy1_sta = (READ(Y_MIN_PIN) == 0);
56
+    endstopy2_sta = (READ(Y_MAX_PIN) == 0);
57
+    endstopz1_sta = (READ(Z_MIN_PIN) == 0);
58
+    endstopz2_sta = (READ(Z_MAX_PIN) == 0);
59
+  }
60
+
61
+  void test_gpio_readlevel_H() {
62
+    volatile uint32_t itest;
63
+    WRITE(WIFI_IO2_PIN, LOW);
64
+    itest = 10000;
65
+    while (itest--);
66
+    pw_det_sta = (READ(POWER_LOSS_PIN) == 1);
67
+    pw_off_sta = (READ(PS_ON_PIN) == 1);
68
+    mt_det_sta = (READ(FIL_RUNOUT_PIN) == 1);
69
+    mt_det2_sta = (READ(FIL_RUNOUT_2_PIN) == 1);
70
+    mt_det3_sta = (READ(FIL_RUNOUT_3_PIN) == 1);
71
+    endstopx1_sta = (READ(X_MIN_PIN) == 1);
72
+    endstopx2_sta = (READ(X_MAX_PIN) == 1);
73
+    endstopy1_sta = (READ(Y_MIN_PIN) == 1);
74
+    endstopy2_sta = (READ(Y_MAX_PIN) == 1);
75
+    endstopz1_sta = (READ(Z_MIN_PIN) == 1);
76
+    endstopz2_sta = (READ(Z_MAX_PIN) == 1);
77
+  }
78
+
79
+  void init_Tst_GPIO() {
80
+    SET_INPUT_PULLUP(X_MIN_PIN);
81
+    SET_INPUT_PULLUP(X_MAX_PIN);
82
+    SET_INPUT_PULLUP(Y_MIN_PIN);
83
+    SET_INPUT_PULLUP(Y_MAX_PIN);
84
+    SET_INPUT_PULLUP(Z_MIN_PIN);
85
+    SET_INPUT_PULLUP(Z_MAX_PIN);
86
+
87
+    SET_OUTPUT(WIFI_IO2_PIN);
88
+
89
+    SET_INPUT_PULLUP(FIL_RUNOUT_PIN);
90
+    SET_INPUT_PULLUP(FIL_RUNOUT_2_PIN);
91
+    SET_INPUT_PULLUP(FIL_RUNOUT_3_PIN);
92
+
93
+    SET_INPUT_PULLUP(POWER_LOSS_PIN);
94
+    SET_INPUT_PULLUP(PS_ON_PIN);
95
+
96
+    SET_INPUT_PULLUP(SERVO0_PIN);
97
+
98
+    SET_OUTPUT(E0_ENABLE_PIN);
99
+    SET_OUTPUT(X_ENABLE_PIN);
100
+
101
+    WRITE(X_ENABLE_PIN, LOW);
102
+    WRITE(Y_ENABLE_PIN, LOW);
103
+    WRITE(Z_ENABLE_PIN, LOW);
104
+    WRITE(E0_ENABLE_PIN, LOW);
105
+    WRITE(E1_ENABLE_PIN, LOW);
106
+    WRITE(E2_ENABLE_PIN, LOW);
107
+  }
108
+
109
+  void mks_test_beeper() {
110
+    WRITE(BEEPER_PIN, HIGH);
111
+    delay(100);
112
+    WRITE(BEEPER_PIN, LOW);
113
+    delay(100);
114
+  }
115
+
116
+  void Test_GPIO() {
117
+    init_Tst_GPIO();
118
+
119
+    test_gpio_readlevel_L();
120
+    test_gpio_readlevel_H();
121
+    test_gpio_readlevel_L();
122
+    if ((pw_det_sta == 1) && (mt_det_sta == 1) && (mt_det2_sta == 1) && (mt_det3_sta == 1)) {
123
+      if (curent_disp_ui == 1) disp_det_ok();
124
+    }
125
+    else if (curent_disp_ui == 1) disp_det_error();
126
+    if ((endstopx1_sta == 1)
127
+        && (endstopx2_sta == 1)
128
+        && (endstopy1_sta == 1)
129
+        && (endstopy2_sta == 1)
130
+        && (endstopz1_sta == 1)
131
+        && (endstopz2_sta == 1)
132
+        ) {
133
+      if (curent_disp_ui == 1) disp_Limit_ok();
134
+    }
135
+    else if (curent_disp_ui == 1)
136
+      disp_Limit_error();
137
+      //mks_test_beeper();
138
+
139
+  }
140
+
141
+  void mks_test() {
142
+    if (millis() % 2000 < 1000) {
143
+      WRITE(X_DIR_PIN, LOW);
144
+      WRITE(Y_DIR_PIN, LOW);
145
+      WRITE(Z_DIR_PIN, LOW);
146
+      WRITE(E0_DIR_PIN, LOW);
147
+      WRITE(E1_DIR_PIN, LOW);
148
+      WRITE(E2_DIR_PIN, LOW);
149
+      thermalManager.fan_speed[0] = 255;
150
+      WRITE(HEATER_2_PIN, HIGH); // HE2
151
+      WRITE(HEATER_1_PIN, HIGH); // HE1
152
+      WRITE(HEATER_0_PIN, HIGH); // HE0
153
+      WRITE(HEATER_BED_PIN, HIGH); // HOT-BED
154
+    }
155
+    else {
156
+      WRITE(X_DIR_PIN, HIGH);
157
+      WRITE(Y_DIR_PIN, HIGH);
158
+      WRITE(Z_DIR_PIN, HIGH);
159
+      WRITE(E0_DIR_PIN, HIGH);
160
+      WRITE(E1_DIR_PIN, HIGH);
161
+      WRITE(E2_DIR_PIN, HIGH);
162
+      thermalManager.fan_speed[0] = 0;
163
+      WRITE(HEATER_2_PIN, LOW); // HE2
164
+      WRITE(HEATER_1_PIN, LOW); // HE1
165
+      WRITE(HEATER_0_PIN, LOW); // HE0
166
+      WRITE(HEATER_BED_PIN, LOW); // HOT-BED
167
+    }
168
+    if ((endstopx1_sta == 1) && (endstopx2_sta == 1)
169
+        && (endstopy1_sta == 1) && (endstopy2_sta == 1)
170
+        && (endstopz1_sta == 1) && (endstopz2_sta == 1)
171
+        ) {
172
+
173
+    }
174
+    else {
175
+      mks_test_beeper();
176
+    }
177
+
178
+    if (curent_disp_ui == 1)
179
+      disp_test();
180
+  }
181
+
182
+#endif // MKS_TEST
183
+
184
+static const uint16_t ASCII_Table_16x24[] PROGMEM = {
185
+  // Space ' '
186
+  0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
187
+  0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
188
+  0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
189
+  // '!'
190
+  0x0000, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180,
191
+  0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0000, 0x0000,
192
+  0x0180, 0x0180, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
193
+  // '"'
194
+  0x0000, 0x0000, 0x00CC, 0x00CC, 0x00CC, 0x00CC, 0x00CC, 0x00CC,
195
+  0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
196
+  0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
197
+  // '#'
198
+  0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0C60, 0x0C60,
199
+  0x0C60, 0x0630, 0x0630, 0x1FFE, 0x1FFE, 0x0630, 0x0738, 0x0318,
200
+  0x1FFE, 0x1FFE, 0x0318, 0x0318, 0x018C, 0x018C, 0x018C, 0x0000,
201
+  // '$'
202
+  0x0000, 0x0080, 0x03E0, 0x0FF8, 0x0E9C, 0x1C8C, 0x188C, 0x008C,
203
+  0x0098, 0x01F8, 0x07E0, 0x0E80, 0x1C80, 0x188C, 0x188C, 0x189C,
204
+  0x0CB8, 0x0FF0, 0x03E0, 0x0080, 0x0080, 0x0000, 0x0000, 0x0000,
205
+  // '%'
206
+  0x0000, 0x0000, 0x0000, 0x180E, 0x0C1B, 0x0C11, 0x0611, 0x0611,
207
+  0x0311, 0x0311, 0x019B, 0x018E, 0x38C0, 0x6CC0, 0x4460, 0x4460,
208
+  0x4430, 0x4430, 0x4418, 0x6C18, 0x380C, 0x0000, 0x0000, 0x0000,
209
+  // '&'
210
+  0x0000, 0x01E0, 0x03F0, 0x0738, 0x0618, 0x0618, 0x0330, 0x01F0,
211
+  0x00F0, 0x00F8, 0x319C, 0x330E, 0x1E06, 0x1C06, 0x1C06, 0x3F06,
212
+  0x73FC, 0x21F0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
213
+  // "'"
214
+  0x0000, 0x0000, 0x000C, 0x000C, 0x000C, 0x000C, 0x000C, 0x000C,
215
+  0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
216
+  0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
217
+  // '('
218
+  0x0000, 0x0200, 0x0300, 0x0180, 0x00C0, 0x00C0, 0x0060, 0x0060,
219
+  0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030,
220
+  0x0060, 0x0060, 0x00C0, 0x00C0, 0x0180, 0x0300, 0x0200, 0x0000,
221
+  // ')'
222
+  0x0000, 0x0020, 0x0060, 0x00C0, 0x0180, 0x0180, 0x0300, 0x0300,
223
+  0x0600, 0x0600, 0x0600, 0x0600, 0x0600, 0x0600, 0x0600, 0x0600,
224
+  0x0300, 0x0300, 0x0180, 0x0180, 0x00C0, 0x0060, 0x0020, 0x0000,
225
+  // '*'
226
+  0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x00C0, 0x00C0,
227
+  0x06D8, 0x07F8, 0x01E0, 0x0330, 0x0738, 0x0000, 0x0000, 0x0000,
228
+  0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
229
+  // '+'
230
+  0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0180, 0x0180,
231
+  0x0180, 0x0180, 0x0180, 0x3FFC, 0x3FFC, 0x0180, 0x0180, 0x0180,
232
+  0x0180, 0x0180, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
233
+  // ','
234
+  0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
235
+  0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
236
+  0x0000, 0x0180, 0x0180, 0x0100, 0x0100, 0x0080, 0x0000, 0x0000,
237
+  // '-'
238
+  0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
239
+  0x0000, 0x0000, 0x0000, 0x0000, 0x07E0, 0x07E0, 0x0000, 0x0000,
240
+  0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
241
+  // '.'
242
+  0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
243
+  0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
244
+  0x0000, 0x00C0, 0x00C0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
245
+  // '/'
246
+  0x0000, 0x0C00, 0x0C00, 0x0600, 0x0600, 0x0600, 0x0300, 0x0300,
247
+  0x0300, 0x0380, 0x0180, 0x0180, 0x0180, 0x00C0, 0x00C0, 0x00C0,
248
+  0x0060, 0x0060, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
249
+  // '0'
250
+  0x0000, 0x03E0, 0x07F0, 0x0E38, 0x0C18, 0x180C, 0x180C, 0x180C,
251
+  0x180C, 0x180C, 0x180C, 0x180C, 0x180C, 0x180C, 0x0C18, 0x0E38,
252
+  0x07F0, 0x03E0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
253
+  // '1'
254
+  0x0000, 0x0100, 0x0180, 0x01C0, 0x01F0, 0x0198, 0x0188, 0x0180,
255
+  0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180,
256
+  0x0180, 0x0180, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
257
+  // '2'
258
+  0x0000, 0x03E0, 0x0FF8, 0x0C18, 0x180C, 0x180C, 0x1800, 0x1800,
259
+  0x0C00, 0x0600, 0x0300, 0x0180, 0x00C0, 0x0060, 0x0030, 0x0018,
260
+  0x1FFC, 0x1FFC, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
261
+  // '3'
262
+  0x0000, 0x01E0, 0x07F8, 0x0E18, 0x0C0C, 0x0C0C, 0x0C00, 0x0600,
263
+  0x03C0, 0x07C0, 0x0C00, 0x1800, 0x1800, 0x180C, 0x180C, 0x0C18,
264
+  0x07F8, 0x03E0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
265
+  // '4'
266
+  0x0000, 0x0C00, 0x0E00, 0x0F00, 0x0F00, 0x0D80, 0x0CC0, 0x0C60,
267
+  0x0C60, 0x0C30, 0x0C18, 0x0C0C, 0x3FFC, 0x3FFC, 0x0C00, 0x0C00,
268
+  0x0C00, 0x0C00, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
269
+  // '5'
270
+  0x0000, 0x0FF8, 0x0FF8, 0x0018, 0x0018, 0x000C, 0x03EC, 0x07FC,
271
+  0x0E1C, 0x1C00, 0x1800, 0x1800, 0x1800, 0x180C, 0x0C1C, 0x0E18,
272
+  0x07F8, 0x03E0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
273
+  // '6'
274
+  0x0000, 0x07C0, 0x0FF0, 0x1C38, 0x1818, 0x0018, 0x000C, 0x03CC,
275
+  0x0FEC, 0x0E3C, 0x1C1C, 0x180C, 0x180C, 0x180C, 0x1C18, 0x0E38,
276
+  0x07F0, 0x03E0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
277
+  // '7'
278
+  0x0000, 0x1FFC, 0x1FFC, 0x0C00, 0x0600, 0x0600, 0x0300, 0x0380,
279
+  0x0180, 0x01C0, 0x00C0, 0x00E0, 0x0060, 0x0060, 0x0070, 0x0030,
280
+  0x0030, 0x0030, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
281
+  // '8'
282
+  0x0000, 0x03E0, 0x07F0, 0x0E38, 0x0C18, 0x0C18, 0x0C18, 0x0638,
283
+  0x07F0, 0x07F0, 0x0C18, 0x180C, 0x180C, 0x180C, 0x180C, 0x0C38,
284
+  0x0FF8, 0x03E0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
285
+  // '9'
286
+  0x0000, 0x03E0, 0x07F0, 0x0E38, 0x0C1C, 0x180C, 0x180C, 0x180C,
287
+  0x1C1C, 0x1E38, 0x1BF8, 0x19E0, 0x1800, 0x0C00, 0x0C00, 0x0E1C,
288
+  0x07F8, 0x01F0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
289
+  // ':'
290
+  0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0180, 0x0180,
291
+  0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
292
+  0x0180, 0x0180, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
293
+  // ';'
294
+  0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0180, 0x0180,
295
+  0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
296
+  0x0180, 0x0180, 0x0100, 0x0100, 0x0080, 0x0000, 0x0000, 0x0000,
297
+  // '<'
298
+  0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
299
+  0x1000, 0x1C00, 0x0F80, 0x03E0, 0x00F8, 0x0018, 0x00F8, 0x03E0,
300
+  0x0F80, 0x1C00, 0x1000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
301
+  // '='
302
+  0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
303
+  0x1FF8, 0x0000, 0x0000, 0x0000, 0x1FF8, 0x0000, 0x0000, 0x0000,
304
+  0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
305
+  // '>'
306
+  0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
307
+  0x0008, 0x0038, 0x01F0, 0x07C0, 0x1F00, 0x1800, 0x1F00, 0x07C0,
308
+  0x01F0, 0x0038, 0x0008, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
309
+  // '?'
310
+  0x0000, 0x03E0, 0x0FF8, 0x0C18, 0x180C, 0x180C, 0x1800, 0x0C00,
311
+  0x0600, 0x0300, 0x0180, 0x00C0, 0x00C0, 0x00C0, 0x0000, 0x0000,
312
+  0x00C0, 0x00C0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
313
+  // '@'
314
+  0x0000, 0x0000, 0x07E0, 0x1818, 0x2004, 0x29C2, 0x4A22, 0x4411,
315
+  0x4409, 0x4409, 0x4409, 0x2209, 0x1311, 0x0CE2, 0x4002, 0x2004,
316
+  0x1818, 0x07E0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
317
+  // 'A'
318
+  0x0000, 0x0380, 0x0380, 0x06C0, 0x06C0, 0x06C0, 0x0C60, 0x0C60,
319
+  0x1830, 0x1830, 0x1830, 0x3FF8, 0x3FF8, 0x701C, 0x600C, 0x600C,
320
+  0xC006, 0xC006, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
321
+  // 'B'
322
+  0x0000, 0x03FC, 0x0FFC, 0x0C0C, 0x180C, 0x180C, 0x180C, 0x0C0C,
323
+  0x07FC, 0x0FFC, 0x180C, 0x300C, 0x300C, 0x300C, 0x300C, 0x180C,
324
+  0x1FFC, 0x07FC, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
325
+  // 'C'
326
+  0x0000, 0x07C0, 0x1FF0, 0x3838, 0x301C, 0x700C, 0x6006, 0x0006,
327
+  0x0006, 0x0006, 0x0006, 0x0006, 0x0006, 0x6006, 0x700C, 0x301C,
328
+  0x1FF0, 0x07E0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
329
+  // 'D'
330
+  0x0000, 0x03FE, 0x0FFE, 0x0E06, 0x1806, 0x1806, 0x3006, 0x3006,
331
+  0x3006, 0x3006, 0x3006, 0x3006, 0x3006, 0x1806, 0x1806, 0x0E06,
332
+  0x0FFE, 0x03FE, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
333
+  // 'E'
334
+  0x0000, 0x3FFC, 0x3FFC, 0x000C, 0x000C, 0x000C, 0x000C, 0x000C,
335
+  0x1FFC, 0x1FFC, 0x000C, 0x000C, 0x000C, 0x000C, 0x000C, 0x000C,
336
+  0x3FFC, 0x3FFC, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
337
+  // 'F'
338
+  0x0000, 0x3FF8, 0x3FF8, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018,
339
+  0x1FF8, 0x1FF8, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018,
340
+  0x0018, 0x0018, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
341
+  // 'G'
342
+  0x0000, 0x0FE0, 0x3FF8, 0x783C, 0x600E, 0xE006, 0xC007, 0x0003,
343
+  0x0003, 0xFE03, 0xFE03, 0xC003, 0xC007, 0xC006, 0xC00E, 0xF03C,
344
+  0x3FF8, 0x0FE0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
345
+  // 'H'
346
+  0x0000, 0x300C, 0x300C, 0x300C, 0x300C, 0x300C, 0x300C, 0x300C,
347
+  0x3FFC, 0x3FFC, 0x300C, 0x300C, 0x300C, 0x300C, 0x300C, 0x300C,
348
+  0x300C, 0x300C, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
349
+  // 'I'
350
+  0x0000, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180,
351
+  0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180,
352
+  0x0180, 0x0180, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
353
+  // 'J'
354
+  0x0000, 0x0600, 0x0600, 0x0600, 0x0600, 0x0600, 0x0600, 0x0600,
355
+  0x0600, 0x0600, 0x0600, 0x0600, 0x0600, 0x0618, 0x0618, 0x0738,
356
+  0x03F0, 0x01E0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
357
+  // 'K'
358
+  0x0000, 0x3006, 0x1806, 0x0C06, 0x0606, 0x0306, 0x0186, 0x00C6,
359
+  0x0066, 0x0076, 0x00DE, 0x018E, 0x0306, 0x0606, 0x0C06, 0x1806,
360
+  0x3006, 0x6006, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
361
+  // 'L'
362
+  0x0000, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018,
363
+  0x0018, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018,
364
+  0x1FF8, 0x1FF8, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
365
+  // 'M'
366
+  0x0000, 0xE00E, 0xF01E, 0xF01E, 0xF01E, 0xD836, 0xD836, 0xD836,
367
+  0xD836, 0xCC66, 0xCC66, 0xCC66, 0xC6C6, 0xC6C6, 0xC6C6, 0xC6C6,
368
+  0xC386, 0xC386, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
369
+  // 'N'
370
+  0x0000, 0x300C, 0x301C, 0x303C, 0x303C, 0x306C, 0x306C, 0x30CC,
371
+  0x30CC, 0x318C, 0x330C, 0x330C, 0x360C, 0x360C, 0x3C0C, 0x3C0C,
372
+  0x380C, 0x300C, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
373
+  // 'O'
374
+  0x0000, 0x07E0, 0x1FF8, 0x381C, 0x700E, 0x6006, 0xC003, 0xC003,
375
+  0xC003, 0xC003, 0xC003, 0xC003, 0xC003, 0x6006, 0x700E, 0x381C,
376
+  0x1FF8, 0x07E0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
377
+  // 'P'
378
+  0x0000, 0x0FFC, 0x1FFC, 0x380C, 0x300C, 0x300C, 0x300C, 0x300C,
379
+  0x180C, 0x1FFC, 0x07FC, 0x000C, 0x000C, 0x000C, 0x000C, 0x000C,
380
+  0x000C, 0x000C, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
381
+  // 'Q'
382
+  0x0000, 0x07E0, 0x1FF8, 0x381C, 0x700E, 0x6006, 0xE003, 0xC003,
383
+  0xC003, 0xC003, 0xC003, 0xC003, 0xE007, 0x6306, 0x3F0E, 0x3C1C,
384
+  0x3FF8, 0xF7E0, 0xC000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
385
+  // 'R'
386
+  0x0000, 0x0FFE, 0x1FFE, 0x3806, 0x3006, 0x3006, 0x3006, 0x3806,
387
+  0x1FFE, 0x07FE, 0x0306, 0x0606, 0x0C06, 0x1806, 0x1806, 0x3006,
388
+  0x3006, 0x6006, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
389
+  // 'S'
390
+  0x0000, 0x03E0, 0x0FF8, 0x0C1C, 0x180C, 0x180C, 0x000C, 0x001C,
391
+  0x03F8, 0x0FE0, 0x1E00, 0x3800, 0x3006, 0x3006, 0x300E, 0x1C1C,
392
+  0x0FF8, 0x07E0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
393
+  // 'T'
394
+  0x0000, 0x7FFE, 0x7FFE, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180,
395
+  0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180,
396
+  0x0180, 0x0180, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
397
+  // 'U'
398
+  0x0000, 0x300C, 0x300C, 0x300C, 0x300C, 0x300C, 0x300C, 0x300C,
399
+  0x300C, 0x300C, 0x300C, 0x300C, 0x300C, 0x300C, 0x300C, 0x1818,
400
+  0x1FF8, 0x07E0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
401
+  // 'V'
402
+  0x0000, 0x6003, 0x3006, 0x3006, 0x3006, 0x180C, 0x180C, 0x180C,
403
+  0x0C18, 0x0C18, 0x0E38, 0x0630, 0x0630, 0x0770, 0x0360, 0x0360,
404
+  0x01C0, 0x01C0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
405
+  // 'W'
406
+  0x0000, 0x6003, 0x61C3, 0x61C3, 0x61C3, 0x3366, 0x3366, 0x3366,
407
+  0x3366, 0x3366, 0x3366, 0x1B6C, 0x1B6C, 0x1B6C, 0x1A2C, 0x1E3C,
408
+  0x0E38, 0x0E38, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
409
+  // 'X'
410
+  0x0000, 0xE00F, 0x700C, 0x3018, 0x1830, 0x0C70, 0x0E60, 0x07C0,
411
+  0x0380, 0x0380, 0x03C0, 0x06E0, 0x0C70, 0x1C30, 0x1818, 0x300C,
412
+  0x600E, 0xE007, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
413
+  // 'Y'
414
+  0x0000, 0xC003, 0x6006, 0x300C, 0x381C, 0x1838, 0x0C30, 0x0660,
415
+  0x07E0, 0x03C0, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180,
416
+  0x0180, 0x0180, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
417
+  // 'Z'
418
+  0x0000, 0x7FFC, 0x7FFC, 0x6000, 0x3000, 0x1800, 0x0C00, 0x0600,
419
+  0x0300, 0x0180, 0x00C0, 0x0060, 0x0030, 0x0018, 0x000C, 0x0006,
420
+  0x7FFE, 0x7FFE, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
421
+  // '['
422
+  0x0000, 0x03E0, 0x03E0, 0x0060, 0x0060, 0x0060, 0x0060, 0x0060,
423
+  0x0060, 0x0060, 0x0060, 0x0060, 0x0060, 0x0060, 0x0060, 0x0060,
424
+  0x0060, 0x0060, 0x0060, 0x0060, 0x0060, 0x03E0, 0x03E0, 0x0000,
425
+  // '\'
426
+  0x0000, 0x0030, 0x0030, 0x0060, 0x0060, 0x0060, 0x00C0, 0x00C0,
427
+  0x00C0, 0x01C0, 0x0180, 0x0180, 0x0180, 0x0300, 0x0300, 0x0300,
428
+  0x0600, 0x0600, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
429
+  // ']'
430
+  0x0000, 0x03E0, 0x03E0, 0x0300, 0x0300, 0x0300, 0x0300, 0x0300,
431
+  0x0300, 0x0300, 0x0300, 0x0300, 0x0300, 0x0300, 0x0300, 0x0300,
432
+  0x0300, 0x0300, 0x0300, 0x0300, 0x0300, 0x03E0, 0x03E0, 0x0000,
433
+  // '^'
434
+  0x0000, 0x0000, 0x01C0, 0x01C0, 0x0360, 0x0360, 0x0360, 0x0630,
435
+  0x0630, 0x0C18, 0x0C18, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
436
+  0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
437
+  // '_'
438
+  0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
439
+  0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
440
+  0x0000, 0xFFFF, 0xFFFF, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
441
+  // '''
442
+  0x0000, 0x000C, 0x000C, 0x000C, 0x000C, 0x000C, 0x000C, 0x0000,
443
+  0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
444
+  0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
445
+  // 'a'
446
+  0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x03F0, 0x07F8,
447
+  0x0C1C, 0x0C0C, 0x0F00, 0x0FF0, 0x0CF8, 0x0C0C, 0x0C0C, 0x0F1C,
448
+  0x0FF8, 0x18F0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
449
+  // 'b'
450
+  0x0000, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018, 0x03D8, 0x0FF8,
451
+  0x0C38, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x0C38,
452
+  0x0FF8, 0x03D8, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
453
+  // 'c'
454
+  0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x03C0, 0x07F0,
455
+  0x0E30, 0x0C18, 0x0018, 0x0018, 0x0018, 0x0018, 0x0C18, 0x0E30,
456
+  0x07F0, 0x03C0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
457
+  // 'd'
458
+  0x0000, 0x1800, 0x1800, 0x1800, 0x1800, 0x1800, 0x1BC0, 0x1FF0,
459
+  0x1C30, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x1C30,
460
+  0x1FF0, 0x1BC0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
461
+  // 'e'
462
+  0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x03C0, 0x0FF0,
463
+  0x0C30, 0x1818, 0x1FF8, 0x1FF8, 0x0018, 0x0018, 0x1838, 0x1C30,
464
+  0x0FF0, 0x07C0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
465
+  // 'f'
466
+  0x0000, 0x0F80, 0x0FC0, 0x00C0, 0x00C0, 0x00C0, 0x07F0, 0x07F0,
467
+  0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0,
468
+  0x00C0, 0x00C0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
469
+  // 'g'
470
+  0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0DE0, 0x0FF8,
471
+  0x0E18, 0x0C0C, 0x0C0C, 0x0C0C, 0x0C0C, 0x0C0C, 0x0C0C, 0x0E18,
472
+  0x0FF8, 0x0DE0, 0x0C00, 0x0C0C, 0x061C, 0x07F8, 0x01F0, 0x0000,
473
+  // 'h'
474
+  0x0000, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018, 0x07D8, 0x0FF8,
475
+  0x1C38, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818,
476
+  0x1818, 0x1818, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
477
+  // 'i'
478
+  0x0000, 0x00C0, 0x00C0, 0x0000, 0x0000, 0x0000, 0x00C0, 0x00C0,
479
+  0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0,
480
+  0x00C0, 0x00C0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
481
+  // 'j'
482
+  0x0000, 0x00C0, 0x00C0, 0x0000, 0x0000, 0x0000, 0x00C0, 0x00C0,
483
+  0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0,
484
+  0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00F8, 0x0078, 0x0000,
485
+  // 'k'
486
+  0x0000, 0x000C, 0x000C, 0x000C, 0x000C, 0x000C, 0x0C0C, 0x060C,
487
+  0x030C, 0x018C, 0x00CC, 0x006C, 0x00FC, 0x019C, 0x038C, 0x030C,
488
+  0x060C, 0x0C0C, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
489
+  // 'l'
490
+  0x0000, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0,
491
+  0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0,
492
+  0x00C0, 0x00C0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
493
+  // 'm'
494
+  0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3C7C, 0x7EFF,
495
+  0xE3C7, 0xC183, 0xC183, 0xC183, 0xC183, 0xC183, 0xC183, 0xC183,
496
+  0xC183, 0xC183, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
497
+  // 'n'
498
+  0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0798, 0x0FF8,
499
+  0x1C38, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818,
500
+  0x1818, 0x1818, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
501
+  // 'o'
502
+  0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x03C0, 0x0FF0,
503
+  0x0C30, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x0C30,
504
+  0x0FF0, 0x03C0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
505
+  // 'p'
506
+  0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x03D8, 0x0FF8,
507
+  0x0C38, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x0C38,
508
+  0x0FF8, 0x03D8, 0x0018, 0x0018, 0x0018, 0x0018, 0x0018, 0x0000,
509
+  // 'q'
510
+  0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x1BC0, 0x1FF0,
511
+  0x1C30, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x1C30,
512
+  0x1FF0, 0x1BC0, 0x1800, 0x1800, 0x1800, 0x1800, 0x1800, 0x0000,
513
+  // 'r'
514
+  0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x07B0, 0x03F0,
515
+  0x0070, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030,
516
+  0x0030, 0x0030, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
517
+  // 's'
518
+  0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x03E0, 0x03F0,
519
+  0x0E38, 0x0C18, 0x0038, 0x03F0, 0x07C0, 0x0C00, 0x0C18, 0x0E38,
520
+  0x07F0, 0x03E0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
521
+  // 't'
522
+  0x0000, 0x0000, 0x0080, 0x00C0, 0x00C0, 0x00C0, 0x07F0, 0x07F0,
523
+  0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0,
524
+  0x07C0, 0x0780, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
525
+  // 'u'
526
+  0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x1818, 0x1818,
527
+  0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x1818, 0x1C38,
528
+  0x1FF0, 0x19E0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
529
+  // 'v'
530
+  0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x180C, 0x0C18,
531
+  0x0C18, 0x0C18, 0x0630, 0x0630, 0x0630, 0x0360, 0x0360, 0x0360,
532
+  0x01C0, 0x01C0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
533
+  // 'w'
534
+  0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x41C1, 0x41C1,
535
+  0x61C3, 0x6363, 0x6363, 0x6363, 0x3636, 0x3636, 0x3636, 0x1C1C,
536
+  0x1C1C, 0x1C1C, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
537
+  // 'x'
538
+  0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x381C, 0x1C38,
539
+  0x0C30, 0x0660, 0x0360, 0x0360, 0x0360, 0x0360, 0x0660, 0x0C30,
540
+  0x1C38, 0x381C, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
541
+  // 'y'
542
+  0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3018, 0x1830,
543
+  0x1830, 0x1870, 0x0C60, 0x0C60, 0x0CE0, 0x06C0, 0x06C0, 0x0380,
544
+  0x0380, 0x0380, 0x0180, 0x0180, 0x01C0, 0x00F0, 0x0070, 0x0000,
545
+  // 'z'
546
+  0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x1FFC, 0x1FFC,
547
+  0x0C00, 0x0600, 0x0300, 0x0180, 0x00C0, 0x0060, 0x0030, 0x0018,
548
+  0x1FFC, 0x1FFC, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
549
+  // '{'
550
+  0x0000, 0x0300, 0x0180, 0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x00C0,
551
+  0x00C0, 0x0060, 0x0060, 0x0030, 0x0060, 0x0040, 0x00C0, 0x00C0,
552
+  0x00C0, 0x00C0, 0x00C0, 0x00C0, 0x0180, 0x0300, 0x0000, 0x0000,
553
+  // '|'
554
+  0x0000, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180,
555
+  0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180,
556
+  0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0180, 0x0000,
557
+  // '}'
558
+  0x0000, 0x0060, 0x00C0, 0x01C0, 0x0180, 0x0180, 0x0180, 0x0180,
559
+  0x0180, 0x0300, 0x0300, 0x0600, 0x0300, 0x0100, 0x0180, 0x0180,
560
+  0x0180, 0x0180, 0x0180, 0x0180, 0x00C0, 0x0060, 0x0000, 0x0000,
561
+  // '~'
562
+  0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
563
+  0x10F0, 0x1FF8, 0x0F08, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
564
+  0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
565
+};
566
+
567
+void disp_char_1624(uint16_t x, uint16_t y, uint8_t c, uint16_t charColor, uint16_t bkColor) {
568
+  for (uint16_t i = 0; i < 24; i++) {
569
+    const uint16_t tmp_char = pgm_read_word(&ASCII_Table_16x24[((c - 0x20) * 24) + i]);
570
+    for (uint16_t j = 0; j < 16; j++)
571
+      tft_set_point(x + j, y + i, ((tmp_char >> j) & 0x01) ? charColor : bkColor);
572
+  }
573
+}
574
+
575
+void disp_string(uint16_t x, uint16_t y, const char * string, uint16_t charColor, uint16_t bkColor) {
576
+  while (*string != '\0') {
577
+    disp_char_1624(x, y, *string, charColor, bkColor);
578
+    string++;
579
+    x += 16;
580
+  }
581
+}
582
+
583
+//static lv_obj_t * scr_test;
584
+void disp_pic_update() {
585
+  LCD_Clear(0x0000);
586
+  disp_string(120, 150, "PIC Updating...", 0xFFFF, 0x0000);
587
+}
588
+
589
+void disp_font_update() {
590
+  LCD_Clear(0x0000);
591
+  disp_string(120, 150, "FONT Updating...", 0xFFFF, 0x0000);
592
+}
593
+
594
+#endif // TFT_LITTLE_VGL_UI

+ 31
- 0
Marlin/src/lcd/extui/lib/mks_ui/mks_hardware_test.h View File

@@ -0,0 +1,31 @@
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 <http://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+#pragma once
23
+
24
+#include "lvgl.h"
25
+
26
+void Test_GPIO();
27
+void disp_char_1624(uint16_t x, uint16_t y, uint8_t c, uint16_t charColor, uint16_t bkColor);
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();

+ 736
- 0
Marlin/src/lcd/extui/lib/mks_ui/pic_manager.cpp View File

@@ -0,0 +1,736 @@
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 <http://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+#include "../../../../inc/MarlinConfigPre.h"
23
+
24
+#if ENABLED(TFT_LITTLE_VGL_UI)
25
+
26
+#include "../../../../MarlinCore.h"
27
+
28
+//#include "type_define.h"
29
+#include "string.h"
30
+
31
+#include "pic_manager.h"
32
+#include "W25Qxx.h"
33
+#include "../../../../sd/cardreader.h"
34
+#include "draw_ready_print.h"
35
+#include "mks_hardware_test.h"
36
+
37
+//#include "gui.h"
38
+//#include "spi_flash.h"
39
+
40
+//uint8_t DMA_ERRO_FLAG;
41
+extern uint16_t DeviceCode;
42
+extern unsigned char bmp_public_buf[17 * 1024];
43
+
44
+#if ENABLED(SDSUPPORT)
45
+  extern char *createFilename(char * const buffer, const dir_t &p);
46
+#endif
47
+
48
+/*void SPI_FLASH_BufferRead(uint8_t* pBuffer, uint32_t ReadAddr, uint16_t NumByteToRead) {}*/
49
+
50
+uint32_t lv_get_pic_addr(uint8_t *Pname) {
51
+  uint8_t Pic_cnt;
52
+  uint8_t i, j;
53
+  PIC_MSG PIC;
54
+  uint32_t tmp_cnt = 0;
55
+  uint32_t addr = 0;
56
+
57
+  W25QXX.init(SPI_QUARTER_SPEED);
58
+
59
+  W25QXX.SPI_FLASH_BufferRead(&Pic_cnt, PIC_COUNTER_ADDR, 1);
60
+  if (Pic_cnt == 0xff)
61
+    Pic_cnt = 0;
62
+  for (i = 0; i < Pic_cnt; i++) {
63
+    j = 0;
64
+    do
65
+    {
66
+      W25QXX.SPI_FLASH_BufferRead(&PIC.name[j], PIC_NAME_ADDR + tmp_cnt, 1);
67
+      tmp_cnt++;
68
+    }while (PIC.name[j++] != '\0');
69
+
70
+    if ((strcmp((char*)Pname, (char*)PIC.name)) == 0) {
71
+
72
+      if ((DeviceCode == 0x9488) || (DeviceCode == 0x5761))
73
+        addr = PIC_DATA_ADDR_TFT35 + i * PER_PIC_MAX_SPACE_TFT35;
74
+      else
75
+        addr = PIC_DATA_ADDR_TFT32 + i * PER_PIC_MAX_SPACE_TFT32;
76
+      return (addr + 4);//The purpose of adding 4 is to remove 4-byte picture header information.
77
+    }
78
+  }
79
+
80
+  return addr;
81
+}
82
+
83
+const char *picPath = "mks_pic";
84
+const char *bakPath = "bak_pic";
85
+
86
+const char *fontPath = "mks_font";
87
+const char *bakFont = "bak_font";
88
+
89
+#if 1
90
+
91
+void spiFlashErase_PIC() {
92
+  #if 1
93
+    volatile uint32_t pic_sectorcnt = 0;
94
+
95
+    //LCD_Clear(BACK_COLOR);
96
+    //LCD_DisplayString(90,80,"SPI Flash");
97
+    //LCD_DisplayString(120,90,"PIC Erasing...");
98
+    if ((DeviceCode == 0x9488) || (DeviceCode == 0x5761)) {
99
+      //LCD_ShowString(180,100,200,24,24,"SPI Flash");
100
+      //LCD_ShowString(170,130,200,24,24,"PIC Erasing...");
101
+    }
102
+    else {
103
+      //LCD_ShowString(100,90,200,24,24,"SPI Flash");
104
+      //LCD_ShowString(100,120,200,24,24,"PIC Erasing...");
105
+    }
106
+    #if ENABLED(MKS_TEST)
107
+      for (pic_sectorcnt = 0; pic_sectorcnt < 2; pic_sectorcnt++)
108
+        W25QXX.SPI_FLASH_BlockErase(PICINFOADDR + pic_sectorcnt * 64 * 1024);
109
+
110
+    #else
111
+      for (pic_sectorcnt = 0; pic_sectorcnt < PIC_SIZE_xM * 1024 / 64; pic_sectorcnt++)
112
+        W25QXX.SPI_FLASH_BlockErase(PICINFOADDR + pic_sectorcnt * 64 * 1024);
113
+
114
+    #endif
115
+    /*
116
+    FLASH_Unlock();
117
+    spiFlashEraseFlag = SPI_FLASH_ERASE_FLAG_DATA;
118
+    FLASH_ProgramHalfWord(SPI_FLASH_ERASE_FLAG_ADDR,spiFlashEraseFlag);
119
+    FLASH_Lock();
120
+    */
121
+    #if 0
122
+      if (DeviceCode == 0x9488)
123
+        LCD_ShowString(170, 130, 200, 24, 24, "PIC Erase Done");
124
+      else
125
+        LCD_ShowString(100, 120, 200, 24, 24, "PIC Erase Done");
126
+
127
+    #endif
128
+    //spiFlashEraseFlag = 1;
129
+  #endif
130
+}
131
+
132
+void spiFlashErase_FONT() {
133
+  volatile uint32_t Font_sectorcnt = 0;
134
+
135
+  //LCD_Clear(BACK_COLOR);
136
+  if ((DeviceCode == 0x9488) || (DeviceCode == 0x5761)) {
137
+    //LCD_ShowString(180,100,200,24,24,"SPI Flash");
138
+    //LCD_ShowString(170,130,200,24,24,"FONT Erasing...");
139
+  }
140
+  else {
141
+    //LCD_ShowString(100,90,200,24,24,"SPI Flash");
142
+    //LCD_ShowString(90,120,200,24,24,"FONT Erasing...");
143
+  }
144
+
145
+  for (Font_sectorcnt = 0; Font_sectorcnt < FONT_SIZE_xM * 1024 / 64; Font_sectorcnt++)
146
+    W25QXX.SPI_FLASH_BlockErase(FONTINFOADDR + Font_sectorcnt * 64 * 1024);
147
+
148
+  /*
149
+  FLASH_Unlock();
150
+  spiFlashEraseFlag = SPI_FLASH_ERASE_FLAG_DATA;
151
+  FLASH_ProgramHalfWord(SPI_FLASH_ERASE_FLAG_ADDR,spiFlashEraseFlag);
152
+  FLASH_Lock();
153
+  */
154
+  #if 0
155
+    if (DeviceCode == 0x9488)
156
+      LCD_ShowString(170, 130, 200, 24, 24, "FONT Erase Done");
157
+    else
158
+      LCD_ShowString(90, 120, 200, 24, 24, "FONT Erase Done");
159
+    //LCD_DisplayString(120,90,"FONT Erase Done");
160
+  #endif
161
+  //spiFlashEraseFlag = 1;
162
+}
163
+
164
+uint32_t LogoWrite_Addroffset = 0;
165
+
166
+uint8_t Pic_Logo_Write(uint8_t *LogoName, uint8_t *Logo_Wbuff, uint32_t LogoWriteSize) {
167
+  //uint16_t n;
168
+  uint32_t i;
169
+  uint8_t temp1;
170
+  static uint32_t logo_maxsize;
171
+
172
+  if (LogoWriteSize <= 0) return 0;
173
+
174
+  W25QXX.SPI_FLASH_BufferWrite(Logo_Wbuff, PIC_LOGO_ADDR + LogoWrite_Addroffset, LogoWriteSize);
175
+
176
+  for (i = 0; i < LogoWriteSize; i++) {
177
+    W25QXX.SPI_FLASH_BufferRead(&temp1, PIC_LOGO_ADDR + LogoWrite_Addroffset + i, 1);
178
+    if (*(Logo_Wbuff + i) != temp1) return 0;
179
+  }
180
+  LogoWrite_Addroffset += LogoWriteSize;
181
+  if ((DeviceCode == 0x9488) || (DeviceCode == 0x5761))
182
+    logo_maxsize = LOGO_MAX_SIZE_TFT35;
183
+  else
184
+    logo_maxsize = LOGO_MAX_SIZE_TFT32;
185
+  if (LogoWrite_Addroffset >= logo_maxsize)
186
+    LogoWrite_Addroffset = 0;
187
+  return 1;
188
+}
189
+
190
+uint32_t TitleLogoWrite_Addroffset = 0;
191
+uint8_t Pic_TitleLogo_Write(uint8_t *TitleLogoName, uint8_t *TitleLogo_Wbuff, uint32_t TitleLogoWriteSize) {
192
+  //uint32_t i;
193
+  //uint8_t temp1;
194
+  if (TitleLogoWriteSize <= 0)
195
+    return 0;
196
+  if ((DeviceCode == 0x9488) || (DeviceCode == 0x5761))
197
+    W25QXX.SPI_FLASH_BufferWrite(TitleLogo_Wbuff, PIC_ICON_LOGO_ADDR_TFT35 + TitleLogoWrite_Addroffset, TitleLogoWriteSize);
198
+  else
199
+    W25QXX.SPI_FLASH_BufferWrite(TitleLogo_Wbuff, PIC_ICON_LOGO_ADDR_TFT32 + TitleLogoWrite_Addroffset, TitleLogoWriteSize);
200
+  TitleLogoWrite_Addroffset += TitleLogoWriteSize;
201
+  if (TitleLogoWrite_Addroffset >= TITLELOGO_MAX_SIZE)
202
+    TitleLogoWrite_Addroffset = 0;
203
+  return 1;
204
+}
205
+
206
+uint32_t default_view_addroffset_r = 0;
207
+void default_view_Write(uint8_t *default_view__Rbuff, uint32_t default_view_Writesize) {
208
+  W25QXX.SPI_FLASH_BufferWrite(default_view__Rbuff, DEFAULT_VIEW_ADDR_TFT35 + default_view_addroffset_r, default_view_Writesize);
209
+  default_view_addroffset_r += default_view_Writesize;
210
+  if (default_view_addroffset_r >= DEFAULT_VIEW_MAX_SIZE)
211
+    default_view_addroffset_r = 0;
212
+}
213
+
214
+uint32_t Pic_Info_Write(uint8_t *P_name, uint32_t P_size) {
215
+  uint8_t pic_counter = 0;
216
+  uint32_t Pic_SaveAddr;
217
+  uint32_t Pic_SizeSaveAddr;
218
+  uint32_t Pic_NameSaveAddr;
219
+  //uint8_t temp;
220
+  uint8_t Pname_temp;
221
+  uint32_t i, j;
222
+  uint32_t name_len = 0;
223
+  uint32_t SaveName_len = 0;
224
+  union union32 size_tmp;
225
+  //union union32 size1;
226
+  //uint8_t Pn[PIC_NAME_MAX_LEN];
227
+  //uint8_t cnt_temp;
228
+  //uint16_t n0;
229
+  //uint32_t Name_saveAddr = 0;
230
+  //uint8_t pic_position;
231
+
232
+  W25QXX.SPI_FLASH_BufferRead(&pic_counter, PIC_COUNTER_ADDR, 1);
233
+
234
+  if (pic_counter == 0xFF)
235
+    pic_counter = 0;
236
+
237
+  if ((DeviceCode == 0x9488) || (DeviceCode == 0x5761))
238
+    Pic_SaveAddr = PIC_DATA_ADDR_TFT35 + pic_counter * PER_PIC_MAX_SPACE_TFT35;
239
+  else
240
+    Pic_SaveAddr = PIC_DATA_ADDR_TFT32 + pic_counter * PER_PIC_MAX_SPACE_TFT32;
241
+
242
+  for (j = 0; j < pic_counter; j++) {
243
+    do {
244
+      W25QXX.SPI_FLASH_BufferRead(&Pname_temp, PIC_NAME_ADDR + SaveName_len, 1);
245
+      SaveName_len++;
246
+    } while (Pname_temp != '\0');
247
+  }
248
+  i = 0;
249
+  while ((*(P_name + i) != '\0')) {
250
+    i++;
251
+    name_len++;
252
+  }
253
+
254
+  Pic_NameSaveAddr = PIC_NAME_ADDR + SaveName_len;
255
+  W25QXX.SPI_FLASH_BufferWrite(P_name, Pic_NameSaveAddr, name_len + 1);
256
+  Pic_SizeSaveAddr = PIC_SIZE_ADDR + 4 * pic_counter;
257
+  size_tmp.dwords = P_size;
258
+  W25QXX.SPI_FLASH_BufferWrite(size_tmp.bytes, Pic_SizeSaveAddr, 4);
259
+
260
+  pic_counter++;
261
+  W25QXX.SPI_FLASH_SectorErase(PIC_COUNTER_ADDR);
262
+  W25QXX.SPI_FLASH_BufferWrite(&pic_counter, PIC_COUNTER_ADDR, 1);
263
+
264
+  return Pic_SaveAddr;
265
+}
266
+
267
+uint8_t public_buf[512];
268
+
269
+//uint8_t public_buf_test[512];
270
+  #if ENABLED(SDSUPPORT)
271
+void UpdatePic() {
272
+  //int r;
273
+  //unsigned char *p;
274
+  //char rootPath[10]={0};
275
+  char *fn;
276
+  unsigned char logoFlag;
277
+  uint16_t pbr;
278
+  uint32_t pfileSize;
279
+  uint32_t Pic_Write_Addr;
280
+  /*----------------------------------*/
281
+
282
+  // FILINFO fno;
283
+  //DIR dir;
284
+  //char tmp[30];
285
+  #if 0//_USE_LFN
286
+    static char lfn[_MAX_LFN + 1];
287
+    finfo.lfname = lfn;
288
+    finfo.lfsize = sizeof(lfn);
289
+  #endif
290
+  //SdFile curDir;
291
+  //if (f_opendir(&dirs, picPath) == FR_OK)
292
+  //card.cd(picPath);
293
+
294
+  //const uint16_t fileCnt = card.get_num_Files();
295
+
296
+  //SdFile *curDir;
297
+  //SdFile dir;
298
+  //dir.open(picPath, O_READ);
299
+  //const char * const fname = card.diveToFile(true, curDir, picPath);
300
+  //if (!fname) return;
301
+
302
+  SdFile dir, root = card.getroot();
303
+  if (dir.open(&root, picPath, O_RDONLY)) {
304
+
305
+    disp_pic_update();
306
+    spiFlashErase_PIC();
307
+
308
+    dir_t d;
309
+    while (dir.readDir(&d, card.longFilename) > 0) {
310
+      #if 1
311
+        /*
312
+        if (power_det == 0) {
313
+          PW_DET_ON;
314
+          power_det=0;
315
+        }
316
+        SPI_FLASH_Init();
317
+        */
318
+
319
+        //for (uint16_t i = 0; i < fileCnt; i++) {
320
+        //res = f_readdir(&dirs, &finfo);
321
+        //card.getfilename_sorted(i);
322
+
323
+        if (card.longFilename[0] == 0)
324
+          break;
325
+        /*if ( card.filename[0] == '.')
326
+        continue;
327
+      */
328
+        if (card.longFilename[0] == '.')
329
+          continue;
330
+
331
+        fn = card.longFilename;
332
+
333
+        /*if ((finfo.lfname[0] == 0) || (finfo.lfname == 0))
334
+          fn = finfo.fname;
335
+        else
336
+          fn = finfo.lfname;*/
337
+
338
+        /*   if (fno.fattrib & AM_DIR)
339
+        {
340
+          continue;
341
+        }
342
+        else */
343
+        //{
344
+        //if ((strstr(fn, ".gco")) || (strstr(fn, ".GCO")) || (fno.fattrib & AM_DIR))
345
+        if (strstr(fn, ".bin")) {
346
+          if (strstr(fn, "_logo"))
347
+            logoFlag = 1;
348
+          else if (strstr(fn, "_titlelogo"))
349
+            logoFlag = 2;
350
+          else if (strstr(fn, "_preview"))
351
+            logoFlag = 3;
352
+          else
353
+            logoFlag = 0;
354
+
355
+          //public_buf[0] = '\0';
356
+          //strcat(public_buf, picPath);
357
+          //strcat(public_buf, "/");
358
+          char dosFilename[FILENAME_LENGTH];
359
+          createFilename(dosFilename, d);
360
+          //strcat(public_buf, dosFilename);
361
+
362
+          SdFile file;
363
+          if (file.open(&dir, dosFilename, O_READ)) {
364
+            #if 1
365
+            /*LCD_Clear(BACK_COLOR);
366
+
367
+            if ((DeviceCode==0x9488)||(DeviceCode==0x5761)) {
368
+              LCD_ShowString(170,100,200,24,24,(u8 *)fn);
369
+              LCD_ShowString(180,130,200,24,24,"Updating...");
370
+            }
371
+            else {
372
+              LCD_ShowString(90,90,200,24,24,(u8 *)fn);
373
+              LCD_ShowString(90,120,200,24,24,"Updating...");
374
+            }
375
+            */
376
+            if (logoFlag == 1) {
377
+              while (1) {
378
+                pbr = file.read(public_buf, BMP_WRITE_BUF_LEN);
379
+                Pic_Logo_Write((uint8_t *)fn, public_buf, pbr); //
380
+                if (pbr < BMP_WRITE_BUF_LEN) break;
381
+              }
382
+            }
383
+            else if (logoFlag == 2) {
384
+              while (1) {
385
+                pbr = file.read(public_buf, BMP_WRITE_BUF_LEN);
386
+                Pic_TitleLogo_Write((uint8_t *)fn, public_buf, pbr); //
387
+                if (pbr < BMP_WRITE_BUF_LEN) break;
388
+              }
389
+            }
390
+            else if (logoFlag == 3) {
391
+              while (1)
392
+              {
393
+                pbr = file.read(public_buf, BMP_WRITE_BUF_LEN);
394
+                default_view_Write(public_buf, pbr); //
395
+                if (pbr < BMP_WRITE_BUF_LEN) break;
396
+              }
397
+            }
398
+            else {
399
+              pfileSize = file.fileSize();
400
+              Pic_Write_Addr = Pic_Info_Write((uint8_t *)fn, pfileSize);
401
+              //uint32_t addr_test = Pic_Write_Addr;
402
+              //memset(bmp_public_buf, 0xff, BMP_WRITE_BUF_LEN);
403
+              while (1)
404
+              {
405
+                pbr = file.read(public_buf, BMP_WRITE_BUF_LEN);
406
+                W25QXX.SPI_FLASH_BufferWrite(public_buf, Pic_Write_Addr, pbr);
407
+                Pic_Write_Addr += pbr;
408
+                if (pbr < BMP_WRITE_BUF_LEN) break;
409
+              }
410
+              //W25QXX.SPI_FLASH_BufferRead(public_buf_test,addr_test,BMP_WRITE_BUF_LEN);
411
+            }
412
+
413
+            /*--------------read test--------------------*/
414
+            /*
415
+            BufferSet(picBuffer, 0xff, PICTURE_MAX_SIZE);
416
+            if (logoFlag == 0)
417
+            {
418
+              PicMsg_Init();
419
+              Pic_Read(fn,picBuffer);
420
+            }
421
+            else
422
+              Pic_Logo_Read(fn,picBuffer,PICTURE_MAX_SIZE);
423
+            */
424
+            /*--------------read test--------------------*/
425
+
426
+            file.close();
427
+            #endif
428
+          }
429
+
430
+        }
431
+        //}
432
+        //}
433
+        /*
434
+            LCD_Clear(LCD_COLOR_BLACK);
435
+            //LCD_ShowString(110,100,200,24,24,"Complete");
436
+            LCD_DisplayString(110,80,"Complete");
437
+            delay(0xfffff);
438
+        */
439
+        //r = f_chdir("/");
440
+        #if 1
441
+          //SdFile dir, root = card.getroot();
442
+          /*if (dir.open(&root, bakPath, O_RDONLY))
443
+      {
444
+        dir.remove();
445
+      }*/
446
+
447
+          //r = f_rename(picPath, bakPath);
448
+
449
+
450
+          //update_flag_ok = 1;
451
+        #endif
452
+      #endif
453
+    }
454
+    dir.rename(&root, bakPath);
455
+  }
456
+}
457
+
458
+
459
+void spi_flash_read_test() {W25QXX.SPI_FLASH_BufferRead(public_buf, UNIGBK_FLASH_ADDR, BMP_WRITE_BUF_LEN);}
460
+
461
+void UpdateFont() {
462
+  //int r;
463
+  //unsigned char *p;
464
+  //char rootPath[10]={0};
465
+  char *fn;
466
+  //unsigned char logoFlag;
467
+  uint16_t pbr;
468
+  uint32_t flashaddr = 0;
469
+  //uint32_t pfileSize;
470
+  //uint32_t Pic_Write_Addr;
471
+  /*----------------------------------*/
472
+
473
+  // FILINFO fno;
474
+  //DIR dir;
475
+  //char tmp[30];
476
+  #if 0//_USE_LFN
477
+    static char lfn[_MAX_LFN + 1];
478
+    finfo.lfname = lfn;
479
+    finfo.lfsize = sizeof(lfn);
480
+  #endif
481
+  //SdFile curDir;
482
+  //if (f_opendir(&dirs, picPath) == FR_OK)
483
+  //card.cd(picPath);
484
+
485
+  //const uint16_t fileCnt = card.get_num_Files();
486
+
487
+  //SdFile *curDir;
488
+  //SdFile dir;
489
+  //dir.open(picPath, O_READ);
490
+  //const char * const fname = card.diveToFile(true, curDir, picPath);
491
+  //if (!fname) return;
492
+
493
+  SdFile dir, root = card.getroot();
494
+  if (dir.open(&root, fontPath, O_RDONLY)) {
495
+
496
+    disp_font_update();
497
+    spiFlashErase_FONT();
498
+
499
+    dir_t d;
500
+    while (dir.readDir(&d, card.longFilename) > 0)
501
+    {
502
+      #if 1
503
+        /*if (power_det == 0)
504
+        {
505
+          PW_DET_ON;
506
+          power_det=0;
507
+        }
508
+        SPI_FLASH_Init();*/
509
+
510
+
511
+        //for (uint16_t i = 0; i < fileCnt; i++)
512
+        //{
513
+        //res = f_readdir(&dirs, &finfo);
514
+        //card.getfilename_sorted(i);
515
+
516
+        if (card.longFilename[0] == 0)
517
+          break;
518
+        /*if ( card.filename[0] == '.')
519
+        continue;
520
+      */
521
+        if (card.longFilename[0] == '.')
522
+          continue;
523
+
524
+        fn = card.longFilename;
525
+
526
+        /*if ((finfo.lfname[0] == 0) || (finfo.lfname == 0))
527
+          fn = finfo.fname;
528
+        else
529
+          fn = finfo.lfname;*/
530
+
531
+        /*   if (fno.fattrib & AM_DIR)
532
+        {
533
+        continue;
534
+        }
535
+        else */
536
+        //{
537
+        //if ((strstr(fn, ".gco")) || (strstr(fn, ".GCO")) || (fno.fattrib & AM_DIR))
538
+        if (strstr(fn, ".bin")) {
539
+          char dosFilename[FILENAME_LENGTH];
540
+          createFilename(dosFilename, d);
541
+          //strcat(public_buf, dosFilename);
542
+
543
+          SdFile file;
544
+          if (file.open(&dir, dosFilename, O_READ)) {
545
+
546
+            #if 1
547
+              /*LCD_Clear(BACK_COLOR);
548
+
549
+              if ((DeviceCode==0x9488)||(DeviceCode==0x5761))
550
+              {
551
+                LCD_ShowString(170,100,200,24,24,(u8 *)fn);
552
+                LCD_ShowString(180,130,200,24,24,"Updating...");
553
+              }
554
+              else
555
+              {
556
+                LCD_ShowString(90,90,200,24,24,(u8 *)fn);
557
+                LCD_ShowString(90,120,200,24,24,"Updating...");
558
+              }
559
+              */
560
+              flashaddr = UNIGBK_FLASH_ADDR;
561
+              pbr = 0;
562
+              while (1)
563
+              {
564
+                flashaddr += pbr;
565
+                pbr = file.read(public_buf, BMP_WRITE_BUF_LEN);
566
+                W25QXX.SPI_FLASH_BufferWrite(public_buf, flashaddr, pbr);
567
+                //W25QXX.SPI_FLASH_BufferRead(public_buf_test,flashaddr,pbr);
568
+                /*if (UNIGBKFlag == 1)
569
+                {
570
+                  fontrate = (uint16_t)(((float)(flashaddr - UNIGBK_FLASH_ADDR)/(float)(psrc.fsize))*100);
571
+                }
572
+                else
573
+                {
574
+                  fontrate = (uint16_t)(((float)(flashaddr - GBK_FLASH_ADDR)/(float)(psrc.fsize))*100);
575
+                }
576
+
577
+                if (fontrate > 99) fontrate=99;
578
+
579
+                if (fontrate < 10)
580
+                {
581
+                  fontString[0] = fontrate%10 + 0x30;
582
+                  fontString[1] = '%';
583
+                  fontString[2] = '\0';
584
+                }
585
+                else
586
+                {
587
+                  fontString[0] = fontrate/10 + 0x30;
588
+                  fontString[1] = fontrate%10 + 0x30;
589
+                  fontString[2] = '%';
590
+                  fontString[3] = '\0';
591
+                }*/
592
+                //LCD_DisplayString(140,130,fontString);
593
+                if ((DeviceCode == 0x9488) || (DeviceCode == 0x5761)) {
594
+                  //LCD_ShowString(200,160,200,24,24,fontString);
595
+                }
596
+                else {
597
+                  //LCD_ShowString(140,150,200,24,24,fontString);
598
+                }
599
+                if (pbr < BMP_WRITE_BUF_LEN) break;
600
+              }
601
+              /*--------------read test--------------------*/
602
+              /*
603
+              BufferSet(picBuffer, 0xff, PICTURE_MAX_SIZE);
604
+              if (logoFlag == 0)
605
+              {
606
+                PicMsg_Init();
607
+                Pic_Read(fn,picBuffer);
608
+              }
609
+              else
610
+                Pic_Logo_Read(fn,picBuffer,PICTURE_MAX_SIZE);
611
+              */
612
+              /*--------------read test--------------------*/
613
+
614
+              file.close();
615
+            #endif
616
+          }
617
+
618
+        }
619
+        //}
620
+        //}
621
+        /*
622
+            LCD_Clear(LCD_COLOR_BLACK);
623
+            //LCD_ShowString(110,100,200,24,24,"Complete");
624
+            LCD_DisplayString(110,80,"Complete");
625
+            delay(0xfffff);
626
+        */
627
+        //r = f_chdir("/");
628
+        #if 1
629
+          //SdFile dir, root = card.getroot();
630
+          /*if (dir.open(&root, bakPath, O_RDONLY))
631
+      {
632
+        dir.remove();
633
+      }*/
634
+          dir.rename(&root, bakFont);
635
+          //r = f_rename(picPath, bakPath);
636
+
637
+
638
+          //update_flag_ok = 1;
639
+        #endif
640
+      #endif
641
+    }
642
+  }
643
+}
644
+  #endif // SDSUPPORT
645
+
646
+#endif
647
+
648
+#if 1
649
+
650
+void Pic_Read(uint8_t *Pname, uint8_t *P_Rbuff) {
651
+  uint8_t i, j;
652
+  uint8_t Pic_cnt;
653
+  uint32_t tmp_cnt = 0;
654
+  PIC_MSG PIC;
655
+
656
+  //void SPI_FLASH_BufferRead(u8* pBuffer, u32 ReadAddr, u16 NumByteToRead);
657
+
658
+  W25QXX.SPI_FLASH_BufferRead(&Pic_cnt, PIC_COUNTER_ADDR, 1);
659
+  if (Pic_cnt == 0xff)
660
+    Pic_cnt = 0;
661
+
662
+  for (i = 0; i < Pic_cnt; i++) {
663
+    //pic name
664
+    j = 0;
665
+    do
666
+    {
667
+      W25QXX.SPI_FLASH_BufferRead(&PIC.name[j], PIC_NAME_ADDR + tmp_cnt, 1);
668
+      tmp_cnt++;
669
+    }while (PIC.name[j++] != '\0');
670
+    //pic size
671
+    W25QXX.SPI_FLASH_BufferRead(PIC.size.bytes, PIC_SIZE_ADDR + i * 4, 4);
672
+
673
+    if ((strcmp((char*)Pname, (char*)PIC.name)) == 0) {
674
+      W25QXX.SPI_FLASH_BufferRead((uint8_t *)P_Rbuff, PIC_DATA_ADDR_TFT35 + i * PER_PIC_MAX_SPACE_TFT35, PIC.size.dwords);
675
+      /*if (DMA_ERRO_FLAG)
676
+      {
677
+        DMA_ERRO_FLAG = 0;
678
+        SPI_FLASH_BufferRead((uint8_t *)P_Rbuff,PIC_DATA_ADDR+i*PER_PIC_MAX_SPACE,PIC.size.dwords);
679
+      }*/
680
+      break;
681
+    }
682
+  }
683
+}
684
+
685
+void lv_pic_test(uint8_t *P_Rbuff, uint32_t addr, uint32_t size) {
686
+  W25QXX.init(SPI_QUARTER_SPEED);
687
+  W25QXX.SPI_FLASH_BufferRead((uint8_t *)P_Rbuff, addr, size);
688
+  /*if (DMA_ERRO_FLAG) {
689
+    DMA_ERRO_FLAG = 0;
690
+    SPI_FLASH_BufferRead((uint8_t *)P_Rbuff,addr,size);
691
+  }*/
692
+
693
+}
694
+
695
+void get_spi_flash_data(const char *rec_buf, int addr, int size) {
696
+  W25QXX.init(SPI_QUARTER_SPEED);
697
+  W25QXX.SPI_FLASH_BufferRead((uint8_t *)rec_buf, UNIGBK_FLASH_ADDR + addr, size);
698
+}
699
+
700
+#endif
701
+
702
+#if 1
703
+
704
+  uint32_t logo_addroffset = 0;
705
+  void Pic_Logo_Read(uint8_t *LogoName, uint8_t *Logo_Rbuff, uint32_t LogoReadsize) {
706
+    W25QXX.SPI_FLASH_BufferRead(Logo_Rbuff, PIC_LOGO_ADDR + logo_addroffset, LogoReadsize);
707
+    logo_addroffset += LogoReadsize;
708
+    if (logo_addroffset >= LOGO_MAX_SIZE_TFT35)
709
+      logo_addroffset = 0;
710
+  }
711
+
712
+  uint32_t default_view_addroffset = 0;
713
+  void default_view_Read(uint8_t *default_view_Rbuff, uint32_t default_view_Readsize) {
714
+    W25QXX.init(SPI_QUARTER_SPEED);
715
+
716
+    W25QXX.SPI_FLASH_BufferRead(default_view_Rbuff, DEFAULT_VIEW_ADDR_TFT35 + default_view_addroffset + 4, default_view_Readsize);
717
+    default_view_addroffset += default_view_Readsize;
718
+    if (default_view_addroffset >= DEFAULT_VIEW_MAX_SIZE)
719
+      default_view_addroffset = 0;
720
+
721
+  }
722
+
723
+  uint32_t flash_view_addroffset = 0;
724
+  void flash_view_Read(uint8_t *flash_view_Rbuff, uint32_t flash_view_Readsize) {
725
+    W25QXX.init(SPI_QUARTER_SPEED);
726
+
727
+    W25QXX.SPI_FLASH_BufferRead(flash_view_Rbuff, BAK_VIEW_ADDR_TFT35 + flash_view_addroffset, flash_view_Readsize);
728
+    flash_view_addroffset += flash_view_Readsize;
729
+    if (flash_view_addroffset >= FLASH_VIEW_MAX_SIZE)
730
+      flash_view_addroffset = 0;
731
+
732
+  }
733
+
734
+#endif
735
+
736
+#endif // TFT_LITTLE_VGL_UI

+ 120
- 0
Marlin/src/lcd/extui/lib/mks_ui/pic_manager.h View File

@@ -0,0 +1,120 @@
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 <http://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+#pragma once
23
+
24
+#ifdef __cplusplus
25
+extern "C" { /* C-declarations for C++ */
26
+#endif
27
+
28
+#include <stdint.h>
29
+#include <string.h>
30
+#include "lvgl.h"
31
+
32
+#if 1
33
+
34
+  #define PIC_MAX_CN           100    // Maximum number of pictures
35
+  #define PIC_NAME_MAX_LEN      50    // Picture name maximum length
36
+
37
+  #define LOGO_MAX_SIZE_TFT35             (300*1024)
38
+  #define LOGO_MAX_SIZE_TFT32             (150*1024)
39
+  #define TITLELOGO_MAX_SIZE              (150*1024) // Little logo maximum
40
+  #define DEFAULT_VIEW_MAX_SIZE           (200*200*2)
41
+  #define FLASH_VIEW_MAX_SIZE             (200*200*2)
42
+
43
+  #define PER_PIC_MAX_SPACE_TFT35         (32*1024)
44
+  #define PER_PIC_MAX_SPACE_TFT32         (16*1024)
45
+  #define PER_FONT_MAX_SPACE              (16*1024)
46
+
47
+  //pic
48
+  //Robin_pro pic addr
49
+  #define PIC_NAME_ADDR                   0x003000      // Pic information addr
50
+  #define PIC_SIZE_ADDR                   0x007000      // Pic size information addr
51
+  #define PIC_COUNTER_ADDR                0x008000      // Pic total number
52
+  #define PER_PIC_SAVE_ADDR               0x009000      // Storage address of each picture
53
+  #define PIC_LOGO_ADDR                   0x00A000      // Logo addr
54
+  //#define PIC_DATA_ADDR                   0x02F000    //
55
+
56
+  // TFT35
57
+  #define DEFAULT_VIEW_ADDR_TFT35                         0XC5800
58
+  #define BAK_VIEW_ADDR_TFT35                                             (DEFAULT_VIEW_ADDR_TFT35+90*1024)
59
+  #define PIC_ICON_LOGO_ADDR_TFT35            (BAK_VIEW_ADDR_TFT35+80*1024)
60
+  #define PIC_DATA_ADDR_TFT35                                             (PIC_ICON_LOGO_ADDR_TFT35+350*1024)//0XC5800
61
+
62
+  // TFT32
63
+  #define PIC_DATA_ADDR_TFT32             0x02F000
64
+  #define PIC_ICON_LOGO_ADDR_TFT32        0x5D8000
65
+  #define PIC_OTHER_SIZE_ADDR_TFT32       0x5EE000
66
+
67
+  // font
68
+  #define FONTINFOADDR                    0x600000 // 6M -- font addr
69
+  #define UNIGBK_FLASH_ADDR              (FONTINFOADDR+4096) // 4*1024
70
+  #define GBK_FLASH_ADDR                 (UNIGBK_FLASH_ADDR+180224) // 176*1024
71
+
72
+  // Flash flag
73
+  #define FLASH_INF_VALID_FLAG            0xAA558761
74
+  // SD card information first addr
75
+  #define VAR_INF_ADDR                    0x000000
76
+
77
+  union union32 {
78
+    uint8_t bytes[4];
79
+    uint32_t dwords;
80
+  };
81
+
82
+  // pic information
83
+  struct pic_msg {
84
+    uint8_t name[PIC_NAME_MAX_LEN];
85
+    union union32 size;
86
+  };
87
+
88
+  typedef struct pic_msg PIC_MSG;
89
+
90
+  #define BMP_WRITE_BUF_LEN 512
91
+
92
+  #define PICINFOADDR   0
93
+
94
+  #define PIC_SIZE_xM   6
95
+  #define FONT_SIZE_xM  2
96
+
97
+  //extern void PicMsg_Init(void);
98
+  extern void Pic_Read(uint8_t *Pname, uint8_t *P_Rbuff);
99
+  //extern void bindBmpFileData(const uint8_t **pBuf, uint8_t *pName);
100
+  //extern void Pic_Logo_Read(uint8_t *LogoName,uint8_t *Logo_Rbuff,uint32_t LogoReadsize);
101
+  //extern void default_view_Read(uint8_t *default_view_Rbuff,uint32_t default_view_Readsize);
102
+  //extern void flash_view_Read(uint8_t *flash_view_Rbuff,uint32_t flash_view_Readsize);
103
+
104
+  //extern void lv_Pic_Read(uint8_t *Pname,uint8_t *P_Rbuff,uint32_t addr,uint32_t size);
105
+  extern void lv_pic_test(uint8_t *P_Rbuff, uint32_t addr, uint32_t size);
106
+
107
+#endif
108
+
109
+extern uint32_t lv_get_pic_addr(uint8_t *Pname);
110
+
111
+extern void get_spi_flash_data(const char *rec_buf, int offset, int size);
112
+//extern void SPI_FLASH_BufferRead(uint8_t* pBuffer, uint32_t ReadAddr, uint16_t NumByteToRead);
113
+
114
+extern void spi_flash_read_test();
115
+extern void default_view_Read(uint8_t *default_view_Rbuff, uint32_t default_view_Readsize);
116
+extern void flash_view_Read(uint8_t *flash_view_Rbuff, uint32_t flash_view_Readsize);
117
+
118
+#ifdef __cplusplus
119
+} /* C-declarations for C++ */
120
+#endif

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

@@ -0,0 +1,218 @@
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 <http://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+#include "../../../../inc/MarlinConfigPre.h"
23
+
24
+#if ENABLED(TFT_LITTLE_VGL_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"));
55
+          gcode.process_subcommands_now_P(PSTR("G91"));
56
+          gcode.process_subcommands_now_P(PSTR("G1 Z5"));
57
+          gcode.process_subcommands_now_P(PSTR("G90"));
58
+
59
+          uiCfg.print_state = PAUSED;
60
+
61
+          //#if ENABLED(POWER_LOSS_RECOVERY)
62
+          //  if (recovery.enabled) recovery.save(true);
63
+          //#endif
64
+          gCfgItems.pause_reprint = 1;
65
+          update_spi_flash();
66
+        }
67
+      #endif
68
+    }
69
+    else {
70
+      uiCfg.waitEndMoves = 0;
71
+    }
72
+
73
+    if (uiCfg.print_state == PAUSED) {
74
+
75
+    }
76
+
77
+    if (uiCfg.print_state == RESUMING) {
78
+      if (IS_SD_PAUSED()) {
79
+        gcode.process_subcommands_now_P(PSTR("G91"));
80
+        gcode.process_subcommands_now_P(PSTR("G1 Z-5"));
81
+        gcode.process_subcommands_now_P(PSTR("G90"));
82
+        gcode.process_subcommands_now_P(PSTR("M24"));
83
+        uiCfg.print_state = WORKING;
84
+        start_print_time();
85
+
86
+        gCfgItems.pause_reprint = 0;
87
+        update_spi_flash();
88
+      }
89
+    }
90
+    #if ENABLED(POWER_LOSS_RECOVERY)
91
+    if (uiCfg.print_state == REPRINTED) {
92
+      memset(public_buf_m, 0, sizeof(public_buf_m));
93
+      #if HOTENDS
94
+      HOTEND_LOOP() {
95
+        const int16_t et = recovery.info.target_temperature[e];
96
+        if (et) {
97
+          #if HOTENDS > 1
98
+            sprintf_P(public_buf_m, PSTR("T%i"), e);
99
+            gcode.process_subcommands_now(public_buf_m);
100
+          #endif
101
+          sprintf_P(public_buf_m, PSTR("M109 S%i"), et);
102
+          gcode.process_subcommands_now(public_buf_m);
103
+        }
104
+      }
105
+      #endif
106
+
107
+      if (gCfgItems.pause_reprint == 1) {
108
+        gcode.process_subcommands_now_P(PSTR("G91"));
109
+        gcode.process_subcommands_now_P(PSTR("G1 Z-5"));
110
+        gcode.process_subcommands_now_P(PSTR("G90"));
111
+      }
112
+      recovery.resume();
113
+
114
+      uiCfg.print_state = WORKING;
115
+      start_print_time();
116
+
117
+      gCfgItems.pause_reprint = 0;
118
+      update_spi_flash();
119
+    }
120
+    #endif
121
+
122
+    if (uiCfg.print_state == WORKING)
123
+      filament_check();
124
+  }
125
+
126
+  void filament_pin_setup() {
127
+    #if PIN_EXISTS(MT_DET_1)
128
+      pinMode(MT_DET_1_PIN, INPUT_PULLUP);
129
+    #endif
130
+    #if PIN_EXISTS(MT_DET_2)
131
+      pinMode(MT_DET_2_PIN, INPUT_PULLUP);
132
+    #endif
133
+    #if PIN_EXISTS(MT_DET_3)
134
+      pinMode(MT_DET_3_PIN, INPUT_PULLUP);
135
+    #endif
136
+  }
137
+
138
+  void filament_check() {
139
+    const int FIL_DELAY = 20;
140
+    #if PIN_EXISTS(MT_DET_1)
141
+      static int fil_det_count_1 = 0;
142
+      if (!READ(MT_DET_1_PIN) && !MT_DET_PIN_INVERTING)
143
+        fil_det_count_1++;
144
+      else if (READ(MT_DET_1_PIN) && MT_DET_PIN_INVERTING)
145
+        fil_det_count_1++;
146
+      else if (fil_det_count_1 > 0)
147
+        fil_det_count_1--;
148
+
149
+      if (!READ(MT_DET_1_PIN) && !MT_DET_PIN_INVERTING)
150
+        fil_det_count_1++;
151
+      else if (READ(MT_DET_1_PIN) && MT_DET_PIN_INVERTING)
152
+        fil_det_count_1++;
153
+      else if (fil_det_count_1 > 0)
154
+        fil_det_count_1--;
155
+    #endif
156
+
157
+    #if PIN_EXISTS(MT_DET_2)
158
+      static int fil_det_count_2 = 0;
159
+      if (!READ(MT_DET_2_PIN) && !MT_DET_PIN_INVERTING)
160
+        fil_det_count_2++;
161
+      else if (READ(MT_DET_2_PIN) && MT_DET_PIN_INVERTING)
162
+        fil_det_count_2++;
163
+      else if (fil_det_count_2 > 0)
164
+        fil_det_count_2--;
165
+
166
+      if (!READ(MT_DET_2_PIN) && !MT_DET_PIN_INVERTING)
167
+        fil_det_count_2++;
168
+      else if (READ(MT_DET_2_PIN) && MT_DET_PIN_INVERTING)
169
+        fil_det_count_2++;
170
+      else if (fil_det_count_2 > 0)
171
+        fil_det_count_2--;
172
+    #endif
173
+
174
+    #if PIN_EXISTS(MT_DET_3)
175
+      static int fil_det_count_3 = 0;
176
+      if (!READ(MT_DET_3_PIN) && !MT_DET_PIN_INVERTING)
177
+        fil_det_count_3++;
178
+      else if (READ(MT_DET_3_PIN) && MT_DET_PIN_INVERTING)
179
+        fil_det_count_3++;
180
+      else if (fil_det_count_3 > 0)
181
+        fil_det_count_3--;
182
+
183
+      if (!READ(MT_DET_3_PIN) && !MT_DET_PIN_INVERTING)
184
+        fil_det_count_3++;
185
+      else if (READ(MT_DET_3_PIN) && MT_DET_PIN_INVERTING)
186
+        fil_det_count_3++;
187
+      else if (fil_det_count_3 > 0)
188
+        fil_det_count_3--;
189
+    #endif
190
+
191
+    if (
192
+      #if PIN_EXISTS(MT_DET_1)
193
+        fil_det_count_1 >= FIL_DELAY
194
+      #else
195
+        false
196
+      #endif
197
+      #if PIN_EXISTS(MT_DET_2)
198
+        || fil_det_count_2 >= FIL_DELAY
199
+      #endif
200
+      #if PIN_EXISTS(MT_DET_3)
201
+        || fil_det_count_3 >= FIL_DELAY
202
+      #endif
203
+      ) {
204
+      clear_cur_ui();
205
+      card.pauseSDPrint();
206
+      stop_print_time();
207
+      uiCfg.print_state = PAUSING;
208
+
209
+      if (gCfgItems.from_flash_pic == 1)
210
+        flash_preview_begin = 1;
211
+      else
212
+        default_preview_flg = 1;
213
+
214
+      lv_draw_printing();
215
+    }
216
+  }
217
+
218
+#endif // TFT_LITTLE_VGL_UI

+ 36
- 0
Marlin/src/lcd/extui/lib/mks_ui/printer_opration.h View File

@@ -0,0 +1,36 @@
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 <http://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+#pragma once
23
+
24
+#ifdef __cplusplus
25
+extern "C" { /* C-declarations for C++ */
26
+#endif
27
+
28
+#define MIN_FILE_PRINTED   100 //5000
29
+
30
+extern void printer_state_polling();
31
+extern void filament_pin_setup();
32
+extern void filament_check();
33
+
34
+#ifdef __cplusplus
35
+} /* C-declarations for C++ */
36
+#endif

+ 718
- 0
Marlin/src/lcd/extui/lib/mks_ui/tft_Language_en.h View File

@@ -0,0 +1,718 @@
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 <http://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+#pragma once
23
+
24
+//****************英文***************************//
25
+#define MACHINE_CONFIG_EN              "Machine\nSettings"
26
+
27
+#define NEXT_EN                 "Next"
28
+#define PREVIOUS_EN             "Previous"
29
+#define DEFAULT_EN              "Default"
30
+#define KEY_BACK_EN             "Del"
31
+#define KEY_REST_EN             "Rest"
32
+#define KEY_CONFIRM_EN          "Confirm"
33
+
34
+#define KEYBOARD_KEY0_EN "0"
35
+#define KEYBOARD_KEY1_EN "1"
36
+#define KEYBOARD_KEY2_EN "2"
37
+#define KEYBOARD_KEY3_EN "3"
38
+#define KEYBOARD_KEY4_EN "4"
39
+#define KEYBOARD_KEY5_EN "5"
40
+#define KEYBOARD_KEY6_EN "6"
41
+#define KEYBOARD_KEY7_EN "7"
42
+#define KEYBOARD_KEY8_EN "8"
43
+#define KEYBOARD_KEY9_EN "9"
44
+#define KEYBOARD_KEY_POINT_EN "."
45
+#define KEYBOARD_KEY_NEGATIVE_EN "-"
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"
53
+
54
+#define MACHINE_CONFIG_TITLE_EN     "Machine Settings"
55
+#define MACHINE_TYPE_EN             "Machine type"
56
+#define MACHINE_STROKE_EN           "Machine Size"
57
+#define MACHINE_HOMEDIR_EN          "Home direction"
58
+#define MACHINE_ENDSTOP_TYPE_EN     "Endstop type"
59
+#define MACHINE_FILAMENT_CONFIG_EN  "Filament settings"
60
+#define MACHINE_LEVELING_CONFIG_EN  "Leveling settings"
61
+
62
+#define MACHINE_TYPE_CONFIG_TITLE_EN    "Machine Settings>Machine type"
63
+#define MACHINE_TYPE_XYZ_EN             "XYZ Machine"
64
+#define MACHINE_TYPE_DELTA_EN           "Delta Machine"
65
+#define MACHINE_TYPE_COREXY_EN          "Corexy Machine"
66
+
67
+#define MACHINE_STROKE_CONF_TITLE_EN    "Machine Settings>Machine Size"
68
+#define X_MAX_LENGTH_EN                 "X-axis maximum stroke"
69
+#define Y_MAX_LENGTH_EN                 "Y-axis maximum stroke"
70
+#define Z_MAX_LENGTH_EN                 "Z-axis maximum stroke"
71
+
72
+#define X_MIN_LENGTH_EN                 "X-axis minimum stroke"
73
+#define Y_MIN_LENGTH_EN                 "Y-axis minimum stroke"
74
+#define Z_MIN_LENGTH_EN                 "Z-axis minimum stroke"
75
+
76
+#define HOME_DIR_CONF_TITLE_EN          "Machine Settings>Home direction"
77
+#define HOME_DIR_X_EN                   "X-axis home direction"
78
+#define HOME_DIR_Y_EN                   "Y-axis home direction"
79
+#define HOME_DIR_Z_EN                   "Z-axis home direction"
80
+#define HOME_MIN_EN                     "MIN"
81
+#define HOME_MAX_EN                     "MAX"
82
+
83
+#define ENDSTOP_CONF_TITLE_EN           "Machine Settings>Endstop type"
84
+#define MIN_ENDSTOP_X_EN                "X-axis minimum Endstop"
85
+#define MIN_ENDSTOP_Y_EN                "Y-axis minimum Endstop"
86
+#define MIN_ENDSTOP_Z_EN                "Z-axis minimum Endstop"
87
+#define MAX_ENDSTOP_X_EN                "X axis maximum Endstop"
88
+#define MAX_ENDSTOP_Y_EN                "Y axis maximum Endstop"
89
+#define MAX_ENDSTOP_Z_EN                "Z axis maximum Endstop"
90
+#define ENDSTOP_FIL_EN                  "Filament sensor"
91
+#define ENDSTOP_LEVEL_EN                "Leveling sensor"
92
+#define ENDSTOP_OPENED_EN               "Open"
93
+#define ENDSTOP_CLOSED_EN               "Close"
94
+
95
+#define FILAMENT_CONF_TITLE_EN          "Filament settings"
96
+#define FILAMENT_IN_TEMPERATURE_EN      "Load temperature"
97
+#define FILAMENT_IN_LENGTH_EN           "Load length"
98
+#define FILAMENT_IN_SPEED_EN            "Load speed"
99
+#define FILAMENT_OUT_TEMPERATURE_EN     "Unload temperature"
100
+#define FILAMENT_OUT_LENGTH_EN          "Unload length"
101
+#define FILAMENT_OUT_SPEED_EN           "Unload speed"
102
+
103
+#define LEVELING_CONF_TITLE_EN          "Leveling settings"
104
+#define LEVELING_PARA_CONF_EN           "Leveling settings"
105
+#define LEVELING_DELTA_EN               "delta machine leveling"
106
+#define LEVELING_XYZ_EN                 "Manual leveling coordinate settings"
107
+
108
+#define LEVELING_PARA_CONF_TITLE_EN     "leveling setting"
109
+#define AUTO_LEVELING_ENABLE_EN         "Enable auto leveling"
110
+#define BLTOUCH_LEVELING_ENABLE_EN      "Enable BLtouch"
111
+#define PROBE_PORT_EN                   "Probe connector"
112
+#define PROBE_X_OFFSET_EN               "Probe x axis offset"
113
+#define PROBE_Y_OFFSET_EN               "Probe y axis offset"
114
+#define PROBE_Z_OFFSET_EN               "Probe z axis offset"
115
+#define PROBE_XY_SPEED_EN               "Probe xy axis speed"
116
+#define PROBE_Z_SPEED_EN                "Probe z axis speed"
117
+#define ENABLE_EN                       "YES"
118
+#define DISABLE_EN                      "NO"
119
+#define Z_MIN_EN                        "ZMin"
120
+#define Z_MAX_EN                        "ZMax"
121
+
122
+#define DELTA_LEVEL_CONF_TITLE_EN       "Delta Machine settings"
123
+#define DELTA_LEVEL_CONF_EN             "Delta Machine Leveling"
124
+#define DELTA_MACHINE_RADIUS_EN         "Machine Radius"
125
+#define DELTA_DIAGONAL_ROD_EN           "Machine rod length"
126
+#define DELTA_PRINT_RADIUS_EN           "Print radius"
127
+#define DELTA_HEIGHT_EN                 "Print height"
128
+#define SMOOTH_ROD_OFFSET_EN            "Slider offset"
129
+#define EFFECTOR_OFFSET_EN              "Effector offset"
130
+#define CALIBRATION_RADIUS_EN           "Leveling radius"
131
+
132
+#define XYZ_LEVEL_CONF_TITLE_EN         "Cartesian Machine Settings"
133
+#define PROBE_REACH_MAX_LEFT_EN         "Probe reaches leftmost position"
134
+#define PROBE_REACH_MAX_RIGHT_EN        "Probe reaches rightmost position"
135
+#define PROBE_REACH_MAX_FRONT_EN        "Probe reaches front position"
136
+#define PROBE_REACH_MAX_BACK_EN         "Probe reaches final position"
137
+
138
+#define TEMPERATURE_CONF_TITLE_EN       "Machine Settings>Temperature settings"
139
+#define NOZZLE_CONF_EN                  "Nozzle settings"
140
+#define HOTBED_CONF_EN                  "Hotbed settings"
141
+#define PREHEAT_TEMPER_EN               "Preset temperature"
142
+
143
+#define NOZZLE_CONF_TITLE_EN            "Machine Settings>Nozzle settings"
144
+#define NOZZLECNT_EN                    "Number of nozzles"
145
+#define NOZZLE_TYPE_EN                  "E0 Temperature type"
146
+#define NOZZLE_ADJUST_TYPE_EN           "PID thermostat"
147
+#define NOZZLE_MIN_TEMPERATURE_EN       "lowest temperature"
148
+#define NOZZLE_MAX_TEMPERATURE_EN       "Maximum temperature"
149
+#define EXTRUD_MIN_TEMPER_EN            "Minimum extrusion temperature"
150
+
151
+#define HOTBED_CONF_TITLE_EN            "Machine Settings>Hotbed settings"
152
+#define HOTBED_ADJUST_EN                "PID thermostat"
153
+#define HOTBED_MIN_TEMPERATURE_EN       "lowest temperature"
154
+#define HOTBED_MAX_TEMPERATURE_EN       "Maximum temperature"
155
+
156
+#define MOTOR_CONF_TITLE_EN             "Machine Settings>Motor settings"
157
+#define MAXFEEDRATE_CONF_EN             "Maximum speed settings"
158
+#define ACCELERATION_CONF_EN            "Acceleration settings"
159
+#define JERKCONF_EN                     "Jerk settings"
160
+#define STEPSCONF_EN                    "Steps settings"
161
+#define MOTORDIRCONF_EN                 "Motor direction settings"
162
+#define HOMEFEEDRATECONF_EN             "Home speed setting"
163
+
164
+#define MAXFEEDRATE_CONF_TITLE_EN       "Machine Settings>Maximum speed"
165
+#define X_MAXFEEDRATE_EN                "X axis maximum speed"
166
+#define Y_MAXFEEDRATE_EN                "Y axis maximum speed"
167
+#define Z_MAXFEEDRATE_EN                "Z axis maximum speed"
168
+#define E0_MAXFEEDRATE_EN               "E0 axis maximum speed"
169
+#define E1_MAXFEEDRATE_EN               "E1 axis maximum speed"
170
+
171
+#define ACCELERATION_CONF_TITLE_EN      "Machine Settings>Acceleration"
172
+#define PRINT_ACCELERATION_EN           "Print acceleration"
173
+#define RETRACT_ACCELERATION_EN         "Retraction acceleration"
174
+#define TRAVEL_ACCELERATION_EN          "Travel acceleration"
175
+#define X_ACCELERATION_EN               "X-axis acceleration"
176
+#define Y_ACCELERATION_EN               "Y-axis acceleration"
177
+#define Z_ACCELERATION_EN               "Z-axis acceleration"
178
+#define E0_ACCELERATION_EN              "E0-axis acceleration"
179
+#define E1_ACCELERATION_EN              "E1-axis acceleration"
180
+
181
+#define JERK_CONF_TITLE_EN              "Machine Settings>Jerk speed"
182
+#define X_JERK_EN                       "X-axis jerk speed"
183
+#define Y_JERK_EN                       "Y-axis jerk speed"
184
+#define Z_JERK_EN                       "J-axis jerk speed"
185
+#define E_JERK_EN                       "E-axis jerk speed"
186
+
187
+#define STEPS_CONF_TITLE_EN             "Machine Settings>Steps settings"
188
+#define X_STEPS_EN                      "X-axis steps"
189
+#define Y_STEPS_EN                      "Y-axis stepS"
190
+#define Z_STEPS_EN                      "Z-axis stepS"
191
+#define E0_STEPS_EN                     "E0-axis steps"
192
+#define E1_STEPS_EN                     "E1-axis steps"
193
+
194
+#define MOTORDIR_CONF_TITLE_EN          "Machine Settings>Motor direction"
195
+#define X_MOTORDIR_EN                   "X-axis motor direction invert"
196
+#define Y_MOTORDIR_EN                   "Y-axis motor direction invert"
197
+#define Z_MOTORDIR_EN                   "Z-axis motor direction invert"
198
+#define E0_MOTORDIR_EN                  "E0-axis motor direction invert"
199
+#define E1_MOTORDIR_EN                  "E1-axis motor direction invert"
200
+#define INVERT_P_EN                     "YES"
201
+#define INVERT_N_EN                     "NO"
202
+
203
+#define HOMEFEEDRATE_CONF_TITLE_EN      "Machine Settings>Home speed"
204
+#define X_HOMESPEED_EN                  "XY-axis Home speed"
205
+#define Y_HOMESPEED_EN                  "Y-axis Home speed"
206
+#define Z_HOMESPEED_EN                  "Z-axis Home speed"
207
+
208
+#define ADVANCED_CONF_TITLE_EN          "Machine Settings>Advance"
209
+#define PWROFF_DECTION_EN               "power off dection module"
210
+#define PWROFF_AFTER_PRINT_EN           "Auto Shutdown after print"
211
+#define HAVE_UPS_EN                     "Has UPS power supply"
212
+#define Z2_AND_Z2ENDSTOP_CONF_EN        "Z2 Settings"
213
+#define ENABLE_PINS_CONF_EN             "Enable pins level settings"
214
+
215
+#define Z2_AND_Z2ENDSTOP_CONF_TITLE_EN  "Z2 Settings"
216
+#define Z2_ENABLE_EN                    "Z2 Enable"
217
+#define Z2_ENDSTOP_EN                   "Z2_EndStop Enable"
218
+#define Z2_PORT_EN                      "Z2 Connector"
219
+
220
+#define ENABLE_PINS_CONF_TITLE_EN       "ENABLE_PINS_LEVEL"
221
+#define X_ENABLE_PINS_INVERT_EN         "X_ENABLE_PIN_INVERT"
222
+#define Y_ENABLE_PINS_INVERT_EN         "Y_ENABLE_PIN_INVERT"
223
+#define Z_ENABLE_PINS_INVERT_EN         "Z_ENABLE_PIN_INVERT"
224
+#define E_ENABLE_PINS_INVERT_EN         "E_ENABLE_PIN_INVERT"
225
+
226
+#define TOOL_TEXT_EN            "Tool"
227
+#define PREHEAT_TEXT_EN         "Preheat"
228
+#define MOVE_TEXT_EN            "Move"
229
+#define HOME_TEXT_EN            "Home"
230
+#define PRINT_TEXT_EN           "Printing"
231
+#define EXTRUDE_TEXT_EN         "Extrusion"
232
+#define LEVELING_TEXT_EN        "Leveling"
233
+#define AUTO_LEVELING_TEXT_EN   "AutoLevel"
234
+#define SET_TEXT_EN             "Settings"
235
+#define MORE_TEXT_EN            "More"
236
+
237
+#define ADD_TEXT_EN             "Add"
238
+#define DEC_TEXT_EN             "Dec"
239
+#define EXTRUDER_1_TEXT_EN      "Extrusion1"
240
+#define EXTRUDER_2_TEXT_EN      "Extrusion2"
241
+#define HEATBED_TEXT_EN         "HeatBed"
242
+#define TEXT_1C_EN              "1℃"
243
+#define TEXT_5C_EN              "5℃"
244
+#define TEXT_10C_EN             "10℃"
245
+#define CLOSE_TEXT_EN           "Close"
246
+
247
+#define BACK_TEXT_EN            "Back"
248
+
249
+#define TOOL_PREHEAT_EN         "Preheat"
250
+#define TOOL_EXTRUDE_EN         "Extrusion"
251
+#define TOOL_MOVE_EN            "Move"
252
+#define TOOL_HOME_EN            "Home"
253
+#define TOOL_LEVELING_EN        "Leveling"
254
+#define TOOL_AUTO_LEVELING_EN   "AutoLevel"
255
+#define TOOL_FILAMENT_EN        "Filament"
256
+#define TOOL_MORE_EN            "More"
257
+
258
+#define AXIS_X_ADD_TEXT_EN      "X+"
259
+#define AXIS_X_DEC_TEXT_EN      "X-"
260
+#define AXIS_Y_ADD_TEXT_EN      "Y+"
261
+#define AXIS_Y_DEC_TEXT_EN      "Y-"
262
+#define AXIS_Z_ADD_TEXT_EN      "Z+"
263
+#define AXIS_Z_DEC_TEXT_EN      "Z-"
264
+#define TEXT_01MM_EN            "0.1mm"
265
+#define TEXT_1MM_EN             "1mm"
266
+#define TEXT_10MM_EN            "10mm"
267
+
268
+#define HOME_X_TEXT_EN          "X"
269
+#define HOME_Y_TEXT_EN          "Y"
270
+#define HOME_Z_TEXT_EN          "Z"
271
+#define HOME_ALL_TEXT_EN        "Home"
272
+#define HOME_STOPMOVE_EN        "Quickstop"
273
+
274
+#define PAGE_UP_TEXT_EN         "Page up"
275
+#define PAGE_DOWN_TEXT_EN       "Page down"
276
+
277
+#define EXTRUDER_IN_TEXT_EN           "In"
278
+#define EXTRUDER_OUT_TEXT_EN          "Out"
279
+#define EXTRUDE_1MM_TEXT_EN           "1mm"
280
+#define EXTRUDE_5MM_TEXT_EN           "5mm"
281
+#define EXTRUDE_10MM_TEXT_EN          "10mm"
282
+#define EXTRUDE_LOW_SPEED_TEXT_EN     "Low"
283
+#define EXTRUDE_MEDIUM_SPEED_TEXT_EN  "Normal"
284
+#define EXTRUDE_HIGH_SPEED_TEXT_EN    "High"
285
+
286
+#define LEVELING_POINT1_TEXT_EN       "Point1"
287
+#define LEVELING_POINT2_TEXT_EN       "Point2"
288
+#define LEVELING_POINT3_TEXT_EN       "Point3"
289
+#define LEVELING_POINT4_TEXT_EN       "Point4"
290
+#define LEVELING_POINT5_TEXT_EN       "Point5"
291
+
292
+#define FILESYS_TEXT_EN               "FileSys"
293
+#define WIFI_TEXT_EN                  "WiFi"
294
+#define FAN_TEXT_EN                   "Fan"
295
+#define ABOUT_TEXT_EN                 "About"
296
+#define BREAK_POINT_TEXT_EN           "Continue"
297
+#define FILAMENT_TEXT_EN              "Filament"
298
+#define LANGUAGE_TEXT_EN              "Language"
299
+#define MOTOR_OFF_TEXT_EN             "Motor-off"
300
+#define MOTOR_OFF_XY_TEXT_EN          "Off-XY"
301
+#define SHUTDOWN_TEXT_EN              "Shutdown"
302
+
303
+#define U_DISK_TEXT_EN                "USB"
304
+#define SD_CARD_TEXT_EN               "SD"
305
+#define WIFI_NAME_TEXT_EN             "WiFi: "
306
+#define WIFI_KEY_TEXT_EN              "Key: "
307
+#define WIFI_IP_TEXT_EN               "IP: "
308
+#define WIFI_AP_TEXT_EN               "State: AP"
309
+#define WIFI_STA_TEXT_EN              "State: STA"
310
+#define WIFI_CONNECTED_TEXT_EN        "Connected"
311
+#define WIFI_DISCONNECTED_TEXT_EN     "Disconnected"
312
+#define WIFI_EXCEPTION_TEXT_EN        "Exception"
313
+#define WIFI_RECONNECT_TEXT_EN        "Reconnect"
314
+#define CLOUD_TEXT_EN                 "Cloud"
315
+#define CLOUD_BIND_EN                 "Bind"
316
+#define CLOUD_UNBIND_EN               "Unbind"
317
+#define CLOUD_UNBINDING_EN            "Unbinding"
318
+#define CLOUD_DISCONNECTED_EN         "Disconnected"
319
+#define CLOUD_UNBINDED_EN             "Unbinded"
320
+#define CLOUD_BINDED_EN               "Binded"
321
+#define CLOUD_DISABLE_EN              "Disable"
322
+
323
+#define FAN_ADD_TEXT_EN               "Add"
324
+#define FAN_DEC_TEXT_EN               "Dec"
325
+#define FAN_OPEN_TEXT_EN              "100%"
326
+#define FAN_HALF_TEXT_EN              "50%"
327
+#define FAN_CLOSE_TEXT_EN             "Close"
328
+#define FAN_TIPS1_TEXT_EN             "FAN"
329
+#define FAN_TIPS2_TEXT_EN             "FAN\nClose"
330
+
331
+#define FILAMENT_IN_TEXT_EN           "Load"
332
+#define FILAMENT_OUT_TEXT_EN          "Unload"
333
+#define FILAMENT_EXT0_TEXT_EN         "Extrusion1"
334
+#define FILAMENT_EXT1_TEXT_EN         "Extrusion2"
335
+#define FILAMENT_HEAT_TEXT_EN         "Preheat"
336
+#define FILAMENT_STOP_TEXT_EN         "Stop"
337
+//#define FILAMENT_CHANGE_TEXT_EN       "Filament replace"
338
+#define FILAMENT_TIPS2_TEXT_EN        "T:"
339
+#define FILAMENT_TIPS3_TEXT_EN        "Loading..."
340
+#define FILAMENT_TIPS4_TEXT_EN        "Unloading..."
341
+#define FILAMENT_TIPS5_TEXT_EN        "Temp is too low to go,please heat"
342
+#define FILAMENT_TIPS6_TEXT_EN        "Completed"
343
+
344
+#if 0
345
+  #define FILAMENT_REPLAYS_IDLE_TEXT_EN           "Please click <Load> or <unload> \nto replace filament!"
346
+  #define FILAMENT_CHANGE_TEXT_EN                 "Please click <Load> or <unload>,\nAfter pinter pause."
347
+  #define FILAMENT_DIALOG_LOAD_HEAT_TIPS_EN       "Heating up the nozzle,please wait..."
348
+  #define FILAMENT_DIALOG_UNLOAD_HEAT_TIPS_EN     "Heating up the nozzle,please wait..."
349
+  #define FILAMENT_DIALOG_LOAD_CONFIRM1_TIPS_EN   "Heat completed,please load filament to extruder,and click <confirm> for start loading."
350
+  #define FILAMENT_DIALOG_LOAD_CONFIRM2_TIPS_EN   "Please load filament to extruder,and click <confirm> for start loading."
351
+  #define FILAMENT_DIALOG_UNLOAD_CONFIRM_TIPS_EN  "Heat completed,please click <confirm> for start unloading.!"
352
+  #define FILAMENT_DIALOG_LOADING_TIPS_EN         "Is loading ,please wait!"
353
+  #define FILAMENT_DIALOG_UNLOADING_TIPS_EN       "Is unloading,please wait!"
354
+  #define FILAMENT_DIALOG_LOAD_COMPLETE_TIPS_EN   "Load filament completed,click <confirm> for return!"
355
+  #define FILAMENT_DIALOG_UNLOAD_COMPLETE_TIPS_EN "Unload filament completed,click <confirm> for return!"
356
+#endif
357
+
358
+
359
+#define FILAMENT_CHANGE_TEXT_EN                 "Please click <Load> \nor <unload>,After \npinter pause."
360
+#define FILAMENT_DIALOG_LOAD_HEAT_TIPS_EN       "Heating up the nozzle,\nplease wait..."
361
+#define FILAMENT_DIALOG_UNLOAD_HEAT_TIPS_EN     "Heating up the nozzle,\nplease wait..."
362
+#define FILAMENT_DIALOG_LOAD_CONFIRM1_TIPS_EN   "Heat completed,please load filament \nto extruder,and click <confirm> \nfor start loading."
363
+#define FILAMENT_DIALOG_LOAD_CONFIRM2_TIPS_EN   "Please load filament to extruder,\nand click <confirm> for start loading."
364
+#define FILAMENT_DIALOG_UNLOAD_CONFIRM_TIPS_EN  "Heat completed,please \nclick <confirm> for start unloading.!"
365
+#define FILAMENT_DIALOG_LOADING_TIPS_EN         "Is loading ,please wait!"
366
+#define FILAMENT_DIALOG_UNLOADING_TIPS_EN       "Is unloading,please wait!"
367
+#define FILAMENT_DIALOG_LOAD_COMPLETE_TIPS_EN   "Load filament completed,\nclick <confirm> for return!"
368
+#define FILAMENT_DIALOG_UNLOAD_COMPLETE_TIPS_EN "Unload filament completed,\nclick <confirm> for return!"
369
+
370
+
371
+#define PRE_HEAT_EXT_TEXT_EN                "E"
372
+#define PRE_HEAT_BED_TEXT_EN                "Bed"
373
+
374
+#define FILE_LOADING_EN                 "Loading......"
375
+#if 0
376
+  #define NO_FILE_AND_CHECK_EN          "No files found!Please insert SD card or U disk!"
377
+#else
378
+  #define NO_FILE_AND_CHECK_EN          "  No files found!\n            Check the file system configuration!"
379
+#endif
380
+
381
+#define NO_FILE_EN                          "No files found!"
382
+
383
+#define EXTRUDER_TEMP_TEXT_EN               "Temper"
384
+#define EXTRUDER_E_LENGTH1_TEXT_EN          "Extrusion1"
385
+#define EXTRUDER_E_LENGTH2_TEXT_EN          "Extrusion2"
386
+#define EXTRUDER_E_LENGTH3_TEXT_EN          "Extrusion3"
387
+
388
+#define ABOUT_TYPE_TEXT_EN                  "Type: "
389
+#define ABOUT_VERSION_TEXT_EN               "Firmware: "
390
+#define ABOUT_WIFI_TEXT_EN                  "WiFi: "
391
+
392
+#define PRINTING_OPERATION_EN               "Option"
393
+#define PRINTING_PAUSE_EN                   "Pause"
394
+#define PRINTING_TEMP_EN                    "Temp."
395
+#define PRINTING_CHANGESPEED_EN             "Speed"
396
+#define PRINTING_RESUME_EN                  "Resume"
397
+#define PRINTING_STOP_EN                    "Stop"
398
+#define PRINTING_MORE_EN                    "More"
399
+#define PRINTING_EXTRUDER_EN                "Extrusion"
400
+#define PRINTING_MOVE_EN                    "Move"
401
+
402
+#define EXTRUDER_SPEED_EN                   "Extrusion"
403
+#define MOVE_SPEED_EN                       "Move"
404
+#define EXTRUDER_SPEED_STATE_EN             "Extrude Speed"
405
+#define MOVE_SPEED_STATE_EN                 "Move Speed"
406
+#define STEP_1PERCENT_EN                    "1%"
407
+#define STEP_5PERCENT_EN                    "5%"
408
+#define STEP_10PERCENT_EN                   "10%"
409
+
410
+#define ZOFFSET_EN                          "Z Offset"
411
+#define ZOFFSET_INC_EN                      "Add"
412
+#define ZOFFSET_DEC_EN                      "Dec"
413
+
414
+#define TITLE_READYPRINT_EN                 "ReadyPrint"
415
+#define TITLE_PREHEAT_EN                    "Preheat"
416
+#define TITLE_MOVE_EN                       "Move"
417
+#define TITLE_HOME_EN                       "Home"
418
+#define TITLE_EXTRUDE_EN                    "Extrusion"
419
+#define TITLE_LEVELING_EN                   "Leveling"
420
+#define TITLE_SET_EN                        "Settings"
421
+#define TITLE_MORE_EN                       "More"
422
+#define TITLE_CHOOSEFILE_EN                 "ChooseFile"
423
+#define TITLE_PRINTING_EN                   "Printing"
424
+#define TITLE_OPERATION_EN                  "Operation"
425
+#define TITLE_ADJUST_EN                     "Adjust"
426
+#define TITLE_WIRELESS_EN                   "Wireless"
427
+#define TITLE_FILAMENT_EN                   "Filament"
428
+#define TITLE_ABOUT_EN                      "About"
429
+#define TITLE_FAN_EN                        "Fan"
430
+#define TITLE_LANGUAGE_EN                   "Language"
431
+#define TITLE_PAUSE_EN                      "Pause"
432
+#define TITLE_CHANGESPEED_EN                "Speed"
433
+#define TITLE_CLOUD_TEXT_EN                 "Cloud"
434
+#define TITLE_DIALOG_CONFIRM_EN             "Confirm"
435
+#define TITLE_FILESYS_EN                    "FileSys"
436
+#define TITLE_ZOFFSET_EN                    "Z Offset"
437
+
438
+#define AUTO_SHUTDOWN_EN                    "Auto"
439
+#define MANUAL_SHUTDOWN_EN                  "Manual"
440
+
441
+#define DIALOG_CONFIRM_EN                   "Confirm"
442
+#define DIALOG_CANCLE_EN                    "Cancel"
443
+#define DIALOG_OK_EN                        "OK"
444
+#define DIALOG_RESET_EN                     "Reset"
445
+#define DIALOG_RETRY_EN                     "Retry"
446
+#define DIALOG_DISABLE_EN                   "Disable"
447
+#define DIALOG_PRINT_MODEL_EN               "Print this model?"
448
+#define DIALOG_CANCEL_PRINT_EN              "Stop print?"
449
+#define DIALOG_RETRY_EN                     "Retry"
450
+#define DIALOG_STOP_EN                      "Stop"
451
+#define DIALOG_REPRINT_FROM_BREAKPOINT_EN   "Reprint from breakpoint?"
452
+//#define DIALOG_UNBIND_PRINTER_EN          "Unbind the printer?"
453
+#define DIALOG_ERROR_TIPS1_EN               "Error:no file,please check it again."
454
+#define DIALOG_ERROR_TIPS2_EN               "Error:transaction failed.please check display baudrate \nwhether as the same as mainboard!"
455
+#define DIALOG_ERROR_TIPS3_EN               "Error:file name or path is too long!"
456
+#define DIALOG_CLOSE_MACHINE_EN             "Closing machine......"
457
+#define DIALOG_UNBIND_PRINTER_EN            "Unbind the printer?"
458
+#define DIALOG_FILAMENT_NO_PRESS_EN         "Filament detection switch is not pressed"
459
+#define DIALOG_PRINT_FINISH_EN              "Done print!"
460
+#define DIALOG_PRINT_TIME_EN                "Print time: "
461
+#define DIALOG_REPRINT_EN                   "Print again"
462
+#define DIALOG_WIFI_ENABLE_TIPS_EN "The wifi module is being configured\nplease wait a moment....."
463
+
464
+#define HOTBED_ENABLE_EN        "Enable heatbed"
465
+#define MOTOR_EN_HIGH_LEVEL_EN  "High"
466
+#define MOTOR_EN_LOW_LEVEL_EN   "Low"
467
+
468
+#define TEXT_WIFI_MENU_TITLE_EN "WI-FI"
469
+#define TEXT_WIFI_SAPCE_EN      "space"
470
+#define TEXT_WIFI_LETTER_EN     "abc"
471
+#define TEXT_WIFI_DIGITAL_EN    "123"
472
+#define TEXT_WIFI_SYMBOL_EN     "#+="
473
+#define TEXT_WIFI_PASSWORD_EN   "Password"
474
+
475
+#define TEXT_WIFI_POINT_BOLD_EN "`"
476
+
477
+#define TEXT_WIFI_JOINING_EN        "Joining\nNetwork..."
478
+#define TEXT_WIFI_FAILED_JOIN_EN    "Failed to\nJoin Wi-Fi"
479
+#define TEXT_WIFI_WIFI_CONECTED_EN  "Wi-Fi\nConnected"
480
+
481
+#define TEXT_BUTTON_DISCONECTED_EN  "Disconnect"
482
+#define TEXT_WIFI_FORGET_EN         "Forget Network"
483
+#define TEXT_DISCONECTED_EN         "Wi-Fi Connected"
484
+
485
+//wifi-list
486
+#define MAIN_BUILT_EN       "Build"
487
+#define MAIN_FILAMENT_EN    "Filament"
488
+#define MAIN_SETUP_EN       "Setup"
489
+#define MAIN_ABOUT_EN       "About"
490
+#define MAIN_MENU_EN        "Menu"
491
+#define FILE_MENU_BUILD_EN  "Build"
492
+#define FILE_MENU_MENU_EN   " < Menu"
493
+
494
+//about
495
+#define ABOUT_TITLE_EN                    "About"
496
+#define ABOUT_BUILT_MACHINES_EN           "Built Machines"
497
+#define ABOUT_SPARK_EN                    "Spark"
498
+#define ABOUT_VERSION_EN                  "Version 1.1.0"
499
+#define ABOUT_SERIAL_NUMBER_EN            "Serial Number:"
500
+#define ABOUT_S_NUMBER_EN                 "DCPLX02KFC6P"
501
+
502
+//set
503
+#define SETUP_TITLE_EN                    "Setup"
504
+#define SETUP_WIFI_EN                     "Wi-Fi"
505
+#define SETUP_MANUAL_IP_EN                "Manual IP"
506
+#define SETUP_WIFI_NOT_CONNECTED_EN       "Not Connected"
507
+#define SETUP_WIFI_NETWORK_EN             "WiFi_Network"
508
+
509
+//build
510
+#define BUILD_TITLE_EN                    "Build"
511
+#define BUILD_SD_CARD_EN                  "SD Card"
512
+#define BUILD_USB_DRIVE_EN                "USB Drive"
513
+
514
+//SD card
515
+#define SD_CARD_TITLE_EN                  "SD Card"
516
+#define SD_CARD_BACK_EN                   "< Back"
517
+//USB Drive
518
+#define USB_DRIVE_TITLE_EN                "USB Drive"
519
+#define USB_DRIVE_BACK_EN                 "< Back"
520
+#define FILE_PAGES_EN                     "%d/%d"
521
+#define FILE_NEXT_PAGE_EN                 "Next Page"
522
+
523
+//BUILD PLATE
524
+#define PLATE_TITLE_EN                    "Build Plate"
525
+#define PLATE_BACK_EN                     "< Back"
526
+#define PLATE_CONFIRM_EN                  "Confirm >"
527
+#define PLATE_TIPS_EN                     "Confirm that there is a Clear\nBuild Plate installed in the\nmachine."
528
+
529
+//build model
530
+#define MODEL_TITLE_EN                    "Build Model"
531
+#define MODEL_START_BUILD_EN              "Start Build"
532
+#define MODEL_BACK_EN                     "< Back"
533
+
534
+//building
535
+#define BUILDING_TITLE_EN                 "Building"
536
+#define BUILDING_MENU_EN                  "Build Menu"
537
+#define BUILDING_COMPLETED                "Build\nComplete"
538
+
539
+//building menu
540
+#define BUILDING_MENU_TITLE_EN            "Build Menu"
541
+#define BUILDING_MENU_SETTINGS_EN         "Build Settings"
542
+#define BUILDING_MENU_PAUSE_EN            "Pause Build"
543
+#define BUILDING_MENU_CANCEL_EN           "Cancel Build"
544
+#define BUILDING_MENU_BACK_EN             "< Back"
545
+
546
+//build settings
547
+#define SETTINGS_TITLE_EN                 "Build Settings"
548
+#define SETTINGS_NOZZLE_TEMPER_EN         "Nozzle Temp:"
549
+#define SETTINGS_NOZZLE_VALUE_EN          "%d"
550
+#define SETTINGS_BED_TEMPER_EN            "Bed Temp:"
551
+#define SETTINGS_BED_VALUE_EN             "%d"
552
+#define SETTINGS_BUILD_SPEED_EN           "Build Speed:"
553
+#define SETTINGS_SPEED_VALUE_EN           "Standard"
554
+#define SETTINGS_BACK_EN                  "< Back"
555
+
556
+//build paused
557
+#define PAUSED_TITLE_EN                   "Build Paused"
558
+#define PAUSED_RESUME_EN                  "Resume Build"
559
+#define PAUSED_CANCEL_EN                  "Cancel Build"
560
+#define PAUSED_BACK_EN                    "< Back"
561
+
562
+//build cancel
563
+#define CANCEL_TITLE_EN                   "Cancel Build"
564
+#define CANCEL_BUILD_EN                   "Cancel Build"
565
+#define CANCEL_TIPS_EN                    "Are you sure you want to\ncancel this build? The model\nwill be deleted from this\nmachine. It will need to be\nresent from your computer\nbefore it can be built in the\nfuture."
566
+#define CANCEL_BACK_EN                    "< Back"
567
+#define CANCEL_BUILD_DISPLAY_EN           "Build\nCanceled"
568
+#define CANCEL_OVER_PLATE_TIPS_EN         "Confirm that the Build Plate\nhas been removed from the\nmachine."
569
+
570
+//filament model enter
571
+#define FILAMENT_MODEL_ENTER_TITLE_EN     "Model-PLA"
572
+#define FILAMENT_MODEL_ENTER_BACK_EN      "< Back"
573
+#define FILAMENT_MODEL_ENTER_BEGIN_EN     "Begin >"
574
+#define FILAMENT_MODEL_ENTER_TIPS_EN      "The Model Filament spool\ncompartment is located on\nthe right side of the machine."
575
+
576
+//filament model PLA
577
+#define FILAMENT_MODEL_PLA_TITLE_EN       "Model-PLA"
578
+#define FILAMENT_PLA_LOAD_TITLE_EN        "Load Filament"
579
+#define FILAMENT_PLA_UNLOAD_TITLE_EN      "Unload Filament"
580
+#define FILAMENT_MODEL_PLA_LOAD_EN        "Load Filament"
581
+#define FILAMENT_MODEL_PLA_UNLOAD_EN      "Unload Filament"
582
+//filament support enter
583
+#define FILAMENT_SUPPORT_ENTER_TITLE_EN   "Support-PVA"
584
+#define FILAMENT_SUPPORT_ENTER_BACK_EN    "< Back"
585
+#define FILAMENT_SUPPORT_ENTER_BEGIN_EN   "Begin >"
586
+#define FILAMENT_SUPPORT_ENTER_TIPS_EN    "The Support Filament spool\ncompartment is located on\nthe left side of the machine."
587
+//filament heating
588
+#define FILAMENT_HEATING_LOAD_TITLE_EN    "Load Filament"
589
+#define FILAMENT_HEATING_UNLOAD_TITLE_EN  "Unload Filament"
590
+#define FILAMENT_HEATING_CANCEL_EN        "< Cancel"
591
+#define FILAMENT_HEATING_MATERIAL_EN      "Material:"
592
+#define FILAMENT_HEATING_PLA_EN           "Model-PLA"
593
+#define FILAMENT_HEATING_TIPS_EN          "Print head is heating..."
594
+//rotate left
595
+#define ROTATE_LEFT_LOAD_TITLE_EN         "Load Filament"
596
+#define ROTATE_LEFT_UNLOAD_TITLE_EN       "Unload Filament"
597
+#define ROTATE_LEFT_CANCEL_EN             "< Cancel"
598
+#define ROTATE_LEFT_MATERIAL_EN           "Material:"
599
+#define ROTATE_LEFT_PLA_EN                "Model-PLA"
600
+#define ROTATE_LEFT_NEXT_EN               "Next >"
601
+#define ROTATE_LEFT_TIPS_EN               "Rotate extruder selection\ndial to the left."
602
+
603
+//hang spool
604
+#define HANG_SPOOL_TITLE_EN         "Load Filament"
605
+#define HANG_SPOOL_PREVIOUS_EN      "< Previous"
606
+#define HANG_SPOOL_MATERIAL_EN      "Material:"
607
+#define HANG_SPOOL_PLA_EN           "Model-PLA"
608
+#define HANG_SPOOL_NEXT_EN          "Next >"
609
+#define HANG_SPOOL_TIPS_EN          "Hang the spool in the spool\ncompartment as shown."
610
+
611
+//feed filament
612
+#define FEED_FILAMENT_TITLE_EN      "Load Filament"
613
+#define FEED_FILAMENT_PREVIOUS_EN   "< Previous"
614
+#define FEED_FILAMENT_MATERIAL_EN   "Material:"
615
+#define FEED_FILAMENT_PLA_EN        "Model-PLA"
616
+#define FEED_FILAMENT_NEXT_EN       "Next >"
617
+#define FEED_FILAMENT_TIPS_EN       "Feed filament into extruder\nup beyond the gears."
618
+
619
+//feed filament
620
+#define ROTATE_UP_TITLE_EN          "Load Filament"
621
+#define ROTATE_UP_PREVIOUS_EN        "< Previous"
622
+#define ROTATE_UP_MATERIAL_EN       "Material:"
623
+#define ROTATE_UP_PLA_EN            "Model-PLA"
624
+#define ROTATE_UP_NEXT_EN           "Next >"
625
+#define ROTATE_UP_TIPS_EN           "Rotate extruder selection\ndial up."
626
+
627
+//filament begin
628
+#define FEED_BEGIN_TITLE_EN         "Load Filament"
629
+#define FEED_BEGIN_MATERIAL_EN      "Material:"
630
+#define FEED_BEGIN_PLA_EN           "Model-PLA"
631
+#define FEED_BEGIN_NEXT_EN          "Next >"
632
+#define FEED_BEGIN_TIPS_EN          "Press Next when filament\nbegins to extrude."
633
+
634
+//filament finish
635
+#define FEED_FINISH_TITLE_EN        "Load Filament"
636
+#define FEED_FINISH_MATERIAL_EN     "Material:"
637
+#define FEED_FINISH_PLA_EN          "Model-PLA"
638
+#define FEED_FINISH_NEXT_EN         "Finish >"
639
+#define FEED_FINISH_TIPS_EN         "Remove filament from the\nnozzle and discard."
640
+//fiament remove
641
+#define REMOVE_SPOOL_TITLE_EN       "Unload Filament"
642
+#define REMOVE_SPOOL_PREVIOUS_EN     "< Previous"
643
+#define REMOVE_SPOOL_FINISH_EN      "Finish >"
644
+#define REMOVE_SPOOL_MATERIAL_EN    "Material:"
645
+#define REMOVE_SPOOL_PLA_EN         "Model-PLA"
646
+#define REMOVE_SPOOL_TIPS_EN        "Remove the spool and pull\nfilament out of the machine."
647
+
648
+#define FILAMENT_SUPPORT_PVA_EN     "Support-PVA"
649
+#define LOAD_FINISH_EN              "Load\nFilament\nComplete"
650
+#define UNLOAD_FINISH_EN            "Unload\nFilament\nComplete"
651
+
652
+//manual ip
653
+#define MANUAL_IP_TITLE_EN          "Manual IP"
654
+#define MANUAL_IP_CANCEL_EN          "< Cancel"
655
+#define MANUAL_IP_APPLY_EN          "Join >"
656
+#define MANUAL_IP_ADDRESS_EN        "IP Address"
657
+#define MANUAL_IP_MASK_EN           "Subnet Mask"
658
+#define MANUAL_IP_GATEWAY_EN        "Default Gateway"
659
+#define MANUAL_IP_SERVER_EN         "Name Server"
660
+#define MANUAL_IP_INIT_DATA_EN      "0.0.0.0"
661
+#define MANUAL_TEXT_POINT_EN         "."
662
+#define MANUAL_TEXT_ENTER_EN        "enter"
663
+
664
+//Wifi name
665
+//#define TEXT_WIFI_MENU_TITLE_EN "WI-FI"
666
+//#define TEXT_WIFI_SAPCE_EN  "space"
667
+//#define TEXT_WIFI_LETTER_EN  "abc"
668
+//#define TEXT_WIFI_DIGITAL_EN  "123"
669
+//#define TEXT_WIFI_SYMBOL_EN  "#+="
670
+//#define TEXT_WIFI_PASSWORD_EN "Password"
671
+
672
+//#define TEXT_WIFI_POINT_BOLD_EN "`"
673
+
674
+//#define TEXT_WIFI_JOINING_EN  "Joining\nNetwork..."
675
+//#define TEXT_WIFI_FAILED_JOIN_EN  "Failed to\nJoin Wi-Fi"
676
+//#define TEXT_WIFI_WIFI_CONECTED_EN "Wi-Fi\nConnected"
677
+
678
+//#define TEXT_BUTTON_DISCONECTED_EN "Disconnect"
679
+//#define TEXT_WIFI_FORGET_EN "Forget Network"
680
+//#define TEXT_DISCONECTED_EN "Wi-Fi Connected"
681
+
682
+#define TEXT_FORGET_TIPS_TITLE_EN "Forget Network"
683
+#define TEXT_FORGET_NETWORK_TIPS1_EN "Are you sure you want to\nforget this network?"
684
+#define TEXT_FORGET_NETWORK_TIPS2_EN "This machine will no longer\njoin this Wi-Fi Network."
685
+
686
+#define TEXT_IPADDRESS_EN "IP Address: "
687
+
688
+#define TEXT_BUILD_FROM_CURA_CANCEL_TIPS1_EN "Are you sure you want to\ncancel this build?"
689
+#define TEXT_BUILD_FROM_CURA_CANCEL_TIPS2_EN "The model will be deleted\nfrom this machine.It will\nneed to be resent from your\ncomputer before it can be\nbuilt in the future."
690
+
691
+#define DIALOG_CONFIRM_EN2              "Confirm"
692
+
693
+#define HEATING_TITLE_EN  "Heating"
694
+#define LEVELING_TITLE_EN  "Leveling"
695
+
696
+#define ABOUT_SPARK_ADD_EN "Spark+"
697
+
698
+#define TEXT_RECEIVING_DATA_EN "Receiving Data"
699
+
700
+#define TEXT_BABY_STEP_EN "Babystep"
701
+
702
+#define PRINTING_OTHER_LANGUGE              "Printing"
703
+#define PRINTING_OPERATION_OTHER_LANGUGE    "Operation"
704
+#define PRINTING_PAUSE_OTHER_LANGUGE        "Pause"
705
+
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"

+ 276
- 0
Marlin/src/lcd/extui/lib/mks_ui/tft_Language_fr.h View File

@@ -0,0 +1,276 @@
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 <http://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+#pragma once
23
+
24
+//*************法文****************************//
25
+#define TOOL_TEXT_FR                  "prêt"
26
+#define PREHEAT_TEXT_FR               "Préchauffe"
27
+#define MOVE_TEXT_FR                  "Déplace"
28
+#define HOME_TEXT_FR                  "Acceuil"
29
+#define PRINT_TEXT_FR                 "Impression"
30
+#define EXTRUDE_TEXT_FR               "Extruder"
31
+#define LEVELING_TEXT_FR              "Leveling"
32
+#define AUTO_LEVELING_TEXT_FR         "AutoLevel"
33
+#define SET_TEXT_FR                   "Config"
34
+#define MORE_TEXT_FR                  "Plus"
35
+
36
+#define ADD_TEXT_FR                   "Ajouter"
37
+#define DEC_TEXT_FR                   "Réduire"
38
+#define EXTRUDER_1_TEXT_FR            "Extr1"
39
+#define EXTRUDER_2_TEXT_FR            "Extr2"
40
+#define HEATBED_TEXT_FR               "Hotlit"
41
+#define TEXT_1C_FR                    "1℃"
42
+#define TEXT_5C_FR                    "5℃"
43
+#define TEXT_10C_FR                   "10℃"
44
+#define CLOSE_TEXT_FR                 "Off"
45
+
46
+#define BACK_TEXT_FR                  "Arrière"
47
+
48
+#define TOOL_PREHEAT_FR               "Préchauffe"
49
+#define TOOL_EXTRUDE_FR               "Extruder"
50
+#define TOOL_MOVE_FR                  "Déplace"
51
+#define TOOL_HOME_FR                  "Acceuil"
52
+#define TOOL_LEVELING_FR              "Leveling"
53
+#define TOOL_AUTO_LEVELING_FR         "AutoLevel"
54
+#define TOOL_FILAMENT_FR              "Filament"
55
+#define TOOL_MORE_FR                  "Plus"
56
+
57
+#define AXIS_X_ADD_TEXT_FR            "X+"
58
+#define AXIS_X_DEC_TEXT_FR            "X-"
59
+#define AXIS_Y_ADD_TEXT_FR            "Y+"
60
+#define AXIS_Y_DEC_TEXT_FR            "Y-"
61
+#define AXIS_Z_ADD_TEXT_FR            "Z+"
62
+#define AXIS_Z_DEC_TEXT_FR            "Z-"
63
+#define TEXT_01MM_FR                  "0.1mm"
64
+#define TEXT_1MM_FR                   "1mm"
65
+#define TEXT_10MM_FR                  "10mm"
66
+
67
+#define HOME_X_TEXT_FR                "X"
68
+#define HOME_Y_TEXT_FR                "Y"
69
+#define HOME_Z_TEXT_FR                "Z"
70
+#define HOME_ALL_TEXT_FR              "ALL"
71
+#define HOME_STOPMOVE_FR              "Quickstop"
72
+
73
+#define PAGE_UP_TEXT_FR               "En haut"
74
+#define PAGE_DOWN_TEXT_FR             "En bas"
75
+
76
+#define EXTRUDER_IN_TEXT_FR           "Insérer"
77
+#define EXTRUDER_OUT_TEXT_FR          "éjecter"
78
+#define EXTRUDE_1MM_TEXT_FR           "1mm"
79
+#define EXTRUDE_5MM_TEXT_FR           "5mm"
80
+#define EXTRUDE_10MM_TEXT_FR          "10mm"
81
+#define EXTRUDE_LOW_SPEED_TEXT_FR     "Lente"
82
+#define EXTRUDE_MEDIUM_SPEED_TEXT_FR  "Moyen"
83
+#define EXTRUDE_HIGH_SPEED_TEXT_FR    "Rapide"
84
+
85
+#define LEVELING_POINT1_TEXT_FR       "Premier"
86
+#define LEVELING_POINT2_TEXT_FR       "Seconde"
87
+#define LEVELING_POINT3_TEXT_FR       "Troisième"
88
+#define LEVELING_POINT4_TEXT_FR       "Quatrième"
89
+#define LEVELING_POINT5_TEXT_FR       "Cinquième"
90
+
91
+#define FILESYS_TEXT_FR               "Fichier"
92
+#define WIFI_TEXT_FR                  "WiFi"
93
+#define FAN_TEXT_FR                   "Fan"
94
+#define ABOUT_TEXT_FR                 "A propos"
95
+#define BREAK_POINT_TEXT_FR           "Continuer"
96
+#define FILAMENT_TEXT_FR              "Remplacer"
97
+#define LANGUAGE_TEXT_FR              "Langue"
98
+#define MOTOR_OFF_TEXT_FR             "M-hors"
99
+#define MOTOR_OFF_XY_TEXT_FR          "M-hors-XY"
100
+#define SHUTDOWN_TEXT_FR              "Eteindre"
101
+
102
+#define U_DISK_TEXT_FR                "Clé usb"
103
+#define SD_CARD_TEXT_FR               "Carte SD"
104
+#define WIFI_NAME_TEXT_FR             "WiFi: "
105
+#define WIFI_KEY_TEXT_FR              "Key: "
106
+#define WIFI_IP_TEXT_FR               "IP: "
107
+#define WIFI_AP_TEXT_FR               "Etat: AP"
108
+#define WIFI_STA_TEXT_FR              "Etat: STA"
109
+#define WIFI_CONNECTED_TEXT_FR        "Connecté"
110
+#define WIFI_DISCONNECTED_TEXT_FR     "Déconnecté"
111
+#define WIFI_EXCEPTION_TEXT_FR        "Exception"
112
+#define WIFI_RECONNECT_TEXT_FR        "Reconnect"
113
+#define CLOUD_TEXT_FR                 "Cloud"
114
+#define CLOUD_BIND_FR                 "Lié"
115
+#define CLOUD_UNBIND_FR               "Délier"
116
+#define CLOUD_UNBINDING_FR            "Délier"
117
+#define CLOUD_DISCONNECTED_FR         "Déconnecté"
118
+#define CLOUD_UNBINDED_FR             "Délier"
119
+#define CLOUD_BINDED_FR               "Lié"
120
+#define CLOUD_DISABLE_FR              "Désactiver"
121
+
122
+#define FAN_ADD_TEXT_FR               "Ajouter"
123
+#define FAN_DEC_TEXT_FR               "Réduire"
124
+#define FAN_OPEN_TEXT_FR              "100%"
125
+#define FAN_HALF_TEXT_FR              "50%"
126
+#define FAN_CLOSE_TEXT_FR             "0%"
127
+#define FAN_TIPS1_TEXT_FR             "ventilateur"
128
+#define FAN_TIPS2_TEXT_FR             "ventilateur\n0"
129
+
130
+#define FILAMENT_IN_TEXT_FR           "Insérer"
131
+#define FILAMENT_OUT_TEXT_FR          "éjecter"
132
+#define FILAMENT_EXT0_TEXT_FR         "Extr1"
133
+#define FILAMENT_EXT1_TEXT_FR         "Extr2"
134
+#define FILAMENT_HEAT_TEXT_FR         "Preheat"
135
+#define FILAMENT_STOP_TEXT_FR         "Arrêter"
136
+//#define FILAMENT_CHANGE_TEXT_FR     "Filament remplacer"
137
+#define FILAMENT_TIPS2_TEXT_FR        "T:"
138
+#define FILAMENT_TIPS3_TEXT_FR        "Insérer le filament..."
139
+#define FILAMENT_TIPS4_TEXT_FR        "éjecter le filament..."
140
+#define FILAMENT_TIPS5_TEXT_FR        "Température trop basse pour démarrer, chauffez svp"
141
+#define FILAMENT_TIPS6_TEXT_FR        "Terminé"
142
+
143
+#if 0
144
+  #define FILAMENT_REPLAYS_IDLE_TEXT_FR             "Please click <Insérer> or <éjecter> \nto replace filament!"
145
+  #define FILAMENT_CHANGE_TEXT_FR                   "Please click <Insérer> or <éjecter>,\nAfter pinter pause."
146
+  #define FILAMENT_DIALOG_LOAD_HEAT_TIPS_FR         "Heating up the nozzle,please wait..."
147
+  #define FILAMENT_DIALOG_UNLOAD_HEAT_TIPS_FR       "Heating up the nozzle,please wait..."
148
+  #define FILAMENT_DIALOG_LOAD_CONFIRM1_TIPS_FR     "Heat completed,please load filament to extruder,and click <Confirmer> for start loading."
149
+  #define FILAMENT_DIALOG_LOAD_CONFIRM2_TIPS_FR     "Please load filament to extruder,and click <Confirmer> for start loading."
150
+  #define FILAMENT_DIALOG_UNLOAD_CONFIRM_TIPS_FR    "Heat completed,please click <Confirmer> for start unloading.!"
151
+  #define FILAMENT_DIALOG_LOADING_TIPS_FR           "Is loading ,please wait!"
152
+  #define FILAMENT_DIALOG_UNLOADING_TIPS_FR         "Is unloading,please wait!"
153
+  #define FILAMENT_DIALOG_LOAD_COMPLETE_TIPS_FR     "Load filament completed,click <Confirmer> for return!"
154
+  #define FILAMENT_DIALOG_UNLOAD_COMPLETE_TIPS_FR   "Unload filament completed,click <Confirmer> for return!"
155
+#endif
156
+#define FILAMENT_CHANGE_TEXT_FR                   "Please click <Load> \nor <unload>,After \npinter pause."
157
+#define FILAMENT_DIALOG_LOAD_HEAT_TIPS_FR         "Heating up the nozzle,\nplease wait..."
158
+#define FILAMENT_DIALOG_UNLOAD_HEAT_TIPS_FR       "Heating up the nozzle,\nplease wait..."
159
+#define FILAMENT_DIALOG_LOAD_CONFIRM1_TIPS_FR     "Heat completed,please load filament \nto extruder,and click <confirm> \nfor start loading."
160
+#define FILAMENT_DIALOG_LOAD_CONFIRM2_TIPS_FR     "Please load filament to extruder,\nand click <confirm> for start loading."
161
+#define FILAMENT_DIALOG_UNLOAD_CONFIRM_TIPS_FR    "Heat completed,please \nclick <confirm> for start unloading.!"
162
+#define FILAMENT_DIALOG_LOADING_TIPS_FR           "Is loading ,please wait!"
163
+#define FILAMENT_DIALOG_UNLOADING_TIPS_FR         "Is unloading,please wait!"
164
+#define FILAMENT_DIALOG_LOAD_COMPLETE_TIPS_FR     "Load filament completed,\nclick <confirm> for return!"
165
+#define FILAMENT_DIALOG_UNLOAD_COMPLETE_TIPS_FR   "Unload filament completed,\nclick <confirm> for return!"
166
+
167
+
168
+#define PRE_HEAT_EXT_TEXT_FR          "E"
169
+#define PRE_HEAT_BED_TEXT_FR          "Bed"
170
+
171
+#define FILE_LOADING_FR               "Chargement......"
172
+#if 0
173
+  #define NO_FILE_AND_CHECK_FR        "Aucun fichier trouvé! Insérez une carte SD ou un disque U!"
174
+#else
175
+  #define NO_FILE_AND_CHECK_FR        "Aucun fichier,vérifiez à nouveau!"
176
+#endif
177
+
178
+#define NO_FILE_FR                    "Pas de fichier!"
179
+
180
+
181
+
182
+#define EXTRUDER_TEMP_TEXT_FR         "Temper"
183
+#define EXTRUDER_E_LENGTH1_TEXT_FR    "Extruder1"
184
+#define EXTRUDER_E_LENGTH2_TEXT_FR    "Extruder2"
185
+#define EXTRUDER_E_LENGTH3_TEXT_FR    "Extruder3"
186
+
187
+#define ABOUT_TYPE_TEXT_FR            "Type: "
188
+#define ABOUT_VERSION_TEXT_FR         "Firmware: "
189
+#define ABOUT_WIFI_TEXT_FR            "Wifi: "
190
+
191
+#define PRINTING_OPERATION_FR         "Option"
192
+#define PRINTING_PAUSE_FR             "Pause"
193
+#define PRINTING_TEMP_FR              "Temp."
194
+#define PRINTING_CHANGESPEED_FR       "Speed"
195
+#define PRINTING_RESUME_FR            "Reprendre"
196
+#define PRINTING_STOP_FR              "Stop"
197
+#define PRINTING_MORE_FR              "Plus"
198
+#define PRINTING_EXTRUDER_FR          "Extruder"
199
+#define PRINTING_MOVE_FR              "Déplace"
200
+
201
+#define EXTRUDER_SPEED_FR             "Extruder"
202
+#define MOVE_SPEED_FR                 "Déplace"
203
+#define EXTRUDER_SPEED_STATE_FR       "Vitesse d'extrusion"
204
+#define MOVE_SPEED_STATE_FR           "vitesse de déplacement"
205
+#define STEP_1PERCENT_FR              "1%"
206
+#define STEP_5PERCENT_FR              "5%"
207
+#define STEP_10PERCENT_FR             "10%"
208
+
209
+#define ZOFFSET_FR                    "Z Offset"
210
+#define ZOFFSET_INC_FR                "Ajouter"
211
+#define ZOFFSET_DEC_FR                "Réduire"
212
+
213
+#define TITLE_READYPRINT_FR           "Prête"
214
+#define TITLE_PREHEAT_FR              "Préchauffe"
215
+#define TITLE_MOVE_FR                 "Déplace"
216
+#define TITLE_HOME_FR                 "Acceuil"
217
+#define TITLE_EXTRUDE_FR              "Extruder"
218
+#define TITLE_LEVELING_FR             "Leveling"
219
+#define TITLE_SET_FR                  "Paramètres"
220
+#define TITLE_MORE_FR                 "Plus"
221
+#define TITLE_CHOOSEFILE_FR           "Fichier"
222
+#define TITLE_PRINTING_FR             "Pimpression"
223
+#define TITLE_OPERATION_FR            "Option"
224
+#define TITLE_ADJUST_FR               "Réglage"
225
+#define TITLE_WIRELESS_FR             "Sans fil"
226
+#define TITLE_FILAMENT_FR             "Remplacer"
227
+#define TITLE_ABOUT_FR                "A propos"
228
+#define TITLE_FAN_FR                  "Ventilateur"
229
+#define TITLE_LANGUAGE_FR             "Langue"
230
+#define TITLE_PAUSE_FR                "Pause"
231
+#define TITLE_CHANGESPEED_FR          "Speed"
232
+#define TITLE_CLOUD_TEXT_FR           "Cloud"
233
+#define TITLE_DIALOG_CONFIRM_FR       "Confirm"
234
+#define TITLE_FILESYS_FR              "FileSys"
235
+#define TITLE_ZOFFSET_FR              "Z Offset"
236
+
237
+#define DIALOG_CLOSE_MACHINE_FR       "Closing machine......"
238
+
239
+#define AUTO_SHUTDOWN_FR              "Auto"
240
+#define MANUAL_SHUTDOWN_FR            "Manuel"
241
+
242
+#define DIALOG_CONFIRM_FR             "Confirmer"
243
+#define DIALOG_CANCLE_FR              "Annuler"
244
+#define DIALOG_OK_FR                  "OK"
245
+#define DIALOG_RESET_FR               "Réinitialiser"
246
+#define DIALOG_RETRY_FR               "Recommencez"
247
+#define DIALOG_DISABLE_FR             "Disable"
248
+#define DIALOG_PRINT_MODEL_FR         "Imprimer le fichier?"
249
+#define DIALOG_CANCEL_PRINT_FR        "Arrêter?"
250
+
251
+#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"

+ 271
- 0
Marlin/src/lcd/extui/lib/mks_ui/tft_Language_it.h View File

@@ -0,0 +1,271 @@
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 <http://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+#pragma once
23
+
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ù"
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"
45
+
46
+#define BACK_TEXT_IT                                    "Indietro"
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"
53
+#define TOOL_AUTO_LEVELING_IT         "Autolevel"
54
+#define TOOL_FILAMENT_IT                "Filamento"
55
+#define TOOL_MORE_IT                    "Di più"
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"
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"
72
+
73
+#define PAGE_UP_TEXT_IT                                 "Pagina su"
74
+#define PAGE_DOWN_TEXT_IT                               "Pagina giù"
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"
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"
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"
101
+
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"
121
+
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"
129
+
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"
142
+
143
+#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!"
155
+#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!"
166
+
167
+
168
+#define PRE_HEAT_EXT_TEXT_IT                            "E"
169
+#define PRE_HEAT_BED_TEXT_IT                            "Piano"
170
+
171
+#define FILE_LOADING_IT                                 "Caricamento......"
172
+#if 0
173
+  #define NO_FILE_AND_CHECK_IT                "Nessun file trovato! Inserisci la scheda SD o il disco U!"
174
+#endif
175
+#define NO_FILE_AND_CHECK_IT                            "Nessun file,\n          per favore controllare di nuovo!"
176
+
177
+#define NO_FILE_IT                                              "Nessun file!"
178
+
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"
183
+
184
+#define ABOUT_TYPE_TEXT_IT                                      "Type: "
185
+#define ABOUT_VERSION_TEXT_IT                           "Firmware: "
186
+#define ABOUT_WIFI_TEXT_IT                                      "WiFi: "
187
+
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"
197
+
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%"
205
+
206
+#define ZOFFSET_IT                          "Z Offset"
207
+#define ZOFFSET_INC_IT                      "Add"
208
+#define ZOFFSET_DEC_IT                      "Dec"
209
+
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"
233
+
234
+#define AUTO_SHUTDOWN_IT                                        "Auto"
235
+#define MANUAL_SHUTDOWN_IT                                      "Manuale"
236
+
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!"
255
+#define DIALOG_PRINT_TIME_IT              "Tempo di stampa: "
256
+#define DIALOG_REPRINT_IT                 "Print again"
257
+#define DIALOG_WIFI_ENABLE_TIPS_IT "The wifi module is being configured,\nplease wait a moment....."
258
+
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"

+ 272
- 0
Marlin/src/lcd/extui/lib/mks_ui/tft_Language_ru.h View File

@@ -0,0 +1,272 @@
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 <http://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+#pragma once
23
+
24
+//****************俄语***************************//
25
+#define TOOL_TEXT_RU                    "инструмент"
26
+#define PREHEAT_TEXT_RU                 " нагрев"
27
+#define MOVE_TEXT_RU                    "движение"
28
+#define HOME_TEXT_RU                    "домой"
29
+#define PRINT_TEXT_RU                   " печать"
30
+#define EXTRUDE_TEXT_RU                 "экструзия"
31
+#define LEVELING_TEXT_RU                "уровень"
32
+#define AUTO_LEVELING_TEXT_RU           "aвто"
33
+#define SET_TEXT_RU                     "настройки"
34
+#define MORE_TEXT_RU                    "больше"
35
+
36
+#define ADD_TEXT_RU                     "добавить"
37
+#define DEC_TEXT_RU                     "уменьшить"
38
+#define EXTRUDER_1_TEXT_RU              "экструдер1"
39
+#define EXTRUDER_2_TEXT_RU              "экструдер2"
40
+#define HEATBED_TEXT_RU                 "стол"
41
+#define TEXT_1C_RU                      "1℃"
42
+#define TEXT_5C_RU                      "5℃"
43
+#define TEXT_10C_RU                     "10℃"
44
+#define CLOSE_TEXT_RU                   "выкл"
45
+
46
+#define BACK_TEXT_RU                    "назад"
47
+
48
+#define TOOL_PREHEAT_RU                 "нагрев"
49
+#define TOOL_EXTRUDE_RU                 "экструзия"
50
+#define TOOL_MOVE_RU                    "движение"
51
+#define TOOL_HOME_RU                    "домой"
52
+#define TOOL_LEVELING_RU                "уровень"
53
+#define TOOL_AUTO_LEVELING_RU           "aвто"
54
+#define TOOL_FILAMENT_RU                "замена"
55
+#define TOOL_MORE_RU                    "больше"
56
+
57
+#define AXIS_X_ADD_TEXT_RU              "X+"
58
+#define AXIS_X_DEC_TEXT_RU              "X-"
59
+#define AXIS_Y_ADD_TEXT_RU              "Y+"
60
+#define AXIS_Y_DEC_TEXT_RU              "Y-"
61
+#define AXIS_Z_ADD_TEXT_RU              "Z+"
62
+#define AXIS_Z_DEC_TEXT_RU              "Z-"
63
+#define TEXT_01MM_RU                    "0.1mm"
64
+#define TEXT_1MM_RU                     "1mm"
65
+#define TEXT_10MM_RU                    "10mm"
66
+
67
+#define HOME_X_TEXT_RU                  "X"
68
+#define HOME_Y_TEXT_RU                  "Y"
69
+#define HOME_Z_TEXT_RU                  "Z"
70
+#define HOME_ALL_TEXT_RU                "Home"
71
+#define HOME_STOPMOVE_RU                "Quickstop"
72
+
73
+#define PAGE_UP_TEXT_RU                 "вверх"
74
+#define PAGE_DOWN_TEXT_RU               "вниз"
75
+
76
+#define EXTRUDER_IN_TEXT_RU             "втянуть"
77
+#define EXTRUDER_OUT_TEXT_RU            "выдавить"
78
+#define EXTRUDE_1MM_TEXT_RU             "1mm"
79
+#define EXTRUDE_5MM_TEXT_RU             "5mm"
80
+#define EXTRUDE_10MM_TEXT_RU            "10mm"
81
+#define EXTRUDE_LOW_SPEED_TEXT_RU       "мин"
82
+#define EXTRUDE_MEDIUM_SPEED_TEXT_RU    "сред"
83
+#define EXTRUDE_HIGH_SPEED_TEXT_RU      "выс"
84
+
85
+#define LEVELING_POINT1_TEXT_RU         "1точка"
86
+#define LEVELING_POINT2_TEXT_RU         "2точка"
87
+#define LEVELING_POINT3_TEXT_RU         "3точка"
88
+#define LEVELING_POINT4_TEXT_RU         "4точка"
89
+#define LEVELING_POINT5_TEXT_RU         "5точка"
90
+
91
+#define FILESYS_TEXT_RU                 "система"
92
+#define WIFI_TEXT_RU                    "WiFi"
93
+#define FAN_TEXT_RU                     "вентилятор"
94
+#define ABOUT_TEXT_RU                   "инфо"
95
+#define BREAK_POINT_TEXT_RU             "продолжить"
96
+#define FILAMENT_TEXT_RU                "замена"
97
+#define LANGUAGE_TEXT_RU                "язык"
98
+#define MOTOR_OFF_TEXT_RU               "отклмотор"
99
+#define MOTOR_OFF_XY_TEXT_RU            "Off-XY"
100
+#define SHUTDOWN_TEXT_RU                "выключение"
101
+
102
+#define U_DISK_TEXT_RU                  "U диск"
103
+#define SD_CARD_TEXT_RU                 "SD диск"
104
+#define WIFI_NAME_TEXT_RU               "WiFi: "
105
+#define WIFI_KEY_TEXT_RU                "пароль: "
106
+#define WIFI_IP_TEXT_RU                 "IP: "
107
+#define WIFI_AP_TEXT_RU                 "режим: AP"
108
+#define WIFI_STA_TEXT_RU                "режим: STA"
109
+#define WIFI_CONNECTED_TEXT_RU          "подключен"
110
+#define WIFI_DISCONNECTED_TEXT_RU       "не подключен"
111
+#define WIFI_EXCEPTION_TEXT_RU          "исключение"
112
+#define WIFI_RECONNECT_TEXT_RU          "Reconnect"
113
+#define CLOUD_TEXT_RU                   "облако"
114
+#define CLOUD_BIND_RU                   "соединён"
115
+#define CLOUD_UNBIND_RU                 "не соединён"
116
+#define CLOUD_UNBINDING_RU              "Unbinding"
117
+#define CLOUD_DISCONNECTED_RU           "Disconnected"
118
+#define CLOUD_UNBINDED_RU               "Unbinded"
119
+#define CLOUD_BINDED_RU                 "Binded"
120
+#define CLOUD_DISABLE_RU                "Disable"
121
+
122
+#define FAN_ADD_TEXT_RU                 "добавить"
123
+#define FAN_DEC_TEXT_RU                 "уменьшить"
124
+#define FAN_OPEN_TEXT_RU                "100%"
125
+#define FAN_HALF_TEXT_RU                "50%"
126
+#define FAN_CLOSE_TEXT_RU               "откл"
127
+#define FAN_TIPS1_TEXT_RU               "вентилятор"
128
+#define FAN_TIPS2_TEXT_RU               "вентилятор\nоткл"
129
+
130
+#define FILAMENT_IN_TEXT_RU             "втянуть"
131
+#define FILAMENT_OUT_TEXT_RU            "выдавить"
132
+#define FILAMENT_EXT0_TEXT_RU           "экструдер1"
133
+#define FILAMENT_EXT1_TEXT_RU           "экструдер2"
134
+#define FILAMENT_HEAT_TEXT_RU           "нагрев"
135
+#define FILAMENT_STOP_TEXT_RU           "стоп"
136
+//#define FILAMENT_CHANGE_TEXT_RU           "замена"
137
+#define FILAMENT_TIPS2_TEXT_RU          "T:"
138
+#define FILAMENT_TIPS3_TEXT_RU          "втянуть..."
139
+#define FILAMENT_TIPS4_TEXT_RU          "вядавить..."
140
+#define FILAMENT_TIPS5_TEXT_RU          "Низкая температура, \nнеобходим нагрев"
141
+#define FILAMENT_TIPS6_TEXT_RU          "завершено"
142
+
143
+#if 0
144
+  #define FILAMENT_REPLAYS_IDLE_TEXT_RU                 "Please click <втянуть> or <выдавить> \nto replace filament!"
145
+  #define FILAMENT_CHANGE_TEXT_RU                       "Please click <втянуть> or <выдавить>,\nAfter pinter pause."
146
+  #define FILAMENT_DIALOG_LOAD_HEAT_TIPS_RU             "Heating up the nozzle,please wait..."
147
+  #define FILAMENT_DIALOG_UNLOAD_HEAT_TIPS_RU           "Heating up the nozzle,please wait..."
148
+  #define FILAMENT_DIALOG_LOAD_CONFIRM1_TIPS_RU         "Heat completed,please load filament to extruder,and click <да> for start loading."
149
+  #define FILAMENT_DIALOG_LOAD_CONFIRM2_TIPS_RU         "Please load filament to extruder,and click <да> for start loading."
150
+  #define FILAMENT_DIALOG_UNLOAD_CONFIRM_TIPS_RU        "Heat completed,please click <да> for start unloading.!"
151
+  #define FILAMENT_DIALOG_LOADING_TIPS_RU               "Is loading ,please wait!"
152
+  #define FILAMENT_DIALOG_UNLOADING_TIPS_RU             "Is unloading,please wait!"
153
+  #define FILAMENT_DIALOG_LOAD_COMPLETE_TIPS_RU         "Load filament completed,click <да> for return!"
154
+  #define FILAMENT_DIALOG_UNLOAD_COMPLETE_TIPS_RU       "Unload filament completed,click <да> for return!"
155
+#endif
156
+#define FILAMENT_CHANGE_TEXT_RU                       "Please click <Load> \nor <unload>,After \npinter pause."
157
+#define FILAMENT_DIALOG_LOAD_HEAT_TIPS_RU             "Heating up the nozzle,\nplease wait..."
158
+#define FILAMENT_DIALOG_UNLOAD_HEAT_TIPS_RU           "Heating up the nozzle,\nplease wait..."
159
+#define FILAMENT_DIALOG_LOAD_CONFIRM1_TIPS_RU         "Heat completed,please load filament \nto extruder,and click <confirm> \nfor start loading."
160
+#define FILAMENT_DIALOG_LOAD_CONFIRM2_TIPS_RU         "Please load filament to extruder,\nand click <confirm> for start loading."
161
+#define FILAMENT_DIALOG_UNLOAD_CONFIRM_TIPS_RU        "Heat completed,please \nclick <confirm> for start unloading.!"
162
+#define FILAMENT_DIALOG_LOADING_TIPS_RU               "Is loading ,please wait!"
163
+#define FILAMENT_DIALOG_UNLOADING_TIPS_RU             "Is unloading,please wait!"
164
+#define FILAMENT_DIALOG_LOAD_COMPLETE_TIPS_RU         "Load filament completed,\nclick <confirm> for return!"
165
+#define FILAMENT_DIALOG_UNLOAD_COMPLETE_TIPS_RU       "Unload filament completed,\nclick <confirm> for return!"
166
+
167
+
168
+#define PRE_HEAT_EXT_TEXT_RU                "E"
169
+#define PRE_HEAT_BED_TEXT_RU                "стол"
170
+
171
+#define FILE_LOADING_RU                     "загрузка......"
172
+#if 0
173
+  #define NO_FILE_AND_CHECK_RU                "Файлы не найдены! Вставьте SD-карту или диск U!"
174
+#endif
175
+#define NO_FILE_AND_CHECK_RU                "нет файла,попробуйте ещё раз!"
176
+
177
+#define NO_FILE_RU                          "нет файла!"
178
+
179
+#define EXTRUDER_TEMP_TEXT_RU               "температура"
180
+#define EXTRUDER_E_LENGTH1_TEXT_RU          "экструзия1"
181
+#define EXTRUDER_E_LENGTH2_TEXT_RU          "экструзия2"
182
+#define EXTRUDER_E_LENGTH3_TEXT_RU          "экструзия3"
183
+
184
+#define ABOUT_TYPE_TEXT_RU                  "Type: "
185
+#define ABOUT_VERSION_TEXT_RU               "Firmware: "
186
+#define ABOUT_WIFI_TEXT_RU                  "WiFi: "
187
+
188
+#define PRINTING_OPERATION_RU               "управление"
189
+#define PRINTING_PAUSE_RU                   "пауза"
190
+#define PRINTING_TEMP_RU                    "темп"
191
+#define PRINTING_CHANGESPEED_RU             "скорости"
192
+#define PRINTING_RESUME_RU                  "возобновить"
193
+#define PRINTING_STOP_RU                    "стоп"
194
+#define PRINTING_MORE_RU                    "больше"
195
+#define PRINTING_EXTRUDER_RU                "экстр"
196
+#define PRINTING_MOVE_RU                    "движение"
197
+
198
+#define EXTRUDER_SPEED_RU                   "экстр"
199
+#define MOVE_SPEED_RU                       "движ"
200
+#define EXTRUDER_SPEED_STATE_RU             "скорость экстр"
201
+#define MOVE_SPEED_STATE_RU                 "скорость движ"
202
+#define STEP_1PERCENT_RU                    "1%"
203
+#define STEP_5PERCENT_RU                    "5%"
204
+#define STEP_10PERCENT_RU                   "10%"
205
+
206
+#define ZOFFSET_RU                          "Z Offset"
207
+#define ZOFFSET_INC_RU                      "добавить"
208
+#define ZOFFSET_DEC_RU                      "уменьшить"
209
+
210
+#define TITLE_READYPRINT_RU                 "готов к"
211
+#define TITLE_PREHEAT_RU                    "движение"
212
+#define TITLE_MOVE_RU                       "движение"
213
+#define TITLE_HOME_RU                       "Home"
214
+#define TITLE_EXTRUDE_RU                    "экструзия"
215
+#define TITLE_LEVELING_RU                   "уровень"
216
+#define TITLE_SET_RU                        "настройки"
217
+#define TITLE_MORE_RU                       "больше"
218
+#define TITLE_CHOOSEFILE_RU                 "файла"
219
+#define TITLE_PRINTING_RU                   "печать"
220
+#define TITLE_OPERATION_RU                  "управление"
221
+#define TITLE_ADJUST_RU                     "регулировать"
222
+#define TITLE_WIRELESS_RU                   "Wireless"
223
+#define TITLE_FILAMENT_RU                   "замена"
224
+#define TITLE_ABOUT_RU                      "инфо"
225
+#define TITLE_FAN_RU                        "вентилятор"
226
+#define TITLE_LANGUAGE_RU                   "язык"
227
+#define TITLE_PAUSE_RU                      "пауза"
228
+#define TITLE_CHANGESPEED_RU                "скорости"
229
+#define TILE_TOOL_RU                        "инструмент"
230
+#define TITLE_CLOUD_TEXT_RU                 "Cloud"
231
+#define TITLE_DIALOG_CONFIRM_RU             "Confirm"
232
+#define TITLE_FILESYS_RU                    "FileSys"
233
+#define TITLE_ZOFFSET_RU                    "Z Offset"
234
+
235
+#define AUTO_SHUTDOWN_RU                    "авто-откл"
236
+#define MANUAL_SHUTDOWN_RU                  "ручн-откл"
237
+
238
+#define DIALOG_CONFIRM_RU                   "да"//"подтвердить"
239
+#define DIALOG_CANCLE_RU                    "отмена"
240
+#define DIALOG_OK_RU                        "да"
241
+#define DIALOG_RESET_RU                     "сброс"
242
+#define DIALOG_RETRY_RU                     "повтор"
243
+#define DIALOG_DISABLE_RU                   "запретить"
244
+#define DIALOG_PRINT_MODEL_RU               "печать модели?"
245
+#define DIALOG_CANCEL_PRINT_RU              "стоп?"
246
+#define DIALOG_STOP_RU                      "стоп"
247
+#define DIALOG_REPRINT_FROM_BREAKPOINT_RU   "продолжить?"
248
+//#define DIALOG_UNBIND_PRINTER_RU          "разрыв?"
249
+#define DIALOG_ERROR_TIPS1_RU               "ошибка:нет файла, попробуйте ещё раз."
250
+#define DIALOG_ERROR_TIPS2_RU               "ошибка:сбой передачи. установите скорость \nпередачи данных как на плате управления!"
251
+#define DIALOG_ERROR_TIPS3_RU               "ошибка: имя файла слишком длинное!"
252
+#define DIALOG_CLOSE_MACHINE_RU             "Closing machine......"
253
+#define DIALOG_UNBIND_PRINTER_RU            "Unbind the printer?"
254
+#define DIALOG_FILAMENT_NO_PRESS_RU         "Filament detection switch is not pressed"
255
+#define DIALOG_PRINT_FINISH_RU              "Печать завершена!"
256
+#define DIALOG_PRINT_TIME_RU                "Время печати: "
257
+#define DIALOG_REPRINT_RU                   "Print again"
258
+#define DIALOG_WIFI_ENABLE_TIPS_RU          "The wifi module is being configured,\nplease wait a moment....."
259
+
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           "Распечатать"

+ 264
- 0
Marlin/src/lcd/extui/lib/mks_ui/tft_Language_s_cn.h View File

@@ -0,0 +1,264 @@
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 <http://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+#pragma once
23
+
24
+//*************简体中文***********************//
25
+#define TOOL_TEXT_CN                "工具"
26
+#define PREHEAT_TEXT_CN             "预热"
27
+#define MOVE_TEXT_CN                "移动"
28
+#define HOME_TEXT_CN                "回零"
29
+#define PRINT_TEXT_CN               "打印"
30
+#define EXTRUDE_TEXT_CN             "挤出"
31
+#define LEVELING_TEXT_CN            "调平"
32
+#define AUTO_LEVELING_TEXT_CN       "自动调平"
33
+#define SET_TEXT_CN                 "设置"
34
+#define MORE_TEXT_CN                "更多"
35
+
36
+#define ADD_TEXT_CN                 "增加"
37
+#define DEC_TEXT_CN                 "减少"
38
+#define EXTRUDER_1_TEXT_CN          "喷头1"
39
+#define EXTRUDER_2_TEXT_CN          "喷头2"
40
+#define HEATBED_TEXT_CN             "热床"
41
+#define TEXT_1C_CN                  "1℃"
42
+#define TEXT_5C_CN                  "5℃"
43
+#define TEXT_10C_CN                 "10℃"
44
+#define CLOSE_TEXT_CN               "关闭"
45
+
46
+#define BACK_TEXT_CN                "返回"
47
+
48
+#define TOOL_PREHEAT_CN             "预热"
49
+#define TOOL_EXTRUDE_CN             "挤出"
50
+#define TOOL_MOVE_CN                "移动"
51
+#define TOOL_HOME_CN                "回零"
52
+#define TOOL_LEVELING_CN            "调平"
53
+#define TOOL_AUTO_LEVELING_CN       "自动调平"
54
+#define TOOL_FILAMENT_CN            "换料"
55
+#define TOOL_MORE_CN                "更多"
56
+
57
+#define AXIS_X_ADD_TEXT_CN          "X+"
58
+#define AXIS_X_DEC_TEXT_CN          "X-"
59
+#define AXIS_Y_ADD_TEXT_CN          "Y+"
60
+#define AXIS_Y_DEC_TEXT_CN          "Y-"
61
+#define AXIS_Z_ADD_TEXT_CN          "Z+"
62
+#define AXIS_Z_DEC_TEXT_CN          "Z-"
63
+#define TEXT_01MM_CN                "0.1mm"
64
+#define TEXT_1MM_CN                 "1mm"
65
+#define TEXT_10MM_CN                "10mm"
66
+
67
+#define HOME_X_TEXT_CN              "X"
68
+#define HOME_Y_TEXT_CN              "Y"
69
+#define HOME_Z_TEXT_CN              "Z"
70
+#define HOME_ALL_TEXT_CN            "回零"
71
+#define HOME_STOPMOVE_CN            "急停"
72
+
73
+#define PAGE_UP_TEXT_CN             "上一页"
74
+#define PAGE_DOWN_TEXT_CN           "下一页"
75
+
76
+#define EXTRUDER_IN_TEXT_CN         "进料"
77
+#define EXTRUDER_OUT_TEXT_CN        "退料"
78
+#define EXTRUDE_1MM_TEXT_CN         "1mm"
79
+#define EXTRUDE_5MM_TEXT_CN         "5mm"
80
+#define EXTRUDE_10MM_TEXT_CN        "10mm"
81
+#define EXTRUDE_LOW_SPEED_TEXT_CN   "低速"
82
+#define EXTRUDE_MEDIUM_SPEED_TEXT_CN "常速"
83
+#define EXTRUDE_HIGH_SPEED_TEXT_CN  "高速"
84
+
85
+#define LEVELING_POINT1_TEXT_CN   "第一点"
86
+#define LEVELING_POINT2_TEXT_CN   "第二点"
87
+#define LEVELING_POINT3_TEXT_CN   "第三点"
88
+#define LEVELING_POINT4_TEXT_CN   "第四点"
89
+#define LEVELING_POINT5_TEXT_CN   "第五点"
90
+
91
+#define FILESYS_TEXT_CN           "文件系统"
92
+#define WIFI_TEXT_CN              "WIFI"
93
+#define FAN_TEXT_CN               "风扇"
94
+#define ABOUT_TEXT_CN             "关于"
95
+#define BREAK_POINT_TEXT_CN       "断点续打"
96
+#define FILAMENT_TEXT_CN          "换料"
97
+#define LANGUAGE_TEXT_CN          "语言"
98
+#define MOTOR_OFF_TEXT_CN         "关闭电机"
99
+#define MOTOR_OFF_XY_TEXT_CN      "关闭XY"
100
+#define SHUTDOWN_TEXT_CN          "关机"
101
+
102
+#define U_DISK_TEXT_CN            "U盘"
103
+#define SD_CARD_TEXT_CN           "SD卡"
104
+#define WIFI_NAME_TEXT_CN         "无线网络:"
105
+#define WIFI_KEY_TEXT_CN          "密码: "
106
+#define WIFI_IP_TEXT_CN           "IP: "
107
+#define WIFI_AP_TEXT_CN           "状态: AP"
108
+#define WIFI_STA_TEXT_CN          "状态: STA"
109
+#define WIFI_CONNECTED_TEXT_CN    "已连接"
110
+#define WIFI_DISCONNECTED_TEXT_CN "未连接"
111
+#define WIFI_EXCEPTION_TEXT_CN    "模块异常"
112
+#define CLOUD_TEXT_CN             "云服务"
113
+#define CLOUD_BIND_CN             "已绑定"
114
+#define CLOUD_UNBIND_CN           "解绑"
115
+#define CLOUD_UNBINDING_CN        "解绑中"
116
+#define CLOUD_DISCONNECTED_CN     "未连接"
117
+#define CLOUD_UNBINDED_CN         "未绑定"
118
+#define CLOUD_BINDED_CN           "已绑定"
119
+#define CLOUD_DISABLE_CN          "已禁用"
120
+
121
+#define FAN_ADD_TEXT_CN           "增加"
122
+#define FAN_DEC_TEXT_CN           "减少"
123
+#define FAN_OPEN_TEXT_CN          "100%"
124
+#define FAN_HALF_TEXT_CN          "50%"
125
+#define FAN_CLOSE_TEXT_CN         "关闭"
126
+#define FAN_TIPS1_TEXT_CN         "风扇"
127
+#define FAN_TIPS2_TEXT_CN         "FAN\nClose"
128
+
129
+#define FILAMENT_IN_TEXT_CN       "进料"
130
+#define FILAMENT_OUT_TEXT_CN      "退料"
131
+#define FILAMENT_EXT0_TEXT_CN     "喷头1"
132
+#define FILAMENT_EXT1_TEXT_CN     "喷头2"
133
+#define FILAMENT_HEAT_TEXT_CN     "预热"
134
+#define FILAMENT_STOP_TEXT_CN     "停止"
135
+#if 0
136
+  #define FILAMENT_REPLAYS_IDLE_TEXT_CN "请按<进料>或<退料>进行换料!"
137
+  #define FILAMENT_CHANGE_TEXT_CN   "待打印机暂停后,请按<进料>或<退料>进行换料!"
138
+#else
139
+  #define FILAMENT_CHANGE_TEXT_CN   "待打印机暂停后,\n请按<进料>或<退料>"
140
+#endif
141
+
142
+#define FILAMENT_DIALOG_LOAD_HEAT_TIPS_CN       "准备进料,正在加热,请稍等!"
143
+#define FILAMENT_DIALOG_UNLOAD_HEAT_TIPS_CN     "准备退料,正在加热,请稍等!"
144
+#define FILAMENT_DIALOG_LOAD_CONFIRM1_TIPS_CN   "加热完成,请装载耗材后,按<确定>开始进料!"
145
+#define FILAMENT_DIALOG_LOAD_CONFIRM2_TIPS_CN   "请装载耗材,按<确定>开始进料!"
146
+#define FILAMENT_DIALOG_UNLOAD_CONFIRM_TIPS_CN  "加热完成,请按<确定>开始退料!"
147
+#define FILAMENT_DIALOG_LOADING_TIPS_CN         "正在进料,请等待耗材加载完成!"
148
+#define FILAMENT_DIALOG_UNLOADING_TIPS_CN       "正在退料,请等待耗材卸载完成!"
149
+#define FILAMENT_DIALOG_LOAD_COMPLETE_TIPS_CN   "进料完成,请按<确定>返回"
150
+#define FILAMENT_DIALOG_UNLOAD_COMPLETE_TIPS_CN "退料完成,请按<确定>返回"
151
+
152
+#define FILAMENT_TIPS3_TEXT_CN      "正在进料"
153
+#define FILAMENT_TIPS4_TEXT_CN      "正在退料"
154
+#define FILAMENT_TIPS5_TEXT_CN      "温度太低,请先预热"
155
+#define FILAMENT_TIPS6_TEXT_CN      "换料完成"
156
+
157
+#define PRE_HEAT_EXT_TEXT_CN        "喷头"
158
+#define PRE_HEAT_BED_TEXT_CN        "热床"
159
+
160
+#define FILE_LOADING_CN             "正在载入......"
161
+#define NO_FILE_AND_CHECK_CN        "无文件!请插入sd卡或u盘!"
162
+#define NO_FILE_CN                  "无文件!"
163
+
164
+#define EXTRUDER_TEMP_TEXT_CN       "温度"
165
+#define EXTRUDER_E_LENGTH1_TEXT_CN  "喷头"
166
+#define EXTRUDER_E_LENGTH2_TEXT_CN  "喷头"
167
+#define EXTRUDER_E_LENGTH3_TEXT_CN  "喷头"
168
+
169
+#define ABOUT_TYPE_TEXT_CN          "Type: "
170
+#define ABOUT_VERSION_TEXT_CN       "Firmware: "
171
+#define ABOUT_WIFI_TEXT_CN          "Wifi: "
172
+
173
+#define PRINTING_OPERATION_CN       "操作"
174
+#define PRINTING_PAUSE_CN           "暂停"
175
+#define PRINTING_TEMP_CN            "温度"
176
+#define PRINTING_CHANGESPEED_CN     "变速"
177
+#define PRINTING_RESUME_CN          "恢复"
178
+#define PRINTING_STOP_CN            "停止"
179
+#define PRINTING_MORE_CN            "更多"
180
+#define PRINTING_EXTRUDER_CN        "挤出"
181
+#define PRINTING_MOVE_CN            "移动"
182
+
183
+#define EXTRUDER_SPEED_CN           "挤出"
184
+#define MOVE_SPEED_CN               "移动"
185
+#define EXTRUDER_SPEED_STATE_CN     "挤出速度"
186
+#define MOVE_SPEED_STATE_CN         "移动速度"
187
+#define STEP_1PERCENT_CN            "1%"
188
+#define STEP_5PERCENT_CN            "5%"
189
+#define STEP_10PERCENT_CN           "10%"
190
+
191
+#define ZOFFSET_CN                  "Z Offset"
192
+#define ZOFFSET_INC_CN              "增加"
193
+#define ZOFFSET_DEC_CN              "减少"
194
+
195
+#define TITLE_READYPRINT_CN         "准备打印"
196
+#define TITLE_PREHEAT_CN            "预热"
197
+#define TITLE_MOVE_CN               "移动"
198
+#define TITLE_HOME_CN               "回零"
199
+#define TITLE_EXTRUDE_CN            "挤出"
200
+#define TITLE_LEVELING_CN           "调平"
201
+#define TITLE_SET_CN                "设置"
202
+#define TITLE_MORE_CN               "更多"
203
+#define TITLE_CHOOSEFILE_CN         "选择文件"
204
+#define TITLE_PRINTING_CN           "正在打印"
205
+#define TITLE_OPERATION_CN          "操作"
206
+#define TITLE_ADJUST_CN             "调整"
207
+#define TITLE_WIRELESS_CN           "无线网络"
208
+#define TITLE_FILAMENT_CN           "换料"
209
+#define TITLE_ABOUT_CN              "关于"
210
+#define TITLE_FAN_CN                "风扇"
211
+#define TITLE_LANGUAGE_CN           "语言"
212
+#define TITLE_PAUSE_CN              "暂停"
213
+#define TITLE_CHANGESPEED_CN        "变速"
214
+#define TITLE_CLOUD_TEXT_CN         "云服务"
215
+#define TITLE_DIALOG_CONFIRM_CN     "确认"
216
+#define TITLE_FILESYS_CN            "文件系统"
217
+#define TITLE_ZOFFSET_CN            "Z Offset"
218
+
219
+#define AUTO_SHUTDOWN_CN            "自动关机"
220
+#define MANUAL_SHUTDOWN_CN          "手动关机"
221
+
222
+#define DIALOG_CONFIRM_CN           "确定"
223
+#define DIALOG_CANCLE_CN            "取消"
224
+#define DIALOG_OK_CN                "确认"
225
+#define DIALOG_RESET_CN             "重置"
226
+#define DIALOG_DISABLE_CN           "禁用"
227
+#define DIALOG_PRINT_MODEL_CN       "打印模型?"
228
+#define DIALOG_CANCEL_PRINT_CN      "停止打印?"
229
+#define DIALOG_RETRY_CN             "重试"
230
+#define DIALOG_STOP_CN              "停止"
231
+#define DIALOG_REPRINT_FROM_BREAKPOINT_CN   "从断点续打?"
232
+//#define DIALOG_UNBIND_PRINTER_CN  "解除绑定 ?"
233
+#define DIALOG_ERROR_TIPS1_CN       "错误:找不到文件,请插入sd卡/u盘!"
234
+#define DIALOG_ERROR_TIPS2_CN       "错误:通信失败,请检查波特率或主板硬件!"
235
+#define DIALOG_ERROR_TIPS3_CN       "错误:文件名或文件路径太长 !"
236
+#define DIALOG_CLOSE_MACHINE_CN     "正在关机......"
237
+#define DIALOG_UNBIND_PRINTER_CN    "解除绑定?"
238
+#define DIALOG_FILAMENT_NO_PRESS_CN "请先装载耗材!"
239
+#define DIALOG_PRINT_FINISH_CN      "打印完成!"
240
+#define DIALOG_PRINT_TIME_CN        "打印时间: "
241
+#define DIALOG_REPRINT_CN           "再打印一次"
242
+#define DIALOG_WIFI_ENABLE_TIPS_CN  "wifi模块正在配置中,请稍等......"
243
+
244
+#define TEXT_VALUE_CN               "%d℃/%d℃"
245
+#define EXTRUDE_TEXT_VALUE_T_CN     ": %d℃"
246
+#define WIFI_RECONNECT_TEXT_CN      "重新连接"
247
+
248
+#define PRINTING_GBK                "正在打印"
249
+#define PRINTING_OPERATION_GBK      "操作"
250
+#define PRINTING_PAUSE_GBK          "暂停"
251
+
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   "打印"

+ 279
- 0
Marlin/src/lcd/extui/lib/mks_ui/tft_Language_sp.h View File

@@ -0,0 +1,279 @@
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 <http://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+#pragma once
23
+
24
+//****************西班牙语***************************
25
+#define TOOL_TEXT_SP            "Ajustes"
26
+#define PREHEAT_TEXT_SP         "Precalentar"//"precalent\nar"
27
+#define MOVE_TEXT_SP            "Mover"
28
+#define HOME_TEXT_SP            "Origen"
29
+#define PRINT_TEXT_SP           "Imprimir"
30
+#define EXTRUDE_TEXT_SP         "Extrusor"
31
+#define LEVELING_TEXT_SP        "Leveling"//"nivelac\nión"
32
+#define AUTO_LEVELING_TEXT_SP   "Autolevel"//"auto\nnivelación"
33
+#define SET_TEXT_SP             "Config"
34
+#define MORE_TEXT_SP            "Más"
35
+
36
+#define ADD_TEXT_SP             "Más"
37
+#define DEC_TEXT_SP             "Menos"
38
+#define EXTRUDER_1_TEXT_SP      "Extrusor1: "
39
+#define EXTRUDER_2_TEXT_SP      "Extrusor2: "
40
+#define HEATBED_TEXT_SP         "Cama: "
41
+#define TEXT_1C_SP              "1℃"
42
+#define TEXT_5C_SP              "5℃"
43
+#define TEXT_10C_SP             "10℃"
44
+#define CLOSE_TEXT_SP           "Apagar"
45
+
46
+#define BACK_TEXT_SP            "Atrás"
47
+
48
+#define TOOL_PREHEAT_SP         "Precalentar"
49
+#define TOOL_EXTRUDE_SP         "Extrusor"
50
+#define TOOL_MOVE_SP            "Mover"
51
+#define TOOL_HOME_SP            "Origen"
52
+#define TOOL_LEVELING_SP        "Leveling"
53
+#define TOOL_AUTO_LEVELING_SP   "Autolevel"
54
+#define TOOL_FILAMENT_SP        "Filamento"
55
+#define TOOL_MORE_SP            "Más"
56
+
57
+#define AXIS_X_ADD_TEXT_SP      "X+"
58
+#define AXIS_X_DEC_TEXT_SP      "X-"
59
+#define AXIS_Y_ADD_TEXT_SP      "Y+"
60
+#define AXIS_Y_DEC_TEXT_SP      "Y-"
61
+#define AXIS_Z_ADD_TEXT_SP      "Z+"
62
+#define AXIS_Z_DEC_TEXT_SP      "Z-"
63
+#define TEXT_01MM_SP            "0.1mm"
64
+#define TEXT_1MM_SP             "1mm"
65
+#define TEXT_10MM_SP            "10mm"
66
+
67
+#define HOME_X_TEXT_SP          "EJE X"
68
+#define HOME_Y_TEXT_SP          "EJE Y"
69
+#define HOME_Z_TEXT_SP          "EJE Z"
70
+#define HOME_ALL_TEXT_SP        "TODOS"
71
+#define HOME_STOPMOVE_SP        "Quickstop"
72
+
73
+#define PAGE_UP_TEXT_SP         "Arriba"
74
+#define PAGE_DOWN_TEXT_SP       "Abajo"
75
+
76
+#define EXTRUDER_IN_TEXT_SP             "Dentro"
77
+#define EXTRUDER_OUT_TEXT_SP            "Fuera"
78
+#define EXTRUDE_1MM_TEXT_SP             "1mm"
79
+#define EXTRUDE_5MM_TEXT_SP             "5mm"
80
+#define EXTRUDE_10MM_TEXT_SP            "10mm"
81
+#define EXTRUDE_LOW_SPEED_TEXT_SP       "Baja"
82
+#define EXTRUDE_MEDIUM_SPEED_TEXT_SP    "Media"
83
+#define EXTRUDE_HIGH_SPEED_TEXT_SP      "Alta"
84
+
85
+#define LEVELING_POINT1_TEXT_SP         "Primero"
86
+#define LEVELING_POINT2_TEXT_SP         "Segundo"
87
+#define LEVELING_POINT3_TEXT_SP         "Tercero"
88
+#define LEVELING_POINT4_TEXT_SP         "Cuarto"
89
+#define LEVELING_POINT5_TEXT_SP         "Quinto"
90
+
91
+#define FILESYS_TEXT_SP         "Puerto"
92
+#define WIFI_TEXT_SP            "WiFi"
93
+#define FAN_TEXT_SP             "Ventilador"
94
+#define ABOUT_TEXT_SP           "Acerca"
95
+#define BREAK_POINT_TEXT_SP     "Continuar"
96
+#define FILAMENT_TEXT_SP        "Filamento"
97
+#define LANGUAGE_TEXT_SP        "Language"
98
+#define MOTOR_OFF_TEXT_SP       "Apagar motor"
99
+#define MOTOR_OFF_XY_TEXT_SP    "Off-XY"
100
+#define SHUTDOWN_TEXT_SP        "Apagar"
101
+
102
+#define U_DISK_TEXT_SP              "PENDRIVE"
103
+#define SD_CARD_TEXT_SP             "SD"
104
+#define WIFI_NAME_TEXT_SP           "WIFI: "
105
+#define WIFI_KEY_TEXT_SP            "Contraseña: "
106
+#define WIFI_IP_TEXT_SP             "IP: "
107
+#define WIFI_AP_TEXT_SP             "Estado: AP"
108
+#define WIFI_STA_TEXT_SP            "Estado: STA"
109
+#define WIFI_CONNECTED_TEXT_SP      "Conectado"
110
+#define WIFI_DISCONNECTED_TEXT_SP   "Desconectado"
111
+#define WIFI_EXCEPTION_TEXT_SP      "Excepción"
112
+#define WIFI_RECONNECT_TEXT_SP      "Reconnect"
113
+#define CLOUD_TEXT_SP               "Nube"
114
+#define CLOUD_BIND_SP               "Atado"
115
+#define CLOUD_UNBIND_SP             "Sin atar"
116
+#define CLOUD_UNBINDING_SP          "Unbinding"
117
+#define CLOUD_DISCONNECTED_SP       "Disconnected"
118
+#define CLOUD_UNBINDED_SP           "Unbinded"
119
+#define CLOUD_BINDED_SP             "Binded"
120
+#define CLOUD_DISABLE_SP            "Disable"
121
+
122
+#define FAN_ADD_TEXT_SP             "Más"
123
+#define FAN_DEC_TEXT_SP             "Menos"
124
+#define FAN_OPEN_TEXT_SP            "100%"
125
+#define FAN_HALF_TEXT_SP            "50%"
126
+#define FAN_CLOSE_TEXT_SP           "0%"
127
+#define FAN_TIPS1_TEXT_SP           "ventilador"
128
+#define FAN_TIPS2_TEXT_SP           "ventilador\n0"
129
+
130
+#define FILAMENT_IN_TEXT_SP         "Dentro"
131
+#define FILAMENT_OUT_TEXT_SP        "Fuera"
132
+#define FILAMENT_EXT0_TEXT_SP       "Extrusor1"
133
+#define FILAMENT_EXT1_TEXT_SP       "Extrusor2"
134
+#define FILAMENT_HEAT_TEXT_SP       "Precalentar"
135
+#define FILAMENT_STOP_TEXT_SP       "Parar"
136
+//#define FILAMENT_CHANGE_TEXT_SP   "Filamento"
137
+#define FILAMENT_TIPS2_TEXT_SP      "T:"
138
+#define FILAMENT_TIPS3_TEXT_SP      "Dentro..."
139
+#define FILAMENT_TIPS4_TEXT_SP      "Fuera..."
140
+#define FILAMENT_TIPS5_TEXT_SP      "Temperatura demasiado baja, por favor calentar"
141
+#define FILAMENT_TIPS6_TEXT_SP      "Completado"
142
+#if 0
143
+  #define FILAMENT_REPLAYS_IDLE_TEXT_SP           "Please click <Dentro> or <Fuera> \nto replace filament!"
144
+  #define FILAMENT_CHANGE_TEXT_SP                 "Please click <Dentro> or <Fuera>,\nAfter pinter pause."
145
+  #define FILAMENT_DIALOG_LOAD_HEAT_TIPS_SP       "Calentando el extrusor, por favor espere..."
146
+  #define FILAMENT_DIALOG_UNLOAD_HEAT_TIPS_SP     "Calentando el extrusor, por favor espere..."
147
+  #define FILAMENT_DIALOG_LOAD_CONFIRM1_TIPS_SP   "Temperatura alcanzada.Inserte el filamento y luego presione\"Confirmar\"para comenzar la carga."
148
+  #define FILAMENT_DIALOG_LOAD_CONFIRM2_TIPS_SP   "Inserte el filamento y luego presione\"Confirmar\"para comenzar la carga."
149
+  #define FILAMENT_DIALOG_UNLOAD_CONFIRM_TIPS_SP  "Temperatura alcanzada.Presione\"Confirmar\"para retirar el filamento."
150
+  #define FILAMENT_DIALOG_LOADING_TIPS_SP         "Cargando filamento,por favor espere."
151
+  #define FILAMENT_DIALOG_UNLOADING_TIPS_SP       "Retirando filamento,por favor espere."
152
+  #define FILAMENT_DIALOG_LOAD_COMPLETE_TIPS_SP   "Filamento cargado,presione\"Confirmar\"."
153
+  #define FILAMENT_DIALOG_UNLOAD_COMPLETE_TIPS_SP "Filamento retirado,presione\"Confirmar\"."
154
+#else
155
+  #define FILAMENT_CHANGE_TEXT_SP                 "Please click <Load> \nor <unload>,After \npinter pause."
156
+  #define FILAMENT_DIALOG_LOAD_HEAT_TIPS_SP       "Calentando el extrusor,\npor favor espere..."
157
+  #define FILAMENT_DIALOG_UNLOAD_HEAT_TIPS_SP     "Calentando el extrusor,\npor favor espere..."
158
+  #define FILAMENT_DIALOG_LOAD_CONFIRM1_TIPS_SP   "Temperatura alcanzada.Inserte el \nfilamento y luego presione\"Confirmar\"\npara comenzar la carga."
159
+  #define FILAMENT_DIALOG_LOAD_CONFIRM2_TIPS_SP   "Inserte el filamento y \nluego presione\"Confirmar\"para \ncomenzar la carga."
160
+  #define FILAMENT_DIALOG_UNLOAD_CONFIRM_TIPS_SP  "Temperatura alcanzada.\nPresione\"Confirmar\"para retirar \nel filamento."
161
+  #define FILAMENT_DIALOG_LOADING_TIPS_SP         "Cargando filamento,\npor favor espere."
162
+  #define FILAMENT_DIALOG_UNLOADING_TIPS_SP       "Retirando filamento,\npor favor espere."
163
+  #define FILAMENT_DIALOG_LOAD_COMPLETE_TIPS_SP   "Filamento cargado,\npresione\"Confirmar\"."
164
+  #define FILAMENT_DIALOG_UNLOAD_COMPLETE_TIPS_SP "Filamento retirado,\npresione\"Confirmar\"."
165
+#endif
166
+
167
+#define PRE_HEAT_EXT_TEXT_SP        "Extrusor"
168
+#define PRE_HEAT_BED_TEXT_SP        "cama"
169
+
170
+#define FILE_LOADING_SP             "Cargando......"
171
+#if 0
172
+  #define NO_FILE_AND_CHECK_SP        "No se encontraron archivos! Por favor, inserte la tarjeta SD o el disco U!"
173
+#endif
174
+#define NO_FILE_AND_CHECK_SP        "Archivo no encontrado,\n         por favor insertar SD o disco USB!"
175
+
176
+#define NO_FILE_SP                  "Sin archivo!"
177
+
178
+
179
+
180
+#define EXTRUDER_TEMP_TEXT_SP       "Temper"
181
+#define EXTRUDER_E_LENGTH1_TEXT_SP  "Extrusor1"
182
+#define EXTRUDER_E_LENGTH2_TEXT_SP  "Extrusor2"
183
+#define EXTRUDER_E_LENGTH3_TEXT_SP  "Extrusor3"
184
+
185
+#define ABOUT_TYPE_TEXT_SP          "Pantalla: "
186
+#define ABOUT_VERSION_TEXT_SP       "Firmware: "
187
+#define ABOUT_WIFI_TEXT_SP          "WiFi: "
188
+
189
+#define PRINTING_OPERATION_SP       "Ajustes"
190
+#define PRINTING_PAUSE_SP           "Pausar"
191
+#define PRINTING_TEMP_SP            "Temp."
192
+#define PRINTING_CHANGESPEED_SP     "Velocidad"
193
+#define PRINTING_RESUME_SP          "Resumir"
194
+#define PRINTING_STOP_SP            "Detener"
195
+#define PRINTING_MORE_SP            "Más"
196
+#define PRINTING_EXTRUDER_SP        "Extrusor"
197
+#define PRINTING_MOVE_SP            "Mover"
198
+
199
+#define EXTRUDER_SPEED_SP           "Extrusor"
200
+#define MOVE_SPEED_SP               "Mover"
201
+#define EXTRUDER_SPEED_STATE_SP     "Extrusión"
202
+#define MOVE_SPEED_STATE_SP         "Movimiento"
203
+#define STEP_1PERCENT_SP            "1%"
204
+#define STEP_5PERCENT_SP            "5%"
205
+#define STEP_10PERCENT_SP           "10%"
206
+
207
+#define ZOFFSET_SP                  "Z Offset"
208
+#define ZOFFSET_INC_SP              "Más"
209
+#define ZOFFSET_DEC_SP              "Menos"
210
+
211
+#define TITLE_READYPRINT_SP         "Inicio"
212
+#define TITLE_PREHEAT_SP            "Precalentar"
213
+#define TITLE_MOVE_SP               "Mover"
214
+#define TITLE_HOME_SP               "Origen"
215
+#define TITLE_EXTRUDE_SP            "Extrusor"
216
+#define TITLE_LEVELING_SP           "Leveling"
217
+#define TITLE_SET_SP                "Config"
218
+#define TITLE_MORE_SP               "Más"
219
+#define TITLE_CHOOSEFILE_SP         "Imprimir"
220
+#define TITLE_PRINTING_SP           "Imprimir"
221
+#define TITLE_OPERATION_SP          "Ajustes"
222
+#define TITLE_ADJUST_SP             "Temp."
223
+#define TITLE_WIRELESS_SP           "Wireless"
224
+#define TITLE_FILAMENT_SP           "Filamento"
225
+#define TITLE_ABOUT_SP              "Acerca"
226
+#define TITLE_FAN_SP                "Ventilador"
227
+#define TITLE_LANGUAGE_SP           "Language"
228
+#define TITLE_PAUSE_SP              "Pausar"
229
+#define TITLE_CHANGESPEED_SP        "Velocidad"
230
+#define TILE_TOOL_SP                "Ajustes"
231
+#define TITLE_CLOUD_TEXT_SP         "Cloud"
232
+#define TITLE_DIALOG_CONFIRM_SP     "Confirmar"
233
+#define TITLE_FILESYS_SP            "Puerto"
234
+#define TITLE_ZOFFSET_SP            "Z Offset"
235
+
236
+#define AUTO_SHUTDOWN_SP            "Auto"
237
+#define MANUAL_SHUTDOWN_SP          "manual"
238
+
239
+#define DIALOG_CONFIRM_SP           "Confirmar"
240
+#define DIALOG_CANCLE_SP            "Cancelar"
241
+#define DIALOG_OK_SP                "OK"
242
+#define DIALOG_RESET_SP             "Resetear"
243
+#define DIALOG_RETRY_SP             "Reintentar"
244
+#define DIALOG_DISABLE_SP           "Desactivar"
245
+#define DIALOG_PRINT_MODEL_SP       "¿Está seguro?"
246
+#define DIALOG_CANCEL_PRINT_SP      "¿Está seguro que desea detener la impresión?"
247
+
248
+#define DIALOG_RETRY_SP               "Reintentar"
249
+#define DIALOG_STOP_SP                "Stop"
250
+#define DIALOG_REPRINT_FROM_BREAKPOINT_SP   "Reprint from breakpoint?"
251
+//#define DIALOG_UNBIND_PRINTER_SP    "Unbind the printer?"
252
+#define DIALOG_ERROR_TIPS1_SP         "Error:archivo no encontrado, \npor favor insertar SD o disco USB."
253
+#define DIALOG_ERROR_TIPS2_SP         "error:transacción fallida, \nconfigurar  baudrate del \ndisplay para la placa base!"
254
+#define DIALOG_ERROR_TIPS3_SP         "Error : nombre de archivo o \nruta demasiado largo!"
255
+#define DIALOG_CLOSE_MACHINE_SP       "Closing machine......"
256
+#define DIALOG_UNBIND_PRINTER_SP      "Unbind the printer?"
257
+#define DIALOG_FILAMENT_NO_PRESS_SP   "Filament detection switch is not pressed"
258
+#define DIALOG_PRINT_FINISH_SP        "¡La impresión está completa!"
259
+#define DIALOG_PRINT_TIME_SP          "Tiempo de impresión: "
260
+#define DIALOG_REPRINT_SP             "Print again"
261
+#define DIALOG_WIFI_ENABLE_TIPS_SP    "The wifi module is being configured,\nplease wait a moment....."
262
+
263
+#define PRINTING_SP                 "Imprimiendo"
264
+#define PRINTING_AJUSTES_SP         "Ajustes"
265
+#define PRINTING_PAUSAR_SP          "Pausar"
266
+
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"

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


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

@@ -0,0 +1,273 @@
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 <http://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+
23
+#include "../../../../inc/MarlinConfig.h"
24
+
25
+#if ENABLED(TFT_LITTLE_VGL_UI)
26
+
27
+  #if defined(ARDUINO_ARCH_STM32F1) && PIN_EXISTS(FSMC_CS) // FSMC on 100/144 pins SoCs
28
+
29
+    #include <libmaple/fsmc.h>
30
+    #include <libmaple/gpio.h>
31
+    #include <libmaple/dma.h>
32
+    #include <boards.h>
33
+
34
+/* Timing configuration */
35
+    #define FSMC_ADDRESS_SETUP_TIME   15// AddressSetupTime
36
+    #define FSMC_DATA_SETUP_TIME      15// DataSetupTime
37
+
38
+    void LCD_IO_Init(uint8_t cs, uint8_t rs);
39
+    void LCD_IO_WriteData(uint16_t RegValue);
40
+    void LCD_IO_WriteReg(uint16_t Reg);
41
+    uint16_t LCD_IO_ReadData(uint16_t RegValue);
42
+    uint32_t LCD_IO_ReadData(uint16_t RegValue, uint8_t ReadSize);
43
+    uint16_t ILI9488_ReadRAM();
44
+    #ifdef LCD_USE_DMA_FSMC
45
+      void LCD_IO_WriteMultiple(uint16_t data, uint32_t count);
46
+      void LCD_IO_WriteSequence(uint16_t *data, uint16_t length);
47
+    #endif
48
+
49
+/**
50
+ * FSMC LCD IO
51
+ */
52
+    #define __ASM __asm
53
+    #define __STATIC_INLINE static inline
54
+
55
+    __attribute__((always_inline)) __STATIC_INLINE void __DSB() {__ASM volatile ("dsb 0xF" ::: "memory");}
56
+
57
+    #define FSMC_CS_NE1   PD7
58
+
59
+    #if ENABLED(STM32_XL_DENSITY)
60
+      #define FSMC_CS_NE2 PG9
61
+      #define FSMC_CS_NE3 PG10
62
+      #define FSMC_CS_NE4 PG12
63
+
64
+      #define FSMC_RS_A0  PF0
65
+      #define FSMC_RS_A1  PF1
66
+      #define FSMC_RS_A2  PF2
67
+      #define FSMC_RS_A3  PF3
68
+      #define FSMC_RS_A4  PF4
69
+      #define FSMC_RS_A5  PF5
70
+      #define FSMC_RS_A6  PF12
71
+      #define FSMC_RS_A7  PF13
72
+      #define FSMC_RS_A8  PF14
73
+      #define FSMC_RS_A9  PF15
74
+      #define FSMC_RS_A10 PG0
75
+      #define FSMC_RS_A11 PG1
76
+      #define FSMC_RS_A12 PG2
77
+      #define FSMC_RS_A13 PG3
78
+      #define FSMC_RS_A14 PG4
79
+      #define FSMC_RS_A15 PG5
80
+    #endif
81
+
82
+    #define FSMC_RS_A16   PD11
83
+    #define FSMC_RS_A17   PD12
84
+    #define FSMC_RS_A18   PD13
85
+    #define FSMC_RS_A19   PE3
86
+    #define FSMC_RS_A20   PE4
87
+    #define FSMC_RS_A21   PE5
88
+    #define FSMC_RS_A22   PE6
89
+    #define FSMC_RS_A23   PE2
90
+
91
+    #if ENABLED(STM32_XL_DENSITY)
92
+      #define FSMC_RS_A24 PG13
93
+      #define FSMC_RS_A25 PG14
94
+    #endif
95
+
96
+    static uint8_t fsmcInit = 0;
97
+
98
+    typedef struct {
99
+      __IO uint16_t REG;
100
+      __IO uint16_t RAM;
101
+    } LCD_CONTROLLER_TypeDef;
102
+
103
+    LCD_CONTROLLER_TypeDef *LCD;
104
+
105
+    void LCD_IO_Init(uint8_t cs, uint8_t rs) {
106
+      uint32_t controllerAddress;
107
+
108
+      if (fsmcInit) return;
109
+      fsmcInit = 1;
110
+
111
+      switch (cs) {
112
+        case FSMC_CS_NE1: controllerAddress = (uint32_t)FSMC_NOR_PSRAM_REGION1; break;
113
+          #if ENABLED(STM32_XL_DENSITY)
114
+        case FSMC_CS_NE2: controllerAddress = (uint32_t)FSMC_NOR_PSRAM_REGION2; break;
115
+        case FSMC_CS_NE3: controllerAddress = (uint32_t)FSMC_NOR_PSRAM_REGION3; break;
116
+        case FSMC_CS_NE4: controllerAddress = (uint32_t)FSMC_NOR_PSRAM_REGION4; break;
117
+          #endif
118
+        default: return;
119
+      }
120
+
121
+      #define _ORADDR(N) controllerAddress |= (_BV32(N) - 2)
122
+
123
+      switch (rs) {
124
+        #if ENABLED(STM32_XL_DENSITY)
125
+        case FSMC_RS_A0:  _ORADDR( 1); break;
126
+        case FSMC_RS_A1:  _ORADDR( 2); break;
127
+        case FSMC_RS_A2:  _ORADDR( 3); break;
128
+        case FSMC_RS_A3:  _ORADDR( 4); break;
129
+        case FSMC_RS_A4:  _ORADDR( 5); break;
130
+        case FSMC_RS_A5:  _ORADDR( 6); break;
131
+        case FSMC_RS_A6:  _ORADDR( 7); break;
132
+        case FSMC_RS_A7:  _ORADDR( 8); break;
133
+        case FSMC_RS_A8:  _ORADDR( 9); break;
134
+        case FSMC_RS_A9:  _ORADDR(10); break;
135
+        case FSMC_RS_A10: _ORADDR(11); break;
136
+        case FSMC_RS_A11: _ORADDR(12); break;
137
+        case FSMC_RS_A12: _ORADDR(13); break;
138
+        case FSMC_RS_A13: _ORADDR(14); break;
139
+        case FSMC_RS_A14: _ORADDR(15); break;
140
+        case FSMC_RS_A15: _ORADDR(16); break;
141
+        #endif
142
+        case FSMC_RS_A16: _ORADDR(17); break;
143
+        case FSMC_RS_A17: _ORADDR(18); break;
144
+        case FSMC_RS_A18: _ORADDR(19); break;
145
+        case FSMC_RS_A19: _ORADDR(20); break;
146
+        case FSMC_RS_A20: _ORADDR(21); break;
147
+        case FSMC_RS_A21: _ORADDR(22); break;
148
+        case FSMC_RS_A22: _ORADDR(23); break;
149
+        case FSMC_RS_A23: _ORADDR(24); break;
150
+          #if ENABLED(STM32_XL_DENSITY)
151
+        case FSMC_RS_A24: _ORADDR(25); break;
152
+        case FSMC_RS_A25: _ORADDR(26); break;
153
+          #endif
154
+        default: return;
155
+      }
156
+
157
+      rcc_clk_enable(RCC_FSMC);
158
+
159
+      gpio_set_mode(GPIOD, 14, GPIO_AF_OUTPUT_PP); // FSMC_D00
160
+      gpio_set_mode(GPIOD, 15, GPIO_AF_OUTPUT_PP); // FSMC_D01
161
+      gpio_set_mode(GPIOD,  0, GPIO_AF_OUTPUT_PP);// FSMC_D02
162
+      gpio_set_mode(GPIOD,  1, GPIO_AF_OUTPUT_PP);// FSMC_D03
163
+      gpio_set_mode(GPIOE,  7, GPIO_AF_OUTPUT_PP);// FSMC_D04
164
+      gpio_set_mode(GPIOE,  8, GPIO_AF_OUTPUT_PP);// FSMC_D05
165
+      gpio_set_mode(GPIOE,  9, GPIO_AF_OUTPUT_PP);// FSMC_D06
166
+      gpio_set_mode(GPIOE, 10, GPIO_AF_OUTPUT_PP); // FSMC_D07
167
+      gpio_set_mode(GPIOE, 11, GPIO_AF_OUTPUT_PP); // FSMC_D08
168
+      gpio_set_mode(GPIOE, 12, GPIO_AF_OUTPUT_PP); // FSMC_D09
169
+      gpio_set_mode(GPIOE, 13, GPIO_AF_OUTPUT_PP); // FSMC_D10
170
+      gpio_set_mode(GPIOE, 14, GPIO_AF_OUTPUT_PP); // FSMC_D11
171
+      gpio_set_mode(GPIOE, 15, GPIO_AF_OUTPUT_PP); // FSMC_D12
172
+      gpio_set_mode(GPIOD,  8, GPIO_AF_OUTPUT_PP);// FSMC_D13
173
+      gpio_set_mode(GPIOD,  9, GPIO_AF_OUTPUT_PP);// FSMC_D14
174
+      gpio_set_mode(GPIOD, 10, GPIO_AF_OUTPUT_PP); // FSMC_D15
175
+
176
+      gpio_set_mode(GPIOD,  4, GPIO_AF_OUTPUT_PP);// FSMC_NOE
177
+      gpio_set_mode(GPIOD,  5, GPIO_AF_OUTPUT_PP);// FSMC_NWE
178
+
179
+      gpio_set_mode(PIN_MAP[cs].gpio_device, PIN_MAP[cs].gpio_bit, GPIO_AF_OUTPUT_PP); //FSMC_CS_NEx
180
+      gpio_set_mode(PIN_MAP[rs].gpio_device, PIN_MAP[rs].gpio_bit, GPIO_AF_OUTPUT_PP); //FSMC_RS_Ax
181
+
182
+      #if ENABLED(STM32_XL_DENSITY)
183
+        FSMC_NOR_PSRAM4_BASE->BCR = FSMC_BCR_WREN | FSMC_BCR_MTYP_SRAM | FSMC_BCR_MWID_16BITS | FSMC_BCR_MBKEN;
184
+        FSMC_NOR_PSRAM4_BASE->BTR = (FSMC_DATA_SETUP_TIME << 8) | FSMC_ADDRESS_SETUP_TIME;
185
+      #else // PSRAM1 for STM32F103V (high density)
186
+        FSMC_NOR_PSRAM1_BASE->BCR = FSMC_BCR_WREN | FSMC_BCR_MTYP_SRAM | FSMC_BCR_MWID_16BITS | FSMC_BCR_MBKEN;
187
+        FSMC_NOR_PSRAM1_BASE->BTR = (FSMC_DATA_SETUP_TIME << 8) | FSMC_ADDRESS_SETUP_TIME;
188
+      #endif
189
+
190
+      afio_remap(AFIO_REMAP_FSMC_NADV);
191
+
192
+      LCD = (LCD_CONTROLLER_TypeDef*)controllerAddress;
193
+    }
194
+
195
+    void LCD_IO_WriteData(uint16_t RegValue) {
196
+      LCD->RAM = RegValue;
197
+      __DSB();
198
+    }
199
+
200
+    void LCD_IO_WriteReg(uint16_t Reg) {
201
+      LCD->REG = Reg;
202
+      __DSB();
203
+    }
204
+
205
+    uint16_t LCD_IO_ReadData(uint16_t RegValue) {
206
+      LCD->REG = RegValue;
207
+      __DSB();
208
+
209
+      return LCD->RAM;
210
+    }
211
+
212
+    uint16_t ILI9488_ReadRAM() {
213
+      uint16_t data;
214
+      data = LCD->RAM;
215
+      return data;
216
+    }
217
+
218
+    uint32_t LCD_IO_ReadData(uint16_t RegValue, uint8_t ReadSize) {
219
+      volatile uint32_t data;
220
+      LCD->REG = RegValue;
221
+      __DSB();
222
+
223
+      data = LCD->RAM; // dummy read
224
+      data = LCD->RAM & 0x00FF;
225
+
226
+      while (--ReadSize) {
227
+        data <<= 8;
228
+        data |= (LCD->RAM & 0x00FF);
229
+      }
230
+      return uint32_t(data);
231
+    }
232
+
233
+    #if ENABLED(LCD_USE_DMA_FSMC)
234
+
235
+    void LCD_IO_WriteMultiple(uint16_t color, uint32_t count) {
236
+      while (count > 0) {
237
+        dma_setup_transfer(FSMC_DMA_DEV, FSMC_DMA_CHANNEL, &color, DMA_SIZE_16BITS, &LCD->RAM, DMA_SIZE_16BITS, DMA_MEM_2_MEM);
238
+        dma_set_num_transfers(FSMC_DMA_DEV, FSMC_DMA_CHANNEL, count > 65535 ? 65535 : count);
239
+        dma_clear_isr_bits(FSMC_DMA_DEV, FSMC_DMA_CHANNEL);
240
+        dma_enable(FSMC_DMA_DEV, FSMC_DMA_CHANNEL);
241
+
242
+        while ((dma_get_isr_bits(FSMC_DMA_DEV, FSMC_DMA_CHANNEL) & 0x0A) == 0) {}
243
+        dma_disable(FSMC_DMA_DEV, FSMC_DMA_CHANNEL);
244
+
245
+        count = count > 65535 ? count - 65535 : 0;
246
+      }
247
+    }
248
+
249
+    void LCD_IO_WriteSequence(uint16_t *data, uint16_t length) {
250
+      dma_setup_transfer(FSMC_DMA_DEV, FSMC_DMA_CHANNEL, data, DMA_SIZE_16BITS, &LCD->RAM, DMA_SIZE_16BITS, DMA_MEM_2_MEM | DMA_PINC_MODE);
251
+      dma_set_num_transfers(FSMC_DMA_DEV, FSMC_DMA_CHANNEL, length);
252
+      dma_clear_isr_bits(FSMC_DMA_DEV, FSMC_DMA_CHANNEL);
253
+      dma_enable(FSMC_DMA_DEV, FSMC_DMA_CHANNEL);
254
+
255
+      while ((dma_get_isr_bits(FSMC_DMA_DEV, FSMC_DMA_CHANNEL) & 0x0A) == 0) {}
256
+      dma_disable(FSMC_DMA_DEV, FSMC_DMA_CHANNEL);
257
+    }
258
+
259
+    void LCD_IO_WriteSequence_Async(uint16_t *data, uint16_t length) {
260
+      dma_setup_transfer(FSMC_DMA_DEV, FSMC_DMA_CHANNEL, data, DMA_SIZE_16BITS, &LCD->RAM, DMA_SIZE_16BITS, DMA_MEM_2_MEM | DMA_PINC_MODE);
261
+      dma_set_num_transfers(FSMC_DMA_DEV, FSMC_DMA_CHANNEL, length);
262
+      dma_clear_isr_bits(FSMC_DMA_DEV, FSMC_DMA_CHANNEL);
263
+      dma_enable(FSMC_DMA_DEV, FSMC_DMA_CHANNEL);
264
+    }
265
+
266
+    void LCD_IO_WaitSequence_Async() {
267
+      while ((dma_get_isr_bits(FSMC_DMA_DEV, FSMC_DMA_CHANNEL) & 0x0A) == 0) {}
268
+      dma_disable(FSMC_DMA_DEV, FSMC_DMA_CHANNEL);
269
+    }
270
+
271
+    #endif // LCD_USE_DMA_FSMC
272
+  #endif // ARDUINO_ARCH_STM32F1 && FSMC_CS_PIN
273
+#endif // TFT_LITTLE_VGL_UI

+ 30
- 0
Marlin/src/lcd/extui/lib/mks_ui/tft_fsmc.h View File

@@ -0,0 +1,30 @@
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 <http://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+#pragma once
23
+
24
+#ifdef __cplusplus
25
+extern "C" { /* C-declarations for C++ */
26
+#endif
27
+
28
+#ifdef __cplusplus
29
+} /* C-declarations for C++ */
30
+#endif

+ 791
- 0
Marlin/src/lcd/extui/lib/mks_ui/tft_lvgl_configuration.cpp View File

@@ -0,0 +1,791 @@
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 <http://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+
23
+/**
24
+ * @file lcd_lvgl_configuration.c
25
+ * @date    2020-02-21
26
+ */
27
+
28
+#include "../../../../inc/MarlinConfigPre.h"
29
+
30
+#if ENABLED(TFT_LITTLE_VGL_UI)
31
+
32
+  #include "../../../../MarlinCore.h"
33
+
34
+  #include "tft_lvgl_configuration.h"
35
+  #include "lvgl.h"
36
+  #include "../../../../feature/touch/xpt2046.h"
37
+  #include "draw_ready_print.h"
38
+  #include "W25Qxx.h"
39
+  #include "pic_manager.h"
40
+
41
+  #include "mks_hardware_test.h"
42
+  #include "draw_ui.h"
43
+
44
+  #if ENABLED(POWER_LOSS_RECOVERY)
45
+    #include "../../../../feature/powerloss.h"
46
+  #endif
47
+
48
+  #include <SPI.h>
49
+
50
+  #if ENABLED(SPI_GRAPHICAL_TFT)
51
+    #include "SPI_TFT.h"
52
+  #endif
53
+
54
+//#include "../../Configuration.h"
55
+//#include "../../src/core/macros.h"
56
+
57
+  extern void LCD_IO_Init(uint8_t cs, uint8_t rs);
58
+  extern void LCD_IO_WriteData(uint16_t RegValue);
59
+  extern void LCD_IO_WriteReg(uint16_t Reg);
60
+
61
+  extern void LCD_IO_WriteMultiple(uint16_t color, uint32_t count);
62
+
63
+  extern void init_gb2312_font();
64
+
65
+  static lv_disp_buf_t disp_buf;
66
+//static lv_color_t buf[LV_HOR_RES_MAX * 18];
67
+//static lv_color_t buf[10*5];
68
+//extern lv_obj_t * scr;
69
+  #if ENABLED(SDSUPPORT)
70
+    extern void UpdatePic();
71
+    extern void UpdateFont();
72
+  #endif
73
+  uint16_t DeviceCode = 0x9488;
74
+  extern uint8_t sel_id;
75
+
76
+  #define SetCs
77
+  #define ClrCs
78
+
79
+  #define  HDP  799//Horizontal Display Period     //**
80
+  #define  HT   1000//Horizontal Total
81
+  #define  HPS  51//LLINE Pulse Start Position
82
+  #define  LPS  3 //  Horizontal Display Period Start Position
83
+  #define  HPW  8 //  LLINE Pulse Width
84
+
85
+  #define  VDP  479//Vertical Display Period
86
+  #define  VT   530//Vertical Total
87
+  #define  VPS  24//  LFRAME Pulse Start Position
88
+  #define  FPS  23//Vertical Display Period Start Positio
89
+  #define  VPW  3 // LFRAME Pulse Width     //**
90
+
91
+  #define MAX_HZ_POSX HDP+1
92
+  #define MAX_HZ_POSY VDP+1
93
+
94
+  extern uint8_t gcode_preview_over, flash_preview_begin, default_preview_flg;
95
+
96
+  void SysTick_Callback() {
97
+    lv_tick_inc(1);
98
+    print_time_count();
99
+  }
100
+
101
+  void tft_set_cursor(uint16_t x, uint16_t y) {
102
+    #if 0
103
+    if (DeviceCode == 0x8989) {
104
+      LCD_WriteReg(0x004E, y);        //行
105
+      LCD_WriteReg(0x004F, x);  //列
106
+    }
107
+    else if ((DeviceCode == 0x9919)) {
108
+      LCD_WriteReg(0x004E, x); // 行
109
+      LCD_WriteReg(0x004F, y); // 列
110
+    }
111
+    else if ((DeviceCode == 0x5761)) {    //SSD1963
112
+      LCD_WrtReg(0x002A);
113
+      LCD_WrtRAM(x >> 8);
114
+      LCD_WrtRAM(x & 0x00FF);
115
+      LCD_WrtRAM(HDP >> 8);
116
+      LCD_WrtRAM(HDP & 0x00FF);
117
+      LCD_WrtReg(0x002B);
118
+      LCD_WrtRAM(y >> 8);
119
+      LCD_WrtRAM(y & 0x00FF);
120
+      LCD_WrtRAM(VDP >> 8);
121
+      LCD_WrtRAM(VDP & 0x00FF);
122
+    }
123
+    else if (DeviceCode == 0x9488) {
124
+      ILI9488_WriteCmd(0x002A);
125
+      ILI9488_WriteData(x >> 8);
126
+      ILI9488_WriteData(x & 0x00FF);
127
+      ILI9488_WriteData(x >> 8);
128
+      ILI9488_WriteData(x & 0x00FF);
129
+      //ILI9488_WriteData(0x01);
130
+      //ILI9488_WriteData(0xDF);
131
+      ILI9488_WriteCmd(0x002B);
132
+      ILI9488_WriteData(y >> 8);
133
+      ILI9488_WriteData(y & 0x00FF);
134
+      ILI9488_WriteData(y >> 8);
135
+      ILI9488_WriteData(y & 0x00FF);
136
+      //ILI9488_WriteData(0x01);
137
+      //ILI9488_WriteData(0x3F);
138
+    }
139
+    else {
140
+      LCD_WriteReg(0x0020, y); // 行
141
+      LCD_WriteReg(0x0021, 0x13f - x); // 列
142
+    }
143
+    #else // if 0
144
+      LCD_IO_WriteReg(0x002A);
145
+      LCD_IO_WriteData(x >> 8);
146
+      LCD_IO_WriteData(x & 0x00FF);
147
+      LCD_IO_WriteData(x >> 8);
148
+      LCD_IO_WriteData(x & 0x00FF);
149
+      //ILI9488_WriteData(0x01);
150
+      //ILI9488_WriteData(0xDF);
151
+      LCD_IO_WriteReg(0x002B);
152
+      LCD_IO_WriteData(y >> 8);
153
+      LCD_IO_WriteData(y & 0x00FF);
154
+      LCD_IO_WriteData(y >> 8);
155
+      LCD_IO_WriteData(y & 0x00FF);
156
+      //ILI9488_WriteData(0x01);
157
+      //ILI9488_WriteData(0x3F);
158
+    #endif // if 0
159
+  }
160
+
161
+  void LCD_WriteRAM_Prepare(void) {
162
+    #if 0
163
+    if ((DeviceCode == 0x9325) || (DeviceCode == 0x9328) || (DeviceCode == 0x8989)) {
164
+      ClrCs
165
+      LCD->LCD_REG = R34;
166
+      SetCs
167
+    }
168
+    else {
169
+      LCD_WrtReg(0x002C);
170
+    }
171
+    #else
172
+      LCD_IO_WriteReg(0x002C);
173
+    #endif
174
+  }
175
+
176
+  void tft_set_point(uint16_t x, uint16_t y, uint16_t point) {
177
+    //if (DeviceCode == 0x9488) {
178
+    if ((x > 480) || (y > 320)) return;
179
+    //}
180
+    //**if ( (x>320)||(y>240) ) return;
181
+    tft_set_cursor(x, y); /*设置光标位置*/
182
+
183
+    LCD_WriteRAM_Prepare();   /* 开始写入GRAM*/
184
+    //LCD_WriteRAM(point);
185
+    LCD_IO_WriteData(point);
186
+  }
187
+
188
+  void LCD_WriteReg(uint16_t LCD_Reg, uint16_t LCD_RegValue) {
189
+    /* Write 16-bit Index, then Write Reg */
190
+    ClrCs
191
+      LCD_IO_WriteReg(LCD_Reg);
192
+    /* Write 16-bit Reg */
193
+    LCD_IO_WriteData(LCD_RegValue);
194
+    SetCs
195
+  }
196
+
197
+  void ili9320_SetWindows(uint16_t StartX, uint16_t StartY, uint16_t width, uint16_t heigh) {
198
+    uint16_t s_h, s_l, e_h, e_l;
199
+
200
+    uint16_t xEnd, yEnd;
201
+    xEnd = StartX + width;
202
+    yEnd = StartY + heigh - 1;
203
+    if (DeviceCode == 0x8989) {
204
+      /*LCD_WriteReg(0x0044, (StartX & 0xFF) | (xEnd << 8));
205
+      LCD_WriteReg(0x0045, StartY);
206
+      LCD_WriteReg(0x0046, yEnd);*/
207
+      LCD_WriteReg(0x0044, (StartY & 0xFF) | (yEnd << 8));
208
+      LCD_WriteReg(0x0045, StartX);
209
+      LCD_WriteReg(0x0046, xEnd);
210
+    }
211
+    else if (DeviceCode == 0x9488) {
212
+      s_h = (StartX >> 8) & 0x00ff;
213
+      s_l = StartX & 0x00ff;
214
+      e_h = ((StartX + width - 1) >> 8) & 0x00ff;
215
+      e_l = (StartX + width - 1) & 0x00ff;
216
+
217
+      LCD_IO_WriteReg(0x002A);
218
+      LCD_IO_WriteData(s_h);
219
+      LCD_IO_WriteData(s_l);
220
+      LCD_IO_WriteData(e_h);
221
+      LCD_IO_WriteData(e_l);
222
+
223
+      s_h = (StartY >> 8) & 0x00ff;
224
+      s_l = StartY & 0x00ff;
225
+      e_h = ((StartY + heigh - 1) >> 8) & 0x00ff;
226
+      e_l = (StartY + heigh - 1) & 0x00ff;
227
+
228
+      LCD_IO_WriteReg(0x002B);
229
+      LCD_IO_WriteData(s_h);
230
+      LCD_IO_WriteData(s_l);
231
+      LCD_IO_WriteData(e_h);
232
+      LCD_IO_WriteData(e_l);
233
+    }
234
+    else if ((DeviceCode == 0x9325) || (DeviceCode == 0x9328) || (DeviceCode == 0x1505)) {
235
+      /* LCD_WriteReg(0x0050, StartX);
236
+       LCD_WriteReg(0x0052, StartY);
237
+       LCD_WriteReg(0x0051, xEnd);
238
+       LCD_WriteReg(0x0053, yEnd);*/
239
+      LCD_WriteReg(0x0050, StartY);      //Specify the start/end positions of the window address in the horizontal direction by an address unit
240
+      LCD_WriteReg(0x0051, yEnd);      //Specify the start positions of the window address in the vertical direction by an address unit
241
+      LCD_WriteReg(0x0052, 320 - xEnd);
242
+      LCD_WriteReg(0x0053, 320 - StartX - 1);      //Specify the end positions of the window address in the vertical direction by an address unit
243
+
244
+    }
245
+    else {
246
+      s_h = (StartX >> 8) & 0xFF;
247
+      s_l = StartX & 0xFF;
248
+      e_h = ((StartX + width - 1) >> 8) & 0xFF;
249
+      e_l = (StartX + width - 1) & 0xFF;
250
+
251
+      LCD_IO_WriteReg(0x2A);
252
+      LCD_IO_WriteData(s_h);
253
+      LCD_IO_WriteData(s_l);
254
+      LCD_IO_WriteData(e_h);
255
+      LCD_IO_WriteData(e_l);
256
+
257
+      s_h = (StartY >> 8) & 0xFF;
258
+      s_l = StartY & 0xFF;
259
+      e_h = ((StartY + heigh - 1) >> 8) & 0xFF;
260
+      e_l = (StartY + heigh - 1) & 0xFF;
261
+
262
+      LCD_IO_WriteReg(0x2B);
263
+      LCD_IO_WriteData(s_h);
264
+      LCD_IO_WriteData(s_l);
265
+      LCD_IO_WriteData(e_h);
266
+      LCD_IO_WriteData(e_l);
267
+    }
268
+  }
269
+
270
+  void LCD_Clear(uint16_t Color) {
271
+    uint32_t index = 0;
272
+    unsigned int count;
273
+
274
+    if (DeviceCode == 0x9488) {
275
+      tft_set_cursor(0, 0);
276
+      ili9320_SetWindows(0, 0, 480, 320);
277
+      LCD_WriteRAM_Prepare();
278
+      //index = (160*480);
279
+      for (index = 0; index < 320 * 480; index++)
280
+        LCD_IO_WriteData(Color);
281
+      //LCD_IO_WriteMultiple(Color, (480*320));
282
+      //while(index --) LCD_IO_WriteData(Color);
283
+    }
284
+    else if (DeviceCode == 0x5761) {
285
+      LCD_IO_WriteReg(0x002a);
286
+      LCD_IO_WriteData(0);
287
+      LCD_IO_WriteData(0);
288
+      LCD_IO_WriteData(HDP >> 8);
289
+      LCD_IO_WriteData(HDP & 0x00ff);
290
+      LCD_IO_WriteReg(0x002b);
291
+      LCD_IO_WriteData(0);
292
+      LCD_IO_WriteData(0);
293
+      LCD_IO_WriteData(VDP >> 8);
294
+      LCD_IO_WriteData(VDP & 0x00ff);
295
+      LCD_IO_WriteReg(0x002c);
296
+      LCD_IO_WriteReg(0x002c);
297
+      for (count = 0; count < (HDP + 1) * (VDP + 1); count++)
298
+        LCD_IO_WriteData(Color);
299
+    }
300
+    else {
301
+      tft_set_cursor(0, 0);
302
+      LCD_WriteRAM_Prepare(); /* Prepare to write GRAM */
303
+      for (index = 0; index < 76800; index++)
304
+        LCD_IO_WriteData(Color);
305
+    }
306
+  }
307
+
308
+  extern uint16_t ILI9488_ReadRAM();
309
+
310
+  #if DISABLED(SPI_GRAPHICAL_TFT)
311
+
312
+  void init_tft() {
313
+    uint16_t i;
314
+    //************* Start Initial Sequence **********//
315
+
316
+    LCD_IO_Init(FSMC_CS_PIN, FSMC_RS_PIN);
317
+
318
+    _delay_ms(5);
319
+
320
+    LCD_IO_WriteReg(0x00D3);
321
+    DeviceCode = ILI9488_ReadRAM(); //dummy read
322
+    DeviceCode = ILI9488_ReadRAM();
323
+    DeviceCode = ILI9488_ReadRAM();
324
+    DeviceCode <<= 8;
325
+    DeviceCode |= ILI9488_ReadRAM();
326
+
327
+    if (DeviceCode == 0x9488) {
328
+      LCD_IO_WriteReg(0x00E0);
329
+      LCD_IO_WriteData(0x0000);
330
+      LCD_IO_WriteData(0x0007);
331
+      LCD_IO_WriteData(0x000f);
332
+      LCD_IO_WriteData(0x000D);
333
+      LCD_IO_WriteData(0x001B);
334
+      LCD_IO_WriteData(0x000A);
335
+      LCD_IO_WriteData(0x003c);
336
+      LCD_IO_WriteData(0x0078);
337
+      LCD_IO_WriteData(0x004A);
338
+      LCD_IO_WriteData(0x0007);
339
+      LCD_IO_WriteData(0x000E);
340
+      LCD_IO_WriteData(0x0009);
341
+      LCD_IO_WriteData(0x001B);
342
+      LCD_IO_WriteData(0x001e);
343
+      LCD_IO_WriteData(0x000f);
344
+
345
+      LCD_IO_WriteReg(0x00E1);
346
+      LCD_IO_WriteData(0x0000);
347
+      LCD_IO_WriteData(0x0022);
348
+      LCD_IO_WriteData(0x0024);
349
+      LCD_IO_WriteData(0x0006);
350
+      LCD_IO_WriteData(0x0012);
351
+      LCD_IO_WriteData(0x0007);
352
+      LCD_IO_WriteData(0x0036);
353
+      LCD_IO_WriteData(0x0047);
354
+      LCD_IO_WriteData(0x0047);
355
+      LCD_IO_WriteData(0x0006);
356
+      LCD_IO_WriteData(0x000a);
357
+      LCD_IO_WriteData(0x0007);
358
+      LCD_IO_WriteData(0x0030);
359
+      LCD_IO_WriteData(0x0037);
360
+      LCD_IO_WriteData(0x000f);
361
+
362
+      LCD_IO_WriteReg(0x00C0);
363
+      LCD_IO_WriteData(0x0010);
364
+      LCD_IO_WriteData(0x0010);
365
+
366
+      LCD_IO_WriteReg(0x00C1);
367
+      LCD_IO_WriteData(0x0041);
368
+
369
+      LCD_IO_WriteReg(0x00C5);
370
+      LCD_IO_WriteData(0x0000);
371
+      LCD_IO_WriteData(0x0022);
372
+      LCD_IO_WriteData(0x0080);
373
+
374
+      LCD_IO_WriteReg(0x0036);
375
+      //ILI9488_WriteData(0x0068);
376
+      //if (gCfgItems.overturn_180 != 0xEE)
377
+      //{
378
+      LCD_IO_WriteData(0x0068);
379
+      //}
380
+      //else
381
+      //{
382
+      //ILI9488_WriteData(0x00A8);
383
+      //}
384
+
385
+      LCD_IO_WriteReg(0x003A); //Interface Mode Control
386
+      LCD_IO_WriteData(0x0055);
387
+
388
+      LCD_IO_WriteReg(0x00B0);  //Interface Mode Control
389
+      LCD_IO_WriteData(0x0000);
390
+      LCD_IO_WriteReg(0x00B1);   //Frame rate 70HZ
391
+      LCD_IO_WriteData(0x00B0);
392
+      LCD_IO_WriteData(0x0011);
393
+      LCD_IO_WriteReg(0x00B4);
394
+      LCD_IO_WriteData(0x0002);
395
+      LCD_IO_WriteReg(0x00B6); //RGB/MCU Interface Control
396
+      LCD_IO_WriteData(0x0002);
397
+      LCD_IO_WriteData(0x0042);
398
+
399
+      LCD_IO_WriteReg(0x00B7);
400
+      LCD_IO_WriteData(0x00C6);
401
+
402
+      //WriteComm(0xBE);
403
+      //WriteData(0x00);
404
+      //WriteData(0x04);
405
+
406
+      LCD_IO_WriteReg(0x00E9);
407
+      LCD_IO_WriteData(0x0000);
408
+
409
+      LCD_IO_WriteReg(0x00F7);
410
+      LCD_IO_WriteData(0x00A9);
411
+      LCD_IO_WriteData(0x0051);
412
+      LCD_IO_WriteData(0x002C);
413
+      LCD_IO_WriteData(0x0082);
414
+
415
+      LCD_IO_WriteReg(0x0011);
416
+      for (i = 0; i < 65535; i++);
417
+      LCD_IO_WriteReg(0x0029);
418
+
419
+      ili9320_SetWindows(0, 0, 480, 320);
420
+      LCD_Clear(0x0000);
421
+
422
+      OUT_WRITE(LCD_BACKLIGHT_PIN, HIGH);
423
+    }
424
+  }
425
+
426
+  #endif // if DISABLED(SPI_GRAPHICAL_TFT)
427
+
428
+  extern uint8_t bmp_public_buf[17 * 1024];
429
+  void tft_lvgl_init() {
430
+    //uint16_t test_id=0;
431
+    W25QXX.init(SPI_QUARTER_SPEED);
432
+    //test_id=W25QXX.W25QXX_ReadID();
433
+    #if ENABLED(SDSUPPORT)
434
+      UpdatePic();
435
+      UpdateFont();
436
+    #endif
437
+
438
+    gCfgItems_init();
439
+    ui_cfg_init();
440
+    disp_language_init();
441
+    //spi_flash_read_test();
442
+
443
+    #if ENABLED(SPI_GRAPHICAL_TFT)
444
+      SPI_TFT.spi_init(SPI_FULL_SPEED);
445
+      SPI_TFT.LCD_init();
446
+    #else
447
+      init_tft();
448
+    #endif
449
+
450
+    lv_init();
451
+
452
+    lv_disp_buf_init(&disp_buf, bmp_public_buf, NULL, LV_HOR_RES_MAX * 18); /*Initialize the display buffer*/
453
+
454
+    lv_disp_drv_t disp_drv;     /*Descriptor of a display driver*/
455
+    lv_disp_drv_init(&disp_drv);    /*Basic initialization*/
456
+    disp_drv.flush_cb = my_disp_flush; /*Set your driver function*/
457
+    disp_drv.buffer = &disp_buf;    /*Assign the buffer to the display*/
458
+    lv_disp_drv_register(&disp_drv);  /*Finally register the driver*/
459
+
460
+    lv_indev_drv_t indev_drv;
461
+    lv_indev_drv_init(&indev_drv);     /*Descriptor of a input device driver*/
462
+    indev_drv.type = LV_INDEV_TYPE_POINTER; /*Touch pad is a pointer-like device*/
463
+    indev_drv.read_cb = my_touchpad_read;  /*Set your driver function*/
464
+    lv_indev_drv_register(&indev_drv);   /*Finally register the driver*/
465
+
466
+    systick_attach_callback(SysTick_Callback);
467
+
468
+    init_gb2312_font();
469
+
470
+    tft_style_init();
471
+
472
+    filament_pin_setup();
473
+
474
+    #if ENABLED(POWER_LOSS_RECOVERY)
475
+    if (recovery.valid()) {
476
+      if (gCfgItems.from_flash_pic == 1)
477
+        flash_preview_begin = 1;
478
+      else
479
+        default_preview_flg = 1;
480
+
481
+      uiCfg.print_state = REPRINTING;
482
+
483
+      memset(public_buf_m, 0, sizeof(public_buf_m));
484
+      strncpy(public_buf_m, recovery.info.sd_filename, sizeof(public_buf_m));
485
+      card.printLongPath(public_buf_m);
486
+
487
+      strncpy(list_file.long_name[sel_id], card.longFilename, sizeof(list_file.long_name[sel_id]));
488
+
489
+      lv_draw_printing();
490
+    }
491
+    else
492
+    #endif
493
+    lv_draw_ready_print();
494
+
495
+    #if ENABLED(MKS_TEST)
496
+      Test_GPIO();
497
+    #endif
498
+  }
499
+
500
+  #if 0
501
+  void LCD_WriteRAM(uint16_t RGB_Code) {
502
+    #if 0
503
+      ClrCs
504
+      /* Write 16-bit GRAM Reg */
505
+      LCD->LCD_RAM = RGB_Code;
506
+      SetCs
507
+    #else
508
+      LCD_IO_WriteData(RGB_Code);
509
+    #endif
510
+  }
511
+  #endif
512
+
513
+  void my_disp_flush(lv_disp_drv_t * disp, const lv_area_t * area, lv_color_t * color_p) {
514
+    #if ENABLED(SPI_GRAPHICAL_TFT)
515
+      uint16_t i, width, height;
516
+      uint16_t clr_temp;
517
+      uint8_t tbuf[480 * 2];
518
+
519
+      SPI_TFT.spi_init(SPI_FULL_SPEED);
520
+
521
+      width = area->x2 - area->x1 + 1;
522
+      height = area->y2 - area->y1 + 1;
523
+
524
+      for (int j = 0; j < height; j++) {
525
+        SPI_TFT.SetCursor(0, 0);
526
+        SPI_TFT.SetWindows((uint16_t)area->x1, (uint16_t)area->y1 + j, width, 1);
527
+        SPI_TFT.LCD_WriteRAM_Prepare();
528
+
529
+        for (i = 0; i < width * 2;) {
530
+          clr_temp = (uint16_t)(((uint16_t)color_p->ch.red << 11)
531
+                                | ((uint16_t)color_p->ch.green << 5)
532
+                                | ((uint16_t)color_p->ch.blue));
533
+
534
+          tbuf[i] = clr_temp >> 8;
535
+          tbuf[i + 1] = clr_temp;
536
+          i += 2;
537
+          color_p++;
538
+        }
539
+        SPI_TFT_CS_L;
540
+        SPI_TFT_DC_H;
541
+        SPI.dmaSend(tbuf, width * 2, true);
542
+        SPI_TFT_CS_H;
543
+      }
544
+
545
+      lv_disp_flush_ready(disp);       /* Indicate you are ready with the flushing*/
546
+
547
+      W25QXX.init(SPI_QUARTER_SPEED);
548
+    #else
549
+      #if 1
550
+        uint16_t i, width, height;
551
+        uint16_t clr_temp;
552
+        #if 0
553
+          int32_t x, y;
554
+          for (y = area->y1; y <= area->y2; y++)
555
+            for (x = area->x1; x <= area->x2; x++) {
556
+              //set_pixel(x, y, *color_p);  /* Put a pixel to the display.*/
557
+              clr_temp = (uint16_t)(((uint16_t)color_p->ch.red << 11)
558
+                                    | ((uint16_t)color_p->ch.green << 5)
559
+                                    | ((uint16_t)color_p->ch.blue));
560
+              tft_set_point(x, y, clr_temp);
561
+              color_p++;
562
+            }
563
+
564
+        #else
565
+          width = area->x2 - area->x1 + 1;
566
+          height = area->y2 - area->y1 + 1;
567
+          //tft_set_cursor((uint16_t)area->x1,(uint16_t)area->y1);
568
+          ili9320_SetWindows((uint16_t)area->x1, (uint16_t)area->y1, width, height);
569
+          LCD_WriteRAM_Prepare();
570
+          for (i = 0; i < width * height; i++) {
571
+            clr_temp = (uint16_t)(((uint16_t)color_p->ch.red << 11)
572
+                                  | ((uint16_t)color_p->ch.green << 5)
573
+                                  | ((uint16_t)color_p->ch.blue));
574
+            LCD_IO_WriteData(clr_temp);
575
+            color_p++;
576
+          }
577
+        #endif
578
+
579
+        lv_disp_flush_ready(disp);       /* Indicate you are ready with the flushing*/
580
+      #endif
581
+    #endif // SPI_GRAPHICAL_TFT
582
+  }
583
+
584
+  #define TICK_CYCLE 1
585
+
586
+  static int32_t touch_time1 = 0;
587
+
588
+  unsigned int  getTickDiff(unsigned int curTick, unsigned int lastTick) {
589
+    if (lastTick <= curTick)
590
+      return (curTick - lastTick) * TICK_CYCLE;
591
+    else
592
+      return (0xFFFFFFFF - lastTick + curTick) * TICK_CYCLE;
593
+  }
594
+
595
+  #if ENABLED(SPI_GRAPHICAL_TFT)
596
+
597
+    #ifndef USE_XPT2046
598
+      #define USE_XPT2046       1
599
+      #define XPT2046_XY_SWAP   1
600
+      #define XPT2046_X_INV     1
601
+      #define XPT2046_Y_INV     0
602
+    #endif
603
+
604
+    #if USE_XPT2046
605
+      #define XPT2046_HOR_RES   480
606
+      #define XPT2046_VER_RES   320
607
+      #define XPT2046_X_MIN     201
608
+      #define XPT2046_Y_MIN     164
609
+      #define XPT2046_X_MAX     3919
610
+      #define XPT2046_Y_MAX     3776
611
+      #define XPT2046_AVG       4
612
+      #define XPT2046_INV       1
613
+    #endif
614
+
615
+  #else
616
+
617
+    #ifndef USE_XPT2046
618
+      #define USE_XPT2046       1
619
+      #define XPT2046_XY_SWAP   1
620
+      #define XPT2046_X_INV     0
621
+      #define XPT2046_Y_INV     1
622
+    #endif
623
+
624
+    #if USE_XPT2046
625
+      #define XPT2046_HOR_RES   480
626
+      #define XPT2046_VER_RES   320
627
+      #define XPT2046_X_MIN     201
628
+      #define XPT2046_Y_MIN     164
629
+      #define XPT2046_X_MAX     3919
630
+      #define XPT2046_Y_MAX     3776
631
+      #define XPT2046_AVG       4
632
+      #define XPT2046_INV       0
633
+    #endif
634
+
635
+  #endif
636
+
637
+  static void xpt2046_corr(uint16_t *x, uint16_t *y) {
638
+    #if XPT2046_XY_SWAP
639
+      int16_t swap_tmp;
640
+      swap_tmp = *x;
641
+      *x = *y;
642
+      *y = swap_tmp;
643
+    #endif
644
+    if ((*x) > XPT2046_X_MIN) (*x) -= XPT2046_X_MIN; else (*x) = 0;
645
+    if ((*y) > XPT2046_Y_MIN) (*y) -= XPT2046_Y_MIN; else (*y) = 0;
646
+    (*x) = uint32_t(uint32_t(*x) * XPT2046_HOR_RES) / (XPT2046_X_MAX - XPT2046_X_MIN);
647
+    (*y) = uint32_t(uint32_t(*y) * XPT2046_VER_RES) / (XPT2046_Y_MAX - XPT2046_Y_MIN);
648
+    #if XPT2046_X_INV
649
+      (*x) = XPT2046_HOR_RES - (*x);
650
+    #endif
651
+    #if XPT2046_Y_INV
652
+      (*y) = XPT2046_VER_RES - (*y);
653
+    #endif
654
+  }
655
+
656
+  #define  times  4
657
+  #define CHX   0x90// 0x90
658
+  #define CHY   0xD0// 0xD0
659
+
660
+  int SPI2_ReadWrite2Bytes(void) {
661
+    volatile uint16_t ans = 0;
662
+    uint16_t temp = 0;
663
+    #if ENABLED(SPI_GRAPHICAL_TFT)
664
+      temp = SPI_TFT.spi_read_write_byte(0xFF);
665
+      ans = temp << 8;
666
+      temp = SPI_TFT.spi_read_write_byte(0xFF);
667
+      ans |= temp;
668
+      ans >>= 3;
669
+    #else
670
+      temp = W25QXX.spi_flash_read_write_byte(0xFF);
671
+      ans = temp << 8;
672
+      temp = W25QXX.spi_flash_read_write_byte(0xFF);
673
+      ans |= temp;
674
+      ans >>= 3;
675
+    #endif
676
+    return ans & 0x0FFF;
677
+  }
678
+
679
+  uint16_t x_addata[times], y_addata[times];
680
+  void XPT2046_Rd_Addata(uint16_t *X_Addata, uint16_t *Y_Addata) {
681
+    uint16_t i, j, k;
682
+    //int result;
683
+    //#if ENABLED(TOUCH_BUTTONS)
684
+
685
+    #if ENABLED(SPI_GRAPHICAL_TFT)
686
+      SPI_TFT.spi_init(SPI_QUARTER_SPEED);
687
+    #endif
688
+
689
+    for (i = 0; i < times; i++) {
690
+      #if ENABLED(SPI_GRAPHICAL_TFT)
691
+        OUT_WRITE(TOUCH_CS_PIN, LOW);
692
+        SPI_TFT.spi_read_write_byte(CHX);
693
+        y_addata[i] = SPI2_ReadWrite2Bytes();
694
+        WRITE(TOUCH_CS_PIN, HIGH);
695
+
696
+        OUT_WRITE(TOUCH_CS_PIN, LOW);
697
+        SPI_TFT.spi_read_write_byte(CHY);
698
+        x_addata[i] = SPI2_ReadWrite2Bytes();
699
+        WRITE(TOUCH_CS_PIN, HIGH);
700
+      #else // #if ENABLED(TOUCH_BUTTONS)
701
+        OUT_WRITE(TOUCH_CS_PIN, LOW);
702
+        W25QXX.spi_flash_read_write_byte(CHX);
703
+        y_addata[i] = SPI2_ReadWrite2Bytes();
704
+        WRITE(TOUCH_CS_PIN, HIGH);
705
+
706
+        OUT_WRITE(TOUCH_CS_PIN, LOW);
707
+        W25QXX.spi_flash_read_write_byte(CHY);
708
+        x_addata[i] = SPI2_ReadWrite2Bytes();
709
+        WRITE(TOUCH_CS_PIN, HIGH);
710
+      #endif
711
+
712
+    }
713
+    //#endif
714
+    //result = x_addata[0];
715
+    for (i = 0; i < times; i++)
716
+      for (j = i + 1; j < times; j++)
717
+        if (x_addata[j] > x_addata[i]) {
718
+          k = x_addata[j];
719
+          x_addata[j] = x_addata[i];
720
+          x_addata[i] = k;
721
+        }
722
+    if (x_addata[times / 2 - 1] - x_addata[times / 2] > 50) {
723
+      *X_Addata = *Y_Addata = 0;
724
+      return;
725
+    }
726
+
727
+    *X_Addata = (x_addata[times / 2 - 1] + x_addata[times / 2]) / 2;
728
+
729
+    //result = y_addata[0];
730
+    for (i = 0; i < times; i++)
731
+      for (j = i + 1; j < times; j++)
732
+        if (y_addata[j] > y_addata[i]) {
733
+          k = y_addata[j];
734
+          y_addata[j] = y_addata[i];
735
+          y_addata[i] = k;
736
+        }
737
+
738
+    if (y_addata[times / 2 - 1] - y_addata[times / 2] > 50) {
739
+      *X_Addata = *Y_Addata = 0;
740
+      return;
741
+    }
742
+
743
+    *Y_Addata = (y_addata[times / 2 - 1] + y_addata[times / 2]) / 2;
744
+  }
745
+
746
+  #define ADC_VALID_OFFSET  10
747
+
748
+  uint8_t TOUCH_PressValid(uint16_t _usX, uint16_t _usY) {
749
+    if ((_usX <= ADC_VALID_OFFSET) || (_usY <= ADC_VALID_OFFSET)
750
+        || (_usX >= 4095 - ADC_VALID_OFFSET) || (_usY >= 4095 - ADC_VALID_OFFSET)
751
+        ) return 0;
752
+
753
+    return 1;
754
+  }
755
+
756
+  static lv_coord_t last_x = 0, last_y = 0;
757
+  bool my_touchpad_read(lv_indev_drv_t * indev_driver, lv_indev_data_t * data) {
758
+    #if 1
759
+      uint32_t tmpTime, diffTime = 0;
760
+
761
+      tmpTime = millis();
762
+      diffTime = getTickDiff(tmpTime, touch_time1);
763
+      /*Save the state and save the pressed coordinate*/
764
+      //data->state = TOUCH_PressValid(last_x, last_y) ? LV_INDEV_STATE_PR : LV_INDEV_STATE_REL;
765
+      //if (data->state == LV_INDEV_STATE_PR)  ADS7843_Rd_Addata((u16 *)&last_x, (u16 *)&last_y);
766
+      //touchpad_get_xy(&last_x, &last_y);
767
+      /*Save the pressed coordinates and the state*/
768
+      if (diffTime > 10) {
769
+        XPT2046_Rd_Addata((uint16_t *)&last_x, (uint16_t *)&last_y);
770
+        if (TOUCH_PressValid(last_x, last_y)) {
771
+
772
+          data->state = LV_INDEV_STATE_PR;
773
+
774
+          /*Set the coordinates (if released use the last pressed coordinates)*/
775
+
776
+          xpt2046_corr((uint16_t *)&last_x, (uint16_t *)&last_y);
777
+          data->point.x = last_x;
778
+          data->point.y = last_y;
779
+
780
+        }
781
+        else {
782
+          data->state = LV_INDEV_STATE_REL;
783
+        }
784
+        touch_time1 = tmpTime;
785
+      }
786
+
787
+      return false; /*Return `false` because we are not buffering and no more data to read*/
788
+    #endif
789
+  }
790
+
791
+#endif // TFT_LITTLE_VGL_UI

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

@@ -0,0 +1,46 @@
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 <http://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+#pragma once
23
+
24
+/**
25
+ * @file tft_lvgl_configuration.h
26
+ * @date    2020-02-21
27
+ * */
28
+
29
+//#ifdef __cplusplus
30
+//extern "C" {
31
+//#endif
32
+
33
+#include "lvgl.h"
34
+
35
+void tft_lvgl_init();
36
+void my_disp_flush(lv_disp_drv_t * disp, const lv_area_t * area, lv_color_t * color_p);
37
+bool my_touchpad_read(lv_indev_drv_t * indev_driver, lv_indev_data_t * data);
38
+
39
+void LCD_Clear(uint16_t Color);
40
+void tft_set_point(uint16_t x, uint16_t y, uint16_t point);
41
+void ili9320_SetWindows(uint16_t StartX, uint16_t StartY, uint16_t width, uint16_t heigh);
42
+void LCD_WriteRAM_Prepare(void);
43
+
44
+//#ifdef __cplusplus
45
+//} /* extern "C" */
46
+//#endif

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


+ 584
- 0
Marlin/src/lcd/extui/lib/mks_ui/tft_multi_language.h View File

@@ -0,0 +1,584 @@
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 <http://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+#pragma once
23
+
24
+#include "inc/tft_Language_en.h"
25
+#include "inc/tft_Language_s_cn.h"
26
+#include "inc/tft_Language_t_cn.h"
27
+#include "inc/tft_Language_ru.h"
28
+#include "inc/tft_Language_fr.h"
29
+#include "inc/tft_Language_sp.h"
30
+#include "inc/tft_Language_it.h"
31
+
32
+extern void disp_language_init();
33
+
34
+#define LANG_SIMPLE_CHINESE    1
35
+#define LANG_COMPLEX_CHINESE   2
36
+#define LANG_ENGLISH           3
37
+#define LANG_JAPAN             4
38
+#define LANG_GERMAN            5
39
+#define LANG_FRENCH            6
40
+#define LANG_RUSSIAN           7
41
+#define LANG_KOREAN            8
42
+#define LANG_TURKISH           9
43
+#define LANG_SPANISH          10
44
+#define LANG_GREEK            11
45
+#define LANG_ITALY            12
46
+#define LANG_PORTUGUESE       13
47
+
48
+#define MULTI_LANGUAGE_ENABLE   1
49
+#define MULTI_LANGUAGE_DISABLE  0
50
+
51
+typedef struct common_menu_disp {
52
+  const char *text_back;
53
+  const char *dialog_confirm_title;
54
+  const char *close_machine_tips;
55
+  const char *unbind_printer_tips;
56
+  const char *print_special_title;
57
+  const char *pause_special_title;
58
+  const char *operate_special_title;
59
+  const char *next;
60
+  const char *previous;
61
+} common_menu_def;
62
+extern common_menu_def common_menu;
63
+
64
+typedef struct main_menu_disp {
65
+  const char *title;
66
+  const char *preheat;
67
+  const char *move;
68
+  const char *home;
69
+  const char *print;
70
+  const char *extrude;
71
+  const char *leveling;
72
+  const char *autoleveling;
73
+  const char *fan;
74
+  const char *set;
75
+  const char *tool;
76
+  const char *more;
77
+  const char *machine_para;
78
+} main_menu_def;
79
+extern main_menu_def main_menu;
80
+
81
+typedef struct preheat_menu_disp {
82
+  const char *adjust_title;
83
+  const char *title;
84
+  const char *add;
85
+  const char *dec;
86
+  const char *ext1;
87
+  const char *ext2;
88
+  const char *hotbed;
89
+  const char *off;
90
+  const char *step_1c;
91
+  const char *step_5c;
92
+  const char *step_10c;
93
+  const char *back;
94
+
95
+  const char *value_state;
96
+
97
+  const char *dialog_tips;
98
+
99
+}preheat_menu_def;
100
+extern preheat_menu_def preheat_menu;
101
+
102
+typedef struct move_menu_disp {
103
+  const char *title;
104
+  const char *x_add;
105
+  const char *x_dec;
106
+  const char *y_add;
107
+  const char *y_dec;
108
+  const char *z_add;
109
+  const char *z_dec;
110
+  const char *step_001mm;
111
+  const char *step_005mm;
112
+  const char *step_01mm;
113
+  const char *step_1mm;
114
+  const char *step_10mm;
115
+  const char *back;
116
+} move_menu_def;
117
+extern move_menu_def move_menu;
118
+
119
+typedef struct home_menu_disp {
120
+  const char *title;
121
+  const char *home_all;
122
+  const char *home_x;
123
+  const char *home_y;
124
+  const char *home_z;
125
+  const char *stopmove;
126
+  const char *back;
127
+} home_menu_def;
128
+extern home_menu_def home_menu;
129
+
130
+typedef struct file_menu_disp {
131
+  const char *title;
132
+  const char *page_up;
133
+  const char *page_down;
134
+  const char *back;
135
+
136
+  const char *file_loading;
137
+  const char *no_file;
138
+  const char *no_file_and_check;
139
+
140
+}file_menu_def;
141
+extern file_menu_def file_menu;
142
+
143
+typedef struct extrude_menu_disp {
144
+  const char *title;
145
+  const char *in;
146
+  const char *out;
147
+  const char *ext1;
148
+  const char *ext2;
149
+  const char *step_1mm;
150
+  const char *step_5mm;
151
+  const char *step_10mm;
152
+  const char *low;
153
+  const char *normal;
154
+  const char *high;
155
+  const char *back;
156
+
157
+  const char *count_value_mm;
158
+  const char *count_value_cm;
159
+  const char *count_value_m;
160
+  const char *temp_value;
161
+  const char *temper_text;
162
+} extrude_menu_def;
163
+extern extrude_menu_def extrude_menu;
164
+
165
+typedef struct leveling_menu_disp {
166
+  const char *title;
167
+  const char *position1;
168
+  const char *position2;
169
+  const char *position3;
170
+  const char *position4;
171
+  const char *position5;
172
+
173
+  char *back;
174
+} leveling_menu_def;
175
+extern leveling_menu_def leveling_menu;
176
+
177
+typedef struct set_menu_disp {
178
+  const char *title;
179
+  const char *filesys;
180
+  const char *wifi;
181
+  const char *about;
182
+  const char *fan;
183
+  const char *filament;
184
+  const char *breakpoint;
185
+  const char *motoroff;
186
+  const char *motoroffXY;
187
+  const char *shutdown;
188
+  const char *language;
189
+  const char *machine_para;
190
+  const char *back;
191
+} set_menu_def;
192
+extern set_menu_def set_menu;
193
+
194
+typedef struct filesys_menu_disp {
195
+  const char *title;
196
+  const char *filesys;
197
+  const char *sd_sys;
198
+  const char *usb_sys;
199
+  const char *back;
200
+} filesys_menu_def;
201
+extern filesys_menu_def filesys_menu;
202
+
203
+typedef struct more_menu_disp {
204
+  const char *title;
205
+  const char *zoffset;
206
+  const char *back;
207
+} more_menu_def;
208
+extern more_menu_def more_menu;
209
+
210
+typedef struct wifi_menu_disp {
211
+  const char *title;
212
+  const char *ip;
213
+  const char *wifi;
214
+  const char *key;
215
+  const char *state_ap;
216
+  const char *state_sta;
217
+  const char *cloud;
218
+  const char *connected;
219
+  const char *disconnected;
220
+  const char *exception;
221
+  const char *back;
222
+  const char *reconnect;
223
+} wifi_menu_def;
224
+extern wifi_menu_def wifi_menu;
225
+
226
+typedef struct cloud_menu_disp {
227
+  const char *title;
228
+  const char *unbind;
229
+  const char *unbinding;
230
+  const char *unbinded;
231
+  const char *bind;
232
+  const char *binding;
233
+  const char *binded;
234
+  const char *disable;
235
+  const char *disconnected;
236
+  const char *back;
237
+  const char *unbind_printer_tips;
238
+} cloud_menu_def;
239
+extern cloud_menu_def cloud_menu;
240
+
241
+typedef struct about_menu_disp {
242
+  const char *title;
243
+  const char *type_name;
244
+  const char *firmware_v;
245
+  const char *type;
246
+  const char *version;
247
+  const char *wifi;
248
+  const char *type_robin;
249
+  const char *type_robin_mini;
250
+  const char *back;
251
+} about_menu_def;
252
+extern about_menu_def about_menu;
253
+
254
+typedef struct fan_menu_disp {
255
+  const char *title;
256
+  const char *add;
257
+  const char *dec;
258
+  const char *full;
259
+  const char *half;
260
+  const char *off;
261
+  const char *back;
262
+
263
+  const char *state;
264
+  const char *state_value;
265
+} fan_menu_def;
266
+extern fan_menu_def fan_menu;
267
+
268
+typedef struct filament_menu_disp {
269
+  const char *title;
270
+  const char *in;
271
+  const char *out;
272
+  const char *ext1;
273
+  const char *ext2;
274
+  const char *back;
275
+  const char *stat_temp;
276
+  const char *ready_replace;
277
+  const char *replacing;
278
+  const char *loading;
279
+  const char *unloading;
280
+  const char *heating;
281
+  const char *complete_and_back;
282
+  const char *filament_dialog_load_heat;
283
+  const char *filament_dialog_unload_heat;
284
+  const char *filament_dialog_load_heat_confirm;
285
+  const char *filament_dialog_unload_heat_confirm;
286
+  const char *filament_dialog_loading;
287
+  const char *filament_dialog_unloading;
288
+  const char *filament_dialog_load_completed;
289
+  const char *filament_dialog_unload_completed;
290
+  const char *filament_dialog_ok;
291
+  const char *filament_dialog_back;
292
+} filament_menu_def;
293
+extern filament_menu_def filament_menu;
294
+
295
+typedef struct language_menu {
296
+  const char *title;
297
+  const char *chinese_s;
298
+  const char *chinese_t;
299
+  const char *english;
300
+  const char *russian;
301
+  const char *japan;
302
+  const char *italy;
303
+  const char *german;
304
+  const char *spanish;
305
+  const char *korean;
306
+  const char *french;
307
+  const char *brazil;
308
+  const char *portuguese;
309
+  const char *next;
310
+  const char *up;
311
+  const char *back;
312
+} language_menu_def;
313
+extern language_menu_def language_menu;
314
+
315
+typedef struct printing_menu_disp {
316
+  const char *title;
317
+  const char *option;
318
+  const char *temp1;
319
+  const char *temp2;
320
+  const char *bed_temp;
321
+  const char *fan_speed;
322
+  const char *pause;
323
+  const char *resume;
324
+  const char *stop;
325
+} printing_menu_def;
326
+extern printing_menu_def printing_menu;
327
+
328
+typedef struct operation_menu_disp {
329
+  const char *title;
330
+  const char *pause;
331
+  const char *stop;
332
+  const char *temp;
333
+  const char *fan;
334
+  const char *filament;
335
+  const char *extr;
336
+  const char *speed;
337
+  const char *move;
338
+  const char *more;
339
+  const char *auto_off;
340
+  const char *manual_off;
341
+  const char *back;
342
+  const char *babystep;
343
+} operation_menu_def;
344
+extern operation_menu_def operation_menu;
345
+
346
+typedef struct pause_menu_disp {
347
+  const char *title;
348
+  const char *resume;
349
+  const char *stop;
350
+  const char *extrude;
351
+  const char *move;
352
+  const char *filament;
353
+  const char *more;
354
+} pause_menu_def;
355
+extern pause_menu_def pause_menu;
356
+
357
+typedef struct speed_menu_disp {
358
+  const char *title;
359
+  const char *add;
360
+  const char *dec;
361
+  const char *extrude;
362
+  const char *move;
363
+  const char *step_1percent;
364
+  const char *step_5percent;
365
+  const char *step_10percent;
366
+  const char *back;
367
+  const char *move_speed;
368
+  const char *extrude_speed;
369
+} speed_menu_def;
370
+extern speed_menu_def speed_menu;
371
+
372
+typedef struct printing_more_menu_disp {
373
+  const char *title;
374
+  const char *fan;
375
+  const char *auto_close;
376
+  const char *manual;
377
+  const char *temp;
378
+  const char *speed;
379
+  const char *back;
380
+} printing_more_menu_def;
381
+extern printing_more_menu_def printing_more_menu;
382
+
383
+typedef struct dialog_menu_disp {
384
+  const char *confirm_title;
385
+
386
+  const char *error1_repint_no_file;
387
+  const char *error2_communication_fail;
388
+  const char *error3_filename_too_long;
389
+  const char *error4_no_file;
390
+  const char *error5_check_filesys;
391
+
392
+  const char *tip1_print_file;
393
+  const char *tip2_stop_file;
394
+} dialog_menu_def;
395
+extern dialog_menu_def dialog_menu;
396
+
397
+typedef struct print_file_dialog_disp {
398
+  const char *title;
399
+  const char *confirm;
400
+  const char *cancle;
401
+  const char *print_file;
402
+  const char *cancle_print;
403
+  const char *retry;
404
+  const char *stop;
405
+  const char *no_file_print_tips;
406
+  const char *print_from_breakpoint;
407
+  const char *file_name_too_long_error;
408
+  const char *close_machine_error;
409
+  const char *filament_no_press;
410
+  const char *print_finish;
411
+  const char *print_time;
412
+  const char *reprint;
413
+  const char *wifi_enable_tips;
414
+} print_file_dialog_menu_def;
415
+extern print_file_dialog_menu_def print_file_dialog_menu;
416
+
417
+typedef struct zoffset_menu_disp {
418
+  const char *title;
419
+  const char *inc;
420
+  const char *dec;
421
+  const char *step001;
422
+  const char *step01;
423
+  const char *step1;
424
+  const char *back;
425
+} zoffset_menu_def;
426
+extern zoffset_menu_def zoffset_menu;
427
+
428
+typedef struct tool_menu_disp {
429
+  const char *title;
430
+  const char *preheat;
431
+  const char *extrude;
432
+  const char *move;
433
+  const char *home;
434
+  const char *leveling;
435
+  const char *autoleveling;
436
+  const char *filament;
437
+  const char *more;
438
+  const char *back;
439
+} tool_menu_def;
440
+extern tool_menu_def tool_menu;
441
+
442
+typedef struct MachinePara_menu_disp {
443
+  const char *title;
444
+  const char *MachineSetting;
445
+  const char *TemperatureSetting;
446
+  const char *MotorSetting;
447
+  const char *AdvanceSetting;
448
+  //const char *back;
449
+} MachinePara_menu_def;
450
+extern MachinePara_menu_def MachinePara_menu;
451
+
452
+typedef struct MachineSettings_menu_disp {
453
+  const char *title;
454
+  const char *Machine;
455
+  const char *Stroke;
456
+  const char *HomeDir;
457
+  const char *EndStopType;
458
+  const char *filamet;
459
+  const char *leveling;
460
+  const char *back;
461
+} MachineSettings_menu_def;
462
+extern MachineSettings_menu_def MachineSettings_menu;
463
+
464
+typedef struct TemperatureSettings_menu_disp {
465
+  const char *title;
466
+  const char *nozzle;
467
+  const char *hotbed;
468
+  const char *preheat;
469
+  const char *back;
470
+} TemperatureSettings_menu_def;
471
+extern TemperatureSettings_menu_def TemperatureSettings_menu;
472
+
473
+typedef struct pause_msg_disp {
474
+  const char *pausing;
475
+  const char *changing;
476
+  const char *unload;
477
+  const char *waiting;
478
+  const char *insert;
479
+  const char *load;
480
+  const char *purge;
481
+  const char *resume;
482
+  const char *heat;
483
+  const char *heating;
484
+  const char *option;
485
+  const char *purgeMore;
486
+  const char *continuePrint;
487
+} pause_msg_def;
488
+extern pause_msg_def pause_msg_menu;
489
+
490
+/*****************************************/
491
+//********************************************//
492
+//#if defined(TFT70)
493
+//
494
+//#elif defined(TFT35)
495
+#define TEXT_VALUE                  "%d/%d"
496
+//#endif
497
+
498
+#define TEXT_VALUE_T                  ": %d℃"
499
+#define TEXT_VALUE_mm                 ": %dmm"
500
+#define TEXT_VALUE_cm                 ": %dcm"
501
+#define TEXT_VALUE_m                  ": %dm"
502
+
503
+#define TEMP_UNIT_SYBOL               "%d℃"
504
+#define FLOAT_TEMP_UNIT_SYBOL               "%.1f℃"
505
+
506
+#define TEXT_1C             "1℃"
507
+#define TEXT_5C             "5℃"
508
+#define TEXT_10C            "10℃"
509
+
510
+#define AXIS_X_ADD_TEXT     "X+"
511
+#define AXIS_X_DEC_TEXT     "X-"
512
+#define AXIS_Y_ADD_TEXT     "Y+"
513
+#define AXIS_Y_DEC_TEXT     "Y-"
514
+#define AXIS_Z_ADD_TEXT     "Z+"
515
+#define AXIS_Z_DEC_TEXT     "Z-"
516
+#define TEXT_001MM          "0.01mm"
517
+#define TEXT_005MM          "0.05mm"
518
+#define TEXT_01MM           "0.1mm"
519
+#define TEXT_1MM            "1mm"
520
+#define TEXT_10MM           "10mm"
521
+
522
+#define EXTRUDE_1MM_TEXT    "1mm"
523
+#define EXTRUDE_5MM_TEXT    "5mm"
524
+#define EXTRUDE_10MM_TEXT   "10mm"
525
+
526
+#define STEP_1PERCENT       "1%"
527
+#define STEP_5PERCENT       "5%"
528
+#define STEP_10PERCENT      "10%"
529
+
530
+#define LANGUAGE_S_CN       "简体"
531
+#define LANGUAGE_T_CN       "繁体"
532
+#define LANGUAGE_EN         "English"
533
+#define LANGUAGE_JP         "日本語"
534
+#define LANGUAGE_GE         "Deutsch"
535
+#define LANGUAGE_FR         "français"
536
+#define LANGUAGE_IT         "Italia"
537
+#define LANGUAGE_PR         "português"
538
+#define LANGUAGE_KR         "Korean"
539
+#define LANGUAGE_BR         "Brazil"
540
+#define LANGUAGE_RU         "русский"
541
+#define LANGUAGE_SP         "español"
542
+
543
+#define HOME_X_TEXT         "X"
544
+#define HOME_Y_TEXT         "Y"
545
+#define HOME_Z_TEXT         "Z"
546
+#define HOME_ALL_TEXT       "All"
547
+//#if defined(MKS_ROBIN_NANO)
548
+#define ABOUT_TYPE_TEXT     "MKS Robin Pro"
549
+//#elif defined(MKS_ROBIN_MINI)
550
+//#define ABOUT_TYPE_TEXT       "MKS Robin Mini"
551
+//#endif
552
+#define ABOUT_VERSION_TEXT  "1.0.0"
553
+//#define ABOUT_WIFI_TEXT   "WiFi:"
554
+
555
+#define FAN_OPEN_TEXT       "100%"
556
+#define FAN_HALF_TEXT       "50%"
557
+#define FAN_CLOSE_TEXT      "0%"
558
+//#define FAN_TIPS1_TEXT      "FAN"
559
+//#define FAN_TIPS2_TEXT      "FAN\nClose"
560
+
561
+#define WIFI_TEXT                       "WIFI"
562
+#define WIFI_IP_TEXT                    "IP: "
563
+#define WIFI_NAME_TEXT                  "WiFi: "
564
+#define WIFI_KEY_TEXT                   "Key: "
565
+#define WIFI_STATE_AP_TEXT              "State: AP"
566
+#define WIFI_STATE_STA_TEXT             "State: STA"
567
+#define WIFI_CONNECTED_TEXT             "Connected"
568
+#define WIFI_DISCONNECTED_TEXT          "Disconnected"
569
+#define WIFI_EXCEPTION_TEXT             "Exception"
570
+
571
+#define FILAMENT_TIPS2_TEXT             "T:"
572
+
573
+#define DIALOG_UPLOAD_ING_EN            "Uploading......"
574
+#define DIALOG_UPLOAD_ERROR_EN          "Upload error"
575
+#define DIALOG_UPLOAD_FINISH_EN         "Upload finished"
576
+#define DIALOG_UPLOAD_SIZE_EN           "Size"
577
+#define DIALOG_UPLOAD_TIME_EN           "Time"
578
+#define DIALOG_UPLOAD_SPEED_EN          "Speed"
579
+#define DIALOG_UPDATE_WIFI_FIRMWARE_EN  "Updating wifi model firmware"
580
+#define DIALOG_UPDATE_WIFI_WEB_EN       "Updating wifi model web data"
581
+
582
+#define ZOFFSET_STEP001                 "0.01mm"
583
+#define ZOFFSET_STEP01                  "0.1mm"
584
+#define ZOFFSET_STEP1                   "1mm"

+ 2
- 2
Marlin/src/module/thermistor/thermistor_22.h View File

@@ -1,9 +1,9 @@
1 1
 /**
2 2
  * Marlin 3D Printer Firmware
3
- * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
3
+ * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4 4
  *
5 5
  * Based on Sprinter and grbl.
6
- * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
6
+ * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
7 7
  *
8 8
  * This program is free software: you can redistribute it and/or modify
9 9
  * it under the terms of the GNU General Public License as published by

+ 2
- 2
Marlin/src/module/thermistor/thermistor_23.h View File

@@ -1,9 +1,9 @@
1 1
 /**
2 2
  * Marlin 3D Printer Firmware
3
- * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
3
+ * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4 4
  *
5 5
  * Based on Sprinter and grbl.
6
- * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
6
+ * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
7 7
  *
8 8
  * This program is free software: you can redistribute it and/or modify
9 9
  * it under the terms of the GNU General Public License as published by

+ 109
- 5
Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO.h View File

@@ -45,6 +45,7 @@
45 45
   //#define FLASH_EEPROM_EMULATION
46 46
   #define SDCARD_EEPROM_EMULATION
47 47
 #endif
48
+#define ENABLE_SPI2
48 49
 
49 50
 //
50 51
 // Limit Switches
@@ -106,16 +107,27 @@
106 107
 //
107 108
 // Misc. Functions
108 109
 //
109
-#define POWER_LOSS_PIN                      PA2   // PW_DET
110
-#define PS_ON_PIN                           PA3   // PW_OFF
110
+//#define POWER_LOSS_PIN                    PA2   // PW_DET
111
+//#define PS_ON_PIN                         PA3   // PW_OFF
111 112
 
112
-#define LED_PIN                             PB2
113
+//#define SUICIDE_PIN                       PB2   // Enable MKSPWC support ROBIN NANO v1.2 ONLY
114
+//#define SUICIDE_PIN_INVERTING false
115
+
116
+//#define KILL_PIN                          PA2   // Enable MKSPWC support ROBIN NANO v1.2 ONLY
117
+//#define KILL_PIN_INVERTING true                 // Enable MKSPWC support ROBIN NANO v1.2 ONLY
118
+
119
+//#define SERVO0_PIN                        PA8   // Enable BLTOUCH support ROBIN NANO v1.2 ONLY
120
+
121
+//#define LED_PIN                           PB2
122
+
123
+#define MT_DET_1_PIN                        PA4
124
+#define MT_DET_PIN_INVERTING false
113 125
 
114 126
 //
115 127
 // SD Card
116 128
 //
117 129
 #ifndef SDCARD_CONNECTION
118
-  #define SDCARD_CONNECTION              ONBOARD
130
+  //#define SDCARD_CONNECTION            ONBOARD
119 131
 #endif
120 132
 
121 133
 #define SDIO_SUPPORT
@@ -131,7 +143,90 @@
131 143
  * If the screen stays white, disable 'LCD_RESET_PIN'
132 144
  * to let the bootloader init the screen.
133 145
  */
134
-#if ENABLED(FSMC_GRAPHICAL_TFT)
146
+
147
+#if ENABLED(SPI_GRAPHICAL_TFT)
148
+
149
+  #if HAS_SPI_LCD
150
+
151
+    #define BEEPER_PIN                      PC5
152
+    #define BTN_ENC                         PE13
153
+    #define LCD_PINS_ENABLE                 PD13
154
+    #define LCD_PINS_RS                     PC6
155
+    #define BTN_EN1                         PE8
156
+    #define BTN_EN2                         PE11
157
+    #define LCD_BACKLIGHT_PIN               -1
158
+
159
+    // MKS MINI12864 and MKS LCD12864B; If using MKS LCD12864A (Need to remove RPK2 resistor)
160
+    #if ENABLED(MKS_MINI_12864)
161
+      #define LCD_BACKLIGHT_PIN             -1
162
+      #define LCD_RESET_PIN                 -1
163
+      #define DOGLCD_A0                     PD11
164
+      #define DOGLCD_CS                     PE15
165
+      #define DOGLCD_SCK                    PA5
166
+      #define DOGLCD_MOSI                   PA7
167
+
168
+      // Required for MKS_MINI_12864 with this board
169
+      #define MKS_LCD12864B
170
+      #undef SHOW_BOOTSCREEN
171
+
172
+    #else                                         // !MKS_MINI_12864
173
+
174
+      #define LCD_PINS_D4                   PE14
175
+      #if ENABLED(ULTIPANEL)
176
+        #define LCD_PINS_D5                 PE15
177
+        #define LCD_PINS_D6                 PD11
178
+        #define LCD_PINS_D7                 PD10
179
+      #endif
180
+
181
+      #ifndef ST7920_DELAY_1
182
+        #define ST7920_DELAY_1     DELAY_NS(125)
183
+      #endif
184
+      #ifndef ST7920_DELAY_2
185
+        #define ST7920_DELAY_2     DELAY_NS(125)
186
+      #endif
187
+      #ifndef ST7920_DELAY_3
188
+        #define ST7920_DELAY_3     DELAY_NS(125)
189
+      #endif
190
+
191
+    #endif // !MKS_MINI_12864
192
+
193
+  #else
194
+
195
+    #define SPI_TFT_CS_PIN                  PD11
196
+    #define SPI_TFT_SCK_PIN                 PA5
197
+    #define SPI_TFT_MISO_PIN                PA6
198
+    #define SPI_TFT_MOSI_PIN                PA7
199
+    #define SPI_TFT_DC_PIN                  PD10
200
+    #define SPI_TFT_RST_PIN                 PC6
201
+
202
+    #define LCD_BACKLIGHT_PIN               PD13
203
+
204
+    #define TOUCH_CS_PIN                    PE14  // SPI1_NSS
205
+    #define TOUCH_SCK_PIN                   PA5   // SPI1_SCK
206
+    #define TOUCH_MISO_PIN                  PA6   // SPI1_MISO
207
+    #define TOUCH_MOSI_PIN                  PA7   // SPI1_MOSI
208
+
209
+    #define BTN_EN1                         PE8
210
+    #define BTN_EN2                         PE11
211
+    #define BEEPER_PIN                      PC5
212
+    #define BTN_ENC                         PE13
213
+
214
+  #endif // HAS_SPI_LCD
215
+
216
+#elif ENABLED(TFT_LITTLE_VGL_UI)
217
+
218
+  #define FSMC_CS_PIN                       PD7   // NE4
219
+  #define FSMC_RS_PIN                       PD11  // A0
220
+
221
+  #define TOUCH_CS_PIN                      PA7   // SPI2_NSS
222
+  #define TOUCH_SCK_PIN                     PB13  // SPI2_SCK
223
+  #define TOUCH_MISO_PIN                    PB14  // SPI2_MISO
224
+  #define TOUCH_MOSI_PIN                    PB15  // SPI2_MOSI
225
+
226
+  #define LCD_BACKLIGHT_PIN                 PD13
227
+
228
+#elif ENABLED(FSMC_GRAPHICAL_TFT)
229
+
135 230
   #define FSMC_CS_PIN                       PD7   // NE4
136 231
   #define FSMC_RS_PIN                       PD11  // A0
137 232
 
@@ -146,4 +241,13 @@
146 241
     #define TOUCH_MISO_PIN                  PB14  // SPI2_MISO
147 242
     #define TOUCH_MOSI_PIN                  PB15  // SPI2_MOSI
148 243
   #endif
244
+
245
+#endif
246
+
247
+#define SPI_FLASH
248
+#if ENABLED(SPI_FLASH)
249
+  #define W25QXX_CS_PIN                     PB12
250
+  #define W25QXX_MOSI_PIN                   PB15
251
+  #define W25QXX_MISO_PIN                   PB14
252
+  #define W25QXX_SCK_PIN                    PB13
149 253
 #endif

+ 40
- 0
buildroot/share/PlatformIO/scripts/mks_robin_nano35.py View File

@@ -0,0 +1,40 @@
1
+import os
2
+Import("env")
3
+
4
+# Relocate firmware from 0x08000000 to 0x08007000
5
+for define in env['CPPDEFINES']:
6
+    if define[0] == "VECT_TAB_ADDR":
7
+        env['CPPDEFINES'].remove(define)
8
+env['CPPDEFINES'].append(("VECT_TAB_ADDR", "0x08007000"))
9
+
10
+custom_ld_script = os.path.abspath("buildroot/share/PlatformIO/ldscripts/mks_robin_nano.ld")
11
+for i, flag in enumerate(env["LINKFLAGS"]):
12
+    if "-Wl,-T" in flag:
13
+        env["LINKFLAGS"][i] = "-Wl,-T" + custom_ld_script
14
+    elif flag == "-T":
15
+        env["LINKFLAGS"][i + 1] = custom_ld_script
16
+
17
+
18
+# Encrypt ${PROGNAME}.bin and save it as 'Robin_nano35.bin'
19
+def encrypt(source, target, env):
20
+    import sys
21
+
22
+    key = [0xA3, 0xBD, 0xAD, 0x0D, 0x41, 0x11, 0xBB, 0x8D, 0xDC, 0x80, 0x2D, 0xD0, 0xD2, 0xC4, 0x9B, 0x1E, 0x26, 0xEB, 0xE3, 0x33, 0x4A, 0x15, 0xE4, 0x0A, 0xB3, 0xB1, 0x3C, 0x93, 0xBB, 0xAF, 0xF7, 0x3E]
23
+
24
+    firmware = open(target[0].path, "rb")
25
+    robin = open(target[0].dir.path +'/Robin_nano35.bin', "wb")
26
+    length = os.path.getsize(target[0].path)
27
+    position = 0
28
+    try:
29
+        while position < length:
30
+            byte = firmware.read(1)
31
+            if position >= 320 and position < 31040:
32
+                byte = chr(ord(byte) ^ key[position & 31])
33
+                if sys.version_info[0] > 2:
34
+                    byte = bytes(byte, 'latin1')
35
+            robin.write(byte)
36
+            position += 1
37
+    finally:
38
+        firmware.close()
39
+        robin.close()
40
+env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", encrypt);

+ 17
- 1
platformio.ini View File

@@ -550,7 +550,6 @@ extra_scripts = buildroot/share/PlatformIO/scripts/mks_robin_nano.py
550 550
 build_flags   = ${common_stm32f1.build_flags}
551 551
   -DMCU_STM32F103VE -DSS_TIMER=4
552 552
 
553
-
554 553
 #
555 554
 # MKS Robin (STM32F103ZET6)
556 555
 #
@@ -627,6 +626,23 @@ lib_ignore    = ${common_stm32f1.lib_ignore}
627 626
   LiquidCrystal, LiquidTWI2, TMCStepper, U8glib-HAL, SoftwareSerialM
628 627
 
629 628
 #
629
+# MKS Robin Nano (STM32F103VET6)
630
+#
631
+[env:mks_robin_nano35]
632
+platform      = ststm32
633
+board         = genericSTM32F103VE
634
+platform_packages = tool-stm32duino
635
+build_flags   = !python Marlin/src/HAL/STM32F1/build_flags.py
636
+  ${common.build_flags} -std=gnu++14 -DHAVE_SW_SERIAL -DSS_TIMER=4
637
+build_unflags = -std=gnu++11
638
+extra_scripts = buildroot/share/PlatformIO/scripts/mks_robin_nano35.py
639
+src_filter    = ${common.default_src_filter} +<src/HAL/STM32F1>
640
+lib_deps      = ${common.lib_deps}
641
+  SoftwareSerialM=https://github.com/FYSETC/SoftwareSerialM/archive/master.zip
642
+  MKS-LittlevGL=https://github.com/makerbase-mks/MKS-LittlevGL/archive/master.zip
643
+lib_ignore    = Adafruit NeoPixel, SPI
644
+
645
+#
630 646
 # Malyan M200 v2 (STM32F070RB)
631 647
 #
632 648
 [env:STM32F070RB_malyan]

Loading…
Cancel
Save