Fix indentation
Improve readability and fix #ifdef and #endif indentations
This commit is contained in:
parent
85c32a2bb6
commit
90e27ff21b
|
@ -15,7 +15,7 @@
|
||||||
You should have received a copy of the GNU Lesser General Public
|
You should have received a copy of the GNU Lesser General Public
|
||||||
License along with this library; if not, write to the Free Software
|
License along with this library; if not, write to the Free Software
|
||||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
@ -51,24 +51,24 @@ char *itostr2(const uint8_t &x)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef ULTRA_LCD
|
#ifndef ULTRA_LCD
|
||||||
#define DIGIT(n) ('0' + (n))
|
#define DIGIT(n) ('0' + (n))
|
||||||
#define DIGIMOD(n, f) DIGIT((n)/(f) % 10)
|
#define DIGIMOD(n, f) DIGIT((n)/(f) % 10)
|
||||||
#define RJDIGIT(n, f) ((n) >= (f) ? DIGIMOD(n, f) : ' ')
|
#define RJDIGIT(n, f) ((n) >= (f) ? DIGIMOD(n, f) : ' ')
|
||||||
#define MINUSOR(n, alt) (n >= 0 ? (alt) : (n = -n, '-'))
|
#define MINUSOR(n, alt) (n >= 0 ? (alt) : (n = -n, '-'))
|
||||||
|
|
||||||
|
|
||||||
char* itostr3(const int x) {
|
char* itostr3(const int x) {
|
||||||
int xx = x;
|
int xx = x;
|
||||||
_conv[4] = MINUSOR(xx, RJDIGIT(xx, 100));
|
_conv[4] = MINUSOR(xx, RJDIGIT(xx, 100));
|
||||||
_conv[5] = RJDIGIT(xx, 10);
|
_conv[5] = RJDIGIT(xx, 10);
|
||||||
_conv[6] = DIGIMOD(xx, 1);
|
_conv[6] = DIGIMOD(xx, 1);
|
||||||
return &_conv[4];
|
return &_conv[4];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Convert signed float to fixed-length string with 023.45 / -23.45 format
|
// Convert signed float to fixed-length string with 023.45 / -23.45 format
|
||||||
|
|
||||||
char *ftostr32(const float &x) {
|
char *ftostr32(const float &x) {
|
||||||
long xx = x * 100;
|
long xx = x * 100;
|
||||||
_conv[1] = MINUSOR(xx, DIGIMOD(xx, 10000));
|
_conv[1] = MINUSOR(xx, DIGIMOD(xx, 10000));
|
||||||
_conv[2] = DIGIMOD(xx, 1000);
|
_conv[2] = DIGIMOD(xx, 1000);
|
||||||
|
@ -77,7 +77,7 @@ char *ftostr32(const float &x) {
|
||||||
_conv[5] = DIGIMOD(xx, 10);
|
_conv[5] = DIGIMOD(xx, 10);
|
||||||
_conv[6] = DIGIMOD(xx, 1);
|
_conv[6] = DIGIMOD(xx, 1);
|
||||||
return &_conv[1];
|
return &_conv[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -93,23 +93,23 @@ void AnycubicTFTClass::Setup() {
|
||||||
ANYCUBIC_SERIAL_PROTOCOLPGM("J12"); // J12 Ready
|
ANYCUBIC_SERIAL_PROTOCOLPGM("J12"); // J12 Ready
|
||||||
ANYCUBIC_SERIAL_ENTER();
|
ANYCUBIC_SERIAL_ENTER();
|
||||||
|
|
||||||
#if ENABLED(SDSUPPORT) && PIN_EXISTS(SD_DETECT)
|
#if ENABLED(SDSUPPORT) && PIN_EXISTS(SD_DETECT)
|
||||||
pinMode(SD_DETECT_PIN, INPUT);
|
pinMode(SD_DETECT_PIN, INPUT);
|
||||||
WRITE(SD_DETECT_PIN, HIGH);
|
WRITE(SD_DETECT_PIN, HIGH);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ENABLED(ANYCUBIC_FILAMENT_RUNOUT_SENSOR)
|
#if ENABLED(ANYCUBIC_FILAMENT_RUNOUT_SENSOR)
|
||||||
pinMode(FIL_RUNOUT_PIN,INPUT);
|
pinMode(FIL_RUNOUT_PIN,INPUT);
|
||||||
WRITE(FIL_RUNOUT_PIN,HIGH);
|
WRITE(FIL_RUNOUT_PIN,HIGH);
|
||||||
if(READ(FIL_RUNOUT_PIN)==true)
|
if(READ(FIL_RUNOUT_PIN)==true)
|
||||||
{
|
{
|
||||||
ANYCUBIC_SERIAL_PROTOCOLPGM("J15"); //J15 FILAMENT LACK
|
ANYCUBIC_SERIAL_PROTOCOLPGM("J15"); //J15 FILAMENT LACK
|
||||||
ANYCUBIC_SERIAL_ENTER();
|
ANYCUBIC_SERIAL_ENTER();
|
||||||
#ifdef ANYCUBIC_TFT_DEBUG
|
#ifdef ANYCUBIC_TFT_DEBUG
|
||||||
SERIAL_ECHOLNPGM("TFT Serial Debug: Filament runout... J15");
|
SERIAL_ECHOLNPGM("TFT Serial Debug: Filament runout... J15");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
SelectedDirectory[0]=0;
|
SelectedDirectory[0]=0;
|
||||||
SpecialMenu=false;
|
SpecialMenu=false;
|
||||||
|
@ -129,9 +129,9 @@ void AnycubicTFTClass::KillTFT()
|
||||||
{
|
{
|
||||||
ANYCUBIC_SERIAL_PROTOCOLPGM("J11"); // J11 Kill
|
ANYCUBIC_SERIAL_PROTOCOLPGM("J11"); // J11 Kill
|
||||||
ANYCUBIC_SERIAL_ENTER();
|
ANYCUBIC_SERIAL_ENTER();
|
||||||
#ifdef ANYCUBIC_TFT_DEBUG
|
#ifdef ANYCUBIC_TFT_DEBUG
|
||||||
SERIAL_ECHOLNPGM("TFT Serial Debug: Kill command... J11");
|
SERIAL_ECHOLNPGM("TFT Serial Debug: Kill command... J11");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -146,7 +146,7 @@ void AnycubicTFTClass::StartPrint(){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
starttime=millis();
|
starttime=millis();
|
||||||
#ifdef SDSUPPORT
|
#ifdef SDSUPPORT
|
||||||
if((!PausedByRunout) && (!PausedByFilamentChange)) // was that a regular pause?
|
if((!PausedByRunout) && (!PausedByFilamentChange)) // was that a regular pause?
|
||||||
{
|
{
|
||||||
card.startFileprint(); // start or resume regularly
|
card.startFileprint(); // start or resume regularly
|
||||||
|
@ -154,78 +154,78 @@ void AnycubicTFTClass::StartPrint(){
|
||||||
else if((PausedByRunout) && (!PausedByFilamentChange)) // resuming from a pause that was caused by filament runout
|
else if((PausedByRunout) && (!PausedByFilamentChange)) // resuming from a pause that was caused 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=false; // clear flag
|
PausedByRunout=false; // clear flag
|
||||||
#ifdef ANYCUBIC_TFT_DEBUG
|
#ifdef ANYCUBIC_TFT_DEBUG
|
||||||
SERIAL_ECHOLNPGM("DEBUG: Filament Pause Flag cleared");
|
SERIAL_ECHOLNPGM("DEBUG: Filament Pause Flag cleared");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else if((!PausedByRunout) && (PausedByFilamentChange)) // was M600 called?
|
else if((!PausedByRunout) && (PausedByFilamentChange)) // was M600 called?
|
||||||
{
|
{
|
||||||
FilamentChangeResume(); // enter M108 routine
|
FilamentChangeResume(); // enter M108 routine
|
||||||
#ifdef ANYCUBIC_TFT_DEBUG
|
#ifdef ANYCUBIC_TFT_DEBUG
|
||||||
SERIAL_ECHOLNPGM("DEBUG: Start M108 routine");
|
SERIAL_ECHOLNPGM("DEBUG: Start M108 routine");
|
||||||
#endif
|
#endif
|
||||||
PausedByFilamentChange=false; // clear flag
|
PausedByFilamentChange=false; // clear flag
|
||||||
#ifdef ANYCUBIC_TFT_DEBUG
|
#ifdef ANYCUBIC_TFT_DEBUG
|
||||||
SERIAL_ECHOLNPGM("DEBUG: Filament Change Flag cleared");
|
SERIAL_ECHOLNPGM("DEBUG: Filament Change Flag cleared");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
TFTstate=ANYCUBIC_TFT_STATE_SDPRINT;
|
TFTstate=ANYCUBIC_TFT_STATE_SDPRINT;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AnycubicTFTClass::PausePrint(){
|
void AnycubicTFTClass::PausePrint(){
|
||||||
#ifdef SDSUPPORT
|
#ifdef SDSUPPORT
|
||||||
if((!PausedByRunout)) // is this a regular pause?
|
if((!PausedByRunout)) // is this a regular pause?
|
||||||
{
|
{
|
||||||
card.pauseSDPrint(); // pause print regularly
|
card.pauseSDPrint(); // pause print regularly
|
||||||
#ifdef ANYCUBIC_TFT_DEBUG
|
#ifdef ANYCUBIC_TFT_DEBUG
|
||||||
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
|
||||||
enqueue_and_echo_commands_P(PSTR("M25")); // pause print and park nozzle
|
enqueue_and_echo_commands_P(PSTR("M25")); // pause print and park nozzle
|
||||||
#ifdef ANYCUBIC_TFT_DEBUG
|
#ifdef ANYCUBIC_TFT_DEBUG
|
||||||
SERIAL_ECHOLNPGM("DEBUG: M25 sent, parking nozzle");
|
SERIAL_ECHOLNPGM("DEBUG: M25 sent, parking nozzle");
|
||||||
#endif
|
#endif
|
||||||
ANYCUBIC_SERIAL_PROTOCOLPGM("J23"); //J23 Show Filament Lack prompt on screen
|
ANYCUBIC_SERIAL_PROTOCOLPGM("J23"); //J23 Show Filament Lack prompt on screen
|
||||||
ANYCUBIC_SERIAL_ENTER();
|
ANYCUBIC_SERIAL_ENTER();
|
||||||
#ifdef ANYCUBIC_TFT_DEBUG
|
#ifdef ANYCUBIC_TFT_DEBUG
|
||||||
SERIAL_ECHOLNPGM("DEBUG: J23 Show filament prompt");
|
SERIAL_ECHOLNPGM("DEBUG: J23 Show filament prompt");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
TFTstate=ANYCUBIC_TFT_STATE_SDPAUSE_REQ;
|
TFTstate=ANYCUBIC_TFT_STATE_SDPAUSE_REQ;
|
||||||
#ifdef ANYCUBIC_FILAMENT_RUNOUT_SENSOR
|
#ifdef ANYCUBIC_FILAMENT_RUNOUT_SENSOR
|
||||||
if(FilamentTestStatus) {
|
if(FilamentTestStatus) {
|
||||||
ANYCUBIC_SERIAL_PROTOCOLPGM("J05");// J05 pausing
|
ANYCUBIC_SERIAL_PROTOCOLPGM("J05");// J05 pausing
|
||||||
ANYCUBIC_SERIAL_ENTER();
|
ANYCUBIC_SERIAL_ENTER();
|
||||||
#ifdef ANYCUBIC_TFT_DEBUG
|
#ifdef ANYCUBIC_TFT_DEBUG
|
||||||
SERIAL_ECHOLNPGM("TFT Serial Debug: SD print paused... J05");
|
SERIAL_ECHOLNPGM("TFT Serial Debug: SD print paused... J05");
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
// Pause because of "out of filament"
|
// Pause because of "out of filament"
|
||||||
ANYCUBIC_SERIAL_PROTOCOLPGM("J23"); //J23 FILAMENT LACK with the prompt box don't disappear
|
ANYCUBIC_SERIAL_PROTOCOLPGM("J23"); //J23 FILAMENT LACK with the prompt box don't disappear
|
||||||
ANYCUBIC_SERIAL_ENTER();
|
ANYCUBIC_SERIAL_ENTER();
|
||||||
#ifdef ANYCUBIC_TFT_DEBUG
|
#ifdef ANYCUBIC_TFT_DEBUG
|
||||||
SERIAL_ECHOLNPGM("TFT Serial Debug: Filament runout while printing... J23");
|
SERIAL_ECHOLNPGM("TFT Serial Debug: Filament runout while printing... J23");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void AnycubicTFTClass::StopPrint(){
|
void AnycubicTFTClass::StopPrint(){
|
||||||
|
|
||||||
#ifdef SDSUPPORT
|
#ifdef SDSUPPORT
|
||||||
card.stopSDPrint();
|
card.stopSDPrint();
|
||||||
#endif
|
#endif
|
||||||
clear_command_queue();
|
clear_command_queue();
|
||||||
quickstop_stepper();
|
quickstop_stepper();
|
||||||
print_job_timer.stop();
|
print_job_timer.stop();
|
||||||
|
@ -258,18 +258,18 @@ void AnycubicTFTClass::FilamentChangeResume(){
|
||||||
wait_for_heatup = false;
|
wait_for_heatup = false;
|
||||||
wait_for_user = false; // remove waiting flags
|
wait_for_user = false; // remove waiting flags
|
||||||
card.startFileprint(); // resume with proper progress state
|
card.startFileprint(); // resume with proper progress state
|
||||||
#ifdef ANYCUBIC_TFT_DEBUG
|
#ifdef ANYCUBIC_TFT_DEBUG
|
||||||
SERIAL_ECHOLNPGM("DEBUG: M108 Resume called");
|
SERIAL_ECHOLNPGM("DEBUG: M108 Resume called");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void AnycubicTFTClass::FilamentChangePause(){
|
void AnycubicTFTClass::FilamentChangePause(){
|
||||||
PausedByFilamentChange=true;
|
PausedByFilamentChange=true;
|
||||||
enqueue_and_echo_commands_P(PSTR("M600"));
|
enqueue_and_echo_commands_P(PSTR("M600"));
|
||||||
TFTstate=ANYCUBIC_TFT_STATE_SDPAUSE_REQ; // set TFT state to paused
|
TFTstate=ANYCUBIC_TFT_STATE_SDPAUSE_REQ; // set TFT state to paused
|
||||||
#ifdef ANYCUBIC_TFT_DEBUG
|
#ifdef ANYCUBIC_TFT_DEBUG
|
||||||
SERIAL_ECHOLNPGM("DEBUG: M600 Pause called");
|
SERIAL_ECHOLNPGM("DEBUG: M600 Pause called");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -380,7 +380,7 @@ void AnycubicTFTClass::Ls()
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef SDSUPPORT
|
#ifdef SDSUPPORT
|
||||||
else if(card.cardOK)
|
else if(card.cardOK)
|
||||||
{
|
{
|
||||||
uint16_t cnt=filenumber;
|
uint16_t cnt=filenumber;
|
||||||
|
@ -411,7 +411,7 @@ void AnycubicTFTClass::Ls()
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
card.getfilename(cnt-1);
|
card.getfilename(cnt-1);
|
||||||
// card.getfilename(cnt);
|
// card.getfilename(cnt);
|
||||||
|
|
||||||
if(card.filenameIsDir) {
|
if(card.filenameIsDir) {
|
||||||
ANYCUBIC_SERIAL_PROTOCOLPGM("/");
|
ANYCUBIC_SERIAL_PROTOCOLPGM("/");
|
||||||
|
@ -430,7 +430,7 @@ void AnycubicTFTClass::Ls()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
else {
|
else {
|
||||||
ANYCUBIC_SERIAL_PROTOCOLLNPGM("<Special_Menu>");
|
ANYCUBIC_SERIAL_PROTOCOLLNPGM("<Special_Menu>");
|
||||||
ANYCUBIC_SERIAL_PROTOCOLLNPGM("<Special_Menu>");
|
ANYCUBIC_SERIAL_PROTOCOLLNPGM("<Special_Menu>");
|
||||||
|
@ -439,7 +439,7 @@ void AnycubicTFTClass::Ls()
|
||||||
|
|
||||||
void AnycubicTFTClass::CheckSDCardChange()
|
void AnycubicTFTClass::CheckSDCardChange()
|
||||||
{
|
{
|
||||||
#ifdef SDSUPPORT
|
#ifdef SDSUPPORT
|
||||||
if (LastSDstatus != IS_SD_INSERTED())
|
if (LastSDstatus != IS_SD_INSERTED())
|
||||||
{
|
{
|
||||||
LastSDstatus = IS_SD_INSERTED();
|
LastSDstatus = IS_SD_INSERTED();
|
||||||
|
@ -449,21 +449,21 @@ void AnycubicTFTClass::CheckSDCardChange()
|
||||||
card.initsd();
|
card.initsd();
|
||||||
ANYCUBIC_SERIAL_PROTOCOLPGM("J00"); // J00 SD Card inserted
|
ANYCUBIC_SERIAL_PROTOCOLPGM("J00"); // J00 SD Card inserted
|
||||||
ANYCUBIC_SERIAL_ENTER();
|
ANYCUBIC_SERIAL_ENTER();
|
||||||
#ifdef ANYCUBIC_TFT_DEBUG
|
#ifdef ANYCUBIC_TFT_DEBUG
|
||||||
SERIAL_ECHOLNPGM("TFT Serial Debug: SD card inserted... J00");
|
SERIAL_ECHOLNPGM("TFT Serial Debug: SD card inserted... J00");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ANYCUBIC_SERIAL_PROTOCOLPGM("J01"); // J01 SD Card removed
|
ANYCUBIC_SERIAL_PROTOCOLPGM("J01"); // J01 SD Card removed
|
||||||
ANYCUBIC_SERIAL_ENTER();
|
ANYCUBIC_SERIAL_ENTER();
|
||||||
#ifdef ANYCUBIC_TFT_DEBUG
|
#ifdef ANYCUBIC_TFT_DEBUG
|
||||||
SERIAL_ECHOLNPGM("TFT Serial Debug: SD card removed... J01");
|
SERIAL_ECHOLNPGM("TFT Serial Debug: SD card removed... J01");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void AnycubicTFTClass::CheckHeaterError()
|
void AnycubicTFTClass::CheckHeaterError()
|
||||||
|
@ -475,9 +475,9 @@ void AnycubicTFTClass::CheckHeaterError()
|
||||||
HeaterCheckCount = 0;
|
HeaterCheckCount = 0;
|
||||||
ANYCUBIC_SERIAL_PROTOCOLPGM("J10"); // J10 Hotend temperature abnormal
|
ANYCUBIC_SERIAL_PROTOCOLPGM("J10"); // J10 Hotend temperature abnormal
|
||||||
ANYCUBIC_SERIAL_ENTER();
|
ANYCUBIC_SERIAL_ENTER();
|
||||||
#ifdef ANYCUBIC_TFT_DEBUG
|
#ifdef ANYCUBIC_TFT_DEBUG
|
||||||
SERIAL_ECHOLNPGM("TFT Serial Debug: Hotend temperature abnormal... J20");
|
SERIAL_ECHOLNPGM("TFT Serial Debug: Hotend temperature abnormal... J20");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -495,17 +495,17 @@ void AnycubicTFTClass::StateHandler()
|
||||||
{
|
{
|
||||||
switch (TFTstate) {
|
switch (TFTstate) {
|
||||||
case ANYCUBIC_TFT_STATE_IDLE:
|
case ANYCUBIC_TFT_STATE_IDLE:
|
||||||
#ifdef SDSUPPORT
|
#ifdef SDSUPPORT
|
||||||
if(card.sdprinting) {
|
if(card.sdprinting) {
|
||||||
TFTstate=ANYCUBIC_TFT_STATE_SDPRINT;
|
TFTstate=ANYCUBIC_TFT_STATE_SDPRINT;
|
||||||
starttime=millis();
|
starttime=millis();
|
||||||
|
|
||||||
// --> Send print info to display... most probably print started via gcode
|
// --> Send print info to display... most probably print started via gcode
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
case ANYCUBIC_TFT_STATE_SDPRINT:
|
case ANYCUBIC_TFT_STATE_SDPRINT:
|
||||||
#ifdef SDSUPPORT
|
#ifdef SDSUPPORT
|
||||||
if(!card.sdprinting) {
|
if(!card.sdprinting) {
|
||||||
// It seems that we are to printing anymore... pause or stopped?
|
// It seems that we are to printing anymore... pause or stopped?
|
||||||
if (card.isFileOpen()) {
|
if (card.isFileOpen()) {
|
||||||
|
@ -516,32 +516,32 @@ void AnycubicTFTClass::StateHandler()
|
||||||
TFTstate=ANYCUBIC_TFT_STATE_IDLE;
|
TFTstate=ANYCUBIC_TFT_STATE_IDLE;
|
||||||
ANYCUBIC_SERIAL_PROTOCOLPGM("J14");// J14 print done
|
ANYCUBIC_SERIAL_PROTOCOLPGM("J14");// J14 print done
|
||||||
ANYCUBIC_SERIAL_ENTER();
|
ANYCUBIC_SERIAL_ENTER();
|
||||||
#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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
case ANYCUBIC_TFT_STATE_SDPAUSE:
|
case ANYCUBIC_TFT_STATE_SDPAUSE:
|
||||||
break;
|
break;
|
||||||
case ANYCUBIC_TFT_STATE_SDPAUSE_OOF:
|
case ANYCUBIC_TFT_STATE_SDPAUSE_OOF:
|
||||||
#ifdef ANYCUBIC_FILAMENT_RUNOUT_SENSOR
|
#ifdef ANYCUBIC_FILAMENT_RUNOUT_SENSOR
|
||||||
if(!FilamentTestStatus) {
|
if(!FilamentTestStatus) {
|
||||||
// We got filament again
|
// We got filament again
|
||||||
TFTstate=ANYCUBIC_TFT_STATE_SDPAUSE;
|
TFTstate=ANYCUBIC_TFT_STATE_SDPAUSE;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
case ANYCUBIC_TFT_STATE_SDPAUSE_REQ:
|
case ANYCUBIC_TFT_STATE_SDPAUSE_REQ:
|
||||||
#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))
|
if((!PausedByRunout) && (!PausedByFilamentChange))
|
||||||
{
|
{
|
||||||
#ifdef ANYCUBIC_TFT_DEBUG
|
#ifdef ANYCUBIC_TFT_DEBUG
|
||||||
SERIAL_ECHOLNPGM("DEBUG: Regular Pause requested");
|
SERIAL_ECHOLNPGM("DEBUG: Regular Pause requested");
|
||||||
#endif
|
#endif
|
||||||
enqueue_and_echo_commands_P(PSTR("G91")); // relative mode
|
enqueue_and_echo_commands_P(PSTR("G91")); // relative mode
|
||||||
enqueue_and_echo_commands_P(PSTR("G1 E-2 F1800")); // retract 2mm
|
enqueue_and_echo_commands_P(PSTR("G1 E-2 F1800")); // retract 2mm
|
||||||
enqueue_and_echo_commands_P(PSTR("G1 Z10 F240")); // lift nozzle by 10mm
|
enqueue_and_echo_commands_P(PSTR("G1 Z10 F240")); // lift nozzle by 10mm
|
||||||
|
@ -557,34 +557,34 @@ void AnycubicTFTClass::StateHandler()
|
||||||
SERIAL_ECHOLNPGM("DEBUG: Filament runout - Retract, beep and park.");
|
SERIAL_ECHOLNPGM("DEBUG: Filament runout - Retract, beep and park.");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#ifdef ANYCUBIC_FILAMENT_RUNOUT_SENSOR
|
#ifdef ANYCUBIC_FILAMENT_RUNOUT_SENSOR
|
||||||
if(FilamentTestStatus) {
|
if(FilamentTestStatus) {
|
||||||
TFTstate=ANYCUBIC_TFT_STATE_SDPAUSE;
|
TFTstate=ANYCUBIC_TFT_STATE_SDPAUSE;
|
||||||
} else {
|
} else {
|
||||||
// Pause because of "out of filament"
|
// Pause because of "out of filament"
|
||||||
TFTstate=ANYCUBIC_TFT_STATE_SDPAUSE_OOF;
|
TFTstate=ANYCUBIC_TFT_STATE_SDPAUSE_OOF;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
ANYCUBIC_SERIAL_PROTOCOLPGM("J18");// J18 pausing print done
|
ANYCUBIC_SERIAL_PROTOCOLPGM("J18");// J18 pausing print done
|
||||||
ANYCUBIC_SERIAL_ENTER();
|
ANYCUBIC_SERIAL_ENTER();
|
||||||
#ifdef ANYCUBIC_TFT_DEBUG
|
#ifdef ANYCUBIC_TFT_DEBUG
|
||||||
SERIAL_ECHOLNPGM("TFT Serial Debug: SD print paused done... J18");
|
SERIAL_ECHOLNPGM("TFT Serial Debug: SD print paused done... J18");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
case ANYCUBIC_TFT_STATE_SDSTOP_REQ:
|
case ANYCUBIC_TFT_STATE_SDSTOP_REQ:
|
||||||
#ifdef SDSUPPORT
|
#ifdef SDSUPPORT
|
||||||
if((!card.sdprinting) && (!planner.movesplanned())) {
|
if((!card.sdprinting) && (!planner.movesplanned())) {
|
||||||
ANYCUBIC_SERIAL_PROTOCOLPGM("J16");// J16 stop print
|
ANYCUBIC_SERIAL_PROTOCOLPGM("J16");// J16 stop print
|
||||||
ANYCUBIC_SERIAL_ENTER();
|
ANYCUBIC_SERIAL_ENTER();
|
||||||
TFTstate=ANYCUBIC_TFT_STATE_IDLE;
|
TFTstate=ANYCUBIC_TFT_STATE_IDLE;
|
||||||
#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
|
||||||
enqueue_and_echo_commands_P(PSTR("M84"));
|
enqueue_and_echo_commands_P(PSTR("M84"));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -593,7 +593,7 @@ void AnycubicTFTClass::StateHandler()
|
||||||
|
|
||||||
void AnycubicTFTClass::FilamentRunout()
|
void AnycubicTFTClass::FilamentRunout()
|
||||||
{
|
{
|
||||||
#if ENABLED(ANYCUBIC_FILAMENT_RUNOUT_SENSOR)
|
#if ENABLED(ANYCUBIC_FILAMENT_RUNOUT_SENSOR)
|
||||||
FilamentTestStatus=READ(FIL_RUNOUT_PIN)&0xff;
|
FilamentTestStatus=READ(FIL_RUNOUT_PIN)&0xff;
|
||||||
|
|
||||||
if(FilamentTestStatus>FilamentTestLastStatus)
|
if(FilamentTestStatus>FilamentTestLastStatus)
|
||||||
|
@ -602,26 +602,26 @@ void AnycubicTFTClass::FilamentRunout()
|
||||||
if(FilamentRunoutCounter>=31600)
|
if(FilamentRunoutCounter>=31600)
|
||||||
{
|
{
|
||||||
FilamentRunoutCounter=0;
|
FilamentRunoutCounter=0;
|
||||||
#ifdef SDSUPPORT
|
#ifdef SDSUPPORT
|
||||||
if((card.sdprinting==true))
|
if((card.sdprinting==true))
|
||||||
{
|
{
|
||||||
PausedByRunout=true; // set runout pause flag
|
PausedByRunout=true; // set runout pause flag
|
||||||
#ifdef ANYCUBIC_TFT_DEBUG
|
#ifdef ANYCUBIC_TFT_DEBUG
|
||||||
SERIAL_ECHOLNPGM("DEBUG: Filament Pause Flag set");
|
SERIAL_ECHOLNPGM("DEBUG: Filament Pause Flag set");
|
||||||
#endif
|
#endif
|
||||||
PausePrint();
|
PausePrint();
|
||||||
}
|
}
|
||||||
else if((card.sdprinting==false))
|
else if((card.sdprinting==false))
|
||||||
{
|
{
|
||||||
#endif
|
#endif
|
||||||
ANYCUBIC_SERIAL_PROTOCOLPGM("J15"); //J15 FILAMENT LACK
|
ANYCUBIC_SERIAL_PROTOCOLPGM("J15"); //J15 FILAMENT LACK
|
||||||
ANYCUBIC_SERIAL_ENTER();
|
ANYCUBIC_SERIAL_ENTER();
|
||||||
#ifdef ANYCUBIC_TFT_DEBUG
|
#ifdef ANYCUBIC_TFT_DEBUG
|
||||||
SERIAL_ECHOLNPGM("TFT Serial Debug: Filament runout... J15");
|
SERIAL_ECHOLNPGM("TFT Serial Debug: Filament runout... J15");
|
||||||
#endif
|
#endif
|
||||||
#ifdef SDSUPPORT
|
#ifdef SDSUPPORT
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
FilamentTestLastStatus=FilamentTestStatus;
|
FilamentTestLastStatus=FilamentTestStatus;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -629,11 +629,11 @@ void AnycubicTFTClass::FilamentRunout()
|
||||||
{
|
{
|
||||||
FilamentRunoutCounter=0;
|
FilamentRunoutCounter=0;
|
||||||
FilamentTestLastStatus=FilamentTestStatus;
|
FilamentTestLastStatus=FilamentTestStatus;
|
||||||
#ifdef ANYCUBIC_TFT_DEBUG
|
#ifdef ANYCUBIC_TFT_DEBUG
|
||||||
SERIAL_ECHOLNPGM("TFT Serial Debug: Filament runout recovered");
|
SERIAL_ECHOLNPGM("TFT Serial Debug: Filament runout recovered");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void AnycubicTFTClass::GetCommandFromTFT()
|
void AnycubicTFTClass::GetCommandFromTFT()
|
||||||
|
@ -658,10 +658,10 @@ void AnycubicTFTClass::GetCommandFromTFT()
|
||||||
TFTstrchr_pointer = strchr(TFTcmdbuffer[TFTbufindw], 'A');
|
TFTstrchr_pointer = strchr(TFTcmdbuffer[TFTbufindw], 'A');
|
||||||
a_command=((int)((strtod(&TFTcmdbuffer[TFTbufindw][TFTstrchr_pointer - TFTcmdbuffer[TFTbufindw] + 1], NULL))));
|
a_command=((int)((strtod(&TFTcmdbuffer[TFTbufindw][TFTstrchr_pointer - TFTcmdbuffer[TFTbufindw] + 1], NULL))));
|
||||||
|
|
||||||
#ifdef ANYCUBIC_TFT_DEBUG
|
#ifdef ANYCUBIC_TFT_DEBUG
|
||||||
if ((a_command>7) && (a_command != 20)) // No debugging of status polls, please!
|
if ((a_command>7) && (a_command != 20)) // No debugging of status polls, please!
|
||||||
SERIAL_ECHOLNPAIR("TFT Serial Command: ", TFTcmdbuffer[TFTbufindw]);
|
SERIAL_ECHOLNPAIR("TFT Serial Command: ", TFTcmdbuffer[TFTbufindw]);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
switch(a_command) {
|
switch(a_command) {
|
||||||
|
|
||||||
|
@ -716,7 +716,7 @@ void AnycubicTFTClass::GetCommandFromTFT()
|
||||||
ANYCUBIC_SERIAL_ENTER();
|
ANYCUBIC_SERIAL_ENTER();
|
||||||
break;
|
break;
|
||||||
case 6: //A6 GET SD CARD PRINTING STATUS
|
case 6: //A6 GET SD CARD PRINTING STATUS
|
||||||
#ifdef SDSUPPORT
|
#ifdef SDSUPPORT
|
||||||
if(card.sdprinting) {
|
if(card.sdprinting) {
|
||||||
ANYCUBIC_SERIAL_PROTOCOLPGM("A6V ");
|
ANYCUBIC_SERIAL_PROTOCOLPGM("A6V ");
|
||||||
if(card.cardOK)
|
if(card.cardOK)
|
||||||
|
@ -731,7 +731,7 @@ void AnycubicTFTClass::GetCommandFromTFT()
|
||||||
else
|
else
|
||||||
ANYCUBIC_SERIAL_PROTOCOLPGM("A6V ---");
|
ANYCUBIC_SERIAL_PROTOCOLPGM("A6V ---");
|
||||||
ANYCUBIC_SERIAL_ENTER();
|
ANYCUBIC_SERIAL_ENTER();
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
case 7://A7 GET PRINTING TIME
|
case 7://A7 GET PRINTING TIME
|
||||||
{
|
{
|
||||||
|
@ -755,7 +755,7 @@ void AnycubicTFTClass::GetCommandFromTFT()
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 8: // A8 GET SD LIST
|
case 8: // A8 GET SD LIST
|
||||||
#ifdef SDSUPPORT
|
#ifdef SDSUPPORT
|
||||||
SelectedDirectory[0]=0;
|
SelectedDirectory[0]=0;
|
||||||
if(!IS_SD_INSERTED())
|
if(!IS_SD_INSERTED())
|
||||||
{
|
{
|
||||||
|
@ -773,10 +773,10 @@ void AnycubicTFTClass::GetCommandFromTFT()
|
||||||
ANYCUBIC_SERIAL_PROTOCOLPGM("END"); // Filelist stop
|
ANYCUBIC_SERIAL_PROTOCOLPGM("END"); // Filelist stop
|
||||||
ANYCUBIC_SERIAL_ENTER();
|
ANYCUBIC_SERIAL_ENTER();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
case 9: // A9 pause sd print
|
case 9: // A9 pause sd print
|
||||||
#ifdef SDSUPPORT
|
#ifdef SDSUPPORT
|
||||||
if(card.sdprinting)
|
if(card.sdprinting)
|
||||||
{
|
{
|
||||||
PausePrint();
|
PausePrint();
|
||||||
|
@ -785,34 +785,34 @@ void AnycubicTFTClass::GetCommandFromTFT()
|
||||||
{
|
{
|
||||||
StopPrint();
|
StopPrint();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
case 10: // A10 resume sd print
|
case 10: // A10 resume sd print
|
||||||
#ifdef SDSUPPORT
|
#ifdef SDSUPPORT
|
||||||
if((TFTstate==ANYCUBIC_TFT_STATE_SDPAUSE) || (TFTstate==ANYCUBIC_TFT_STATE_SDOUTAGE))
|
if((TFTstate==ANYCUBIC_TFT_STATE_SDPAUSE) || (TFTstate==ANYCUBIC_TFT_STATE_SDOUTAGE))
|
||||||
{
|
{
|
||||||
StartPrint();
|
StartPrint();
|
||||||
ANYCUBIC_SERIAL_PROTOCOLPGM("J04");// J04 printing form sd card now
|
ANYCUBIC_SERIAL_PROTOCOLPGM("J04");// J04 printing form sd card now
|
||||||
ANYCUBIC_SERIAL_ENTER();
|
ANYCUBIC_SERIAL_ENTER();
|
||||||
#ifdef ANYCUBIC_TFT_DEBUG
|
#ifdef ANYCUBIC_TFT_DEBUG
|
||||||
SERIAL_ECHOLNPGM("TFT Serial Debug: SD print started... J04");
|
SERIAL_ECHOLNPGM("TFT Serial Debug: SD print started... J04");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
case 11: // A11 STOP SD PRINT
|
case 11: // A11 STOP SD PRINT
|
||||||
#ifdef SDSUPPORT
|
#ifdef SDSUPPORT
|
||||||
if((card.sdprinting) || (TFTstate==ANYCUBIC_TFT_STATE_SDOUTAGE))
|
if((card.sdprinting) || (TFTstate==ANYCUBIC_TFT_STATE_SDOUTAGE))
|
||||||
{
|
{
|
||||||
StopPrint();
|
StopPrint();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
case 12: // A12 kill
|
case 12: // A12 kill
|
||||||
kill(PSTR(MSG_KILLED));
|
kill(PSTR(MSG_KILLED));
|
||||||
break;
|
break;
|
||||||
case 13: // A13 SELECTION FILE
|
case 13: // A13 SELECTION FILE
|
||||||
#ifdef SDSUPPORT
|
#ifdef SDSUPPORT
|
||||||
//if((!planner.movesplanned()) && (TFTstate!=ANYCUBIC_TFT_STATE_SDPAUSE) && (TFTstate!=ANYCUBIC_TFT_STATE_SDOUTAGE))
|
//if((!planner.movesplanned()) && (TFTstate!=ANYCUBIC_TFT_STATE_SDPAUSE) && (TFTstate!=ANYCUBIC_TFT_STATE_SDOUTAGE))
|
||||||
if((TFTstate!=ANYCUBIC_TFT_STATE_SDOUTAGE)) // allow special menu to be used while printing from USB
|
if((TFTstate!=ANYCUBIC_TFT_STATE_SDOUTAGE)) // allow special menu to be used while printing from USB
|
||||||
{
|
{
|
||||||
|
@ -830,36 +830,36 @@ void AnycubicTFTClass::GetCommandFromTFT()
|
||||||
if (card.isFileOpen()) {
|
if (card.isFileOpen()) {
|
||||||
ANYCUBIC_SERIAL_PROTOCOLPGM("J20"); // J20 Open successful
|
ANYCUBIC_SERIAL_PROTOCOLPGM("J20"); // J20 Open successful
|
||||||
ANYCUBIC_SERIAL_ENTER();
|
ANYCUBIC_SERIAL_ENTER();
|
||||||
#ifdef ANYCUBIC_TFT_DEBUG
|
#ifdef ANYCUBIC_TFT_DEBUG
|
||||||
SERIAL_ECHOLNPGM("TFT Serial Debug: File open successful... J20");
|
SERIAL_ECHOLNPGM("TFT Serial Debug: File open successful... J20");
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
ANYCUBIC_SERIAL_PROTOCOLPGM("J21"); // J21 Open failed
|
ANYCUBIC_SERIAL_PROTOCOLPGM("J21"); // J21 Open failed
|
||||||
ANYCUBIC_SERIAL_ENTER();
|
ANYCUBIC_SERIAL_ENTER();
|
||||||
#ifdef ANYCUBIC_TFT_DEBUG
|
#ifdef ANYCUBIC_TFT_DEBUG
|
||||||
SERIAL_ECHOLNPGM("TFT Serial Debug: File open failed... J21");
|
SERIAL_ECHOLNPGM("TFT Serial Debug: File open failed... J21");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ANYCUBIC_SERIAL_ENTER();
|
ANYCUBIC_SERIAL_ENTER();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
case 14: // A14 START PRINTING
|
case 14: // A14 START PRINTING
|
||||||
#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()))
|
||||||
{
|
{
|
||||||
StartPrint();
|
StartPrint();
|
||||||
ANYCUBIC_SERIAL_PROTOCOLPGM("J04"); // J04 Starting Print
|
ANYCUBIC_SERIAL_PROTOCOLPGM("J04"); // J04 Starting Print
|
||||||
ANYCUBIC_SERIAL_ENTER();
|
ANYCUBIC_SERIAL_ENTER();
|
||||||
#ifdef ANYCUBIC_TFT_DEBUG
|
#ifdef ANYCUBIC_TFT_DEBUG
|
||||||
SERIAL_ECHOLNPGM("TFT Serial Debug: Starting SD Print... J04");
|
SERIAL_ECHOLNPGM("TFT Serial Debug: Starting SD Print... J04");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
case 15: // A15 RESUMING FROM OUTAGE
|
case 15: // A15 RESUMING FROM OUTAGE
|
||||||
// if((!planner.movesplanned())&&(!TFTresumingflag))
|
//if((!planner.movesplanned())&&(!TFTresumingflag))
|
||||||
// {
|
// {
|
||||||
// if(card.cardOK)
|
// if(card.cardOK)
|
||||||
// FlagResumFromOutage=true;
|
// FlagResumFromOutage=true;
|
||||||
|
@ -868,7 +868,7 @@ void AnycubicTFTClass::GetCommandFromTFT()
|
||||||
// starttime=millis();
|
// starttime=millis();
|
||||||
// ANYCUBIC_SERIAL_SUCC_START;
|
// ANYCUBIC_SERIAL_SUCC_START;
|
||||||
// }
|
// }
|
||||||
// ANYCUBIC_SERIAL_ENTER();
|
//ANYCUBIC_SERIAL_ENTER();
|
||||||
break;
|
break;
|
||||||
case 16: // A16 set hotend temp
|
case 16: // A16 set hotend temp
|
||||||
{
|
{
|
||||||
|
@ -909,9 +909,9 @@ void AnycubicTFTClass::GetCommandFromTFT()
|
||||||
break;
|
break;
|
||||||
case 19: // A19 stop stepper drivers
|
case 19: // A19 stop stepper drivers
|
||||||
if((!planner.movesplanned())
|
if((!planner.movesplanned())
|
||||||
#ifdef SDSUPPORT
|
#ifdef SDSUPPORT
|
||||||
&&(!card.sdprinting)
|
&&(!card.sdprinting)
|
||||||
#endif
|
#endif
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
quickstop_stepper();
|
quickstop_stepper();
|
||||||
|
@ -1021,13 +1021,13 @@ void AnycubicTFTClass::GetCommandFromTFT()
|
||||||
thermalManager.setTargetBed(0);
|
thermalManager.setTargetBed(0);
|
||||||
ANYCUBIC_SERIAL_PROTOCOLPGM("J12"); // J12 cool down
|
ANYCUBIC_SERIAL_PROTOCOLPGM("J12"); // J12 cool down
|
||||||
ANYCUBIC_SERIAL_ENTER();
|
ANYCUBIC_SERIAL_ENTER();
|
||||||
#ifdef ANYCUBIC_TFT_DEBUG
|
#ifdef ANYCUBIC_TFT_DEBUG
|
||||||
SERIAL_ECHOLNPGM("TFT Serial Debug: Cooling down... J12");
|
SERIAL_ECHOLNPGM("TFT Serial Debug: Cooling down... J12");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 26: // A26 refresh SD
|
case 26: // A26 refresh SD
|
||||||
#ifdef SDSUPPORT
|
#ifdef SDSUPPORT
|
||||||
if (SelectedDirectory[0]==0) {
|
if (SelectedDirectory[0]==0) {
|
||||||
card.initsd();
|
card.initsd();
|
||||||
} else {
|
} else {
|
||||||
|
@ -1048,16 +1048,16 @@ void AnycubicTFTClass::GetCommandFromTFT()
|
||||||
{
|
{
|
||||||
ANYCUBIC_SERIAL_PROTOCOLPGM("J02"); // J02 SD Card initilized
|
ANYCUBIC_SERIAL_PROTOCOLPGM("J02"); // J02 SD Card initilized
|
||||||
ANYCUBIC_SERIAL_ENTER();
|
ANYCUBIC_SERIAL_ENTER();
|
||||||
#ifdef ANYCUBIC_TFT_DEBUG
|
#ifdef ANYCUBIC_TFT_DEBUG
|
||||||
SERIAL_ECHOLNPGM("TFT Serial Debug: SD card initialized... J02");
|
SERIAL_ECHOLNPGM("TFT Serial Debug: SD card initialized... J02");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
#ifdef SERVO_ENDSTOPS
|
#ifdef SERVO_ENDSTOPS
|
||||||
case 27: // A27 servos angles adjust
|
case 27: // A27 servos angles adjust
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
case 28: // A28 filament test
|
case 28: // A28 filament test
|
||||||
{
|
{
|
||||||
if(CodeSeen('O'));
|
if(CodeSeen('O'));
|
||||||
|
@ -1070,49 +1070,49 @@ void AnycubicTFTClass::GetCommandFromTFT()
|
||||||
|
|
||||||
case 30: // A30 assist leveling, the original function was canceled
|
case 30: // A30 assist leveling, the original function was canceled
|
||||||
if(CodeSeen('S')) {
|
if(CodeSeen('S')) {
|
||||||
#ifdef ANYCUBIC_TFT_DEBUG
|
#ifdef ANYCUBIC_TFT_DEBUG
|
||||||
SERIAL_ECHOLNPGM("TFT Entering level menue...");
|
SERIAL_ECHOLNPGM("TFT Entering level menue...");
|
||||||
#endif
|
#endif
|
||||||
} else if(CodeSeen('O')) {
|
} else if(CodeSeen('O')) {
|
||||||
#ifdef ANYCUBIC_TFT_DEBUG
|
#ifdef ANYCUBIC_TFT_DEBUG
|
||||||
SERIAL_ECHOLNPGM("TFT Leveling started and movint to front left...");
|
SERIAL_ECHOLNPGM("TFT Leveling started and movint to front left...");
|
||||||
#endif
|
#endif
|
||||||
enqueue_and_echo_commands_P(PSTR("G91\nG1 Z10 F240\nG90\nG28\nG29\nG1 X20 Y20 F6000\nG1 Z0 F240"));
|
enqueue_and_echo_commands_P(PSTR("G91\nG1 Z10 F240\nG90\nG28\nG29\nG1 X20 Y20 F6000\nG1 Z0 F240"));
|
||||||
} else if(CodeSeen('T')) {
|
} else if(CodeSeen('T')) {
|
||||||
#ifdef ANYCUBIC_TFT_DEBUG
|
#ifdef ANYCUBIC_TFT_DEBUG
|
||||||
SERIAL_ECHOLNPGM("TFT Level checkpoint front right...");
|
SERIAL_ECHOLNPGM("TFT Level checkpoint front right...");
|
||||||
#endif
|
#endif
|
||||||
enqueue_and_echo_commands_P(PSTR("G1 Z5 F240\nG1 X190 Y20 F6000\nG1 Z0 F240"));
|
enqueue_and_echo_commands_P(PSTR("G1 Z5 F240\nG1 X190 Y20 F6000\nG1 Z0 F240"));
|
||||||
} else if(CodeSeen('C')) {
|
} else if(CodeSeen('C')) {
|
||||||
#ifdef ANYCUBIC_TFT_DEBUG
|
#ifdef ANYCUBIC_TFT_DEBUG
|
||||||
SERIAL_ECHOLNPGM("TFT Level checkpoint back right...");
|
SERIAL_ECHOLNPGM("TFT Level checkpoint back right...");
|
||||||
#endif
|
#endif
|
||||||
enqueue_and_echo_commands_P(PSTR("G1 Z5 F240\nG1 X190 Y190 F6000\nG1 Z0 F240"));
|
enqueue_and_echo_commands_P(PSTR("G1 Z5 F240\nG1 X190 Y190 F6000\nG1 Z0 F240"));
|
||||||
} else if(CodeSeen('Q')) {
|
} else if(CodeSeen('Q')) {
|
||||||
#ifdef ANYCUBIC_TFT_DEBUG
|
#ifdef ANYCUBIC_TFT_DEBUG
|
||||||
SERIAL_ECHOLNPGM("TFT Level checkpoint back right...");
|
SERIAL_ECHOLNPGM("TFT Level checkpoint back right...");
|
||||||
#endif
|
#endif
|
||||||
enqueue_and_echo_commands_P(PSTR("G1 Z5 F240\nG1 X190 Y20 F6000\nG1 Z0 F240"));
|
enqueue_and_echo_commands_P(PSTR("G1 Z5 F240\nG1 X190 Y20 F6000\nG1 Z0 F240"));
|
||||||
} else if(CodeSeen('H')) {
|
} else if(CodeSeen('H')) {
|
||||||
#ifdef ANYCUBIC_TFT_DEBUG
|
#ifdef ANYCUBIC_TFT_DEBUG
|
||||||
SERIAL_ECHOLNPGM("TFT Level check no heating...");
|
SERIAL_ECHOLNPGM("TFT Level check no heating...");
|
||||||
#endif
|
#endif
|
||||||
// enqueue_and_echo_commands_P(PSTR("... TBD ..."));
|
//enqueue_and_echo_commands_P(PSTR("... TBD ..."));
|
||||||
ANYCUBIC_SERIAL_PROTOCOLPGM("J22"); // J22 Test print done
|
ANYCUBIC_SERIAL_PROTOCOLPGM("J22"); // J22 Test print done
|
||||||
ANYCUBIC_SERIAL_ENTER();
|
ANYCUBIC_SERIAL_ENTER();
|
||||||
#ifdef ANYCUBIC_TFT_DEBUG
|
#ifdef ANYCUBIC_TFT_DEBUG
|
||||||
SERIAL_ECHOLNPGM("TFT Serial Debug: Leveling print test done... J22");
|
SERIAL_ECHOLNPGM("TFT Serial Debug: Leveling print test done... J22");
|
||||||
#endif
|
#endif
|
||||||
} else if(CodeSeen('L')) {
|
} else if(CodeSeen('L')) {
|
||||||
#ifdef ANYCUBIC_TFT_DEBUG
|
#ifdef ANYCUBIC_TFT_DEBUG
|
||||||
SERIAL_ECHOLNPGM("TFT Level check heating...");
|
SERIAL_ECHOLNPGM("TFT Level check heating...");
|
||||||
#endif
|
#endif
|
||||||
// enqueue_and_echo_commands_P(PSTR("... TBD ..."));
|
//enqueue_and_echo_commands_P(PSTR("... TBD ..."));
|
||||||
ANYCUBIC_SERIAL_PROTOCOLPGM("J22"); // J22 Test print done
|
ANYCUBIC_SERIAL_PROTOCOLPGM("J22"); // J22 Test print done
|
||||||
ANYCUBIC_SERIAL_ENTER();
|
ANYCUBIC_SERIAL_ENTER();
|
||||||
#ifdef ANYCUBIC_TFT_DEBUG
|
#ifdef ANYCUBIC_TFT_DEBUG
|
||||||
SERIAL_ECHOLNPGM("TFT Serial Debug: Leveling print test with heating done... J22");
|
SERIAL_ECHOLNPGM("TFT Serial Debug: Leveling print test with heating done... J22");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
ANYCUBIC_SERIAL_SUCC_START;
|
ANYCUBIC_SERIAL_SUCC_START;
|
||||||
ANYCUBIC_SERIAL_ENTER();
|
ANYCUBIC_SERIAL_ENTER();
|
||||||
|
@ -1121,7 +1121,7 @@ void AnycubicTFTClass::GetCommandFromTFT()
|
||||||
case 31: // A31 zoffset
|
case 31: // A31 zoffset
|
||||||
if((!planner.movesplanned())&&(TFTstate!=ANYCUBIC_TFT_STATE_SDPAUSE) && (TFTstate!=ANYCUBIC_TFT_STATE_SDOUTAGE))
|
if((!planner.movesplanned())&&(TFTstate!=ANYCUBIC_TFT_STATE_SDPAUSE) && (TFTstate!=ANYCUBIC_TFT_STATE_SDOUTAGE))
|
||||||
{
|
{
|
||||||
#if HAS_BED_PROBE
|
#if HAS_BED_PROBE
|
||||||
char value[30];
|
char value[30];
|
||||||
char *s_zoffset;
|
char *s_zoffset;
|
||||||
//if((current_position[Z_AXIS]<10))
|
//if((current_position[Z_AXIS]<10))
|
||||||
|
@ -1131,12 +1131,12 @@ void AnycubicTFTClass::GetCommandFromTFT()
|
||||||
ANYCUBIC_SERIAL_PROTOCOLPGM("A9V ");
|
ANYCUBIC_SERIAL_PROTOCOLPGM("A9V ");
|
||||||
ANYCUBIC_SERIAL_PROTOCOL(itostr3(int(zprobe_zoffset*100.00 + 0.5)));
|
ANYCUBIC_SERIAL_PROTOCOL(itostr3(int(zprobe_zoffset*100.00 + 0.5)));
|
||||||
ANYCUBIC_SERIAL_ENTER();
|
ANYCUBIC_SERIAL_ENTER();
|
||||||
#ifdef ANYCUBIC_TFT_DEBUG
|
#ifdef ANYCUBIC_TFT_DEBUG
|
||||||
SERIAL_ECHOPGM("TFT sending current z-probe offset data... <");
|
SERIAL_ECHOPGM("TFT sending current z-probe offset data... <");
|
||||||
SERIAL_ECHOPGM("A9V ");
|
SERIAL_ECHOPGM("A9V ");
|
||||||
SERIAL_ECHO(itostr3(int(zprobe_zoffset*100.00 + 0.5)));
|
SERIAL_ECHO(itostr3(int(zprobe_zoffset*100.00 + 0.5)));
|
||||||
SERIAL_ECHOLNPGM(">");
|
SERIAL_ECHOLNPGM(">");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
if(CodeSeen('D'))
|
if(CodeSeen('D'))
|
||||||
{
|
{
|
||||||
|
@ -1146,15 +1146,15 @@ void AnycubicTFTClass::GetCommandFromTFT()
|
||||||
enqueue_and_echo_command(value); // Apply Z-Probe offset
|
enqueue_and_echo_command(value); // Apply Z-Probe offset
|
||||||
enqueue_and_echo_commands_P(PSTR("M500")); // Save to EEPROM
|
enqueue_and_echo_commands_P(PSTR("M500")); // Save to EEPROM
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
ANYCUBIC_SERIAL_ENTER();
|
ANYCUBIC_SERIAL_ENTER();
|
||||||
break;
|
break;
|
||||||
case 32: // A32 clean leveling beep flag
|
case 32: // A32 clean leveling beep flag
|
||||||
if(CodeSeen('S')) {
|
if(CodeSeen('S')) {
|
||||||
#ifdef ANYCUBIC_TFT_DEBUG
|
#ifdef ANYCUBIC_TFT_DEBUG
|
||||||
SERIAL_ECHOLNPGM("TFT Level saving data...");
|
SERIAL_ECHOLNPGM("TFT Level saving data...");
|
||||||
#endif
|
#endif
|
||||||
enqueue_and_echo_commands_P(PSTR("M500\nM420 S1\nG1 Z10 F240\nG1 X0 Y0 F6000"));
|
enqueue_and_echo_commands_P(PSTR("M500\nM420 S1\nG1 Z10 F240\nG1 X0 Y0 F6000"));
|
||||||
ANYCUBIC_SERIAL_SUCC_START;
|
ANYCUBIC_SERIAL_SUCC_START;
|
||||||
ANYCUBIC_SERIAL_ENTER();
|
ANYCUBIC_SERIAL_ENTER();
|
||||||
|
@ -1200,26 +1200,26 @@ void AnycubicTFTClass::HeatingStart()
|
||||||
{
|
{
|
||||||
ANYCUBIC_SERIAL_PROTOCOLPGM("J06"); // J07 hotend heating start
|
ANYCUBIC_SERIAL_PROTOCOLPGM("J06"); // J07 hotend heating start
|
||||||
ANYCUBIC_SERIAL_ENTER();
|
ANYCUBIC_SERIAL_ENTER();
|
||||||
#ifdef ANYCUBIC_TFT_DEBUG
|
#ifdef ANYCUBIC_TFT_DEBUG
|
||||||
SERIAL_ECHOLNPGM("TFT Serial Debug: Nozzle is heating... J06");
|
SERIAL_ECHOLNPGM("TFT Serial Debug: Nozzle is heating... J06");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void AnycubicTFTClass::HeatingDone()
|
void AnycubicTFTClass::HeatingDone()
|
||||||
{
|
{
|
||||||
ANYCUBIC_SERIAL_PROTOCOLPGM("J07"); // J07 hotend heating done
|
ANYCUBIC_SERIAL_PROTOCOLPGM("J07"); // J07 hotend heating done
|
||||||
ANYCUBIC_SERIAL_ENTER();
|
ANYCUBIC_SERIAL_ENTER();
|
||||||
#ifdef ANYCUBIC_TFT_DEBUG
|
#ifdef ANYCUBIC_TFT_DEBUG
|
||||||
SERIAL_ECHOLNPGM("TFT Serial Debug: Nozzle heating is done... J07");
|
SERIAL_ECHOLNPGM("TFT Serial Debug: Nozzle heating is done... J07");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(TFTstate==ANYCUBIC_TFT_STATE_SDPRINT)
|
if(TFTstate==ANYCUBIC_TFT_STATE_SDPRINT)
|
||||||
{
|
{
|
||||||
ANYCUBIC_SERIAL_PROTOCOLPGM("J04"); // J04 printing from sd card
|
ANYCUBIC_SERIAL_PROTOCOLPGM("J04"); // J04 printing from sd card
|
||||||
ANYCUBIC_SERIAL_ENTER();
|
ANYCUBIC_SERIAL_ENTER();
|
||||||
#ifdef ANYCUBIC_TFT_DEBUG
|
#ifdef ANYCUBIC_TFT_DEBUG
|
||||||
SERIAL_ECHOLNPGM("TFT Serial Debug: Continuing SD print after heating... J04");
|
SERIAL_ECHOLNPGM("TFT Serial Debug: Continuing SD print after heating... J04");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1227,18 +1227,18 @@ void AnycubicTFTClass::BedHeatingStart()
|
||||||
{
|
{
|
||||||
ANYCUBIC_SERIAL_PROTOCOLPGM("J08"); // J08 hotbed heating start
|
ANYCUBIC_SERIAL_PROTOCOLPGM("J08"); // J08 hotbed heating start
|
||||||
ANYCUBIC_SERIAL_ENTER();
|
ANYCUBIC_SERIAL_ENTER();
|
||||||
#ifdef ANYCUBIC_TFT_DEBUG
|
#ifdef ANYCUBIC_TFT_DEBUG
|
||||||
SERIAL_ECHOLNPGM("TFT Serial Debug: Bed is heating... J08");
|
SERIAL_ECHOLNPGM("TFT Serial Debug: Bed is heating... J08");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void AnycubicTFTClass::BedHeatingDone()
|
void AnycubicTFTClass::BedHeatingDone()
|
||||||
{
|
{
|
||||||
ANYCUBIC_SERIAL_PROTOCOLPGM("J09"); // J09 hotbed heating done
|
ANYCUBIC_SERIAL_PROTOCOLPGM("J09"); // J09 hotbed heating done
|
||||||
ANYCUBIC_SERIAL_ENTER();
|
ANYCUBIC_SERIAL_ENTER();
|
||||||
#ifdef ANYCUBIC_TFT_DEBUG
|
#ifdef ANYCUBIC_TFT_DEBUG
|
||||||
SERIAL_ECHOLNPGM("TFT Serial Debug: Bed heating is done... J09");
|
SERIAL_ECHOLNPGM("TFT Serial Debug: Bed heating is done... J09");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue