Skip to content

Commit

Permalink
🎨 Misc. LCD cleanup (MarlinFirmware#25400)
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead authored and EvilGremlin committed Apr 8, 2023
1 parent 5aebd41 commit 154aca7
Show file tree
Hide file tree
Showing 76 changed files with 541 additions and 951 deletions.
2 changes: 1 addition & 1 deletion Marlin/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -2096,7 +2096,7 @@
#define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping
#if ENABLED(BABYSTEP_ZPROBE_OFFSET)
//#define BABYSTEP_HOTEND_Z_OFFSET // For multiple hotends, babystep relative Z offsets
//#define BABYSTEP_ZPROBE_GFX_OVERLAY // Enable graphical overlay on Z-offset editor
//#define BABYSTEP_GFX_OVERLAY // Enable graphical overlay on Z-offset editor
#endif
#endif

Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/feature/bedlevel/abl/bbl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ void LevelingBilinear::extrapolate_unprobed_bed_level() {
}
}

void LevelingBilinear::print_leveling_grid(const bed_mesh_t* _z_values /*= NULL*/) {
void LevelingBilinear::print_leveling_grid(const bed_mesh_t* _z_values/*=nullptr*/) {
// print internal grid(s) or just the one passed as a parameter
SERIAL_ECHOLNPGM("Bilinear Leveling Grid:");
print_2d_array(GRID_MAX_POINTS_X, GRID_MAX_POINTS_Y, 3, _z_values ? *_z_values[0] : z_values[0]);
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/feature/bedlevel/abl/bbl.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class LevelingBilinear {
static void reset();
static void set_grid(const xy_pos_t& _grid_spacing, const xy_pos_t& _grid_start);
static void extrapolate_unprobed_bed_level();
static void print_leveling_grid(const bed_mesh_t* _z_values = NULL);
static void print_leveling_grid(const bed_mesh_t *_z_values=nullptr);
static void refresh_bed_level();
static bool has_mesh() { return !!grid_spacing.x; }
static bool mesh_is_valid() { return has_mesh(); }
Expand Down
10 changes: 6 additions & 4 deletions Marlin/src/inc/SanityCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -670,6 +670,8 @@
#error "MILLISECONDS_PREHEAT_TIME is now PREHEAT_TIME_HOTEND_MS."
#elif defined(EXPERIMENTAL_SCURVE)
#error "EXPERIMENTAL_SCURVE is no longer needed and should be removed."
#elif defined(BABYSTEP_ZPROBE_GFX_OVERLAY)
#error "BABYSTEP_ZPROBE_GFX_OVERLAY is now BABYSTEP_GFX_OVERLAY."
#endif

// L64xx stepper drivers have been removed
Expand Down Expand Up @@ -1042,10 +1044,10 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE, "Movement bounds (X_MIN_POS, X_MAX_POS
#error "MESH_BED_LEVELING and BABYSTEP_ZPROBE_OFFSET is not a valid combination"
#elif ENABLED(BABYSTEP_ZPROBE_OFFSET) && !HAS_BED_PROBE
#error "BABYSTEP_ZPROBE_OFFSET requires a probe."
#elif ENABLED(BABYSTEP_ZPROBE_GFX_OVERLAY) && NONE(HAS_MARLINUI_U8GLIB, IS_DWIN_MARLINUI)
#error "BABYSTEP_ZPROBE_GFX_OVERLAY requires a Graphical LCD."
#elif ENABLED(BABYSTEP_ZPROBE_GFX_OVERLAY) && DISABLED(BABYSTEP_ZPROBE_OFFSET)
#error "BABYSTEP_ZPROBE_GFX_OVERLAY requires a BABYSTEP_ZPROBE_OFFSET."
#elif ENABLED(BABYSTEP_GFX_OVERLAY) && NONE(HAS_MARLINUI_U8GLIB, IS_DWIN_MARLINUI)
#error "BABYSTEP_GFX_OVERLAY requires a Graphical LCD."
#elif ENABLED(BABYSTEP_GFX_OVERLAY) && DISABLED(BABYSTEP_ZPROBE_OFFSET)
#error "BABYSTEP_GFX_OVERLAY requires a BABYSTEP_ZPROBE_OFFSET."
#elif ENABLED(BABYSTEP_HOTEND_Z_OFFSET) && !HAS_HOTEND_OFFSET
#error "BABYSTEP_HOTEND_Z_OFFSET requires 2 or more HOTENDS."
#elif BOTH(BABYSTEP_ALWAYS_AVAILABLE, MOVE_Z_WHEN_IDLE)
Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/lcd/dogm/marlinui_DOGM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,7 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop

#endif // AUTO_BED_LEVELING_UBL

#if EITHER(BABYSTEP_ZPROBE_GFX_OVERLAY, MESH_EDIT_GFX_OVERLAY)
#if EITHER(BABYSTEP_GFX_OVERLAY, MESH_EDIT_GFX_OVERLAY)

//
// Draw knob rotation => Z motion key for:
Expand Down Expand Up @@ -746,7 +746,7 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop
}
}

#endif // BABYSTEP_ZPROBE_GFX_OVERLAY || MESH_EDIT_GFX_OVERLAY
#endif // BABYSTEP_GFX_OVERLAY || MESH_EDIT_GFX_OVERLAY

#endif // HAS_MARLINUI_MENU

Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/lcd/e3v2/marlinui/ui_common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,7 @@ void MarlinUI::draw_status_message(const bool blink) {

#endif // AUTO_BED_LEVELING_UBL

#if EITHER(BABYSTEP_ZPROBE_GFX_OVERLAY, MESH_EDIT_GFX_OVERLAY)
#if EITHER(BABYSTEP_GFX_OVERLAY, MESH_EDIT_GFX_OVERLAY)

void MarlinUI::zoffset_overlay(const int8_t dir) {
const int rot_up = TERN(OVERLAY_GFX_REVERSE, ICON_RotateCCW, ICON_RotateCW),
Expand All @@ -587,7 +587,7 @@ void MarlinUI::draw_status_message(const bool blink) {
DWIN_ICON_Show(ICON, rot_up, LCD_PIXEL_WIDTH - 10 - 48, arrow_y);
}

#endif // BABYSTEP_ZPROBE_GFX_OVERLAY || MESH_EDIT_GFX_OVERLAY
#endif // BABYSTEP_GFX_OVERLAY || MESH_EDIT_GFX_OVERLAY

#endif // HAS_MARLINUI_MENU

Expand Down
16 changes: 0 additions & 16 deletions Marlin/src/lcd/e3v2/proui/dwin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1271,7 +1271,6 @@ void EachMomentUpdate() {

if ((Printing() != HMI_flag.printing_flag) && !HMI_flag.home_flag) {
HMI_flag.printing_flag = Printing();
DEBUG_ECHOLNPGM("printing_flag: ", HMI_flag.printing_flag);
if (HMI_flag.printing_flag)
DWIN_Print_Started();
else if (HMI_flag.abort_flag)
Expand All @@ -1282,7 +1281,6 @@ void EachMomentUpdate() {

if ((printingIsPaused() != HMI_flag.pause_flag) && !HMI_flag.home_flag) {
HMI_flag.pause_flag = printingIsPaused();
DEBUG_ECHOLNPGM("pause_flag: ", HMI_flag.pause_flag);
if (HMI_flag.pause_flag)
DWIN_Print_Pause();
else if (HMI_flag.abort_flag)
Expand Down Expand Up @@ -1628,7 +1626,6 @@ void DWIN_LevelingDone() {

// Started a Print Job
void DWIN_Print_Started() {
DEBUG_ECHOLNPGM("DWIN_Print_Started: ", SD_Printing());
TERN_(HAS_GCODE_PREVIEW, if (Host_Printing()) Preview_Invalidate());
_percent_done = 0;
_remain_time = 0;
Expand All @@ -1642,20 +1639,17 @@ void DWIN_Print_Started() {

// Pause a print job
void DWIN_Print_Pause() {
DEBUG_ECHOLNPGM("DWIN_Print_Pause");
ICON_ResumeOrPause();
}

// Resume print job
void DWIN_Print_Resume() {
DEBUG_ECHOLNPGM("DWIN_Print_Resume");
ICON_ResumeOrPause();
LCD_MESSAGE(MSG_RESUME_PRINT);
}

// Ended print job
void DWIN_Print_Finished() {
DEBUG_ECHOLNPGM("DWIN_Print_Finished");
TERN_(POWER_LOSS_RECOVERY, if (card.isPrinting()) recovery.cancel());
HMI_flag.pause_flag = false;
wait_for_heatup = false;
Expand All @@ -1666,7 +1660,6 @@ void DWIN_Print_Finished() {

// Print was aborted
void DWIN_Print_Aborted() {
DEBUG_ECHOLNPGM("DWIN_Print_Aborted");
DWIN_Print_Finished();
}

Expand Down Expand Up @@ -1714,7 +1707,6 @@ void DWIN_SetColorDefaults() {
}

void DWIN_SetDataDefaults() {
DEBUG_ECHOLNPGM("DWIN_SetDataDefaults");
DWIN_SetColorDefaults();
DWINUI::SetColors(HMI_data.Text_Color, HMI_data.Background_Color, HMI_data.StatusBg_Color);
TERN_(PIDTEMP, HMI_data.HotendPidT = DEF_HOTENDPIDT);
Expand All @@ -1738,13 +1730,10 @@ void DWIN_SetDataDefaults() {
}

void DWIN_CopySettingsTo(char * const buff) {
DEBUG_ECHOLNPGM("DWIN_CopySettingsTo");
DEBUG_ECHOLNPGM("HMI_data: ", sizeof(HMI_data_t));
memcpy(buff, &HMI_data, eeprom_data_size);
}

void DWIN_CopySettingsFrom(const char * const buff) {
DEBUG_ECHOLNPGM("DWIN_CopySettingsFrom");
memcpy(&HMI_data, buff, sizeof(HMI_data_t));
if (HMI_data.Text_Color == HMI_data.Background_Color) DWIN_SetColorDefaults();
DWINUI::SetColors(HMI_data.Text_Color, HMI_data.Background_Color, HMI_data.StatusBg_Color);
Expand All @@ -1764,18 +1753,14 @@ void DWIN_CopySettingsFrom(const char * const buff) {

// Initialize or re-initialize the LCD
void MarlinUI::init_lcd() {
DEBUG_ECHOLNPGM("MarlinUI::init_lcd");
delay(750); // wait to wakeup screen
const bool hs = DWIN_Handshake(); UNUSED(hs);
DEBUG_ECHOPGM("DWIN_Handshake ");
DEBUG_ECHOLNF(hs ? F("ok.") : F("error."));
DWIN_Frame_SetDir(1);
DWIN_JPG_CacheTo1(Language_English);
Encoder_Configuration();
}

void DWIN_InitScreen() {
DEBUG_ECHOLNPGM("DWIN_InitScreen");
DWIN_SetColorDefaults();
HMI_Init(); // draws boot screen
DWINUI::init();
Expand Down Expand Up @@ -2034,7 +2019,6 @@ void AutoHome() { queue.inject_P(G28_STR); }
#if EITHER(BABYSTEP_ZPROBE_OFFSET, JUST_BABYSTEP)
const_float_t step_zoffset = round((MenuData.Value / 100.0f) * planner.settings.axis_steps_per_mm[Z_AXIS]) - babystep.accum;
if (BABYSTEP_ALLOWED()) babystep.add_steps(Z_AXIS, step_zoffset);
//DEBUG_ECHOLNF(F("BB Steps: "), step_zoffset);
#endif
}
void SetZOffset() {
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/lcd/e3v2/proui/gcode_preview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ bool Has_Preview() {
Get_Value(buf, ";MAXZ:", fileprop.height);
fileprop.height -= tmp;
posptr = strstr(buf, tbstart);
if (posptr != NULL) {
if (posptr != nullptr) {
fileprop.thumbstart = indx + (posptr - &buf[0]);
}
else {
Expand Down
16 changes: 2 additions & 14 deletions Marlin/src/lcd/extui/anycubic_chiron/FileNavigator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ char FileNavigator::currentfoldername[MAX_PATH_LEN + 1]; // Current folde
FileNavigator::FileNavigator() { reset(); }

void FileNavigator::reset() {
DEBUG_ECHOLNPGM("reset()");
currentfoldername[0] = '\0';
currentfolderdepth = 0;
currentindex = 0;
Expand All @@ -86,7 +85,6 @@ void FileNavigator::refresh() { filelist.refresh(); }

void FileNavigator::changeDIR(const char *folder) {
if (currentfolderdepth >= MAX_FOLDER_DEPTH) return; // limit the folder depth
DEBUG_ECHOLNPGM("FD:" , folderdepth, " FP:",currentindex, " currentfolder:", currentfoldername, " enter:", folder);
currentfolderindex[currentfolderdepth] = currentindex;
strcat(currentfoldername, folder);
strcat(currentfoldername, "/");
Expand All @@ -96,7 +94,6 @@ void FileNavigator::changeDIR(const char *folder) {
}

void FileNavigator::upDIR() {
DEBUG_ECHOLNPGM("upDIR() from D:", currentfolderdepth, " N:", currentfoldername);
if (!filelist.isAtRootDir()) {
filelist.upDir();
currentfolderdepth--;
Expand All @@ -117,7 +114,6 @@ void FileNavigator::skiptofileindex(uint16_t skip) {
if (skip == 0) return;
while (skip > 0) {
if (filelist.seek(currentindex)) {
DEBUG_ECHOLNPGM("CI:", currentindex, " FD:", currentfolderdepth, " N:", skip, " ", filelist.longFilename());
if (!filelist.isDir()) {
skip--;
currentindex++;
Expand Down Expand Up @@ -151,8 +147,6 @@ void FileNavigator::skiptofileindex(uint16_t skip) {
}
lastpanelindex = index;

DEBUG_ECHOLNPGM("index=", index, " currentindex=", currentindex);

if (currentindex == 0 && currentfolderdepth > 0) { // Add a link to go up a folder
// The new panel ignores entries that don't end in .GCO or .gcode so add and pad them.
if (paneltype <= AC_panel_new) {
Expand All @@ -166,12 +160,8 @@ void FileNavigator::skiptofileindex(uint16_t skip) {
filesneeded--;
}

for (uint16_t seek = currentindex; seek < currentindex + filesneeded; seek++) {
if (filelist.seek(seek)) {
sendFile(paneltype);
DEBUG_ECHOLNPGM("-", seek, " '", filelist.longFilename(), "' '", currentfoldername, "", filelist.shortFilename(), "'");
}
}
for (uint16_t seek = currentindex; seek < currentindex + filesneeded; seek++)
if (filelist.seek(seek)) sendFile(paneltype);
}

void FileNavigator::sendFile(panel_type_t paneltype) {
Expand Down Expand Up @@ -212,7 +202,6 @@ void FileNavigator::skiptofileindex(uint16_t skip) {
#else // Flat file list

void FileNavigator::getFiles(uint16_t index, panel_type_t paneltype, uint8_t filesneeded) {
DEBUG_ECHOLNPGM("getFiles() I:", index," L:", lastpanelindex);
// if we're searching backwards, jump back to start and search forward
if (index < lastpanelindex) {
reset();
Expand Down Expand Up @@ -248,7 +237,6 @@ void FileNavigator::skiptofileindex(uint16_t skip) {
TFTSer.println(filelist.shortFilename());
if (currentfolderdepth > 0) TFTSer.print(currentfoldername);
TFTSer.println(filelist.longFilename());
DEBUG_ECHOLNPGM("/", currentfoldername, "", filelist.shortFilename(), " ", filelist.longFilename());
}

#endif // Flat file list
Expand Down
6 changes: 3 additions & 3 deletions Marlin/src/lcd/extui/anycubic_i3mega/anycubic_i3mega_lcd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -704,7 +704,7 @@ void AnycubicTFTClass::GetCommandFromTFT() {
break;

case 16: { // A16 set hotend temp
unsigned int tempvalue;
uint16_t tempvalue;
if (CodeSeen('S')) {
tempvalue = constrain(CodeValue(), 0, 275);
setTargetTemp_celsius(tempvalue, (extruder_t)E0);
Expand All @@ -719,7 +719,7 @@ void AnycubicTFTClass::GetCommandFromTFT() {
break;

case 17: { // A17 set heated bed temp
unsigned int tempbed;
uint16_t tempbed;
if (CodeSeen('S')) {
tempbed = constrain(CodeValue(), 0, 100);
setTargetTemp_celsius(tempbed, (heater_t)BED);
Expand Down Expand Up @@ -777,7 +777,7 @@ void AnycubicTFTClass::GetCommandFromTFT() {
case 22: // A22 move X/Y/Z or extrude
if (!isPrinting()) {
float coorvalue;
unsigned int movespeed = 0;
uint16_t movespeed = 0;
char commandStr[30];
char fullCommandStr[38];

Expand Down
9 changes: 0 additions & 9 deletions Marlin/src/lcd/extui/dgus/DGUSDisplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@ void DGUSDisplay::ProcessRx() {
if (!LCD_SERIAL.available() && LCD_SERIAL.buffer_overruns()) {
// Overrun, but reset the flag only when the buffer is empty
// We want to extract as many as valid datagrams possible...
DEBUG_ECHOPGM("OVFL");
rx_datagram_state = DGUS_IDLE;
//LCD_SERIAL.reset_rx_overun();
LCD_SERIAL.flush();
Expand Down Expand Up @@ -205,17 +204,11 @@ void DGUSDisplay::ProcessRx() {
| Command DataLen (in Words) */
if (command == DGUS_CMD_READVAR) {
const uint16_t vp = tmp[0] << 8 | tmp[1];
//const uint8_t dlen = tmp[2] << 1; // Convert to Bytes. (Display works with words)
//DEBUG_ECHOPGM(" vp=", vp, " dlen=", dlen);
DGUS_VP_Variable ramcopy;
if (populate_VPVar(vp, &ramcopy)) {
if (ramcopy.set_by_display_handler)
ramcopy.set_by_display_handler(ramcopy, &tmp[3]);
else
DEBUG_ECHOLNPGM(" VPVar found, no handler.");
}
else
DEBUG_ECHOLNPGM(" VPVar not found:", vp);

rx_datagram_state = DGUS_IDLE;
break;
Expand Down Expand Up @@ -260,9 +253,7 @@ bool DGUSDisplay::Initialized = false,
#define sw_barrier() asm volatile("": : :"memory");

bool populate_VPVar(const uint16_t VP, DGUS_VP_Variable * const ramcopy) {
//DEBUG_ECHOPGM("populate_VPVar ", VP);
const DGUS_VP_Variable *pvp = DGUSLCD_FindVPVar(VP);
//DEBUG_ECHOLNPGM(" pvp ", (uint16_t )pvp);
if (!pvp) return false;
memcpy_P(ramcopy, pvp, sizeof(DGUS_VP_Variable));
return true;
Expand Down
Loading

0 comments on commit 154aca7

Please sign in to comment.