Browse Source

Reinstate JyersUI

FB4S_WIFI
Scott Lahteine 2 years ago
parent
commit
0f3c3c419e
  1. 1
      Marlin/Configuration.h
  2. 2
      Marlin/Configuration_adv.h
  3. 2
      Marlin/src/MarlinCore.cpp
  4. 4
      Marlin/src/gcode/feature/powerloss/M1000.cpp
  5. 6
      Marlin/src/gcode/probe/G30.cpp
  6. 6
      Marlin/src/inc/Conditionals_LCD.h
  7. 2
      Marlin/src/inc/Conditionals_post.h
  8. 4
      Marlin/src/inc/SanityCheck.h
  9. 7
      Marlin/src/lcd/e3v2/jyersui/README.md
  10. 4848
      Marlin/src/lcd/e3v2/jyersui/dwin.cpp
  11. 245
      Marlin/src/lcd/e3v2/jyersui/dwin.h
  12. 64
      Marlin/src/lcd/e3v2/jyersui/dwin_lcd.cpp
  13. 34
      Marlin/src/lcd/e3v2/jyersui/dwin_lcd.h
  14. 2
      Marlin/src/lcd/extui/ui_api.h
  15. 5
      Marlin/src/lcd/marlinui.cpp
  16. 10
      Marlin/src/lcd/marlinui.h
  17. 22
      Marlin/src/module/settings.cpp
  18. 5
      buildroot/tests/STM32F103RE_creality
  19. 1
      ini/features.ini

1
Marlin/Configuration.h

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

2
Marlin/Configuration_adv.h

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

2
Marlin/src/MarlinCore.cpp

@ -76,6 +76,8 @@
#include "lcd/e3v2/creality/dwin.h" #include "lcd/e3v2/creality/dwin.h"
#elif ENABLED(DWIN_LCD_PROUI) #elif ENABLED(DWIN_LCD_PROUI)
#include "lcd/e3v2/proui/dwin.h" #include "lcd/e3v2/proui/dwin.h"
#elif ENABLED(DWIN_CREALITY_LCD_JYERSUI)
#include "lcd/e3v2/jyersui/dwin.h"
#endif #endif
#endif #endif

4
Marlin/src/gcode/feature/powerloss/M1000.cpp

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

6
Marlin/src/gcode/probe/G30.cpp

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

6
Marlin/src/inc/Conditionals_LCD.h

@ -477,6 +477,8 @@
// Aliases for LCD features // Aliases for LCD features
#if EITHER(DWIN_CREALITY_LCD, DWIN_LCD_PROUI) #if EITHER(DWIN_CREALITY_LCD, DWIN_LCD_PROUI)
#define HAS_DWIN_E3V2_BASIC 1 #define HAS_DWIN_E3V2_BASIC 1
#endif
#if EITHER(HAS_DWIN_E3V2_BASIC, DWIN_CREALITY_LCD_JYERSUI)
#define HAS_DWIN_E3V2 1 #define HAS_DWIN_E3V2 1
#endif #endif
#if ENABLED(DWIN_LCD_PROUI) #if ENABLED(DWIN_LCD_PROUI)
@ -506,7 +508,7 @@
#endif #endif
#endif #endif
#if ANY(HAS_WIRED_LCD, EXTENSIBLE_UI, DWIN_LCD_PROUI) #if ANY(HAS_WIRED_LCD, EXTENSIBLE_UI, DWIN_LCD_PROUI, DWIN_CREALITY_LCD_JYERSUI)
#define HAS_DISPLAY 1 #define HAS_DISPLAY 1
#endif #endif
@ -526,7 +528,7 @@
#define HAS_MANUAL_MOVE_MENU 1 #define HAS_MANUAL_MOVE_MENU 1
#endif #endif
#if ANY(HAS_MARLINUI_U8GLIB, EXTENSIBLE_UI, HAS_MARLINUI_HD44780, IS_TFTGLCD_PANEL, IS_DWIN_MARLINUI) #if ANY(HAS_MARLINUI_U8GLIB, EXTENSIBLE_UI, HAS_MARLINUI_HD44780, IS_TFTGLCD_PANEL, IS_DWIN_MARLINUI, DWIN_CREALITY_LCD_JYERSUI)
#define CAN_SHOW_REMAINING_TIME 1 #define CAN_SHOW_REMAINING_TIME 1
#endif #endif

