Browse Source

✨ Reinstate JyersUI

Scott Lahteine 1 year ago
parent
commit
007af47768

+ 1
- 0
Marlin/Configuration.h View File

@@ -3084,6 +3084,7 @@
3084 3084
 //
3085 3085
 //#define DWIN_CREALITY_LCD           // Creality UI
3086 3086
 //#define DWIN_LCD_PROUI              // Pro UI by MRiscoC
3087
+//#define DWIN_CREALITY_LCD_JYERSUI   // Jyers UI by Jacob Myers
3087 3088
 //#define DWIN_MARLINUI_PORTRAIT      // MarlinUI (portrait orientation)
3088 3089
 //#define DWIN_MARLINUI_LANDSCAPE     // MarlinUI (landscape orientation)
3089 3090
 

+ 1
- 1
Marlin/Configuration_adv.h View File

@@ -1355,7 +1355,7 @@
1355 1355
 
1356 1356
 #endif // HAS_MARLINUI_MENU
1357 1357
 
1358
-#if EITHER(HAS_DISPLAY, DWIN_LCD_PROUI)
1358
+#if ANY(HAS_DISPLAY, DWIN_LCD_PROUI, DWIN_CREALITY_LCD_JYERSUI)
1359 1359
   //#define SOUND_MENU_ITEM   // Add a mute option to the LCD menu
1360 1360
   #define SOUND_ON_DEFAULT    // Buzzer/speaker default enabled state
1361 1361
 #endif

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

@@ -76,6 +76,8 @@
76 76
     #include "lcd/e3v2/creality/dwin.h"
77 77
   #elif ENABLED(DWIN_LCD_PROUI)
78 78
     #include "lcd/e3v2/proui/dwin.h"
79
+  #elif ENABLED(DWIN_CREALITY_LCD_JYERSUI)
80
+    #include "lcd/e3v2/jyersui/dwin.h"
79 81
   #endif
80 82
 #endif
81 83
 

+ 4
- 0
Marlin/src/gcode/feature/powerloss/M1000.cpp View File

@@ -35,6 +35,8 @@
35 35
   #include "../../../lcd/e3v2/creality/dwin.h"
36 36
 #elif ENABLED(DWIN_LCD_PROUI)
37 37
   #include "../../../lcd/e3v2/proui/dwin.h"
38
+#elif ENABLED(DWIN_CREALITY_LCD_JYERSUI)
39
+  #include "../../../lcd/e3v2/jyersui/dwin.h" // Temporary fix until it can be better implemented
38 40
 #endif
39 41
 
40 42
 #define DEBUG_OUT ENABLED(DEBUG_POWER_LOSS_RECOVERY)
