🎨 More more lowercase (partial ProUI)

Followup to #25939
This commit is contained in:
Scott Lahteine
2023-06-16 18:08:59 -05:00
parent 78b342661a
commit 238951a966
16 changed files with 224 additions and 224 deletions

View File

@@ -217,13 +217,13 @@ bool BedLevelToolsClass::meshvalidate() {
const float v_max = abs(get_max_value()), v_min = abs(get_min_value()), range = _MAX(v_min, v_max); const float v_max = abs(get_max_value()), v_min = abs(get_min_value()), range = _MAX(v_min, v_max);
// Clear background from previous selection and select new square // Clear background from previous selection and select new square
DWIN_Draw_Rectangle(1, Color_Bg_Black, _MAX(0, padding_x - gridline_width), _MAX(0, padding_y_top - gridline_width), padding_x + total_width_px, padding_y_top + total_width_px); dwinDrawRectangle(1, Color_Bg_Black, _MAX(0, padding_x - gridline_width), _MAX(0, padding_y_top - gridline_width), padding_x + total_width_px, padding_y_top + total_width_px);
if (selected >= 0) { if (selected >= 0) {
const auto selected_y = selected / (GRID_MAX_POINTS_X); const auto selected_y = selected / (GRID_MAX_POINTS_X);
const auto selected_x = selected - (GRID_MAX_POINTS_X) * selected_y; const auto selected_x = selected - (GRID_MAX_POINTS_X) * selected_y;
const auto start_y_px = padding_y_top + selected_y * cell_height_px; const auto start_y_px = padding_y_top + selected_y * cell_height_px;
const auto start_x_px = padding_x + selected_x * cell_width_px; const auto start_x_px = padding_x + selected_x * cell_width_px;
DWIN_Draw_Rectangle(1, Color_White, _MAX(0, start_x_px - gridline_width), _MAX(0, start_y_px - gridline_width), start_x_px + cell_width_px, start_y_px + cell_height_px); dwinDrawRectangle(1, Color_White, _MAX(0, start_x_px - gridline_width), _MAX(0, start_y_px - gridline_width), start_x_px + cell_width_px, start_y_px + cell_height_px);
} }
// Draw value square grid // Draw value square grid
@@ -233,7 +233,7 @@ bool BedLevelToolsClass::meshvalidate() {
const auto end_x_px = start_x_px + cell_width_px - 1 - gridline_width; const auto end_x_px = start_x_px + cell_width_px - 1 - gridline_width;
const auto start_y_px = padding_y_top + ((GRID_MAX_POINTS_Y) - y - 1) * cell_height_px; const auto start_y_px = padding_y_top + ((GRID_MAX_POINTS_Y) - y - 1) * cell_height_px;
const auto end_y_px = start_y_px + cell_height_px - 1 - gridline_width; const auto end_y_px = start_y_px + cell_height_px - 1 - gridline_width;
DWIN_Draw_Rectangle(1, // RGB565 colors: http://www.barth-dev.de/online/rgb565-color-picker/ dwinDrawRectangle(1, // RGB565 colors: http://www.barth-dev.de/online/rgb565-color-picker/
isnan(bedlevel.z_values[x][y]) ? Color_Grey : ( // gray if undefined isnan(bedlevel.z_values[x][y]) ? Color_Grey : ( // gray if undefined
(bedlevel.z_values[x][y] < 0 ? (bedlevel.z_values[x][y] < 0 ?
(uint16_t)round(0x1F * -bedlevel.z_values[x][y] / (!viewer_asymmetric_range ? range : v_min)) << 11 : // red if mesh point value is negative (uint16_t)round(0x1F * -bedlevel.z_values[x][y] / (!viewer_asymmetric_range ? range : v_min)) << 11 : // red if mesh point value is negative
@@ -249,7 +249,7 @@ bool BedLevelToolsClass::meshvalidate() {
if (viewer_print_value) { if (viewer_print_value) {
int8_t offset_x, offset_y = cell_height_px / 2 - 6; int8_t offset_x, offset_y = cell_height_px / 2 - 6;
if (isnan(bedlevel.z_values[x][y])) { // undefined if (isnan(bedlevel.z_values[x][y])) { // undefined
DWIN_Draw_String(false, font6x12, Color_White, Color_Bg_Blue, start_x_px + cell_width_px / 2 - 5, start_y_px + offset_y, F("X")); dwinDrawString(false, font6x12, Color_White, Color_Bg_Blue, start_x_px + cell_width_px / 2 - 5, start_y_px + offset_y, F("X"));
} }
else { // has value else { // has value
if (GRID_MAX_POINTS_X < 10) if (GRID_MAX_POINTS_X < 10)
@@ -258,8 +258,8 @@ bool BedLevelToolsClass::meshvalidate() {
sprintf_P(buf, PSTR("%02i"), (uint16_t)(abs(bedlevel.z_values[x][y] - (int16_t)bedlevel.z_values[x][y]) * 100)); sprintf_P(buf, PSTR("%02i"), (uint16_t)(abs(bedlevel.z_values[x][y] - (int16_t)bedlevel.z_values[x][y]) * 100));
offset_x = cell_width_px / 2 - 3 * (strlen(buf)) - 2; offset_x = cell_width_px / 2 - 3 * (strlen(buf)) - 2;
if (!(GRID_MAX_POINTS_X < 10)) if (!(GRID_MAX_POINTS_X < 10))
DWIN_Draw_String(false, font6x12, Color_White, Color_Bg_Blue, start_x_px - 2 + offset_x, start_y_px + offset_y /*+ square / 2 - 6*/, F(".")); dwinDrawString(false, font6x12, Color_White, Color_Bg_Blue, start_x_px - 2 + offset_x, start_y_px + offset_y /*+ square / 2 - 6*/, F("."));
DWIN_Draw_String(false, font6x12, Color_White, Color_Bg_Blue, start_x_px + 1 + offset_x, start_y_px + offset_y /*+ square / 2 - 6*/, buf); dwinDrawString(false, font6x12, Color_White, Color_Bg_Blue, start_x_px + 1 + offset_x, start_y_px + offset_y /*+ square / 2 - 6*/, buf);
} }
safe_delay(10); safe_delay(10);
LCD_SERIAL.flushTX(); LCD_SERIAL.flushTX();

View File

@@ -162,7 +162,7 @@
// Structs // Structs
HMI_value_t HMI_value; HMI_value_t HMI_value;
HMI_flag_t HMI_flag{0}; HMI_flag_t hmiFlag{0};
HMI_data_t HMI_data; HMI_data_t HMI_data;
enum SelectItem : uint8_t { enum SelectItem : uint8_t {
@@ -278,24 +278,24 @@ bool Host_Printing() { return Printing() && !IS_SD_FILE_OPEN(); }
#define DWIN_LANGUAGE_EEPROM_ADDRESS 0x01 // Between 0x01 and 0x63 (EEPROM_OFFSET-1) #define DWIN_LANGUAGE_EEPROM_ADDRESS 0x01 // Between 0x01 and 0x63 (EEPROM_OFFSET-1)
// BL24CXX::check() uses 0x00 // BL24CXX::check() uses 0x00
inline bool HMI_IsChinese() { return HMI_flag.language == DWIN_CHINESE; } inline bool HMI_IsChinese() { return hmiFlag.language == DWIN_CHINESE; }
void HMI_SetLanguageCache() { void HMI_SetLanguageCache() {
DWIN_JPG_CacheTo1(HMI_IsChinese() ? Language_Chinese : Language_English); dwinJPGCacheTo1(HMI_IsChinese() ? Language_Chinese : Language_English);
} }
void HMI_SetLanguage() { void HMI_SetLanguage() {
#if ALL(EEPROM_SETTINGS, IIC_BL24CXX_EEPROM) #if ALL(EEPROM_SETTINGS, IIC_BL24CXX_EEPROM)
BL24CXX::read(DWIN_LANGUAGE_EEPROM_ADDRESS, (uint8_t*)&HMI_flag.language, sizeof(HMI_flag.language)); BL24CXX::read(DWIN_LANGUAGE_EEPROM_ADDRESS, (uint8_t*)&hmiFlag.language, sizeof(hmiFlag.language));
#endif #endif
HMI_SetLanguageCache(); HMI_SetLanguageCache();
} }
void HMI_ToggleLanguage() { void HMI_ToggleLanguage() {
HMI_flag.language = HMI_IsChinese() ? DWIN_ENGLISH : DWIN_CHINESE; hmiFlag.language = HMI_IsChinese() ? DWIN_ENGLISH : DWIN_CHINESE;
HMI_SetLanguageCache(); HMI_SetLanguageCache();
#if ALL(EEPROM_SETTINGS, IIC_BL24CXX_EEPROM) #if ALL(EEPROM_SETTINGS, IIC_BL24CXX_EEPROM)
BL24CXX::write(DWIN_LANGUAGE_EEPROM_ADDRESS, (uint8_t*)&HMI_flag.language, sizeof(HMI_flag.language)); BL24CXX::write(DWIN_LANGUAGE_EEPROM_ADDRESS, (uint8_t*)&hmiFlag.language, sizeof(hmiFlag.language));
#endif #endif
} }
@@ -403,7 +403,7 @@ void Popup_window_PauseOrStop() {
DWINUI::Draw_IconWB(ICON_Confirm_C, 26, 280); DWINUI::Draw_IconWB(ICON_Confirm_C, 26, 280);
DWINUI::Draw_IconWB(ICON_Cancel_C, 146, 280); DWINUI::Draw_IconWB(ICON_Cancel_C, 146, 280);
Draw_Select_Highlight(true); Draw_Select_Highlight(true);
DWIN_UpdateLCD(); dwinUpdateLCD();
} }
else else
DWIN_Popup_ConfirmCancel(ICON_BLTouch, select_print.now == PRINT_PAUSE_RESUME ? GET_TEXT_F(MSG_PAUSE_PRINT) : GET_TEXT_F(MSG_STOP_PRINT)); DWIN_Popup_ConfirmCancel(ICON_BLTouch, select_print.now == PRINT_PAUSE_RESUME ? GET_TEXT_F(MSG_PAUSE_PRINT) : GET_TEXT_F(MSG_STOP_PRINT));
@@ -420,7 +420,7 @@ void Popup_window_PauseOrStop() {
DWIN_Frame_AreaCopy(1, 103, 371, 136, 386, 69, 240); 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, 102, 240);
DWINUI::Draw_IconWB(ICON_Confirm_C, 86, 280); DWINUI::Draw_IconWB(ICON_Confirm_C, 86, 280);
DWIN_UpdateLCD(); dwinUpdateLCD();
} }
else else
DWIN_Popup_Confirm(ICON_TempTooLow, GET_TEXT_F(MSG_HOTEND_TOO_COLD), GET_TEXT_F(MSG_PLEASE_PREHEAT)); DWIN_Popup_Confirm(ICON_TempTooLow, GET_TEXT_F(MSG_HOTEND_TOO_COLD), GET_TEXT_F(MSG_PLEASE_PREHEAT));
@@ -429,7 +429,7 @@ void Popup_window_PauseOrStop() {
#endif #endif
#if HAS_HOTEND || HAS_HEATED_BED #if HAS_HOTEND || HAS_HEATED_BED
void DWIN_Popup_Temperature(const bool toohigh) { void dwinPopupTemperature(const bool toohigh) {
HMI_SaveProcessID(WaitResponse); HMI_SaveProcessID(WaitResponse);
if (HMI_IsChinese()) { if (HMI_IsChinese()) {
DWINUI::ClearMainArea(); DWINUI::ClearMainArea();
@@ -455,7 +455,7 @@ void Popup_window_PauseOrStop() {
// Draw status line // Draw status line
// //
void DWIN_DrawStatusLine(const char *text) { void DWIN_DrawStatusLine(const char *text) {
DWIN_Draw_Rectangle(1, HMI_data.StatusBg_Color, 0, STATUS_Y, DWIN_WIDTH, STATUS_Y + 20); dwinDrawRectangle(1, HMI_data.StatusBg_Color, 0, STATUS_Y, DWIN_WIDTH, STATUS_Y + 20);
if (text) DWINUI::Draw_CenteredString(HMI_data.StatusTxt_Color, STATUS_Y + 2, text); if (text) DWINUI::Draw_CenteredString(HMI_data.StatusTxt_Color, STATUS_Y + 2, text);
} }
void DWIN_DrawStatusLine(FSTR_P fstr) { DWIN_DrawStatusLine(FTOP(fstr)); } void DWIN_DrawStatusLine(FSTR_P fstr) { DWIN_DrawStatusLine(FTOP(fstr)); }
@@ -501,7 +501,7 @@ void DWIN_DrawStatusMessage() {
// and the string remaining length // and the string remaining length
uint8_t rlen; uint8_t rlen;
const char *stat = MarlinUI::status_and_len(rlen); const char *stat = MarlinUI::status_and_len(rlen);
DWIN_Draw_Rectangle(1, HMI_data.StatusBg_Color, 0, STATUS_Y, DWIN_WIDTH, STATUS_Y + 20); dwinDrawRectangle(1, HMI_data.StatusBg_Color, 0, STATUS_Y, DWIN_WIDTH, STATUS_Y + 20);
DWINUI::MoveTo(0, STATUS_Y + 2); DWINUI::MoveTo(0, STATUS_Y + 2);
DWINUI::Draw_String(HMI_data.StatusTxt_Color, stat, LCD_WIDTH); DWINUI::Draw_String(HMI_data.StatusTxt_Color, stat, LCD_WIDTH);
@@ -542,7 +542,7 @@ void Draw_Print_Labels() {
void Draw_Print_ProgressBar() { void Draw_Print_ProgressBar() {
DWINUI::Draw_IconWB(ICON_Bar, 15, 93); DWINUI::Draw_IconWB(ICON_Bar, 15, 93);
DWIN_Draw_Rectangle(1, HMI_data.Barfill_Color, 16 + _percent_done * 240 / 100, 93, 256, 113); dwinDrawRectangle(1, HMI_data.Barfill_Color, 16 + _percent_done * 240 / 100, 93, 256, 113);
DWINUI::Draw_Int(HMI_data.PercentTxt_Color, HMI_data.Background_Color, 3, 117, 133, _percent_done); DWINUI::Draw_Int(HMI_data.PercentTxt_Color, HMI_data.Background_Color, 3, 117, 133, _percent_done);
DWINUI::Draw_String(HMI_data.PercentTxt_Color, 142, 133, F("%")); DWINUI::Draw_String(HMI_data.PercentTxt_Color, 142, 133, F("%"));
} }
@@ -573,7 +573,7 @@ void DWIN_Print_Header(const char *text = nullptr) {
headertxt[size] = '\0'; headertxt[size] = '\0';
} }
if (checkkey == PrintProcess || checkkey == PrintDone) { if (checkkey == PrintProcess || checkkey == PrintDone) {
DWIN_Draw_Rectangle(1, HMI_data.Background_Color, 0, 60, DWIN_WIDTH, 60+16); dwinDrawRectangle(1, HMI_data.Background_Color, 0, 60, DWIN_WIDTH, 60+16);
DWINUI::Draw_CenteredString(60, headertxt); DWINUI::Draw_CenteredString(60, headertxt);
} }
} }
@@ -604,7 +604,7 @@ void Goto_PrintProcess() {
Draw_PrintProcess(); Draw_PrintProcess();
TERN_(DASH_REDRAW, DWIN_RedrawDash()); TERN_(DASH_REDRAW, DWIN_RedrawDash());
} }
DWIN_UpdateLCD(); dwinUpdateLCD();
} }
void Draw_PrintDone() { void Draw_PrintDone() {
@@ -619,7 +619,7 @@ void Draw_PrintDone() {
#if HAS_GCODE_PREVIEW #if HAS_GCODE_PREVIEW
const bool isvalid = Preview_Valid(); const bool isvalid = Preview_Valid();
if (isvalid) { if (isvalid) {
DWIN_ICON_Show(0, 0, 1, 21, 100, 0x00); dwinIconShow(0, 0, 1, 21, 100, 0x00);
DWINUI::Draw_Button(BTN_Continue, 86, 300); DWINUI::Draw_Button(BTN_Continue, 86, 300);
} }
#else #else
@@ -642,7 +642,7 @@ void Goto_PrintDone() {
if (checkkey != PrintDone) { if (checkkey != PrintDone) {
checkkey = PrintDone; checkkey = PrintDone;
Draw_PrintDone(); Draw_PrintDone();
DWIN_UpdateLCD(); dwinUpdateLCD();
} }
} }
@@ -663,7 +663,7 @@ void Goto_Main_Menu() {
if (checkkey == MainMenu) return; if (checkkey == MainMenu) return;
checkkey = MainMenu; checkkey = MainMenu;
Draw_Main_Menu(); Draw_Main_Menu();
DWIN_UpdateLCD(); dwinUpdateLCD();
} }
// Draw X, Y, Z and blink if in an un-homed or un-trusted state // Draw X, Y, Z and blink if in an un-homed or un-trusted state
@@ -695,19 +695,19 @@ void _draw_ZOffsetIcon() {
static bool _leveling_active = false; static bool _leveling_active = false;
if (_leveling_active != planner.leveling_active) { if (_leveling_active != planner.leveling_active) {
_leveling_active = planner.leveling_active; _leveling_active = planner.leveling_active;
DWIN_Draw_Rectangle(1, HMI_data.Background_Color, 186, 415, 205, 436); dwinDrawRectangle(1, HMI_data.Background_Color, 186, 415, 205, 436);
DWINUI::Draw_Icon(_leveling_active ? ICON_SetZOffset : ICON_Zoffset, 187, 416); DWINUI::Draw_Icon(_leveling_active ? ICON_SetZOffset : ICON_Zoffset, 187, 416);
} }
#else #else
if (planner.leveling_active) { if (planner.leveling_active) {
DWIN_Draw_Rectangle(1, blink ? HMI_data.SplitLine_Color : HMI_data.Background_Color, 186, 415, 205, 436); dwinDrawRectangle(1, blink ? HMI_data.SplitLine_Color : HMI_data.Background_Color, 186, 415, 205, 436);
DWINUI::Draw_Icon(ICON_SetZOffset, 186, 416); DWINUI::Draw_Icon(ICON_SetZOffset, 186, 416);
} }
static bool _leveling_active = false; static bool _leveling_active = false;
if (_leveling_active != planner.leveling_active) { if (_leveling_active != planner.leveling_active) {
_leveling_active = planner.leveling_active; _leveling_active = planner.leveling_active;
if (!_leveling_active) { if (!_leveling_active) {
DWIN_Draw_Rectangle(1, HMI_data.Background_Color, 186, 415, 205, 436); dwinDrawRectangle(1, HMI_data.Background_Color, 186, 415, 205, 436);
DWINUI::Draw_Icon(ICON_Zoffset, 187, 416); DWINUI::Draw_Icon(ICON_Zoffset, 187, 416);
} }
} }
@@ -948,7 +948,7 @@ void Draw_Print_File_Menu() {
else { else {
if (SET_MENU(FileMenu, MSG_MEDIA_MENU, 1)) BACK_ITEM(Goto_Main_Menu); if (SET_MENU(FileMenu, MSG_MEDIA_MENU, 1)) BACK_ITEM(Goto_Main_Menu);
UpdateMenu(FileMenu); UpdateMenu(FileMenu);
DWIN_Draw_Rectangle(1, HMI_data.AlertBg_Color, 10, MBASE(3) - 10, DWIN_WIDTH - 10, MBASE(4)); dwinDrawRectangle(1, HMI_data.AlertBg_Color, 10, MBASE(3) - 10, DWIN_WIDTH - 10, MBASE(4));
DWINUI::Draw_CenteredString(font12x24, HMI_data.AlertTxt_Color, MBASE(3), GET_TEXT_F(MSG_MEDIA_NOT_INSERTED)); DWINUI::Draw_CenteredString(font12x24, HMI_data.AlertTxt_Color, MBASE(3), GET_TEXT_F(MSG_MEDIA_NOT_INSERTED));
} }
TERN_(SCROLL_LONG_FILENAMES, FileMenuIdle(true)); TERN_(SCROLL_LONG_FILENAMES, FileMenuIdle(true));
@@ -958,12 +958,12 @@ void Draw_Print_File_Menu() {
// Watch for media mount / unmount // Watch for media mount / unmount
// //
void HMI_SDCardUpdate() { void HMI_SDCardUpdate() {
if (HMI_flag.home_flag) return; if (hmiFlag.home_flag) return;
if (DWIN_lcd_sd_status != card.isMounted()) { if (DWIN_lcd_sd_status != card.isMounted()) {
DWIN_lcd_sd_status = card.isMounted(); DWIN_lcd_sd_status = card.isMounted();
if (IsMenu(FileMenu)) Redraw_SD_List(); if (IsMenu(FileMenu)) Redraw_SD_List();
if (!DWIN_lcd_sd_status && SD_Printing()) ui.abort_print(); // Media removed while printing if (!DWIN_lcd_sd_status && SD_Printing()) ui.abort_print(); // Media removed while printing
DWIN_UpdateLCD(); dwinUpdateLCD();
} }
} }
@@ -973,7 +973,7 @@ void HMI_SDCardUpdate() {
void DWIN_Draw_Dashboard() { void DWIN_Draw_Dashboard() {
DWIN_Draw_Rectangle(1, HMI_data.Background_Color, 0, STATUS_Y + 21, DWIN_WIDTH, DWIN_HEIGHT - 1); dwinDrawRectangle(1, HMI_data.Background_Color, 0, STATUS_Y + 21, DWIN_WIDTH, DWIN_HEIGHT - 1);
#if HAS_HOTEND #if HAS_HOTEND
DWINUI::Draw_Icon(ICON_HotendTemp, 10, 383); DWINUI::Draw_Icon(ICON_HotendTemp, 10, 383);
@@ -1008,7 +1008,7 @@ void DWIN_Draw_Dashboard() {
DWINUI::Draw_Signed_Float(DWIN_FONT_STAT, HMI_data.Indicator_Color, HMI_data.Background_Color, 2, 2, 204, 417, BABY_Z_VAR); DWINUI::Draw_Signed_Float(DWIN_FONT_STAT, HMI_data.Indicator_Color, HMI_data.Background_Color, 2, 2, 204, 417, BABY_Z_VAR);
DWIN_Draw_Rectangle(1, HMI_data.SplitLine_Color, 0, 449, DWIN_WIDTH, 451); dwinDrawRectangle(1, HMI_data.SplitLine_Color, 0, 449, DWIN_WIDTH, 451);
DWINUI::Draw_Icon(ICON_MaxSpeedX, 10, 456); DWINUI::Draw_Icon(ICON_MaxSpeedX, 10, 456);
DWINUI::Draw_Icon(ICON_MaxSpeedY, 95, 456); DWINUI::Draw_Icon(ICON_MaxSpeedY, 95, 456);
@@ -1042,7 +1042,7 @@ void Draw_Info_Menu() {
for (uint8_t i = 0; i < 3; ++i) { for (uint8_t i = 0; i < 3; ++i) {
DWINUI::Draw_Icon(ICON_PrintSize + i, ICOX, 99 + i * 73); DWINUI::Draw_Icon(ICON_PrintSize + i, ICOX, 99 + i * 73);
DWIN_Draw_HLine(HMI_data.SplitLine_Color, 16, MBASE(2) + i * 73, 240); dwinDrawHLine(HMI_data.SplitLine_Color, 16, MBASE(2) + i * 73, 240);
} }
} }
@@ -1085,14 +1085,14 @@ void HMI_MainMenu() {
case PAGE_ADVANCE: Draw_AdvancedSettings_Menu(); break; case PAGE_ADVANCE: Draw_AdvancedSettings_Menu(); break;
} }
} }
DWIN_UpdateLCD(); dwinUpdateLCD();
} }
// Pause or Stop popup // Pause or Stop popup
void onClick_PauseOrStop() { void onClick_PauseOrStop() {
switch (select_print.now) { switch (select_print.now) {
case PRINT_PAUSE_RESUME: if (HMI_flag.select_flag) ui.pause_print(); break; // confirm pause case PRINT_PAUSE_RESUME: if (hmiFlag.select_flag) ui.pause_print(); break; // confirm pause
case PRINT_STOP: if (HMI_flag.select_flag) ui.abort_print(); break; // stop confirmed then abort print case PRINT_STOP: if (hmiFlag.select_flag) ui.abort_print(); break; // stop confirmed then abort print
default: break; default: break;
} }
return Goto_PrintProcess(); return Goto_PrintProcess();
@@ -1136,7 +1136,7 @@ void HMI_Printing() {
default: break; default: break;
} }
} }
DWIN_UpdateLCD(); dwinUpdateLCD();
} }
#include "../../../libs/buzzer.h" #include "../../../libs/buzzer.h"
@@ -1200,8 +1200,8 @@ void HMI_Init() {
DWINUI::Draw_CenteredString(Color_White, 220, F("Professional Firmware ")); DWINUI::Draw_CenteredString(Color_White, 220, F("Professional Firmware "));
for (uint16_t t = 15; t < 257; t += 11) { for (uint16_t t = 15; t < 257; t += 11) {
DWINUI::Draw_Icon(ICON_Bar, 15, 260); DWINUI::Draw_Icon(ICON_Bar, 15, 260);
DWIN_Draw_Rectangle(1, HMI_data.Background_Color, t, 260, 257, 280); dwinDrawRectangle(1, HMI_data.Background_Color, t, 260, 257, 280);
DWIN_UpdateLCD(); dwinUpdateLCD();
safe_delay((BOOTSCREEN_TIMEOUT) / 22); safe_delay((BOOTSCREEN_TIMEOUT) / 22);
} }
#endif #endif
@@ -1241,21 +1241,21 @@ void EachMomentUpdate() {
if (!PENDING(ms, next_rts_update_ms)) { if (!PENDING(ms, next_rts_update_ms)) {
next_rts_update_ms = ms + DWIN_UPDATE_INTERVAL; next_rts_update_ms = ms + DWIN_UPDATE_INTERVAL;
if ((Printing() != HMI_flag.printing_flag) && !HMI_flag.home_flag) { if ((Printing() != hmiFlag.printing_flag) && !hmiFlag.home_flag) {
HMI_flag.printing_flag = Printing(); hmiFlag.printing_flag = Printing();
if (HMI_flag.printing_flag) if (hmiFlag.printing_flag)
DWIN_Print_Started(); DWIN_Print_Started();
else if (HMI_flag.abort_flag) else if (hmiFlag.abort_flag)
DWIN_Print_Aborted(); DWIN_Print_Aborted();
else else
DWIN_Print_Finished(); DWIN_Print_Finished();
} }
if ((printingIsPaused() != HMI_flag.pause_flag) && !HMI_flag.home_flag) { if ((printingIsPaused() != hmiFlag.pause_flag) && !hmiFlag.home_flag) {
HMI_flag.pause_flag = printingIsPaused(); hmiFlag.pause_flag = printingIsPaused();
if (HMI_flag.pause_flag) if (hmiFlag.pause_flag)
DWIN_Print_Pause(); DWIN_Print_Pause();
else if (HMI_flag.abort_flag) else if (hmiFlag.abort_flag)
DWIN_Print_Aborted(); DWIN_Print_Aborted();
else else
DWIN_Print_Resume(); DWIN_Print_Resume();
@@ -1265,7 +1265,7 @@ void EachMomentUpdate() {
duration_t elapsed = print_job_timer.duration(); // print timer duration_t elapsed = print_job_timer.duration(); // print timer
if (card.isPrinting() && !HMI_flag.percent_flag) { if (card.isPrinting() && !hmiFlag.percent_flag) {
uint8_t percentDone = card.percentDone(); uint8_t percentDone = card.percentDone();
if (_percent_done != percentDone) { // print percent if (_percent_done != percentDone) { // print percent
_percent_done = percentDone; _percent_done = percentDone;
@@ -1274,7 +1274,7 @@ void EachMomentUpdate() {
// Estimate remaining time every 20 seconds // Estimate remaining time every 20 seconds
static millis_t next_remain_time_update = 0; static millis_t next_remain_time_update = 0;
if (_percent_done > 1 && ELAPSED(ms, next_remain_time_update) && !HMI_flag.heat_flag && !HMI_flag.remain_flag) { if (_percent_done > 1 && ELAPSED(ms, next_remain_time_update) && !hmiFlag.heat_flag && !hmiFlag.remain_flag) {
_remain_time = (elapsed.value - dwin_heat_time) / (_percent_done * 0.01f) - (elapsed.value - dwin_heat_time); _remain_time = (elapsed.value - dwin_heat_time) / (_percent_done * 0.01f) - (elapsed.value - dwin_heat_time);
next_remain_time_update += DWIN_REMAIN_TIME_UPDATE_INTERVAL; next_remain_time_update += DWIN_REMAIN_TIME_UPDATE_INTERVAL;
Draw_Print_ProgressRemain(); Draw_Print_ProgressRemain();
@@ -1296,7 +1296,7 @@ void EachMomentUpdate() {
} }
#endif // POWER_LOSS_RECOVERY #endif // POWER_LOSS_RECOVERY
DWIN_UpdateLCD(); dwinUpdateLCD();
} }
} }
@@ -1321,12 +1321,12 @@ void EachMomentUpdate() {
const char * const filename = card.diveToFile(true, dir, recovery.info.sd_filename); const char * const filename = card.diveToFile(true, dir, recovery.info.sd_filename);
card.selectFileByName(filename); card.selectFileByName(filename);
DWINUI::Draw_CenteredString(HMI_data.PopupTxt_Color, 207, card.longest_filename()); DWINUI::Draw_CenteredString(HMI_data.PopupTxt_Color, 207, card.longest_filename());
Draw_Select_Highlight(HMI_flag.select_flag); Draw_Select_Highlight(hmiFlag.select_flag);
DWIN_UpdateLCD(); dwinUpdateLCD();
} }
void onClick_PowerLossRecovery() { void onClick_PowerLossRecovery() {
if (HMI_flag.select_flag) { if (hmiFlag.select_flag) {
queue.inject(F("M1000C")); queue.inject(F("M1000C"));
select_page.reset(); select_page.reset();
return Goto_Main_Menu(); return Goto_Main_Menu();
@@ -1393,15 +1393,15 @@ void HMI_SaveProcessID(const uint8_t id) {
} }
} }
void DWIN_HomingStart() { void dwinHomingStart() {
HMI_flag.home_flag = true; hmiFlag.home_flag = true;
HMI_SaveProcessID(Homing); HMI_SaveProcessID(Homing);
Title.ShowCaption(GET_TEXT_F(MSG_HOMING)); Title.ShowCaption(GET_TEXT_F(MSG_HOMING));
DWIN_Show_Popup(ICON_BLTouch, GET_TEXT_F(MSG_HOMING), GET_TEXT_F(MSG_PLEASE_WAIT)); DWIN_Show_Popup(ICON_BLTouch, GET_TEXT_F(MSG_HOMING), GET_TEXT_F(MSG_PLEASE_WAIT));
} }
void DWIN_HomingDone() { void dwinHomingDone() {
HMI_flag.home_flag = false; hmiFlag.home_flag = false;
HMI_ReturnScreen(); HMI_ReturnScreen();
} }
@@ -1614,10 +1614,10 @@ void DWIN_Print_Started() {
TERN_(HAS_GCODE_PREVIEW, if (Host_Printing()) Preview_Invalidate()); TERN_(HAS_GCODE_PREVIEW, if (Host_Printing()) Preview_Invalidate());
_percent_done = 0; _percent_done = 0;
_remain_time = 0; _remain_time = 0;
HMI_flag.percent_flag = false; hmiFlag.percent_flag = false;
HMI_flag.remain_flag = false; hmiFlag.remain_flag = false;
HMI_flag.pause_flag = false; hmiFlag.pause_flag = false;
HMI_flag.abort_flag = false; hmiFlag.abort_flag = false;
select_print.reset(); select_print.reset();
Goto_PrintProcess(); Goto_PrintProcess();
} }
@@ -1636,7 +1636,7 @@ void DWIN_Print_Resume() {
// Ended print job // Ended print job
void DWIN_Print_Finished() { void DWIN_Print_Finished() {
TERN_(POWER_LOSS_RECOVERY, if (card.isPrinting()) recovery.cancel()); TERN_(POWER_LOSS_RECOVERY, if (card.isPrinting()) recovery.cancel());
HMI_flag.pause_flag = false; hmiFlag.pause_flag = false;
wait_for_heatup = false; wait_for_heatup = false;
planner.finish_and_disable(); planner.finish_and_disable();
thermalManager.cooldown(); thermalManager.cooldown();
@@ -1652,11 +1652,11 @@ void DWIN_Print_Aborted() {
void DWIN_M73() { void DWIN_M73() {
if (parser.seenval('P')) { if (parser.seenval('P')) {
_percent_done = parser.value_byte(); _percent_done = parser.value_byte();
HMI_flag.percent_flag = true; hmiFlag.percent_flag = true;
} }
if (parser.seenval('R')) { if (parser.seenval('R')) {
_remain_time = parser.value_ulong() * 60; _remain_time = parser.value_ulong() * 60;
HMI_flag.remain_flag = true; hmiFlag.remain_flag = true;
} }
if (checkkey == PrintProcess) { if (checkkey == PrintProcess) {
Draw_Print_ProgressBar(); Draw_Print_ProgressBar();
@@ -1739,13 +1739,13 @@ void DWIN_CopySettingsFrom(const char * const buff) {
// Initialize or re-initialize the LCD // Initialize or re-initialize the LCD
void MarlinUI::init_lcd() { void MarlinUI::init_lcd() {
delay(750); // wait to wakeup screen delay(750); // wait to wakeup screen
const bool hs = DWIN_Handshake(); UNUSED(hs); const bool hs = dwinHandshake(); UNUSED(hs);
DWIN_Frame_SetDir(1); dwinFrameSetDir(1);
DWIN_JPG_CacheTo1(Language_English); dwinJPGCacheTo1(Language_English);
Encoder_Configuration(); encoderConfiguration();
} }
void DWIN_InitScreen() { void dwinInitScreen() {
DWIN_SetColorDefaults(); DWIN_SetColorDefaults();
HMI_Init(); // draws boot screen HMI_Init(); // draws boot screen
DWINUI::init(); DWINUI::init();
@@ -1769,20 +1769,20 @@ void MarlinUI::update() {
void MarlinUI::refresh() { /* Nothing to see here */ } void MarlinUI::refresh() { /* Nothing to see here */ }
#if HAS_LCD_BRIGHTNESS #if HAS_LCD_BRIGHTNESS
void MarlinUI::_set_brightness() { DWIN_LCD_Brightness(backlight ? brightness : 0); } void MarlinUI::_set_brightness() { dwinLCDBrightness(backlight ? brightness : 0); }
#endif #endif
void MarlinUI::kill_screen(FSTR_P const lcd_error, FSTR_P const lcd_component) { void MarlinUI::kill_screen(FSTR_P const lcd_error, FSTR_P const lcd_component) {
DWIN_Draw_Popup(ICON_BLTouch, GET_TEXT_F(MSG_PRINTER_KILLED), lcd_error); DWIN_Draw_Popup(ICON_BLTouch, GET_TEXT_F(MSG_PRINTER_KILLED), lcd_error);
DWINUI::Draw_CenteredString(HMI_data.PopupTxt_Color, 270, GET_TEXT_F(MSG_TURN_OFF)); DWINUI::Draw_CenteredString(HMI_data.PopupTxt_Color, 270, GET_TEXT_F(MSG_TURN_OFF));
DWIN_UpdateLCD(); dwinUpdateLCD();
} }
void DWIN_RebootScreen() { void DWIN_RebootScreen() {
DWIN_Frame_Clear(Color_Bg_Black); dwinFrameClear(Color_Bg_Black);
DWIN_JPG_ShowAndCache(0); dwinJPGShowAndCache(0);
DWINUI::Draw_CenteredString(Color_White, 220, GET_TEXT_F(MSG_PLEASE_WAIT_REBOOT)); DWINUI::Draw_CenteredString(Color_White, 220, GET_TEXT_F(MSG_PLEASE_WAIT_REBOOT));
DWIN_UpdateLCD(); dwinUpdateLCD();
safe_delay(500); safe_delay(500);
} }
@@ -1837,7 +1837,7 @@ void DWIN_RedrawScreen() {
} }
void onClick_FilamentPurge() { void onClick_FilamentPurge() {
if (HMI_flag.select_flag) if (hmiFlag.select_flag)
pause_menu_response = PAUSE_RESPONSE_EXTRUDE_MORE; // "Purge More" button pause_menu_response = PAUSE_RESPONSE_EXTRUDE_MORE; // "Purge More" button
else { else {
HMI_SaveProcessID(NothingToDo); HMI_SaveProcessID(NothingToDo);
@@ -1896,8 +1896,8 @@ void DWIN_RedrawScreen() {
void onClick_ConfirmToPrint() { void onClick_ConfirmToPrint() {
Preview_Reset(); Preview_Reset();
DWIN_ResetStatusLine(); DWIN_ResetStatusLine();
if (HMI_flag.select_flag) { // Confirm if (hmiFlag.select_flag) { // Confirm
HMI_flag.heat_flag = true; hmiFlag.heat_flag = true;
Goto_Main_Menu(); Goto_Main_Menu();
return card.openAndPrintFile(card.filename); return card.openAndPrintFile(card.filename);
} }
@@ -1912,7 +1912,7 @@ void Goto_ConfirmToPrint() {
Goto_Popup(Preview_DrawFromSD, onClick_ConfirmToPrint); Goto_Popup(Preview_DrawFromSD, onClick_ConfirmToPrint);
#else #else
// Print SD file // Print SD file
HMI_flag.heat_flag = true; hmiFlag.heat_flag = true;
card.openAndPrintFile(card.filename); card.openAndPrintFile(card.filename);
#endif #endif
} }
@@ -1934,7 +1934,7 @@ void Goto_ConfirmToPrint() {
void WriteEeprom() { void WriteEeprom() {
DWIN_DrawStatusLine(GET_TEXT_F(MSG_STORE_EEPROM)); DWIN_DrawStatusLine(GET_TEXT_F(MSG_STORE_EEPROM));
DWIN_UpdateLCD(); dwinUpdateLCD();
DONE_BUZZ(settings.save()); DONE_BUZZ(settings.save());
} }
@@ -1967,7 +1967,7 @@ void RebootPrinter() {
void Goto_Info_Menu() { void Goto_Info_Menu() {
Draw_Info_Menu(); Draw_Info_Menu();
DWIN_UpdateLCD(); dwinUpdateLCD();
HMI_SaveProcessID(WaitResponse); HMI_SaveProcessID(WaitResponse);
} }
@@ -2110,7 +2110,7 @@ void SetMoveZ() { HMI_value.axis = Z_AXIS; SetPFloatOnClick(Z_MIN_POS, Z_MAX_POS
HMI_data.Baud115K ^= true; HMI_data.Baud115K ^= true;
HMI_SetBaudRate(); HMI_SetBaudRate();
Draw_Chkb_Line(CurrentMenu->line(), HMI_data.Baud115K); Draw_Chkb_Line(CurrentMenu->line(), HMI_data.Baud115K);
DWIN_UpdateLCD(); dwinUpdateLCD();
} }
void SetBaud115K() { queue.inject(F("M575 P0 B115200")); HMI_data.Baud115K = true; } void SetBaud115K() { queue.inject(F("M575 P0 B115200")); HMI_data.Baud115K = true; }
void SetBaud250K() { queue.inject(F("M575 P0 B250000")); HMI_data.Baud115K = false; } void SetBaud250K() { queue.inject(F("M575 P0 B250000")); HMI_data.Baud115K = false; }
@@ -2118,7 +2118,7 @@ void SetMoveZ() { HMI_value.axis = Z_AXIS; SetPFloatOnClick(Z_MIN_POS, Z_MAX_POS
#if HAS_LCD_BRIGHTNESS #if HAS_LCD_BRIGHTNESS
void ApplyBrightness() { ui.set_brightness(MenuData.Value); } void ApplyBrightness() { ui.set_brightness(MenuData.Value); }
void LiveBrightness() { DWIN_LCD_Brightness(MenuData.Value); } void LiveBrightness() { dwinLCDBrightness(MenuData.Value); }
void SetBrightness() { SetIntOnClick(LCD_BRIGHTNESS_MIN, LCD_BRIGHTNESS_MAX, ui.brightness, ApplyBrightness, LiveBrightness); } void SetBrightness() { SetIntOnClick(LCD_BRIGHTNESS_MIN, LCD_BRIGHTNESS_MAX, ui.brightness, ApplyBrightness, LiveBrightness); }
void TurnOffBacklight() { HMI_SaveProcessID(WaitResponse); ui.set_brightness(0); DWIN_RedrawScreen(); } void TurnOffBacklight() { HMI_SaveProcessID(WaitResponse); ui.set_brightness(0); DWIN_RedrawScreen(); }
#endif #endif
@@ -2227,7 +2227,7 @@ void SelColor() {
void LiveRGBColor() { void LiveRGBColor() {
HMI_value.Color[CurrentMenu->line() - 2] = MenuData.Value; HMI_value.Color[CurrentMenu->line() - 2] = MenuData.Value;
uint16_t color = RGB(HMI_value.Color[0], HMI_value.Color[1], HMI_value.Color[2]); uint16_t color = RGB(HMI_value.Color[0], HMI_value.Color[1], HMI_value.Color[2]);
DWIN_Draw_Rectangle(1, color, 20, 315, DWIN_WIDTH - 20, 335); dwinDrawRectangle(1, color, 20, 315, DWIN_WIDTH - 20, 335);
} }
void SetRGBColor() { void SetRGBColor() {
const uint8_t color = static_cast<MenuItemClass*>(CurrentMenu->SelectedItem())->icon; const uint8_t color = static_cast<MenuItemClass*>(CurrentMenu->SelectedItem())->icon;
@@ -2716,8 +2716,8 @@ void onDrawLanguage(MenuItemClass* menuitem, int8_t line) {
void onDrawSelColorItem(MenuItemClass* menuitem, int8_t line) { void onDrawSelColorItem(MenuItemClass* menuitem, int8_t line) {
const uint16_t color = *(uint16_t*)static_cast<MenuItemPtrClass*>(menuitem)->value; const uint16_t color = *(uint16_t*)static_cast<MenuItemPtrClass*>(menuitem)->value;
DWIN_Draw_Rectangle(0, HMI_data.Highlight_Color, ICOX + 1, MBASE(line) - 1 + 1, ICOX + 18, MBASE(line) - 1 + 18); dwinDrawRectangle(0, HMI_data.Highlight_Color, ICOX + 1, MBASE(line) - 1 + 1, ICOX + 18, MBASE(line) - 1 + 18);
DWIN_Draw_Rectangle(1, color, ICOX + 2, MBASE(line) - 1 + 2, ICOX + 17, MBASE(line) - 1 + 17); dwinDrawRectangle(1, color, ICOX + 2, MBASE(line) - 1 + 2, ICOX + 17, MBASE(line) - 1 + 17);
onDrawMenuItem(menuitem, line); onDrawMenuItem(menuitem, line);
} }
@@ -2730,11 +2730,11 @@ void onDrawGetColorItem(MenuItemClass* menuitem, int8_t line) {
case 2: color = RGB(0, 0, 31); break; // Blue case 2: color = RGB(0, 0, 31); break; // Blue
default: color = 0; break; default: color = 0; break;
} }
DWIN_Draw_Rectangle(0, HMI_data.Highlight_Color, ICOX + 1, MBASE(line) - 1 + 1, ICOX + 18, MBASE(line) - 1 + 18); dwinDrawRectangle(0, HMI_data.Highlight_Color, ICOX + 1, MBASE(line) - 1 + 1, ICOX + 18, MBASE(line) - 1 + 18);
DWIN_Draw_Rectangle(1, color, ICOX + 2, MBASE(line) - 1 + 2, ICOX + 17, MBASE(line) - 1 + 17); dwinDrawRectangle(1, color, ICOX + 2, MBASE(line) - 1 + 2, ICOX + 17, MBASE(line) - 1 + 17);
DWINUI::Draw_String(LBLX, MBASE(line) - 1, menuitem->caption); DWINUI::Draw_String(LBLX, MBASE(line) - 1, menuitem->caption);
Draw_Menu_IntValue(HMI_data.Background_Color, line, 4, HMI_value.Color[i]); Draw_Menu_IntValue(HMI_data.Background_Color, line, 4, HMI_value.Color[i]);
DWIN_Draw_HLine(HMI_data.SplitLine_Color, 16, MYPOS(line + 1), 240); dwinDrawHLine(HMI_data.SplitLine_Color, 16, MYPOS(line + 1), 240);
} }
#if DWIN_PID_TUNE #if DWIN_PID_TUNE
@@ -3289,7 +3289,7 @@ void Draw_GetColor_Menu() {
MENU_ITEM(2, MSG_COLORS_BLUE, onDrawGetColorItem, SetRGBColor); MENU_ITEM(2, MSG_COLORS_BLUE, onDrawGetColorItem, SetRGBColor);
} }
UpdateMenu(GetColorMenu); UpdateMenu(GetColorMenu);
DWIN_Draw_Rectangle(1, *MenuData.P_Int, 20, 315, DWIN_WIDTH - 20, 335); dwinDrawRectangle(1, *MenuData.P_Int, 20, 315, DWIN_WIDTH - 20, 335);
} }
#if ALL(CASE_LIGHT_MENU, CASELIGHT_USES_BRIGHTNESS) #if ALL(CASE_LIGHT_MENU, CASELIGHT_USES_BRIGHTNESS)
@@ -3725,7 +3725,7 @@ void Draw_Steps_Menu() {
void SetMeshActive() { void SetMeshActive() {
set_bed_leveling_enabled(!planner.leveling_active); set_bed_leveling_enabled(!planner.leveling_active);
Draw_Chkb_Line(CurrentMenu->line(), planner.leveling_active); Draw_Chkb_Line(CurrentMenu->line(), planner.leveling_active);
DWIN_UpdateLCD(); dwinUpdateLCD();
} }
#if ENABLED(PREHEAT_BEFORE_LEVELING) #if ENABLED(PREHEAT_BEFORE_LEVELING)

View File

@@ -175,13 +175,13 @@ typedef struct {
} HMI_flag_t; } HMI_flag_t;
extern HMI_value_t HMI_value; extern HMI_value_t HMI_value;
extern HMI_flag_t HMI_flag; extern HMI_flag_t hmiFlag;
extern uint8_t checkkey; extern uint8_t checkkey;
extern millis_t dwin_heat_time; extern millis_t dwin_heat_time;
// Popups // Popups
#if HAS_HOTEND || HAS_HEATED_BED #if HAS_HOTEND || HAS_HEATED_BED
void DWIN_Popup_Temperature(const bool toohigh); void dwinPopupTemperature(const bool toohigh);
#endif #endif
#if ENABLED(POWER_LOSS_RECOVERY) #if ENABLED(POWER_LOSS_RECOVERY)
void Popup_PowerLossRecovery(); void Popup_PowerLossRecovery();
@@ -260,11 +260,11 @@ void HMI_SaveProcessID(const uint8_t id);
void HMI_SDCardUpdate(); void HMI_SDCardUpdate();
void EachMomentUpdate(); void EachMomentUpdate();
void update_variable(); void update_variable();
void DWIN_InitScreen(); void dwinInitScreen();
void DWIN_HandleScreen(); void DWIN_HandleScreen();
void DWIN_CheckStatusMessage(); void DWIN_CheckStatusMessage();
void DWIN_HomingStart(); void dwinHomingStart();
void DWIN_HomingDone(); void dwinHomingDone();
#if HAS_MESH #if HAS_MESH
void DWIN_MeshUpdate(const int8_t cpos, const int8_t tpos, const_float_t zval); void DWIN_MeshUpdate(const int8_t cpos, const int8_t tpos, const_float_t zval);
#endif #endif

View File

@@ -44,20 +44,20 @@
// str: multi-bit data // str: multi-bit data
void DWIN_Draw_QR(uint8_t QR_Pixel, uint16_t x, uint16_t y, char *string) { void DWIN_Draw_QR(uint8_t QR_Pixel, uint16_t x, uint16_t y, char *string) {
size_t i = 0; size_t i = 0;
DWIN_Byte(i, 0x21); dwinByte(i, 0x21);
DWIN_Word(i, x); dwinWord(i, x);
DWIN_Word(i, y); dwinWord(i, y);
DWIN_Byte(i, QR_Pixel); dwinByte(i, QR_Pixel);
DWIN_Text(i, string); dwinText(i, string);
DWIN_Send(i); dwinSend(i);
} }
// Draw an Icon with transparent background // Draw an Icon with transparent background
// libID: Icon library ID // libID: Icon library ID
// picID: Icon ID // picID: Icon ID
// x/y: Upper-left point // x/y: Upper-left point
void DWIN_ICON_Show(uint8_t libID, uint8_t picID, uint16_t x, uint16_t y) { void dwinIconShow(uint8_t libID, uint8_t picID, uint16_t x, uint16_t y) {
DWIN_ICON_Show(false, false, true, libID, picID, x, y); dwinIconShow(false, false, true, libID, picID, x, y);
} }
// Copy area from current virtual display area to current screen // Copy area from current virtual display area to current screen
@@ -66,14 +66,14 @@ void DWIN_ICON_Show(uint8_t libID, uint8_t picID, uint16_t x, uint16_t y) {
// x/y: Screen paste point // x/y: Screen paste point
void DWIN_Frame_AreaCopy(uint16_t xStart, uint16_t yStart, uint16_t xEnd, uint16_t yEnd, uint16_t x, uint16_t y) { void DWIN_Frame_AreaCopy(uint16_t xStart, uint16_t yStart, uint16_t xEnd, uint16_t yEnd, uint16_t x, uint16_t y) {
size_t i = 0; size_t i = 0;
DWIN_Byte(i, 0x26); dwinByte(i, 0x26);
DWIN_Word(i, xStart); dwinWord(i, xStart);
DWIN_Word(i, yStart); dwinWord(i, yStart);
DWIN_Word(i, xEnd); dwinWord(i, xEnd);
DWIN_Word(i, yEnd); dwinWord(i, yEnd);
DWIN_Word(i, x); dwinWord(i, x);
DWIN_Word(i, y); dwinWord(i, y);
DWIN_Send(i); dwinSend(i);
} }
// Copy area from virtual display area to current screen // Copy area from virtual display area to current screen
@@ -86,15 +86,15 @@ void DWIN_Frame_AreaCopy(uint16_t xStart, uint16_t yStart, uint16_t xEnd, uint16
// x/y: Screen paste point // x/y: Screen paste point
void DWIN_Frame_AreaCopy(bool IBD, bool BIR, bool BFI, uint8_t cacheID, uint16_t xStart, uint16_t yStart, uint16_t xEnd, uint16_t yEnd, uint16_t x, uint16_t y) { void DWIN_Frame_AreaCopy(bool IBD, bool BIR, bool BFI, uint8_t cacheID, uint16_t xStart, uint16_t yStart, uint16_t xEnd, uint16_t yEnd, uint16_t x, uint16_t y) {
size_t i = 0; size_t i = 0;
DWIN_Byte(i, 0x27); dwinByte(i, 0x27);
DWIN_Byte(i, (IBD & 1) << 7 | (BIR & 1) << 6 | (BFI & 1) << 5 | cacheID); dwinByte(i, (IBD & 1) << 7 | (BIR & 1) << 6 | (BFI & 1) << 5 | cacheID);
DWIN_Word(i, xStart); dwinWord(i, xStart);
DWIN_Word(i, yStart); dwinWord(i, yStart);
DWIN_Word(i, xEnd); dwinWord(i, xEnd);
DWIN_Word(i, yEnd); dwinWord(i, yEnd);
DWIN_Word(i, x); dwinWord(i, x);
DWIN_Word(i, y); dwinWord(i, y);
DWIN_Send(i); dwinSend(i);
} }
// Copy area from virtual display area to current screen with transparent background // Copy area from virtual display area to current screen with transparent background
@@ -122,13 +122,13 @@ void DWIN_WriteToMem(uint8_t mem, uint16_t addr, uint16_t length, uint8_t *data)
indx = block * max_size; indx = block * max_size;
to_send = _MIN(pending, max_size); to_send = _MIN(pending, max_size);
size_t i = 0; size_t i = 0;
DWIN_Byte(i, 0x31); dwinByte(i, 0x31);
DWIN_Byte(i, mem); dwinByte(i, mem);
DWIN_Word(i, addr + indx); // start address of the data block dwinWord(i, addr + indx); // start address of the data block
++i; ++i;
for (uint8_t j = 0; j < i; ++j) { LCD_SERIAL.write(DWIN_SendBuf[j]); delayMicroseconds(1); } // Buf header for (uint8_t j = 0; j < i; ++j) { LCD_SERIAL.write(dwinSendBuf[j]); delayMicroseconds(1); } // Buf header
for (uint16_t j = indx; j <= indx + to_send - 1; j++) LCD_SERIAL.write(*(data + j)); delayMicroseconds(1); // write block of data for (uint16_t j = indx; j <= indx + to_send - 1; j++) LCD_SERIAL.write(*(data + j)); delayMicroseconds(1); // write block of data
for (uint8_t j = 0; j < 4; ++j) { LCD_SERIAL.write(DWIN_BufTail[j]); delayMicroseconds(1); } for (uint8_t j = 0; j < 4; ++j) { LCD_SERIAL.write(dwinBufTail[j]); delayMicroseconds(1); }
block++; block++;
pending -= to_send; pending -= to_send;
} }
@@ -138,23 +138,23 @@ void DWIN_WriteToMem(uint8_t mem, uint16_t addr, uint16_t length, uint8_t *data)
// picID: Picture memory space location, 0x00-0x0F, each space is 32Kbytes // picID: Picture memory space location, 0x00-0x0F, each space is 32Kbytes
void DWIN_SRAMToPic(uint8_t picID) { void DWIN_SRAMToPic(uint8_t picID) {
size_t i = 0; size_t i = 0;
DWIN_Byte(i, 0x33); dwinByte(i, 0x33);
DWIN_Byte(i, 0x5A); dwinByte(i, 0x5A);
DWIN_Byte(i, 0xA5); dwinByte(i, 0xA5);
DWIN_Byte(i, picID); dwinByte(i, picID);
DWIN_Send(i); dwinSend(i);
} }
//--------------------------Test area ------------------------- //--------------------------Test area -------------------------
//void DWIN_ReadSRAM(uint16_t addr, const uint8_t length, const char * const data) { //void DWIN_ReadSRAM(uint16_t addr, const uint8_t length, const char * const data) {
// size_t i = 0; // size_t i = 0;
// DWIN_Byte(i, 0x32); // dwinByte(i, 0x32);
// DWIN_Byte(i, 0x5A); // 0x5A Read from SRAM - 0xA5 Read from Flash // dwinByte(i, 0x5A); // 0x5A Read from SRAM - 0xA5 Read from Flash
// DWIN_Word(i, addr); // 0x0000 to 0x7FFF // dwinWord(i, addr); // 0x0000 to 0x7FFF
// const size_t len = _MIN(0xF0, length); // const size_t len = _MIN(0xF0, length);
// DWIN_Byte(i, len); // dwinByte(i, len);
// DWIN_Send(i); // dwinSend(i);
//} //}
#endif // DWIN_LCD_PROUI #endif // DWIN_LCD_PROUI

View File

@@ -45,27 +45,27 @@ uint16_t HighlightYPos = 280;
void Draw_Select_Highlight(const bool sel, const uint16_t ypos) { void Draw_Select_Highlight(const bool sel, const uint16_t ypos) {
HighlightYPos = ypos; HighlightYPos = ypos;
HMI_flag.select_flag = sel; hmiFlag.select_flag = sel;
const uint16_t c1 = sel ? HMI_data.Highlight_Color : HMI_data.PopupBg_Color, const uint16_t c1 = sel ? HMI_data.Highlight_Color : HMI_data.PopupBg_Color,
c2 = sel ? HMI_data.PopupBg_Color : HMI_data.Highlight_Color; c2 = sel ? HMI_data.PopupBg_Color : HMI_data.Highlight_Color;
DWIN_Draw_Rectangle(0, c1, 25, ypos - 1, 126, ypos + 38); dwinDrawRectangle(0, c1, 25, ypos - 1, 126, ypos + 38);
DWIN_Draw_Rectangle(0, c1, 24, ypos - 2, 127, ypos + 39); dwinDrawRectangle(0, c1, 24, ypos - 2, 127, ypos + 39);
DWIN_Draw_Rectangle(0, c2, 145, ypos - 1, 246, ypos + 38); dwinDrawRectangle(0, c2, 145, ypos - 1, 246, ypos + 38);
DWIN_Draw_Rectangle(0, c2, 144, ypos - 2, 247, ypos + 39); dwinDrawRectangle(0, c2, 144, ypos - 2, 247, ypos + 39);
} }
void DWIN_Popup_Continue(const uint8_t icon, FSTR_P const fmsg1, FSTR_P const fmsg2) { void DWIN_Popup_Continue(const uint8_t icon, FSTR_P const fmsg1, FSTR_P const fmsg2) {
HMI_SaveProcessID(WaitResponse); HMI_SaveProcessID(WaitResponse);
DWIN_Draw_Popup(icon, fmsg1, fmsg2, BTN_Continue); // Button Continue DWIN_Draw_Popup(icon, fmsg1, fmsg2, BTN_Continue); // Button Continue
DWIN_UpdateLCD(); dwinUpdateLCD();
} }
void DWIN_Popup_ConfirmCancel(const uint8_t icon, FSTR_P const fmsg2) { void DWIN_Popup_ConfirmCancel(const uint8_t icon, FSTR_P const fmsg2) {
DWIN_Draw_Popup(ICON_BLTouch, F("Please confirm"), fmsg2); DWIN_Draw_Popup(ICON_BLTouch, F("Please confirm"), fmsg2);
DWINUI::Draw_Button(BTN_Confirm, 26, 280); DWINUI::Draw_Button(BTN_Confirm, 26, 280);
DWINUI::Draw_Button(BTN_Cancel, 146, 280); DWINUI::Draw_Button(BTN_Cancel, 146, 280);
Draw_Select_Highlight(HMI_flag.select_flag); Draw_Select_Highlight(hmiFlag.select_flag);
DWIN_UpdateLCD(); dwinUpdateLCD();
} }
void Goto_Popup(const popupDrawFunc_t fnDraw, const popupClickFunc_t fnClick/*=nullptr*/, const popupChangeFunc_t fnChange/*=nullptr*/) { void Goto_Popup(const popupDrawFunc_t fnDraw, const popupClickFunc_t fnClick/*=nullptr*/, const popupChangeFunc_t fnChange/*=nullptr*/) {
@@ -73,7 +73,7 @@ void Goto_Popup(const popupDrawFunc_t fnDraw, const popupClickFunc_t fnClick/*=n
popupClick = fnClick; popupClick = fnClick;
popupChange = fnChange; popupChange = fnChange;
HMI_SaveProcessID(Popup); HMI_SaveProcessID(Popup);
HMI_flag.select_flag = false; hmiFlag.select_flag = false;
popupDraw(); popupDraw();
} }
@@ -87,7 +87,7 @@ void HMI_Popup() {
if (encoder_diffState == ENCODER_DIFF_CW || encoder_diffState == ENCODER_DIFF_CCW) { if (encoder_diffState == ENCODER_DIFF_CW || encoder_diffState == ENCODER_DIFF_CCW) {
const bool change = encoder_diffState != ENCODER_DIFF_CW; const bool change = encoder_diffState != ENCODER_DIFF_CW;
if (popupChange) popupChange(change); else Draw_Select_Highlight(change, HighlightYPos); if (popupChange) popupChange(change); else Draw_Select_Highlight(change, HighlightYPos);
DWIN_UpdateLCD(); dwinUpdateLCD();
} }
} }
} }

View File

@@ -44,8 +44,8 @@ void Goto_Popup(const popupDrawFunc_t fnDraw, const popupClickFunc_t fnClick=nul
void HMI_Popup(); void HMI_Popup();
inline void Draw_Popup_Bkgd() { inline void Draw_Popup_Bkgd() {
DWIN_Draw_Rectangle(1, HMI_data.PopupBg_Color, 14, 60, 258, 330); dwinDrawRectangle(1, HMI_data.PopupBg_Color, 14, 60, 258, 330);
DWIN_Draw_Rectangle(0, HMI_data.Highlight_Color, 14, 60, 258, 330); dwinDrawRectangle(0, HMI_data.Highlight_Color, 14, 60, 258, 330);
} }
template<typename T, typename U> template<typename T, typename U>
@@ -61,13 +61,13 @@ void DWIN_Draw_Popup(const uint8_t icon, T amsg1=nullptr, U amsg2=nullptr, uint8
template<typename T, typename U> template<typename T, typename U>
void DWIN_Show_Popup(const uint8_t icon, T amsg1=nullptr, U amsg2=nullptr, uint8_t button=0) { void DWIN_Show_Popup(const uint8_t icon, T amsg1=nullptr, U amsg2=nullptr, uint8_t button=0) {
DWIN_Draw_Popup(icon, amsg1, amsg2, button); DWIN_Draw_Popup(icon, amsg1, amsg2, button);
DWIN_UpdateLCD(); dwinUpdateLCD();
} }
template<typename T, typename U> template<typename T, typename U>
void DWIN_Popup_Confirm(const uint8_t icon, T amsg1, U amsg2) { void DWIN_Popup_Confirm(const uint8_t icon, T amsg1, U amsg2) {
HMI_SaveProcessID(WaitResponse); HMI_SaveProcessID(WaitResponse);
DWIN_Draw_Popup(icon, amsg1, amsg2, BTN_Confirm); // Button Confirm DWIN_Draw_Popup(icon, amsg1, amsg2, BTN_Confirm); // Button Confirm
DWIN_UpdateLCD(); dwinUpdateLCD();
} }

View File

@@ -137,7 +137,7 @@ void DWINUI::MoveBy(xy_int_t point) {
// Draw a Centered string using arbitrary x1 and x2 margins // Draw a Centered string using arbitrary x1 and x2 margins
void DWINUI::Draw_CenteredString(bool bShow, fontid_t fid, uint16_t color, uint16_t bColor, uint16_t x1, uint16_t x2, uint16_t y, const char * const string) { void DWINUI::Draw_CenteredString(bool bShow, fontid_t fid, uint16_t color, uint16_t bColor, uint16_t x1, uint16_t x2, uint16_t y, const char * const string) {
const uint16_t x = _MAX(0U, x2 + x1 - strlen_P(string) * fontWidth(fid)) / 2 - 1; const uint16_t x = _MAX(0U, x2 + x1 - strlen_P(string) * fontWidth(fid)) / 2 - 1;
DWIN_Draw_String(bShow, fid, color, bColor, x, y, string); dwinDrawString(bShow, fid, color, bColor, x, y, string);
} }
// Draw a char // Draw a char
@@ -147,7 +147,7 @@ void DWINUI::Draw_CenteredString(bool bShow, fontid_t fid, uint16_t color, uint1
// c: ASCII code of char // c: ASCII code of char
void DWINUI::Draw_Char(uint16_t color, uint16_t x, uint16_t y, const char c) { void DWINUI::Draw_Char(uint16_t color, uint16_t x, uint16_t y, const char c) {
const char string[2] = { c, 0}; const char string[2] = { c, 0};
DWIN_Draw_String(false, fontid, color, backcolor, x, y, string, 1); dwinDrawString(false, fontid, color, backcolor, x, y, string, 1);
} }
// Draw a char at cursor position and increment cursor // Draw a char at cursor position and increment cursor
@@ -161,11 +161,11 @@ void DWINUI::Draw_Char(uint16_t color, const char c) {
// *string: The string // *string: The string
// rlimit: For draw less chars than string length use rlimit // rlimit: For draw less chars than string length use rlimit
void DWINUI::Draw_String(const char * const string, uint16_t rlimit) { void DWINUI::Draw_String(const char * const string, uint16_t rlimit) {
DWIN_Draw_String(false, fontid, textcolor, backcolor, cursor.x, cursor.y, string, rlimit); dwinDrawString(false, fontid, textcolor, backcolor, cursor.x, cursor.y, string, rlimit);
MoveBy(strlen(string) * fontWidth(fontid), 0); MoveBy(strlen(string) * fontWidth(fontid), 0);
} }
void DWINUI::Draw_String(uint16_t color, const char * const string, uint16_t rlimit) { void DWINUI::Draw_String(uint16_t color, const char * const string, uint16_t rlimit) {
DWIN_Draw_String(false, fontid, color, backcolor, cursor.x, cursor.y, string, rlimit); dwinDrawString(false, fontid, color, backcolor, cursor.x, cursor.y, string, rlimit);
MoveBy(strlen(string) * fontWidth(fontid), 0); MoveBy(strlen(string) * fontWidth(fontid), 0);
} }
@@ -181,7 +181,7 @@ void DWINUI::Draw_String(uint16_t color, const char * const string, uint16_t rli
void DWINUI::Draw_Int(uint8_t bShow, bool signedMode, fontid_t fid, uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, int32_t value) { void DWINUI::Draw_Int(uint8_t bShow, bool signedMode, fontid_t fid, uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, int32_t value) {
char nstr[10]; char nstr[10];
sprintf_P(nstr, PSTR("%*li"), (signedMode ? iNum + 1 : iNum), value); sprintf_P(nstr, PSTR("%*li"), (signedMode ? iNum + 1 : iNum), value);
DWIN_Draw_String(bShow, fid, color, bColor, x, y, nstr); dwinDrawString(bShow, fid, color, bColor, x, y, nstr);
} }
// Draw a numeric float value // Draw a numeric float value
@@ -196,7 +196,7 @@ void DWINUI::Draw_Int(uint8_t bShow, bool signedMode, fontid_t fid, uint16_t col
// value: float value // value: float value
void DWINUI::Draw_Float(uint8_t bShow, bool signedMode, fontid_t fid, uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) { void DWINUI::Draw_Float(uint8_t bShow, bool signedMode, fontid_t fid, uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) {
char nstr[10]; char nstr[10];
DWIN_Draw_String(bShow, fid, color, bColor, x, y, dtostrf(value, iNum + (signedMode ? 2:1) + fNum, fNum, nstr)); dwinDrawString(bShow, fid, color, bColor, x, y, dtostrf(value, iNum + (signedMode ? 2:1) + fNum, fNum, nstr));
} }
// ------------------------- Icons -------------------------------// // ------------------------- Icons -------------------------------//
@@ -209,13 +209,13 @@ void DWINUI::Draw_Float(uint8_t bShow, bool signedMode, fontid_t fid, uint16_t c
void DWINUI::ICON_Show(bool BG, uint8_t icon, uint16_t x, uint16_t y) { void DWINUI::ICON_Show(bool BG, uint8_t icon, uint16_t x, uint16_t y) {
const uint8_t libID = ICON TERN_(HAS_CUSTOMICONS, + (icon / 100)); const uint8_t libID = ICON TERN_(HAS_CUSTOMICONS, + (icon / 100));
const uint8_t picID = icon TERN_(HAS_CUSTOMICONS, % 100); const uint8_t picID = icon TERN_(HAS_CUSTOMICONS, % 100);
DWIN_ICON_Show(BG, false, !BG, libID, picID, x, y); dwinIconShow(BG, false, !BG, libID, picID, x, y);
} }
// ------------------------- Buttons ------------------------------// // ------------------------- Buttons ------------------------------//
void DWINUI::Draw_Button(uint16_t color, uint16_t bcolor, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, const char * const caption) { void DWINUI::Draw_Button(uint16_t color, uint16_t bcolor, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, const char * const caption) {
DWIN_Draw_Rectangle(1, bcolor, x1, y1, x2, y2); dwinDrawRectangle(1, bcolor, x1, y1, x2, y2);
Draw_CenteredString(0, fontid, color, bcolor, x1, x2, (y2 + y1 - fontHeight())/2, caption); Draw_CenteredString(0, fontid, color, bcolor, x1, x2, (y2 + y1 - fontHeight())/2, caption);
} }
@@ -243,14 +243,14 @@ void DWINUI::Draw_Circle(uint16_t color, uint16_t x, uint16_t y, uint8_t r) {
while (a <= b) { while (a <= b) {
b = SQRT(sq(r) - sq(a)); b = SQRT(sq(r) - sq(a));
if (a == 0) b--; if (a == 0) b--;
DWIN_Draw_Point(color, 1, 1, x + a, y + b); // Draw some sector 1 dwinDrawPoint(color, 1, 1, x + a, y + b); // Draw some sector 1
DWIN_Draw_Point(color, 1, 1, x + b, y + a); // Draw some sector 2 dwinDrawPoint(color, 1, 1, x + b, y + a); // Draw some sector 2
DWIN_Draw_Point(color, 1, 1, x + b, y - a); // Draw some sector 3 dwinDrawPoint(color, 1, 1, x + b, y - a); // Draw some sector 3
DWIN_Draw_Point(color, 1, 1, x + a, y - b); // Draw some sector 4 dwinDrawPoint(color, 1, 1, x + a, y - b); // Draw some sector 4
DWIN_Draw_Point(color, 1, 1, x - a, y - b); // Draw some sector 5 dwinDrawPoint(color, 1, 1, x - a, y - b); // Draw some sector 5
DWIN_Draw_Point(color, 1, 1, x - b, y - a); // Draw some sector 6 dwinDrawPoint(color, 1, 1, x - b, y - a); // Draw some sector 6
DWIN_Draw_Point(color, 1, 1, x - b, y + a); // Draw some sector 7 dwinDrawPoint(color, 1, 1, x - b, y + a); // Draw some sector 7
DWIN_Draw_Point(color, 1, 1, x - a, y + b); // Draw some sector 8 dwinDrawPoint(color, 1, 1, x - a, y + b); // Draw some sector 8
a++; a++;
} }
} }
@@ -265,10 +265,10 @@ void DWINUI::Draw_FillCircle(uint16_t bcolor, uint16_t x,uint16_t y,uint8_t r) {
while (a <= b) { while (a <= b) {
b = SQRT(sq(r) - sq(a)); // b=sqrt(r*r-a*a); b = SQRT(sq(r) - sq(a)); // b=sqrt(r*r-a*a);
if (a == 0) b--; if (a == 0) b--;
DWIN_Draw_Line(bcolor, x-b,y-a,x+b,y-a); dwinDrawLine(bcolor, x-b,y-a,x+b,y-a);
DWIN_Draw_Line(bcolor, x-a,y-b,x+a,y-b); dwinDrawLine(bcolor, x-a,y-b,x+a,y-b);
DWIN_Draw_Line(bcolor, x-b,y+a,x+b,y+a); dwinDrawLine(bcolor, x-b,y+a,x+b,y+a);
DWIN_Draw_Line(bcolor, x-a,y+b,x+a,y+b); dwinDrawLine(bcolor, x-a,y+b,x+a,y+b);
a++; a++;
} }
} }
@@ -322,13 +322,13 @@ uint16_t DWINUI::RainbowInt(int16_t val, int16_t minv, int16_t maxv) {
// x/y: Upper-left point // x/y: Upper-left point
// mode : 0 : unchecked, 1 : checked // mode : 0 : unchecked, 1 : checked
void DWINUI::Draw_Checkbox(uint16_t color, uint16_t bcolor, uint16_t x, uint16_t y, bool checked=false) { void DWINUI::Draw_Checkbox(uint16_t color, uint16_t bcolor, uint16_t x, uint16_t y, bool checked=false) {
DWIN_Draw_Rectangle(0, color, x + 2, y + 2, x + 17, y + 17); dwinDrawRectangle(0, color, x + 2, y + 2, x + 17, y + 17);
DWIN_Draw_Rectangle(1, checked ? color : bcolor, x + 6, y + 6, x + 13, y + 13); dwinDrawRectangle(1, checked ? color : bcolor, x + 6, y + 6, x + 13, y + 13);
} }
// Clear Menu by filling the menu area with background color // Clear Menu by filling the menu area with background color
void DWINUI::ClearMainArea() { void DWINUI::ClearMainArea() {
DWIN_Draw_Rectangle(1, backcolor, 0, TITLE_HEIGHT, DWIN_WIDTH - 1, STATUS_Y - 1); dwinDrawRectangle(1, backcolor, 0, TITLE_HEIGHT, DWIN_WIDTH - 1, STATUS_Y - 1);
} }
/* Title Class ==============================================================*/ /* Title Class ==============================================================*/

View File

@@ -286,10 +286,10 @@ namespace DWINUI {
// color: Line segment color // color: Line segment color
// x/y: End point // x/y: End point
inline void LineTo(uint16_t color, uint16_t x, uint16_t y) { inline void LineTo(uint16_t color, uint16_t x, uint16_t y) {
DWIN_Draw_Line(color, cursor.x, cursor.y, x, y); dwinDrawLine(color, cursor.x, cursor.y, x, y);
} }
inline void LineTo(uint16_t x, uint16_t y) { inline void LineTo(uint16_t x, uint16_t y) {
DWIN_Draw_Line(pencolor, cursor.x, cursor.y, x, y); dwinDrawLine(pencolor, cursor.x, cursor.y, x, y);
} }
// Extend a frame box // Extend a frame box
@@ -462,28 +462,28 @@ namespace DWINUI {
// x/y: Upper-left coordinate of the string // x/y: Upper-left coordinate of the string
// *string: The string // *string: The string
inline void Draw_String(uint16_t x, uint16_t y, const char * const string) { inline void Draw_String(uint16_t x, uint16_t y, const char * const string) {
DWIN_Draw_String(false, fontid, textcolor, backcolor, x, y, string); dwinDrawString(false, fontid, textcolor, backcolor, x, y, string);
} }
inline void Draw_String(uint16_t x, uint16_t y, FSTR_P title) { inline void Draw_String(uint16_t x, uint16_t y, FSTR_P title) {
DWIN_Draw_String(false, fontid, textcolor, backcolor, x, y, FTOP(title)); dwinDrawString(false, fontid, textcolor, backcolor, x, y, FTOP(title));
} }
inline void Draw_String(uint16_t color, uint16_t x, uint16_t y, const char * const string) { inline void Draw_String(uint16_t color, uint16_t x, uint16_t y, const char * const string) {
DWIN_Draw_String(false, fontid, color, backcolor, x, y, string); dwinDrawString(false, fontid, color, backcolor, x, y, string);
} }
inline void Draw_String(uint16_t color, uint16_t x, uint16_t y, FSTR_P title) { inline void Draw_String(uint16_t color, uint16_t x, uint16_t y, FSTR_P title) {
DWIN_Draw_String(false, fontid, color, backcolor, x, y, title); dwinDrawString(false, fontid, color, backcolor, x, y, title);
} }
inline void Draw_String(uint16_t color, uint16_t bgcolor, uint16_t x, uint16_t y, const char * const string) { inline void Draw_String(uint16_t color, uint16_t bgcolor, uint16_t x, uint16_t y, const char * const string) {
DWIN_Draw_String(true, fontid, color, bgcolor, x, y, string); dwinDrawString(true, fontid, color, bgcolor, x, y, string);
} }
inline void Draw_String(uint16_t color, uint16_t bgcolor, uint16_t x, uint16_t y, FSTR_P title) { inline void Draw_String(uint16_t color, uint16_t bgcolor, uint16_t x, uint16_t y, FSTR_P title) {
DWIN_Draw_String(true, fontid, color, bgcolor, x, y, title); dwinDrawString(true, fontid, color, bgcolor, x, y, title);
} }
inline void Draw_String(fontid_t fid, uint16_t color, uint16_t bgcolor, uint16_t x, uint16_t y, const char * const string) { inline void Draw_String(fontid_t fid, uint16_t color, uint16_t bgcolor, uint16_t x, uint16_t y, const char * const string) {
DWIN_Draw_String(true, fid, color, bgcolor, x, y, string); dwinDrawString(true, fid, color, bgcolor, x, y, string);
} }
inline void Draw_String(fontid_t fid, uint16_t color, uint16_t bgcolor, uint16_t x, uint16_t y, FSTR_P title) { inline void Draw_String(fontid_t fid, uint16_t color, uint16_t bgcolor, uint16_t x, uint16_t y, FSTR_P title) {
DWIN_Draw_String(true, fid, color, bgcolor, x, y, title); dwinDrawString(true, fid, color, bgcolor, x, y, title);
} }
// Draw a centered string using DWIN_WIDTH // Draw a centered string using DWIN_WIDTH
@@ -527,7 +527,7 @@ namespace DWINUI {
// color: Rectangle color // color: Rectangle color
// frame: Box coordinates and size // frame: Box coordinates and size
inline void Draw_Box(uint8_t mode, uint16_t color, frame_rect_t frame) { inline void Draw_Box(uint8_t mode, uint16_t color, frame_rect_t frame) {
DWIN_Draw_Box(mode, color, frame.x, frame.y, frame.w, frame.h); dwinDrawBox(mode, color, frame.x, frame.y, frame.w, frame.h);
} }
// Draw a circle // Draw a circle

View File

@@ -60,7 +60,7 @@ void draw_es_label(FSTR_P const flabel=nullptr) {
void draw_es_state(const bool is_hit) { void draw_es_state(const bool is_hit) {
const uint8_t LM = 130; const uint8_t LM = 130;
DWINUI::cursor.x = LM; DWINUI::cursor.x = LM;
DWIN_Draw_Rectangle(1, HMI_data.PopupBg_Color, LM, DWINUI::cursor.y, LM + 100, DWINUI::cursor.y + 20); dwinDrawRectangle(1, HMI_data.PopupBg_Color, LM, DWINUI::cursor.y, LM + 100, DWINUI::cursor.y + 20);
is_hit ? DWINUI::Draw_String(RGB(31,31,16), F(STR_ENDSTOP_HIT)) : DWINUI::Draw_String(RGB(16,63,16), F(STR_ENDSTOP_OPEN)); is_hit ? DWINUI::Draw_String(RGB(31,31,16), F(STR_ENDSTOP_HIT)) : DWINUI::Draw_String(RGB(16,63,16), F(STR_ENDSTOP_OPEN));
DWINUI::MoveBy(0, 25); DWINUI::MoveBy(0, 25);
} }
@@ -86,7 +86,7 @@ void ESDiagClass::Update() {
TERN_(USE_Y_MIN, ES_REPORT(Y_MIN)); TERN_(USE_Y_MAX, ES_REPORT(Y_MAX)); TERN_(USE_Y_MIN, ES_REPORT(Y_MIN)); TERN_(USE_Y_MAX, ES_REPORT(Y_MAX));
TERN_(HAS_Z_MIN_PIN, ES_REPORT(Z_MIN)); TERN_(USE_Z_MAX, ES_REPORT(Z_MAX)); TERN_(HAS_Z_MIN_PIN, ES_REPORT(Z_MIN)); TERN_(USE_Z_MAX, ES_REPORT(Z_MAX));
TERN_(HAS_FILAMENT_SENSOR, draw_es_state(READ(FIL_RUNOUT1_PIN) != FIL_RUNOUT1_STATE)); TERN_(HAS_FILAMENT_SENSOR, draw_es_state(READ(FIL_RUNOUT1_PIN) != FIL_RUNOUT1_STATE));
DWIN_UpdateLCD(); dwinUpdateLCD();
} }
#endif // DWIN_LCD_PROUI && HAS_ESDIAG #endif // DWIN_LCD_PROUI && HAS_ESDIAG

View File

@@ -199,7 +199,7 @@ void Preview_DrawFromSD() {
char str_1[6] = ""; char str_1[6] = "";
char str_2[6] = ""; char str_2[6] = "";
char str_3[6] = ""; char str_3[6] = "";
DWIN_Draw_Rectangle(1, HMI_data.Background_Color, 0, 0, DWIN_WIDTH, STATUS_Y - 1); dwinDrawRectangle(1, HMI_data.Background_Color, 0, 0, DWIN_WIDTH, STATUS_Y - 1);
if (fileprop.time) { if (fileprop.time) {
sprintf_P(buf, PSTR("Estimated time: %i:%02i"), (uint16_t)fileprop.time / 3600, ((uint16_t)fileprop.time % 3600) / 60); sprintf_P(buf, PSTR("Estimated time: %i:%02i"), (uint16_t)fileprop.time / 3600, ((uint16_t)fileprop.time % 3600) / 60);
DWINUI::Draw_String(20, 10, buf); DWINUI::Draw_String(20, 10, buf);
@@ -218,12 +218,12 @@ void Preview_DrawFromSD() {
} }
DWINUI::Draw_Button(BTN_Print, 26, 290); DWINUI::Draw_Button(BTN_Print, 26, 290);
DWINUI::Draw_Button(BTN_Cancel, 146, 290); DWINUI::Draw_Button(BTN_Cancel, 146, 290);
DWIN_ICON_Show(0, 0, 1, 21, 90, 0x00); dwinIconShow(0, 0, 1, 21, 90, 0x00);
Draw_Select_Highlight(true, 290); Draw_Select_Highlight(true, 290);
DWIN_UpdateLCD(); dwinUpdateLCD();
} }
else { else {
HMI_flag.select_flag = 1; hmiFlag.select_flag = 1;
wait_for_user = false; wait_for_user = false;
} }
} }

View File

@@ -55,9 +55,9 @@ void LockScreenClass::draw() {
DWINUI::Draw_CenteredString(Color_White, 180, GET_TEXT_F(MSG_LOCKSCREEN_LOCKED)); DWINUI::Draw_CenteredString(Color_White, 180, GET_TEXT_F(MSG_LOCKSCREEN_LOCKED));
DWINUI::Draw_CenteredString(Color_White, 200, GET_TEXT_F(MSG_LOCKSCREEN_UNLOCK)); DWINUI::Draw_CenteredString(Color_White, 200, GET_TEXT_F(MSG_LOCKSCREEN_UNLOCK));
DWINUI::Draw_CenteredString(Color_White, 240, F("-> | <-")); DWINUI::Draw_CenteredString(Color_White, 240, F("-> | <-"));
DWIN_Draw_Box(1, HMI_data.Barfill_Color, 0, 260, DWIN_WIDTH, 20); dwinDrawBox(1, HMI_data.Barfill_Color, 0, 260, DWIN_WIDTH, 20);
DWIN_Draw_VLine(Color_Yellow, lock_pos * DWIN_WIDTH / 255, 260, 20); dwinDrawVLine(Color_Yellow, lock_pos * DWIN_WIDTH / 255, 260, 20);
DWIN_UpdateLCD(); dwinUpdateLCD();
} }
void LockScreenClass::onEncoder(EncoderState encoder_diffState) { void LockScreenClass::onEncoder(EncoderState encoder_diffState) {
@@ -67,9 +67,9 @@ void LockScreenClass::onEncoder(EncoderState encoder_diffState) {
case ENCODER_DIFF_ENTER: unlocked = (lock_pos == 128); break; case ENCODER_DIFF_ENTER: unlocked = (lock_pos == 128); break;
default: break; default: break;
} }
DWIN_Draw_Box(1, HMI_data.Barfill_Color, 0, 260, DWIN_WIDTH, 20); dwinDrawBox(1, HMI_data.Barfill_Color, 0, 260, DWIN_WIDTH, 20);
DWIN_Draw_VLine(Color_Yellow, lock_pos * DWIN_WIDTH / 255, 260, 20); dwinDrawVLine(Color_Yellow, lock_pos * DWIN_WIDTH / 255, 260, 20);
DWIN_UpdateLCD(); dwinUpdateLCD();
} }
#endif // DWIN_LCD_PROUI && HAS_LOCKSCREEN #endif // DWIN_LCD_PROUI && HAS_LOCKSCREEN

View File

@@ -47,20 +47,20 @@ MenuData_t MenuData;
// Menuitem Drawing functions ================================================= // Menuitem Drawing functions =================================================
void Draw_Title(TitleClass* title) { void Draw_Title(TitleClass* title) {
DWIN_Draw_Rectangle(1, HMI_data.TitleBg_Color, 0, 0, DWIN_WIDTH - 1, TITLE_HEIGHT - 1); dwinDrawRectangle(1, HMI_data.TitleBg_Color, 0, 0, DWIN_WIDTH - 1, TITLE_HEIGHT - 1);
if (title->frameid) if (title->frameid)
DWIN_Frame_AreaCopy(title->frameid, title->frame.left, title->frame.top, title->frame.right, title->frame.bottom, 14, (TITLE_HEIGHT - (title->frame.bottom - title->frame.top)) / 2 - 1); DWIN_Frame_AreaCopy(title->frameid, title->frame.left, title->frame.top, title->frame.right, title->frame.bottom, 14, (TITLE_HEIGHT - (title->frame.bottom - title->frame.top)) / 2 - 1);
else else
#if ENABLED(TITLE_CENTERED) #if ENABLED(TITLE_CENTERED)
DWINUI::Draw_CenteredString(false, DWIN_FONT_HEAD, HMI_data.TitleTxt_Color, HMI_data.TitleBg_Color, (TITLE_HEIGHT - DWINUI::fontHeight(DWIN_FONT_HEAD)) / 2 - 1, title->caption); DWINUI::Draw_CenteredString(false, DWIN_FONT_HEAD, HMI_data.TitleTxt_Color, HMI_data.TitleBg_Color, (TITLE_HEIGHT - DWINUI::fontHeight(DWIN_FONT_HEAD)) / 2 - 1, title->caption);
#else #else
DWIN_Draw_String(false, DWIN_FONT_HEAD, HMI_data.TitleTxt_Color, HMI_data.TitleBg_Color, 14, (TITLE_HEIGHT - DWINUI::fontHeight(DWIN_FONT_HEAD)) / 2 - 1, title->caption); dwinDrawString(false, DWIN_FONT_HEAD, HMI_data.TitleTxt_Color, HMI_data.TitleBg_Color, 14, (TITLE_HEIGHT - DWINUI::fontHeight(DWIN_FONT_HEAD)) / 2 - 1, title->caption);
#endif #endif
} }
void Draw_Menu(MenuClass* menu) { void Draw_Menu(MenuClass* menu) {
DWINUI::SetColors(HMI_data.Text_Color, HMI_data.Background_Color, HMI_data.StatusBg_Color); DWINUI::SetColors(HMI_data.Text_Color, HMI_data.Background_Color, HMI_data.StatusBg_Color);
DWIN_Draw_Rectangle(1, DWINUI::backcolor, 0, TITLE_HEIGHT, DWIN_WIDTH - 1, STATUS_Y - 1); dwinDrawRectangle(1, DWINUI::backcolor, 0, TITLE_HEIGHT, DWIN_WIDTH - 1, STATUS_Y - 1);
} }
void Draw_Menu_Cursor(const int8_t line) { void Draw_Menu_Cursor(const int8_t line) {
@@ -84,7 +84,7 @@ void Draw_Menu_Line(const uint8_t line, const uint8_t icon /*=0*/, const char *
if (label) DWINUI::Draw_String(LBLX, MBASE(line) - 1, (char*)label); if (label) DWINUI::Draw_String(LBLX, MBASE(line) - 1, (char*)label);
if (more) DWINUI::Draw_Icon(ICON_More, VALX + 16, MBASE(line) - 3); if (more) DWINUI::Draw_Icon(ICON_More, VALX + 16, MBASE(line) - 3);
if (selected) Draw_Menu_Cursor(line); if (selected) Draw_Menu_Cursor(line);
DWIN_Draw_HLine(HMI_data.SplitLine_Color, 16, MYPOS(line + 1), 240); dwinDrawHLine(HMI_data.SplitLine_Color, 16, MYPOS(line + 1), 240);
} }
void Draw_Menu_Line(const uint8_t line, const uint8_t icon /*=0*/, FSTR_P label /*=nullptr*/, bool more /*=false*/, bool selected /*=false*/) { void Draw_Menu_Line(const uint8_t line, const uint8_t icon /*=0*/, FSTR_P label /*=nullptr*/, bool more /*=false*/, bool selected /*=false*/) {
@@ -98,7 +98,7 @@ void Draw_Chkb_Line(const uint8_t line, const bool checked) {
void Show_Chkb_Line(const bool checked) { void Show_Chkb_Line(const bool checked) {
const uint8_t line = CurrentMenu->line(); const uint8_t line = CurrentMenu->line();
DWINUI::Draw_Checkbox(HMI_data.Text_Color, HMI_data.Background_Color, VALX + 3 * DWINUI::fontWidth(), MBASE(line) - 1, checked); DWINUI::Draw_Checkbox(HMI_data.Text_Color, HMI_data.Background_Color, VALX + 3 * DWINUI::fontWidth(), MBASE(line) - 1, checked);
DWIN_UpdateLCD(); dwinUpdateLCD();
} }
void Toggle_Chkb_Line(bool &checked) { void Toggle_Chkb_Line(bool &checked) {
@@ -116,7 +116,7 @@ void onDrawMenuItem(MenuItemClass* menuitem, int8_t line) {
DWIN_Frame_AreaCopy(menuitem->frameid, menuitem->frame.left, menuitem->frame.top, menuitem->frame.right, menuitem->frame.bottom, LBLX, MBASE(line)); DWIN_Frame_AreaCopy(menuitem->frameid, menuitem->frame.left, menuitem->frame.top, menuitem->frame.right, menuitem->frame.bottom, LBLX, MBASE(line));
else if (menuitem->caption) else if (menuitem->caption)
DWINUI::Draw_String(LBLX, MBASE(line) - 1, menuitem->caption); DWINUI::Draw_String(LBLX, MBASE(line) - 1, menuitem->caption);
DWIN_Draw_HLine(HMI_data.SplitLine_Color, 16, MYPOS(line + 1), 240); dwinDrawHLine(HMI_data.SplitLine_Color, 16, MYPOS(line + 1), 240);
} }
void onDrawSubMenu(MenuItemClass* menuitem, int8_t line) { void onDrawSubMenu(MenuItemClass* menuitem, int8_t line) {
@@ -197,7 +197,7 @@ void SetOnClick(uint8_t process, const int32_t lo, const int32_t hi, uint8_t dp,
MenuData.Apply = Apply; MenuData.Apply = Apply;
MenuData.LiveUpdate = LiveUpdate; MenuData.LiveUpdate = LiveUpdate;
MenuData.Value = constrain(val, lo, hi); MenuData.Value = constrain(val, lo, hi);
EncoderRate.enabled = true; encoderRate.enabled = true;
} }
// Generic onclick event for integer values // Generic onclick event for integer values
@@ -292,8 +292,8 @@ int8_t HMI_Get(bool draw) {
const int32_t cval = MenuData.Value; const int32_t cval = MenuData.Value;
EncoderState encoder_diffState = get_encoder_state(); EncoderState encoder_diffState = get_encoder_state();
if (encoder_diffState != ENCODER_DIFF_NO) { if (encoder_diffState != ENCODER_DIFF_NO) {
if (Apply_Encoder(encoder_diffState, MenuData.Value)) { if (applyEncoder(encoder_diffState, MenuData.Value)) {
EncoderRate.enabled = false; encoderRate.enabled = false;
if (draw) DrawItemEdit(false); if (draw) DrawItemEdit(false);
checkkey = Menu; checkkey = Menu;
return 2; return 2;
@@ -358,7 +358,7 @@ void MenuClass::draw() {
for (int8_t i = 0; i < MenuItemCount; i++) for (int8_t i = 0; i < MenuItemCount; i++)
MenuItems[i]->draw(i - topline); MenuItems[i]->draw(i - topline);
Draw_Menu_Cursor(line()); Draw_Menu_Cursor(line());
DWIN_UpdateLCD(); dwinUpdateLCD();
} }
void MenuClass::onScroll(bool dir) { void MenuClass::onScroll(bool dir) {
@@ -367,20 +367,20 @@ void MenuClass::onScroll(bool dir) {
LIMIT(sel, 0, MenuItemCount - 1); LIMIT(sel, 0, MenuItemCount - 1);
if (sel != selected) { if (sel != selected) {
Erase_Menu_Cursor(line()); Erase_Menu_Cursor(line());
DWIN_UpdateLCD(); dwinUpdateLCD();
if ((sel - topline) == TROWS) { if ((sel - topline) == TROWS) {
DWIN_Frame_AreaMove(1, DWIN_SCROLL_UP, MLINE, DWINUI::backcolor, 0, TITLE_HEIGHT + 1, DWIN_WIDTH, STATUS_Y - 1); dwinFrameAreaMove(1, DWIN_SCROLL_UP, MLINE, DWINUI::backcolor, 0, TITLE_HEIGHT + 1, DWIN_WIDTH, STATUS_Y - 1);
topline++; topline++;
MenuItems[sel]->draw(TROWS - 1); MenuItems[sel]->draw(TROWS - 1);
} }
if ((sel < topline)) { if ((sel < topline)) {
DWIN_Frame_AreaMove(1, DWIN_SCROLL_DOWN, MLINE, DWINUI::backcolor, 0, TITLE_HEIGHT + 1, DWIN_WIDTH, STATUS_Y - 1); dwinFrameAreaMove(1, DWIN_SCROLL_DOWN, MLINE, DWINUI::backcolor, 0, TITLE_HEIGHT + 1, DWIN_WIDTH, STATUS_Y - 1);
topline--; topline--;
MenuItems[sel]->draw(0); MenuItems[sel]->draw(0);
} }
selected = sel; selected = sel;
Draw_Menu_Cursor(line()); Draw_Menu_Cursor(line());
DWIN_UpdateLCD(); dwinUpdateLCD();
} }
} }

View File

@@ -57,8 +57,8 @@ void MeshViewerClass::DrawMesh(bed_mesh_t zval, const uint8_t sizex, const uint8
#define py(yp) (30 + DWIN_WIDTH - my - (yp) * sty) #define py(yp) (30 + DWIN_WIDTH - my - (yp) * sty)
#define rm(z) ((z - minz) * (rmax - rmin) / _MAX(1, (maxz - minz)) + rmin) #define rm(z) ((z - minz) * (rmax - rmin) / _MAX(1, (maxz - minz)) + rmin)
#define DrawMeshValue(xp, yp, zv) DWINUI::Draw_Signed_Float(font6x12, 1, 2, px(xp) - 18, py(yp) - 6, zv) #define DrawMeshValue(xp, yp, zv) DWINUI::Draw_Signed_Float(font6x12, 1, 2, px(xp) - 18, py(yp) - 6, zv)
#define DrawMeshHLine(yp) DWIN_Draw_HLine(HMI_data.SplitLine_Color, px(0), py(yp), DWIN_WIDTH - 2 * mx) #define DrawMeshHLine(yp) dwinDrawHLine(HMI_data.SplitLine_Color, px(0), py(yp), DWIN_WIDTH - 2 * mx)
#define DrawMeshVLine(xp) DWIN_Draw_VLine(HMI_data.SplitLine_Color, px(xp), py(sizey - 1), DWIN_WIDTH - 2 * my) #define DrawMeshVLine(xp) dwinDrawVLine(HMI_data.SplitLine_Color, px(xp), py(sizey - 1), DWIN_WIDTH - 2 * my)
int16_t maxz =-32000; int16_t minz = 32000; int16_t maxz =-32000; int16_t minz = 32000;
for (uint8_t y = 0; y < sizey; ++y) for (uint8_t x = 0; x < sizex; ++x) { for (uint8_t y = 0; y < sizey; ++y) for (uint8_t x = 0; x < sizex; ++x) {
const float v = isnan(zval[x][y]) ? 0 : round(zval[x][y] * 100); const float v = isnan(zval[x][y]) ? 0 : round(zval[x][y] * 100);
@@ -69,7 +69,7 @@ void MeshViewerClass::DrawMesh(bed_mesh_t zval, const uint8_t sizex, const uint8
max = (float)maxz / 100; max = (float)maxz / 100;
min = (float)minz / 100; min = (float)minz / 100;
DWINUI::ClearMainArea(); DWINUI::ClearMainArea();
DWIN_Draw_Rectangle(0, HMI_data.SplitLine_Color, px(0), py(0), px(sizex - 1), py(sizey - 1)); dwinDrawRectangle(0, HMI_data.SplitLine_Color, px(0), py(0), px(sizex - 1), py(sizey - 1));
for (uint8_t x = 1; x < sizex - 1; ++x) DrawMeshVLine(x); for (uint8_t x = 1; x < sizex - 1; ++x) DrawMeshVLine(x);
for (uint8_t y = 1; y < sizey - 1; ++y) DrawMeshHLine(y); for (uint8_t y = 1; y < sizey - 1; ++y) DrawMeshHLine(y);
for (uint8_t y = 0; y < sizey; ++y) { for (uint8_t y = 0; y < sizey; ++y) {
@@ -93,7 +93,7 @@ void MeshViewerClass::DrawMesh(bed_mesh_t zval, const uint8_t sizex, const uint8
sprintf_P(str_1, PSTR("-.%02i"), -zmesh[x][y]); sprintf_P(str_1, PSTR("-.%02i"), -zmesh[x][y]);
break; break;
case 0: case 0:
DWIN_Draw_String(false, font6x12, DWINUI::textcolor, DWINUI::backcolor, px(x) - 4, py(y) - 6, "0"); dwinDrawString(false, font6x12, DWINUI::textcolor, DWINUI::backcolor, px(x) - 4, py(y) - 6, "0");
break; break;
case 1 ... 99: case 1 ... 99:
sprintf_P(str_1, PSTR(".%02i"), zmesh[x][y]); sprintf_P(str_1, PSTR(".%02i"), zmesh[x][y]);
@@ -103,7 +103,7 @@ void MeshViewerClass::DrawMesh(bed_mesh_t zval, const uint8_t sizex, const uint8
break; break;
} }
if (str_1[0]) if (str_1[0])
DWIN_Draw_String(false, font6x12, DWINUI::textcolor, DWINUI::backcolor, px(x) - 12, py(y) - 6, str_1); dwinDrawString(false, font6x12, DWINUI::textcolor, DWINUI::backcolor, px(x) - 12, py(y) - 6, str_1);
} }
} }
} }
@@ -121,7 +121,7 @@ void MeshViewerClass::Draw(bool withsave /*= false*/) {
if (withsave) { if (withsave) {
DWINUI::Draw_Button(BTN_Save, 26, 305); DWINUI::Draw_Button(BTN_Save, 26, 305);
DWINUI::Draw_Button(BTN_Continue, 146, 305); DWINUI::Draw_Button(BTN_Continue, 146, 305);
Draw_Select_Highlight(HMI_flag.select_flag, 305); Draw_Select_Highlight(hmiFlag.select_flag, 305);
} }
else else
DWINUI::Draw_Button(BTN_Continue, 86, 305); DWINUI::Draw_Button(BTN_Continue, 86, 305);
@@ -138,7 +138,7 @@ void MeshViewerClass::Draw(bool withsave /*= false*/) {
} }
void Draw_MeshViewer() { MeshViewer.Draw(true); } void Draw_MeshViewer() { MeshViewer.Draw(true); }
void onClick_MeshViewer() { if (HMI_flag.select_flag) SaveMesh(); HMI_ReturnScreen(); } void onClick_MeshViewer() { if (hmiFlag.select_flag) SaveMesh(); HMI_ReturnScreen(); }
void Goto_MeshViewer() { if (leveling_is_valid()) Goto_Popup(Draw_MeshViewer, onClick_MeshViewer); else HMI_ReturnScreen(); } void Goto_MeshViewer() { if (leveling_is_valid()) Goto_Popup(Draw_MeshViewer, onClick_MeshViewer); else HMI_ReturnScreen(); }
#endif // DWIN_LCD_PROUI && HAS_MESH #endif // DWIN_LCD_PROUI && HAS_MESH

View File

@@ -54,22 +54,22 @@ void PlotClass::Draw(const frame_rect_t &frame, const celsius_t max, const_float
y2 = frame.y + frame.h - 1; y2 = frame.y + frame.h - 1;
r = round((y2) - ref * scale); r = round((y2) - ref * scale);
DWINUI::Draw_Box(1, Plot_Bg_Color, frame); DWINUI::Draw_Box(1, Plot_Bg_Color, frame);
for (uint8_t i = 1; i < 4; i++) if (i * 50 < frame.w) DWIN_Draw_VLine(Line_Color, i * 50 + frame.x, frame.y, frame.h); for (uint8_t i = 1; i < 4; i++) if (i * 50 < frame.w) dwinDrawVLine(Line_Color, i * 50 + frame.x, frame.y, frame.h);
DWINUI::Draw_Box(0, Color_White, DWINUI::ExtendFrame(frame, 1)); DWINUI::Draw_Box(0, Color_White, DWINUI::ExtendFrame(frame, 1));
DWIN_Draw_HLine(Color_Red, frame.x, r, frame.w); dwinDrawHLine(Color_Red, frame.x, r, frame.w);
} }
void PlotClass::Update(const_float_t value) { void PlotClass::Update(const_float_t value) {
if (!scale) return; if (!scale) return;
const uint16_t y = round((y2) - value * scale); const uint16_t y = round((y2) - value * scale);
if (grphpoints < grphframe.w) { if (grphpoints < grphframe.w) {
DWIN_Draw_Point(Color_Yellow, 1, 1, grphpoints + grphframe.x, y); dwinDrawPoint(Color_Yellow, 1, 1, grphpoints + grphframe.x, y);
} }
else { else {
DWIN_Frame_AreaMove(1, 0, 1, Plot_Bg_Color, grphframe.x, grphframe.y, x2, y2); dwinFrameAreaMove(1, 0, 1, Plot_Bg_Color, grphframe.x, grphframe.y, x2, y2);
if ((grphpoints % 50) == 0) DWIN_Draw_VLine(Line_Color, x2 - 1, grphframe.y + 1, grphframe.h - 2); if ((grphpoints % 50) == 0) dwinDrawVLine(Line_Color, x2 - 1, grphframe.y + 1, grphframe.h - 2);
DWIN_Draw_Point(Color_Red, 1, 1, x2 - 1, r); dwinDrawPoint(Color_Red, 1, 1, x2 - 1, r);
DWIN_Draw_Point(Color_Yellow, 1, 1, x2 - 1, y); dwinDrawPoint(Color_Yellow, 1, 1, x2 - 1, y);
} }
grphpoints++; grphpoints++;
} }

View File

@@ -82,7 +82,7 @@ void Goto_PrintStats() {
// Print Stats Reset popup // Print Stats Reset popup
void Popup_ResetStats() { DWIN_Popup_ConfirmCancel(ICON_Info_0, GET_TEXT_F(MSG_RESET_STATS)); } void Popup_ResetStats() { DWIN_Popup_ConfirmCancel(ICON_Info_0, GET_TEXT_F(MSG_RESET_STATS)); }
void OnClick_ResetStats() { void OnClick_ResetStats() {
if (HMI_flag.select_flag) PrintStatsClass::Reset(); if (hmiFlag.select_flag) PrintStatsClass::Reset();
HMI_ReturnScreen(); HMI_ReturnScreen();
} }
void PrintStatsReset() { Goto_Popup(Popup_ResetStats, OnClick_ResetStats); } void PrintStatsReset() { Goto_Popup(Popup_ResetStats, OnClick_ResetStats); }

View File

@@ -1667,7 +1667,7 @@ void MarlinUI::init() {
TERN_(HOST_PROMPT_SUPPORT, hostui.prompt_open(PROMPT_INFO, F("UI Aborted"), FPSTR(DISMISS_STR))); TERN_(HOST_PROMPT_SUPPORT, hostui.prompt_open(PROMPT_INFO, F("UI Aborted"), FPSTR(DISMISS_STR)));
LCD_MESSAGE(MSG_PRINT_ABORTED); LCD_MESSAGE(MSG_PRINT_ABORTED);
TERN_(HAS_MARLINUI_MENU, return_to_status()); TERN_(HAS_MARLINUI_MENU, return_to_status());
TERN_(DWIN_LCD_PROUI, HMI_flag.abort_flag = true); TERN_(DWIN_LCD_PROUI, hmiFlag.abort_flag = true);
} }
#if ALL(HAS_MARLINUI_MENU, PSU_CONTROL) #if ALL(HAS_MARLINUI_MENU, PSU_CONTROL)