2
Marlin/src/inc/Conditionals_post.h

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

4
Marlin/src/inc/SanityCheck.h

@ -902,7 +902,7 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
#error "PROGRESS_MSG_EXPIRE must be greater than or equal to 0." #error "PROGRESS_MSG_EXPIRE must be greater than or equal to 0."
#endif #endif
#elif ENABLED(LCD_SET_PROGRESS_MANUALLY) && NONE(HAS_MARLINUI_U8GLIB, HAS_GRAPHICAL_TFT, HAS_MARLINUI_HD44780, EXTENSIBLE_UI, HAS_DWIN_E3V2, IS_DWIN_MARLINUI) #elif ENABLED(LCD_SET_PROGRESS_MANUALLY) && NONE(HAS_MARLINUI_U8GLIB, HAS_GRAPHICAL_TFT, HAS_MARLINUI_HD44780, EXTENSIBLE_UI, HAS_DWIN_E3V2, IS_DWIN_MARLINUI)
#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." #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."
#endif #endif
#if ENABLED(USE_M73_REMAINING_TIME) && DISABLED(LCD_SET_PROGRESS_MANUALLY) #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
+ COUNT_ENABLED(ANYCUBIC_LCD_I3MEGA, ANYCUBIC_LCD_CHIRON, ANYCUBIC_TFT35) \ + COUNT_ENABLED(ANYCUBIC_LCD_I3MEGA, ANYCUBIC_LCD_CHIRON, ANYCUBIC_TFT35) \
+ COUNT_ENABLED(DGUS_LCD_UI_ORIGIN, DGUS_LCD_UI_FYSETC, DGUS_LCD_UI_HIPRECY, DGUS_LCD_UI_MKS, DGUS_LCD_UI_RELOADED) \ + COUNT_ENABLED(DGUS_LCD_UI_ORIGIN, DGUS_LCD_UI_FYSETC, DGUS_LCD_UI_HIPRECY, DGUS_LCD_UI_MKS, DGUS_LCD_UI_RELOADED) \
+ COUNT_ENABLED(ENDER2_STOCKDISPLAY, CR10_STOCKDISPLAY) \ + COUNT_ENABLED(ENDER2_STOCKDISPLAY, CR10_STOCKDISPLAY) \
+ COUNT_ENABLED(DWIN_CREALITY_LCD, DWIN_LCD_PROUI, DWIN_MARLINUI_PORTRAIT, DWIN_MARLINUI_LANDSCAPE) \ + COUNT_ENABLED(DWIN_CREALITY_LCD, DWIN_LCD_PROUI, DWIN_CREALITY_LCD_JYERSUI, DWIN_MARLINUI_PORTRAIT, DWIN_MARLINUI_LANDSCAPE) \
+ COUNT_ENABLED(FYSETC_MINI_12864_X_X, FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0, FYSETC_GENERIC_12864_1_1) \ + COUNT_ENABLED(FYSETC_MINI_12864_X_X, FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0, FYSETC_GENERIC_12864_1_1) \
+ COUNT_ENABLED(LCD_SAINSMART_I2C_1602, LCD_SAINSMART_I2C_2004) \ + COUNT_ENABLED(LCD_SAINSMART_I2C_1602, LCD_SAINSMART_I2C_2004) \
+ COUNT_ENABLED(MKS_12864OLED, MKS_12864OLED_SSD1306) \ + COUNT_ENABLED(MKS_12864OLED, MKS_12864OLED_SSD1306) \

7
Marlin/src/lcd/e3v2/jyersui/README.md

@ -0,0 +1,7 @@
# DWIN for Creality Ender 3 v2
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).
## Easy Install
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
Marlin/src/lcd/e3v2/jyersui/dwin.cpp

File diff suppressed because it is too large

245
Marlin/src/lcd/e3v2/jyersui/dwin.h

