parent
8aa4ed6945
commit
ad683fdedc
|
@ -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>
|
||||||
|
@ -396,7 +396,7 @@ 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();
|
||||||
|
|
||||||
|
@ -406,9 +406,9 @@ void AnycubicTFTClass::StateHandler()
|
||||||
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()) {
|
||||||
// File is still open --> paused
|
// File is still open --> paused
|
||||||
TFTstate=ANYCUBIC_TFT_STATE_SDPAUSE;
|
TFTstate=ANYCUBIC_TFT_STATE_SDPAUSE;
|
||||||
} else {
|
} else {
|
||||||
|
@ -435,7 +435,7 @@ void AnycubicTFTClass::StateHandler()
|
||||||
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
|
||||||
#ifndef ADVANCED_PAUSE_FEATURE
|
#ifndef ADVANCED_PAUSE_FEATURE
|
||||||
enqueue_and_echo_commands_P(PSTR("G91\nG1 Z10 F240\nG90"));
|
enqueue_and_echo_commands_P(PSTR("G91\nG1 Z10 F240\nG90"));
|
||||||
|
@ -458,22 +458,22 @@ void AnycubicTFTClass::StateHandler()
|
||||||
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
|
||||||
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("G91"));
|
||||||
enqueue_and_echo_commands_P(PSTR("G1 Z1 F240"));
|
enqueue_and_echo_commands_P(PSTR("G1 Z1 F240"));
|
||||||
enqueue_and_echo_commands_P(PSTR("G90"));
|
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("G91"));
|
||||||
enqueue_and_echo_commands_P(PSTR("G1 Z15 F240"));
|
enqueue_and_echo_commands_P(PSTR("G1 Z15 F240"));
|
||||||
enqueue_and_echo_commands_P(PSTR("G90"));
|
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("G91"));
|
||||||
enqueue_and_echo_commands_P(PSTR("G1 Z50 F240"));
|
enqueue_and_echo_commands_P(PSTR("G1 Z50 F240"));
|
||||||
enqueue_and_echo_commands_P(PSTR("G90"));
|
enqueue_and_echo_commands_P(PSTR("G90"));
|
||||||
|
@ -545,7 +545,7 @@ void AnycubicTFTClass::GetCommandFromTFT()
|
||||||
|
|
||||||
TFTcmdbuffer[TFTbufindw][serial3_count] = 0; //terminate string
|
TFTcmdbuffer[TFTbufindw][serial3_count] = 0; //terminate string
|
||||||
|
|
||||||
if((strchr(TFTcmdbuffer[TFTbufindw], 'A') != NULL)){
|
if((strchr(TFTcmdbuffer[TFTbufindw], 'A') != NULL)) {
|
||||||
int16_t a_command;
|
int16_t a_command;
|
||||||
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))));
|
||||||
|
@ -555,7 +555,7 @@ void AnycubicTFTClass::GetCommandFromTFT()
|
||||||
SERIAL_ECHOLNPAIR("TFT Serial Command: ", TFTcmdbuffer[TFTbufindw]);
|
SERIAL_ECHOLNPAIR("TFT Serial Command: ", TFTcmdbuffer[TFTbufindw]);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
switch(a_command){
|
switch(a_command) {
|
||||||
|
|
||||||
case 0: //A0 GET HOTEND TEMP
|
case 0: //A0 GET HOTEND TEMP
|
||||||
ANYCUBIC_SERIAL_PROTOCOLPGM("A0V ");
|
ANYCUBIC_SERIAL_PROTOCOLPGM("A0V ");
|
||||||
|
@ -609,7 +609,7 @@ void AnycubicTFTClass::GetCommandFromTFT()
|
||||||
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)
|
||||||
{
|
{
|
||||||
|
@ -782,9 +782,8 @@ void AnycubicTFTClass::GetCommandFromTFT()
|
||||||
case 17:// A17 set heated bed temp
|
case 17:// A17 set heated bed temp
|
||||||
{
|
{
|
||||||
unsigned int tempbed;
|
unsigned int tempbed;
|
||||||
if(CodeSeen('S')){tempbed=constrain(CodeValue(),0,150);
|
if(CodeSeen('S')) {tempbed=constrain(CodeValue(),0,150);
|
||||||
thermalManager.setTargetBed(tempbed);
|
thermalManager.setTargetBed(tempbed);}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// ANYCUBIC_SERIAL_ENTER();
|
// ANYCUBIC_SERIAL_ENTER();
|
||||||
break;
|
break;
|
||||||
|
@ -816,8 +815,9 @@ void AnycubicTFTClass::GetCommandFromTFT()
|
||||||
break;
|
break;
|
||||||
case 20:// A20 read printing speed
|
case 20:// A20 read printing speed
|
||||||
{
|
{
|
||||||
if(CodeSeen('S')){
|
if(CodeSeen('S')) {
|
||||||
feedrate_percentage=constrain(CodeValue(),40,999);}
|
feedrate_percentage=constrain(CodeValue(),40,999);
|
||||||
|
}
|
||||||
else{
|
else{
|
||||||
ANYCUBIC_SERIAL_PROTOCOLPGM("A20V ");
|
ANYCUBIC_SERIAL_PROTOCOLPGM("A20V ");
|
||||||
ANYCUBIC_SERIAL_PROTOCOL(feedrate_percentage);
|
ANYCUBIC_SERIAL_PROTOCOL(feedrate_percentage);
|
||||||
|
@ -830,11 +830,11 @@ void AnycubicTFTClass::GetCommandFromTFT()
|
||||||
{
|
{
|
||||||
if(CodeSeen('X')||CodeSeen('Y')||CodeSeen('Z'))
|
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('Y')) enqueue_and_echo_commands_P(PSTR("G28 Y"));
|
||||||
if(CodeSeen('Z')) enqueue_and_echo_commands_P(PSTR("G28 Z"));
|
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;
|
break;
|
||||||
case 22: // A22 move X/Y/Z or extrude
|
case 22: // A22 move X/Y/Z or extrude
|
||||||
|
@ -851,32 +851,32 @@ void AnycubicTFTClass::GetCommandFromTFT()
|
||||||
if(CodeSeen('X')) // Move in X direction
|
if(CodeSeen('X')) // Move in X direction
|
||||||
{
|
{
|
||||||
coorvalue=CodeValue();
|
coorvalue=CodeValue();
|
||||||
if((coorvalue<=0.2)&&coorvalue>0){sprintf_P(value,PSTR("G1 X0.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 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);}
|
else {sprintf_P(value,PSTR("G1 X%iF%i"),int(coorvalue),movespeed);}
|
||||||
enqueue_and_echo_command(value);
|
enqueue_and_echo_command(value);
|
||||||
}
|
}
|
||||||
else if(CodeSeen('Y')) // Move in Y direction
|
else if(CodeSeen('Y')) // Move in Y direction
|
||||||
{
|
{
|
||||||
coorvalue=CodeValue();
|
coorvalue=CodeValue();
|
||||||
if((coorvalue<=0.2)&&coorvalue>0){sprintf_P(value,PSTR("G1 Y0.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 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);}
|
else {sprintf_P(value,PSTR("G1 Y%iF%i"),int(coorvalue),movespeed);}
|
||||||
enqueue_and_echo_command(value);
|
enqueue_and_echo_command(value);
|
||||||
}
|
}
|
||||||
else if(CodeSeen('Z')) // Move in Z direction
|
else if(CodeSeen('Z')) // Move in Z direction
|
||||||
{
|
{
|
||||||
coorvalue=CodeValue();
|
coorvalue=CodeValue();
|
||||||
if((coorvalue<=0.2)&&coorvalue>0){sprintf_P(value,PSTR("G1 Z0.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 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);}
|
else {sprintf_P(value,PSTR("G1 Z%iF%i"),int(coorvalue),movespeed);}
|
||||||
enqueue_and_echo_command(value);
|
enqueue_and_echo_command(value);
|
||||||
}
|
}
|
||||||
else if(CodeSeen('E')) // Extrude
|
else if(CodeSeen('E')) // Extrude
|
||||||
{
|
{
|
||||||
coorvalue=CodeValue();
|
coorvalue=CodeValue();
|
||||||
if((coorvalue<=0.2)&&coorvalue>0){sprintf_P(value,PSTR("G1 E0.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 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)); }
|
else {sprintf_P(value,PSTR("G1 E%iF500"),int(coorvalue)); }
|
||||||
enqueue_and_echo_command(value);
|
enqueue_and_echo_command(value);
|
||||||
}
|
}
|
||||||
|
@ -1018,7 +1018,7 @@ void AnycubicTFTClass::GetCommandFromTFT()
|
||||||
//if((current_position[Z_AXIS]<10))
|
//if((current_position[Z_AXIS]<10))
|
||||||
// z_offset_auto_test();
|
// z_offset_auto_test();
|
||||||
|
|
||||||
if(CodeSeen('S')){
|
if(CodeSeen('S')) {
|
||||||
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();
|
||||||
|
|
Loading…
Reference in New Issue