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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  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 "../common/encoder.h"
  28. #include "../../../libs/BL24CXX.h"
  29. #include "../../../inc/MarlinConfigPre.h"
  30. enum processID : uint8_t {
  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_PREHEAT
  44. PLAPreheat,
  45. #if PREHEAT_COUNT > 1
  46. ABSPreheat,
  47. #endif
  48. #endif
  49. MaxSpeed,
  50. MaxSpeed_value,
  51. MaxAcceleration,
  52. MaxAcceleration_value,
  53. MaxJerk,
  54. MaxJerk_value,
  55. Step,
  56. Step_value,
  57. HomeOff,
  58. HomeOffX,
  59. HomeOffY,
  60. HomeOffZ,
  61. // Last Process ID
  62. Last_Prepare,
  63. // Advance Settings
  64. AdvSet,
  65. ProbeOff,
  66. ProbeOffX,
  67. ProbeOffY,
  68. // Back Process ID
  69. Back_Main,
  70. Back_Print,
  71. // Date variable ID
  72. Move_X,
  73. Move_Y,
  74. Move_Z,
  75. #if HAS_HOTEND
  76. Extruder,
  77. ETemp,
  78. #endif
  79. Homeoffset,
  80. #if HAS_HEATED_BED
  81. BedTemp,
  82. #endif
  83. #if HAS_FAN
  84. FanSpeed,
  85. #endif
  86. PrintSpeed,
  87. // Window ID
  88. Print_window,
  89. Popup_Window
  90. };
  91. extern uint8_t checkkey;
  92. extern float zprobe_zoffset;
  93. extern char print_filename[16];
  94. extern millis_t dwin_heat_time;
  95. typedef struct {
  96. #if HAS_HOTEND
  97. celsius_t E_Temp = 0;
  98. #endif
  99. #if HAS_HEATED_BED
  100. celsius_t Bed_Temp = 0;
  101. #endif
  102. #if HAS_FAN
  103. int16_t Fan_speed = 0;
  104. #endif
  105. int16_t print_speed = 100;
  106. float Max_Feedspeed = 0;
  107. float Max_Acceleration = 0;
  108. float Max_Jerk_scaled = 0;
  109. float Max_Step_scaled = 0;
  110. float Move_X_scaled = 0;
  111. float Move_Y_scaled = 0;
  112. float Move_Z_scaled = 0;
  113. #if HAS_HOTEND
  114. float Move_E_scaled = 0;
  115. #endif
  116. float offset_value = 0;
  117. int8_t show_mode = 0; // -1: Temperature control 0: Printing temperature
  118. float Home_OffX_scaled = 0;
  119. float Home_OffY_scaled = 0;
  120. float Home_OffZ_scaled = 0;
  121. float Probe_OffX_scaled = 0;
  122. float Probe_OffY_scaled = 0;
  123. } HMI_value_t;
  124. #define DWIN_CHINESE 123
  125. #define DWIN_ENGLISH 0
  126. typedef struct {
  127. uint8_t language;
  128. bool pause_flag:1; // printing is paused
  129. bool pause_action:1; // flag a pause action
  130. bool print_finish:1; // print was finished
  131. bool select_flag:1; // Popup button selected
  132. bool home_flag:1; // homing in course
  133. bool heat_flag:1; // 0: heating done 1: during heating
  134. bool done_confirm_flag:1;
  135. #if ENABLED(PREVENT_COLD_EXTRUSION)
  136. bool cold_flag:1;
  137. #endif
  138. AxisEnum feedspeed_axis, acc_axis, jerk_axis, step_axis;
  139. } HMI_flag_t;
  140. extern HMI_value_t HMI_ValueStruct;
  141. extern HMI_flag_t HMI_flag;
  142. #if HAS_HOTEND || HAS_HEATED_BED
  143. // Popup message window
  144. void DWIN_Popup_Temperature(const bool toohigh);
  145. #endif
  146. #if HAS_HOTEND
  147. void Popup_Window_ETempTooLow();
  148. #endif
  149. void Popup_Window_Resume();
  150. void Popup_Window_Home(const bool parking=false);
  151. void Popup_Window_Leveling();
  152. void Goto_PrintProcess();
  153. void Goto_MainMenu();
  154. // Variable control
  155. void HMI_Move_X();
  156. void HMI_Move_Y();
  157. void HMI_Move_Z();
  158. void HMI_Move_E();
  159. void HMI_Zoffset();
  160. #if HAS_HOTEND
  161. void HMI_ETemp();
  162. #endif
  163. #if HAS_HEATED_BED
  164. void HMI_BedTemp();
  165. #endif
  166. #if HAS_FAN
  167. void HMI_FanSpeed();
  168. #endif
  169. void HMI_PrintSpeed();
  170. void HMI_MaxFeedspeedXYZE();
  171. void HMI_MaxAccelerationXYZE();
  172. void HMI_MaxJerkXYZE();
  173. void HMI_StepXYZE();
  174. void HMI_SetLanguageCache();
  175. void update_variable();
  176. 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);
  177. // SD Card
  178. void HMI_SDCardInit();
  179. void HMI_SDCardUpdate();
  180. // Main Process
  181. void Icon_print(bool value);
  182. void Icon_control(bool value);
  183. void Icon_temperature(bool value);
  184. void Icon_leveling(bool value);
  185. // Other
  186. void Draw_Status_Area(const bool with_update); // Status Area
  187. void HMI_StartFrame(const bool with_update); // Prepare the menu view
  188. void HMI_MainMenu(); // Main process screen
  189. void HMI_SelectFile(); // File page
  190. void HMI_Printing(); // Print page
  191. void HMI_Prepare(); // Prepare page
  192. void HMI_Control(); // Control page
  193. void HMI_Leveling(); // Level the page
  194. void HMI_AxisMove(); // Axis movement menu
  195. void HMI_Temperature(); // Temperature menu
  196. void HMI_Motion(); // Sports menu
  197. void HMI_Info(); // Information menu
  198. void HMI_Tune(); // Adjust the menu
  199. #if HAS_PREHEAT
  200. void HMI_PLAPreheatSetting(); // PLA warm-up setting
  201. void HMI_ABSPreheatSetting(); // ABS warm-up setting
  202. #endif
  203. void HMI_MaxSpeed(); // Maximum speed submenu
  204. void HMI_MaxAcceleration(); // Maximum acceleration submenu
  205. void HMI_MaxJerk(); // Maximum jerk speed submenu
  206. void HMI_Step(); // Transmission ratio
  207. void HMI_Init();
  208. void DWIN_InitScreen();
  209. void DWIN_Update();
  210. void EachMomentUpdate();
  211. void DWIN_HandleScreen();
  212. void DWIN_StatusChanged(const char * const cstr=nullptr);
  213. void DWIN_StatusChanged(FSTR_P const fstr);
  214. inline void DWIN_HomingStart() { HMI_flag.home_flag = true; }
  215. void DWIN_HomingDone();
  216. void DWIN_LevelingDone();