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 7.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295
  1. /**
  2. * Marlin 3D Printer Firmware
  3. * Copyright (c) 2021 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 Enhanced implementation for PRO UI
  25. * Author: Miguel A. Risco-Castillo (MRISCOC)
  26. * Version: 3.17.2
  27. * Date: 2022/04/08
  28. */
  29. #include "dwin_defines.h"
  30. #include "dwinui.h"
  31. #include "../common/encoder.h"
  32. #include "../../../libs/BL24CXX.h"
  33. #include "../../../inc/MarlinConfig.h"
  34. enum processID : uint8_t {
  35. // Process ID
  36. MainMenu,
  37. Menu,
  38. SetInt,
  39. SetPInt,
  40. SetIntNoDraw,
  41. SetFloat,
  42. SetPFloat,
  43. SelectFile,
  44. PrintProcess,
  45. Popup,
  46. Leveling,
  47. Locked,
  48. Reboot,
  49. PrintDone,
  50. ESDiagProcess,
  51. WaitResponse,
  52. Homing,
  53. PidProcess,
  54. NothingToDo
  55. };
  56. enum pidresult_t : uint8_t {
  57. PID_BAD_EXTRUDER_NUM,
  58. PID_TEMP_TOO_HIGH,
  59. PID_TUNING_TIMEOUT,
  60. PID_EXTR_START,
  61. PID_BED_START,
  62. PID_DONE
  63. };
  64. #define DWIN_CHINESE 123
  65. #define DWIN_ENGLISH 0
  66. typedef struct {
  67. int8_t Color[3]; // Color components
  68. pidresult_t pidresult = PID_DONE;
  69. uint8_t Select = 0; // Auxiliary selector variable
  70. AxisEnum axis = X_AXIS; // Axis Select
  71. } HMI_value_t;
  72. typedef struct {
  73. uint8_t language;
  74. bool percent_flag:1; // percent was override by M73
  75. bool remain_flag:1; // remain was override by M73
  76. bool pause_flag:1; // printing is paused
  77. bool pause_action:1; // flag a pause action
  78. bool abort_flag:1; // printing is aborting
  79. bool abort_action:1; // flag a aborting action
  80. bool print_finish:1; // print was finished
  81. bool select_flag:1; // Popup button selected
  82. bool home_flag:1; // homing in course
  83. bool heat_flag:1; // 0: heating done 1: during heating
  84. } HMI_flag_t;
  85. extern HMI_value_t HMI_value;
  86. extern HMI_flag_t HMI_flag;
  87. extern uint8_t checkkey;
  88. extern millis_t dwin_heat_time;
  89. // Popups
  90. #if HAS_HOTEND || HAS_HEATED_BED
  91. void DWIN_Popup_Temperature(const bool toohigh);
  92. #endif
  93. #if ENABLED(POWER_LOSS_RECOVERY)
  94. void Popup_PowerLossRecovery();
  95. #endif
  96. // Tool Functions
  97. #if ENABLED(EEPROM_SETTINGS)
  98. void WriteEeprom();
  99. void ReadEeprom();
  100. void ResetEeprom();
  101. #if HAS_MESH
  102. void SaveMesh();
  103. #endif
  104. #endif
  105. void RebootPrinter();
  106. void DisableMotors();
  107. void AutoLev();
  108. void AutoHome();
  109. #if HAS_PREHEAT
  110. void DoPreheat0();
  111. void DoPreheat1();
  112. void DoPreheat2();
  113. #endif
  114. void DoCoolDown();
  115. #if HAS_HOTEND
  116. void HotendPID();
  117. #endif
  118. #if HAS_HEATED_BED
  119. void BedPID();
  120. #endif
  121. #if ENABLED(BAUD_RATE_GCODE)
  122. void HMI_SetBaudRate();
  123. void SetBaud115K();
  124. void SetBaud250K();
  125. #endif
  126. #if HAS_LCD_BRIGHTNESS
  127. void TurnOffBacklight();
  128. #endif
  129. void ApplyExtMinT();
  130. void ParkHead();
  131. #if HAS_ONESTEP_LEVELING
  132. void Trammingwizard();
  133. #endif
  134. #if BOTH(LED_CONTROL_MENU, HAS_COLOR_LEDS)
  135. void ApplyLEDColor();
  136. #endif
  137. #if ENABLED(AUTO_BED_LEVELING_UBL)
  138. void UBLTiltMesh();
  139. bool UBLValidMesh();
  140. void UBLSaveMesh();
  141. void UBLLoadMesh();
  142. #endif
  143. // Other
  144. void Goto_PrintProcess();
  145. void Goto_Main_Menu();
  146. void Goto_Info_Menu();
  147. void Goto_PowerLossRecovery();
  148. void Goto_ConfirmToPrint();
  149. void DWIN_Draw_Dashboard(const bool with_update); // Status Area
  150. void Draw_Main_Area(); // Redraw main area
  151. void DWIN_DrawStatusLine(); // Draw simple status text
  152. void DWIN_RedrawDash(); // Redraw Dash and Status line
  153. void DWIN_RedrawScreen(); // Redraw all screen elements
  154. void HMI_MainMenu(); // Main process screen
  155. void HMI_SelectFile(); // File page
  156. void HMI_Printing(); // Print page
  157. void HMI_ReturnScreen(); // Return to previous screen before popups
  158. void HMI_WaitForUser();
  159. void HMI_SaveProcessID(const uint8_t id);
  160. void HMI_SDCardInit();
  161. void HMI_SDCardUpdate();
  162. void EachMomentUpdate();
  163. void update_variable();
  164. void DWIN_InitScreen();
  165. void DWIN_HandleScreen();
  166. void DWIN_CheckStatusMessage();
  167. void DWIN_HomingStart();
  168. void DWIN_HomingDone();
  169. #if HAS_MESH
  170. void DWIN_MeshUpdate(const int8_t xpos, const int8_t ypos, const_float_t zval);
  171. #endif
  172. void DWIN_LevelingStart();
  173. void DWIN_LevelingDone();
  174. void DWIN_PidTuning(pidresult_t result);
  175. void DWIN_Print_Started(const bool sd=false);
  176. void DWIN_Print_Pause();
  177. void DWIN_Print_Resume();
  178. void DWIN_Print_Finished();
  179. void DWIN_Print_Aborted();
  180. #if HAS_FILAMENT_SENSOR
  181. void DWIN_FilamentRunout(const uint8_t extruder);
  182. #endif
  183. void DWIN_M73();
  184. void DWIN_Print_Header(const char *text);
  185. void DWIN_SetColorDefaults();
  186. void DWIN_ApplyColor();
  187. void DWIN_CopySettingsTo(char * const buff);
  188. void DWIN_CopySettingsFrom(const char * const buff);
  189. void DWIN_SetDataDefaults();
  190. void DWIN_RebootScreen();
  191. #if ENABLED(ADVANCED_PAUSE_FEATURE)
  192. void DWIN_Popup_Pause(FSTR_P const fmsg, uint8_t button=0);
  193. void Draw_Popup_FilamentPurge();
  194. void Goto_FilamentPurge();
  195. void HMI_FilamentPurge();
  196. #endif
  197. // Utility and extensions
  198. #if HAS_LOCKSCREEN
  199. void DWIN_LockScreen();
  200. void DWIN_UnLockScreen();
  201. void HMI_LockScreen();
  202. #endif
  203. #if HAS_MESH
  204. void DWIN_MeshViewer();
  205. #endif
  206. #if HAS_GCODE_PREVIEW
  207. void HMI_ConfirmToPrint();
  208. #endif
  209. #if HAS_ESDIAG
  210. void Draw_EndStopDiag();
  211. #endif
  212. #if ENABLED(PRINTCOUNTER)
  213. void Draw_PrintStats();
  214. #endif
  215. // Menu drawing functions
  216. void Draw_Control_Menu();
  217. void Draw_AdvancedSettings_Menu();
  218. void Draw_Prepare_Menu();
  219. void Draw_Move_Menu();
  220. void Draw_Tramming_Menu();
  221. #if HAS_HOME_OFFSET
  222. void Draw_HomeOffset_Menu();
  223. #endif
  224. #if HAS_BED_PROBE
  225. void Draw_ProbeSet_Menu();
  226. #endif
  227. void Draw_FilSet_Menu();
  228. #if ENABLED(NOZZLE_PARK_FEATURE)
  229. void Draw_ParkPos_Menu();
  230. #endif
  231. void Draw_PhySet_Menu();
  232. void Draw_SelectColors_Menu();
  233. void Draw_GetColor_Menu();
  234. #if BOTH(CASE_LIGHT_MENU, CASELIGHT_USES_BRIGHTNESS)
  235. void Draw_CaseLight_Menu();
  236. #endif
  237. #if ENABLED(LED_CONTROL_MENU)
  238. void Draw_LedControl_Menu();
  239. #endif
  240. void Draw_Tune_Menu();
  241. void Draw_Motion_Menu();
  242. #if ENABLED(ADVANCED_PAUSE_FEATURE)
  243. void Draw_FilamentMan_Menu();
  244. #endif
  245. #if ENABLED(MESH_BED_LEVELING)
  246. void Draw_ManualMesh_Menu();
  247. #endif
  248. #if HAS_HOTEND
  249. void Draw_Preheat1_Menu();
  250. void Draw_Preheat2_Menu();
  251. void Draw_Preheat3_Menu();
  252. #if ENABLED(PIDTEMP)
  253. void Draw_HotendPID_Menu();
  254. #endif
  255. #endif
  256. void Draw_Temperature_Menu();
  257. void Draw_MaxSpeed_Menu();
  258. void Draw_MaxAccel_Menu();
  259. #if HAS_CLASSIC_JERK
  260. void Draw_MaxJerk_Menu();
  261. #endif
  262. void Draw_Steps_Menu();
  263. #if ENABLED(PIDTEMPBED)
  264. void Draw_BedPID_Menu();
  265. #endif
  266. #if EITHER(HAS_BED_PROBE, BABYSTEPPING)
  267. void Draw_ZOffsetWiz_Menu();
  268. #endif
  269. #if ENABLED(INDIVIDUAL_AXIS_HOMING_SUBMENU)
  270. void Draw_Homing_Menu();
  271. #endif
  272. #if ENABLED(FWRETRACT)
  273. void Draw_FWRetract_Menu();
  274. #endif
  275. #if HAS_MESH
  276. void Draw_MeshSet_Menu();
  277. #if ENABLED(MESH_EDIT_MENU)
  278. void Draw_EditMesh_Menu();
  279. #endif
  280. #endif