Fix stuttering issues on detailed models
- Optimize TFT code for state handling (pause, runout, ...) - Remove multiple state booleans in favour of a single integer - Remove obsolete filament runout code - Increase jerk/accel - Decrease TX buffer size - Revert minimum segment time to factory default
This commit is contained in:
parent
b18052c0c3
commit
425e10c29a
|
@ -144,81 +144,127 @@ void AnycubicTFTClass::KillTFT()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void AnycubicTFTClass::StartPrint(){
|
void AnycubicTFTClass::StartPrint() {
|
||||||
// are we resuming from a pause?
|
// which kind of starting behaviour is needed?
|
||||||
if (TFTstate==ANYCUBIC_TFT_STATE_SDPAUSE) {
|
switch (ai3m_pause_state) {
|
||||||
// was that a regular pause?
|
case 0:
|
||||||
if((!PausedByRunout) && (!PausedByFilamentChange) && (!PausedByNozzleTimeout)) {
|
// no pause, just a regular start
|
||||||
|
starttime=millis();
|
||||||
|
card.startFileprint();
|
||||||
|
TFTstate=ANYCUBIC_TFT_STATE_SDPRINT;
|
||||||
|
#ifdef ANYCUBIC_TFT_DEBUG
|
||||||
|
SERIAL_ECHOPAIR(" DEBUG: AI3M Pause State: ", ai3m_pause_state);
|
||||||
|
SERIAL_EOL();
|
||||||
|
SERIAL_ECHOLNPGM("DEBUG: Regular Start");
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
// regular sd pause
|
||||||
enqueue_and_echo_commands_P(PSTR("M24")); // unpark nozzle
|
enqueue_and_echo_commands_P(PSTR("M24")); // unpark nozzle
|
||||||
#ifdef ANYCUBIC_TFT_DEBUG
|
#ifdef ANYCUBIC_TFT_DEBUG
|
||||||
|
SERIAL_ECHOPAIR(" DEBUG: AI3M Pause State: ", ai3m_pause_state);
|
||||||
|
SERIAL_EOL();
|
||||||
SERIAL_ECHOLNPGM("DEBUG: M24 Resume from regular pause");
|
SERIAL_ECHOLNPGM("DEBUG: M24 Resume from regular pause");
|
||||||
#endif
|
#endif
|
||||||
IsParked=false; // remove parked flag
|
IsParked=false; // remove parked flag
|
||||||
}
|
starttime=millis();
|
||||||
}
|
card.startFileprint(); // resume regularly
|
||||||
starttime=millis();
|
TFTstate=ANYCUBIC_TFT_STATE_SDPRINT;
|
||||||
#ifdef SDSUPPORT
|
ai3m_pause_state = 0;
|
||||||
// was that a regular pause or are we starting a print?
|
#ifdef ANYCUBIC_TFT_DEBUG
|
||||||
if((!PausedByRunout) && (!PausedByFilamentChange) && (!PausedByNozzleTimeout)) {
|
SERIAL_ECHOPAIR(" DEBUG: AI3M Pause State: ", ai3m_pause_state);
|
||||||
card.startFileprint(); // start or resume regularly
|
SERIAL_EOL();
|
||||||
}
|
#endif
|
||||||
// resuming from a pause that was caused by filament runout
|
break;
|
||||||
else if((PausedByRunout) && (!PausedByFilamentChange) && (!PausedByNozzleTimeout)) {
|
case 2:
|
||||||
|
// paused by M600
|
||||||
|
#ifdef ANYCUBIC_TFT_DEBUG
|
||||||
|
SERIAL_ECHOPAIR(" DEBUG: AI3M Pause State: ", ai3m_pause_state);
|
||||||
|
SERIAL_EOL();
|
||||||
|
SERIAL_ECHOLNPGM("DEBUG: Start M108 routine");
|
||||||
|
#endif
|
||||||
|
FilamentChangeResume(); // enter display M108 routine
|
||||||
|
ai3m_pause_state = 0; // clear flag
|
||||||
|
#ifdef ANYCUBIC_TFT_DEBUG
|
||||||
|
SERIAL_ECHOLNPGM("DEBUG: Filament Change Flag cleared");
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
// paused by filament runout
|
||||||
enqueue_and_echo_commands_P(PSTR("M24")); // unpark nozzle and resume
|
enqueue_and_echo_commands_P(PSTR("M24")); // unpark nozzle and resume
|
||||||
#ifdef ANYCUBIC_TFT_DEBUG
|
#ifdef ANYCUBIC_TFT_DEBUG
|
||||||
SERIAL_ECHOLNPGM("DEBUG: M24 Resume from Filament Runout");
|
SERIAL_ECHOLNPGM("DEBUG: M24 Resume from Filament Runout");
|
||||||
#endif
|
#endif
|
||||||
PausedByRunout = IsParked = false; // clear flags
|
IsParked = false; // clear flags
|
||||||
|
ai3m_pause_state = 0;
|
||||||
#ifdef ANYCUBIC_TFT_DEBUG
|
#ifdef ANYCUBIC_TFT_DEBUG
|
||||||
SERIAL_ECHOLNPGM("DEBUG: Filament Pause Flag cleared");
|
SERIAL_ECHOLNPGM("DEBUG: Filament Pause Flag cleared");
|
||||||
#endif
|
#endif
|
||||||
}
|
break;
|
||||||
// was M600 called and the nozzle is not timed out?
|
case 4:
|
||||||
else if((!PausedByRunout) && (PausedByFilamentChange) && (!PausedByNozzleTimeout)) {
|
// nozzle was timed out before (M600), do not enter printing state yet
|
||||||
|
TFTstate=ANYCUBIC_TFT_STATE_SDPAUSE_REQ;
|
||||||
#ifdef ANYCUBIC_TFT_DEBUG
|
#ifdef ANYCUBIC_TFT_DEBUG
|
||||||
SERIAL_ECHOLNPGM("DEBUG: Start M108 routine");
|
SERIAL_ECHOLNPGM("DEBUG: Set Pause again because of timeout");
|
||||||
#endif
|
#endif
|
||||||
FilamentChangeResume(); // enter display M108 routine
|
|
||||||
PausedByFilamentChange=false; // clear flag
|
|
||||||
#ifdef ANYCUBIC_TFT_DEBUG
|
|
||||||
SERIAL_ECHOLNPGM("DEBUG: Filament Change Flag cleared");
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
if (PausedByNozzleTimeout) {
|
|
||||||
// nozzle was timed out before, do not enter printing state yet
|
|
||||||
TFTstate=ANYCUBIC_TFT_STATE_SDPAUSE_REQ;
|
|
||||||
#ifdef ANYCUBIC_TFT_DEBUG
|
|
||||||
SERIAL_ECHOLNPGM("DEBUG: Set Pause again because of timeout");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// clear the timeout flag to ensure the print continues on the
|
// clear the timeout flag to ensure the print continues on the
|
||||||
// next push of CONTINUE
|
// next push of CONTINUE
|
||||||
PausedByNozzleTimeout=false;
|
ai3m_pause_state = 2;
|
||||||
#ifdef ANYCUBIC_TFT_DEBUG
|
#ifdef ANYCUBIC_TFT_DEBUG
|
||||||
SERIAL_ECHOLNPGM("DEBUG: Nozzle timeout flag cleared");
|
SERIAL_ECHOLNPGM("DEBUG: Nozzle timeout flag cleared");
|
||||||
#endif
|
#endif
|
||||||
} else {
|
break;
|
||||||
// regular resume/start or all specific resume routines are done,
|
case 5:
|
||||||
// set printing state again
|
// nozzle was timed out before (runout), do not enter printing state yet
|
||||||
TFTstate=ANYCUBIC_TFT_STATE_SDPRINT;
|
TFTstate=ANYCUBIC_TFT_STATE_SDPAUSE_REQ;
|
||||||
|
#ifdef ANYCUBIC_TFT_DEBUG
|
||||||
|
SERIAL_ECHOLNPGM("DEBUG: Set Pause again because of timeout");
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// clear the timeout flag to ensure the print continues on the
|
||||||
|
// next push of CONTINUE
|
||||||
|
ai3m_pause_state = 3;
|
||||||
|
#ifdef ANYCUBIC_TFT_DEBUG
|
||||||
|
SERIAL_ECHOLNPGM("DEBUG: Nozzle timeout flag cleared");
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AnycubicTFTClass::PausePrint(){
|
void AnycubicTFTClass::PausePrint() {
|
||||||
#ifdef SDSUPPORT
|
#ifdef SDSUPPORT
|
||||||
if((!PausedByRunout)) { // is this a regular pause?
|
if(ai3m_pause_state < 2) { // is this a regular pause?
|
||||||
card.pauseSDPrint(); // pause print regularly
|
card.pauseSDPrint(); // pause print regularly
|
||||||
#ifdef ANYCUBIC_TFT_DEBUG
|
#ifdef ANYCUBIC_TFT_DEBUG
|
||||||
|
SERIAL_ECHOPAIR(" DEBUG: AI3M Pause State: ", ai3m_pause_state);
|
||||||
|
SERIAL_EOL();
|
||||||
SERIAL_ECHOLNPGM("DEBUG: Regular Pause");
|
SERIAL_ECHOLNPGM("DEBUG: Regular Pause");
|
||||||
#endif
|
#endif
|
||||||
} else { // pause caused by filament runout
|
} else { // pause caused by filament runout
|
||||||
#ifdef ANYCUBIC_TFT_DEBUG
|
#ifdef ANYCUBIC_TFT_DEBUG
|
||||||
SERIAL_ECHOLNPGM("DEBUG: Filament Runout Pause");
|
SERIAL_ECHOLNPGM("DEBUG: Filament Runout Pause");
|
||||||
#endif
|
#endif
|
||||||
|
// filament runout, retract and beep
|
||||||
|
enqueue_and_echo_commands_P(PSTR("G91")); // relative mode
|
||||||
|
enqueue_and_echo_commands_P(PSTR("G1 E-3 F1800")); // retract 3mm
|
||||||
|
enqueue_and_echo_commands_P(PSTR("G90")); // absolute mode
|
||||||
|
buzzer.tone(200, 1567);
|
||||||
|
buzzer.tone(200, 1174);
|
||||||
|
buzzer.tone(200, 1567);
|
||||||
|
buzzer.tone(200, 1174);
|
||||||
|
buzzer.tone(2000, 1567);
|
||||||
|
#ifdef ANYCUBIC_TFT_DEBUG
|
||||||
|
SERIAL_ECHOLNPGM("DEBUG: Filament runout - Retract, beep and park.");
|
||||||
|
#endif
|
||||||
enqueue_and_echo_commands_P(PSTR("M25")); // pause print and park nozzle
|
enqueue_and_echo_commands_P(PSTR("M25")); // pause print and park nozzle
|
||||||
|
ai3m_pause_state = 3;
|
||||||
#ifdef ANYCUBIC_TFT_DEBUG
|
#ifdef ANYCUBIC_TFT_DEBUG
|
||||||
SERIAL_ECHOLNPGM("DEBUG: M25 sent, parking nozzle");
|
SERIAL_ECHOLNPGM("DEBUG: M25 sent, parking nozzle");
|
||||||
|
SERIAL_ECHOPAIR(" DEBUG: AI3M Pause State: ", ai3m_pause_state);
|
||||||
|
SERIAL_EOL();
|
||||||
#endif
|
#endif
|
||||||
IsParked = true;
|
IsParked = true;
|
||||||
// show filament runout prompt on screen
|
// show filament runout prompt on screen
|
||||||
|
@ -230,24 +276,6 @@ void AnycubicTFTClass::PausePrint(){
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
TFTstate=ANYCUBIC_TFT_STATE_SDPAUSE_REQ;
|
TFTstate=ANYCUBIC_TFT_STATE_SDPAUSE_REQ;
|
||||||
#ifdef ANYCUBIC_FILAMENT_RUNOUT_SENSOR
|
|
||||||
// regular pause
|
|
||||||
if(FilamentTestStatus) {
|
|
||||||
ANYCUBIC_SERIAL_PROTOCOLPGM("J05");
|
|
||||||
ANYCUBIC_SERIAL_ENTER();
|
|
||||||
#ifdef ANYCUBIC_TFT_DEBUG
|
|
||||||
SERIAL_ECHOLNPGM("TFT Serial Debug: SD print paused... J05");
|
|
||||||
#endif
|
|
||||||
// pause because of filament sensor
|
|
||||||
} else {
|
|
||||||
// show filament runout prompt on screen
|
|
||||||
ANYCUBIC_SERIAL_PROTOCOLPGM("J23");
|
|
||||||
ANYCUBIC_SERIAL_ENTER();
|
|
||||||
#ifdef ANYCUBIC_TFT_DEBUG
|
|
||||||
SERIAL_ECHOLNPGM("TFT Serial Debug: Filament runout while printing... J23");
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AnycubicTFTClass::StopPrint(){
|
void AnycubicTFTClass::StopPrint(){
|
||||||
|
@ -259,12 +287,18 @@ void AnycubicTFTClass::StopPrint(){
|
||||||
#endif
|
#endif
|
||||||
print_job_timer.stop();
|
print_job_timer.stop();
|
||||||
thermalManager.disable_all_heaters();
|
thermalManager.disable_all_heaters();
|
||||||
IsParked = false; // we are not parked yet, do it in the display state routine
|
// we are not parked yet, do it in the display state routine
|
||||||
|
IsParked = false;
|
||||||
// turn off fan, cancel any heatups and set display state
|
// turn off fan, cancel any heatups and set display state
|
||||||
#if FAN_COUNT > 0
|
#if FAN_COUNT > 0
|
||||||
for (uint8_t i = 0; i < FAN_COUNT; i++) fanSpeeds[i] = 0;
|
for (uint8_t i = 0; i < FAN_COUNT; i++) fanSpeeds[i] = 0;
|
||||||
#endif
|
#endif
|
||||||
wait_for_heatup=false;
|
wait_for_heatup=false;
|
||||||
|
ai3m_pause_state = 0;
|
||||||
|
#ifdef ANYCUBIC_TFT_DEBUG
|
||||||
|
SERIAL_ECHOPAIR(" DEBUG: AI3M Pause State: ", ai3m_pause_state);
|
||||||
|
SERIAL_EOL();
|
||||||
|
#endif
|
||||||
TFTstate=ANYCUBIC_TFT_STATE_SDSTOP_REQ;
|
TFTstate=ANYCUBIC_TFT_STATE_SDSTOP_REQ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -289,7 +323,11 @@ void AnycubicTFTClass::FilamentChangeResume(){
|
||||||
void AnycubicTFTClass::FilamentChangePause(){
|
void AnycubicTFTClass::FilamentChangePause(){
|
||||||
// set filament change flag to ensure the M108 routine
|
// set filament change flag to ensure the M108 routine
|
||||||
// gets used when the user hits CONTINUE
|
// gets used when the user hits CONTINUE
|
||||||
PausedByFilamentChange=true;
|
ai3m_pause_state = 2;
|
||||||
|
#ifdef ANYCUBIC_TFT_DEBUG
|
||||||
|
SERIAL_ECHOPAIR(" DEBUG: AI3M Pause State: ", ai3m_pause_state);
|
||||||
|
SERIAL_EOL();
|
||||||
|
#endif
|
||||||
|
|
||||||
// call M600 and set display state to paused
|
// call M600 and set display state to paused
|
||||||
enqueue_and_echo_commands_P(PSTR("M600"));
|
enqueue_and_echo_commands_P(PSTR("M600"));
|
||||||
|
@ -313,11 +351,19 @@ void AnycubicTFTClass::ReheatNozzle(){
|
||||||
#ifdef ANYCUBIC_TFT_DEBUG
|
#ifdef ANYCUBIC_TFT_DEBUG
|
||||||
SERIAL_ECHOLNPGM("DEBUG: Clear flags");
|
SERIAL_ECHOLNPGM("DEBUG: Clear flags");
|
||||||
#endif
|
#endif
|
||||||
nozzle_timed_out = false;
|
|
||||||
|
|
||||||
// clear waiting flags
|
// clear waiting flags
|
||||||
|
nozzle_timed_out = false;
|
||||||
wait_for_user = false;
|
wait_for_user = false;
|
||||||
wait_for_heatup = false;
|
wait_for_heatup = false;
|
||||||
|
// lower the pause flag by two to restore initial pause condition
|
||||||
|
if (ai3m_pause_state > 3) {
|
||||||
|
ai3m_pause_state -= 2;
|
||||||
|
#ifdef ANYCUBIC_TFT_DEBUG
|
||||||
|
SERIAL_ECHOPAIR(" DEBUG: NTO done, AI3M Pause State: ", ai3m_pause_state);
|
||||||
|
SERIAL_EOL();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
// set pause state to show CONTINUE button again
|
// set pause state to show CONTINUE button again
|
||||||
TFTstate=ANYCUBIC_TFT_STATE_SDPAUSE_REQ;
|
TFTstate=ANYCUBIC_TFT_STATE_SDPAUSE_REQ;
|
||||||
|
@ -339,6 +385,11 @@ void AnycubicTFTClass::ParkAfterStop(){
|
||||||
}
|
}
|
||||||
enqueue_and_echo_commands_P(PSTR("M84")); // disable stepper motors
|
enqueue_and_echo_commands_P(PSTR("M84")); // disable stepper motors
|
||||||
enqueue_and_echo_commands_P(PSTR("M27")); // force report of SD status
|
enqueue_and_echo_commands_P(PSTR("M27")); // force report of SD status
|
||||||
|
ai3m_pause_state = 0;
|
||||||
|
#ifdef ANYCUBIC_TFT_DEBUG
|
||||||
|
SERIAL_ECHOPAIR(" DEBUG: AI3M Pause State: ", ai3m_pause_state);
|
||||||
|
SERIAL_EOL();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
float AnycubicTFTClass::CodeValue()
|
float AnycubicTFTClass::CodeValue()
|
||||||
|
@ -583,7 +634,7 @@ void AnycubicTFTClass::StateHandler()
|
||||||
if (card.isFileOpen()) {
|
if (card.isFileOpen()) {
|
||||||
// File is still open --> paused
|
// File is still open --> paused
|
||||||
TFTstate=ANYCUBIC_TFT_STATE_SDPAUSE;
|
TFTstate=ANYCUBIC_TFT_STATE_SDPAUSE;
|
||||||
} else {
|
} else if ((!card.isFileOpen()) && (ai3m_pause_state == 0)) {
|
||||||
// File is closed --> stopped
|
// File is closed --> stopped
|
||||||
TFTstate=ANYCUBIC_TFT_STATE_IDLE;
|
TFTstate=ANYCUBIC_TFT_STATE_IDLE;
|
||||||
ANYCUBIC_SERIAL_PROTOCOLPGM("J14");// J14 print done
|
ANYCUBIC_SERIAL_PROTOCOLPGM("J14");// J14 print done
|
||||||
|
@ -591,6 +642,11 @@ void AnycubicTFTClass::StateHandler()
|
||||||
#ifdef ANYCUBIC_TFT_DEBUG
|
#ifdef ANYCUBIC_TFT_DEBUG
|
||||||
SERIAL_ECHOLNPGM("TFT Serial Debug: SD print done... J14");
|
SERIAL_ECHOLNPGM("TFT Serial Debug: SD print done... J14");
|
||||||
#endif
|
#endif
|
||||||
|
ai3m_pause_state = 0;
|
||||||
|
#ifdef ANYCUBIC_TFT_DEBUG
|
||||||
|
SERIAL_ECHOPAIR(" DEBUG: AI3M Pause State: ", ai3m_pause_state);
|
||||||
|
SERIAL_EOL();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -611,9 +667,13 @@ void AnycubicTFTClass::StateHandler()
|
||||||
#ifdef SDSUPPORT
|
#ifdef SDSUPPORT
|
||||||
if((!card.sdprinting) && (!planner.movesplanned())) {
|
if((!card.sdprinting) && (!planner.movesplanned())) {
|
||||||
// We have to wait until the sd card printing has been settled
|
// We have to wait until the sd card printing has been settled
|
||||||
if((!PausedByRunout) && (!PausedByFilamentChange) && (!PausedByNozzleTimeout)) {
|
if(ai3m_pause_state < 2) {
|
||||||
|
|
||||||
// no flags, this is a regular pause.
|
// no flags, this is a regular pause.
|
||||||
|
ai3m_pause_state = 1;
|
||||||
#ifdef ANYCUBIC_TFT_DEBUG
|
#ifdef ANYCUBIC_TFT_DEBUG
|
||||||
|
SERIAL_ECHOPAIR(" DEBUG: AI3M Pause State: ", ai3m_pause_state);
|
||||||
|
SERIAL_EOL();
|
||||||
SERIAL_ECHOLNPGM("DEBUG: Regular Pause requested");
|
SERIAL_ECHOLNPGM("DEBUG: Regular Pause requested");
|
||||||
#endif
|
#endif
|
||||||
if(!IsParked) {
|
if(!IsParked) {
|
||||||
|
@ -621,19 +681,6 @@ void AnycubicTFTClass::StateHandler()
|
||||||
enqueue_and_echo_commands_P(PSTR("M125 L2"));
|
enqueue_and_echo_commands_P(PSTR("M125 L2"));
|
||||||
IsParked = true;
|
IsParked = true;
|
||||||
}
|
}
|
||||||
} else if((PausedByRunout)) {
|
|
||||||
// filament runout, retract and beep
|
|
||||||
enqueue_and_echo_commands_P(PSTR("G91")); // relative mode
|
|
||||||
enqueue_and_echo_commands_P(PSTR("G1 E-3 F1800")); // retract 3mm
|
|
||||||
enqueue_and_echo_commands_P(PSTR("G90")); // absolute mode
|
|
||||||
buzzer.tone(200, 1567);
|
|
||||||
buzzer.tone(200, 1174);
|
|
||||||
buzzer.tone(200, 1567);
|
|
||||||
buzzer.tone(200, 1174);
|
|
||||||
buzzer.tone(2000, 1567);
|
|
||||||
#ifdef ANYCUBIC_TFT_DEBUG
|
|
||||||
SERIAL_ECHOLNPGM("DEBUG: Filament runout - Retract, beep and park.");
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
#ifdef ANYCUBIC_FILAMENT_RUNOUT_SENSOR
|
#ifdef ANYCUBIC_FILAMENT_RUNOUT_SENSOR
|
||||||
if(FilamentTestStatus) {
|
if(FilamentTestStatus) {
|
||||||
|
@ -659,6 +706,11 @@ void AnycubicTFTClass::StateHandler()
|
||||||
#ifdef ANYCUBIC_TFT_DEBUG
|
#ifdef ANYCUBIC_TFT_DEBUG
|
||||||
SERIAL_ECHOLNPGM("TFT Serial Debug: SD print stopped... J16");
|
SERIAL_ECHOLNPGM("TFT Serial Debug: SD print stopped... J16");
|
||||||
#endif
|
#endif
|
||||||
|
ai3m_pause_state = 0;
|
||||||
|
#ifdef ANYCUBIC_TFT_DEBUG
|
||||||
|
SERIAL_ECHOPAIR(" DEBUG: AI3M Pause State: ", ai3m_pause_state);
|
||||||
|
SERIAL_EOL();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
// did we park the hotend already?
|
// did we park the hotend already?
|
||||||
if((!IsParked) && (!card.sdprinting) && (!planner.movesplanned())) {
|
if((!IsParked) && (!card.sdprinting) && (!planner.movesplanned())) {
|
||||||
|
@ -702,9 +754,10 @@ void AnycubicTFTClass::FilamentRunout()
|
||||||
SERIAL_ECHOLNPGM("DEBUG: 3000ms delay done");
|
SERIAL_ECHOLNPGM("DEBUG: 3000ms delay done");
|
||||||
#endif
|
#endif
|
||||||
if((card.sdprinting==true)) {
|
if((card.sdprinting==true)) {
|
||||||
PausedByRunout=true; // set runout pause flag
|
ai3m_pause_state = 3; // set runout pause flag
|
||||||
#ifdef ANYCUBIC_TFT_DEBUG
|
#ifdef ANYCUBIC_TFT_DEBUG
|
||||||
SERIAL_ECHOLNPGM("DEBUG: Filament Pause Flag set");
|
SERIAL_ECHOPAIR(" DEBUG: AI3M Pause State: ", ai3m_pause_state);
|
||||||
|
SERIAL_EOL();
|
||||||
#endif
|
#endif
|
||||||
PausePrint();
|
PausePrint();
|
||||||
} else if((card.sdprinting==false)) {
|
} else if((card.sdprinting==false)) {
|
||||||
|
@ -877,6 +930,11 @@ void AnycubicTFTClass::GetCommandFromTFT()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
ai3m_pause_state = 0;
|
||||||
|
#ifdef ANYCUBIC_TFT_DEBUG
|
||||||
|
SERIAL_ECHOPAIR(" DEBUG: AI3M Pause State: ", ai3m_pause_state);
|
||||||
|
SERIAL_EOL();
|
||||||
|
#endif
|
||||||
StopPrint();
|
StopPrint();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -906,6 +964,11 @@ void AnycubicTFTClass::GetCommandFromTFT()
|
||||||
ANYCUBIC_SERIAL_PROTOCOLPGM("J16");
|
ANYCUBIC_SERIAL_PROTOCOLPGM("J16");
|
||||||
ANYCUBIC_SERIAL_ENTER();
|
ANYCUBIC_SERIAL_ENTER();
|
||||||
TFTstate=ANYCUBIC_TFT_STATE_IDLE;
|
TFTstate=ANYCUBIC_TFT_STATE_IDLE;
|
||||||
|
ai3m_pause_state = 0;
|
||||||
|
#ifdef ANYCUBIC_TFT_DEBUG
|
||||||
|
SERIAL_ECHOPAIR(" DEBUG: AI3M Pause State: ", ai3m_pause_state);
|
||||||
|
SERIAL_EOL();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
@ -949,6 +1012,11 @@ void AnycubicTFTClass::GetCommandFromTFT()
|
||||||
#ifdef SDSUPPORT
|
#ifdef SDSUPPORT
|
||||||
if((!planner.movesplanned()) && (TFTstate!=ANYCUBIC_TFT_STATE_SDPAUSE) && (TFTstate!=ANYCUBIC_TFT_STATE_SDOUTAGE) && (card.isFileOpen()))
|
if((!planner.movesplanned()) && (TFTstate!=ANYCUBIC_TFT_STATE_SDPAUSE) && (TFTstate!=ANYCUBIC_TFT_STATE_SDOUTAGE) && (card.isFileOpen()))
|
||||||
{
|
{
|
||||||
|
ai3m_pause_state = 0;
|
||||||
|
#ifdef ANYCUBIC_TFT_DEBUG
|
||||||
|
SERIAL_ECHOPAIR(" DEBUG: AI3M Pause State: ", ai3m_pause_state);
|
||||||
|
SERIAL_EOL();
|
||||||
|
#endif
|
||||||
StartPrint();
|
StartPrint();
|
||||||
IsParked = false;
|
IsParked = false;
|
||||||
ANYCUBIC_SERIAL_PROTOCOLPGM("J04"); // J04 Starting Print
|
ANYCUBIC_SERIAL_PROTOCOLPGM("J04"); // J04 Starting Print
|
||||||
|
|
|
@ -56,9 +56,18 @@ public:
|
||||||
void FilamentRunout();
|
void FilamentRunout();
|
||||||
void KillTFT();
|
void KillTFT();
|
||||||
char TFTstate=ANYCUBIC_TFT_STATE_IDLE;
|
char TFTstate=ANYCUBIC_TFT_STATE_IDLE;
|
||||||
bool PausedByRunout=false;
|
|
||||||
bool PausedByFilamentChange=false;
|
/**
|
||||||
bool PausedByNozzleTimeout=false;
|
* Anycubic TFT pause states:
|
||||||
|
*
|
||||||
|
* 0 - printing / stopped
|
||||||
|
* 1 - regular pause
|
||||||
|
* 2 - M600 pause
|
||||||
|
* 3 - filament runout pause
|
||||||
|
* 4 - nozzle timeout on M600
|
||||||
|
* 5 - nozzle timeout on filament runout
|
||||||
|
*/
|
||||||
|
uint8_t ai3m_pause_state = 0;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
char TFTcmdbuffer[TFTBUFSIZE][TFT_MAX_CMD_SIZE];
|
char TFTcmdbuffer[TFTBUFSIZE][TFT_MAX_CMD_SIZE];
|
||||||
|
|
|
@ -629,7 +629,7 @@
|
||||||
* Override with M201
|
* Override with M201
|
||||||
* X, Y, Z, E0 [, E1[, E2[, E3[, E4]]]]
|
* X, Y, Z, E0 [, E1[, E2[, E3[, E4]]]]
|
||||||
*/
|
*/
|
||||||
#define DEFAULT_MAX_ACCELERATION { 2000, 1200, 60, 10000 }
|
#define DEFAULT_MAX_ACCELERATION { 3000, 2000, 60, 10000 }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default Acceleration (change/s) change = mm/s
|
* Default Acceleration (change/s) change = mm/s
|
||||||
|
@ -639,9 +639,9 @@
|
||||||
* M204 R Retract Acceleration
|
* M204 R Retract Acceleration
|
||||||
* M204 T Travel Acceleration
|
* M204 T Travel Acceleration
|
||||||
*/
|
*/
|
||||||
#define DEFAULT_ACCELERATION 1200 // X, Y, Z and E acceleration for printing moves
|
#define DEFAULT_ACCELERATION 1500 // X, Y, Z and E acceleration for printing moves
|
||||||
#define DEFAULT_RETRACT_ACCELERATION 3000 // E acceleration for retracts
|
#define DEFAULT_RETRACT_ACCELERATION 3000 // E acceleration for retracts
|
||||||
#define DEFAULT_TRAVEL_ACCELERATION 1500 // X, Y, Z acceleration for travel (non printing) moves
|
#define DEFAULT_TRAVEL_ACCELERATION 3000 // X, Y, Z acceleration for travel (non printing) moves
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default Jerk (mm/s)
|
* Default Jerk (mm/s)
|
||||||
|
@ -651,8 +651,8 @@
|
||||||
* When changing speed and direction, if the difference is less than the
|
* When changing speed and direction, if the difference is less than the
|
||||||
* value set here, it may happen instantaneously.
|
* value set here, it may happen instantaneously.
|
||||||
*/
|
*/
|
||||||
#define DEFAULT_XJERK 8.0
|
#define DEFAULT_XJERK 10.0
|
||||||
#define DEFAULT_YJERK 8.0
|
#define DEFAULT_YJERK 10.0
|
||||||
#define DEFAULT_ZJERK 0.4
|
#define DEFAULT_ZJERK 0.4
|
||||||
#define DEFAULT_EJERK 5.0
|
#define DEFAULT_EJERK 5.0
|
||||||
|
|
||||||
|
|
|
@ -431,7 +431,7 @@
|
||||||
// @section extras
|
// @section extras
|
||||||
|
|
||||||
// minimum time in microseconds that a movement needs to take if the buffer is emptied.
|
// minimum time in microseconds that a movement needs to take if the buffer is emptied.
|
||||||
#define DEFAULT_MINSEGMENTTIME 30000
|
#define DEFAULT_MINSEGMENTTIME 20000
|
||||||
|
|
||||||
// If defined the movements slow down when the look ahead buffer is only half full
|
// If defined the movements slow down when the look ahead buffer is only half full
|
||||||
#define SLOWDOWN
|
#define SLOWDOWN
|
||||||
|
@ -889,7 +889,7 @@
|
||||||
// For debug-echo: 128 bytes for the optimal speed.
|
// For debug-echo: 128 bytes for the optimal speed.
|
||||||
// Other output doesn't need to be that speedy.
|
// Other output doesn't need to be that speedy.
|
||||||
// :[0, 2, 4, 8, 16, 32, 64, 128, 256]
|
// :[0, 2, 4, 8, 16, 32, 64, 128, 256]
|
||||||
#define TX_BUFFER_SIZE 256
|
#define TX_BUFFER_SIZE 4
|
||||||
|
|
||||||
// Host Receive Buffer Size
|
// Host Receive Buffer Size
|
||||||
// Without XON/XOFF flow control (see SERIAL_XON_XOFF below) 32 bytes should be enough.
|
// Without XON/XOFF flow control (see SERIAL_XON_XOFF below) 32 bytes should be enough.
|
||||||
|
|
|
@ -7212,9 +7212,6 @@ inline void gcode_M17() {
|
||||||
*/
|
*/
|
||||||
static void wait_for_filament_reload(const int8_t max_beep_count=0) {
|
static void wait_for_filament_reload(const int8_t max_beep_count=0) {
|
||||||
nozzle_timed_out = false;
|
nozzle_timed_out = false;
|
||||||
#ifdef ANYCUBIC_TFT_MODEL
|
|
||||||
AnycubicTFT.PausedByNozzleTimeout = false;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if ENABLED(ULTIPANEL)
|
#if ENABLED(ULTIPANEL)
|
||||||
lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_INSERT);
|
lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_INSERT);
|
||||||
|
@ -7249,7 +7246,13 @@ inline void gcode_M17() {
|
||||||
if (nozzle_timed_out) {
|
if (nozzle_timed_out) {
|
||||||
|
|
||||||
#ifdef ANYCUBIC_TFT_MODEL
|
#ifdef ANYCUBIC_TFT_MODEL
|
||||||
AnycubicTFT.PausedByNozzleTimeout=true;
|
if (AnycubicTFT.ai3m_pause_state < 3) {
|
||||||
|
AnycubicTFT.ai3m_pause_state += 2;
|
||||||
|
#ifdef ANYCUBIC_TFT_DEBUG
|
||||||
|
SERIAL_ECHOPAIR(" DEBUG: NTO - AI3M Pause State set to: ", AnycubicTFT.ai3m_pause_state);
|
||||||
|
SERIAL_EOL();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
#ifdef ANYCUBIC_TFT_DEBUG
|
#ifdef ANYCUBIC_TFT_DEBUG
|
||||||
SERIAL_ECHOLNPGM("DEBUG: Nozzle timeout flag set");
|
SERIAL_ECHOLNPGM("DEBUG: Nozzle timeout flag set");
|
||||||
#endif
|
#endif
|
||||||
|
@ -7296,8 +7299,14 @@ inline void gcode_M17() {
|
||||||
|
|
||||||
wait_for_user = true; // Wait for user to load filament
|
wait_for_user = true; // Wait for user to load filament
|
||||||
nozzle_timed_out = false;
|
nozzle_timed_out = false;
|
||||||
#ifdef ANYCUBIC_TFT_DEBUG
|
#ifdef ANYCUBIC_TFT_MODEL
|
||||||
AnycubicTFT.PausedByNozzleTimeout = false;
|
if (AnycubicTFT.ai3m_pause_state > 3) {
|
||||||
|
AnycubicTFT.ai3m_pause_state -= 2;
|
||||||
|
#ifdef ANYCUBIC_TFT_DEBUG
|
||||||
|
SERIAL_ECHOPAIR(" DEBUG: NTO - AI3M Pause State set to: ", AnycubicTFT.ai3m_pause_state);
|
||||||
|
SERIAL_EOL();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if HAS_BUZZER
|
#if HAS_BUZZER
|
||||||
|
@ -7334,7 +7343,13 @@ inline void gcode_M17() {
|
||||||
// Re-enable the heaters if they timed out
|
// Re-enable the heaters if they timed out
|
||||||
nozzle_timed_out = false;
|
nozzle_timed_out = false;
|
||||||
#ifdef ANYCUBIC_TFT_MODEL
|
#ifdef ANYCUBIC_TFT_MODEL
|
||||||
AnycubicTFT.PausedByNozzleTimeout = false;
|
if (AnycubicTFT.ai3m_pause_state > 3) {
|
||||||
|
AnycubicTFT.ai3m_pause_state -= 2;
|
||||||
|
#ifdef ANYCUBIC_TFT_DEBUG
|
||||||
|
SERIAL_ECHOPAIR(" DEBUG: NTO - AI3M Pause State set to: ", AnycubicTFT.ai3m_pause_state);
|
||||||
|
SERIAL_EOL();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
HOTEND_LOOP() {
|
HOTEND_LOOP() {
|
||||||
|
@ -8569,7 +8584,7 @@ inline void gcode_M109() {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// flush the serial buffer after heating to prevent lockup by m105
|
// flush the serial buffer after heating to prevent lockup by m105
|
||||||
SERIAL_FLUSH();
|
//SERIAL_FLUSH();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8724,7 +8739,7 @@ inline void gcode_M109() {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// flush the serial buffer after heating to prevent lockup by m105
|
// flush the serial buffer after heating to prevent lockup by m105
|
||||||
SERIAL_FLUSH();
|
//SERIAL_FLUSH();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // HAS_HEATED_BED
|
#endif // HAS_HEATED_BED
|
||||||
|
@ -11011,6 +11026,13 @@ inline void gcode_M502() {
|
||||||
#ifdef ANYCUBIC_TFT_MODEL
|
#ifdef ANYCUBIC_TFT_MODEL
|
||||||
#ifdef SDSUPPORT
|
#ifdef SDSUPPORT
|
||||||
if (card.sdprinting) { // are we printing from sd?
|
if (card.sdprinting) { // are we printing from sd?
|
||||||
|
if (AnycubicTFT.ai3m_pause_state < 2) {
|
||||||
|
AnycubicTFT.ai3m_pause_state = 2;
|
||||||
|
#ifdef ANYCUBIC_TFT_DEBUG
|
||||||
|
SERIAL_ECHOPAIR(" DEBUG: M600 - AI3M Pause State set to: ", AnycubicTFT.ai3m_pause_state);
|
||||||
|
SERIAL_EOL();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
#ifdef ANYCUBIC_TFT_DEBUG
|
#ifdef ANYCUBIC_TFT_DEBUG
|
||||||
SERIAL_ECHOLNPGM("DEBUG: Enter M600 TFTstate routine");
|
SERIAL_ECHOLNPGM("DEBUG: Enter M600 TFTstate routine");
|
||||||
#endif
|
#endif
|
||||||
|
@ -11018,10 +11040,7 @@ inline void gcode_M502() {
|
||||||
#ifdef ANYCUBIC_TFT_DEBUG
|
#ifdef ANYCUBIC_TFT_DEBUG
|
||||||
SERIAL_ECHOLNPGM("DEBUG: Set TFTstate to SDPAUSE_REQ");
|
SERIAL_ECHOLNPGM("DEBUG: Set TFTstate to SDPAUSE_REQ");
|
||||||
#endif
|
#endif
|
||||||
AnycubicTFT.PausedByFilamentChange=true; // set flag to ensure correct resume routine gets executed
|
// set flag to ensure correct resume routine gets executed
|
||||||
#ifdef ANYCUBIC_TFT_DEBUG
|
|
||||||
SERIAL_ECHOLNPGM("DEBUG: Set filament change flag");
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -54,7 +54,7 @@
|
||||||
* here we define this default string as the date where the latest release
|
* here we define this default string as the date where the latest release
|
||||||
* version was tagged.
|
* version was tagged.
|
||||||
*/
|
*/
|
||||||
#define STRING_DISTRIBUTION_DATE "2019-03-24"
|
#define STRING_DISTRIBUTION_DATE "2019-04-03"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Required minimum Configuration.h and Configuration_adv.h file versions.
|
* Required minimum Configuration.h and Configuration_adv.h file versions.
|
||||||
|
|
Loading…
Reference in New Issue