@ -0,0 +1,245 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2021 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#pragma once
/**
* lcd/e3v2/jyersui/dwin.h
*/
#include "dwin_lcd.h"
#include "../common/dwin_set.h"
#include "../common/dwin_font.h"
#include "../common/dwin_color.h"
#include "../common/encoder.h"
#include "../../../libs/BL24CXX.h"
#include "../../../inc/MarlinConfigPre.h"
//#define DWIN_CREALITY_LCD_CUSTOM_ICONS
enum processID : uint8_t {
Main, Print, Menu, Value, Option, File, Popup, Confirm, Wait
};
enum PopupID : uint8_t {
Pause, Stop, Resume, SaveLevel, ETemp, ConfFilChange, PurgeMore, MeshSlot,
Level, Home, MoveWait, Heating, FilLoad, FilChange, TempWarn, Runout, PIDWait, Resuming, ManualProbing,
FilInsert, HeaterTime, UserInput, LevelError, InvalidMesh, UI, Complete, Custom
};
enum menuID : uint8_t {
MainMenu,
Prepare,
Move,
HomeMenu,
ManualLevel,
ZOffset,
Preheat,
ChangeFilament,
MenuCustom,
Control,
TempMenu,
PID,
HotendPID,
BedPID,
#if HAS_PREHEAT
#define _PREHEAT_ID(N) Preheat##N,
REPEAT_1(PREHEAT_COUNT, _PREHEAT_ID)
#endif
Motion,
HomeOffsets,
MaxSpeed,
MaxAcceleration,
MaxJerk,
Steps,
Visual,
ColorSettings,
Advanced,
ProbeMenu,
Info,
Leveling,
LevelManual,
LevelView,
MeshViewer,
LevelSettings,
ManualMesh,
UBLMesh,
InfoMain,
Tune,
PreheatHotend
};
// Custom icons
#if ENABLED(DWIN_CREALITY_LCD_CUSTOM_ICONS)
// index of every custom icon should be >= CUSTOM_ICON_START
#define CUSTOM_ICON_START ICON_Checkbox_F
#define ICON_Checkbox_F 200
#define ICON_Checkbox_T 201
#define ICON_Fade 202
#define ICON_Mesh 203
#define ICON_Tilt 204
#define ICON_Brightness 205
#define ICON_AxisD 249
#define ICON_AxisBR 250
#define ICON_AxisTR 251
#define ICON_AxisBL 252
#define ICON_AxisTL 253
#define ICON_AxisC 254
#else
#define ICON_Fade ICON_Version
#define ICON_Mesh ICON_Version
#define ICON_Tilt ICON_Version
#define ICON_Brightness ICON_Version
#define ICON_AxisD ICON_Axis
#define ICON_AxisBR ICON_Axis
#define ICON_AxisTR ICON_Axis
#define ICON_AxisBL ICON_Axis
#define ICON_AxisTL ICON_Axis
#define ICON_AxisC ICON_Axis
#endif
enum colorID : uint8_t {
Default, White, Green, Cyan, Blue, Magenta, Red, Orange, Yellow, Brown, Black
};
#define Custom_Colors 10
#define Color_Aqua RGB(0x00,0x3F,0x1F)
#define Color_Light_White 0xBDD7
#define Color_Green RGB(0x00,0x3F,0x00)
#define Color_Light_Green 0x3460
#define Color_Cyan 0x07FF
#define Color_Light_Cyan 0x04F3
#define Color_Blue 0x015F
#define Color_Light_Blue 0x3A6A
#define Color_Magenta 0xF81F
#define Color_Light_Magenta 0x9813
#define Color_Light_Red 0x8800
#define Color_Orange 0xFA20
#define Color_Light_Orange 0xFBC0
#define Color_Light_Yellow 0x8BE0
#define Color_Brown 0xCC27
#define Color_Light_Brown 0x6204
#define Color_Black 0x0000
#define Color_Grey 0x18E3
#define Check_Color 0x4E5C // Check-box check color
#define Confirm_Color 0x34B9
#define Cancel_Color 0x3186
class CrealityDWINClass {
public:
static constexpr size_t eeprom_data_size = 48;
static struct EEPROM_Settings { // use bit fields to save space, max 48 bytes
bool time_format_textual : 1;
#if ENABLED(AUTO_BED_LEVELING_UBL)
uint8_t tilt_grid_size : 3;
#endif
uint16_t corner_pos : 10;
uint8_t cursor_color : 4;
uint8_t menu_split_line : 4;
uint8_t menu_top_bg : 4;
uint8_t menu_top_txt : 4;
uint8_t highlight_box : 4;
uint8_t progress_percent : 4;
uint8_t progress_time : 4;
uint8_t status_bar_text : 4;
uint8_t status_area_text : 4;
uint8_t coordinates_text : 4;
uint8_t coordinates_split_line : 4;
} eeprom_settings;
static constexpr const char * const color_names[11] = { "Default", "White", "Green", "Cyan", "Blue", "Magenta", "Red", "Orange", "Yellow", "Brown", "Black" };
static constexpr const char * const preheat_modes[3] = { "Both", "Hotend", "Bed" };
static void Clear_Screen(uint8_t e=3);
static void Draw_Float(float value, uint8_t row, bool selected=false, uint8_t minunit=10);
static void Draw_Option(uint8_t value, const char * const * options, uint8_t row, bool selected=false, bool color=false);
static uint16_t GetColor(uint8_t color, uint16_t original, bool light=false);
static void Draw_Checkbox(uint8_t row, bool value);
static void Draw_Title(const char * title);
static void Draw_Title(FSTR_P const title);
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);
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);
static void Draw_Menu(uint8_t menu, uint8_t select=0, uint8_t scroll=0);
static void Redraw_Menu(bool lastprocess=true, bool lastselection=false, bool lastmenu=false);
static void Redraw_Screen();
static void Main_Menu_Icons();
static void Draw_Main_Menu(uint8_t select=0);
static void Print_Screen_Icons();
static void Draw_Print_Screen();
static void Draw_Print_Filename(const bool reset=false);
static void Draw_Print_ProgressBar();
#if ENABLED(USE_M73_REMAINING_TIME)
static void Draw_Print_ProgressRemain();
#endif
static void Draw_Print_ProgressElapsed();
static void Draw_Print_confirm();
static void Draw_SD_Item(uint8_t item, uint8_t row);
static void Draw_SD_List(bool removed=false);
static void Draw_Status_Area(bool icons=false);
static void Draw_Popup(FSTR_P const line1, FSTR_P const line2, FSTR_P const line3, uint8_t mode, uint8_t icon=0);
static void Popup_Select();
static void Update_Status_Bar(bool refresh=false);
#if ENABLED(AUTO_BED_LEVELING_UBL)
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);
static void Set_Mesh_Viewer_Status();
#endif
static FSTR_P Get_Menu_Title(uint8_t menu);
static uint8_t Get_Menu_Size(uint8_t menu);
static void Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw=true);
static void Popup_Handler(PopupID popupid, bool option = false);
static void Confirm_Handler(PopupID popupid);
static void Main_Menu_Control();
static void Menu_Control();
static void Value_Control();
static void Option_Control();
static void File_Control();
static void Print_Screen_Control();
static void Popup_Control();
static void Confirm_Control();
static void Setup_Value(float value, float min, float max, float unit, uint8_t type);
static void Modify_Value(float &value, float min, float max, float unit, void (*f)()=nullptr);
static void Modify_Value(uint8_t &value, float min, float max, float unit, void (*f)()=nullptr);
static void Modify_Value(uint16_t &value, float min, float max, float unit, void (*f)()=nullptr);
static void Modify_Value(int16_t &value, float min, float max, float unit, void (*f)()=nullptr);
static void Modify_Value(uint32_t &value, float min, float max, float unit, void (*f)()=nullptr);
static void Modify_Value(int8_t &value, float min, float max, float unit, void (*f)()=nullptr);
static void Modify_Option(uint8_t value, const char * const * options, uint8_t max);
static void Update_Status(const char * const text);
static void Start_Print(bool sd);
static void Stop_Print();
static void Update();
static void State_Update();
static void Screen_Update();
static void AudioFeedback(const bool success=true);
static void Save_Settings(char *buff);
static void Load_Settings(const char *buff);
static void Reset_Settings();
};
extern CrealityDWINClass CrealityDWIN;

