🚚 Relocate and adjust DWIN E3V2 (#22471)

This commit is contained in:
Scott Lahteine 2021-07-31 05:32:13 -05:00 committed by Scott Lahteine
parent a348f8e02c
commit c544711f14
23 changed files with 305 additions and 268 deletions

View File

@ -1282,11 +1282,14 @@
//#define LCD_SHOW_E_TOTAL
#endif
#if EITHER(SDSUPPORT, LCD_SET_PROGRESS_MANUALLY) && ANY(HAS_MARLINUI_U8GLIB, HAS_MARLINUI_HD44780, IS_TFTGLCD_PANEL, EXTENSIBLE_UI)
//#define SHOW_REMAINING_TIME // Display estimated time to completion
#if ENABLED(SHOW_REMAINING_TIME)
//#define USE_M73_REMAINING_TIME // Use remaining time from M73 command instead of estimation
//#define ROTATE_PROGRESS_DISPLAY // Display (P)rogress, (E)lapsed, and (R)emaining time
// LCD Print Progress options
#if EITHER(SDSUPPORT, LCD_SET_PROGRESS_MANUALLY)
#if ANY(HAS_MARLINUI_U8GLIB, EXTENSIBLE_UI, HAS_MARLINUI_HD44780, IS_TFTGLCD_PANEL)
//#define SHOW_REMAINING_TIME // Display estimated time to completion
#if ENABLED(SHOW_REMAINING_TIME)
//#define USE_M73_REMAINING_TIME // Use remaining time from M73 command instead of estimation
//#define ROTATE_PROGRESS_DISPLAY // Display (P)rogress, (E)lapsed, and (R)emaining time
#endif
#endif
#if EITHER(HAS_MARLINUI_U8GLIB, EXTENSIBLE_UI)

View File

@ -75,8 +75,8 @@
#endif
#if ENABLED(DWIN_CREALITY_LCD)
#include "lcd/dwin/e3v2/dwin.h"
#include "lcd/dwin/e3v2/rotary_encoder.h"
#include "lcd/e3v2/creality/dwin.h"
#include "lcd/e3v2/creality/rotary_encoder.h"
#endif
#if ENABLED(EXTENSIBLE_UI)
@ -1310,11 +1310,7 @@ void setup() {
// (because EEPROM code calls the UI).
#if ENABLED(DWIN_CREALITY_LCD)
delay(800); // Required delay (since boot?)
SERIAL_ECHOPGM("\nDWIN handshake ");
if (DWIN_Handshake()) SERIAL_ECHOLNPGM("ok."); else SERIAL_ECHOLNPGM("error.");
DWIN_Frame_SetDir(1); // Orientation 90°
DWIN_UpdateLCD(); // Show bootscreen (first image)
SETUP_RUN(DWIN_Startup());
#else
SETUP_RUN(ui.init());
#if BOTH(HAS_WIRED_LCD, SHOW_BOOTSCREEN)

View File

@ -61,7 +61,7 @@
#endif
#if ENABLED(DWIN_CREALITY_LCD)
#include "../../../lcd/dwin/e3v2/dwin.h"
#include "../../../lcd/e3v2/creality/dwin.h"
#endif
#if HAS_MULTI_HOTEND

View File

@ -47,7 +47,7 @@
#include "../../lcd/marlinui.h"
#if ENABLED(DWIN_CREALITY_LCD)
#include "../../lcd/dwin/e3v2/dwin.h"
#include "../../lcd/e3v2/creality/dwin.h"
#endif
#if ENABLED(EXTENSIBLE_UI)

View File

@ -482,10 +482,6 @@
#endif
// Aliases for LCD features
#if EITHER(IS_ULTRA_LCD, EXTENSIBLE_UI)
#define HAS_DISPLAY 1
#endif
#if IS_ULTRA_LCD
#define HAS_WIRED_LCD 1
#if ENABLED(DOGLCD)
@ -497,6 +493,10 @@
#endif
#endif
#if EITHER(HAS_WIRED_LCD, EXTENSIBLE_UI)
#define HAS_DISPLAY 1
#endif
#if ANY(HAS_DISPLAY, DWIN_CREALITY_LCD, GLOBAL_STATUS_MESSAGE)
#define HAS_STATUS_MESSAGE 1
#endif

View File

@ -791,9 +791,10 @@ void MarlinUI::draw_status_screen() {
//
lcd.setCursor(0, 0);
_draw_axis_value(X_AXIS, ftostr4sign(LOGICAL_X_POSITION(current_position.x)), blink); lcd.write(' ');
_draw_axis_value(Y_AXIS, ftostr4sign(LOGICAL_Y_POSITION(current_position.y)), blink); lcd.write(' ');
_draw_axis_value(Z_AXIS, ftostr52sp(LOGICAL_Z_POSITION(current_position.z)), blink);
const xyz_pos_t lpos = current_position.asLogical();
_draw_axis_value(X_AXIS, ftostr4sign(lpos.x), blink); lcd.write(' ');
_draw_axis_value(Y_AXIS, ftostr4sign(lpos.y), blink); lcd.write(' ');
_draw_axis_value(Z_AXIS, ftostr52sp(lpos.z), blink);
#if HAS_LEVELING && !HAS_HEATED_BED
lcd.write(planner.leveling_active || blink ? '_' : ' ');

View File

@ -42,10 +42,6 @@
#define JUST_BABYSTEP 1
#endif
#include <WString.h>
#include <stdio.h>
#include <string.h>
#include "../../fontutils.h"
#include "../../marlinui.h"
@ -85,6 +81,10 @@
#include "../../../feature/powerloss.h"
#endif
#include <WString.h>
#include <stdio.h>
#include <string.h>
#ifndef MACHINE_SIZE
#define MACHINE_SIZE STRINGIFY(X_BED_SIZE) "x" STRINGIFY(Y_BED_SIZE) "x" STRINGIFY(Z_MAX_POS)
#endif
@ -97,10 +97,6 @@
#define USE_STRING_HEADINGS
//#define USE_STRING_TITLES
#define DWIN_FONT_MENU font8x16
#define DWIN_FONT_STAT font10x20
#define DWIN_FONT_HEAD font10x20
#define MENU_CHAR_LIMIT 24
#define STATUS_Y 360
@ -135,6 +131,9 @@ constexpr uint16_t TROWS = 6, MROWS = TROWS - 1, // Total rows, and other
#define BABY_Z_VAR TERN(HAS_BED_PROBE, probe.offset.z, dwin_zoffset)
#define DWIN_BOTTOM (DWIN_HEIGHT-1)
#define DWIN_RIGHT (DWIN_WIDTH-1)
/* Value Init */
HMI_value_t HMI_ValueStruct;
HMI_Flag_t HMI_flag{0};
@ -220,11 +219,11 @@ void HMI_ToggleLanguage() {
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) {
if (value < 0) {
DWIN_Draw_String(false, true, size, Color_White, bColor, x - 6, y, F("-"));
DWIN_Draw_String(true, size, Color_White, bColor, x - 6, y, F("-"));
DWIN_Draw_FloatValue(true, true, 0, size, Color_White, bColor, iNum, fNum, x, y, -value);
}
else {
DWIN_Draw_String(false, true, size, Color_White, bColor, x - 6, y, F(" "));
DWIN_Draw_String(true, size, Color_White, bColor, x - 6, y, F(" "));
DWIN_Draw_FloatValue(true, true, 0, size, Color_White, bColor, iNum, fNum, x, y, value);
}
}
@ -391,20 +390,20 @@ void ICON_Stop() {
}
}
void Clear_Title_Bar() {
DWIN_Draw_Rectangle(1, Color_Bg_Blue, 0, 0, DWIN_WIDTH, 30);
inline void Clear_Title_Bar() {
DWIN_Draw_Box(1, Color_Bg_Blue, 0, 0, DWIN_WIDTH, TITLE_HEIGHT);
}
void Draw_Title(const char * const title) {
DWIN_Draw_String(false, false, DWIN_FONT_HEAD, Color_White, Color_Bg_Blue, 14, 4, (char*)title);
DWIN_Draw_String(false, DWIN_FONT_HEAD, Color_White, Color_Bg_Blue, 14, 4, (char*)title);
}
void Draw_Title(const __FlashStringHelper * title) {
DWIN_Draw_String(false, false, DWIN_FONT_HEAD, Color_White, Color_Bg_Blue, 14, 4, (char*)title);
DWIN_Draw_String(false, DWIN_FONT_HEAD, Color_White, Color_Bg_Blue, 14, 4, (char*)title);
}
void Clear_Menu_Area() {
DWIN_Draw_Rectangle(1, Color_Bg_Black, 0, 31, DWIN_WIDTH, STATUS_Y - 1);
inline void Clear_Menu_Area() {
DWIN_Draw_Box(1, Color_Bg_Black, 0, TITLE_HEIGHT, DWIN_WIDTH, STATUS_Y - TITLE_HEIGHT);
}
void Clear_Main_Window() {
@ -465,7 +464,7 @@ void Erase_Menu_Text(const uint8_t line) {
}
void Draw_Menu_Item(const uint8_t line, const uint8_t icon=0, const char * const label=nullptr, bool more=false) {
if (label) DWIN_Draw_String(false, false, font8x16, Color_White, Color_Bg_Black, LBLX, MBASE(line) - 1, (char*)label);
if (label) DWIN_Draw_String(false, font8x16, Color_White, Color_Bg_Black, LBLX, MBASE(line) - 1, (char*)label);
if (icon) Draw_Menu_Icon(line, icon);
if (more) Draw_More_Icon(line);
}
@ -494,7 +493,8 @@ void Draw_Back_First(const bool is_sel=true) {
if (is_sel) Draw_Menu_Cursor(0);
}
inline bool Apply_Encoder(const ENCODER_DiffState &encoder_diffState, auto &valref) {
template <typename T>
inline bool Apply_Encoder(const ENCODER_DiffState &encoder_diffState, T &valref) {
if (encoder_diffState == ENCODER_DIFF_CW)
valref += EncoderRate.encoderMoveValue;
else if (encoder_diffState == ENCODER_DIFF_CCW)
@ -563,7 +563,7 @@ inline bool Apply_Encoder(const ENCODER_DiffState &encoder_diffState, auto &valr
//
void DWIN_Draw_Label(const uint16_t y, char *string) {
DWIN_Draw_String(false, true, font8x16, Color_White, Color_Bg_Black, LBLX, y, string);
DWIN_Draw_String(true, font8x16, Color_White, Color_Bg_Black, LBLX, y, string);
}
void DWIN_Draw_Label(const uint16_t y, const __FlashStringHelper *title) {
DWIN_Draw_Label(y, (char*)title);
@ -577,7 +577,9 @@ void draw_move_en(const uint16_t line) {
#endif
}
void DWIN_Frame_TitleCopy(uint8_t id, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2) { DWIN_Frame_AreaCopy(id, x1, y1, x2, y2, 14, 8); }
inline void DWIN_Frame_TitleCopy(uint8_t id, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2) {
DWIN_Frame_AreaCopy(id, x1, y1, x2, y2, 14, 8);
}
void Item_Prepare_Move(const uint8_t row) {
if (HMI_IsChinese())
@ -703,7 +705,7 @@ void Item_Prepare_Lang(const uint8_t row) {
DWIN_Frame_AreaCopy(1, 0, 194, 121, 207, LBLX, MBASE(row)); // "Language selection"
#endif
}
DWIN_Draw_String(false, false, font8x16, Color_White, Color_Bg_Black, 226, MBASE(row), HMI_IsChinese() ? F("CN") : F("EN"));
DWIN_Draw_String(false, font8x16, Color_White, Color_Bg_Black, 226, MBASE(row), HMI_IsChinese() ? F("CN") : F("EN"));
Draw_Menu_Icon(row, ICON_Language);
}
@ -849,7 +851,7 @@ void Draw_Tune_Menu() {
Clear_Main_Window();
if (HMI_IsChinese()) {
DWIN_Frame_AreaCopy(1, 73, 2, 100, 13, 14, 9);
DWIN_Frame_TitleCopy(1, 73, 2, 100, 13);
DWIN_Frame_AreaCopy(1, 116, 164, 171, 176, LBLX, MBASE(TUNE_CASE_SPEED));
#if HAS_HOTEND
DWIN_Frame_AreaCopy(1, 1, 134, 56, 146, LBLX, MBASE(TUNE_CASE_TEMP));
@ -883,6 +885,7 @@ void Draw_Tune_Menu() {
#endif
DWIN_Draw_Label(MBASE(TUNE_CASE_ZOFF), GET_TEXT_F(MSG_ZPROBE_ZOFFSET));
#else
DWIN_Frame_TitleCopy(1, 94, 2, 126, 12);
DWIN_Frame_AreaCopy(1, 1, 179, 92, 190, LBLX, MBASE(TUNE_CASE_SPEED)); // Print speed
#if HAS_HOTEND
DWIN_Frame_AreaCopy(1, 197, 104, 238, 114, LBLX, MBASE(TUNE_CASE_TEMP)); // Hotend...
@ -1008,6 +1011,7 @@ void Draw_Motion_Menu() {
//
// Draw Popup Windows
//
#if HAS_HOTEND || HAS_HEATED_BED
void DWIN_Popup_Temperature(const bool toohigh) {
@ -1021,8 +1025,8 @@ void Draw_Motion_Menu() {
DWIN_Frame_AreaCopy(1, 189, 389, 271, 402, 95, 310);
}
else {
DWIN_Draw_String(false, true, font8x16, Popup_Text_Color, Color_Bg_Window, 36, 300, F("Nozzle or Bed temperature"));
DWIN_Draw_String(false, true, font8x16, Popup_Text_Color, Color_Bg_Window, 92, 300, F("is too high"));
DWIN_Draw_String(true, font8x16, Popup_Text_Color, Color_Bg_Window, 36, 300, F("Nozzle or Bed temperature"));
DWIN_Draw_String(true, font8x16, Popup_Text_Color, Color_Bg_Window, 92, 300, F("is too high"));
}
}
else {
@ -1032,8 +1036,8 @@ void Draw_Motion_Menu() {
DWIN_Frame_AreaCopy(1, 189, 389, 271, 402, 95, 310);
}
else {
DWIN_Draw_String(false, true, font8x16, Popup_Text_Color, Color_Bg_Window, 36, 300, F("Nozzle or Bed temperature"));
DWIN_Draw_String(false, true, font8x16, Popup_Text_Color, Color_Bg_Window, 92, 300, F("is too low"));
DWIN_Draw_String(true, font8x16, Popup_Text_Color, Color_Bg_Window, 36, 300, F("Nozzle or Bed temperature"));
DWIN_Draw_String(true, font8x16, Popup_Text_Color, Color_Bg_Window, 92, 300, F("is too low"));
}
}
}
@ -1052,11 +1056,11 @@ void Draw_Popup_Bkgd_60() {
DWIN_ICON_Show(ICON, ICON_TempTooLow, 102, 105);
if (HMI_IsChinese()) {
DWIN_Frame_AreaCopy(1, 103, 371, 136, 386, 69, 240);
DWIN_Frame_AreaCopy(1, 170, 371, 270, 386, 102, 240);
DWIN_Frame_AreaCopy(1, 170, 371, 270, 386, 69 + 33, 240);
DWIN_ICON_Show(ICON, ICON_Confirm_C, 86, 280);
}
else {
DWIN_Draw_String(false, true, font8x16, Popup_Text_Color, Color_Bg_Window, 20, 235, F("Nozzle is too cold"));
DWIN_Draw_String(true, font8x16, Popup_Text_Color, Color_Bg_Window, 20, 235, F("Nozzle is too cold"));
DWIN_ICON_Show(ICON, ICON_Confirm_E, 86, 280);
}
}
@ -1073,9 +1077,9 @@ void Popup_Window_Resume() {
DWIN_ICON_Show(ICON, ICON_Continue_C, 146, 307);
}
else {
DWIN_Draw_String(false, true, font8x16, Popup_Text_Color, Color_Bg_Window, (272 - 8 * 14) / 2, 115, F("Continue Print"));
DWIN_Draw_String(false, true, font8x16, Popup_Text_Color, Color_Bg_Window, (272 - 8 * 22) / 2, 192, F("It looks like the last"));
DWIN_Draw_String(false, true, font8x16, Popup_Text_Color, Color_Bg_Window, (272 - 8 * 22) / 2, 212, F("file was interrupted."));
DWIN_Draw_String(true, font8x16, Popup_Text_Color, Color_Bg_Window, (272 - 8 * 14) / 2, 115, F("Continue Print"));
DWIN_Draw_String(true, font8x16, Popup_Text_Color, Color_Bg_Window, (272 - 8 * 22) / 2, 192, F("It looks like the last"));
DWIN_Draw_String(true, font8x16, Popup_Text_Color, Color_Bg_Window, (272 - 8 * 22) / 2, 212, F("file was interrupted."));
DWIN_ICON_Show(ICON, ICON_Cancel_E, 26, 307);
DWIN_ICON_Show(ICON, ICON_Continue_E, 146, 307);
}
@ -1091,8 +1095,8 @@ void Popup_Window_Home(const bool parking/*=false*/) {
DWIN_Frame_AreaCopy(1, 0, 389, 150, 402, 61, 280);
}
else {
DWIN_Draw_String(false, true, font8x16, Popup_Text_Color, Color_Bg_Window, (272 - 8 * (parking ? 7 : 10)) / 2, 230, parking ? F("Parking") : F("Homing XYZ"));
DWIN_Draw_String(false, true, font8x16, Popup_Text_Color, Color_Bg_Window, (272 - 8 * 23) / 2, 260, F("Please wait until done."));
DWIN_Draw_String(true, font8x16, Popup_Text_Color, Color_Bg_Window, (272 - 8 * (parking ? 7 : 10)) / 2, 230, parking ? F("Parking") : F("Homing XYZ"));
DWIN_Draw_String(true, font8x16, Popup_Text_Color, Color_Bg_Window, (272 - 8 * 23) / 2, 260, F("Please wait until done."));
}
}
@ -1107,8 +1111,8 @@ void Popup_Window_Home(const bool parking/*=false*/) {
DWIN_Frame_AreaCopy(1, 0, 389, 150, 402, 61, 280);
}
else {
DWIN_Draw_String(false, true, font8x16, Popup_Text_Color, Color_Bg_Window, (272 - 8 * 13) / 2, 230, GET_TEXT_F(MSG_BED_LEVELING));
DWIN_Draw_String(false, true, font8x16, Popup_Text_Color, Color_Bg_Window, (272 - 8 * 23) / 2, 260, F("Please wait until done."));
DWIN_Draw_String(true, font8x16, Popup_Text_Color, Color_Bg_Window, (272 - 8 * 13) / 2, 230, GET_TEXT_F(MSG_BED_LEVELING));
DWIN_Draw_String(true, font8x16, Popup_Text_Color, Color_Bg_Window, (272 - 8 * 23) / 2, 260, F("Please wait until done."));
}
}
@ -1135,8 +1139,8 @@ void Popup_window_PauseOrStop() {
DWIN_ICON_Show(ICON, ICON_Cancel_C, 146, 280);
}
else {
if (select_print.now == 1) DWIN_Draw_String(false, true, font8x16, Popup_Text_Color, Color_Bg_Window, (272 - 8 * 11) / 2, 150, GET_TEXT_F(MSG_PAUSE_PRINT));
else if (select_print.now == 2) DWIN_Draw_String(false, true, font8x16, Popup_Text_Color, Color_Bg_Window, (272 - 8 * 10) / 2, 150, GET_TEXT_F(MSG_STOP_PRINT));
if (select_print.now == 1) DWIN_Draw_String(true, font8x16, Popup_Text_Color, Color_Bg_Window, (272 - 8 * 11) / 2, 150, GET_TEXT_F(MSG_PAUSE_PRINT));
else if (select_print.now == 2) DWIN_Draw_String(true, font8x16, Popup_Text_Color, Color_Bg_Window, (272 - 8 * 10) / 2, 150, GET_TEXT_F(MSG_STOP_PRINT));
DWIN_ICON_Show(ICON, ICON_Confirm_E, 26, 280);
DWIN_ICON_Show(ICON, ICON_Cancel_E, 146, 280);
}
@ -1160,19 +1164,19 @@ void Draw_Print_ProgressBar() {
DWIN_ICON_Show(ICON, ICON_Bar, 15, 93);
DWIN_Draw_Rectangle(1, BarFill_Color, 16 + _card_percent * 240 / 100, 93, 256, 113);
DWIN_Draw_IntValue(true, true, 0, font8x16, Percent_Color, Color_Bg_Black, 2, 117, 133, _card_percent);
DWIN_Draw_String(false, false, font8x16, Percent_Color, Color_Bg_Black, 133, 133, F("%"));
DWIN_Draw_String(false, font8x16, Percent_Color, Color_Bg_Black, 133, 133, F("%"));
}
void Draw_Print_ProgressElapsed() {
duration_t elapsed = print_job_timer.duration(); // print timer
DWIN_Draw_IntValue(true, true, 1, font8x16, Color_White, Color_Bg_Black, 2, 42, 212, elapsed.value / 3600);
DWIN_Draw_String(false, false, font8x16, Color_White, Color_Bg_Black, 58, 212, F(":"));
DWIN_Draw_String(false, font8x16, Color_White, Color_Bg_Black, 58, 212, F(":"));
DWIN_Draw_IntValue(true, true, 1, font8x16, Color_White, Color_Bg_Black, 2, 66, 212, (elapsed.value % 3600) / 60);
}
void Draw_Print_ProgressRemain() {
DWIN_Draw_IntValue(true, true, 1, font8x16, Color_White, Color_Bg_Black, 2, 176, 212, _remain_time / 3600);
DWIN_Draw_String(false, false, font8x16, Color_White, Color_Bg_Black, 192, 212, F(":"));
DWIN_Draw_String(false, font8x16, Color_White, Color_Bg_Black, 192, 212, F(":"));
DWIN_Draw_IntValue(true, true, 1, font8x16, Color_White, Color_Bg_Black, 2, 200, 212, (_remain_time % 3600) / 60);
}
@ -1189,7 +1193,7 @@ void Goto_PrintProcess() {
// Copy into filebuf string before entry
char * const name = card.longest_filename();
const int8_t npos = _MAX(0U, DWIN_WIDTH - strlen(name) * MENU_CHR_W) / 2;
DWIN_Draw_String(false, false, font8x16, Color_White, Color_Bg_Black, npos, 60, name);
DWIN_Draw_String(false, font8x16, Color_White, Color_Bg_Black, npos, 60, name);
DWIN_ICON_Show(ICON, ICON_PrintTime, 17, 193);
DWIN_ICON_Show(ICON, ICON_RemainTime, 150, 191);
@ -1204,14 +1208,13 @@ void Goto_MainMenu() {
Clear_Main_Window();
if (HMI_IsChinese()) {
DWIN_Frame_AreaCopy(1, 2, 2, 27, 14, 14, 9); // "Home"
}
if (HMI_IsChinese())
DWIN_Frame_TitleCopy(1, 2, 2, 27, 14); // "Home"
else {
#ifdef USE_STRING_HEADINGS
Draw_Title(GET_TEXT_F(MSG_MAIN));
#else
DWIN_Frame_AreaCopy(1, 0, 2, 39, 12, 14, 9);
DWIN_Frame_TitleCopy(1, 0, 2, 39, 12);
#endif
}
@ -1588,9 +1591,9 @@ void _update_axis_value(const AxisEnum axis, const uint16_t x, const uint16_t y,
if (force || changed || draw_qmark || draw_empty) {
if (blink && draw_qmark)
DWIN_Draw_String(false, true, font8x16, Color_White, Color_Bg_Black, x, y, F("???.?"));
DWIN_Draw_String(true, font8x16, Color_White, Color_Bg_Black, x, y, F("???.?"));
else if (blink && draw_empty)
DWIN_Draw_String(false, true, font8x16, Color_White, Color_Bg_Black, x, y, F(" "));
DWIN_Draw_String(true, font8x16, Color_White, Color_Bg_Black, x, y, F(" "));
else
DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 1, x, y, p * 10);
}
@ -1706,11 +1709,11 @@ void update_variable() {
_offset = BABY_Z_VAR;
if (BABY_Z_VAR < 0) {
DWIN_Draw_FloatValue(true, true, 0, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 2, 2, 207, 417, -_offset * 100);
DWIN_Draw_String(false, true, font8x16, Color_White, Color_Bg_Black, 205, 419, F("-"));
DWIN_Draw_String(true, font8x16, Color_White, Color_Bg_Black, 205, 419, F("-"));
}
else {
DWIN_Draw_FloatValue(true, true, 0, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 2, 2, 207, 417, _offset * 100);
DWIN_Draw_String(false, true, font8x16, Color_White, Color_Bg_Black, 205, 419, F(" "));
DWIN_Draw_String(true, font8x16, Color_White, Color_Bg_Black, 205, 419, F(" "));
}
}
@ -1853,7 +1856,7 @@ void Redraw_SD_List() {
}
else {
DWIN_Draw_Rectangle(1, Color_Bg_Red, 10, MBASE(3) - 10, DWIN_WIDTH - 10, MBASE(4));
DWIN_Draw_String(false, false, font16x32, Color_Yellow, Color_Bg_Red, ((DWIN_WIDTH) - 8 * 16) / 2, MBASE(3), F("No Media"));
DWIN_Draw_String(false, font16x32, Color_Yellow, Color_Bg_Red, ((DWIN_WIDTH) - 8 * 16) / 2, MBASE(3), F("No Media"));
}
}
@ -1911,24 +1914,24 @@ void Draw_Status_Area(const bool with_update) {
#if HAS_HOTEND
DWIN_ICON_Show(ICON, ICON_HotendTemp, 10, 383);
DWIN_Draw_IntValue(true, true, 0, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 3, 28, 384, thermalManager.wholeDegHotend(0));
DWIN_Draw_String(false, false, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 25 + 3 * STAT_CHR_W + 5, 384, F("/"));
DWIN_Draw_String(false, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 25 + 3 * STAT_CHR_W + 5, 384, F("/"));
DWIN_Draw_IntValue(true, true, 0, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 3, 25 + 4 * STAT_CHR_W + 6, 384, thermalManager.degTargetHotend(0));
DWIN_ICON_Show(ICON, ICON_StepE, 112, 417);
DWIN_Draw_IntValue(true, true, 0, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 3, 116 + 2 * STAT_CHR_W, 417, planner.flow_percentage[0]);
DWIN_Draw_String(false, false, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 116 + 5 * STAT_CHR_W + 2, 417, F("%"));
DWIN_Draw_String(false, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 116 + 5 * STAT_CHR_W + 2, 417, F("%"));
#endif
#if HAS_HEATED_BED
DWIN_ICON_Show(ICON, ICON_BedTemp, 10, 416);
DWIN_Draw_IntValue(true, true, 0, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 3, 28, 417, thermalManager.wholeDegBed());
DWIN_Draw_String(false, false, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 25 + 3 * STAT_CHR_W + 5, 417, F("/"));
DWIN_Draw_String(false, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 25 + 3 * STAT_CHR_W + 5, 417, F("/"));
DWIN_Draw_IntValue(true, true, 0, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 3, 25 + 4 * STAT_CHR_W + 6, 417, thermalManager.degTargetBed());
#endif
DWIN_ICON_Show(ICON, ICON_Speed, 113, 383);
DWIN_Draw_IntValue(true, true, 0, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 3, 116 + 2 * STAT_CHR_W, 384, feedrate_percentage);
DWIN_Draw_String(false, false, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 116 + 5 * STAT_CHR_W + 2, 384, F("%"));
DWIN_Draw_String(false, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 116 + 5 * STAT_CHR_W + 2, 384, F("%"));
#if HAS_FAN
DWIN_ICON_Show(ICON, ICON_FanSpeed, 187, 383);
@ -1941,11 +1944,11 @@ void Draw_Status_Area(const bool with_update) {
if (BABY_Z_VAR < 0) {
DWIN_Draw_FloatValue(true, true, 0, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 2, 2, 207, 417, -BABY_Z_VAR * 100);
DWIN_Draw_String(false, true, font8x16, Color_White, Color_Bg_Black, 205, 419, F("-"));
DWIN_Draw_String(true, font8x16, Color_White, Color_Bg_Black, 205, 419, F("-"));
}
else {
DWIN_Draw_FloatValue(true, true, 0, DWIN_FONT_STAT, Color_White, Color_Bg_Black, 2, 2, 207, 417, BABY_Z_VAR * 100);
DWIN_Draw_String(false, true, font8x16, Color_White, Color_Bg_Black, 205, 419, F(" "));
DWIN_Draw_String(true, font8x16, Color_White, Color_Bg_Black, 205, 419, F(" "));
}
DWIN_Draw_Rectangle(1, Line_Color, 0, 449, DWIN_WIDTH, 451);
@ -1969,8 +1972,8 @@ void HMI_StartFrame(const bool with_update) {
void Draw_Info_Menu() {
Clear_Main_Window();
DWIN_Draw_String(false, false, font8x16, Color_White, Color_Bg_Black, (DWIN_WIDTH - strlen(MACHINE_SIZE) * MENU_CHR_W) / 2, 122, F(MACHINE_SIZE));
DWIN_Draw_String(false, false, font8x16, Color_White, Color_Bg_Black, (DWIN_WIDTH - strlen(SHORT_BUILD_VERSION) * MENU_CHR_W) / 2, 195, F(SHORT_BUILD_VERSION));
DWIN_Draw_String(false, font8x16, Color_White, Color_Bg_Black, (DWIN_WIDTH - strlen(MACHINE_SIZE) * MENU_CHR_W) / 2, 122, F(MACHINE_SIZE));
DWIN_Draw_String(false, font8x16, Color_White, Color_Bg_Black, (DWIN_WIDTH - strlen(SHORT_BUILD_VERSION) * MENU_CHR_W) / 2, 195, F(SHORT_BUILD_VERSION));
if (HMI_IsChinese()) {
DWIN_Frame_TitleCopy(1, 30, 17, 57, 29); // "Info"
@ -1990,7 +1993,7 @@ void Draw_Info_Menu() {
DWIN_Frame_AreaCopy(1, 146, 151, 254, 161, 82, 175);
DWIN_Frame_AreaCopy(1, 0, 165, 94, 175, 89, 248);
}
DWIN_Draw_String(false, false, font8x16, Color_White, Color_Bg_Black, (DWIN_WIDTH - strlen(CORP_WEBSITE) * MENU_CHR_W) / 2, 268, F(CORP_WEBSITE));
DWIN_Draw_String(false, font8x16, Color_White, Color_Bg_Black, (DWIN_WIDTH - strlen(CORP_WEBSITE) * MENU_CHR_W) / 2, 268, F(CORP_WEBSITE));
Draw_Back_First();
LOOP_L_N(i, 3) {
@ -4007,7 +4010,7 @@ void EachMomentUpdate() {
//(void)recovery.interrupted_file_exists();
char * const name = card.longest_filename();
const int8_t npos = _MAX(0U, DWIN_WIDTH - strlen(name) * (MENU_CHR_W)) / 2;
DWIN_Draw_String(false, true, font8x16, Popup_Text_Color, Color_Bg_Window, npos, 252, name);
DWIN_Draw_String(true, font8x16, Popup_Text_Color, Color_Bg_Window, npos, 252, name);
DWIN_UpdateLCD();
while (recovery_flag) {
@ -4033,7 +4036,7 @@ void EachMomentUpdate() {
Goto_PrintProcess();
Draw_Status_Area(true);
}
#endif
#endif // POWER_LOSS_RECOVERY
DWIN_UpdateLCD();
}
@ -4124,7 +4127,7 @@ void DWIN_CompletedLeveling() {
void DWIN_StatusChanged(const char *text) {
DWIN_Draw_Rectangle(1, Color_Bg_Blue, 0, STATUS_Y, DWIN_WIDTH, STATUS_Y + 20);
const int8_t x = _MAX(0U, DWIN_WIDTH - strlen_P(text) * MENU_CHR_W) / 2;
DWIN_Draw_String(false, false, font8x16, Color_White, Color_Bg_Blue, x, STATUS_Y + 2, F(text));
DWIN_Draw_String(false, font8x16, Color_White, Color_Bg_Blue, x, STATUS_Y + 2, F(text));
DWIN_UpdateLCD();
}
@ -4136,8 +4139,8 @@ void DWIN_StatusChanged_P(PGM_P const pstr) {
// GUI extension
void DWIN_Draw_Checkbox(uint16_t color, uint16_t bcolor, uint16_t x, uint16_t y, bool mode=false) {
DWIN_Draw_String(false,true,font8x16,Select_Color,bcolor,x+4,y,F(mode ? "x" : " "));
DWIN_Draw_Rectangle(0,color,x+2,y+2,x+17,y+17);
DWIN_Draw_String(true, font8x16, Select_Color, bcolor, x + 4, y, F(mode ? "x" : " "));
DWIN_Draw_Rectangle(0, color, x + 2, y + 2, x + 17, y + 17);
}
#endif // DWIN_CREALITY_LCD

View File

@ -25,7 +25,7 @@
* DWIN by Creality3D
*/
#include "../dwin_lcd.h"
#include "dwin_lcd.h"
#include "rotary_encoder.h"
#include "../../../libs/BL24CXX.h"
@ -103,151 +103,6 @@ enum processID : uint8_t {
Popup_Window
};
// Picture ID
#define Start_Process 0
#define Language_English 1
#define Language_Chinese 2
// ICON ID
#define ICON 0x09
#define ICON_LOGO 0
#define ICON_Print_0 1
#define ICON_Print_1 2
#define ICON_Prepare_0 3
#define ICON_Prepare_1 4
#define ICON_Control_0 5
#define ICON_Control_1 6
#define ICON_Leveling_0 7
#define ICON_Leveling_1 8
#define ICON_HotendTemp 9
#define ICON_BedTemp 10
#define ICON_Speed 11
#define ICON_Zoffset 12
#define ICON_Back 13
#define ICON_File 14
#define ICON_PrintTime 15
#define ICON_RemainTime 16
#define ICON_Setup_0 17
#define ICON_Setup_1 18
#define ICON_Pause_0 19
#define ICON_Pause_1 20
#define ICON_Continue_0 21
#define ICON_Continue_1 22
#define ICON_Stop_0 23
#define ICON_Stop_1 24
#define ICON_Bar 25
#define ICON_More 26
#define ICON_Axis 27
#define ICON_CloseMotor 28
#define ICON_Homing 29
#define ICON_SetHome 30
#define ICON_PLAPreheat 31
#define ICON_ABSPreheat 32
#define ICON_Cool 33
#define ICON_Language 34
#define ICON_MoveX 35
#define ICON_MoveY 36
#define ICON_MoveZ 37
#define ICON_Extruder 38
#define ICON_Temperature 40
#define ICON_Motion 41
#define ICON_WriteEEPROM 42
#define ICON_ReadEEPROM 43
#define ICON_ResumeEEPROM 44
#define ICON_Info 45
#define ICON_SetEndTemp 46
#define ICON_SetBedTemp 47
#define ICON_FanSpeed 48
#define ICON_SetPLAPreheat 49
#define ICON_SetABSPreheat 50
#define ICON_MaxSpeed 51
#define ICON_MaxAccelerated 52
#define ICON_MaxJerk 53
#define ICON_Step 54
#define ICON_PrintSize 55
#define ICON_Version 56
#define ICON_Contact 57
#define ICON_StockConfiguraton 58
#define ICON_MaxSpeedX 59
#define ICON_MaxSpeedY 60
#define ICON_MaxSpeedZ 61
#define ICON_MaxSpeedE 62
#define ICON_MaxAccX 63
#define ICON_MaxAccY 64
#define ICON_MaxAccZ 65
#define ICON_MaxAccE 66
#define ICON_MaxSpeedJerkX 67
#define ICON_MaxSpeedJerkY 68
#define ICON_MaxSpeedJerkZ 69
#define ICON_MaxSpeedJerkE 70
#define ICON_StepX 71
#define ICON_StepY 72
#define ICON_StepZ 73
#define ICON_StepE 74
#define ICON_Setspeed 75
#define ICON_SetZOffset 76
#define ICON_Rectangle 77
#define ICON_BLTouch 78
#define ICON_TempTooLow 79
#define ICON_AutoLeveling 80
#define ICON_TempTooHigh 81
#define ICON_NoTips_C 82
#define ICON_NoTips_E 83
#define ICON_Continue_C 84
#define ICON_Continue_E 85
#define ICON_Cancel_C 86
#define ICON_Cancel_E 87
#define ICON_Confirm_C 88
#define ICON_Confirm_E 89
#define ICON_Info_0 90
#define ICON_Info_1 91
#define ICON_AdvSet ICON_Language
#define ICON_HomeOff ICON_AdvSet
#define ICON_HomeOffX ICON_StepX
#define ICON_HomeOffY ICON_StepY
#define ICON_HomeOffZ ICON_StepZ
#define ICON_ProbeOff ICON_AdvSet
#define ICON_ProbeOffX ICON_StepX
#define ICON_ProbeOffY ICON_StepY
#define ICON_PIDNozzle ICON_SetEndTemp
#define ICON_PIDbed ICON_SetBedTemp
/**
* 3-.0The font size, 0x00-0x09, corresponds to the font size below:
* 0x00=6*12 0x01=8*16 0x02=10*20 0x03=12*24 0x04=14*28
* 0x05=16*32 0x06=20*40 0x07=24*48 0x08=28*56 0x09=32*64
*/
#define font6x12 0x00
#define font8x16 0x01
#define font10x20 0x02
#define font12x24 0x03
#define font14x28 0x04
#define font16x32 0x05
#define font20x40 0x06
#define font24x48 0x07
#define font28x56 0x08
#define font32x64 0x09
// Color
#define Color_White 0xFFFF
#define Color_Yellow 0xFF0F
#define Color_Bg_Window 0x31E8 // Popup background color
#define Color_Bg_Blue 0x1125 // Dark blue background color
#define Color_Bg_Black 0x0841 // Black background color
#define Color_Bg_Red 0xF00F // Red background color
#define Popup_Text_Color 0xD6BA // Popup font background color
#define Line_Color 0x3A6A // Split line color
#define Rectangle_Color 0xEE2F // Blue square cursor color
#define Percent_Color 0xFE29 // Percentage color
#define BarFill_Color 0x10E4 // Fill color of progress bar
#define Select_Color 0x33BB // Selected color
extern uint8_t checkkey;
extern float zprobe_zoffset;
extern char print_filename[16];

View File

@ -21,24 +21,24 @@
*/
/********************************************************************************
* @file dwin_lcd.cpp
* @file lcd/e3v2/creality/dwin_lcd.cpp
* @author LEO / Creality3D
* @date 2019/07/18
* @version 2.0.1
* @brief DWIN screen control functions
********************************************************************************/
#include "../../inc/MarlinConfigPre.h"
#include "../../../inc/MarlinConfigPre.h"
#if ENABLED(DWIN_CREALITY_LCD)
#include "../../inc/MarlinConfig.h"
#include "../../../inc/MarlinConfig.h"
#include "dwin_lcd.h"
#include <string.h> // for memset
//#define DEBUG_OUT 1
#include "../../core/debug_out.h"
#include "../../../core/debug_out.h"
// Make sure DWIN_SendBuf is large enough to hold the largest string plus draw command and tail.
// Assume the narrowest (6 pixel) font and 2-byte gb2312-encoded characters.
@ -122,6 +122,17 @@ bool DWIN_Handshake(void) {
&& databuf[3] == 'K' );
}
void DWIN_Startup(void) {
DEBUG_ECHOPGM("\r\nDWIN handshake ");
delay(750); // Delay here or init later in the boot process
if (DWIN_Handshake()) DEBUG_ECHOLNPGM("ok."); else DEBUG_ECHOLNPGM("error.");
DWIN_Frame_SetDir(1);
#if DISABLED(SHOW_BOOTSCREEN)
DWIN_Frame_Clear(Color_Bg_Black); // MarlinUI handles the bootscreen so just clear here
#endif
DWIN_UpdateLCD();
}
// Set the backlight luminance
// luminance: (0x00-0xFF)
void DWIN_Backlight_SetLuminance(const uint8_t luminance) {
@ -164,9 +175,10 @@ void DWIN_Frame_Clear(const uint16_t color) {
// width: point width 0x01-0x0F
// height: point height 0x01-0x0F
// x,y: upper left point
void DWIN_Draw_Point(uint8_t width, uint8_t height, uint16_t x, uint16_t y) {
void DWIN_Draw_Point(uint16_t color, uint8_t width, uint8_t height, uint16_t x, uint16_t y) {
size_t i = 0;
DWIN_Byte(i, 0x02);
DWIN_Word(i, color);
DWIN_Byte(i, width);
DWIN_Byte(i, height);
DWIN_Word(i, x);
@ -238,8 +250,8 @@ void DWIN_Frame_AreaMove(uint8_t mode, uint8_t dir, uint16_t dis,
// bColor: Background color
// x/y: Upper-left coordinate of the string
// *string: The string
void DWIN_Draw_String(bool widthAdjust, bool bShow, uint8_t size,
uint16_t color, uint16_t bColor, uint16_t x, uint16_t y, char *string) {
void DWIN_Draw_String(bool bShow, uint8_t size, uint16_t color, uint16_t bColor, uint16_t x, uint16_t y, char *string) {
uint8_t widthAdjust = 0;
size_t i = 0;
DWIN_Byte(i, 0x11);
// Bit 7: widthAdjust
@ -356,6 +368,7 @@ void DWIN_ICON_Show(uint8_t libID, uint8_t picID, uint16_t x, uint16_t y) {
DWIN_Word(i, x);
DWIN_Word(i, y);
DWIN_Byte(i, 0x80 | libID);
//DWIN_Byte(i, libID);
DWIN_Byte(i, picID);
DWIN_Send(i);
}
@ -421,7 +434,7 @@ void DWIN_ICON_Animation(uint8_t animID, bool animate, uint8_t libID, uint8_t pi
// state: 16 bits, each bit is the state of an animation id
void DWIN_ICON_AnimationControl(uint16_t state) {
size_t i = 0;
DWIN_Byte(i, 0x28);
DWIN_Byte(i, 0x29);
DWIN_Word(i, state);
DWIN_Send(i);
}

View File

@ -42,6 +42,163 @@
#define DWIN_WIDTH 272
#define DWIN_HEIGHT 480
// Character matrix width x height
//#define LCD_WIDTH ((DWIN_WIDTH) / 8)
//#define LCD_HEIGHT ((DWIN_HEIGHT) / 12)
// Picture ID
#define DWIN_Boot_Screen 0
#define Language_English 1
#define Language_Chinese 2
// ICON ID
#define ICON 0x09
#define ICON_LOGO 0
#define ICON_Print_0 1
#define ICON_Print_1 2
#define ICON_Prepare_0 3
#define ICON_Prepare_1 4
#define ICON_Control_0 5
#define ICON_Control_1 6
#define ICON_Leveling_0 7
#define ICON_Leveling_1 8
#define ICON_HotendTemp 9
#define ICON_BedTemp 10
#define ICON_Speed 11
#define ICON_Zoffset 12
#define ICON_Back 13
#define ICON_File 14
#define ICON_PrintTime 15
#define ICON_RemainTime 16
#define ICON_Setup_0 17
#define ICON_Setup_1 18
#define ICON_Pause_0 19
#define ICON_Pause_1 20
#define ICON_Continue_0 21
#define ICON_Continue_1 22
#define ICON_Stop_0 23
#define ICON_Stop_1 24
#define ICON_Bar 25
#define ICON_More 26
#define ICON_Axis 27
#define ICON_CloseMotor 28
#define ICON_Homing 29
#define ICON_SetHome 30
#define ICON_PLAPreheat 31
#define ICON_ABSPreheat 32
#define ICON_Cool 33
#define ICON_Language 34
#define ICON_MoveX 35
#define ICON_MoveY 36
#define ICON_MoveZ 37
#define ICON_Extruder 38
#define ICON_Temperature 40
#define ICON_Motion 41
#define ICON_WriteEEPROM 42
#define ICON_ReadEEPROM 43
#define ICON_ResumeEEPROM 44
#define ICON_Info 45
#define ICON_SetEndTemp 46
#define ICON_SetBedTemp 47
#define ICON_FanSpeed 48
#define ICON_SetPLAPreheat 49
#define ICON_SetABSPreheat 50
#define ICON_MaxSpeed 51
#define ICON_MaxAccelerated 52
#define ICON_MaxJerk 53
#define ICON_Step 54
#define ICON_PrintSize 55
#define ICON_Version 56
#define ICON_Contact 57
#define ICON_StockConfiguraton 58
#define ICON_MaxSpeedX 59
#define ICON_MaxSpeedY 60
#define ICON_MaxSpeedZ 61
#define ICON_MaxSpeedE 62
#define ICON_MaxAccX 63
#define ICON_MaxAccY 64
#define ICON_MaxAccZ 65
#define ICON_MaxAccE 66
#define ICON_MaxSpeedJerkX 67
#define ICON_MaxSpeedJerkY 68
#define ICON_MaxSpeedJerkZ 69
#define ICON_MaxSpeedJerkE 70
#define ICON_StepX 71
#define ICON_StepY 72
#define ICON_StepZ 73
#define ICON_StepE 74
#define ICON_Setspeed 75
#define ICON_SetZOffset 76
#define ICON_Rectangle 77
#define ICON_BLTouch 78
#define ICON_TempTooLow 79
#define ICON_AutoLeveling 80
#define ICON_TempTooHigh 81
#define ICON_NoTips_C 82
#define ICON_NoTips_E 83
#define ICON_Continue_C 84
#define ICON_Continue_E 85
#define ICON_Cancel_C 86
#define ICON_Cancel_E 87
#define ICON_Confirm_C 88
#define ICON_Confirm_E 89
#define ICON_Info_0 90
#define ICON_Info_1 91
#define ICON_AdvSet ICON_Language
#define ICON_HomeOff ICON_AdvSet
#define ICON_HomeOffX ICON_StepX
#define ICON_HomeOffY ICON_StepY
#define ICON_HomeOffZ ICON_StepZ
#define ICON_ProbeOff ICON_AdvSet
#define ICON_ProbeOffX ICON_StepX
#define ICON_ProbeOffY ICON_StepY
#define ICON_PIDNozzle ICON_SetEndTemp
#define ICON_PIDbed ICON_SetBedTemp
/**
* 3-.0The font size, 0x00-0x09, corresponds to the font size below:
* 0x00=6*12 0x01=8*16 0x02=10*20 0x03=12*24 0x04=14*28
* 0x05=16*32 0x06=20*40 0x07=24*48 0x08=28*56 0x09=32*64
*/
#define font6x12 0x00
#define font8x16 0x01
#define font10x20 0x02
#define font12x24 0x03
#define font14x28 0x04
#define font16x32 0x05
#define font20x40 0x06
#define font24x48 0x07
#define font28x56 0x08
#define font32x64 0x09
#define DWIN_FONT_MENU font10x20
#define DWIN_FONT_STAT font10x20
#define DWIN_FONT_HEAD font10x20
#define DWIN_FONT_ALERT font14x28
// Color
#define Color_White 0xFFFF
#define Color_Yellow 0xFF0F
#define Color_Error_Red 0xB000 // Error!
#define Color_Bg_Red 0xF00F // Red background color
#define Color_Bg_Window 0x31E8 // Popup background color
#define Color_Bg_Blue 0x1125 // Dark blue background color
#define Color_Bg_Black 0x0841 // Black background color
#define Color_IconBlue 0x45FA // Lighter blue that matches icons/accents
#define Popup_Text_Color 0xD6BA // Popup font background color
#define Line_Color 0x3A6A // Split line color
#define Rectangle_Color 0xEE2F // Blue square cursor color
#define Percent_Color 0xFE29 // Percentage color
#define BarFill_Color 0x10E4 // Fill color of progress bar
#define Select_Color 0x33BB // Selected color
/*-------------------------------------- System variable function --------------------------------------*/
// Handshake (1: Success, 0: Fail)
@ -68,10 +225,11 @@ void DWIN_UpdateLCD(void);
void DWIN_Frame_Clear(const uint16_t color);
// Draw a point
// color: point color
// width: point width 0x01-0x0F
// height: point height 0x01-0x0F
// x,y: upper left point
void DWIN_Draw_Point(uint8_t width, uint8_t height, uint16_t x, uint16_t y);
void DWIN_Draw_Point(uint16_t color, uint8_t width, uint8_t height, uint16_t x, uint16_t y);
// Draw a line
// color: Line segment color
@ -125,20 +283,18 @@ void DWIN_Frame_AreaMove(uint8_t mode, uint8_t dir, uint16_t dis,
/*---------------------------------------- Text related functions ----------------------------------------*/
// Draw a string
// widthAdjust: true=self-adjust character width; false=no adjustment
// bShow: true=display background color; false=don't display background color
// size: Font size
// color: Character color
// bColor: Background color
// x/y: Upper-left coordinate of the string
// *string: The string
void DWIN_Draw_String(bool widthAdjust, bool bShow, uint8_t size,
uint16_t color, uint16_t bColor, uint16_t x, uint16_t y, char *string);
void DWIN_Draw_String(bool bShow, uint8_t size, uint16_t color, uint16_t bColor, uint16_t x, uint16_t y, char *string);
class __FlashStringHelper;
inline void DWIN_Draw_String(bool widthAdjust, bool bShow, uint8_t size, uint16_t color, uint16_t bColor, uint16_t x, uint16_t y, const __FlashStringHelper *title) {
DWIN_Draw_String(widthAdjust, bShow, size, color, bColor, x, y, (char *)title);
inline void DWIN_Draw_String(bool bShow, uint8_t size, uint16_t color, uint16_t bColor, uint16_t x, uint16_t y, const __FlashStringHelper *title) {
DWIN_Draw_String(bShow, size, color, bColor, x, y, (char *)title);
}
// Draw a positive integer

View File

@ -21,7 +21,7 @@
*/
/*****************************************************************************
* @file rotary_encoder.cpp
* @file lcd/e3v2/creality/rotary_encoder.cpp
* @author LEO / Creality3D
* @date 2019/07/06
* @version 2.0.1

View File

@ -22,7 +22,7 @@
#pragma once
/*****************************************************************************
* @file rotary_encoder.h
* @file lcd/e3v2/creality/rotary_encoder.h
* @author LEO / Creality3D
* @date 2019/07/06
* @version 2.0.1

View File

@ -44,8 +44,8 @@ class LockScreen : public BaseScreen, public CachedScreen<LOCK_SCREEN_CACHE> {
static void enable();
static void disable();
static void set_hash(uint16_t pass) {passcode = pass;};
static uint16_t get_hash() {return passcode;};
static void set_hash(uint16_t pass) { passcode = pass; }
static uint16_t get_hash() { return passcode; }
static void onEntry();
static void onRedraw(draw_mode_t);

View File

@ -149,7 +149,7 @@ uint8_t* get_utf8_value_cb(uint8_t *pstart, read_byte_cb_t cb_read_byte, wchar_t
static inline uint8_t utf8_strlen_cb(const char *pstart, read_byte_cb_t cb_read_byte) {
uint8_t cnt = 0;
uint8_t *p = (uint8_t *)pstart;
for (;;) {
if (p) for (;;) {
const uint8_t b = cb_read_byte(p);
if (!b) break;
if (utf8_is_start_byte_of_char(b)) cnt++;

View File

@ -76,8 +76,10 @@
#define INFO_FONT_HEIGHT (INFO_FONT_ASCENT + INFO_FONT_DESCENT)
#define INFO_FONT_WIDTH 6
// Graphical LCD uses the menu font size for cursor positioning
#define LCD_COL_X(col) (( (col)) * (MENU_FONT_WIDTH))
#define LCD_ROW_Y(row) ((1 + (row)) * (MENU_FONT_HEIGHT))
#define LCD_ROW_Y(row) ((1 + (row)) * (MENU_LINE_HEIGHT))
#define LCD_COL_X_RJ(len) (LCD_WIDTH - LCD_COL_X(len))
#else
@ -94,13 +96,17 @@
#define LCD_PIXEL_WIDTH LCD_WIDTH
#define LCD_PIXEL_HEIGHT LCD_HEIGHT
// Character LCD uses direct cursor positioning
#define LCD_COL_X(col) (col)
#define LCD_ROW_Y(row) (row)
#define LCD_COL_X_RJ(len) (LCD_PIXEL_WIDTH - LCD_COL_X(len))
#endif
#define LCD_COL_X_RJ(len) (LCD_PIXEL_WIDTH - LCD_COL_X(len))
#define LCD_BOTTOM_ROW (LCD_PIXEL_HEIGHT - 1)
#ifndef MENU_LINE_HEIGHT
#define MENU_LINE_HEIGHT MENU_FONT_HEIGHT
#endif
#define SETCURSOR(col, row) lcd_moveto(LCD_COL_X(col), LCD_ROW_Y(row))
#define SETCURSOR_RJ(len, row) lcd_moveto(LCD_COL_X_RJ(len), LCD_ROW_Y(row))
#define SETCURSOR_X(col) SETCURSOR(col, _lcdLineNr)

View File

@ -47,7 +47,7 @@ MarlinUI ui;
#endif
#if ENABLED(DWIN_CREALITY_LCD)
#include "dwin/e3v2/dwin.h"
#include "e3v2/creality/dwin.h"
#endif
#if ENABLED(LCD_PROGRESS_BAR) && !IS_TFTGLCD_PANEL
@ -65,15 +65,8 @@ MarlinUI ui;
constexpr uint8_t epps = ENCODER_PULSES_PER_STEP;
#if HAS_STATUS_MESSAGE
#if HAS_WIRED_LCD
#if ENABLED(STATUS_MESSAGE_SCROLLING)
uint8_t MarlinUI::status_scroll_offset; // = 0
constexpr uint8_t MAX_MESSAGE_LENGTH = _MAX(LONG_FILENAME_LENGTH, MAX_LANG_CHARSIZE * 2 * (LCD_WIDTH));
#else
constexpr uint8_t MAX_MESSAGE_LENGTH = MAX_LANG_CHARSIZE * (LCD_WIDTH);
#endif
#else
constexpr uint8_t MAX_MESSAGE_LENGTH = 63;
#if BOTH(HAS_WIRED_LCD, STATUS_MESSAGE_SCROLLING)
uint8_t MarlinUI::status_scroll_offset; // = 0
#endif
char MarlinUI::status_message[MAX_MESSAGE_LENGTH + 1];
uint8_t MarlinUI::alert_level; // = 0

View File

@ -312,6 +312,17 @@ public:
#endif
#if HAS_STATUS_MESSAGE
#if HAS_WIRED_LCD
#if ENABLED(STATUS_MESSAGE_SCROLLING)
#define MAX_MESSAGE_LENGTH _MAX(LONG_FILENAME_LENGTH, MAX_LANG_CHARSIZE * 2 * (LCD_WIDTH))
#else
#define MAX_MESSAGE_LENGTH (MAX_LANG_CHARSIZE * (LCD_WIDTH))
#endif
#else
#define MAX_MESSAGE_LENGTH 63
#endif
static char status_message[];
static uint8_t alert_level; // Higher levels block lower levels

View File

@ -187,7 +187,7 @@ static void _lcd_level_bed_corners_get_next_position() {
}
--cy;
y -= MENU_FONT_HEIGHT;
y -= MENU_LINE_HEIGHT;
// Display the Last Z value
if (PAGE_CONTAINS(y - (MENU_FONT_HEIGHT), y)) {

View File

@ -46,7 +46,7 @@
#endif
#if ENABLED(DWIN_CREALITY_LCD)
#include "../lcd/dwin/e3v2/dwin.h"
#include "../lcd/e3v2/creality/dwin.h"
#endif
#if ENABLED(EXTENSIBLE_UI)

View File

@ -32,7 +32,7 @@
#include "../lcd/marlinui.h"
#if ENABLED(DWIN_CREALITY_LCD)
#include "../lcd/dwin/e3v2/dwin.h"
#include "../lcd/e3v2/creality/dwin.h"
#endif
#include "../module/planner.h" // for synchronize

View File

@ -44,8 +44,8 @@ HAS_SPI_TFT = src_filter=+<src/HAL/STM32/tft/tft_spi.
I2C_EEPROM = src_filter=+<src/HAL/shared/eeprom_if_i2c.cpp>
SOFT_I2C_EEPROM = SlowSoftI2CMaster, SlowSoftWire=https://github.com/felias-fogg/SlowSoftWire/archive/master.zip
SPI_EEPROM = src_filter=+<src/HAL/shared/eeprom_if_spi.cpp>
DWIN_CREALITY_LCD = src_filter=+<src/lcd/e3v2/creality>
HAS_GRAPHICAL_TFT = src_filter=+<src/lcd/tft>
DWIN_CREALITY_LCD = src_filter=+<src/lcd/dwin>
IS_TFTGLCD_PANEL = src_filter=+<src/lcd/TFTGLCD>
HAS_TOUCH_BUTTONS = src_filter=+<src/lcd/touch/touch_buttons.cpp>
HAS_LCD_MENU = src_filter=+<src/lcd/menu>

View File

@ -48,7 +48,7 @@ extra_scripts =
post:buildroot/share/PlatformIO/scripts/common-dependencies-post.py
lib_deps =
default_src_filter = +<src/*> -<src/config> -<src/HAL> +<src/HAL/shared>
-<src/lcd/HD44780> -<src/lcd/TFTGLCD> -<src/lcd/dwin> -<src/lcd/dogm> -<src/lcd/tft> -<src/lcd/tft_io>
-<src/lcd/HD44780> -<src/lcd/TFTGLCD> -<src/lcd/e3v2/creality> -<src/lcd/dogm> -<src/lcd/tft> -<src/lcd/tft_io>
-<src/HAL/STM32/tft> -<src/HAL/STM32F1/tft>
-<src/lcd/menu>
-<src/lcd/menu/game/game.cpp> -<src/lcd/menu/game/brickout.cpp> -<src/lcd/menu/game/invaders.cpp>