Browse Source

Clean up DWIN code

Scott Lahteine 5 years ago
parent
commit
e78f19bc87

+ 4
- 1
Marlin/src/inc/Conditionals_post.h View File

@@ -1776,7 +1776,10 @@
1776 1776
 // Shorthand for common combinations
1777 1777
 #if HAS_TEMP_BED && HAS_HEATER_BED
1778 1778
   #define HAS_HEATED_BED 1
1779
-  #define BED_MAX_TARGET (BED_MAXTEMP - 10)
1779
+  #ifndef BED_OVERSHOOT
1780
+    #define BED_OVERSHOOT 10
1781
+  #endif
1782
+  #define BED_MAX_TARGET (BED_MAXTEMP - (BED_OVERSHOOT))
1780 1783
 #endif
1781 1784
 #if HAS_HEATED_BED || HAS_TEMP_CHAMBER
1782 1785
   #define BED_OR_CHAMBER 1

+ 1053
- 983
Marlin/src/lcd/dwin/dwin.cpp
File diff suppressed because it is too large
View File


+ 54
- 102
Marlin/src/lcd/dwin/dwin.h View File

@@ -31,45 +31,8 @@
31 31
 
32 32
 #include <stdint.h>
33 33
 
34
-#define MACHINE_SIZE    "220x220x250"
35
-#define CORP_WEBSITE_C  "www.cxsw3d.com"
36
-#define CORP_WEBSITE_E  "www.creality.com"
37
-
38
-/*********************************/
39
-
40
-#define MENU_CHAR_LIMIT  24
41
-
42
-/*fan speed limit*/
43
-#define FanOn           255
44
-#define FanOff          0
45
-
46
-/*print speed limit*/
47
-#define max_print_speed   999
48
-#define min_print_speed   10
49
-
50
-/*Temp limit*/
51
-#define max_E_Temp    (HEATER_0_MAXTEMP - 15)
52
-#define min_E_Temp    HEATER_0_MINTEMP
53
-#define max_Bed_Temp  (BED_MAXTEMP  - 10)
54
-#define min_Bed_Temp  BED_MINTEMP
55
-
56
-/*Feedspeed limit*/  // max feedspeed = DEFAULT_MAX_FEEDRATE * 2
57
-#define min_MaxFeedspeed      1
58
-#define min_MaxAcceleration   1
59
-#define min_MaxCorner         0.1
60
-#define min_Step              1
61
-
62
-#define FEEDRATE_E      (60)
63
-
64
-// mininum unit (0.1) : multiple (10)
65
-#define MinUnitMult   10
66
-
67
-#define Encoder_wait    20
68
-#define DWIN_SCROLL_UPDATE_INTERVAL 2000
69
-#define DWIN_REMAIN_TIME_UPDATE_INTERVAL 20000
70
-
71 34
 enum processID {
72
-  /*Process ID*/
35
+  // Process ID
73 36
   MainMenu,
74 37
   SelectFile,
75 38
   Prepare,
@@ -94,14 +57,14 @@ enum processID {
94 57
   Step,
95 58
   Step_value,
96 59
 
97
-  /*Last Process ID*/
60
+  // Last Process ID
98 61
   Last_Prepare,
99 62
 
100
-  /*Back Process ID*/
63
+  // Back Process ID
101 64
   Back_Main,
102 65
   Back_Print,
103 66
 
104
-  /*Date variable ID*/
67
+  // Date variable ID
105 68
   Move_X,
106 69
   Move_Y,
107 70
   Move_Z,
@@ -118,17 +81,17 @@ enum processID {
118 81
   #endif
119 82
   PrintSpeed,
120 83
 
121
-  /*Window ID*/
84
+  // Window ID
122 85
   Print_window,
123 86
   Popup_Window
124 87
 };
125 88
 
126
-/*Picture ID*/
89
+// Picture ID
127 90
 #define Start_Process       0
128 91
 #define Language_English    1
129 92
 #define Language_Chinese    2
130 93
 
131
-/*ICON ID*/
94
+// ICON ID
132 95
 #define ICON                      0x09
133 96
 #define ICON_LOGO                  0
134 97
 #define ICON_Print_0               1
@@ -227,11 +190,11 @@ enum processID {
227 190
 #define ICON_Info_0               90
228 191
 #define ICON_Info_1               91
229 192
 
230
-/*
231
-* 3-.0:字号大小,0x00-0x09,对应字体大小于下:
232
-* 0x00=6*12   0x01=8*16   0x02=10*20  0x03=12*24  0x04=14*28
233
-* 0x05=16*32  0x06=20*40  0x07=24*48  0x08=28*56  0x09=32*64
234
-*/
193
+/**
194
+ * 3-.0:The font size, 0x00-0x09, corresponds to the font size below:
195
+ * 0x00=6*12   0x01=8*16   0x02=10*20  0x03=12*24  0x04=14*28
196
+ * 0x05=16*32  0x06=20*40  0x07=24*48  0x08=28*56  0x09=32*64
197
+ */
235 198
 #define font6x12  0x00
236 199
 #define font8x16  0x01
237 200
 #define font10x20 0x02
@@ -243,17 +206,17 @@ enum processID {
243 206
 #define font28x56 0x08
244 207
 #define font32x64 0x09
245 208
 
246
-/* Colour */
209
+// Color
247 210
 #define White             0xFFFF
248
-#define Background_window 0x31E8  // 弹窗背景色
249
-#define Background_blue   0x1125  // 暗蓝背景色
250
-#define Background_black  0x0841  // 黑色背景色
251
-#define Font_window       0xD6BA  // 弹窗字体背景色
252
-#define Line_Color        0x3A6A  // 分割线颜色
253
-#define Rectangle_Color   0xEE2F  // 蓝色方块光标颜色
254
-#define Percent_Color     0xFE29  // 百分比颜色
255
-#define BarFill_Color     0x10E4  // 进度条填充色
256
-#define Select_Color      0x33BB  // 选中色
211
+#define Background_window 0x31E8  // Popup background color
212
+#define Background_blue   0x1125  // Dark blue background color
213
+#define Background_black  0x0841  // black background color
214
+#define Font_window       0xD6BA  // Popup font background color
215
+#define Line_Color        0x3A6A  // Split line color
216
+#define Rectangle_Color   0xEE2F  // blue square cursor color
217
+#define Percent_Color     0xFE29  // percentage color
218
+#define BarFill_Color     0x10E4  // fill color of progress bar
219
+#define Select_Color      0x33BB  // selected color
257 220
 
258 221
 extern int checkkey, last_checkkey;
259 222
 extern float zprobe_zoffset;
@@ -262,15 +225,9 @@ extern char print_filename[16];
262 225
 extern millis_t dwin_heat_time;
263 226
 
264 227
 typedef struct {
265
-  #if HAS_HOTEND
266
-    int16_t E_Temp        = 0;
267
-  #endif
268
-  #if HAS_HEATED_BED
269
-    int16_t Bed_Temp      = 0;
270
-  #endif
271
-  #if HAS_FAN
272
-    int16_t Fan_speed     = 0;
273
-  #endif
228
+  TERN_(HAS_HOTEND,     int16_t E_Temp    = 0);
229
+  TERN_(HAS_HEATED_BED, int16_t Bed_Temp  = 0);
230
+  TERN_(HAS_FAN,        int16_t Fan_speed = 0);
274 231
   int16_t print_speed     = 100;
275 232
   float Max_Feedspeed     = 0;
276 233
   float Max_Acceleration  = 0;
@@ -311,12 +268,12 @@ typedef struct {
311 268
 extern HMI_value_t HMI_ValueStruct;
312 269
 extern HMI_Flag    HMI_flag;
313 270
 
314
-/* Language */
271
+// Language
315 272
 void lcd_select_language(void);
316 273
 void set_english_to_eeprom(void);
317 274
 void set_chinese_to_eeprom(void);
318 275
 
319
-/* Show ICON*/
276
+// Show ICO
320 277
 void ICON_Print(bool show);
321 278
 void ICON_Prepare(bool show);
322 279
 void ICON_Control(bool show);
@@ -328,7 +285,7 @@ void ICON_Pause(bool show);
328 285
 void ICON_Continue(bool show);
329 286
 void ICON_Stop(bool show);
330 287
 
331
-/* Popup window tips */
288
+// Popup window tips
332 289
 #if HAS_HOTEND
333 290
   void Popup_Window_Temperature(const bool toohigh);
334 291
   void Popup_Window_ETempTooLow(void);
@@ -341,7 +298,7 @@ void Popup_Window_Leveling(void);
341 298
 void Goto_PrintProcess(void);
342 299
 void Goto_MainMenu(void);
343 300
 
344
-/* Variable control */
301
+// Variable control
345 302
 void HMI_Move_X(void);
346 303
 void HMI_Move_Y(void);
347 304
 void HMI_Move_Z(void);
@@ -349,15 +306,10 @@ void HMI_Move_E(void);
349 306
 
350 307
 void HMI_Zoffset(void);
351 308
 
352
-#if HAS_HOTEND
353
-  void HMI_ETemp(void);
354
-#endif
355
-#if HAS_HEATED_BED
356
-  void HMI_BedTemp(void);
357
-#endif
358
-#if HAS_FAN
359
-  void HMI_FanSpeed(void);
360
-#endif
309
+TERN_(HAS_HOTEND,     void HMI_ETemp(void));
310
+TERN_(HAS_HEATED_BED, void HMI_BedTemp(void));
311
+TERN_(HAS_FAN,        void HMI_FanSpeed(void));
312
+
361 313
 void HMI_PrintSpeed(void);
362 314
 
363 315
 void HMI_MaxFeedspeedXYZE(void);
@@ -368,40 +320,40 @@ void HMI_StepXYZE(void);
368 320
 void update_variable(void);
369 321
 void show_plus_or_minus(uint8_t size, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, long value);
370 322
 
371
-/* SD Card */
323
+// SD Card
372 324
 void HMI_SDCardInit(void);
373 325
 void HMI_SDCardUpdate(void);
374 326
 
375
-/* Main Process */
327
+// Main Process
376 328
 void Icon_print(bool value);
377 329
 void Icon_control(bool value);
378 330
 void Icon_temperature(bool value);
379 331
 void Icon_leveling(bool value);
380 332
 
381
-/* Other */
333
+// Other
382 334
 bool Pause_HeatStatus();
383
-void HMI_StartFrame(const bool with_update); // 开机画面
384
-void HMI_MainMenu(void);          // 主进程画面
385
-void HMI_SelectFile(void);        // 文件页
386
-void HMI_Printing(void);          // 打印页
387
-void HMI_Prepare(void);           // 准备页
388
-void HMI_Control(void);           // 控制页
389
-void HMI_Leveling(void);          // 调平页
390
-void HMI_AxisMove(void);          // 轴移动菜单
391
-void HMI_Temperature(void);       // 温度菜单
392
-void HMI_Motion(void);            // 运动菜单
393
-void HMI_Info(void);              // 信息菜单
394
-void HMI_Tune(void);              // 调整菜单
335
+void HMI_StartFrame(const bool with_update); // startup screen
336
+void HMI_MainMenu(void);          // main process screen
337
+void HMI_SelectFile(void);        // file page
338
+void HMI_Printing(void);          // print page
339
+void HMI_Prepare(void);           // prepare page
340
+void HMI_Control(void);           // control page
341
+void HMI_Leveling(void);          // Level the page
342
+void HMI_AxisMove(void);          // Axis movement menu
343
+void HMI_Temperature(void);       // Temperature menu
344
+void HMI_Motion(void);            // Sports menu
345
+void HMI_Info(void);              // Information menu
346
+void HMI_Tune(void);              // Adjust the menu
395 347
 
396 348
 #if HAS_HOTEND
397
-  void HMI_PLAPreheatSetting(void); // PLA预热设置
398
-  void HMI_ABSPreheatSetting(void); // ABS预热设置
349
+  void HMI_PLAPreheatSetting(void); // PLA warm-up setting
350
+  void HMI_ABSPreheatSetting(void); // ABS warm-up setting
399 351
 #endif
400 352
 
401
-void HMI_MaxSpeed(void);          // 最大速度子菜单
402
-void HMI_MaxAcceleration(void);   // 最大加速度子菜单
403
-void HMI_MaxCorner(void);         // 最大拐角速度子菜单
404
-void HMI_Step(void);              // 传动比
353
+void HMI_MaxSpeed(void);          // Maximum speed submenu
354
+void HMI_MaxAcceleration(void);   // Maximum acceleration submenu
355
+void HMI_MaxCorner(void);         // Maximum corner speed submenu
356
+void HMI_Step(void);              // transmission ratio
405 357
 
406 358
 void HMI_Init(void);
407 359
 void DWIN_Update(void);

+ 19
- 19
Marlin/src/lcd/dwin/eeprom_BL24CXX.h View File

@@ -30,11 +30,11 @@
30 30
 
31 31
 /******************** IIC ********************/
32 32
 
33
-//IO方向设置
33
+//IO direction setting
34 34
 #define SDA_IN()  do{ PIN_MAP[IIC_EEPROM_SDA].gpio_device->regs->CRH &= 0XFFFF0FFF; PIN_MAP[IIC_EEPROM_SDA].gpio_device->regs->CRH |= 8 << 12; }while(0)
35 35
 #define SDA_OUT() do{ PIN_MAP[IIC_EEPROM_SDA].gpio_device->regs->CRH &= 0XFFFF0FFF; PIN_MAP[IIC_EEPROM_SDA].gpio_device->regs->CRH |= 3 << 12; }while(0)
36 36
 
37
-//IO操作函数
37
+//IO operation function
38 38
 #define IIC_SCL_0()   WRITE(IIC_EEPROM_SCL, LOW)
39 39
 #define IIC_SCL_1()   WRITE(IIC_EEPROM_SCL, HIGH)
40 40
 #define IIC_SDA_0()   WRITE(IIC_EEPROM_SDA, LOW)
@@ -43,18 +43,18 @@
43 43
 
44 44
 class BL24CXX;
45 45
 
46
-// IIC所有操作函数
46
+// All operation functions of IIC
47 47
 class IIC {
48 48
 friend class BL24CXX;
49 49
 protected:
50
-  static void init();                // 初始化IIC的IO口
51
-  static void start();               // 发送IIC开始信号
52
-  static void stop();                // 发送IIC停止信号
53
-  static void send_byte(uint8_t txd); // IIC发送一个字节
54
-  static uint8_t read_byte(unsigned char ack); // IIC读取一个字节
55
-  static uint8_t wait_ack();         // IIC等待ACK信号
56
-  static void ack();                 // IIC发送ACK信号
57
-  static void nAck();                // IIC不发送ACK信号
50
+  static void init();                // Initialize the IO port of IIC
51
+  static void start();               // Send IIC start signal
52
+  static void stop();                // Send IIC stop signal
53
+  static void send_byte(uint8_t txd); // IIC sends a byte
54
+  static uint8_t read_byte(unsigned char ack); // IIC reads a byte
55
+  static uint8_t wait_ack();         // IIC waits for ACK signal
56
+  static void ack();                 // IIC sends ACK signal
57
+  static void nAck();                // IIC does not send ACK signal
58 58
 
59 59
   static void write_one_byte(uint8_t daddr, uint8_t addr, uint8_t data);
60 60
   static uint8_t read_one_byte(uint8_t daddr, uint8_t addr);
@@ -75,12 +75,12 @@ protected:
75 75
 
76 76
 class BL24CXX {
77 77
 public:
78
-  static void init(); //初始化IIC
79
-  static uint8_t check();  //检查器件
80
-  static uint8_t readOneByte(uint16_t ReadAddr);                       //指定地址读取一个字节
81
-  static void writeOneByte(uint16_t WriteAddr, uint8_t DataToWrite);   //指定地址写入一个字节
82
-  static void writeLenByte(uint16_t WriteAddr, uint32_t DataToWrite, uint8_t Len);//指定地址开始写入指定长度的数据
83
-  static uint32_t readLenByte(uint16_t ReadAddr, uint8_t Len);         //指定地址开始读取指定长度数据
84
-  static void write(uint16_t WriteAddr, uint8_t *pBuffer, uint16_t NumToWrite);  //从指定地址开始写入指定长度的数据
85
-  static void read(uint16_t ReadAddr, uint8_t *pBuffer, uint16_t NumToRead);     //从指定地址开始读出指定长度的数据
78
+  static void init(); // Initialize IIC
79
+  static uint8_t check();  // Check the device
80
+  static uint8_t readOneByte(uint16_t ReadAddr);                       // Read a byte at the specified address
81
+  static void writeOneByte(uint16_t WriteAddr, uint8_t DataToWrite);   // Write a byte at the specified address
82
+  static void writeLenByte(uint16_t WriteAddr, uint32_t DataToWrite, uint8_t Len);// The specified address begins to write the data of the specified length
83
+  static uint32_t readLenByte(uint16_t ReadAddr, uint8_t Len);         // The specified address starts to read the data of the specified length
84
+  static void write(uint16_t WriteAddr, uint8_t *pBuffer, uint16_t NumToWrite);  // Write the specified length of data from the specified address
85
+  static void read(uint16_t ReadAddr, uint8_t *pBuffer, uint16_t NumToRead);     // Read the data of the specified length from the specified address
86 86
 };

+ 1
- 4
Marlin/src/lcd/menu/menu_advanced.cpp View File

@@ -314,10 +314,7 @@ void menu_cancelobject();
314 314
         #undef PID_BED_MENU_SECTION
315 315
       #endif
316 316
       #if ENABLED(PID_AUTOTUNE_MENU)
317
-        #ifndef BED_OVERSHOOT
318
-          #define BED_OVERSHOOT 5
319
-        #endif
320
-        EDIT_ITEM_FAST_N(int3, -1, MSG_PID_AUTOTUNE_E, &autotune_temp_bed, PREHEAT_1_TEMP_BED, BED_MAXTEMP - BED_OVERSHOOT, []{ _lcd_autotune(-1); });
317
+        EDIT_ITEM_FAST_N(int3, -1, MSG_PID_AUTOTUNE_E, &autotune_temp_bed, PREHEAT_1_TEMP_BED, BED_MAX_TARGET, []{ _lcd_autotune(-1); });
321 318
       #endif
322 319
     #endif
323 320
 

Loading…
Cancel
Save