64
Marlin/src/lcd/e3v2/jyersui/dwin_lcd.cpp

@ -0,0 +1,64 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2021 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
/********************************************************************************
* @file lcd/e3v2/jyersui/dwin_lcd.cpp
* @brief DWIN screen control functions
********************************************************************************/
#include "../../../inc/MarlinConfigPre.h"
#if ENABLED(DWIN_CREALITY_LCD_JYERSUI)
#include "dwin_lcd.h"
/*-------------------------------------- System variable function --------------------------------------*/
void DWIN_Startup() {}
/*---------------------------------------- Drawing functions ----------------------------------------*/
// Draw the degree (°) symbol
// Color: color
// x/y: Upper-left coordinate of the first pixel
void DWIN_Draw_DegreeSymbol(uint16_t Color, uint16_t x, uint16_t y) {
DWIN_Draw_Point(Color, 1, 1, x + 1, y);
DWIN_Draw_Point(Color, 1, 1, x + 2, y);
DWIN_Draw_Point(Color, 1, 1, x, y + 1);
DWIN_Draw_Point(Color, 1, 1, x + 3, y + 1);
DWIN_Draw_Point(Color, 1, 1, x, y + 2);
DWIN_Draw_Point(Color, 1, 1, x + 3, y + 2);
DWIN_Draw_Point(Color, 1, 1, x + 1, y + 3);
DWIN_Draw_Point(Color, 1, 1, x + 2, y + 3);
}
/*---------------------------------------- Picture related functions ----------------------------------------*/
// Draw an Icon
// libID: Icon library ID
// picID: Icon ID
// x/y: Upper-left point
void DWIN_ICON_Show(uint8_t libID, uint8_t picID, uint16_t x, uint16_t y) {
DWIN_ICON_Show(true, false, false, libID, picID, x, y);
}
#endif // DWIN_CREALITY_LCD_JYERSUI

