Fix Anycubic Chiron "Ready" detection (#19880)
Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
This commit is contained in:
parent
e44a97a096
commit
676354f1d1
@ -40,6 +40,7 @@
|
||||
#include "../../../../sd/cardreader.h"
|
||||
#include "../../../../libs/numtostr.h"
|
||||
#include "../../../../MarlinCore.h"
|
||||
|
||||
namespace Anycubic {
|
||||
|
||||
printer_state_t ChironTFT::printer_state;
|
||||
@ -87,7 +88,7 @@ namespace Anycubic {
|
||||
|
||||
// Enable levelling and Disable end stops during print
|
||||
// as Z home places nozzle above the bed so we need to allow it past the end stops
|
||||
injectCommands_P(AC_cmnd_enable_levelling); //M211 S0\n"));
|
||||
injectCommands_P(AC_cmnd_enable_levelling);
|
||||
|
||||
// Startup tunes are defined in Tunes.h
|
||||
//PlayTune(BEEPER_PIN, Anycubic_PowerOn, 1);
|
||||
@ -179,7 +180,7 @@ namespace Anycubic {
|
||||
#endif
|
||||
switch (printer_state) {
|
||||
case AC_printer_pausing: {
|
||||
if ( (strcmp_P(msg, MARLIN_msg_print_paused) == 0 ) || (strcmp_P(msg, MARLIN_msg_nozzle_parked) == 0 ) ) {
|
||||
if (strcmp_P(msg, MARLIN_msg_print_paused) == 0 || strcmp_P(msg, MARLIN_msg_nozzle_parked) == 0) {
|
||||
SendtoTFTLN(AC_msg_paused); // enable continue button
|
||||
printer_state = AC_printer_paused;
|
||||
}
|
||||
@ -221,7 +222,8 @@ namespace Anycubic {
|
||||
switch (printer_state) {
|
||||
case AC_printer_probing: {
|
||||
// If probing completes ok save the mesh and park
|
||||
if (strcmp_P(msg, MARLIN_msg_ready) == 0 ) {
|
||||
// Ignore the custom machine name
|
||||
if (strcmp_P(msg + strlen(CUSTOM_MACHINE_NAME), MARLIN_msg_ready) == 0) {
|
||||
injectCommands_P(PSTR("M500\nG27"));
|
||||
SendtoTFTLN(AC_msg_probing_complete);
|
||||
printer_state = AC_printer_idle;
|
||||
@ -306,7 +308,7 @@ namespace Anycubic {
|
||||
|
||||
bool ChironTFT::ReadTFTCommand() {
|
||||
bool command_ready = false;
|
||||
while( (TFTSer.available() > 0) && (command_len < MAX_CMND_LEN) ) {
|
||||
while(TFTSer.available() > 0 && command_len < MAX_CMND_LEN) {
|
||||
panel_command[command_len] = TFTSer.read();
|
||||
if (panel_command[command_len] == '\n') {
|
||||
command_ready = true;
|
||||
@ -333,26 +335,18 @@ namespace Anycubic {
|
||||
}
|
||||
|
||||
int8_t ChironTFT::Findcmndpos(const char * buff, char q) {
|
||||
bool found = false;
|
||||
int8_t pos = 0;
|
||||
do {
|
||||
if (buff[pos] == q) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
pos ++;
|
||||
} while(pos < MAX_CMND_LEN);
|
||||
if (found) return pos;
|
||||
do { if (buff[pos] == q) return pos; } while(++pos < MAX_CMND_LEN);
|
||||
return -1;
|
||||
}
|
||||
|
||||
void ChironTFT::CheckHeaters() {
|
||||
uint8_t faultDuration = 0; float temp = 0;
|
||||
uint8_t faultDuration = 0;
|
||||
float temp = 0;
|
||||
|
||||
// if the hotend temp is abnormal, confirm state before signalling panel
|
||||
temp = getActualTemp_celsius(E0);
|
||||
if ( (temp <= HEATER_0_MINTEMP) || (temp >= HEATER_0_MAXTEMP) ) {
|
||||
do {
|
||||
while (!WITHIN(temp, HEATER_0_MINTEMP, HEATER_0_MAXTEMP)) {
|
||||
faultDuration++;
|
||||
if (faultDuration >= AC_HEATER_FAULT_VALIDATION_TIME) {
|
||||
SendtoTFTLN(AC_msg_nozzle_temp_abnormal);
|
||||
@ -361,14 +355,12 @@ namespace Anycubic {
|
||||
}
|
||||
delay_ms(500);
|
||||
temp = getActualTemp_celsius(E0);
|
||||
} while ((temp <= HEATER_0_MINTEMP) || (temp >= HEATER_0_MAXTEMP) );
|
||||
}
|
||||
|
||||
// if the hotbed temp is abnormal, confirm state before signalling panel
|
||||
// If the hotbed temp is abnormal, confirm state before signaling panel
|
||||
faultDuration = 0;
|
||||
temp = getActualTemp_celsius(BED);
|
||||
if ( (temp <= BED_MINTEMP) || (temp >= BED_MAXTEMP) ) {
|
||||
do {
|
||||
while (!WITHIN(temp, BED_MINTEMP, BED_MAXTEMP)) {
|
||||
faultDuration++;
|
||||
if (faultDuration >= AC_HEATER_FAULT_VALIDATION_TIME) {
|
||||
SendtoTFTLN(AC_msg_nozzle_temp_abnormal);
|
||||
@ -377,7 +369,6 @@ namespace Anycubic {
|
||||
}
|
||||
delay_ms(500);
|
||||
temp = getActualTemp_celsius(E0);
|
||||
} while ((temp <= BED_MINTEMP) || (temp >= BED_MAXTEMP) );
|
||||
}
|
||||
|
||||
// Update panel with hotend heater status
|
||||
@ -398,7 +389,7 @@ namespace Anycubic {
|
||||
}
|
||||
|
||||
void ChironTFT::SendFileList(int8_t startindex) {
|
||||
// respond to panel request for 4 files starting at index
|
||||
// Respond to panel request for 4 files starting at index
|
||||
#if ACDEBUG(AC_INFO)
|
||||
SERIAL_ECHOLNPAIR("## SendFileList ## ", startindex);
|
||||
#endif
|
||||
@ -493,7 +484,6 @@ namespace Anycubic {
|
||||
if (isPrintingFromMedia()) {
|
||||
SendtoTFT(PSTR("A6V "));
|
||||
TFTSer.println(ui8tostr2(getProgress_percent()));
|
||||
|
||||
}
|
||||
else
|
||||
SendtoTFTLN(PSTR("A6V ---"));
|
||||
@ -552,7 +542,7 @@ namespace Anycubic {
|
||||
}
|
||||
else {
|
||||
if (printer_state == AC_printer_resuming_from_power_outage)
|
||||
injectCommands_P(PSTR("M1000 C\n")); // Cancel recovery
|
||||
injectCommands_P(PSTR("M1000 C")); // Cancel recovery
|
||||
SendtoTFTLN(AC_msg_stop);
|
||||
printer_state = AC_printer_idle;
|
||||
}
|
||||
@ -569,7 +559,7 @@ namespace Anycubic {
|
||||
case 14: { // A14 Start Printing
|
||||
// Allows printer to restart the job if we dont want to recover
|
||||
if (printer_state == AC_printer_resuming_from_power_outage) {
|
||||
injectCommands_P(PSTR("M1000 C\n")); // Cancel recovery
|
||||
injectCommands_P(PSTR("M1000 C")); // Cancel recovery
|
||||
printer_state = AC_printer_idle;
|
||||
}
|
||||
#if ACDebugLevel >= 1
|
||||
@ -587,8 +577,7 @@ namespace Anycubic {
|
||||
if (printer_state == AC_printer_resuming_from_power_outage)
|
||||
// Need to home here to restore the Z position
|
||||
injectCommands_P(AC_cmnd_power_loss_recovery);
|
||||
|
||||
injectCommands_P(PSTR("M1000\n")); // home and start recovery
|
||||
injectCommands_P(PSTR("M1000")); // home and start recovery
|
||||
break;
|
||||
|
||||
case 16: { // A16 Set HotEnd temp A17 S170
|
||||
@ -631,10 +620,10 @@ namespace Anycubic {
|
||||
case 21: // A21 Home Axis A21 X
|
||||
if (!isPrinting()) {
|
||||
switch ((char)panel_command[4]) {
|
||||
case 'X': injectCommands_P(PSTR("G28 X\n")); break;
|
||||
case 'Y': injectCommands_P(PSTR("G28 Y\n")); break;
|
||||
case 'Z': injectCommands_P(PSTR("G28 Z\n")); break;
|
||||
case 'C': injectCommands_P(PSTR("G28\n")); break;
|
||||
case 'X': injectCommands_P(PSTR("G28 X")); break;
|
||||
case 'Y': injectCommands_P(PSTR("G28 Y")); break;
|
||||
case 'Z': injectCommands_P(PSTR("G28 Z")); break;
|
||||
case 'C': injectCommands_P(PSTR("G28")); break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -729,7 +718,7 @@ namespace Anycubic {
|
||||
// If the same meshpoint is selected twice in a row, move the head to that ready for adjustment
|
||||
if ((selectedmeshpoint.x == pos.x) && (selectedmeshpoint.y == pos.y)) {
|
||||
if (!isPositionKnown())
|
||||
injectCommands_P(PSTR("G28\n")); // home
|
||||
injectCommands_P(PSTR("G28")); // home
|
||||
|
||||
if (isPositionKnown()) {
|
||||
#if ACDEBUG(AC_INFO)
|
||||
@ -769,17 +758,15 @@ namespace Anycubic {
|
||||
switch (panel_command[3]) {
|
||||
case 'C': // Restore and apply original offsets
|
||||
if (!isPrinting()) {
|
||||
injectCommands_P(PSTR("M501\nM420 S1\n"));
|
||||
selectedmeshpoint.x = 99;
|
||||
selectedmeshpoint.y = 99;
|
||||
injectCommands_P(PSTR("M501\nM420 S1"));
|
||||
selectedmeshpoint.x = selectedmeshpoint.y = 99;
|
||||
}
|
||||
break;
|
||||
case 'D': // Save Z Offset tables and restore levelling state
|
||||
if (!isPrinting()) {
|
||||
setAxisPosition_mm(1.0,Z);
|
||||
injectCommands_P(PSTR("M500\n"));
|
||||
selectedmeshpoint.x = 99;
|
||||
selectedmeshpoint.y = 99;
|
||||
injectCommands_P(PSTR("M500"));
|
||||
selectedmeshpoint.x = selectedmeshpoint.y = 99;
|
||||
}
|
||||
break;
|
||||
case 'G': // Get current offset
|
||||
@ -790,8 +777,7 @@ namespace Anycubic {
|
||||
TFTSer.println(live_Zoffset);
|
||||
else {
|
||||
TFTSer.println(getZOffset_mm());
|
||||
selectedmeshpoint.x = 99;
|
||||
selectedmeshpoint.y = 99;
|
||||
selectedmeshpoint.x = selectedmeshpoint.y = 99;
|
||||
}
|
||||
break;
|
||||
case 'S': { // Set offset (adjusts all points by value)
|
||||
@ -859,8 +845,7 @@ namespace Anycubic {
|
||||
case 34: { // A34 Adjust single mesh point A34 C/S X1 Y1 V123
|
||||
if (panel_command[3] == 'C') { // Restore original offsets
|
||||
injectCommands_P(PSTR("M501\nM420 S1"));
|
||||
selectedmeshpoint.x = 99;
|
||||
selectedmeshpoint.y = 99;
|
||||
selectedmeshpoint.x = selectedmeshpoint.y = 99;
|
||||
//printer_state = AC_printer_idle;
|
||||
}
|
||||
else {
|
||||
@ -876,9 +861,10 @@ namespace Anycubic {
|
||||
#endif
|
||||
// Update Meshpoint
|
||||
setMeshPoint(pos,newval);
|
||||
if ( (printer_state == AC_printer_idle) || (printer_state == AC_printer_probing) ) {//!isPrinting()) {
|
||||
// if we are at the current mesh point indicated on the panel Move Z pos +/- 0.05mm ( The panel changes the mesh value by +/- 0.05mm on each button press)
|
||||
if ((selectedmeshpoint.x == pos.x) && (selectedmeshpoint.y == pos.y)) {
|
||||
if (printer_state == AC_printer_idle || printer_state == AC_printer_probing /*!isPrinting()*/) {
|
||||
// if we are at the current mesh point indicated on the panel Move Z pos +/- 0.05mm
|
||||
// (The panel changes the mesh value by +/- 0.05mm on each button press)
|
||||
if (selectedmeshpoint.x == pos.x && selectedmeshpoint.y == pos.y) {
|
||||
setSoftEndstopState(false);
|
||||
float currZpos = getAxisPosition_mm(Z);
|
||||
#if ACDEBUG(AC_INFO)
|
||||
|
@ -88,7 +88,7 @@
|
||||
|
||||
#define MARLIN_msg_start_probing PSTR("Probing Point 1/25")
|
||||
#define MARLIN_msg_probing_failed PSTR("Probing Failed")
|
||||
#define MARLIN_msg_ready PSTR("3D Printer Ready.")
|
||||
#define MARLIN_msg_ready PSTR(" Ready.")
|
||||
#define MARLIN_msg_print_paused PSTR("Print Paused")
|
||||
#define MARLIN_msg_print_aborted PSTR("Print Aborted")
|
||||
#define MARLIN_msg_extruder_heating PSTR("E Heating...")
|
||||
|
Loading…
Reference in New Issue
Block a user