Fix indentation

Improve readability and fix #ifdef and #endif indentations
This commit is contained in:
David Ramiro 2019-03-08 01:25:21 +01:00
parent 85c32a2bb6
commit 90e27ff21b
No known key found for this signature in database
GPG Key ID: 5B042737EBEEB736
1 changed files with 1084 additions and 1084 deletions

View File

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