34
Marlin/src/lcd/e3v2/jyersui/dwin_lcd.h

@ -0,0 +1,34 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2021 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#pragma once
/********************************************************************************
* @file lcd/e3v2/jyersui/dwin_lcd.h
* @brief DWIN screen control functions
********************************************************************************/
#include "../common/dwin_api.h"
// Draw the degree (°) symbol
// Color: color
// x/y: Upper-left coordinate of the first pixel
void DWIN_Draw_DegreeSymbol(uint16_t Color, uint16_t x, uint16_t y);

2
Marlin/src/lcd/extui/ui_api.h

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

5
Marlin/src/lcd/marlinui.cpp

@ -49,6 +49,8 @@ MarlinUI ui;
#include "e3v2/creality/dwin.h" #include "e3v2/creality/dwin.h"
#elif ENABLED(DWIN_LCD_PROUI) #elif ENABLED(DWIN_LCD_PROUI)
#include "e3v2/proui/dwin.h" #include "e3v2/proui/dwin.h"
#elif ENABLED(DWIN_CREALITY_LCD_JYERSUI)
#include "e3v2/jyersui/dwin.h"
#endif #endif
#if ENABLED(LCD_PROGRESS_BAR) && !IS_TFTGLCD_PANEL #if ENABLED(LCD_PROGRESS_BAR) && !IS_TFTGLCD_PANEL
@ -151,7 +153,7 @@ constexpr uint8_t epps = ENCODER_PULSES_PER_STEP;
bool MarlinUI::lcd_clicked; bool MarlinUI::lcd_clicked;
#endif #endif
#if HAS_WIRED_LCD #if EITHER(HAS_WIRED_LCD, DWIN_CREALITY_LCD_JYERSUI)
bool MarlinUI::get_blink() { bool MarlinUI::get_blink() {
static uint8_t blink = 0; static uint8_t blink = 0;
@ -1566,6 +1568,7 @@ void MarlinUI::init() {
TERN_(EXTENSIBLE_UI, ExtUI::onStatusChanged(status_message)); TERN_(EXTENSIBLE_UI, ExtUI::onStatusChanged(status_message));
TERN_(DWIN_CREALITY_LCD, DWIN_StatusChanged(status_message)); TERN_(DWIN_CREALITY_LCD, DWIN_StatusChanged(status_message));
TERN_(DWIN_LCD_PROUI, DWIN_CheckStatusMessage()); TERN_(DWIN_LCD_PROUI, DWIN_CheckStatusMessage());
TERN_(DWIN_CREALITY_LCD_JYERSUI, CrealityDWIN.Update_Status(status_message));
} }
#if ENABLED(STATUS_MESSAGE_SCROLLING) #if ENABLED(STATUS_MESSAGE_SCROLLING)

10
Marlin/src/lcd/marlinui.h

@ -83,10 +83,12 @@ typedef bool (*statusResetFunc_t)();
#endif // HAS_MARLINUI_MENU #endif // HAS_MARLINUI_MENU
#define LCD_UPDATE_INTERVAL TERN(HAS_TOUCH_BUTTONS, 50, 100)
#endif // HAS_WIRED_LCD #endif // HAS_WIRED_LCD
#if EITHER(HAS_WIRED_LCD, DWIN_CREALITY_LCD_JYERSUI)
#define LCD_UPDATE_INTERVAL TERN(HAS_TOUCH_BUTTONS, 50, 100)
#endif
#if HAS_MARLINUI_U8GLIB #if HAS_MARLINUI_U8GLIB
enum MarlinFont : uint8_t { enum MarlinFont : uint8_t {
FONT_STATUSMENU = 1, FONT_STATUSMENU = 1,
@ -389,7 +391,7 @@ public:
static void poweroff(); static void poweroff();
#endif #endif
#if HAS_WIRED_LCD #if EITHER(HAS_WIRED_LCD, DWIN_CREALITY_LCD_JYERSUI)
static bool get_blink(); static bool get_blink();
#endif #endif
@ -626,7 +628,7 @@ public:
static bool use_click() { return false; } static bool use_click() { return false; }
#endif #endif
#if ENABLED(ADVANCED_PAUSE_FEATURE) && ANY(HAS_MARLINUI_MENU, EXTENSIBLE_UI, DWIN_LCD_PROUI) #if ENABLED(ADVANCED_PAUSE_FEATURE) && ANY(HAS_MARLINUI_MENU, EXTENSIBLE_UI, DWIN_LCD_PROUI, DWIN_CREALITY_LCD_JYERSUI)
static void pause_show_message(const PauseMessage message, const PauseMode mode=PAUSE_MODE_SAME, const uint8_t extruder=active_extruder); static void pause_show_message(const PauseMessage message, const PauseMode mode=PAUSE_MODE_SAME, const uint8_t extruder=active_extruder);
#else #else
static void _pause_show_message() {} static void _pause_show_message() {}

22
Marlin/src/module/settings.cpp

@ -77,6 +77,8 @@
#elif ENABLED(DWIN_LCD_PROUI) #elif ENABLED(DWIN_LCD_PROUI)
#include "../lcd/e3v2/proui/dwin.h" #include "../lcd/e3v2/proui/dwin.h"
#include "../lcd/e3v2/proui/bedlevel_tools.h" #include "../lcd/e3v2/proui/bedlevel_tools.h"
#elif ENABLED(DWIN_CREALITY_LCD_JYERSUI)
#include "../lcd/e3v2/jyersui/dwin.h"
#endif #endif
#if ENABLED(HOST_PROMPT_SUPPORT) #if ENABLED(HOST_PROMPT_SUPPORT)
@ -501,6 +503,8 @@ typedef struct SettingsDataStruct {
// //
#if ENABLED(DWIN_LCD_PROUI) #if ENABLED(DWIN_LCD_PROUI)
uint8_t dwin_data[eeprom_data_size]; uint8_t dwin_data[eeprom_data_size];
#elif ENABLED(DWIN_CREALITY_LCD_JYERSUI)
uint8_t dwin_settings[CrealityDWIN.eeprom_data_size];
#endif #endif
// //
@ -1519,6 +1523,15 @@ void MarlinSettings::postprocess() {
} }
#endif #endif
#if ENABLED(DWIN_CREALITY_LCD_JYERSUI)
{
_FIELD_TEST(dwin_settings);
char dwin_settings[CrealityDWIN.eeprom_data_size] = { 0 };
CrealityDWIN.Save_Settings(dwin_settings);
EEPROM_WRITE(dwin_settings);
}
#endif
// //
// Case Light Brightness // Case Light Brightness
// //
@ -2483,6 +2496,13 @@ void MarlinSettings::postprocess() {
EEPROM_READ(dwin_data); EEPROM_READ(dwin_data);
if (!validating) DWIN_CopySettingsFrom(dwin_data); if (!validating) DWIN_CopySettingsFrom(dwin_data);
} }
#elif ENABLED(DWIN_CREALITY_LCD_JYERSUI)
{
const char dwin_settings[CrealityDWIN.eeprom_data_size] = { 0 };
_FIELD_TEST(dwin_settings);
EEPROM_READ(dwin_settings);
if (!validating) CrealityDWIN.Load_Settings(dwin_settings);
}
#endif #endif
// //
@ -2920,6 +2940,8 @@ void MarlinSettings::reset() {
#endif #endif
#endif #endif
TERN_(DWIN_CREALITY_LCD_JYERSUI, CrealityDWIN.Reset_Settings());
// //
// Case Light Brightness // Case Light Brightness
// //

5
buildroot/tests/STM32F103RE_creality

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

1
ini/features.ini

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

Loading…
Cancel
Save