Browse Source

🐛 Fix Chiron new TFT SD print after reset (#23855)

FB4S_WIFI
Nick 3 years ago
committed by Scott Lahteine
parent
commit
1a76d4d467
  1. 6
      Marlin/src/gcode/bedlevel/mbl/G29.cpp
  2. 4
      Marlin/src/lcd/extui/anycubic_chiron/FileNavigator.cpp
  3. 30
      Marlin/src/lcd/extui/anycubic_chiron/chiron_tft.cpp
  4. 10
      Marlin/src/lcd/extui/anycubic_chiron/chiron_tft_defs.h

6
Marlin/src/gcode/bedlevel/mbl/G29.cpp

@ -118,9 +118,11 @@ void GcodeSuite::G29() {
// For each G29 S2...
if (mbl_probe_index == 0) {
// Move close to the bed before the first point
do_blocking_move_to_z(0.4f
do_blocking_move_to_z(
#ifdef MANUAL_PROBE_START_Z
+ (MANUAL_PROBE_START_Z) - 0.4f
MANUAL_PROBE_START_Z
#else
0.4f
#endif
);
}

4
Marlin/src/lcd/extui/anycubic_chiron/FileNavigator.cpp

@ -155,7 +155,7 @@ void FileNavigator::skiptofileindex(uint16_t skip) {
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) {
if (paneltype <= AC_panel_new) {
TFTSer.println("<<.GCO");
Chiron.SendtoTFTLN(F(".. .gcode"));
}
@ -177,7 +177,7 @@ void FileNavigator::skiptofileindex(uint16_t skip) {
void FileNavigator::sendFile(panel_type_t paneltype) {
if (filelist.isDir()) {
// Add mandatory tags for new panel otherwise lines are ignored.
if (paneltype == AC_panel_new) {
if (paneltype <= AC_panel_new) {
TFTSer.print(filelist.shortFilename());
TFTSer.println(".GCO");
TFTSer.print(filelist.shortFilename());

30
Marlin/src/lcd/extui/anycubic_chiron/chiron_tft.cpp

@ -442,7 +442,7 @@ void ChironTFT::SendFileList(int8_t startindex) {
}
void ChironTFT::SelectFile() {
if (panel_type == AC_panel_new) {
if (panel_type <= AC_panel_new) {
strncpy(selectedfile, panel_command + 4, command_len - 3);
selectedfile[command_len - 4] = '\0';
}
@ -465,7 +465,7 @@ void ChironTFT::SelectFile() {
break;
default: // enter sub folder
// for new panel remove the '.GCO' tag that was added to the end of the path
if (panel_type == AC_panel_new)
if (panel_type <= AC_panel_new)
selectedfile[strlen(selectedfile) - 4] = '\0';
filenavigator.changeDIR(selectedfile);
SendtoTFTLN(AC_msg_sd_file_open_failed);
@ -478,8 +478,8 @@ void ChironTFT::ProcessPanelRequest() {
// Break these up into logical blocks // as its easier to navigate than one huge switch case!
int8_t tpos = FindToken('A');
// Panel request are 'A0' - 'A36'
if (tpos != -1) {
const int8_t req = atoi(&panel_command[tpos+1]);
if (tpos >= 0) {
const int8_t req = atoi(&panel_command[tpos + 1]);
// Information requests A0 - A8 and A33
if (req <= 8 || req == 33) PanelInfo(req);
@ -495,16 +495,18 @@ void ChironTFT::ProcessPanelRequest() {
// This may be a response to a panel type detection query
if (panel_type == AC_panel_unknown) {
tpos = FindToken('S'); // old panel will respond to 'SIZE' with 'SXY 480 320'
if (tpos != -1) {
if (panel_command[tpos+1]== 'X' && panel_command[tpos+2]=='Y') {
if (tpos >= 0) {
if (panel_command[tpos + 1] == 'X' && panel_command[tpos + 2] =='Y') {
panel_type = AC_panel_standard;
SERIAL_ECHOLNF(AC_msg_old_panel_detected);
}
}
else {
tpos = FindToken('['); // new panel will respond to 'J200' with '[0]=0'
if (tpos != -1) {
if (panel_command[tpos+1]== '0' && panel_command[tpos+2]==']') {
// new panel will respond to 'J200' with '[0]=0'
// it seems only after a power cycle so detection assumes a new panel
tpos = FindToken('[');
if (tpos >= 0) {
if (panel_command[tpos + 1] == '0' && panel_command[tpos + 2] ==']') {
panel_type = AC_panel_new;
SERIAL_ECHOLNF(AC_msg_new_panel_detected);
}
@ -811,7 +813,7 @@ void ChironTFT::PanelProcess(uint8_t req) {
} break;
case 30: // A30 Auto leveling
if (FindToken('S') != -1) { // Start probing New panel adds spaces..
if (FindToken('S') >= 0) { // Start probing New panel adds spaces..
// Ignore request if printing
if (isPrinting())
SendtoTFTLN(AC_msg_probing_not_allowed); // forbid auto leveling
@ -828,7 +830,7 @@ void ChironTFT::PanelProcess(uint8_t req) {
case 31: // A31 Adjust all Probe Points
// The tokens can occur in different places on the new panel so we need to find it.
if (FindToken('C') != -1) { // Restore and apply original offsets
if (FindToken('C') >= 0) { // Restore and apply original offsets
if (!isPrinting()) {
injectCommands(F("M501\nM420 S1"));
selectedmeshpoint.x = selectedmeshpoint.y = 99;
@ -836,7 +838,7 @@ void ChironTFT::PanelProcess(uint8_t req) {
}
}
else if (FindToken('D') != -1) { // Save Z Offset tables and restore leveling state
else if (FindToken('D') >= 0) { // Save Z Offset tables and restore leveling state
if (!isPrinting()) {
setAxisPosition_mm(1.0,Z); // Lift nozzle before any further movements are made
injectCommands(F("M500"));
@ -845,7 +847,7 @@ void ChironTFT::PanelProcess(uint8_t req) {
}
}
else if (FindToken('G') != -1) { // Get current offset
else if (FindToken('G') >= 0) { // Get current offset
SendtoTFT(F("A31V "));
// When printing use the live z Offset position
// we will use babystepping to move the print head
@ -859,7 +861,7 @@ void ChironTFT::PanelProcess(uint8_t req) {
else {
int8_t tokenpos = FindToken('S');
if (tokenpos != -1) { // Set offset (adjusts all points by value)
if (tokenpos >= 0) { // Set offset (adjusts all points by value)
float Zshift = atof(&panel_command[tokenpos+1]);
setSoftEndstopState(false); // disable endstops
// Allow temporary Z position nudging during print

10
Marlin/src/lcd/extui/anycubic_chiron/chiron_tft_defs.h

@ -89,6 +89,10 @@
#define AC_msg_mesh_changes_saved F("Mesh changes saved.")
#define AC_msg_old_panel_detected F("Standard TFT panel detected!")
#define AC_msg_new_panel_detected F("New TFT panel detected!")
#define AC_msg_auto_panel_detection F("Auto detect panel type (assuming new panel)")
#define AC_msg_old_panel_set F("Set for standard TFT panel.")
#define AC_msg_new_panel_set F("Set for new TFT panel.")
#define AC_msg_powerloss_recovery F("Resuming from power outage! select the same SD file then press resume")
// Error messages must not contain spaces
#define AC_msg_error_bed_temp F("Abnormal_bed_temp")
@ -161,10 +165,10 @@ namespace Anycubic {
AC_menu_change_to_file,
AC_menu_change_to_command
};
enum panel_type_t : uint8_t {
enum panel_type_t : uint8_t { // order is important here as we assume new panel if type is unknown
AC_panel_unknown,
AC_panel_standard,
AC_panel_new
AC_panel_new,
AC_panel_standard
};
enum last_error_t : uint8_t {
AC_error_none,

Loading…
Cancel
Save