Skip to content

Commit

Permalink
semi-related LCD cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Feb 18, 2023
1 parent 550c936 commit f0cc8bd
Show file tree
Hide file tree
Showing 31 changed files with 499 additions and 901 deletions.
2 changes: 1 addition & 1 deletion Marlin/Configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -3049,7 +3049,7 @@
#if DGUS_UI_IS(MKS)
#define USE_MKS_GREEN_UI
#elif DGUS_UI_IS(IA_CREALITY)
//#define ROTATE_0_POINT //Portrait Mode or 800x480 displays
//#define LCD_SCREEN_ROTATE 90 // Portrait Mode or 800x480 displays
#endif

//
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
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 f0cc8bd

Please sign in to comment.