Beautify code

Fix indentation
This commit is contained in:
David Ramiro 2019-01-24 16:45:35 +01:00
parent 8aa4ed6945
commit ad683fdedc
No known key found for this signature in database
GPG Key ID: 5B042737EBEEB736
1 changed files with 924 additions and 924 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>
@ -396,7 +396,7 @@ void AnycubicTFTClass::StateHandler()
switch (TFTstate) {
case ANYCUBIC_TFT_STATE_IDLE:
#ifdef SDSUPPORT
if(card.sdprinting){
if(card.sdprinting) {
TFTstate=ANYCUBIC_TFT_STATE_SDPRINT;
starttime=millis();
@ -406,9 +406,9 @@ void AnycubicTFTClass::StateHandler()
break;
case ANYCUBIC_TFT_STATE_SDPRINT:
#ifdef SDSUPPORT
if(!card.sdprinting){
if(!card.sdprinting) {
// It seems that we are to printing anymore... pause or stopped?
if (card.isFileOpen()){
if (card.isFileOpen()) {
// File is still open --> paused
TFTstate=ANYCUBIC_TFT_STATE_SDPAUSE;
} else {
@ -435,7 +435,7 @@ void AnycubicTFTClass::StateHandler()
break;
case ANYCUBIC_TFT_STATE_SDPAUSE_REQ:
#ifdef SDSUPPORT
if((!card.sdprinting) && (!planner.movesplanned())){
if((!card.sdprinting) && (!planner.movesplanned())) {
// We have to wait until the sd card printing has been settled
#ifndef ADVANCED_PAUSE_FEATURE
enqueue_and_echo_commands_P(PSTR("G91\nG1 Z10 F240\nG90"));
@ -458,22 +458,22 @@ void AnycubicTFTClass::StateHandler()
break;
case ANYCUBIC_TFT_STATE_SDSTOP_REQ:
#ifdef SDSUPPORT
if((!card.sdprinting) && (!planner.movesplanned())){
if((!card.sdprinting) && (!planner.movesplanned())) {
ANYCUBIC_SERIAL_PROTOCOLPGM("J16");// J16 stop print
ANYCUBIC_SERIAL_ENTER();
TFTstate=ANYCUBIC_TFT_STATE_IDLE;
#ifdef ANYCUBIC_TFT_DEBUG
SERIAL_ECHOLNPGM("TFT Serial Debug: SD print stopped... J16");
#endif
if((current_position[Z_AXIS]>200)){
if((current_position[Z_AXIS]>200)) {
enqueue_and_echo_commands_P(PSTR("G91"));
enqueue_and_echo_commands_P(PSTR("G1 Z1 F240"));
enqueue_and_echo_commands_P(PSTR("G90"));
} else if ((current_position[Z_AXIS]<190)){
} else if ((current_position[Z_AXIS]<190)) {
enqueue_and_echo_commands_P(PSTR("G91"));
enqueue_and_echo_commands_P(PSTR("G1 Z15 F240"));
enqueue_and_echo_commands_P(PSTR("G90"));
} else if ((current_position[Z_AXIS]<150)){
} else if ((current_position[Z_AXIS]<150)) {
enqueue_and_echo_commands_P(PSTR("G91"));
enqueue_and_echo_commands_P(PSTR("G1 Z50 F240"));
enqueue_and_echo_commands_P(PSTR("G90"));
@ -545,7 +545,7 @@ void AnycubicTFTClass::GetCommandFromTFT()
TFTcmdbuffer[TFTbufindw][serial3_count] = 0; //terminate string
if((strchr(TFTcmdbuffer[TFTbufindw], 'A') != NULL)){
if((strchr(TFTcmdbuffer[TFTbufindw], 'A') != NULL)) {
int16_t a_command;
TFTstrchr_pointer = strchr(TFTcmdbuffer[TFTbufindw], 'A');
a_command=((int)((strtod(&TFTcmdbuffer[TFTbufindw][TFTstrchr_pointer - TFTcmdbuffer[TFTbufindw] + 1], NULL))));
@ -555,7 +555,7 @@ void AnycubicTFTClass::GetCommandFromTFT()
SERIAL_ECHOLNPAIR("TFT Serial Command: ", TFTcmdbuffer[TFTbufindw]);
#endif
switch(a_command){
switch(a_command) {
case 0: //A0 GET HOTEND TEMP
ANYCUBIC_SERIAL_PROTOCOLPGM("A0V ");
@ -609,7 +609,7 @@ void AnycubicTFTClass::GetCommandFromTFT()
break;
case 6: //A6 GET SD CARD PRINTING STATUS
#ifdef SDSUPPORT
if(card.sdprinting){
if(card.sdprinting) {
ANYCUBIC_SERIAL_PROTOCOLPGM("A6V ");
if(card.cardOK)
{
@ -782,9 +782,8 @@ void AnycubicTFTClass::GetCommandFromTFT()
case 17:// A17 set heated bed temp
{
unsigned int tempbed;
if(CodeSeen('S')){tempbed=constrain(CodeValue(),0,150);
thermalManager.setTargetBed(tempbed);
}
if(CodeSeen('S')) {tempbed=constrain(CodeValue(),0,150);
thermalManager.setTargetBed(tempbed);}
}
// ANYCUBIC_SERIAL_ENTER();
break;
@ -816,8 +815,9 @@ void AnycubicTFTClass::GetCommandFromTFT()
break;
case 20:// A20 read printing speed
{
if(CodeSeen('S')){
feedrate_percentage=constrain(CodeValue(),40,999);}
if(CodeSeen('S')) {
feedrate_percentage=constrain(CodeValue(),40,999);
}
else{
ANYCUBIC_SERIAL_PROTOCOLPGM("A20V ");
ANYCUBIC_SERIAL_PROTOCOL(feedrate_percentage);
@ -830,11 +830,11 @@ void AnycubicTFTClass::GetCommandFromTFT()
{
if(CodeSeen('X')||CodeSeen('Y')||CodeSeen('Z'))
{
if(CodeSeen('X'))enqueue_and_echo_commands_P(PSTR("G28 X"));
if(CodeSeen('X')) enqueue_and_echo_commands_P(PSTR("G28 X"));
if(CodeSeen('Y')) enqueue_and_echo_commands_P(PSTR("G28 Y"));
if(CodeSeen('Z')) enqueue_and_echo_commands_P(PSTR("G28 Z"));
}
else if(CodeSeen('C'))enqueue_and_echo_commands_P(PSTR("G28"));
else if(CodeSeen('C')) enqueue_and_echo_commands_P(PSTR("G28"));
}
break;
case 22: // A22 move X/Y/Z or extrude
@ -851,32 +851,32 @@ void AnycubicTFTClass::GetCommandFromTFT()
if(CodeSeen('X')) // Move in X direction
{
coorvalue=CodeValue();
if((coorvalue<=0.2)&&coorvalue>0){sprintf_P(value,PSTR("G1 X0.1F%i"),movespeed);}
else if((coorvalue<=-0.1)&&coorvalue>-1){sprintf_P(value,PSTR("G1 X-0.1F%i"),movespeed);}
if((coorvalue<=0.2)&&coorvalue>0) {sprintf_P(value,PSTR("G1 X0.1F%i"),movespeed);}
else if((coorvalue<=-0.1)&&coorvalue>-1) {sprintf_P(value,PSTR("G1 X-0.1F%i"),movespeed);}
else {sprintf_P(value,PSTR("G1 X%iF%i"),int(coorvalue),movespeed);}
enqueue_and_echo_command(value);
}
else if(CodeSeen('Y')) // Move in Y direction
{
coorvalue=CodeValue();
if((coorvalue<=0.2)&&coorvalue>0){sprintf_P(value,PSTR("G1 Y0.1F%i"),movespeed);}
else if((coorvalue<=-0.1)&&coorvalue>-1){sprintf_P(value,PSTR("G1 Y-0.1F%i"),movespeed);}
if((coorvalue<=0.2)&&coorvalue>0) {sprintf_P(value,PSTR("G1 Y0.1F%i"),movespeed);}
else if((coorvalue<=-0.1)&&coorvalue>-1) {sprintf_P(value,PSTR("G1 Y-0.1F%i"),movespeed);}
else {sprintf_P(value,PSTR("G1 Y%iF%i"),int(coorvalue),movespeed);}
enqueue_and_echo_command(value);
}
else if(CodeSeen('Z')) // Move in Z direction
{
coorvalue=CodeValue();
if((coorvalue<=0.2)&&coorvalue>0){sprintf_P(value,PSTR("G1 Z0.1F%i"),movespeed);}
else if((coorvalue<=-0.1)&&coorvalue>-1){sprintf_P(value,PSTR("G1 Z-0.1F%i"),movespeed);}
if((coorvalue<=0.2)&&coorvalue>0) {sprintf_P(value,PSTR("G1 Z0.1F%i"),movespeed);}
else if((coorvalue<=-0.1)&&coorvalue>-1) {sprintf_P(value,PSTR("G1 Z-0.1F%i"),movespeed);}
else {sprintf_P(value,PSTR("G1 Z%iF%i"),int(coorvalue),movespeed);}
enqueue_and_echo_command(value);
}
else if(CodeSeen('E')) // Extrude
{
coorvalue=CodeValue();
if((coorvalue<=0.2)&&coorvalue>0){sprintf_P(value,PSTR("G1 E0.1F%i"),movespeed);}
else if((coorvalue<=-0.1)&&coorvalue>-1){sprintf_P(value,PSTR("G1 E-0.1F%i"),movespeed);}
if((coorvalue<=0.2)&&coorvalue>0) {sprintf_P(value,PSTR("G1 E0.1F%i"),movespeed);}
else if((coorvalue<=-0.1)&&coorvalue>-1) {sprintf_P(value,PSTR("G1 E-0.1F%i"),movespeed);}
else {sprintf_P(value,PSTR("G1 E%iF500"),int(coorvalue)); }
enqueue_and_echo_command(value);
}
@ -1018,7 +1018,7 @@ void AnycubicTFTClass::GetCommandFromTFT()
//if((current_position[Z_AXIS]<10))
// z_offset_auto_test();
if(CodeSeen('S')){
if(CodeSeen('S')) {
ANYCUBIC_SERIAL_PROTOCOLPGM("A9V ");
ANYCUBIC_SERIAL_PROTOCOL(itostr3(int(zprobe_zoffset*100.00 + 0.5)));
ANYCUBIC_SERIAL_ENTER();