diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h
index 22a5ff9c90..d3efb73ccc 100644
--- a/Marlin/Configuration_adv.h
+++ b/Marlin/Configuration_adv.h
@@ -1361,7 +1361,7 @@
//#define BROWSE_MEDIA_ON_INSERT // Open the file browser when media is inserted
- #define EVENT_GCODE_SD_ABORT "G28XY" // G-code to run on SD Abort Print (e.g., "G28XY" or "G27")
+ #define EVENT_GCODE_SD_ABORT "G91\nG1Z5\nG90\nM84\nM104S0\nM140S0" // G-code to run on SD Abort Print (e.g., "G28XY" or "G27")
#if ENABLED(PRINTER_EVENT_LEDS)
#define PE_LEDS_COMPLETED_TIME (30*60) // (seconds) Time to keep the LED "done" color before restoring normal illumination
diff --git a/Marlin/src/lcd/extui/lib/Creality/Creality_DWIN.cpp b/Marlin/src/lcd/extui/lib/Creality/Creality_DWIN.cpp
index 8b6c8d531e..e7ade473da 100644
--- a/Marlin/src/lcd/extui/lib/Creality/Creality_DWIN.cpp
+++ b/Marlin/src/lcd/extui/lib/Creality/Creality_DWIN.cpp
@@ -1,3 +1,36 @@
+/**
+ * Marlin 3D Printer Firmware
+ * Copyright (c) 2021 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
+ *
+ * Based on Sprinter and grbl.
+ * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ *
+ */
+
+/* ****************************************
+ * lcd/extui/lib/Creality/Creality_DWIN.cpp
+ * ****************************************
+ * Extensible_UI implementation for Creality DWIN
+ * 10SPro, Max, CRX, and others
+ * Based original Creality release, ported to ExtUI for Marlin 2.0
+ * Written by Insanity Automation, sponsored by Tiny Machines 3D
+ *
+ * ***************************************/
+
+
#include "Creality_DWIN.h"
#include "FileNavigator.h"
#include
@@ -522,6 +555,7 @@ void RTSSHOW::RTS_SndData(const char *str, unsigned long addr, unsigned char cmd
if (len > 0)
{
+ if(len>20) len = 20; //databuf is 26 chars, loop adds 6 for header so limit data to 20
databuf[0] = FHONE;
databuf[1] = FHTWO;
databuf[2] = 3 + len;
@@ -653,6 +687,11 @@ void RTSSHOW::RTS_HandleData()
}
switch(recdat.addr) {
+ case ProbeOffset_Z :
+ {
+ Checkkey = Zoffset_Value;
+ break;
+ }
case Flowrate :
case StepMM_X :
case StepMM_Y :
@@ -660,7 +699,6 @@ void RTSSHOW::RTS_HandleData()
case StepMM_E :
case ProbeOffset_X :
case ProbeOffset_Y :
- case ProbeOffset_Z :
case HotendPID_AutoTmp :
case BedPID_AutoTmp :
case HotendPID_P :
@@ -724,6 +762,8 @@ SERIAL_ECHOLNPGM_P(PSTR("BeginSwitch"));
InforShowStatus = false;
SERIAL_ECHOLNPGM_P(PSTR("Handle Data PrintFile Pre"));
filenavigator.getFiles(0);
+ fileIndex = 0;
+ recordcount = 0;
SERIAL_ECHOLNPGM_P(PSTR("Handle Data PrintFile Post"));
RTS_SndData(ExchangePageBase + 46, ExchangepageAddr);
}
@@ -873,21 +913,30 @@ SERIAL_ECHOLNPGM_P(PSTR("BeginSwitch"));
{
tmp_zprobe_offset = ((float)recdat.data[0]) / 100;
}
-
+ tmp_zprobe_offset = tmp_zprobe_offset; //Invert sign here so it follows below
+ SERIAL_ECHOLNPAIR("Requested Offset ", tmp_zprobe_offset);
if (WITHIN((tmp_zprobe_offset), Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX))
{
-
- smartAdjustAxis_steps(((getAxisSteps_per_mm(Z) * (getZOffset_mm() - tmp_zprobe_offset)) * -1), (axis_t)Z, false);
- //babystepAxis_steps(((int)getAxisSteps_per_mm(Z) * (getZOffset_mm() - tmp_zprobe_offset) * -1), (axis_t)Z);
- //setZOffset_mm(tmp_zprobe_offset);
+ int16_t tmpSteps = mmToWholeSteps(getZOffset_mm() - tmp_zprobe_offset, (axis_t)Z);
+ if(tmpSteps==0)
+ {
+ SERIAL_ECHOLNPGM_P(PSTR("Rounding to step"));
+ if(getZOffset_mm() < tmp_zprobe_offset)
+ tmpSteps = 1;
+ else
+ tmpSteps = -1;
+ }
+ smartAdjustAxis_steps(tmpSteps*-1, (axis_t)Z, false);
+ char zOffs[20], tmp1[11];
+ sprintf_P(zOffs, PSTR("Z Offset : %s"), dtostrf(getZOffset_mm(), 1, 3, tmp1));
+ onStatusChanged(zOffs);
}
else
{
+ onStatusChanged_P(PSTR("Requested Offset Beyond Limits"));
RTS_SndData(getZOffset_mm() * 100, ProbeOffset_Z);
}
- char zOffs[20], tmp1[11];
- sprintf_P(zOffs, PSTR("Z Offset : %s"), dtostrf(getZOffset_mm(), 1, 3, tmp1));
- onStatusChanged(zOffs);
+
rtscheck.RTS_SndData(getZOffset_mm() * 100, ProbeOffset_Z);
break;
@@ -1609,6 +1658,8 @@ SERIAL_ECHOLNPGM_P(PSTR("BeginSwitch"));
PrintStatue[1] = 0;
PrinterStatusKey[0] = 1;
PrinterStatusKey[1] = 3;
+ fileIndex = 0;
+ recordcount = 0;
}
else if(recdat.data[0] == 2) //Page Down
{
@@ -1633,6 +1684,11 @@ SERIAL_ECHOLNPGM_P(PSTR("BeginSwitch"));
filenavigator.getFiles(fileIndex);
}
}
+ else if(recdat.data[0] == 4) //Page Up
+ {
+ SERIAL_ECHOLNPGM_P(PSTR("Refresh"));
+ injectCommands_P(PSTR("M22\nM21"));
+ }
else if (recdat.data[0] == 0) // return to main page
{
InforShowStatus = true;
@@ -1682,6 +1738,8 @@ void onMediaInserted()
SERIAL_ECHOLNPGM_P(PSTR("***Initing card is OK***"));
filenavigator.reset();
filenavigator.getFiles(0);
+ fileIndex = 0;
+ recordcount = 0;
}
void onMediaError()
diff --git a/Marlin/src/lcd/extui/lib/Creality/Creality_DWIN.h b/Marlin/src/lcd/extui/lib/Creality/Creality_DWIN.h
index 048824dd10..9124acf07e 100644
--- a/Marlin/src/lcd/extui/lib/Creality/Creality_DWIN.h
+++ b/Marlin/src/lcd/extui/lib/Creality/Creality_DWIN.h
@@ -1,3 +1,35 @@
+/**
+ * Marlin 3D Printer Firmware
+ * Copyright (c) 2021 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
+ *
+ * Based on Sprinter and grbl.
+ * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ *
+ */
+
+/* ****************************************
+ * lcd/extui/lib/Creality/Creality_DWIN.h
+ * ****************************************
+ * Extensible_UI implementation for Creality DWIN
+ * 10SPro, Max, CRX, and others
+ * Based original Creality release, ported to ExtUI for Marlin 2.0
+ * Written by Insanity Automation, sponsored by Tiny Machines 3D
+ *
+ * ***************************************/
+
#pragma once
#include "string.h"
@@ -181,7 +213,7 @@ void RTSUpdate();
void RTSInit();
}
-#ifndef USER_GCODE_1
- #define USER_GCODE_1 "G28"
+#ifndef MAIN_MENU_ITEM_1_GCODE
+ #define MAIN_MENU_ITEM_1_GCODE "G28"
#endif
#endif
diff --git a/Marlin/src/lcd/extui/lib/Creality/FileNavigator.h b/Marlin/src/lcd/extui/lib/Creality/FileNavigator.h
index a205bb2820..2c86fa210b 100644
--- a/Marlin/src/lcd/extui/lib/Creality/FileNavigator.h
+++ b/Marlin/src/lcd/extui/lib/Creality/FileNavigator.h
@@ -22,10 +22,10 @@
#pragma once
/* ****************************************
- * lcd/extui/lib/Creality/FileNavigator.cpp
+ * lcd/extui/lib/Creality/FileNavigator.h
* ****************************************
* Extensible_UI implementation for Creality DWIN
- * 10SPro, Max, CR10V2
+ * 10SPro, Max, CRX and others
* Based on implementations for Anycubic Chiron and Nextion by Nick Wells and Skorpi08
* Written by Insanity Automation
* ***************************************/
diff --git a/Marlin/src/lcd/extui/ui_api.cpp b/Marlin/src/lcd/extui/ui_api.cpp
index 187d6b37e3..66bc10c411 100644
--- a/Marlin/src/lcd/extui/ui_api.cpp
+++ b/Marlin/src/lcd/extui/ui_api.cpp
@@ -1067,8 +1067,6 @@ namespace ExtUI {
void onStatusChanged_P(PGM_P const pstr) {
char msg[strlen_P(pstr) + 1];
strcpy_P(msg, pstr);
- if(strlen(msg) > 20)
- msg[20]="\0";
onStatusChanged(msg);
}
diff --git a/Marlin/src/pins/ramps/pins_RAMPS.h b/Marlin/src/pins/ramps/pins_RAMPS.h
index f30a235626..c8429eb5aa 100644
--- a/Marlin/src/pins/ramps/pins_RAMPS.h
+++ b/Marlin/src/pins/ramps/pins_RAMPS.h
@@ -653,7 +653,9 @@
#define BEEPER_PIN EXP1_10_PIN
#define BTN_ENC EXP1_09_PIN
- #define SD_DETECT_PIN EXP2_04_PIN
+ #ifndef SD_DETECT_PIN
+ #define SD_DETECT_PIN EXP2_04_PIN
+ #endif
#ifndef KILL_PIN
#define KILL_PIN EXP2_03_PIN
diff --git a/buildroot/share/PlatformIO/scripts/common-cxxflags.py b/buildroot/share/PlatformIO/scripts/common-cxxflags.py
index cb185352b4..0a6bd2b18d 100644
--- a/buildroot/share/PlatformIO/scripts/common-cxxflags.py
+++ b/buildroot/share/PlatformIO/scripts/common-cxxflags.py
@@ -33,7 +33,7 @@ def add_cpu_freq():
if env.GetBuildType() == "debug" and env.get('UPLOAD_PROTOCOL') not in ['jlink', 'stlink']:
env['BUILD_DIR'] = '$PROJECT_BUILD_DIR/$PIOENV/debug'
env_name = str(env["PIOENV"])
-env.Replace(PROGNAME="%s_DW7.3" % (env_name))
+env.Replace(PROGNAME="%s_DW7.3.1" % (env_name))
print("Environment: %s" % (env_name))
# On some platform, F_CPU is a runtime variable. Since it's used to convert from ns
diff --git a/buildroot/share/PlatformIO/scripts/random-bin.py b/buildroot/share/PlatformIO/scripts/random-bin.py
index 8df003f7d4..98d9dba59e 100644
--- a/buildroot/share/PlatformIO/scripts/random-bin.py
+++ b/buildroot/share/PlatformIO/scripts/random-bin.py
@@ -6,5 +6,5 @@ Import("env")
from datetime import datetime
env_name = str(env["PIOENV"])
-env['PROGNAME'] = "firmware_%s_DW7.3" % (env_name)
-#env['PROGNAME'] += datetime.now().strftime("-%Y%m%d-%H%M%S")
+env['PROGNAME'] = "firmware_%s_DW7.3.1" % (env_name)
+#env['PROGNAME'] .= datetime.now().strftime("-%Y%m%d-%H%M%S")