🧑💻 Misc. LCD cleanup
This commit is contained in:
@ -33,7 +33,7 @@
|
||||
//#define USE_STRING_HEADINGS
|
||||
//#define USE_STRING_TITLES
|
||||
|
||||
#if ENABLED(LCD_BED_LEVELING) && DISABLED(PROBE_MANUALLY) && ANY(AUTO_BED_LEVELING_BILINEAR, AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_3POINT)
|
||||
#if DISABLED(PROBE_MANUALLY) && ANY(AUTO_BED_LEVELING_BILINEAR, AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_3POINT)
|
||||
#define HAS_ONESTEP_LEVELING 1
|
||||
#endif
|
||||
|
||||
@ -1366,8 +1366,6 @@ void HMI_Move_Z() {
|
||||
|
||||
#if HAS_ZOFFSET_ITEM
|
||||
|
||||
bool printer_busy() { return planner.movesplanned() || printingIsActive(); }
|
||||
|
||||
void HMI_Zoffset() {
|
||||
EncoderState encoder_diffState = Encoder_ReceiveAnalyze();
|
||||
if (encoder_diffState == ENCODER_DIFF_NO) return;
|
||||
|
@ -432,7 +432,7 @@ void Draw_Back_First(const bool is_sel=true) {
|
||||
//PopUps
|
||||
void Popup_window_PauseOrStop() {
|
||||
if (HMI_IsChinese()) {
|
||||
DWINUI::ClearMenuArea();
|
||||
DWINUI::ClearMainArea();
|
||||
Draw_Popup_Bkgd();
|
||||
if (select_print.now == PRINT_PAUSE_RESUME) DWIN_Frame_AreaCopy(1, 237, 338, 269, 356, 98, 150);
|
||||
else if (select_print.now == PRINT_STOP) DWIN_Frame_AreaCopy(1, 221, 320, 253, 336, 98, 150);
|
||||
@ -451,7 +451,7 @@ void Popup_window_PauseOrStop() {
|
||||
void Popup_Window_ETempTooLow() {
|
||||
if (HMI_IsChinese()) {
|
||||
HMI_SaveProcessID(WaitResponse);
|
||||
DWINUI::ClearMenuArea();
|
||||
DWINUI::ClearMainArea();
|
||||
Draw_Popup_Bkgd();
|
||||
DWINUI::Draw_Icon(ICON_TempTooLow, 102, 105);
|
||||
DWIN_Frame_AreaCopy(1, 103, 371, 136, 386, 69, 240);
|
||||
@ -469,7 +469,7 @@ void Popup_window_PauseOrStop() {
|
||||
void DWIN_Popup_Temperature(const bool toohigh) {
|
||||
HMI_SaveProcessID(WaitResponse);
|
||||
if (HMI_IsChinese()) {
|
||||
DWINUI::ClearMenuArea();
|
||||
DWINUI::ClearMainArea();
|
||||
Draw_Popup_Bkgd();
|
||||
if (toohigh) {
|
||||
DWINUI::Draw_Icon(ICON_TempTooHigh, 102, 165);
|
||||
@ -579,13 +579,13 @@ void Draw_Print_ProgressBar() {
|
||||
void Draw_Print_ProgressElapsed() {
|
||||
char buf[10];
|
||||
duration_t elapsed = print_job_timer.duration(); // print timer
|
||||
sprintf_P(buf, PSTR("%02i:%02i"), (uint16_t)(elapsed.value / 3600), ((uint16_t)elapsed.value % 3600) / 60);
|
||||
sprintf_P(buf, PSTR("%02i:%02i "), (uint16_t)(elapsed.value / 3600), ((uint16_t)elapsed.value % 3600) / 60);
|
||||
DWINUI::Draw_String(HMI_data.Text_Color, HMI_data.Background_Color, 47, 192, buf);
|
||||
}
|
||||
|
||||
void Draw_Print_ProgressRemain() {
|
||||
char buf[10];
|
||||
sprintf_P(buf, PSTR("%02i:%02i"), (uint16_t)(_remain_time / 3600), ((uint16_t)_remain_time % 3600) / 60);
|
||||
sprintf_P(buf, PSTR("%02i:%02i "), (uint16_t)(_remain_time / 3600), ((uint16_t)_remain_time % 3600) / 60);
|
||||
DWINUI::Draw_String(HMI_data.Text_Color, HMI_data.Background_Color, 181, 192, buf);
|
||||
}
|
||||
|
||||
@ -612,7 +612,7 @@ void Draw_PrintProcess() {
|
||||
Title.FrameCopy(30, 1, 42, 14); // "Printing"
|
||||
else
|
||||
Title.ShowCaption(GET_TEXT_F(MSG_PRINTING));
|
||||
DWINUI::ClearMenuArea();
|
||||
DWINUI::ClearMainArea();
|
||||
DWIN_Print_Header(sdprint ? card.longest_filename() : nullptr);
|
||||
Draw_Print_Labels();
|
||||
DWINUI::Draw_Icon(ICON_PrintTime, 15, 173);
|
||||
@ -641,7 +641,7 @@ void Draw_PrintDone() {
|
||||
_remain_time = 0;
|
||||
|
||||
Title.ShowCaption(GET_TEXT_F(MSG_PRINT_DONE));
|
||||
DWINUI::ClearMenuArea();
|
||||
DWINUI::ClearMainArea();
|
||||
DWIN_Print_Header(nullptr);
|
||||
Draw_Print_ProgressBar();
|
||||
Draw_Print_Labels();
|
||||
@ -663,7 +663,7 @@ void Goto_PrintDone() {
|
||||
}
|
||||
|
||||
void Draw_Main_Menu() {
|
||||
DWINUI::ClearMenuArea();
|
||||
DWINUI::ClearMainArea();
|
||||
if (HMI_IsChinese())
|
||||
Title.FrameCopy(2, 2, 26, 13); // "Home" etc
|
||||
else
|
||||
@ -933,7 +933,7 @@ void Redraw_SD_List() {
|
||||
select_file.reset();
|
||||
index_file = MROWS;
|
||||
|
||||
DWINUI::ClearMenuArea(); // Leave title bar unchanged
|
||||
DWINUI::ClearMainArea(); // Leave title bar unchanged
|
||||
|
||||
Draw_Back_First();
|
||||
|
||||
@ -1041,7 +1041,7 @@ void DWIN_Draw_Dashboard() {
|
||||
}
|
||||
|
||||
void Draw_Info_Menu() {
|
||||
DWINUI::ClearMenuArea();
|
||||
DWINUI::ClearMainArea();
|
||||
Draw_Back_First();
|
||||
if (HMI_IsChinese())
|
||||
Title.FrameCopy(30, 17, 28, 13); // "Info"
|
||||
@ -1107,7 +1107,7 @@ void HMI_MainMenu() {
|
||||
case PAGE_PRINT:
|
||||
checkkey = SelectFile;
|
||||
card.mount();
|
||||
delay(300);
|
||||
safe_delay(300);
|
||||
Draw_Print_File_Menu();
|
||||
break;
|
||||
case PAGE_PREPARE: Draw_Prepare_Menu(); break;
|
||||
@ -1349,8 +1349,8 @@ void HMI_Init() {
|
||||
|
||||
void EachMomentUpdate() {
|
||||
static millis_t next_var_update_ms = 0, next_rts_update_ms = 0, next_status_update_ms = 0;
|
||||
|
||||
const millis_t ms = millis();
|
||||
|
||||
if (ELAPSED(ms, next_var_update_ms)) {
|
||||
next_var_update_ms = ms + DWIN_VAR_UPDATE_INTERVAL;
|
||||
update_variable();
|
||||
@ -1439,7 +1439,7 @@ void EachMomentUpdate() {
|
||||
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
void Popup_PowerLossRecovery() {
|
||||
DWINUI::ClearMenuArea();
|
||||
DWINUI::ClearMainArea();
|
||||
Draw_Popup_Bkgd();
|
||||
if (HMI_IsChinese()) {
|
||||
DWIN_Frame_AreaCopy(1, 160, 338, 235, 354, 98, 115);
|
||||
@ -1478,7 +1478,7 @@ void EachMomentUpdate() {
|
||||
|
||||
void Goto_PowerLossRecovery() {
|
||||
recovery.dwin_flag = false;
|
||||
LCD_MESSAGE_F(GET_TEXT_F(MSG_CONTINUE_PRINT_JOB));
|
||||
LCD_MESSAGE(MSG_CONTINUE_PRINT_JOB);
|
||||
Goto_Popup(Popup_PowerLossRecovery, onClick_PowerLossRecovery);
|
||||
}
|
||||
|
||||
@ -1581,15 +1581,15 @@ void DWIN_PidTuning(pidresult_t result) {
|
||||
break;
|
||||
case PID_BAD_EXTRUDER_NUM:
|
||||
checkkey = last_checkkey;
|
||||
DWIN_Popup_Confirm(ICON_TempTooLow, F("PID Autotune failed!"), F("Bad extruder"));
|
||||
DWIN_Popup_Confirm(ICON_TempTooLow, GET_TEXT_F(MSG_PID_AUTOTUNE_FAILED), GET_TEXT_F(MSG_BAD_EXTRUDER_NUM));
|
||||
break;
|
||||
case PID_TUNING_TIMEOUT:
|
||||
checkkey = last_checkkey;
|
||||
DWIN_Popup_Confirm(ICON_TempTooHigh, F("Error"), GET_TEXT_F(MSG_PID_TIMEOUT));
|
||||
DWIN_Popup_Confirm(ICON_TempTooHigh, GET_TEXT_F(MSG_ERROR), GET_TEXT_F(MSG_PID_TIMEOUT));
|
||||
break;
|
||||
case PID_TEMP_TOO_HIGH:
|
||||
checkkey = last_checkkey;
|
||||
DWIN_Popup_Confirm(ICON_TempTooHigh, F("PID Autotune failed!"), F("Temperature too high"));
|
||||
DWIN_Popup_Confirm(ICON_TempTooHigh, GET_TEXT_F(MSG_PID_AUTOTUNE_FAILED), GET_TEXT_F(MSG_TEMP_TOO_HIGH));
|
||||
break;
|
||||
case PID_DONE:
|
||||
checkkey = last_checkkey;
|
||||
@ -1637,7 +1637,7 @@ void DWIN_Print_Finished() {
|
||||
HMI_flag.pause_flag = false;
|
||||
wait_for_heatup = false;
|
||||
planner.finish_and_disable();
|
||||
thermalManager.cooldown();
|
||||
thermalManager.cooldown();
|
||||
Goto_PrintDone();
|
||||
}
|
||||
|
||||
@ -1652,7 +1652,7 @@ void DWIN_Print_Aborted() {
|
||||
}
|
||||
|
||||
// Progress Bar update
|
||||
void DWIN_Progress_Update() {
|
||||
void DWIN_M73() {
|
||||
if (parser.seenval('P')) _percent_done = parser.byteval('P');
|
||||
if (parser.seenval('R')) {
|
||||
_remain_time = parser.ulongval('R') * 60;
|
||||
@ -1707,11 +1707,11 @@ void DWIN_SetDataDefaults() {
|
||||
TERN_(BAUD_RATE_GCODE, SetBaud250K());
|
||||
}
|
||||
|
||||
void DWIN_StoreSettings(char *buff) {
|
||||
void DWIN_CopySettingsTo(char * const buff) {
|
||||
memcpy(buff, &HMI_data, _MIN(sizeof(HMI_data), eeprom_data_size));
|
||||
}
|
||||
|
||||
void DWIN_LoadSettings(const char *buff) {
|
||||
void DWIN_CopySettingsFrom(const char * const buff) {
|
||||
// (void *)-> Avoid Warning when save data different from uintX_t in HMI_data_t struct
|
||||
memcpy((void *)&HMI_data, buff, _MIN(sizeof(HMI_data), eeprom_data_size));
|
||||
dwin_zoffset = TERN0(HAS_BED_PROBE, probe.offset.z);
|
||||
@ -1729,6 +1729,7 @@ void DWIN_LoadSettings(const char *buff) {
|
||||
// Apply Led Color
|
||||
leds.set_color(HMI_data.Led_Color);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
// Initialize or re-initialize the LCD
|
||||
@ -1773,10 +1774,10 @@ void DWIN_RebootScreen() {
|
||||
DWIN_JPG_ShowAndCache(0);
|
||||
DWINUI::Draw_CenteredString(Color_White, 220, GET_TEXT_F(MSG_PLEASE_WAIT_REBOOT));
|
||||
DWIN_UpdateLCD();
|
||||
delay(500);
|
||||
safe_delay(500);
|
||||
}
|
||||
|
||||
void DWIN_Redraw_screen() {
|
||||
void DWIN_RedrawScreen() {
|
||||
Draw_Main_Area();
|
||||
hash_changed = true;
|
||||
DWIN_DrawStatusMessage();
|
||||
@ -1898,13 +1899,13 @@ void Goto_ConfirmToPrint() {
|
||||
|
||||
void ReadEeprom() {
|
||||
const bool success = settings.load();
|
||||
DWIN_Redraw_screen();
|
||||
DWIN_RedrawScreen();
|
||||
HMI_AudioFeedback(success);
|
||||
}
|
||||
|
||||
void ResetEeprom() {
|
||||
settings.reset();
|
||||
DWIN_Redraw_screen();
|
||||
DWIN_RedrawScreen();
|
||||
HMI_AudioFeedback();
|
||||
}
|
||||
#endif
|
||||
@ -1947,7 +1948,7 @@ void SetHome() {
|
||||
}
|
||||
|
||||
#if HAS_ZOFFSET_ITEM
|
||||
bool printer_busy() { return planner.movesplanned() || printingIsActive(); }
|
||||
|
||||
void ApplyZOffset() { TERN_(EEPROM_SETTINGS, settings.save()); }
|
||||
void LiveZOffset() {
|
||||
last_zoffset = dwin_zoffset;
|
||||
@ -2066,7 +2067,7 @@ void SetPID(celsius_t t, heater_id_t h) {
|
||||
void ApplyBrightness() { ui.set_brightness(MenuData.Value); }
|
||||
void LiveBrightness() { DWIN_LCD_Brightness(MenuData.Value); }
|
||||
void SetBrightness() { SetIntOnClick(LCD_BRIGHTNESS_MIN, LCD_BRIGHTNESS_MAX, ui.brightness, ApplyBrightness, LiveBrightness); }
|
||||
void TurnOffBacklight() { HMI_SaveProcessID(WaitResponse); ui.set_brightness(0); DWIN_Redraw_screen(); }
|
||||
void TurnOffBacklight() { HMI_SaveProcessID(WaitResponse); ui.set_brightness(0); DWIN_RedrawScreen(); }
|
||||
#endif
|
||||
|
||||
#if ENABLED(CASE_LIGHT_MENU)
|
||||
@ -2170,7 +2171,7 @@ void SetPID(celsius_t t, heater_id_t h) {
|
||||
void RestoreDefaultsColors() {
|
||||
DWIN_SetColorDefaults();
|
||||
DWINUI::SetColors(HMI_data.Text_Color, HMI_data.Background_Color, HMI_data.StatusBg_Color);
|
||||
DWIN_Redraw_screen();
|
||||
DWIN_RedrawScreen();
|
||||
}
|
||||
|
||||
void SelColor() {
|
||||
@ -2981,7 +2982,7 @@ void Draw_Prepare_Menu() {
|
||||
}
|
||||
|
||||
void Draw_Tramming_Menu() {
|
||||
DWINUI::ClearMenuArea();
|
||||
DWINUI::ClearMainArea();
|
||||
checkkey = Menu;
|
||||
if (!TrammingMenu) TrammingMenu = new MenuClass();
|
||||
if (CurrentMenu != TrammingMenu) {
|
||||
|
@ -115,7 +115,7 @@ void Goto_PowerLossRecovery();
|
||||
void Goto_ConfirmToPrint();
|
||||
void DWIN_Draw_Dashboard(const bool with_update); // Status Area
|
||||
void Draw_Main_Area(); // Redraw main area;
|
||||
void DWIN_Redraw_screen(); // Redraw all screen elements
|
||||
void DWIN_RedrawScreen(); // Redraw all screen elements
|
||||
void HMI_MainMenu(); // Main process screen
|
||||
void HMI_SelectFile(); // File page
|
||||
void HMI_Printing(); // Print page
|
||||
@ -158,12 +158,12 @@ void DWIN_Print_Aborted();
|
||||
#if HAS_FILAMENT_SENSOR
|
||||
void DWIN_FilamentRunout(const uint8_t extruder);
|
||||
#endif
|
||||
void DWIN_Progress_Update();
|
||||
void DWIN_M73();
|
||||
void DWIN_Print_Header(const char *text);
|
||||
void DWIN_SetColorDefaults();
|
||||
void DWIN_ApplyColor();
|
||||
void DWIN_StoreSettings(char *buff);
|
||||
void DWIN_LoadSettings(const char *buff);
|
||||
void DWIN_CopySettingsTo(char * const buff);
|
||||
void DWIN_CopySettingsFrom(const char * const buff);
|
||||
void DWIN_SetDataDefaults();
|
||||
void DWIN_RebootScreen();
|
||||
|
||||
|
@ -80,7 +80,7 @@
|
||||
|
||||
#define HAS_ESDIAG 1
|
||||
|
||||
#if ENABLED(LED_CONTROL_MENU, HAS_COLOR_LEDS)
|
||||
#if BOTH(LED_CONTROL_MENU, HAS_COLOR_LEDS)
|
||||
#define Def_Leds_Color LEDColorWhite()
|
||||
#endif
|
||||
#if ENABLED(CASELIGHT_USES_BRIGHTNESS)
|
||||
|
@ -50,7 +50,7 @@ inline void Draw_Popup_Bkgd() {
|
||||
|
||||
template<typename T, typename U>
|
||||
void DWIN_Draw_Popup(const uint8_t icon, T amsg1=nullptr, U amsg2=nullptr, uint8_t button=0) {
|
||||
DWINUI::ClearMenuArea();
|
||||
DWINUI::ClearMainArea();
|
||||
Draw_Popup_Bkgd();
|
||||
if (icon) DWINUI::Draw_Icon(icon, 101, 105);
|
||||
if (amsg1) DWINUI::Draw_CenteredString(HMI_data.PopupTxt_Color, 210, amsg1);
|
||||
|
@ -304,7 +304,7 @@ void DWINUI::Draw_Checkbox(uint16_t color, uint16_t bcolor, uint16_t x, uint16_t
|
||||
}
|
||||
|
||||
// Clear Menu by filling the menu area with background color
|
||||
void DWINUI::ClearMenuArea() {
|
||||
void DWINUI::ClearMainArea() {
|
||||
DWIN_Draw_Rectangle(1, backcolor, 0, TITLE_HEIGHT, DWIN_WIDTH - 1, STATUS_Y - 1);
|
||||
}
|
||||
|
||||
|
@ -593,7 +593,7 @@ namespace DWINUI {
|
||||
|
||||
// Clear Menu by filling the area with background color
|
||||
// Area (0, TITLE_HEIGHT, DWIN_WIDTH, STATUS_Y - 1)
|
||||
void ClearMenuArea();
|
||||
void ClearMainArea();
|
||||
|
||||
// Clear MenuItems array and free MenuItems elements
|
||||
void MenuItemsClear();
|
||||
|
@ -71,7 +71,7 @@ void draw_es_state(const bool is_hit) {
|
||||
|
||||
void ESDiagClass::Draw() {
|
||||
Title.ShowCaption(F("End-stops Diagnostic"));
|
||||
DWINUI::ClearMenuArea();
|
||||
DWINUI::ClearMainArea();
|
||||
Draw_Popup_Bkgd();
|
||||
DWINUI::Draw_Button(BTN_Continue, 86, 250);
|
||||
DWINUI::cursor.y = 80;
|
||||
|
@ -50,11 +50,10 @@ void LockScreenClass::init() {
|
||||
}
|
||||
|
||||
void LockScreenClass::draw() {
|
||||
Title.SetCaption(PSTR("Lock Screen"));
|
||||
DWINUI::ClearMenuArea();
|
||||
DWINUI::ClearMainArea();
|
||||
DWINUI::Draw_Icon(ICON_LOGO, 71, 120); // CREALITY logo
|
||||
DWINUI::Draw_CenteredString(Color_White, 180, F("Printer is Locked,"));
|
||||
DWINUI::Draw_CenteredString(Color_White, 200, F("Scroll to unlock."));
|
||||
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, 240, F("-> | <-"));
|
||||
DWIN_Draw_Box(1, HMI_data.Barfill_Color, 0, 260, DWIN_WIDTH, 20);
|
||||
DWIN_Draw_VLine(Color_Yellow, lock_pos * DWIN_WIDTH / 255, 260, 20);
|
||||
|
@ -67,7 +67,7 @@ void MeshViewerClass::DrawMesh(bed_mesh_t zval, const uint8_t sizex, const uint8
|
||||
max = (float)maxz / 100;
|
||||
min = (float)minz / 100;
|
||||
avg = avg / (100 * sizex * sizey);
|
||||
DWINUI::ClearMenuArea();
|
||||
DWINUI::ClearMainArea();
|
||||
DWIN_Draw_Rectangle(0, HMI_data.SplitLine_Color, px(0), py(0), px(sizex - 1), py(sizey - 1));
|
||||
LOOP_S_L_N(x, 1, sizex - 1) DrawMeshVLine(x);
|
||||
LOOP_S_L_N(y, 1, sizey - 1) DrawMeshHLine(y);
|
||||
@ -90,7 +90,7 @@ void MeshViewerClass::DrawMesh(bed_mesh_t zval, const uint8_t sizex, const uint8
|
||||
sprintf_P(str_1, PSTR("-.%02i"), -zmesh[x][y]);
|
||||
break;
|
||||
case 0:
|
||||
DWIN_Draw_String(false, font6x12, DWINUI::textcolor, DWINUI::backcolor, px(x) - 4, py(y) - 6, "0");;
|
||||
DWIN_Draw_String(false, font6x12, DWINUI::textcolor, DWINUI::backcolor, px(x) - 4, py(y) - 6, "0");
|
||||
break;
|
||||
case 1 ... 99:
|
||||
sprintf_P(str_1, PSTR(".%02i"), zmesh[x][y]);
|
||||
@ -107,13 +107,16 @@ void MeshViewerClass::DrawMesh(bed_mesh_t zval, const uint8_t sizex, const uint8
|
||||
}
|
||||
|
||||
void MeshViewerClass::Draw(bool withsave /*= false*/) {
|
||||
Title.ShowCaption(F("Mesh Viewer"));
|
||||
Title.ShowCaption(GET_TEXT_F(MSG_MESH_VIEWER));
|
||||
DrawMesh(Z_VALUES_ARR, GRID_MAX_POINTS_X, GRID_MAX_POINTS_Y);
|
||||
if (withsave) {
|
||||
DWINUI::Draw_Button(BTN_Save, 26, 305);
|
||||
DWINUI::Draw_Button(BTN_Continue, 146, 305);
|
||||
Draw_Select_Highlight(HMI_flag.select_flag, 305);
|
||||
} else DWINUI::Draw_Button(BTN_Continue, 86, 305);
|
||||
}
|
||||
else
|
||||
DWINUI::Draw_Button(BTN_Continue, 86, 305);
|
||||
|
||||
char str_1[6], str_2[6] = "";
|
||||
ui.status_printf(0, F("Mesh minZ: %s, maxZ: %s"),
|
||||
dtostrf(min, 1, 2, str_1),
|
||||
|
@ -50,7 +50,7 @@ void PrintStatsClass::Draw() {
|
||||
constexpr int8_t MRG = 30;
|
||||
|
||||
Title.ShowCaption(GET_TEXT_F(MSG_INFO_STATS_MENU));
|
||||
DWINUI::ClearMenuArea();
|
||||
DWINUI::ClearMainArea();
|
||||
Draw_Popup_Bkgd();
|
||||
DWINUI::Draw_Button(BTN_Continue, 86, 250);
|
||||
printStatistics ps = print_job_timer.getStats();
|
||||
|
Reference in New Issue
Block a user