diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index 73a367636c..92243beeb1 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -16,8 +16,8 @@ //#define MachineCR10 //#define MachineCR10S //#define MachineCR10SPro // Graphics LCD Requires soldering R64 and R66 -#define MachineCRX -//#define MachineCR10Max +//#define MachineCRX +#define MachineCR10Max //#define MachineS4 //#define MachineS5 @@ -36,8 +36,8 @@ //#define ForceCRXDisplay #define Force10SProDisplay //#define AddonFilSensor //Adds a filamnt runout sensor to the CR20 or Ender 4 -#define lerdgeFilSensor //Using lerdge filament sensor, which is opposite polarity to stock -#define DualFilSensors //Using dual filament sensors on XMax and YMAX +//#define lerdgeFilSensor //Using lerdge filament sensor, which is opposite polarity to stock +//#define DualFilSensors //Using dual filament sensors on XMax and YMAX //#define SKR13 // 32 bit board - assumes 2208 drivers //#define SKR13_2209 //#define SKR13_UART // Configure SKR board with drivers in UART mode @@ -2051,7 +2051,7 @@ * Add a bed leveling sub-menu for ABL or MBL. * Include a guided procedure if manual probing is enabled. */ -#if DISABLED(ABL_EZABL, ABL_NCSW, ABL_BLTOUCH) +#if DISABLED(ABL_EZABL, ABL_NCSW, ABL_BLTOUCH) && (DISABLED(MachineCRX) || ENABLED(GraphicLCD)) #define LCD_BED_LEVELING #endif diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index 43fb1f9796..c885ff156d 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -1225,7 +1225,9 @@ #endif #endif - //#define BABYSTEP_DISPLAY_TOTAL // Display total babysteps since last G28 + #if ENABLED(EXTENSIBLE_UI) + #define BABYSTEP_DISPLAY_TOTAL // Display total babysteps since last G28 + #endif #if ANY(ABL_EZABL, ABL_BLTOUCH, ABL_NCSW) #define BABYSTEP_ZPROBE_OFFSET // Combine M851 Z and Babystepping diff --git a/Marlin/src/feature/babystep.cpp b/Marlin/src/feature/babystep.cpp index eb6ed046a4..41d7e80075 100644 --- a/Marlin/src/feature/babystep.cpp +++ b/Marlin/src/feature/babystep.cpp @@ -37,7 +37,7 @@ Babystep babystep; volatile int16_t Babystep::todo[BS_TODO_AXIS(Z_AXIS) + 1]; -#if HAS_LCD_MENU +#if HAS_LCD_MENU || ENABLED(EXTENSIBLE_UI) int16_t Babystep::accum; #if ENABLED(BABYSTEP_DISPLAY_TOTAL) int16_t Babystep::axis_total[BS_TOTAL_AXIS(Z_AXIS) + 1]; @@ -75,7 +75,7 @@ void Babystep::add_steps(const AxisEnum axis, const int16_t distance) { if (!CAN_BABYSTEP(axis)) return; - #if HAS_LCD_MENU + #if HAS_LCD_MENU || ENABLED(EXTENSIBLE_UI) accum += distance; // Count up babysteps for the UI #if ENABLED(BABYSTEP_DISPLAY_TOTAL) axis_total[BS_TOTAL_AXIS(axis)] += distance; diff --git a/Marlin/src/feature/babystep.h b/Marlin/src/feature/babystep.h index 1969e6c9c3..ff3709e5ff 100644 --- a/Marlin/src/feature/babystep.h +++ b/Marlin/src/feature/babystep.h @@ -30,7 +30,7 @@ #define BS_TODO_AXIS(A) 0 #endif -#if HAS_LCD_MENU && ENABLED(BABYSTEP_DISPLAY_TOTAL) +#if (HAS_LCD_MENU || ENABLED(EXTENSIBLE_UI)) && ENABLED(BABYSTEP_DISPLAY_TOTAL) #if ENABLED(BABYSTEP_XY) #define BS_TOTAL_AXIS(A) A #else @@ -41,7 +41,7 @@ class Babystep { public: static volatile int16_t todo[BS_TODO_AXIS(Z_AXIS) + 1]; - #if HAS_LCD_MENU + #if HAS_LCD_MENU || ENABLED(EXTENSIBLE_UI) static int16_t accum; // Total babysteps in current edit #if ENABLED(BABYSTEP_DISPLAY_TOTAL) static int16_t axis_total[BS_TOTAL_AXIS(Z_AXIS) + 1]; // Total babysteps since G28 diff --git a/Marlin/src/lcd/extensible_ui/lib/Creality_DWIN.cpp b/Marlin/src/lcd/extensible_ui/lib/Creality_DWIN.cpp index 4465c58d5b..7e19e512d9 100644 --- a/Marlin/src/lcd/extensible_ui/lib/Creality_DWIN.cpp +++ b/Marlin/src/lcd/extensible_ui/lib/Creality_DWIN.cpp @@ -12,16 +12,11 @@ namespace ExtUI uint8_t progress_bar_percent; int startprogress = 0; CRec CardRecbuf; - int temphot = 0; - //int tempbed=0; - //float pause_z = 0; #if DISABLED(POWER_LOSS_RECOVERY) int power_off_type_yes = 0; int power_off_commands_count = 0; #endif - int last_target_temperature_bed; - int last_target_temperature[4] = {0}; char waitway = 0; int recnum = 0; unsigned char Percentrecord = 0; @@ -32,15 +27,11 @@ namespace ExtUI bool PrintMode = false; //Eco Mode default off char PrintStatue[2] = {0}; //PrintStatue[0], 0 represent to 43 page, 1 represent to 44 page - bool CardUpdate = false; //represents to update file list - char CardCheckStatus[2] = {0}; //CardCheckStatus[0] represents to check card in printing and after making sure to begin and to check card in heating with value as 1, but 0 for off char PrinterStatusKey[2] = {0}; // PrinterStatusKey[1] value: 0 represents to keep temperature, 1 represents to heating , 2 stands for cooling , 3 stands for printing // PrinterStatusKey[0] value: 0 reprensents 3D printer ready - bool lcd_sd_status; //represents SD-card status, true means SD is available, false means opposite. char FilenamesCount = 0; - char cmdbuf[20] = {0}; char FilementStatus[2] = {0}; unsigned char AxisPagenum = 0; //0 for 10mm, 1 for 1mm, 2 for 0.1mm @@ -52,7 +43,6 @@ namespace ExtUI unsigned long VolumeSet = 0x80; extern char power_off_commands[9][96]; bool PoweroffContinue = false; - char commandbuf[30]; bool reEntryPrevent = false; uint8_t idleThrottling = 0; @@ -75,8 +65,6 @@ void onStartup() else rtscheck.RTS_SndData(2, FanKeyIcon + 1); // normal - last_target_temperature_bed = getTargetTemp_celsius(BED); - last_target_temperature[0] = getTargetTemp_celsius(H0); rtscheck.RTS_SndData(100, FeedrateDisplay); /***************turn off motor*****************/ @@ -132,7 +120,7 @@ void onIdle() { if (reEntryPrevent) return; - if(idleThrottling++ < 250){ + if(idleThrottling++ < 1000){ return; } @@ -248,7 +236,7 @@ void onIdle() if ((startprogress += 1) > 200) { #if ENABLED(POWER_LOSS_RECOVERY) - if(lcd_sd_status && (power_off_commands_count > 0)) { + if(isMediaInserted() && (power_off_commands_count > 0)) { for (uint16_t i = 0; i < CardRecbuf.Filesum; i++) { if (!strcmp(CardRecbuf.Cardfilename[i], &power_off_info.sd_filename[1])) @@ -609,54 +597,57 @@ void RTSSHOW::RTS_SndData(unsigned long n, unsigned long addr, unsigned char cmd void RTSSHOW::RTS_SDCardUpate(bool removed, bool inserted) { - SERIAL_ECHOLN("SDUpdate"); + bool shouldCheck; + if(!removed && !inserted) + shouldCheck = isMediaInserted(); + else + shouldCheck = false; - if (inserted || isMediaInserted()) + if (inserted || shouldCheck) { - ExtUI::FileList files; - files.count(); + ExtUI::FileList files; + files.count(); - int addrnum = 0; - int num = 0; - for (uint16_t i = 0; i < files.count() && i < (uint16_t)MaxFileNumber + addrnum; i++) - { - files.seek(i); - files.filename(); - const char *pointFilename = files.longFilename(); - int filenamelen = strlen(files.longFilename()); - int j = 1; - while ((strncmp(&pointFilename[j], ".gcode", 6) && strncmp(&pointFilename[j], ".GCODE", 6)) && (j++) < filenamelen) - ; - if (j >= filenamelen) - { - addrnum++; - continue; - } + int addrnum = 0; + int num = 0; + for (uint16_t i = 0; i < files.count() && i < (uint16_t)MaxFileNumber + addrnum; i++) + { + files.seek(i); + files.filename(); + const char *pointFilename = files.longFilename(); + int filenamelen = strlen(files.longFilename()); + int j = 1; + while ((strncmp(&pointFilename[j], ".gcode", 6) && strncmp(&pointFilename[j], ".GCODE", 6)) && (j++) < filenamelen) + ; + if (j >= filenamelen) + { + addrnum++; + continue; + } - if (j >= TEXTBYTELEN) - { - //strncpy(&files.longFilename[TEXTBYTELEN -3],"~~",2); - //files.longFilename()[TEXTBYTELEN-1] = '\0'; - j = TEXTBYTELEN - 1; - } + if (j >= TEXTBYTELEN) + { + //strncpy(&files.longFilename[TEXTBYTELEN -3],"~~",2); + //files.longFilename()[TEXTBYTELEN-1] = '\0'; + j = TEXTBYTELEN - 1; + } - strncpy(CardRecbuf.Cardshowfilename[num], files.longFilename(), j); + strncpy(CardRecbuf.Cardshowfilename[num], files.longFilename(), j); - strcpy(CardRecbuf.Cardfilename[num], files.shortFilename()); - CardRecbuf.addr[num] = SDFILE_ADDR + num * 10; - rtscheck.RTS_SndData(CardRecbuf.Cardshowfilename[num], CardRecbuf.addr[num]); - CardRecbuf.Filesum = (++num); - //SERIAL_ECHO(" CardRecbuf.Filesum =="); - //SERIAL_ECHO(CardRecbuf.Filesum); - rtscheck.RTS_SndData(1, FilenameIcon + CardRecbuf.Filesum); - } - rtscheck.RTS_SndData(17, IconPrintstatus); - lcd_sd_status = true; - return; + strcpy(CardRecbuf.Cardfilename[num], files.shortFilename()); + CardRecbuf.addr[num] = SDFILE_ADDR + num * 10; + rtscheck.RTS_SndData(CardRecbuf.Cardshowfilename[num], CardRecbuf.addr[num]); + CardRecbuf.Filesum = (++num); + //SERIAL_ECHO(" CardRecbuf.Filesum =="); + //SERIAL_ECHO(CardRecbuf.Filesum); + rtscheck.RTS_SndData(1, FilenameIcon + CardRecbuf.Filesum); + } + rtscheck.RTS_SndData(17, IconPrintstatus); + return; } - if(removed || !isMediaInserted()) + if(removed || !shouldCheck) { for (int i = 0; i < MaxFileNumber; i++) { @@ -761,7 +752,6 @@ SERIAL_ECHOLN(PSTR("BeginSwitch")); if (recdat.data[0] == 1) // card { InforShowStatus = false; - CardUpdate = true; CardRecbuf.recordcount = -1; RTS_SDCardUpate(false, false); SERIAL_ECHO("\n Handle Data PrintFile 1 Setting Screen "); @@ -861,7 +851,6 @@ SERIAL_ECHOLN(PSTR("BeginSwitch")); RTS_SndData(ExchangePageBase + 45, ExchangepageAddr); RTS_SndData(0, Timehour); RTS_SndData(0, Timemin); - CardCheckStatus[0] = 0; // close the key of checking card in printing stopPrint(); } else if (recdat.addr == Pauseprint) @@ -882,15 +871,14 @@ SERIAL_ECHOLN(PSTR("BeginSwitch")); RTS_SndData(0 + CEIconGrap, IconPrintstatus); PrintStatue[1] = 0; //PrinterStatusKey[1] = 3; - CardCheckStatus[0] = 1; // open the key of checking card in printing RTS_SndData(ExchangePageBase + 53, ExchangepageAddr); } if (recdat.addr == Resumeprint && recdat.data[0] == 2) // warming { + resumePrint(); NozzleTempStatus[2] = 1; PrinterStatusKey[1] = 0; InforShowStatus = true; - setTargetTemp_celsius((float)temphot, H0); startprogress = 0; RTS_SndData(ExchangePageBase + 82, ExchangepageAddr); } @@ -1413,7 +1401,6 @@ SERIAL_ECHOLN(PSTR("BeginSwitch")); RTS_SndData(1 + CEIconGrap, IconPrintstatus); PrintStatue[1] = 0; PrinterStatusKey[1] = 3; - CardCheckStatus[0] = 1; // open the key of checking card in printing RTS_SndData(ExchangePageBase + 53, ExchangepageAddr); FilementStatus[0] = 0; // recover the status waiting to check filements } @@ -1480,7 +1467,6 @@ SERIAL_ECHOLN(PSTR("BeginSwitch")); PrinterStatusKey[1] = 3; PoweroffContinue = true; TPShowStatus = InforShowStatus = true; - CardCheckStatus[0] = 1; // open the key of checking card in printing RTS_SndData(1 + CEIconGrap, IconPrintstatus); RTS_SndData(ExchangePageBase + 53, ExchangepageAddr); @@ -1538,11 +1524,6 @@ SERIAL_ECHOLN(PSTR("BeginSwitch")); break; case Filename: - //if(card.cardOK && recdat.data[0] > 0 && recdat.data[0] <= CardRecbuf.Filesum && recdat.addr != 0x20D2) - /*SERIAL_ECHO("\n recdat.data[0] =="); - SERIAL_ECHO(recdat.data[0]); - SERIAL_ECHO("\n recdat.addr =="); - SERIAL_ECHO(recdat.addr); */ SERIAL_ECHOLN("Filename"); if (isMediaInserted() && recdat.addr == FilenameChs) { @@ -1554,18 +1535,18 @@ SERIAL_ECHOLN(PSTR("BeginSwitch")); CardRecbuf.recordcount = recdat.data[0] - 1; for (int j = 0; j < 10; j++) RTS_SndData(0, Choosefilename + j); - int filelen = strlen(CardRecbuf.Cardshowfilename[CardRecbuf.recordcount]); + int filelen = strlen(CardRecbuf.Cardshowfilename[(int)CardRecbuf.recordcount]); filelen = (TEXTBYTELEN - filelen) / 2; if (filelen > 0) { char buf[20]; memset(buf, 0, sizeof(buf)); strncpy(buf, " ", filelen); - strcpy(&buf[filelen], CardRecbuf.Cardshowfilename[CardRecbuf.recordcount]); + strcpy(&buf[filelen], CardRecbuf.Cardshowfilename[(int)CardRecbuf.recordcount]); RTS_SndData(buf, Choosefilename); } else - RTS_SndData(CardRecbuf.Cardshowfilename[CardRecbuf.recordcount], Choosefilename); + RTS_SndData(CardRecbuf.Cardshowfilename[(int)CardRecbuf.recordcount], Choosefilename); for (int j = 0; j < 8; j++) RTS_SndData(0, FilenameCount + j); @@ -1589,23 +1570,23 @@ SERIAL_ECHOLN(PSTR("BeginSwitch")); { if (CardRecbuf.recordcount < 0) break; - printFile(CardRecbuf.Cardfilename[CardRecbuf.recordcount]); + printFile(CardRecbuf.Cardfilename[(int)CardRecbuf.recordcount]); for (int j = 0; j < 10; j++) //clean screen. RTS_SndData(0, Printfilename + j); - int filelen = strlen(CardRecbuf.Cardshowfilename[CardRecbuf.recordcount]); + int filelen = strlen(CardRecbuf.Cardshowfilename[(int)CardRecbuf.recordcount]); filelen = (TEXTBYTELEN - filelen) / 2; if (filelen > 0) { char buf[20]; memset(buf, 0, sizeof(buf)); strncpy(buf, " ", filelen); - strcpy(&buf[filelen], CardRecbuf.Cardshowfilename[CardRecbuf.recordcount]); + strcpy(&buf[filelen], CardRecbuf.Cardshowfilename[(int)CardRecbuf.recordcount]); RTS_SndData(buf, Printfilename); } else - RTS_SndData(CardRecbuf.Cardshowfilename[CardRecbuf.recordcount], Printfilename); + RTS_SndData(CardRecbuf.Cardshowfilename[(int)CardRecbuf.recordcount], Printfilename); delay_ms(2); #if FAN_COUNT > 0 @@ -1622,8 +1603,6 @@ SERIAL_ECHOLN(PSTR("BeginSwitch")); PrintStatue[1] = 0; PrinterStatusKey[0] = 1; PrinterStatusKey[1] = 3; - CardCheckStatus[0] = 1; // open the key of checking card in printing - //Update_Time_Value = 0; } else if (recdat.data[0] == 0) // return to main page { @@ -1708,7 +1687,6 @@ void onPrintTimerStarted() rtscheck.RTS_SndData(4 + CEIconGrap, IconPrintstatus); delay_ms(1); rtscheck.RTS_SndData(ExchangePageBase + 53, ExchangepageAddr); - CardCheckStatus[0] = 1; // open the key of checking card in printing } void onPrintTimerPaused() diff --git a/Marlin/src/lcd/extensible_ui/lib/Creality_DWIN.h b/Marlin/src/lcd/extensible_ui/lib/Creality_DWIN.h index 26e44ce253..7542f31a63 100644 --- a/Marlin/src/lcd/extensible_ui/lib/Creality_DWIN.h +++ b/Marlin/src/lcd/extensible_ui/lib/Creality_DWIN.h @@ -132,23 +132,6 @@ class RTSSHOW { static RTSSHOW rtscheck; -#if defined(MachineCRX) && !defined(Force10SProDisplay) - #define Addvalue 2 - #define PrintChoice_Value (1+Addvalue) - #define TempControl_Value (4+Addvalue) - #define Setting_Value (8+Addvalue) - #define XYZEaxis_Value (12+Addvalue) - #define Filement_Value (15+Addvalue) - #define Language_Value (18+Addvalue) - #define Filename_Value (21+Addvalue) - - enum PROC_COM {Printfile=0,Ajust,Feedrate,PrintChoice=PrintChoice_Value,TempControl=TempControl_Value,ManualSetTemp,Setting=Setting_Value, - ReturnBack,Bedlevel,Autohome,XYZEaxis=XYZEaxis_Value,Filement=Filement_Value,LanguageChoice=Language_Value,PwrOffNoF,Volume,Filename=Filename_Value}; - - const unsigned long Addrbuf[] = {0x1002, 0x1004, 0x1006, 0x1008, 0x100A, 0x100C, 0x1030, 0x1032, 0x1034, 0x103A, 0x103E, - 0x1040, 0x1044, 0x1046, 0x1048, 0x104A, 0x104C, 0x1054, 0x1056, 0x1058, 0x105C, - 0x105F, 0x1088, 0}; -#else #define Addvalue 3 #define PrintChoice_Value (0+Addvalue) #define Zoffset_Value (3+Addvalue) @@ -164,7 +147,7 @@ static RTSSHOW rtscheck; const unsigned long Addrbuf[] = {0x1002, 0x1004, 0x1006, 0x1008, 0x100A, 0x100C, 0x1026, 0x1030, 0x1032, 0x1034, 0x103A, 0x103E, 0x1040, 0x1044, 0x1046, 0x1048, 0x104A, 0x104C, 0x1054, 0x1056, 0x1058, 0x105C, 0x105E, 0x105F, 0x1088, 0}; -#endif + extern void RTSUpdate(); extern void RTSInit(); @@ -187,4 +170,7 @@ extern char PrinterStatusKey[2]; extern uint8_t progress_bar_percent; extruder_t original_extruder; float targetPos; -} \ No newline at end of file +} +#ifndef USER_GCODE_1 + #define USER_GCODE_1 "G28" +#endif \ No newline at end of file diff --git a/Marlin/src/lcd/extensible_ui/ui_api.cpp b/Marlin/src/lcd/extensible_ui/ui_api.cpp index 34969c7305..179289c72e 100644 --- a/Marlin/src/lcd/extensible_ui/ui_api.cpp +++ b/Marlin/src/lcd/extensible_ui/ui_api.cpp @@ -714,17 +714,25 @@ namespace ExtUI { } #endif - #if HAS_BED_PROBE - float getZOffset_mm() { + float getZOffset_mm() { + #if HAS_BED_PROBE return zprobe_zoffset; - } + #elif ENABLED(BABYSTEP_DISPLAY_TOTAL) + return babystep.axis_total[BS_TOTAL_AXIS(Z_AXIS) + 1]; + #endif + } - void setZOffset_mm(const float value) { + void setZOffset_mm(const float value) { + #if HAS_BED_PROBE if (WITHIN(value, Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX)) { zprobe_zoffset = value; } - } - #endif // HAS_BED_PROBE + #elif ENABLED(BABYSTEP_DISPLAY_TOTAL) + babystep.add_mm(Z_AXIS, (value - babystep.axis_total[BS_TOTAL_AXIS(Z_AXIS) + 1])); + #else + UNUSED(value); + #endif + } #if HAS_HOTEND_OFFSET diff --git a/Marlin/src/lcd/extensible_ui/ui_api.h b/Marlin/src/lcd/extensible_ui/ui_api.h index 8d2a98d171..11a60a28a5 100644 --- a/Marlin/src/lcd/extensible_ui/ui_api.h +++ b/Marlin/src/lcd/extensible_ui/ui_api.h @@ -198,10 +198,8 @@ namespace ExtUI { void normalizeNozzleOffset(const axis_t axis); #endif - #if HAS_BED_PROBE - float getZOffset_mm(); - void setZOffset_mm(const float); - #endif + float getZOffset_mm(); + void setZOffset_mm(const float); #if ENABLED(BACKLASH_GCODE) float getAxisBacklash_mm(const axis_t);