|
@ -2,7 +2,7 @@ |
|
|
* anycubic_i3mega_lcd.cpp --- Support for Anycubic i3 Mega TFT |
|
|
* anycubic_i3mega_lcd.cpp --- Support for Anycubic i3 Mega TFT |
|
|
* Created by Christian Hopp on 09.12.17. |
|
|
* Created by Christian Hopp on 09.12.17. |
|
|
* Improved by David Ramiro |
|
|
* Improved by David Ramiro |
|
|
* Converted to ext_iu by John BouAntoun 21 June 2020 |
|
|
* Converted to ExtUI by John BouAntoun 21 June 2020 |
|
|
* |
|
|
* |
|
|
* This library is free software; you can redistribute it and/or |
|
|
* This library is free software; you can redistribute it and/or |
|
|
* modify it under the terms of the GNU Lesser General Public |
|
|
* modify it under the terms of the GNU Lesser General Public |
|
@ -32,44 +32,46 @@ |
|
|
#include "../../../../inc/MarlinConfig.h" |
|
|
#include "../../../../inc/MarlinConfig.h" |
|
|
|
|
|
|
|
|
// command sending macro's with debugging capability
|
|
|
// command sending macro's with debugging capability
|
|
|
#define SEND_PGM(x) send_P(PSTR(x)) |
|
|
#define SEND_PGM(x) send_P(PSTR(x)) |
|
|
#define SENDLINE_PGM(x) sendLine_P(PSTR(x)) |
|
|
#define SENDLINE_PGM(x) sendLine_P(PSTR(x)) |
|
|
#define SEND_PGM_VAL(x,y) (send_P(PSTR(x)), sendLine(i16tostr3rj(y))) |
|
|
#define SEND_PGM_VAL(x,y) (send_P(PSTR(x)), sendLine(i16tostr3rj(y))) |
|
|
#define SEND(x) send(x) |
|
|
#define SEND(x) send(x) |
|
|
#define SENDLINE(x) sendLine(x) |
|
|
#define SENDLINE(x) sendLine(x) |
|
|
#if ENABLED(ANYCUBIC_LCD_DEBUG) |
|
|
#if ENABLED(ANYCUBIC_LCD_DEBUG) |
|
|
#define SENDLINE_DBG_PGM(x,y) (sendLine_P(PSTR(x)), SERIAL_ECHOLNPGM(y)) |
|
|
#define SENDLINE_DBG_PGM(x,y) (sendLine_P(PSTR(x)), SERIAL_ECHOLNPGM(y)) |
|
|
#define SENDLINE_DBG_PGM_VAL(x,y,z) (sendLine_P(PSTR(x)), SERIAL_ECHOPGM(y), SERIAL_ECHOLN(z)) |
|
|
#define SENDLINE_DBG_PGM_VAL(x,y,z) (sendLine_P(PSTR(x)), SERIAL_ECHOPGM(y), SERIAL_ECHOLN(z)) |
|
|
#else |
|
|
#else |
|
|
#define SENDLINE_DBG_PGM(x,y) sendLine_P(PSTR(x)) |
|
|
#define SENDLINE_DBG_PGM(x,y) sendLine_P(PSTR(x)) |
|
|
#define SENDLINE_DBG_PGM_VAL(x,y,z) sendLine_P(PSTR(x)) |
|
|
#define SENDLINE_DBG_PGM_VAL(x,y,z) sendLine_P(PSTR(x)) |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
|
AnycubicTFTClass AnycubicTFT; |
|
|
AnycubicTFTClass AnycubicTFT; |
|
|
|
|
|
|
|
|
static void sendNewLine(void) { |
|
|
char AnycubicTFTClass::TFTcmdbuffer[TFTBUFSIZE][TFT_MAX_CMD_SIZE]; |
|
|
LCD_SERIAL.write('\r'); |
|
|
int AnycubicTFTClass::TFTbuflen = 0, |
|
|
LCD_SERIAL.write('\n'); |
|
|
AnycubicTFTClass::TFTbufindr = 0, |
|
|
} |
|
|
AnycubicTFTClass::TFTbufindw = 0; |
|
|
|
|
|
char AnycubicTFTClass::serial3_char; |
|
|
static void send(const char *str) { |
|
|
int AnycubicTFTClass::serial3_count = 0; |
|
|
LCD_SERIAL.print(str); |
|
|
char* AnycubicTFTClass::TFTstrchr_pointer; |
|
|
} |
|
|
uint8_t AnycubicTFTClass::SpecialMenu = false; |
|
|
|
|
|
AnycubicMediaPrintState AnycubicTFTClass::mediaPrintingState = AMPRINTSTATE_NOT_PRINTING; |
|
|
static void sendLine(const char *str) { |
|
|
AnycubicMediaPauseState AnycubicTFTClass::mediaPauseState = AMPAUSESTATE_NOT_PAUSED; |
|
|
send(str); |
|
|
|
|
|
sendNewLine(); |
|
|
char AnycubicTFTClass::SelectedDirectory[30]; |
|
|
} |
|
|
char AnycubicTFTClass::SelectedFile[FILENAME_LENGTH]; |
|
|
|
|
|
|
|
|
|
|
|
// Serial helpers
|
|
|
|
|
|
static void sendNewLine(void) { LCD_SERIAL.write('\r'); LCD_SERIAL.write('\n'); } |
|
|
|
|
|
static void send(const char *str) { LCD_SERIAL.print(str); } |
|
|
static void send_P(PGM_P str) { |
|
|
static void send_P(PGM_P str) { |
|
|
while (const char c = pgm_read_byte(str++)) |
|
|
while (const char c = pgm_read_byte(str++)) |
|
|
LCD_SERIAL.write(c); |
|
|
LCD_SERIAL.write(c); |
|
|
} |
|
|
} |
|
|
|
|
|
static void sendLine(const char *str) { send(str); sendNewLine(); } |
|
|
|
|
|
static void sendLine_P(PGM_P str) { send_P(str); sendNewLine(); } |
|
|
|
|
|
|
|
|
static void sendLine_P(PGM_P str) { |
|
|
using namespace ExtUI; |
|
|
send_P(str); |
|
|
|
|
|
sendNewLine(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
AnycubicTFTClass::AnycubicTFTClass() {} |
|
|
AnycubicTFTClass::AnycubicTFTClass() {} |
|
|
|
|
|
|
|
@ -80,7 +82,7 @@ void AnycubicTFTClass::OnSetup() { |
|
|
LCD_SERIAL.begin(LCD_BAUDRATE); |
|
|
LCD_SERIAL.begin(LCD_BAUDRATE); |
|
|
|
|
|
|
|
|
SENDLINE_DBG_PGM("J17", "TFT Serial Debug: Main board reset... J17"); // J17 Main board reset
|
|
|
SENDLINE_DBG_PGM("J17", "TFT Serial Debug: Main board reset... J17"); // J17 Main board reset
|
|
|
ExtUI::delay_ms(10); |
|
|
delay_ms(10); |
|
|
|
|
|
|
|
|
// initialise the state of the key pins running on the tft
|
|
|
// initialise the state of the key pins running on the tft
|
|
|
#if ENABLED(SDSUPPORT) && PIN_EXISTS(SD_DETECT) |
|
|
#if ENABLED(SDSUPPORT) && PIN_EXISTS(SD_DETECT) |
|
@ -95,13 +97,13 @@ void AnycubicTFTClass::OnSetup() { |
|
|
|
|
|
|
|
|
// DoSDCardStateCheck();
|
|
|
// DoSDCardStateCheck();
|
|
|
SENDLINE_DBG_PGM("J12", "TFT Serial Debug: Ready... J12"); // J12 Ready
|
|
|
SENDLINE_DBG_PGM("J12", "TFT Serial Debug: Ready... J12"); // J12 Ready
|
|
|
ExtUI::delay_ms(10); |
|
|
delay_ms(10); |
|
|
|
|
|
|
|
|
DoFilamentRunoutCheck(); |
|
|
DoFilamentRunoutCheck(); |
|
|
SelectedFile[0] = 0; |
|
|
SelectedFile[0] = 0; |
|
|
|
|
|
|
|
|
#if ENABLED(STARTUP_CHIME) |
|
|
#if ENABLED(STARTUP_CHIME) |
|
|
ExtUI::injectCommands_P(PSTR("M300 P250 S554\nM300 P250 S554\nM300 P250 S740\nM300 P250 S554\nM300 P250 S740\nM300 P250 S554\nM300 P500 S831")); |
|
|
injectCommands_P(PSTR("M300 P250 S554\nM300 P250 S554\nM300 P250 S740\nM300 P250 S554\nM300 P250 S740\nM300 P250 S554\nM300 P500 S831")); |
|
|
#endif |
|
|
#endif |
|
|
#if ENABLED(ANYCUBIC_LCD_DEBUG) |
|
|
#if ENABLED(ANYCUBIC_LCD_DEBUG) |
|
|
SERIAL_ECHOLNPGM("TFT Serial Debug: Finished startup"); |
|
|
SERIAL_ECHOLNPGM("TFT Serial Debug: Finished startup"); |
|
@ -119,8 +121,8 @@ void AnycubicTFTClass::OnCommandScan() { |
|
|
#endif |
|
|
#endif |
|
|
mediaPrintingState = AMPRINTSTATE_NOT_PRINTING; |
|
|
mediaPrintingState = AMPRINTSTATE_NOT_PRINTING; |
|
|
mediaPauseState = AMPAUSESTATE_NOT_PAUSED; |
|
|
mediaPauseState = AMPAUSESTATE_NOT_PAUSED; |
|
|
ExtUI::injectCommands_P(PSTR("M84\nM27")); // disable stepper motors and force report of SD status
|
|
|
injectCommands_P(PSTR("M84\nM27")); // disable stepper motors and force report of SD status
|
|
|
ExtUI::delay_ms(200); |
|
|
delay_ms(200); |
|
|
// tell printer to release resources of print to indicate it is done
|
|
|
// tell printer to release resources of print to indicate it is done
|
|
|
SENDLINE_DBG_PGM("J14", "TFT Serial Debug: SD Print Stopped... J14"); |
|
|
SENDLINE_DBG_PGM("J14", "TFT Serial Debug: SD Print Stopped... J14"); |
|
|
} |
|
|
} |
|
@ -224,8 +226,8 @@ bool AnycubicTFTClass::CodeSeen(char code) { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
bool AnycubicTFTClass::IsNozzleHomed() { |
|
|
bool AnycubicTFTClass::IsNozzleHomed() { |
|
|
const float xPosition = ExtUI::getAxisPosition_mm((ExtUI::axis_t) ExtUI::X); |
|
|
const float xPosition = getAxisPosition_mm((axis_t) X); |
|
|
const float yPosition = ExtUI::getAxisPosition_mm((ExtUI::axis_t) ExtUI::Y); |
|
|
const float yPosition = getAxisPosition_mm((axis_t) Y); |
|
|
return WITHIN(xPosition, X_MIN_POS - 0.1, X_MIN_POS + 0.1) && |
|
|
return WITHIN(xPosition, X_MIN_POS - 0.1, X_MIN_POS + 0.1) && |
|
|
WITHIN(yPosition, Y_MIN_POS - 0.1, Y_MIN_POS + 0.1); |
|
|
WITHIN(yPosition, Y_MIN_POS - 0.1, Y_MIN_POS + 0.1); |
|
|
} |
|
|
} |
|
@ -246,48 +248,48 @@ void AnycubicTFTClass::HandleSpecialMenu() { |
|
|
switch (SelectedDirectory[2]) { |
|
|
switch (SelectedDirectory[2]) { |
|
|
case '1': // "<01ZUp0.1>"
|
|
|
case '1': // "<01ZUp0.1>"
|
|
|
SERIAL_ECHOLNPGM("Special Menu: Z Up 0.1"); |
|
|
SERIAL_ECHOLNPGM("Special Menu: Z Up 0.1"); |
|
|
ExtUI::injectCommands_P(PSTR("G91\nG1 Z+0.1\nG90")); |
|
|
injectCommands_P(PSTR("G91\nG1 Z+0.1\nG90")); |
|
|
break; |
|
|
break; |
|
|
|
|
|
|
|
|
case '2': // "<02ZUp0.02>"
|
|
|
case '2': // "<02ZUp0.02>"
|
|
|
SERIAL_ECHOLNPGM("Special Menu: Z Up 0.02"); |
|
|
SERIAL_ECHOLNPGM("Special Menu: Z Up 0.02"); |
|
|
ExtUI::injectCommands_P(PSTR("G91\nG1 Z+0.02\nG90")); |
|
|
injectCommands_P(PSTR("G91\nG1 Z+0.02\nG90")); |
|
|
break; |
|
|
break; |
|
|
|
|
|
|
|
|
case '3': // "<03ZDn0.02>"
|
|
|
case '3': // "<03ZDn0.02>"
|
|
|
SERIAL_ECHOLNPGM("Special Menu: Z Down 0.02"); |
|
|
SERIAL_ECHOLNPGM("Special Menu: Z Down 0.02"); |
|
|
ExtUI::injectCommands_P(PSTR("G91\nG1 Z-0.02\nG90")); |
|
|
injectCommands_P(PSTR("G91\nG1 Z-0.02\nG90")); |
|
|
break; |
|
|
break; |
|
|
|
|
|
|
|
|
case '4': // "<04ZDn0.1>"
|
|
|
case '4': // "<04ZDn0.1>"
|
|
|
SERIAL_ECHOLNPGM("Special Menu: Z Down 0.1"); |
|
|
SERIAL_ECHOLNPGM("Special Menu: Z Down 0.1"); |
|
|
ExtUI::injectCommands_P(PSTR("G91\nG1 Z-0.1\nG90")); |
|
|
injectCommands_P(PSTR("G91\nG1 Z-0.1\nG90")); |
|
|
break; |
|
|
break; |
|
|
|
|
|
|
|
|
case '5': // "<05PrehtBed>"
|
|
|
case '5': // "<05PrehtBed>"
|
|
|
SERIAL_ECHOLNPGM("Special Menu: Preheat Bed"); |
|
|
SERIAL_ECHOLNPGM("Special Menu: Preheat Bed"); |
|
|
ExtUI::injectCommands_P(PSTR("M140 S65")); |
|
|
injectCommands_P(PSTR("M140 S65")); |
|
|
break; |
|
|
break; |
|
|
|
|
|
|
|
|
case '6': // "<06SMeshLvl>"
|
|
|
case '6': // "<06SMeshLvl>"
|
|
|
SERIAL_ECHOLNPGM("Special Menu: Start Mesh Leveling"); |
|
|
SERIAL_ECHOLNPGM("Special Menu: Start Mesh Leveling"); |
|
|
ExtUI::injectCommands_P(PSTR("G29S1")); |
|
|
injectCommands_P(PSTR("G29S1")); |
|
|
break; |
|
|
break; |
|
|
|
|
|
|
|
|
case '7': // "<07MeshNPnt>"
|
|
|
case '7': // "<07MeshNPnt>"
|
|
|
SERIAL_ECHOLNPGM("Special Menu: Next Mesh Point"); |
|
|
SERIAL_ECHOLNPGM("Special Menu: Next Mesh Point"); |
|
|
ExtUI::injectCommands_P(PSTR("G29S2")); |
|
|
injectCommands_P(PSTR("G29S2")); |
|
|
break; |
|
|
break; |
|
|
|
|
|
|
|
|
case '8': // "<08HtEndPID>"
|
|
|
case '8': // "<08HtEndPID>"
|
|
|
SERIAL_ECHOLNPGM("Special Menu: Auto Tune Hotend PID"); |
|
|
SERIAL_ECHOLNPGM("Special Menu: Auto Tune Hotend PID"); |
|
|
// need to dwell for half a second to give the fan a chance to start before the pid tuning starts
|
|
|
// need to dwell for half a second to give the fan a chance to start before the pid tuning starts
|
|
|
ExtUI::injectCommands_P(PSTR("M106 S204\nG4 P500\nM303 E0 S215 C15 U1")); |
|
|
injectCommands_P(PSTR("M106 S204\nG4 P500\nM303 E0 S215 C15 U1")); |
|
|
break; |
|
|
break; |
|
|
|
|
|
|
|
|
case '9': // "<09HtBedPID>"
|
|
|
case '9': // "<09HtBedPID>"
|
|
|
SERIAL_ECHOLNPGM("Special Menu: Auto Tune Hotbed Pid"); |
|
|
SERIAL_ECHOLNPGM("Special Menu: Auto Tune Hotbed Pid"); |
|
|
ExtUI::injectCommands_P(PSTR("M303 E-1 S65 C6 U1")); |
|
|
injectCommands_P(PSTR("M303 E-1 S65 C6 U1")); |
|
|
break; |
|
|
break; |
|
|
|
|
|
|
|
|
default: |
|
|
default: |
|
@ -299,12 +301,12 @@ void AnycubicTFTClass::HandleSpecialMenu() { |
|
|
switch (SelectedDirectory[2]) { |
|
|
switch (SelectedDirectory[2]) { |
|
|
case '0': // "<10FWDeflts>"
|
|
|
case '0': // "<10FWDeflts>"
|
|
|
SERIAL_ECHOLNPGM("Special Menu: Load FW Defaults"); |
|
|
SERIAL_ECHOLNPGM("Special Menu: Load FW Defaults"); |
|
|
ExtUI::injectCommands_P(PSTR("M502\nM300 P105 S1661\nM300 P210 S1108")); |
|
|
injectCommands_P(PSTR("M502\nM300 P105 S1661\nM300 P210 S1108")); |
|
|
break; |
|
|
break; |
|
|
|
|
|
|
|
|
case '1': // "<11SvEEPROM>"
|
|
|
case '1': // "<11SvEEPROM>"
|
|
|
SERIAL_ECHOLNPGM("Special Menu: Save EEPROM"); |
|
|
SERIAL_ECHOLNPGM("Special Menu: Save EEPROM"); |
|
|
ExtUI::injectCommands_P(PSTR("M500\nM300 P105 S1108\nM300 P210 S1661")); |
|
|
injectCommands_P(PSTR("M500\nM300 P105 S1108\nM300 P210 S1661")); |
|
|
break; |
|
|
break; |
|
|
|
|
|
|
|
|
default: |
|
|
default: |
|
@ -316,38 +318,38 @@ void AnycubicTFTClass::HandleSpecialMenu() { |
|
|
switch (SelectedDirectory[2]) { |
|
|
switch (SelectedDirectory[2]) { |
|
|
case '1': // "<01PrehtBed>"
|
|
|
case '1': // "<01PrehtBed>"
|
|
|
SERIAL_ECHOLNPGM("Special Menu: Preheat Bed"); |
|
|
SERIAL_ECHOLNPGM("Special Menu: Preheat Bed"); |
|
|
ExtUI::injectCommands_P(PSTR("M140 S65")); |
|
|
injectCommands_P(PSTR("M140 S65")); |
|
|
break; |
|
|
break; |
|
|
|
|
|
|
|
|
case '2': // "<02ABL>"
|
|
|
case '2': // "<02ABL>"
|
|
|
SERIAL_ECHOLNPGM("Special Menu: Auto Bed Leveling"); |
|
|
SERIAL_ECHOLNPGM("Special Menu: Auto Bed Leveling"); |
|
|
ExtUI::injectCommands_P(PSTR("G29N")); |
|
|
injectCommands_P(PSTR("G29N")); |
|
|
break; |
|
|
break; |
|
|
|
|
|
|
|
|
case '3': // "<03HtendPID>"
|
|
|
case '3': // "<03HtendPID>"
|
|
|
SERIAL_ECHOLNPGM("Special Menu: Auto Tune Hotend PID"); |
|
|
SERIAL_ECHOLNPGM("Special Menu: Auto Tune Hotend PID"); |
|
|
// need to dwell for half a second to give the fan a chance to start before the pid tuning starts
|
|
|
// need to dwell for half a second to give the fan a chance to start before the pid tuning starts
|
|
|
ExtUI::injectCommands_P(PSTR("M106 S204\nG4 P500\nM303 E0 S215 C15 U1")); |
|
|
injectCommands_P(PSTR("M106 S204\nG4 P500\nM303 E0 S215 C15 U1")); |
|
|
break; |
|
|
break; |
|
|
|
|
|
|
|
|
case '4': // "<04HtbedPID>"
|
|
|
case '4': // "<04HtbedPID>"
|
|
|
SERIAL_ECHOLNPGM("Special Menu: Auto Tune Hotbed Pid"); |
|
|
SERIAL_ECHOLNPGM("Special Menu: Auto Tune Hotbed Pid"); |
|
|
ExtUI::injectCommands_P(PSTR("M303 E-1 S65 C6 U1")); |
|
|
injectCommands_P(PSTR("M303 E-1 S65 C6 U1")); |
|
|
break; |
|
|
break; |
|
|
|
|
|
|
|
|
case '5': // "<05FWDeflts>"
|
|
|
case '5': // "<05FWDeflts>"
|
|
|
SERIAL_ECHOLNPGM("Special Menu: Load FW Defaults"); |
|
|
SERIAL_ECHOLNPGM("Special Menu: Load FW Defaults"); |
|
|
ExtUI::injectCommands_P(PSTR("M502\nM300 P105 S1661\nM300 P210 S1108")); |
|
|
injectCommands_P(PSTR("M502\nM300 P105 S1661\nM300 P210 S1108")); |
|
|
break; |
|
|
break; |
|
|
|
|
|
|
|
|
case '6': // "<06SvEEPROM>"
|
|
|
case '6': // "<06SvEEPROM>"
|
|
|
SERIAL_ECHOLNPGM("Special Menu: Save EEPROM"); |
|
|
SERIAL_ECHOLNPGM("Special Menu: Save EEPROM"); |
|
|
ExtUI::injectCommands_P(PSTR("M500\nM300 P105 S1108\nM300 P210 S1661")); |
|
|
injectCommands_P(PSTR("M500\nM300 P105 S1108\nM300 P210 S1661")); |
|
|
break; |
|
|
break; |
|
|
|
|
|
|
|
|
case '7': // <07SendM108>
|
|
|
case '7': // <07SendM108>
|
|
|
SERIAL_ECHOLNPGM("Special Menu: Send User Confirmation"); |
|
|
SERIAL_ECHOLNPGM("Special Menu: Send User Confirmation"); |
|
|
ExtUI::injectCommands_P(PSTR("M108")); |
|
|
injectCommands_P(PSTR("M108")); |
|
|
break; |
|
|
break; |
|
|
|
|
|
|
|
|
default: |
|
|
default: |
|
@ -373,11 +375,11 @@ void AnycubicTFTClass::RenderCurrentFileList() { |
|
|
uint16_t selectedNumber = 0; |
|
|
uint16_t selectedNumber = 0; |
|
|
SelectedDirectory[0] = 0; |
|
|
SelectedDirectory[0] = 0; |
|
|
SelectedFile[0] = 0; |
|
|
SelectedFile[0] = 0; |
|
|
ExtUI::FileList currentFileList; |
|
|
FileList currentFileList; |
|
|
|
|
|
|
|
|
SENDLINE_PGM("FN "); // Filelist start
|
|
|
SENDLINE_PGM("FN "); // Filelist start
|
|
|
|
|
|
|
|
|
if (!ExtUI::isMediaInserted() && !SpecialMenu) { |
|
|
if (!isMediaInserted() && !SpecialMenu) { |
|
|
SENDLINE_DBG_PGM("J02", "TFT Serial Debug: No SD Card mounted to render Current File List... J02"); |
|
|
SENDLINE_DBG_PGM("J02", "TFT Serial Debug: No SD Card mounted to render Current File List... J02"); |
|
|
|
|
|
|
|
|
SENDLINE_PGM("<Special_Menu>"); |
|
|
SENDLINE_PGM("<Special_Menu>"); |
|
@ -462,7 +464,7 @@ void AnycubicTFTClass::RenderSpecialMenu(uint16_t selectedNumber) { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void AnycubicTFTClass::RenderCurrentFolder(uint16_t selectedNumber) { |
|
|
void AnycubicTFTClass::RenderCurrentFolder(uint16_t selectedNumber) { |
|
|
ExtUI::FileList currentFileList; |
|
|
FileList currentFileList; |
|
|
uint16_t cnt = selectedNumber; |
|
|
uint16_t cnt = selectedNumber; |
|
|
uint16_t max_files; |
|
|
uint16_t max_files; |
|
|
uint16_t dir_files = currentFileList.count(); |
|
|
uint16_t dir_files = currentFileList.count(); |
|
@ -514,7 +516,7 @@ void AnycubicTFTClass::OnPrintTimerStarted() { |
|
|
|
|
|
|
|
|
void AnycubicTFTClass::OnPrintTimerPaused() { |
|
|
void AnycubicTFTClass::OnPrintTimerPaused() { |
|
|
#if ENABLED(SDSUPPORT) |
|
|
#if ENABLED(SDSUPPORT) |
|
|
if (ExtUI::isPrintingFromMedia()) { |
|
|
if (isPrintingFromMedia()) { |
|
|
mediaPrintingState = AMPRINTSTATE_PAUSED; |
|
|
mediaPrintingState = AMPRINTSTATE_PAUSED; |
|
|
mediaPauseState = AMPAUSESTATE_PARKING; |
|
|
mediaPauseState = AMPAUSESTATE_PARKING; |
|
|
} |
|
|
} |
|
@ -558,38 +560,38 @@ void AnycubicTFTClass::GetCommandFromTFT() { |
|
|
|
|
|
|
|
|
switch (a_command) { |
|
|
switch (a_command) { |
|
|
case 0: { // A0 GET HOTEND TEMP
|
|
|
case 0: { // A0 GET HOTEND TEMP
|
|
|
float hotendActualTemp = ExtUI::getActualTemp_celsius((ExtUI::extruder_t) (ExtUI::extruder_t) ExtUI::E0); |
|
|
float hotendActualTemp = getActualTemp_celsius((extruder_t) (extruder_t) E0); |
|
|
SEND_PGM_VAL("A0V ", int(hotendActualTemp + 0.5)); |
|
|
SEND_PGM_VAL("A0V ", int(hotendActualTemp + 0.5)); |
|
|
} |
|
|
} |
|
|
break; |
|
|
break; |
|
|
|
|
|
|
|
|
case 1: { // A1 GET HOTEND TARGET TEMP
|
|
|
case 1: { // A1 GET HOTEND TARGET TEMP
|
|
|
float hotendTargetTemp = ExtUI::getTargetTemp_celsius((ExtUI::extruder_t) (ExtUI::extruder_t) ExtUI::E0); |
|
|
float hotendTargetTemp = getTargetTemp_celsius((extruder_t) (extruder_t) E0); |
|
|
SEND_PGM_VAL("A1V ", int(hotendTargetTemp + 0.5)); |
|
|
SEND_PGM_VAL("A1V ", int(hotendTargetTemp + 0.5)); |
|
|
} |
|
|
} |
|
|
break; |
|
|
break; |
|
|
|
|
|
|
|
|
case 2: { // A2 GET HOTBED TEMP
|
|
|
case 2: { // A2 GET HOTBED TEMP
|
|
|
float heatedBedActualTemp = ExtUI::getActualTemp_celsius((ExtUI::heater_t) ExtUI::BED); |
|
|
float heatedBedActualTemp = getActualTemp_celsius((heater_t) BED); |
|
|
SEND_PGM_VAL("A2V ", int(heatedBedActualTemp + 0.5)); |
|
|
SEND_PGM_VAL("A2V ", int(heatedBedActualTemp + 0.5)); |
|
|
} |
|
|
} |
|
|
break; |
|
|
break; |
|
|
|
|
|
|
|
|
case 3: { // A3 GET HOTBED TARGET TEMP
|
|
|
case 3: { // A3 GET HOTBED TARGET TEMP
|
|
|
float heatedBedTargetTemp = ExtUI::getTargetTemp_celsius((ExtUI::heater_t) ExtUI::BED); |
|
|
float heatedBedTargetTemp = getTargetTemp_celsius((heater_t) BED); |
|
|
SEND_PGM_VAL("A3V ", int(heatedBedTargetTemp + 0.5)); |
|
|
SEND_PGM_VAL("A3V ", int(heatedBedTargetTemp + 0.5)); |
|
|
} break; |
|
|
} break; |
|
|
|
|
|
|
|
|
case 4: { // A4 GET FAN SPEED
|
|
|
case 4: { // A4 GET FAN SPEED
|
|
|
float fanPercent = ExtUI::getActualFan_percent(ExtUI::FAN0); |
|
|
float fanPercent = getActualFan_percent(FAN0); |
|
|
fanPercent = constrain(fanPercent, 0, 100); |
|
|
fanPercent = constrain(fanPercent, 0, 100); |
|
|
SEND_PGM_VAL("A4V ", int(fanPercent)); |
|
|
SEND_PGM_VAL("A4V ", int(fanPercent)); |
|
|
} break; |
|
|
} break; |
|
|
|
|
|
|
|
|
case 5: { // A5 GET CURRENT COORDINATE
|
|
|
case 5: { // A5 GET CURRENT COORDINATE
|
|
|
const float xPosition = ExtUI::getAxisPosition_mm(ExtUI::X), |
|
|
const float xPosition = getAxisPosition_mm(X), |
|
|
yPosition = ExtUI::getAxisPosition_mm(ExtUI::Y), |
|
|
yPosition = getAxisPosition_mm(Y), |
|
|
zPosition = ExtUI::getAxisPosition_mm(ExtUI::Z); |
|
|
zPosition = getAxisPosition_mm(Z); |
|
|
SEND_PGM("A5V X: "); LCD_SERIAL.print(xPosition); |
|
|
SEND_PGM("A5V X: "); LCD_SERIAL.print(xPosition); |
|
|
SEND_PGM( " Y: "); LCD_SERIAL.print(yPosition); |
|
|
SEND_PGM( " Y: "); LCD_SERIAL.print(yPosition); |
|
|
SEND_PGM( " Z: "); LCD_SERIAL.print(zPosition); |
|
|
SEND_PGM( " Z: "); LCD_SERIAL.print(zPosition); |
|
@ -598,10 +600,10 @@ void AnycubicTFTClass::GetCommandFromTFT() { |
|
|
|
|
|
|
|
|
case 6: // A6 GET SD CARD PRINTING STATUS
|
|
|
case 6: // A6 GET SD CARD PRINTING STATUS
|
|
|
#if ENABLED(SDSUPPORT) |
|
|
#if ENABLED(SDSUPPORT) |
|
|
if (ExtUI::isPrintingFromMedia()) { |
|
|
if (isPrintingFromMedia()) { |
|
|
SEND_PGM("A6V "); |
|
|
SEND_PGM("A6V "); |
|
|
if (ExtUI::isMediaInserted()) |
|
|
if (isMediaInserted()) |
|
|
SENDLINE(ui8tostr3rj(ExtUI::getProgress_percent())); |
|
|
SENDLINE(ui8tostr3rj(getProgress_percent())); |
|
|
else |
|
|
else |
|
|
SENDLINE_DBG_PGM("J02", "TFT Serial Debug: No SD Card mounted to return printing status... J02"); |
|
|
SENDLINE_DBG_PGM("J02", "TFT Serial Debug: No SD Card mounted to return printing status... J02"); |
|
|
} |
|
|
} |
|
@ -611,7 +613,7 @@ void AnycubicTFTClass::GetCommandFromTFT() { |
|
|
break; |
|
|
break; |
|
|
|
|
|
|
|
|
case 7: { // A7 GET PRINTING TIME
|
|
|
case 7: { // A7 GET PRINTING TIME
|
|
|
const uint32_t elapsedSeconds = ExtUI::getProgress_seconds_elapsed(); |
|
|
const uint32_t elapsedSeconds = getProgress_seconds_elapsed(); |
|
|
SEND_PGM("A7V "); |
|
|
SEND_PGM("A7V "); |
|
|
if (elapsedSeconds != 0) { // print time
|
|
|
if (elapsedSeconds != 0) { // print time
|
|
|
const uint32_t elapsedMinutes = elapsedSeconds / 60; |
|
|
const uint32_t elapsedMinutes = elapsedSeconds / 60; |
|
@ -634,14 +636,14 @@ void AnycubicTFTClass::GetCommandFromTFT() { |
|
|
|
|
|
|
|
|
case 9: // A9 pause sd print
|
|
|
case 9: // A9 pause sd print
|
|
|
#if ENABLED(SDSUPPORT) |
|
|
#if ENABLED(SDSUPPORT) |
|
|
if (ExtUI::isPrintingFromMedia()) |
|
|
if (isPrintingFromMedia()) |
|
|
PausePrint(); |
|
|
PausePrint(); |
|
|
#endif |
|
|
#endif |
|
|
break; |
|
|
break; |
|
|
|
|
|
|
|
|
case 10: // A10 resume sd print
|
|
|
case 10: // A10 resume sd print
|
|
|
#if ENABLED(SDSUPPORT) |
|
|
#if ENABLED(SDSUPPORT) |
|
|
if (ExtUI::isPrintingFromMediaPaused()) |
|
|
if (isPrintingFromMediaPaused()) |
|
|
ResumePrint(); |
|
|
ResumePrint(); |
|
|
#endif |
|
|
#endif |
|
|
break; |
|
|
break; |
|
@ -656,7 +658,7 @@ void AnycubicTFTClass::GetCommandFromTFT() { |
|
|
|
|
|
|
|
|
case 13: // A13 SELECTION FILE
|
|
|
case 13: // A13 SELECTION FILE
|
|
|
#if ENABLED(SDSUPPORT) |
|
|
#if ENABLED(SDSUPPORT) |
|
|
if (ExtUI::isMediaInserted()) { |
|
|
if (isMediaInserted()) { |
|
|
starpos = (strchr(TFTstrchr_pointer + 4, '*')); |
|
|
starpos = (strchr(TFTstrchr_pointer + 4, '*')); |
|
|
if (TFTstrchr_pointer[4] == '/') { |
|
|
if (TFTstrchr_pointer[4] == '/') { |
|
|
strcpy(SelectedDirectory, TFTstrchr_pointer + 5); |
|
|
strcpy(SelectedDirectory, TFTstrchr_pointer + 5); |
|
@ -685,7 +687,7 @@ void AnycubicTFTClass::GetCommandFromTFT() { |
|
|
|
|
|
|
|
|
case 14: // A14 START PRINTING
|
|
|
case 14: // A14 START PRINTING
|
|
|
#if ENABLED(SDSUPPORT) |
|
|
#if ENABLED(SDSUPPORT) |
|
|
if (!ExtUI::isPrinting() && strlen(SelectedFile) > 0) |
|
|
if (!isPrinting() && strlen(SelectedFile) > 0) |
|
|
StartPrint(); |
|
|
StartPrint(); |
|
|
#endif |
|
|
#endif |
|
|
break; |
|
|
break; |
|
@ -698,13 +700,13 @@ void AnycubicTFTClass::GetCommandFromTFT() { |
|
|
unsigned int tempvalue; |
|
|
unsigned int tempvalue; |
|
|
if (CodeSeen('S')) { |
|
|
if (CodeSeen('S')) { |
|
|
tempvalue = constrain(CodeValue(), 0, 275); |
|
|
tempvalue = constrain(CodeValue(), 0, 275); |
|
|
ExtUI::setTargetTemp_celsius(tempvalue, (ExtUI::extruder_t) ExtUI::E0); |
|
|
setTargetTemp_celsius(tempvalue, (extruder_t) E0); |
|
|
} |
|
|
} |
|
|
else if (CodeSeen('C') && !ExtUI::isPrinting()) { |
|
|
else if (CodeSeen('C') && !isPrinting()) { |
|
|
if (ExtUI::getAxisPosition_mm(ExtUI::Z) < 10) |
|
|
if (getAxisPosition_mm(Z) < 10) |
|
|
ExtUI::injectCommands_P(PSTR("G1 Z10")); // RASE Z AXIS
|
|
|
injectCommands_P(PSTR("G1 Z10")); // RASE Z AXIS
|
|
|
tempvalue = constrain(CodeValue(), 0, 275); |
|
|
tempvalue = constrain(CodeValue(), 0, 275); |
|
|
ExtUI::setTargetTemp_celsius(tempvalue, (ExtUI::extruder_t) ExtUI::E0); |
|
|
setTargetTemp_celsius(tempvalue, (extruder_t) E0); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
break; |
|
|
break; |
|
@ -713,7 +715,7 @@ void AnycubicTFTClass::GetCommandFromTFT() { |
|
|
unsigned int tempbed; |
|
|
unsigned int tempbed; |
|
|
if (CodeSeen('S')) { |
|
|
if (CodeSeen('S')) { |
|
|
tempbed = constrain(CodeValue(), 0, 100); |
|
|
tempbed = constrain(CodeValue(), 0, 100); |
|
|
ExtUI::setTargetTemp_celsius(tempbed, (ExtUI::heater_t)ExtUI::BED); |
|
|
setTargetTemp_celsius(tempbed, (heater_t)BED); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
break; |
|
|
break; |
|
@ -723,18 +725,18 @@ void AnycubicTFTClass::GetCommandFromTFT() { |
|
|
if (CodeSeen('S')) { |
|
|
if (CodeSeen('S')) { |
|
|
fanPercent = CodeValue(); |
|
|
fanPercent = CodeValue(); |
|
|
fanPercent = constrain(fanPercent, 0, 100); |
|
|
fanPercent = constrain(fanPercent, 0, 100); |
|
|
ExtUI::setTargetFan_percent(fanPercent, ExtUI::FAN0); |
|
|
setTargetFan_percent(fanPercent, FAN0); |
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
|
fanPercent = 100; |
|
|
fanPercent = 100; |
|
|
|
|
|
|
|
|
ExtUI::setTargetFan_percent(fanPercent, ExtUI::FAN0); |
|
|
setTargetFan_percent(fanPercent, FAN0); |
|
|
SENDLINE_PGM(""); |
|
|
SENDLINE_PGM(""); |
|
|
} |
|
|
} |
|
|
break; |
|
|
break; |
|
|
|
|
|
|
|
|
case 19: // A19 stop stepper drivers - sent on stop extrude command and on turn motors off command
|
|
|
case 19: // A19 stop stepper drivers - sent on stop extrude command and on turn motors off command
|
|
|
if (!ExtUI::isPrinting()) { |
|
|
if (!isPrinting()) { |
|
|
quickstop_stepper(); |
|
|
quickstop_stepper(); |
|
|
disable_all_steppers(); |
|
|
disable_all_steppers(); |
|
|
} |
|
|
} |
|
@ -750,23 +752,23 @@ void AnycubicTFTClass::GetCommandFromTFT() { |
|
|
break; |
|
|
break; |
|
|
|
|
|
|
|
|
case 21: // A21 all home
|
|
|
case 21: // A21 all home
|
|
|
if (!ExtUI::isPrinting() && !ExtUI::isPrintingFromMediaPaused()) { |
|
|
if (!isPrinting() && !isPrintingFromMediaPaused()) { |
|
|
if (CodeSeen('X') || CodeSeen('Y') || CodeSeen('Z')) { |
|
|
if (CodeSeen('X') || CodeSeen('Y') || CodeSeen('Z')) { |
|
|
if (CodeSeen('X')) |
|
|
if (CodeSeen('X')) |
|
|
ExtUI::injectCommands_P(PSTR("G28X")); |
|
|
injectCommands_P(PSTR("G28X")); |
|
|
if (CodeSeen('Y')) |
|
|
if (CodeSeen('Y')) |
|
|
ExtUI::injectCommands_P(PSTR("G28Y")); |
|
|
injectCommands_P(PSTR("G28Y")); |
|
|
if (CodeSeen('Z')) |
|
|
if (CodeSeen('Z')) |
|
|
ExtUI::injectCommands_P(PSTR("G28Z")); |
|
|
injectCommands_P(PSTR("G28Z")); |
|
|
} |
|
|
} |
|
|
else if (CodeSeen('C')) { |
|
|
else if (CodeSeen('C')) { |
|
|
ExtUI::injectCommands_P(G28_STR); |
|
|
injectCommands_P(G28_STR); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
break; |
|
|
break; |
|
|
|
|
|
|
|
|
case 22: // A22 move X/Y/Z or extrude
|
|
|
case 22: // A22 move X/Y/Z or extrude
|
|
|
if (!ExtUI::isPrinting()) { |
|
|
if (!isPrinting()) { |
|
|
float coorvalue; |
|
|
float coorvalue; |
|
|
unsigned int movespeed = 0; |
|
|
unsigned int movespeed = 0; |
|
|
char commandStr[30]; |
|
|
char commandStr[30]; |
|
@ -819,38 +821,38 @@ void AnycubicTFTClass::GetCommandFromTFT() { |
|
|
SERIAL_ECHOPGM("TFT Serial Debug: A22 Move final request with gcode... "); |
|
|
SERIAL_ECHOPGM("TFT Serial Debug: A22 Move final request with gcode... "); |
|
|
SERIAL_ECHOLN(fullCommandStr); |
|
|
SERIAL_ECHOLN(fullCommandStr); |
|
|
#endif |
|
|
#endif |
|
|
ExtUI::injectCommands(fullCommandStr); |
|
|
injectCommands(fullCommandStr); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
SENDLINE_PGM(""); |
|
|
SENDLINE_PGM(""); |
|
|
break; |
|
|
break; |
|
|
|
|
|
|
|
|
case 23: // A23 preheat pla
|
|
|
case 23: // A23 preheat pla
|
|
|
if (!ExtUI::isPrinting()) { |
|
|
if (!isPrinting()) { |
|
|
if (ExtUI::getAxisPosition_mm(ExtUI::Z) < 10) |
|
|
if (getAxisPosition_mm(Z) < 10) |
|
|
ExtUI::injectCommands_P(PSTR("G1 Z10")); // RASE Z AXIS
|
|
|
injectCommands_P(PSTR("G1 Z10")); // RASE Z AXIS
|
|
|
|
|
|
|
|
|
ExtUI::setTargetTemp_celsius(PREHEAT_1_TEMP_BED, (ExtUI::heater_t) ExtUI::BED); |
|
|
setTargetTemp_celsius(PREHEAT_1_TEMP_BED, (heater_t) BED); |
|
|
ExtUI::setTargetTemp_celsius(PREHEAT_1_TEMP_HOTEND, (ExtUI::extruder_t) ExtUI::E0); |
|
|
setTargetTemp_celsius(PREHEAT_1_TEMP_HOTEND, (extruder_t) E0); |
|
|
SENDLINE_PGM("OK"); |
|
|
SENDLINE_PGM("OK"); |
|
|
} |
|
|
} |
|
|
break; |
|
|
break; |
|
|
|
|
|
|
|
|
case 24:// A24 preheat abs
|
|
|
case 24:// A24 preheat abs
|
|
|
if (!ExtUI::isPrinting()) { |
|
|
if (!isPrinting()) { |
|
|
if (ExtUI::getAxisPosition_mm(ExtUI::Z) < 10) |
|
|
if (getAxisPosition_mm(Z) < 10) |
|
|
ExtUI::injectCommands_P(PSTR("G1 Z10")); // RASE Z AXIS
|
|
|
injectCommands_P(PSTR("G1 Z10")); // RASE Z AXIS
|
|
|
|
|
|
|
|
|
ExtUI::setTargetTemp_celsius(PREHEAT_2_TEMP_BED, (ExtUI::heater_t) ExtUI::BED); |
|
|
setTargetTemp_celsius(PREHEAT_2_TEMP_BED, (heater_t) BED); |
|
|
ExtUI::setTargetTemp_celsius(PREHEAT_2_TEMP_HOTEND, (ExtUI::extruder_t) ExtUI::E0); |
|
|
setTargetTemp_celsius(PREHEAT_2_TEMP_HOTEND, (extruder_t) E0); |
|
|
SENDLINE_PGM("OK"); |
|
|
SENDLINE_PGM("OK"); |
|
|
} |
|
|
} |
|
|
break; |
|
|
break; |
|
|
|
|
|
|
|
|
case 25: // A25 cool down
|
|
|
case 25: // A25 cool down
|
|
|
if (!ExtUI::isPrinting()) { |
|
|
if (!isPrinting()) { |
|
|
ExtUI::setTargetTemp_celsius(0, (ExtUI::heater_t) ExtUI::BED); |
|
|
setTargetTemp_celsius(0, (heater_t) BED); |
|
|
ExtUI::setTargetTemp_celsius(0, (ExtUI::extruder_t) ExtUI::E0); |
|
|
setTargetTemp_celsius(0, (extruder_t) E0); |
|
|
|
|
|
|
|
|
SENDLINE_DBG_PGM("J12", "TFT Serial Debug: Cooling down... J12"); // J12 cool down
|
|
|
SENDLINE_DBG_PGM("J12", "TFT Serial Debug: Cooling down... J12"); // J12 cool down
|
|
|
} |
|
|
} |
|
@ -858,9 +860,9 @@ void AnycubicTFTClass::GetCommandFromTFT() { |
|
|
|
|
|
|
|
|
case 26: // A26 refresh SD
|
|
|
case 26: // A26 refresh SD
|
|
|
#if ENABLED(SDSUPPORT) |
|
|
#if ENABLED(SDSUPPORT) |
|
|
if (ExtUI::isMediaInserted()) { |
|
|
if (isMediaInserted()) { |
|
|
if (strlen(SelectedDirectory) > 0) { |
|
|
if (strlen(SelectedDirectory) > 0) { |
|
|
ExtUI::FileList currentFileList; |
|
|
FileList currentFileList; |
|
|
if ((SelectedDirectory[0] == '.') && (SelectedDirectory[1] == '.')) { |
|
|
if ((SelectedDirectory[0] == '.') && (SelectedDirectory[1] == '.')) { |
|
|
currentFileList.upDir(); |
|
|
currentFileList.upDir(); |
|
|
} |
|
|
} |
|
@ -914,7 +916,7 @@ void AnycubicTFTClass::GetCommandFromTFT() { |
|
|
|
|
|
|
|
|
void AnycubicTFTClass::DoSDCardStateCheck() { |
|
|
void AnycubicTFTClass::DoSDCardStateCheck() { |
|
|
#if ENABLED(SDSUPPORT) && PIN_EXISTS(SD_DETECT) |
|
|
#if ENABLED(SDSUPPORT) && PIN_EXISTS(SD_DETECT) |
|
|
bool isInserted = ExtUI::isMediaInserted(); |
|
|
bool isInserted = isMediaInserted(); |
|
|
if (isInserted) |
|
|
if (isInserted) |
|
|
SENDLINE_DBG_PGM("J00", "TFT Serial Debug: SD card state changed... isInserted"); |
|
|
SENDLINE_DBG_PGM("J00", "TFT Serial Debug: SD card state changed... isInserted"); |
|
|
else |
|
|
else |
|
@ -925,12 +927,12 @@ void AnycubicTFTClass::DoSDCardStateCheck() { |
|
|
|
|
|
|
|
|
void AnycubicTFTClass::DoFilamentRunoutCheck() { |
|
|
void AnycubicTFTClass::DoFilamentRunoutCheck() { |
|
|
#if ENABLED(FILAMENT_RUNOUT_SENSOR) |
|
|
#if ENABLED(FILAMENT_RUNOUT_SENSOR) |
|
|
// NOTE: ExtUI::getFilamentRunoutState() only returns the runout state if the job is printing
|
|
|
// NOTE: getFilamentRunoutState() only returns the runout state if the job is printing
|
|
|
// we want to actually check the status of the pin here, regardless of printstate
|
|
|
// we want to actually check the status of the pin here, regardless of printstate
|
|
|
if (READ(FIL_RUNOUT1_PIN)) { |
|
|
if (READ(FIL_RUNOUT1_PIN)) { |
|
|
if (mediaPrintingState == AMPRINTSTATE_PRINTING || mediaPrintingState == AMPRINTSTATE_PAUSED || mediaPrintingState == AMPRINTSTATE_PAUSE_REQUESTED) { |
|
|
if (mediaPrintingState == AMPRINTSTATE_PRINTING || mediaPrintingState == AMPRINTSTATE_PAUSED || mediaPrintingState == AMPRINTSTATE_PAUSE_REQUESTED) { |
|
|
// play tone to indicate filament is out
|
|
|
// play tone to indicate filament is out
|
|
|
ExtUI::injectCommands_P(PSTR("\nM300 P200 S1567\nM300 P200 S1174\nM300 P200 S1567\nM300 P200 S1174\nM300 P2000 S1567")); |
|
|
injectCommands_P(PSTR("\nM300 P200 S1567\nM300 P200 S1174\nM300 P200 S1567\nM300 P200 S1174\nM300 P2000 S1567")); |
|
|
|
|
|
|
|
|
// tell the user that the filament has run out and wait
|
|
|
// tell the user that the filament has run out and wait
|
|
|
SENDLINE_DBG_PGM("J23", "TFT Serial Debug: Blocking filament prompt... J23"); |
|
|
SENDLINE_DBG_PGM("J23", "TFT Serial Debug: Blocking filament prompt... J23"); |
|
@ -944,30 +946,30 @@ void AnycubicTFTClass::DoFilamentRunoutCheck() { |
|
|
|
|
|
|
|
|
void AnycubicTFTClass::StartPrint() { |
|
|
void AnycubicTFTClass::StartPrint() { |
|
|
#if ENABLED(SDSUPPORT) |
|
|
#if ENABLED(SDSUPPORT) |
|
|
if (!ExtUI::isPrinting() && strlen(SelectedFile) > 0) { |
|
|
if (!isPrinting() && strlen(SelectedFile) > 0) { |
|
|
#if ENABLED(ANYCUBIC_LCD_DEBUG) |
|
|
#if ENABLED(ANYCUBIC_LCD_DEBUG) |
|
|
SERIAL_ECHOPGM("TFT Serial Debug: About to print file ... "); |
|
|
SERIAL_ECHOPGM("TFT Serial Debug: About to print file ... "); |
|
|
SERIAL_ECHO(ExtUI::isPrinting()); |
|
|
SERIAL_ECHO(isPrinting()); |
|
|
SERIAL_ECHOPGM(" "); |
|
|
SERIAL_ECHOPGM(" "); |
|
|
SERIAL_ECHOLN(SelectedFile); |
|
|
SERIAL_ECHOLN(SelectedFile); |
|
|
#endif |
|
|
#endif |
|
|
mediaPrintingState = AMPRINTSTATE_PRINTING; |
|
|
mediaPrintingState = AMPRINTSTATE_PRINTING; |
|
|
mediaPauseState = AMPAUSESTATE_NOT_PAUSED; |
|
|
mediaPauseState = AMPAUSESTATE_NOT_PAUSED; |
|
|
ExtUI::printFile(SelectedFile); |
|
|
printFile(SelectedFile); |
|
|
} |
|
|
} |
|
|
#endif // SDUPPORT
|
|
|
#endif // SDUPPORT
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void AnycubicTFTClass::PausePrint() { |
|
|
void AnycubicTFTClass::PausePrint() { |
|
|
#if ENABLED(SDSUPPORT) |
|
|
#if ENABLED(SDSUPPORT) |
|
|
if (ExtUI::isPrintingFromMedia() && mediaPrintingState != AMPRINTSTATE_STOP_REQUESTED && mediaPauseState == AMPAUSESTATE_NOT_PAUSED) { |
|
|
if (isPrintingFromMedia() && mediaPrintingState != AMPRINTSTATE_STOP_REQUESTED && mediaPauseState == AMPAUSESTATE_NOT_PAUSED) { |
|
|
mediaPrintingState = AMPRINTSTATE_PAUSE_REQUESTED; |
|
|
mediaPrintingState = AMPRINTSTATE_PAUSE_REQUESTED; |
|
|
mediaPauseState = AMPAUSESTATE_NOT_PAUSED; // need the userconfirm method to update pause state
|
|
|
mediaPauseState = AMPAUSESTATE_NOT_PAUSED; // need the userconfirm method to update pause state
|
|
|
SENDLINE_DBG_PGM("J05", "TFT Serial Debug: SD print pause started... J05"); // J05 printing pause
|
|
|
SENDLINE_DBG_PGM("J05", "TFT Serial Debug: SD print pause started... J05"); // J05 printing pause
|
|
|
|
|
|
|
|
|
// for some reason pausing the print doesn't retract the extruder so force a manual one here
|
|
|
// for some reason pausing the print doesn't retract the extruder so force a manual one here
|
|
|
ExtUI::injectCommands_P(PSTR("G91\nG1 E-2 F1800\nG90")); |
|
|
injectCommands_P(PSTR("G91\nG1 E-2 F1800\nG90")); |
|
|
ExtUI::pausePrint(); |
|
|
pausePrint(); |
|
|
} |
|
|
} |
|
|
#endif |
|
|
#endif |
|
|
} |
|
|
} |
|
@ -996,14 +998,14 @@ void AnycubicTFTClass::ResumePrint() { |
|
|
// SENDLINE_DBG_PGM("J05", "TFT Serial Debug: Resume called with heater timeout... J05"); // J05 printing pause
|
|
|
// SENDLINE_DBG_PGM("J05", "TFT Serial Debug: Resume called with heater timeout... J05"); // J05 printing pause
|
|
|
|
|
|
|
|
|
// reheat the nozzle
|
|
|
// reheat the nozzle
|
|
|
ExtUI::setUserConfirmed(); |
|
|
setUserConfirmed(); |
|
|
} |
|
|
} |
|
|
else { |
|
|
else { |
|
|
mediaPrintingState = AMPRINTSTATE_PRINTING; |
|
|
mediaPrintingState = AMPRINTSTATE_PRINTING; |
|
|
mediaPauseState = AMPAUSESTATE_NOT_PAUSED; |
|
|
mediaPauseState = AMPAUSESTATE_NOT_PAUSED; |
|
|
|
|
|
|
|
|
SENDLINE_DBG_PGM("J04", "TFT Serial Debug: SD print resumed... J04"); // J04 printing form sd card now
|
|
|
SENDLINE_DBG_PGM("J04", "TFT Serial Debug: SD print resumed... J04"); // J04 printing form sd card now
|
|
|
ExtUI::resumePrint(); |
|
|
resumePrint(); |
|
|
} |
|
|
} |
|
|
#endif |
|
|
#endif |
|
|
} |
|
|
} |
|
@ -1015,8 +1017,8 @@ void AnycubicTFTClass::StopPrint() { |
|
|
SENDLINE_DBG_PGM("J16", "TFT Serial Debug: SD print stop called... J16"); |
|
|
SENDLINE_DBG_PGM("J16", "TFT Serial Debug: SD print stop called... J16"); |
|
|
|
|
|
|
|
|
// for some reason stopping the print doesn't retract the extruder so force a manual one here
|
|
|
// for some reason stopping the print doesn't retract the extruder so force a manual one here
|
|
|
ExtUI::injectCommands_P(PSTR("G91\nG1 E-2 F1800\nG90")); |
|
|
injectCommands_P(PSTR("G91\nG1 E-2 F1800\nG90")); |
|
|
ExtUI::stopPrint(); |
|
|
stopPrint(); |
|
|
#endif |
|
|
#endif |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|