@@ -69,6 +71,8 @@ void GcodeSuite::M1000() {
69 71
         ui.goto_screen(menu_job_recovery);
70 72
       #elif HAS_DWIN_E3V2_BASIC
71 73
         recovery.dwin_flag = true;
74
+      #elif ENABLED(DWIN_CREALITY_LCD_JYERSUI) // Temporary fix until it can be better implemented
75
+        CrealityDWIN.Popup_Handler(Resume);
72 76
       #elif ENABLED(EXTENSIBLE_UI)
73 77
         ExtUI::onPowerLossResume();
74 78
       #else

+ 4
- 2
Marlin/src/gcode/probe/G30.cpp View File

@@ -73,7 +73,9 @@ void GcodeSuite::G30() {
73 73
 
74 74
     remember_feedrate_scaling_off();
75 75
 
76
-    TERN_(DWIN_LCD_PROUI, process_subcommands_now(F("G28O")));
76
+    #if EITHER(DWIN_LCD_PROUI, DWIN_CREALITY_LCD_JYERSUI)
77
+      process_subcommands_now(F("G28O"));
78
+    #endif
77 79
 
78 80
     const ProbePtRaise raise_after = parser.boolval('E', true) ? PROBE_PT_STOW : PROBE_PT_NONE;
79 81
 
@@ -82,7 +84,7 @@ void GcodeSuite::G30() {
82 84
     TERN_(HAS_PTC, ptc.set_enabled(true));
83 85
     if (!isnan(measured_z)) {
84 86
       SERIAL_ECHOLNPGM("Bed X: ", pos.x, " Y: ", pos.y, " Z: ", measured_z);
85
-      #if ENABLED(DWIN_LCD_PROUI)
87
+      #if EITHER(DWIN_LCD_PROUI, DWIN_CREALITY_LCD_JYERSUI)
86 88
         char msg[31], str_1[6], str_2[6], str_3[6];
87 89
         sprintf_P(msg, PSTR("X:%s, Y:%s, Z:%s"),
88 90
           dtostrf(pos.x, 1, 1, str_1),

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

@@ -477,6 +477,8 @@
477 477
 // Aliases for LCD features
478 478
 #if EITHER(DWIN_CREALITY_LCD, DWIN_LCD_PROUI)
479 479
   #define HAS_DWIN_E3V2_BASIC 1
480
+#endif
481
+#if EITHER(HAS_DWIN_E3V2_BASIC, DWIN_CREALITY_LCD_JYERSUI)
480 482
   #define HAS_DWIN_E3V2 1
481 483
 #endif
482 484
 #if ENABLED(DWIN_LCD_PROUI)
@@ -506,7 +508,7 @@
506 508
   #endif
507 509
 #endif
508 510
 
509
-#if ANY(HAS_WIRED_LCD, EXTENSIBLE_UI, DWIN_LCD_PROUI)
511
+#if ANY(HAS_WIRED_LCD, EXTENSIBLE_UI, DWIN_LCD_PROUI, DWIN_CREALITY_LCD_JYERSUI)
510 512
   #define HAS_DISPLAY 1
511 513
 #endif
512 514
 
@@ -526,7 +528,7 @@
526 528
   #define HAS_MANUAL_MOVE_MENU 1
527 529
 #endif
528 530
 
529
-#if ANY(HAS_MARLINUI_U8GLIB, EXTENSIBLE_UI, HAS_MARLINUI_HD44780, IS_TFTGLCD_PANEL, IS_DWIN_MARLINUI)
531
+#if ANY(HAS_MARLINUI_U8GLIB, EXTENSIBLE_UI, HAS_MARLINUI_HD44780, IS_TFTGLCD_PANEL, IS_DWIN_MARLINUI, DWIN_CREALITY_LCD_JYERSUI)
530 532
   #define CAN_SHOW_REMAINING_TIME 1
531 533
 #endif
532 534
 

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

@@ -3430,7 +3430,7 @@
3430 3430
  * Advanced Pause - Filament Change
3431 3431
  */
3432 3432
 #if ENABLED(ADVANCED_PAUSE_FEATURE)
3433
-  #if ANY(HAS_MARLINUI_MENU, EXTENSIBLE_UI, DWIN_LCD_PROUI) || BOTH(EMERGENCY_PARSER, HOST_PROMPT_SUPPORT)
3433
+  #if ANY(HAS_MARLINUI_MENU, EXTENSIBLE_UI, DWIN_LCD_PROUI, DWIN_CREALITY_LCD_JYERSUI) || BOTH(EMERGENCY_PARSER, HOST_PROMPT_SUPPORT)
3434 3434
     #define M600_PURGE_MORE_RESUMABLE 1
3435 3435
   #endif
3436 3436
   #ifndef FILAMENT_CHANGE_SLOW_LOAD_LENGTH

+ 2
- 2
Marlin/src/inc/SanityCheck.h View File

@@ -902,7 +902,7 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
902 902
     #error "PROGRESS_MSG_EXPIRE must be greater than or equal to 0."
903 903
   #endif
904 904
 #elif ENABLED(LCD_SET_PROGRESS_MANUALLY) && NONE(HAS_MARLINUI_U8GLIB, HAS_GRAPHICAL_TFT, HAS_MARLINUI_HD44780, EXTENSIBLE_UI, HAS_DWIN_E3V2, IS_DWIN_MARLINUI)
905
-  #error "LCD_SET_PROGRESS_MANUALLY requires LCD_PROGRESS_BAR, Character LCD, Graphical LCD, TFT, DWIN_CREALITY_LCD, DWIN_LCD_PROUI, DWIN_MARLINUI_*, OR EXTENSIBLE_UI."
905
+  #error "LCD_SET_PROGRESS_MANUALLY requires LCD_PROGRESS_BAR, Character LCD, Graphical LCD, TFT, DWIN_CREALITY_LCD, DWIN_LCD_PROUI, DWIN_CREALITY_LCD_JYERSUI, DWIN_MARLINUI_*, OR EXTENSIBLE_UI."
906 906
 #endif
907 907
 
908 908
 #if ENABLED(USE_M73_REMAINING_TIME) && DISABLED(LCD_SET_PROGRESS_MANUALLY)
@@ -2882,7 +2882,7 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
2882 2882
   + COUNT_ENABLED(ANYCUBIC_LCD_I3MEGA, ANYCUBIC_LCD_CHIRON, ANYCUBIC_TFT35) \
2883 2883
   + COUNT_ENABLED(DGUS_LCD_UI_ORIGIN, DGUS_LCD_UI_FYSETC, DGUS_LCD_UI_HIPRECY, DGUS_LCD_UI_MKS, DGUS_LCD_UI_RELOADED) \
2884 2884
   + COUNT_ENABLED(ENDER2_STOCKDISPLAY, CR10_STOCKDISPLAY) \
2885
-  + COUNT_ENABLED(DWIN_CREALITY_LCD, DWIN_LCD_PROUI, DWIN_MARLINUI_PORTRAIT, DWIN_MARLINUI_LANDSCAPE) \
2885
+  + COUNT_ENABLED(DWIN_CREALITY_LCD, DWIN_LCD_PROUI, DWIN_CREALITY_LCD_JYERSUI, DWIN_MARLINUI_PORTRAIT, DWIN_MARLINUI_LANDSCAPE) \
2886 2886
   + COUNT_ENABLED(FYSETC_MINI_12864_X_X, FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0, FYSETC_GENERIC_12864_1_1) \
2887 2887
   + COUNT_ENABLED(LCD_SAINSMART_I2C_1602, LCD_SAINSMART_I2C_2004) \
2888 2888
   + COUNT_ENABLED(MKS_12864OLED, MKS_12864OLED_SSD1306) \

+ 7
- 0
Marlin/src/lcd/e3v2/jyersui/README.md View File

@@ -0,0 +1,7 @@
1
+# DWIN for Creality Ender 3 v2
2
+
3
+Marlin's Ender 3 v2 support requires the `DWIN_SET` included with the Ender 3 V2 [example configuration](https://github.com/MarlinFirmware/Configurations/tree/bugfix-2.1.x/config/examples/Creality/Ender-3%20V2).
4
+
5
+## Easy Install
6
+
7
+Copy the `DWIN_SET` folder onto a Micro-SD card and insert the card into the slot on the DWIN screen. Cycle the machine and wait for the screen to go from blue to orange. Turn the machine off and remove the SD card. When you turn on the machine the screen will display a "Creality" loading screen.

+ 4848
- 0
Marlin/src/lcd/e3v2/jyersui/dwin.cpp
File diff suppressed because it is too large
View File


+ 245
- 0
Marlin/src/lcd/e3v2/jyersui/dwin.h View File

@@ -0,0 +1,245 @@
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
+/**
25
+ * lcd/e3v2/jyersui/dwin.h
26
+ */
27
+
28
+#include "dwin_lcd.h"
29
+#include "../common/dwin_set.h"
30
+#include "../common/dwin_font.h"
31
+#include "../common/dwin_color.h"
32
+#include "../common/encoder.h"
33
+#include "../../../libs/BL24CXX.h"
34
+
35
+#include "../../../inc/MarlinConfigPre.h"
36
+
37
+//#define DWIN_CREALITY_LCD_CUSTOM_ICONS
38
+
39
+enum processID : uint8_t {
40
+  Main, Print, Menu, Value, Option, File, Popup, Confirm, Wait
41
+};
42
+
43
+enum PopupID : uint8_t {
44
+  Pause, Stop, Resume, SaveLevel, ETemp, ConfFilChange, PurgeMore, MeshSlot,
45
+  Level, Home, MoveWait, Heating,  FilLoad, FilChange, TempWarn, Runout, PIDWait, Resuming, ManualProbing,
46
+  FilInsert, HeaterTime, UserInput, LevelError, InvalidMesh, UI, Complete, Custom
47
+};
48
+
49
+enum menuID : uint8_t {
50
+  MainMenu,
51
+    Prepare,
52
+      Move,
53
+      HomeMenu,
54
+      ManualLevel,
55
+      ZOffset,
56
+      Preheat,
57
+      ChangeFilament,
58
+      MenuCustom,
59
+    Control,
60
+      TempMenu,
61
+        PID,
62
+          HotendPID,
63
+          BedPID,
64
+        #if HAS_PREHEAT
65
+          #define _PREHEAT_ID(N) Preheat##N,
66
+          REPEAT_1(PREHEAT_COUNT, _PREHEAT_ID)
67
+        #endif
68
+      Motion,
69
+        HomeOffsets,
70
+        MaxSpeed,
71
+        MaxAcceleration,
72
+        MaxJerk,
73
+        Steps,
74
+      Visual,
75
+        ColorSettings,
76
+      Advanced,
77
+        ProbeMenu,
78
+      Info,
79
+    Leveling,
80
+      LevelManual,
81
+      LevelView,
82
+      MeshViewer,
83
+      LevelSettings,
84
+      ManualMesh,
85
+      UBLMesh,
86
+    InfoMain,
87
+  Tune,
88
+  PreheatHotend
89
+};
90
+
91
+// Custom icons
92
+#if ENABLED(DWIN_CREALITY_LCD_CUSTOM_ICONS)
93
+  // index of every custom icon should be >= CUSTOM_ICON_START
94
+  #define CUSTOM_ICON_START         ICON_Checkbox_F
95
+  #define ICON_Checkbox_F           200
96
+  #define ICON_Checkbox_T           201
97
+  #define ICON_Fade                 202
98
+  #define ICON_Mesh                 203
99
+  #define ICON_Tilt                 204
100
+  #define ICON_Brightness           205
101
+  #define ICON_AxisD                249
102
+  #define ICON_AxisBR               250
103
+  #define ICON_AxisTR               251
104
+  #define ICON_AxisBL               252
105
+  #define ICON_AxisTL               253
106
+  #define ICON_AxisC                254
107
+#else
108
+  #define ICON_Fade                 ICON_Version
109
+  #define ICON_Mesh                 ICON_Version
110
+  #define ICON_Tilt                 ICON_Version
111
+  #define ICON_Brightness           ICON_Version
112
+  #define ICON_AxisD                ICON_Axis
113
+  #define ICON_AxisBR               ICON_Axis
114
+  #define ICON_AxisTR               ICON_Axis
115
+  #define ICON_AxisBL               ICON_Axis
116
+  #define ICON_AxisTL               ICON_Axis
117
+  #define ICON_AxisC                ICON_Axis
118
+#endif
119
+
120
+enum colorID : uint8_t {
121
+  Default, White, Green, Cyan, Blue, Magenta, Red, Orange, Yellow, Brown, Black
122
+};
123
+
124
+#define Custom_Colors       10
125
+#define Color_Aqua          RGB(0x00,0x3F,0x1F)
126
+#define Color_Light_White   0xBDD7
127
+#define Color_Green         RGB(0x00,0x3F,0x00)
128
+#define Color_Light_Green   0x3460
129
+#define Color_Cyan          0x07FF
130
+#define Color_Light_Cyan    0x04F3
131
+#define Color_Blue          0x015F
132
+#define Color_Light_Blue    0x3A6A
133
+#define Color_Magenta       0xF81F
134
+#define Color_Light_Magenta 0x9813
135
+#define Color_Light_Red     0x8800
136
+#define Color_Orange        0xFA20
137
+#define Color_Light_Orange  0xFBC0
138
+#define Color_Light_Yellow  0x8BE0
139
+#define Color_Brown         0xCC27
140
+#define Color_Light_Brown   0x6204
141
+#define Color_Black         0x0000
142
+#define Color_Grey          0x18E3
143
+#define Check_Color         0x4E5C  // Check-box check color
144
+#define Confirm_Color       0x34B9
145
+#define Cancel_Color        0x3186
146
+
147
+class CrealityDWINClass {
148
+public:
149
+  static constexpr size_t eeprom_data_size = 48;
150
+  static struct EEPROM_Settings { // use bit fields to save space, max 48 bytes
151
+    bool time_format_textual : 1;
152
+    #if ENABLED(AUTO_BED_LEVELING_UBL)
153
+      uint8_t tilt_grid_size : 3;
154
+    #endif
155
+    uint16_t corner_pos : 10;
156
+    uint8_t cursor_color : 4;
157
+    uint8_t menu_split_line : 4;
158
+    uint8_t menu_top_bg : 4;
159
+    uint8_t menu_top_txt : 4;
160
+    uint8_t highlight_box : 4;
161
+    uint8_t progress_percent : 4;
162
+    uint8_t progress_time : 4;
163
+    uint8_t status_bar_text : 4;
164
+    uint8_t status_area_text : 4;
165
+    uint8_t coordinates_text : 4;
166
+    uint8_t coordinates_split_line : 4;
167
+  } eeprom_settings;
168
+
169
+  static constexpr const char * const color_names[11] = { "Default", "White", "Green", "Cyan", "Blue", "Magenta", "Red", "Orange", "Yellow", "Brown", "Black" };
170
+  static constexpr const char * const preheat_modes[3] = { "Both", "Hotend", "Bed" };
171
+
172
+  static void Clear_Screen(uint8_t e=3);
173
+  static void Draw_Float(float value, uint8_t row, bool selected=false, uint8_t minunit=10);
174
+  static void Draw_Option(uint8_t value, const char * const * options, uint8_t row, bool selected=false, bool color=false);
175
+  static uint16_t GetColor(uint8_t color, uint16_t original, bool light=false);
176
+  static void Draw_Checkbox(uint8_t row, bool value);
177
+  static void Draw_Title(const char * title);
178
+  static void Draw_Title(FSTR_P const title);
179
+  static void Draw_Menu_Item(uint8_t row, uint8_t icon=0, const char * const label1=nullptr, const char * const label2=nullptr, bool more=false, bool centered=false);
180
+  static void Draw_Menu_Item(uint8_t row, uint8_t icon=0, FSTR_P const flabel1=nullptr, FSTR_P const flabel2=nullptr, bool more=false, bool centered=false);
181
+  static void Draw_Menu(uint8_t menu, uint8_t select=0, uint8_t scroll=0);
182
+  static void Redraw_Menu(bool lastprocess=true, bool lastselection=false, bool lastmenu=false);
183
+  static void Redraw_Screen();
184
+
185
+  static void Main_Menu_Icons();
186
+  static void Draw_Main_Menu(uint8_t select=0);
187
+  static void Print_Screen_Icons();
188
+  static void Draw_Print_Screen();
189
+  static void Draw_Print_Filename(const bool reset=false);
190
+  static void Draw_Print_ProgressBar();
191
+  #if ENABLED(USE_M73_REMAINING_TIME)
192
+    static void Draw_Print_ProgressRemain();
193
+  #endif
194
+  static void Draw_Print_ProgressElapsed();
195
+  static void Draw_Print_confirm();
196
+  static void Draw_SD_Item(uint8_t item, uint8_t row);
197
+  static void Draw_SD_List(bool removed=false);
198
+  static void Draw_Status_Area(bool icons=false);
199
+  static void Draw_Popup(FSTR_P const line1, FSTR_P const line2, FSTR_P const line3, uint8_t mode, uint8_t icon=0);
200
+  static void Popup_Select();
201
+  static void Update_Status_Bar(bool refresh=false);
202
+
203
+  #if ENABLED(AUTO_BED_LEVELING_UBL)
204
+    static void Draw_Bed_Mesh(int16_t selected = -1, uint8_t gridline_width = 1, uint16_t padding_x = 8, uint16_t padding_y_top = 40 + 53 - 7);
205
+    static void Set_Mesh_Viewer_Status();
206
+  #endif
207
+
208
+  static FSTR_P Get_Menu_Title(uint8_t menu);
209
+  static uint8_t Get_Menu_Size(uint8_t menu);
210
+  static void Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw=true);
211
+
212
+  static void Popup_Handler(PopupID popupid, bool option = false);
213
+  static void Confirm_Handler(PopupID popupid);
214
+
215
+  static void Main_Menu_Control();
216
+  static void Menu_Control();
217
+  static void Value_Control();
218
+  static void Option_Control();
219
+  static void File_Control();
220
+  static void Print_Screen_Control();
221
+  static void Popup_Control();
222
+  static void Confirm_Control();
223
+
224
+  static void Setup_Value(float value, float min, float max, float unit, uint8_t type);
225
+  static void Modify_Value(float &value, float min, float max, float unit, void (*f)()=nullptr);
226
+  static void Modify_Value(uint8_t &value, float min, float max, float unit, void (*f)()=nullptr);
227
+  static void Modify_Value(uint16_t &value, float min, float max, float unit, void (*f)()=nullptr);
228
+  static void Modify_Value(int16_t &value, float min, float max, float unit, void (*f)()=nullptr);
229
+  static void Modify_Value(uint32_t &value, float min, float max, float unit, void (*f)()=nullptr);
230
+  static void Modify_Value(int8_t &value, float min, float max, float unit, void (*f)()=nullptr);
231
+  static void Modify_Option(uint8_t value, const char * const * options, uint8_t max);
232
+
233
+  static void Update_Status(const char * const text);
234
+  static void Start_Print(bool sd);
235
+  static void Stop_Print();
236
+  static void Update();
237
+  static void State_Update();
238
+  static void Screen_Update();
239
+  static void AudioFeedback(const bool success=true);
240
+  static void Save_Settings(char *buff);
241
+  static void Load_Settings(const char *buff);
242
+  static void Reset_Settings();
243
+};
244
+
245
+extern CrealityDWINClass CrealityDWIN;

+ 64
- 0
Marlin/src/lcd/e3v2/jyersui/dwin_lcd.cpp View File

@@ -0,0 +1,64 @@
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
+
23
+/********************************************************************************
24
+ * @file     lcd/e3v2/jyersui/dwin_lcd.cpp
25
+ * @brief    DWIN screen control functions
26
+ ********************************************************************************/
27
+
28
+#include "../../../inc/MarlinConfigPre.h"
29
+
30
+#if ENABLED(DWIN_CREALITY_LCD_JYERSUI)
31
+
32
+#include "dwin_lcd.h"
33
+
34
+/*-------------------------------------- System variable function --------------------------------------*/
35
+
36
+void DWIN_Startup() {}
37
+
38
+/*---------------------------------------- Drawing functions ----------------------------------------*/
39
+
40
+// Draw the degree (°) symbol
41
+// Color: color
42
+//  x/y: Upper-left coordinate of the first pixel
43
+void DWIN_Draw_DegreeSymbol(uint16_t Color, uint16_t x, uint16_t y) {
44
+  DWIN_Draw_Point(Color, 1, 1, x + 1, y);
45
+  DWIN_Draw_Point(Color, 1, 1, x + 2, y);
46
+  DWIN_Draw_Point(Color, 1, 1, x, y + 1);
47
+  DWIN_Draw_Point(Color, 1, 1, x + 3, y + 1);
48
+  DWIN_Draw_Point(Color, 1, 1, x, y + 2);
49
+  DWIN_Draw_Point(Color, 1, 1, x + 3, y + 2);
50
+  DWIN_Draw_Point(Color, 1, 1, x + 1, y + 3);
51
+  DWIN_Draw_Point(Color, 1, 1, x + 2, y + 3);
52
+}
53
+
54
+/*---------------------------------------- Picture related functions ----------------------------------------*/
55
+
56
+// Draw an Icon
57
+//  libID: Icon library ID
58
+//  picID: Icon ID
59
+//  x/y: Upper-left point
60
+void DWIN_ICON_Show(uint8_t libID, uint8_t picID, uint16_t x, uint16_t y) {
61
+  DWIN_ICON_Show(true, false, false, libID, picID, x, y);
62
+}
63
+
64
+#endif // DWIN_CREALITY_LCD_JYERSUI

+ 34
- 0
Marlin/src/lcd/e3v2/jyersui/dwin_lcd.h View File

@@ -0,0 +1,34 @@
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
+/********************************************************************************
25
+ * @file     lcd/e3v2/jyersui/dwin_lcd.h
26
+ * @brief    DWIN screen control functions
27
+ ********************************************************************************/
28
+
29
+#include "../common/dwin_api.h"
30
+
31
+// Draw the degree (°) symbol
32
+// Color: color
33
+//  x/y: Upper-left coordinate of the first pixel
34
+void DWIN_Draw_DegreeSymbol(uint16_t Color, uint16_t x, uint16_t y);

+ 1
- 1
Marlin/src/lcd/extui/ui_api.h View File

@@ -199,7 +199,7 @@ namespace ExtUI {
199 199
   #endif
200 200
 
201 201
   inline void simulateUserClick() {
202
-    #if EITHER(HAS_MARLINUI_MENU, EXTENSIBLE_UI)
202
+    #if ANY(HAS_MARLINUI_MENU, EXTENSIBLE_UI, DWIN_CREALITY_LCD_JYERSUI)
203 203
       ui.lcd_clicked = true;
204 204
     #endif
205 205
   }

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

@@ -49,6 +49,8 @@ MarlinUI ui;
49 49
   #include "e3v2/creality/dwin.h"
50 50
 #elif ENABLED(DWIN_LCD_PROUI)
51 51
   #include "e3v2/proui/dwin.h"
52
+#elif ENABLED(DWIN_CREALITY_LCD_JYERSUI)
53
+  #include "e3v2/jyersui/dwin.h"
52 54
 #endif
53 55
 
54 56
 #if ENABLED(LCD_PROGRESS_BAR) && !IS_TFTGLCD_PANEL
@@ -151,7 +153,7 @@ constexpr uint8_t epps = ENCODER_PULSES_PER_STEP;
151 153
   bool MarlinUI::lcd_clicked;
152 154
 #endif
153 155
 
154
-#if HAS_WIRED_LCD
156
+#if EITHER(HAS_WIRED_LCD, DWIN_CREALITY_LCD_JYERSUI)
155 157
 
156 158
   bool MarlinUI::get_blink() {
157 159
     static uint8_t blink = 0;
@@ -1566,6 +1568,7 @@ void MarlinUI::init() {
1566 1568
     TERN_(EXTENSIBLE_UI, ExtUI::onStatusChanged(status_message));
1567 1569
     TERN_(DWIN_CREALITY_LCD, DWIN_StatusChanged(status_message));
1568 1570
     TERN_(DWIN_LCD_PROUI, DWIN_CheckStatusMessage());
1571
+    TERN_(DWIN_CREALITY_LCD_JYERSUI, CrealityDWIN.Update_Status(status_message));
1569 1572
   }
1570 1573
 
1571 1574
   #if ENABLED(STATUS_MESSAGE_SCROLLING)

+ 6
- 4
Marlin/src/lcd/marlinui.h View File

@@ -83,10 +83,12 @@ typedef bool (*statusResetFunc_t)();
83 83
 
84 84
   #endif // HAS_MARLINUI_MENU
85 85
 
86
-  #define LCD_UPDATE_INTERVAL TERN(HAS_TOUCH_BUTTONS, 50, 100)
87
-
88 86
 #endif // HAS_WIRED_LCD
89 87
 
88
+#if EITHER(HAS_WIRED_LCD, DWIN_CREALITY_LCD_JYERSUI)
89
+  #define LCD_UPDATE_INTERVAL TERN(HAS_TOUCH_BUTTONS, 50, 100)
90
+#endif
91
+
90 92
 #if HAS_MARLINUI_U8GLIB
91 93
   enum MarlinFont : uint8_t {
92 94
     FONT_STATUSMENU = 1,
@@ -389,7 +391,7 @@ public:
389 391
       static void poweroff();
390 392
     #endif
391 393
 
392
-    #if HAS_WIRED_LCD
394
+    #if EITHER(HAS_WIRED_LCD, DWIN_CREALITY_LCD_JYERSUI)
393 395
       static bool get_blink();
394 396
     #endif
395 397
 
@@ -626,7 +628,7 @@ public:
626 628
     static bool use_click() { return false; }
627 629
   #endif
628 630
 
629
-  #if ENABLED(ADVANCED_PAUSE_FEATURE) && ANY(HAS_MARLINUI_MENU, EXTENSIBLE_UI, DWIN_LCD_PROUI)
631
+  #if ENABLED(ADVANCED_PAUSE_FEATURE) && ANY(HAS_MARLINUI_MENU, EXTENSIBLE_UI, DWIN_LCD_PROUI, DWIN_CREALITY_LCD_JYERSUI)
630 632
     static void pause_show_message(const PauseMessage message, const PauseMode mode=PAUSE_MODE_SAME, const uint8_t extruder=active_extruder);
631 633
   #else
632 634
     static void _pause_show_message() {}

+ 22
- 0
Marlin/src/module/settings.cpp View File

@@ -77,6 +77,8 @@
77 77
 #elif ENABLED(DWIN_LCD_PROUI)
78 78
   #include "../lcd/e3v2/proui/dwin.h"
79 79
   #include "../lcd/e3v2/proui/bedlevel_tools.h"
80
+#elif ENABLED(DWIN_CREALITY_LCD_JYERSUI)
81
+  #include "../lcd/e3v2/jyersui/dwin.h"
80 82
 #endif
81 83
 
82 84
 #if ENABLED(HOST_PROMPT_SUPPORT)
@@ -501,6 +503,8 @@ typedef struct SettingsDataStruct {
501 503
   //
502 504
   #if ENABLED(DWIN_LCD_PROUI)
503 505
     uint8_t dwin_data[eeprom_data_size];
506
+  #elif ENABLED(DWIN_CREALITY_LCD_JYERSUI)
507
+    uint8_t dwin_settings[CrealityDWIN.eeprom_data_size];
504 508
   #endif
505 509
 
506 510
   //
@@ -1519,6 +1523,15 @@ void MarlinSettings::postprocess() {
1519 1523
     }
1520 1524
     #endif
1521 1525
 
1526
+    #if ENABLED(DWIN_CREALITY_LCD_JYERSUI)
1527
+    {
1528
+      _FIELD_TEST(dwin_settings);
1529
+      char dwin_settings[CrealityDWIN.eeprom_data_size] = { 0 };
1530
+      CrealityDWIN.Save_Settings(dwin_settings);
1531
+      EEPROM_WRITE(dwin_settings);
1532
+    }
1533
+    #endif
1534
+
1522 1535
     //
1523 1536
     // Case Light Brightness
1524 1537
     //
@@ -2483,6 +2496,13 @@ void MarlinSettings::postprocess() {
2483 2496
         EEPROM_READ(dwin_data);
2484 2497
         if (!validating) DWIN_CopySettingsFrom(dwin_data);
2485 2498
       }
2499
+      #elif ENABLED(DWIN_CREALITY_LCD_JYERSUI)
2500
+      {
2501
+        const char dwin_settings[CrealityDWIN.eeprom_data_size] = { 0 };
2502
+        _FIELD_TEST(dwin_settings);
2503
+        EEPROM_READ(dwin_settings);
2504
+        if (!validating) CrealityDWIN.Load_Settings(dwin_settings);
2505
+      }
2486 2506
       #endif
2487 2507
 
2488 2508
       //
@@ -2920,6 +2940,8 @@ void MarlinSettings::reset() {
2920 2940
     #endif
2921 2941
   #endif
2922 2942
 
2943
+  TERN_(DWIN_CREALITY_LCD_JYERSUI, CrealityDWIN.Reset_Settings());
2944
+
2923 2945
   //
2924 2946
   // Case Light Brightness
2925 2947
   //

+ 5
- 0
buildroot/tests/STM32F103RE_creality View File

@@ -13,6 +13,11 @@ use_example_configs "Creality/Ender-3 V2/CrealityV422/CrealityUI"
13 13
 opt_enable MARLIN_DEV_MODE BUFFER_MONITORING BLTOUCH AUTO_BED_LEVELING_BILINEAR Z_SAFE_HOMING
14 14
 exec_test $1 $2 "Ender 3 v2 with CrealityUI" "$3"
15 15
 
16
+use_example_configs "Creality/Ender-3 V2/CrealityV422/CrealityUI"
17
+opt_disable DWIN_CREALITY_LCD
18
+opt_enable DWIN_CREALITY_LCD_JYERSUI AUTO_BED_LEVELING_BILINEAR PROBE_MANUALLY
19
+exec_test $1 $2 "Ender 3 v2 with JyersUI" "$3"
20
+
16 21
 use_example_configs "Creality/Ender-3 S1/STM32F1"
17 22
 opt_disable DWIN_CREALITY_LCD Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN AUTO_BED_LEVELING_BILINEAR CONFIGURATION_EMBEDDING CANCEL_OBJECTS FWRETRACT
18 23
 opt_enable DWIN_LCD_PROUI INDIVIDUAL_AXIS_HOMING_SUBMENU LCD_SET_PROGRESS_MANUALLY STATUS_MESSAGE_SCROLLING \

+ 1
- 0
ini/features.ini View File

@@ -47,6 +47,7 @@ SPI_EEPROM                             = src_filter=+<src/HAL/shared/eeprom_if_s
47 47
 HAS_DWIN_E3V2|IS_DWIN_MARLINUI         = src_filter=+<src/lcd/e3v2/common>
48 48
 DWIN_CREALITY_LCD                      = src_filter=+<src/lcd/e3v2/creality>
49 49
 DWIN_LCD_PROUI                         = src_filter=+<src/lcd/e3v2/proui>
50
+DWIN_CREALITY_LCD_JYERSUI              = src_filter=+<src/lcd/e3v2/jyersui>
50 51
 IS_DWIN_MARLINUI                       = src_filter=+<src/lcd/e3v2/marlinui>
51 52
 HAS_GRAPHICAL_TFT                      = src_filter=+<src/lcd/tft>
52 53
 IS_TFTGLCD_PANEL                       = src_filter=+<src/lcd/TFTGLCD>

Loading…
Cancel
Save