My Marlin configs for Fabrikator Mini and CTC i3 Pro B
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

dwin.h 9.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364
  1. /**
  2. * Marlin 3D Printer Firmware
  3. * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
  4. *
  5. * Based on Sprinter and grbl.
  6. * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
  7. *
  8. * This program is free software: you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation, either version 3 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  20. *
  21. */
  22. #pragma once
  23. /**
  24. * DWIN by Creality3D
  25. */
  26. #include "../dwin_lcd.h"
  27. #include "rotary_encoder.h"
  28. #include "../../../libs/BL24CXX.h"
  29. #include <stdint.h>
  30. enum processID {
  31. // Process ID
  32. MainMenu,
  33. SelectFile,
  34. Prepare,
  35. Control,
  36. Leveling,
  37. PrintProcess,
  38. AxisMove,
  39. TemperatureID,
  40. Motion,
  41. Info,
  42. Tune,
  43. #if HAS_HOTEND
  44. PLAPreheat,
  45. ABSPreheat,
  46. #endif
  47. MaxSpeed,
  48. MaxSpeed_value,
  49. MaxAcceleration,
  50. MaxAcceleration_value,
  51. MaxJerk,
  52. MaxJerk_value,
  53. Step,
  54. Step_value,
  55. // Last Process ID
  56. Last_Prepare,
  57. // Back Process ID
  58. Back_Main,
  59. Back_Print,
  60. // Date variable ID
  61. Move_X,
  62. Move_Y,
  63. Move_Z,
  64. #if HAS_HOTEND
  65. Extruder,
  66. ETemp,
  67. #endif
  68. Homeoffset,
  69. #if HAS_HEATED_BED
  70. BedTemp,
  71. #endif
  72. #if HAS_FAN
  73. FanSpeed,
  74. #endif
  75. PrintSpeed,
  76. // Window ID
  77. Print_window,
  78. Popup_Window
  79. };
  80. // Picture ID
  81. #define Start_Process 0
  82. #define Language_English 1
  83. #define Language_Chinese 2
  84. // ICON ID
  85. #define ICON 0x09
  86. #define ICON_LOGO 0
  87. #define ICON_Print_0 1
  88. #define ICON_Print_1 2
  89. #define ICON_Prepare_0 3
  90. #define ICON_Prepare_1 4
  91. #define ICON_Control_0 5
  92. #define ICON_Control_1 6
  93. #define ICON_Leveling_0 7
  94. #define ICON_Leveling_1 8
  95. #define ICON_HotendTemp 9
  96. #define ICON_BedTemp 10
  97. #define ICON_Speed 11
  98. #define ICON_Zoffset 12
  99. #define ICON_Back 13
  100. #define ICON_File 14
  101. #define ICON_PrintTime 15
  102. #define ICON_RemainTime 16
  103. #define ICON_Setup_0 17
  104. #define ICON_Setup_1 18
  105. #define ICON_Pause_0 19
  106. #define ICON_Pause_1 20
  107. #define ICON_Continue_0 21
  108. #define ICON_Continue_1 22
  109. #define ICON_Stop_0 23
  110. #define ICON_Stop_1 24
  111. #define ICON_Bar 25
  112. #define ICON_More 26
  113. #define ICON_Axis 27
  114. #define ICON_CloseMotor 28
  115. #define ICON_Homing 29
  116. #define ICON_SetHome 30
  117. #define ICON_PLAPreheat 31
  118. #define ICON_ABSPreheat 32
  119. #define ICON_Cool 33
  120. #define ICON_Language 34
  121. #define ICON_MoveX 35
  122. #define ICON_MoveY 36
  123. #define ICON_MoveZ 37
  124. #define ICON_Extruder 38
  125. #define ICON_Temperature 40
  126. #define ICON_Motion 41
  127. #define ICON_WriteEEPROM 42
  128. #define ICON_ReadEEPROM 43
  129. #define ICON_ResumeEEPROM 44
  130. #define ICON_Info 45
  131. #define ICON_SetEndTemp 46
  132. #define ICON_SetBedTemp 47
  133. #define ICON_FanSpeed 48
  134. #define ICON_SetPLAPreheat 49
  135. #define ICON_SetABSPreheat 50
  136. #define ICON_MaxSpeed 51
  137. #define ICON_MaxAccelerated 52
  138. #define ICON_MaxJerk 53
  139. #define ICON_Step 54
  140. #define ICON_PrintSize 55
  141. #define ICON_Version 56
  142. #define ICON_Contact 57
  143. #define ICON_StockConfiguraton 58
  144. #define ICON_MaxSpeedX 59
  145. #define ICON_MaxSpeedY 60
  146. #define ICON_MaxSpeedZ 61
  147. #define ICON_MaxSpeedE 62
  148. #define ICON_MaxAccX 63
  149. #define ICON_MaxAccY 64
  150. #define ICON_MaxAccZ 65
  151. #define ICON_MaxAccE 66
  152. #define ICON_MaxSpeedJerkX 67
  153. #define ICON_MaxSpeedJerkY 68
  154. #define ICON_MaxSpeedJerkZ 69
  155. #define ICON_MaxSpeedJerkE 70
  156. #define ICON_StepX 71
  157. #define ICON_StepY 72
  158. #define ICON_StepZ 73
  159. #define ICON_StepE 74
  160. #define ICON_Setspeed 75
  161. #define ICON_SetZOffset 76
  162. #define ICON_Rectangle 77
  163. #define ICON_BLTouch 78
  164. #define ICON_TempTooLow 79
  165. #define ICON_AutoLeveling 80
  166. #define ICON_TempTooHigh 81
  167. #define ICON_NoTips_C 82
  168. #define ICON_NoTips_E 83
  169. #define ICON_Continue_C 84
  170. #define ICON_Continue_E 85
  171. #define ICON_Cancel_C 86
  172. #define ICON_Cancel_E 87
  173. #define ICON_Confirm_C 88
  174. #define ICON_Confirm_E 89
  175. #define ICON_Info_0 90
  176. #define ICON_Info_1 91
  177. /**
  178. * 3-.0:The font size, 0x00-0x09, corresponds to the font size below:
  179. * 0x00=6*12 0x01=8*16 0x02=10*20 0x03=12*24 0x04=14*28
  180. * 0x05=16*32 0x06=20*40 0x07=24*48 0x08=28*56 0x09=32*64
  181. */
  182. #define font6x12 0x00
  183. #define font8x16 0x01
  184. #define font10x20 0x02
  185. #define font12x24 0x03
  186. #define font14x28 0x04
  187. #define font16x32 0x05
  188. #define font20x40 0x06
  189. #define font24x48 0x07
  190. #define font28x56 0x08
  191. #define font32x64 0x09
  192. // Color
  193. #define White 0xFFFF
  194. #define Background_window 0x31E8 // Popup background color
  195. #define Background_blue 0x1125 // Dark blue background color
  196. #define Background_black 0x0841 // black background color
  197. #define Font_window 0xD6BA // Popup font background color
  198. #define Line_Color 0x3A6A // Split line color
  199. #define Rectangle_Color 0xEE2F // blue square cursor color
  200. #define Percent_Color 0xFE29 // percentage color
  201. #define BarFill_Color 0x10E4 // fill color of progress bar
  202. #define Select_Color 0x33BB // selected color
  203. extern int checkkey, last_checkkey;
  204. extern float zprobe_zoffset;
  205. extern char print_filename[16];
  206. extern millis_t dwin_heat_time;
  207. typedef struct {
  208. TERN_(HAS_HOTEND, int16_t E_Temp = 0);
  209. TERN_(HAS_HEATED_BED, int16_t Bed_Temp = 0);
  210. TERN_(HAS_FAN, int16_t Fan_speed = 0);
  211. int16_t print_speed = 100;
  212. float Max_Feedspeed = 0;
  213. float Max_Acceleration = 0;
  214. float Max_Jerk = 0;
  215. float Max_Step = 0;
  216. float Move_X_scale = 0;
  217. float Move_Y_scale = 0;
  218. float Move_Z_scale = 0;
  219. #if EXTRUDERS
  220. float Move_E_scale = 0;
  221. #endif
  222. float offset_value = 0;
  223. char show_mode = 0; // -1: Temperature control 0: Printing temperature
  224. } HMI_value_t;
  225. typedef struct {
  226. bool language_chinese; // 0: EN, 1: CN
  227. bool pause_flag:1;
  228. bool print_finish:1;
  229. bool confirm_flag:1;
  230. bool select_flag:1;
  231. bool home_flag:1;
  232. bool heat_flag:1; // 0: heating done 1: during heating
  233. #if HAS_HOTEND
  234. bool ETempTooLow_flag:1;
  235. #endif
  236. #if HAS_LEVELING
  237. bool leveling_offset_flag:1;
  238. #endif
  239. #if HAS_FAN
  240. char feedspeed_flag;
  241. #endif
  242. char acc_flag;
  243. char jerk_flag;
  244. char step_flag;
  245. } HMI_Flag;
  246. extern HMI_value_t HMI_ValueStruct;
  247. extern HMI_Flag HMI_flag;
  248. // Language
  249. void HMI_SetLanguage(void);
  250. void HMI_SetAndSaveLanguageWestern(void);
  251. void HMI_SetAndSaveLanguageChinese(void);
  252. // Show ICO
  253. void ICON_Print(bool show);
  254. void ICON_Prepare(bool show);
  255. void ICON_Control(bool show);
  256. void ICON_Leveling(bool show);
  257. void ICON_StartInfo(bool show);
  258. void ICON_Setting(bool show);
  259. void ICON_Pause(bool show);
  260. void ICON_Continue(bool show);
  261. void ICON_Stop(bool show);
  262. // Popup window tips
  263. #if HAS_HOTEND
  264. void Popup_Window_Temperature(const bool toohigh);
  265. void Popup_Window_ETempTooLow(void);
  266. #endif
  267. void Popup_Window_Resume(void);
  268. void Popup_Window_Home(void);
  269. void Popup_Window_Leveling(void);
  270. void Goto_PrintProcess(void);
  271. void Goto_MainMenu(void);
  272. // Variable control
  273. void HMI_Move_X(void);
  274. void HMI_Move_Y(void);
  275. void HMI_Move_Z(void);
  276. void HMI_Move_E(void);
  277. void HMI_Zoffset(void);
  278. TERN_(HAS_HOTEND, void HMI_ETemp(void));
  279. TERN_(HAS_HEATED_BED, void HMI_BedTemp(void));
  280. TERN_(HAS_FAN, void HMI_FanSpeed(void));
  281. void HMI_PrintSpeed(void);
  282. void HMI_MaxFeedspeedXYZE(void);
  283. void HMI_MaxAccelerationXYZE(void);
  284. void HMI_MaxJerkXYZE(void);
  285. void HMI_StepXYZE(void);
  286. void update_variable(void);
  287. void DWIN_Draw_Signed_Float(uint8_t size, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, long value);
  288. // SD Card
  289. void HMI_SDCardInit(void);
  290. void HMI_SDCardUpdate(void);
  291. // Main Process
  292. void Icon_print(bool value);
  293. void Icon_control(bool value);
  294. void Icon_temperature(bool value);
  295. void Icon_leveling(bool value);
  296. // Other
  297. bool Pause_HeatStatus();
  298. void HMI_StartFrame(const bool with_update); // Startup screen
  299. void HMI_MainMenu(void); // Main process screen
  300. void HMI_SelectFile(void); // File page
  301. void HMI_Printing(void); // Print page
  302. void HMI_Prepare(void); // Prepare page
  303. void HMI_Control(void); // Control page
  304. void HMI_Leveling(void); // Level the page
  305. void HMI_AxisMove(void); // Axis movement menu
  306. void HMI_Temperature(void); // Temperature menu
  307. void HMI_Motion(void); // Sports menu
  308. void HMI_Info(void); // Information menu
  309. void HMI_Tune(void); // Adjust the menu
  310. #if HAS_HOTEND
  311. void HMI_PLAPreheatSetting(void); // PLA warm-up setting
  312. void HMI_ABSPreheatSetting(void); // ABS warm-up setting
  313. #endif
  314. void HMI_MaxSpeed(void); // Maximum speed submenu
  315. void HMI_MaxAcceleration(void); // Maximum acceleration submenu
  316. void HMI_MaxJerk(void); // Maximum jerk speed submenu
  317. void HMI_Step(void); // Transmission ratio
  318. void HMI_Init(void);
  319. void DWIN_Update(void);
  320. void EachMomentUpdate(void);
  321. void DWIN_HandleScreen(void);
  322. void DWIN_CompletedHoming(void);
  323. void DWIN_CompletedLeveling(void);