Skip to content

Commit

Permalink
🚸 JyersUI updates (#24451)
Browse files Browse the repository at this point in the history
  • Loading branch information
LCh-77 authored Jul 6, 2022
1 parent c902f66 commit a797390
Show file tree
Hide file tree
Showing 32 changed files with 4,352 additions and 1,000 deletions.
2 changes: 2 additions & 0 deletions Marlin/src/gcode/bedlevel/abl/G29.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@
#include "../../../lcd/e3v2/creality/dwin.h"
#elif ENABLED(DWIN_LCD_PROUI)
#include "../../../lcd/e3v2/proui/dwin.h"
#elif ENABLED(DWIN_CREALITY_LCD_JYERSUI)
#include "../../../lcd/e3v2/jyersui/dwin.h"
#endif

#if HAS_MULTI_HOTEND
Expand Down
9 changes: 8 additions & 1 deletion Marlin/src/gcode/config/M575.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@

#include "../gcode.h"

#if ENABLED(DWIN_CREALITY_LCD_JYERSUI)
#include "../../lcd/e3v2/jyersui/dwin.h"
#endif

/**
* M575 - Change serial baud rate
*
Expand Down Expand Up @@ -65,7 +69,10 @@ void GcodeSuite::M575() {

SERIAL_FLUSH();

if (set1) { MYSERIAL1.end(); MYSERIAL1.begin(baud); }
if (set1) {
MYSERIAL1.end(); MYSERIAL1.begin(baud);
TERN_(DWIN_CREALITY_LCD_JYERSUI, eeprom_settings.Baud115k = (baud == 115200));
}
#if HAS_MULTI_SERIAL
if (set2) { MYSERIAL2.end(); MYSERIAL2.begin(baud); }
#ifdef SERIAL_PORT_3
Expand Down
3 changes: 3 additions & 0 deletions Marlin/src/gcode/control/M997.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@

#if ENABLED(DWIN_LCD_PROUI)
#include "../../lcd/e3v2/proui/dwin.h"
#elif ENABLED(DWIN_CREALITY_LCD_JYERSUI)
#include "../../lcd/e3v2/jyersui/dwin.h"
#endif

/**
Expand All @@ -34,6 +36,7 @@
void GcodeSuite::M997() {

TERN_(DWIN_LCD_PROUI, DWIN_RebootScreen());
TERN_(DWIN_CREALITY_LCD_JYERSUI, CrealityDWIN.DWIN_RebootScreen());

flashFirmware(parser.intval('S'));

Expand Down
4 changes: 4 additions & 0 deletions Marlin/src/gcode/lcd/M0_M1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
#elif ENABLED(DWIN_LCD_PROUI)
#include "../../lcd/e3v2/proui/dwin_popup.h"
#include "../../lcd/e3v2/proui/dwin.h"
#elif ENABLED(DWIN_CREALITY_LCD_JYERSUI)
#include "../../lcd/e3v2/jyersui/dwin.h"
#endif

#if ENABLED(HOST_PROMPT_SUPPORT)
Expand Down Expand Up @@ -76,6 +78,8 @@ void GcodeSuite::M0_M1() {
DWIN_Popup_Confirm(ICON_BLTouch, parser.string_arg, GET_TEXT_F(MSG_USERWAIT));
else
DWIN_Popup_Confirm(ICON_BLTouch, GET_TEXT_F(MSG_STOPPED), GET_TEXT_F(MSG_USERWAIT));
#elif ENABLED(DWIN_CREALITY_LCD_JYERSUI)
CrealityDWIN.Confirm_Handler(UserInput, parser.string_arg == nullptr);
#else

if (parser.string_arg) {
Expand Down
10 changes: 6 additions & 4 deletions Marlin/src/gcode/probe/G30.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#include "../../feature/probe_temp_comp.h"
#endif

#if ENABLED(DWIN_LCD_PROUI)
#if EITHER(DWIN_LCD_PROUI, DWIN_CREALITY_LCD_JYERSUI)
#include "../../lcd/marlinui.h"
#endif

Expand All @@ -53,7 +53,7 @@ void GcodeSuite::G30() {
parser.linearval('Y', current_position.y + probe.offset_xy.y) };

if (!probe.can_reach(pos)) {
#if ENABLED(DWIN_LCD_PROUI)
#if EITHER(DWIN_LCD_PROUI, DWIN_CREALITY_LCD_JYERSUI)
SERIAL_ECHOLNF(GET_EN_TEXT_F(MSG_ZPROBE_OUT));
LCD_MESSAGE(MSG_ZPROBE_OUT);
#endif
Expand All @@ -65,7 +65,9 @@ void GcodeSuite::G30() {

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;

Expand All @@ -74,7 +76,7 @@ void GcodeSuite::G30() {
TERN_(HAS_PTC, ptc.set_enabled(true));
if (!isnan(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];
sprintf_P(msg, PSTR("X:%s, Y:%s, Z:%s"),
dtostrf(pos.x, 1, 1, str_1),
Expand Down
16 changes: 12 additions & 4 deletions Marlin/src/gcode/stats/M75-M78.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,23 @@
#include "../../lcd/e3v2/proui/dwin.h"
#endif

#if ENABLED(DWIN_CREALITY_LCD_JYERSUI)
#include "../../lcd/e3v2/jyersui/dwin.h"
#endif

/**
* M75: Start print timer
*/
void GcodeSuite::M75() {
startOrResumeJob();
#if ENABLED(DWIN_LCD_PROUI)
DWIN_Print_Started(false);
if (!IS_SD_PRINTING()) DWIN_Print_Header(parser.string_arg && parser.string_arg[0] ? parser.string_arg : GET_TEXT(MSG_HOST_START_PRINT));
#endif
TERN_(DWIN_LCD_PROUI, DWIN_Print_Started(false));
if (!IS_SD_PRINTING()) {
#if ENABLED(DWIN_LCD_PROUI)
DWIN_Print_Header(parser.string_arg && parser.string_arg[0] ? parser.string_arg : GET_TEXT(MSG_HOST_START_PRINT));
#elif ENABLED(DWIN_CREALITY_LCD_JYERSUI)
CrealityDWIN.Update_Print_Filename(parser.string_arg && parser.string_arg[0] ? parser.string_arg : GET_TEXT(MSG_HOST_START_PRINT));
#endif
}
}

/**
Expand Down
3 changes: 3 additions & 0 deletions Marlin/src/gcode/temp/M303.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
#include "../../lcd/extui/ui_api.h"
#elif ENABLED(DWIN_LCD_PROUI)
#include "../../lcd/e3v2/proui/dwin.h"
#elif ENABLED(DWIN_CREALITY_LCD_JYERSUI)
#include "../../lcd/e3v2/jyersui/dwin.h"
#endif

/**
Expand Down Expand Up @@ -75,6 +77,7 @@ void GcodeSuite::M303() {
SERIAL_ECHOLNPGM(STR_PID_BAD_HEATER_ID);
TERN_(EXTENSIBLE_UI, ExtUI::onPidTuning(ExtUI::result_t::PID_BAD_EXTRUDER_NUM));
TERN_(DWIN_LCD_PROUI, DWIN_PidTuning(PID_BAD_EXTRUDER_NUM));
TERN_(DWIN_CREALITY_LCD_JYERSUI, CrealityDWINClass::DWIN_PidTuning(PID_BAD_EXTRUDER_NUM));
return;
}

Expand Down
9 changes: 4 additions & 5 deletions Marlin/src/inc/Conditionals_LCD.h
Original file line number Diff line number Diff line change
Expand Up @@ -1256,6 +1256,8 @@
#endif
#if ANY(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR, AUTO_BED_LEVELING_3POINT)
#define HAS_ABL_NOT_UBL 1
#else
#undef PROBE_MANUALLY
#endif
#if ANY(AUTO_BED_LEVELING_BILINEAR, AUTO_BED_LEVELING_UBL, MESH_BED_LEVELING)
#define HAS_MESH 1
Expand All @@ -1274,14 +1276,11 @@
#if DISABLED(AUTO_BED_LEVELING_UBL)
#define PLANNER_LEVELING 1
#endif
#endif
#if !HAS_LEVELING
#else
#undef RESTORE_LEVELING_AFTER_G28
#undef ENABLE_LEVELING_AFTER_G28
#undef G29_RETRY_AND_RECOVER
#endif
#if !HAS_LEVELING || EITHER(MESH_BED_LEVELING, AUTO_BED_LEVELING_UBL)
#undef PROBE_MANUALLY
#undef PREHEAT_BEFORE_LEVELING
#endif
#if ANY(HAS_BED_PROBE, PROBE_MANUALLY, MESH_BED_LEVELING)
#define PROBE_SELECTED 1
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/inc/Conditionals_post.h
Original file line number Diff line number Diff line change
Expand Up @@ -3541,7 +3541,7 @@
#ifndef MESH_MAX_Y
#define MESH_MAX_Y _MESH_MAX_Y
#endif
#else
#elif DISABLED(DWIN_CREALITY_LCD_JYERSUI)
#undef MESH_MIN_X
#undef MESH_MIN_Y
#undef MESH_MAX_X
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/inc/SanityCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -3671,7 +3671,7 @@ static_assert(_PLUS_TEST(4), "HOMING_FEEDRATE_MM_M values must be positive.");
#error "A very large BLOCK_BUFFER_SIZE is not needed and takes longer to drain the buffer on pause / cancel."
#endif

#if ENABLED(LED_CONTROL_MENU) && NONE(HAS_MARLINUI_MENU, DWIN_LCD_PROUI)
#if ENABLED(LED_CONTROL_MENU) && NONE(HAS_MARLINUI_MENU, DWIN_LCD_PROUI, DWIN_CREALITY_LCD_JYERSUI)
#error "LED_CONTROL_MENU requires an LCD controller that implements the menu."
#endif

Expand Down
10 changes: 7 additions & 3 deletions Marlin/src/lcd/e3v2/common/dwin_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ void DWIN_Frame_AreaMove(uint8_t mode, uint8_t dir, uint16_t dis,
// *string: The string
// rlimit: To limit the drawn string length
void DWIN_Draw_String(bool bShow, uint8_t size, uint16_t color, uint16_t bColor, uint16_t x, uint16_t y, const char * const string, uint16_t rlimit/*=0xFFFF*/) {
#if DISABLED(DWIN_LCD_PROUI)
#if NONE(DWIN_LCD_PROUI, DWIN_CREALITY_LCD_JYERSUI)
DWIN_Draw_Rectangle(1, bColor, x, y, x + (fontWidth(size) * strlen_P(string)), y + fontHeight(size));
#endif
constexpr uint8_t widthAdjust = 0;
Expand Down Expand Up @@ -266,7 +266,9 @@ void DWIN_Draw_String(bool bShow, uint8_t size, uint16_t color, uint16_t bColor,
void DWIN_Draw_IntValue(uint8_t bShow, bool zeroFill, uint8_t zeroMode, uint8_t size, uint16_t color,
uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, uint32_t value) {
size_t i = 0;
DWIN_Draw_Rectangle(1, bColor, x, y, x + fontWidth(size) * iNum + 1, y + fontHeight(size));
#if DISABLED(DWIN_CREALITY_LCD_JYERSUI)
DWIN_Draw_Rectangle(1, bColor, x, y, x + fontWidth(size) * iNum + 1, y + fontHeight(size));
#endif
DWIN_Byte(i, 0x14);
// Bit 7: bshow
// Bit 6: 1 = signed; 0 = unsigned number;
Expand Down Expand Up @@ -314,7 +316,9 @@ void DWIN_Draw_FloatValue(uint8_t bShow, bool zeroFill, uint8_t zeroMode, uint8_
uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, int32_t value) {
//uint8_t *fvalue = (uint8_t*)&value;
size_t i = 0;
DWIN_Draw_Rectangle(1, bColor, x, y, x + fontWidth(size) * (iNum+fNum+1), y + fontHeight(size));
#if DISABLED(DWIN_CREALITY_LCD_JYERSUI)
DWIN_Draw_Rectangle(1, bColor, x, y, x + fontWidth(size) * (iNum+fNum+1), y + fontHeight(size));
#endif
DWIN_Byte(i, 0x14);
DWIN_Byte(i, (bShow * 0x80) | (zeroFill * 0x20) | (zeroMode * 0x10) | size);
DWIN_Word(i, color);
Expand Down
Loading

0 comments on commit a797390

Please sign in to comment.