2020-07-17 06:07:09 +00:00
|
|
|
/**
|
2020-08-06 10:38:18 +00:00
|
|
|
* anycubic_i3mega_lcd.cpp --- Support for Anycubic i3 Mega TFT
|
2020-07-17 06:07:09 +00:00
|
|
|
* Created by Christian Hopp on 09.12.17.
|
|
|
|
* Improved by David Ramiro
|
2021-03-12 12:54:42 +00:00
|
|
|
* Converted to ExtUI by John BouAntoun 21 June 2020
|
2020-07-17 06:07:09 +00:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* 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
|
|
|
|
*/
|
|
|
|
|
2021-05-06 09:17:59 +00:00
|
|
|
#include "../../../inc/MarlinConfigPre.h"
|
2020-07-17 06:07:09 +00:00
|
|
|
|
2020-08-06 10:38:18 +00:00
|
|
|
#if ENABLED(ANYCUBIC_LCD_I3MEGA)
|
2020-07-17 06:07:09 +00:00
|
|
|
|
2020-08-06 10:38:18 +00:00
|
|
|
#include "anycubic_i3mega_lcd.h"
|
2021-05-06 09:17:59 +00:00
|
|
|
#include "../ui_api.h"
|
2020-09-28 23:53:40 +00:00
|
|
|
|
2021-05-06 09:17:59 +00:00
|
|
|
#include "../../../libs/numtostr.h"
|
|
|
|
#include "../../../module/motion.h" // for quickstop_stepper, A20 read printing speed, feedrate_percentage
|
|
|
|
#include "../../../MarlinCore.h" // for disable_steppers
|
|
|
|
#include "../../../inc/MarlinConfig.h"
|
2020-07-17 06:07:09 +00:00
|
|
|
|
2020-08-06 10:38:18 +00:00
|
|
|
// command sending macro's with debugging capability
|
2021-03-12 12:54:42 +00:00
|
|
|
#define SEND_PGM(x) send_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(x) send(x)
|
|
|
|
#define SENDLINE(x) sendLine(x)
|
2020-08-06 10:38:18 +00:00
|
|
|
#if ENABLED(ANYCUBIC_LCD_DEBUG)
|
2021-03-12 12:54:42 +00:00
|
|
|
#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))
|
2020-08-06 10:38:18 +00:00
|
|
|
#else
|
2021-03-12 12:54:42 +00:00
|
|
|
#define SENDLINE_DBG_PGM(x,y) sendLine_P(PSTR(x))
|
|
|
|
#define SENDLINE_DBG_PGM_VAL(x,y,z) sendLine_P(PSTR(x))
|
2020-08-06 10:38:18 +00:00
|
|
|
#endif
|
|
|
|
|
2020-07-17 06:07:09 +00:00
|
|
|
AnycubicTFTClass AnycubicTFT;
|
|
|
|
|
2021-03-12 12:54:42 +00:00
|
|
|
char AnycubicTFTClass::TFTcmdbuffer[TFTBUFSIZE][TFT_MAX_CMD_SIZE];
|
|
|
|
int AnycubicTFTClass::TFTbuflen = 0,
|
|
|
|
AnycubicTFTClass::TFTbufindr = 0,
|
|
|
|
AnycubicTFTClass::TFTbufindw = 0;
|
|
|
|
char AnycubicTFTClass::serial3_char;
|
|
|
|
int AnycubicTFTClass::serial3_count = 0;
|
|
|
|
char* AnycubicTFTClass::TFTstrchr_pointer;
|
|
|
|
uint8_t AnycubicTFTClass::SpecialMenu = false;
|
|
|
|
AnycubicMediaPrintState AnycubicTFTClass::mediaPrintingState = AMPRINTSTATE_NOT_PRINTING;
|
|
|
|
AnycubicMediaPauseState AnycubicTFTClass::mediaPauseState = AMPAUSESTATE_NOT_PAUSED;
|
|
|
|
|
|
|
|
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); }
|
2020-08-06 10:38:18 +00:00
|
|
|
static void send_P(PGM_P str) {
|
|
|
|
while (const char c = pgm_read_byte(str++))
|
2020-09-25 01:28:48 +00:00
|
|
|
LCD_SERIAL.write(c);
|
2020-08-06 10:38:18 +00:00
|
|
|
}
|
2021-03-12 12:54:42 +00:00
|
|
|
static void sendLine(const char *str) { send(str); sendNewLine(); }
|
|
|
|
static void sendLine_P(PGM_P str) { send_P(str); sendNewLine(); }
|
2020-08-06 10:38:18 +00:00
|
|
|
|
2021-03-12 12:54:42 +00:00
|
|
|
using namespace ExtUI;
|
2020-08-06 10:38:18 +00:00
|
|
|
|
2020-07-17 06:07:09 +00:00
|
|
|
AnycubicTFTClass::AnycubicTFTClass() {}
|
|
|
|
|
|
|
|
void AnycubicTFTClass::OnSetup() {
|
2020-09-24 02:36:31 +00:00
|
|
|
#ifndef LCD_BAUDRATE
|
|
|
|
#define LCD_BAUDRATE 115200
|
|
|
|
#endif
|
|
|
|
LCD_SERIAL.begin(LCD_BAUDRATE);
|
|
|
|
|
2020-08-06 10:38:18 +00:00
|
|
|
SENDLINE_DBG_PGM("J17", "TFT Serial Debug: Main board reset... J17"); // J17 Main board reset
|
2021-03-12 12:54:42 +00:00
|
|
|
delay_ms(10);
|
2020-07-17 06:07:09 +00:00
|
|
|
|
|
|
|
// initialise the state of the key pins running on the tft
|
|
|
|
#if ENABLED(SDSUPPORT) && PIN_EXISTS(SD_DETECT)
|
2020-09-24 02:36:39 +00:00
|
|
|
SET_INPUT_PULLUP(SD_DETECT_PIN);
|
2020-07-17 06:07:09 +00:00
|
|
|
#endif
|
|
|
|
#if ENABLED(FILAMENT_RUNOUT_SENSOR)
|
2020-11-11 06:39:23 +00:00
|
|
|
SET_INPUT_PULLUP(FIL_RUNOUT1_PIN);
|
2020-07-17 06:07:09 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
mediaPrintingState = AMPRINTSTATE_NOT_PRINTING;
|
|
|
|
mediaPauseState = AMPAUSESTATE_NOT_PAUSED;
|
|
|
|
|
|
|
|
// DoSDCardStateCheck();
|
2020-08-06 10:38:18 +00:00
|
|
|
SENDLINE_DBG_PGM("J12", "TFT Serial Debug: Ready... J12"); // J12 Ready
|
2021-03-12 12:54:42 +00:00
|
|
|
delay_ms(10);
|
2020-07-17 06:07:09 +00:00
|
|
|
|
|
|
|
DoFilamentRunoutCheck();
|
|
|
|
SelectedFile[0] = 0;
|
|
|
|
|
|
|
|
#if ENABLED(STARTUP_CHIME)
|
2021-03-12 12:54:42 +00:00
|
|
|
injectCommands_P(PSTR("M300 P250 S554\nM300 P250 S554\nM300 P250 S740\nM300 P250 S554\nM300 P250 S740\nM300 P250 S554\nM300 P500 S831"));
|
2020-07-17 06:07:09 +00:00
|
|
|
#endif
|
2020-08-06 10:38:18 +00:00
|
|
|
#if ENABLED(ANYCUBIC_LCD_DEBUG)
|
2020-07-17 06:07:09 +00:00
|
|
|
SERIAL_ECHOLNPGM("TFT Serial Debug: Finished startup");
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
void AnycubicTFTClass::OnCommandScan() {
|
|
|
|
static millis_t nextStopCheck = 0; // used to slow the stopped print check down to reasonable times
|
|
|
|
const millis_t ms = millis();
|
|
|
|
if (ELAPSED(ms, nextStopCheck)) {
|
|
|
|
nextStopCheck = ms + 1000UL;
|
|
|
|
if (mediaPrintingState == AMPRINTSTATE_STOP_REQUESTED && IsNozzleHomed()) {
|
2020-08-06 10:38:18 +00:00
|
|
|
#if ENABLED(ANYCUBIC_LCD_DEBUG)
|
2020-07-17 06:07:09 +00:00
|
|
|
SERIAL_ECHOLNPGM("TFT Serial Debug: Finished stopping print, releasing motors ...");
|
|
|
|
#endif
|
|
|
|
mediaPrintingState = AMPRINTSTATE_NOT_PRINTING;
|
|
|
|
mediaPauseState = AMPAUSESTATE_NOT_PAUSED;
|
2021-03-12 12:54:42 +00:00
|
|
|
injectCommands_P(PSTR("M84\nM27")); // disable stepper motors and force report of SD status
|
|
|
|
delay_ms(200);
|
2020-07-17 06:07:09 +00:00
|
|
|
// tell printer to release resources of print to indicate it is done
|
2020-08-06 10:38:18 +00:00
|
|
|
SENDLINE_DBG_PGM("J14", "TFT Serial Debug: SD Print Stopped... J14");
|
2020-07-17 06:07:09 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (TFTbuflen < (TFTBUFSIZE - 1))
|
|
|
|
GetCommandFromTFT();
|
|
|
|
|
|
|
|
if (TFTbuflen) {
|
|
|
|
TFTbuflen = (TFTbuflen - 1);
|
|
|
|
TFTbufindr = (TFTbufindr + 1) % TFTBUFSIZE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void AnycubicTFTClass::OnKillTFT() {
|
2020-08-06 10:38:18 +00:00
|
|
|
SENDLINE_DBG_PGM("J11", "TFT Serial Debug: Kill command... J11");
|
2020-07-17 06:07:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void AnycubicTFTClass::OnSDCardStateChange(bool isInserted) {
|
2020-08-06 10:38:18 +00:00
|
|
|
#if ENABLED(ANYCUBIC_LCD_DEBUG)
|
2021-02-08 06:37:24 +00:00
|
|
|
SERIAL_ECHOLNPAIR("TFT Serial Debug: OnSDCardStateChange event triggered...", isInserted);
|
2020-07-17 06:07:09 +00:00
|
|
|
#endif
|
|
|
|
DoSDCardStateCheck();
|
|
|
|
}
|
|
|
|
|
|
|
|
void AnycubicTFTClass::OnSDCardError() {
|
2020-08-06 10:38:18 +00:00
|
|
|
#if ENABLED(ANYCUBIC_LCD_DEBUG)
|
2020-07-17 06:07:09 +00:00
|
|
|
SERIAL_ECHOLNPGM("TFT Serial Debug: OnSDCardError event triggered...");
|
|
|
|
#endif
|
2020-08-06 10:38:18 +00:00
|
|
|
SENDLINE_DBG_PGM("J21", "TFT Serial Debug: On SD Card Error ... J21");
|
2020-07-17 06:07:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void AnycubicTFTClass::OnFilamentRunout() {
|
2020-08-06 10:38:18 +00:00
|
|
|
#if ENABLED(ANYCUBIC_LCD_DEBUG)
|
2020-07-17 06:07:09 +00:00
|
|
|
SERIAL_ECHOLNPGM("TFT Serial Debug: FilamentRunout triggered...");
|
|
|
|
#endif
|
|
|
|
DoFilamentRunoutCheck();
|
|
|
|
}
|
|
|
|
|
|
|
|
void AnycubicTFTClass::OnUserConfirmRequired(const char * const msg) {
|
2020-08-06 10:38:18 +00:00
|
|
|
#if ENABLED(ANYCUBIC_LCD_DEBUG)
|
2021-02-05 01:18:31 +00:00
|
|
|
SERIAL_ECHOLNPAIR("TFT Serial Debug: OnUserConfirmRequired triggered... ", msg);
|
2020-07-17 06:07:09 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if ENABLED(SDSUPPORT)
|
|
|
|
/**
|
|
|
|
* Need to handle the process of following states
|
|
|
|
* "Nozzle Parked"
|
|
|
|
* "Load Filament"
|
|
|
|
* "Filament Purging..."
|
|
|
|
* "HeaterTimeout"
|
|
|
|
* "Reheat finished."
|
|
|
|
*
|
|
|
|
* NOTE: The only way to handle these states is strcmp_P with the msg unfortunately (very expensive)
|
|
|
|
*/
|
|
|
|
if (strcmp_P(msg, PSTR("Nozzle Parked")) == 0) {
|
|
|
|
mediaPrintingState = AMPRINTSTATE_PAUSED;
|
|
|
|
mediaPauseState = AMPAUSESTATE_PARKED;
|
|
|
|
// enable continue button
|
2020-08-06 10:38:18 +00:00
|
|
|
SENDLINE_DBG_PGM("J18", "TFT Serial Debug: UserConfirm SD print paused done... J18");
|
2020-07-17 06:07:09 +00:00
|
|
|
}
|
|
|
|
else if (strcmp_P(msg, PSTR("Load Filament")) == 0) {
|
|
|
|
mediaPrintingState = AMPRINTSTATE_PAUSED;
|
|
|
|
mediaPauseState = AMPAUSESTATE_FILAMENT_OUT;
|
|
|
|
// enable continue button
|
2020-08-06 10:38:18 +00:00
|
|
|
SENDLINE_DBG_PGM("J18", "TFT Serial Debug: UserConfirm Filament is out... J18");
|
|
|
|
SENDLINE_DBG_PGM("J23", "TFT Serial Debug: UserConfirm Blocking filament prompt... J23");
|
2020-07-17 06:07:09 +00:00
|
|
|
}
|
|
|
|
else if (strcmp_P(msg, PSTR("Filament Purging...")) == 0) {
|
|
|
|
mediaPrintingState = AMPRINTSTATE_PAUSED;
|
|
|
|
mediaPauseState = AMPAUSESTATE_PARKING;
|
|
|
|
// TODO: JBA I don't think J05 just disables the continue button, i think it injects a rogue M25. So taking this out
|
|
|
|
// disable continue button
|
2020-08-06 10:38:18 +00:00
|
|
|
// SENDLINE_DBG_PGM("J05", "TFT Serial Debug: UserConfirm SD Filament Purging... J05"); // J05 printing pause
|
2020-07-17 06:07:09 +00:00
|
|
|
|
|
|
|
// enable continue button
|
2020-08-06 10:38:18 +00:00
|
|
|
SENDLINE_DBG_PGM("J18", "TFT Serial Debug: UserConfirm Filament is purging... J18");
|
2020-07-17 06:07:09 +00:00
|
|
|
}
|
|
|
|
else if (strcmp_P(msg, PSTR("HeaterTimeout")) == 0) {
|
|
|
|
mediaPrintingState = AMPRINTSTATE_PAUSED;
|
|
|
|
mediaPauseState = AMPAUSESTATE_HEATER_TIMEOUT;
|
|
|
|
// enable continue button
|
2020-08-06 10:38:18 +00:00
|
|
|
SENDLINE_DBG_PGM("J18", "TFT Serial Debug: UserConfirm SD Heater timeout... J18");
|
2020-07-17 06:07:09 +00:00
|
|
|
}
|
|
|
|
else if (strcmp_P(msg, PSTR("Reheat finished.")) == 0) {
|
|
|
|
mediaPrintingState = AMPRINTSTATE_PAUSED;
|
|
|
|
mediaPauseState = AMPAUSESTATE_REHEAT_FINISHED;
|
|
|
|
// enable continue button
|
2020-08-06 10:38:18 +00:00
|
|
|
SENDLINE_DBG_PGM("J18", "TFT Serial Debug: UserConfirm SD Reheat done... J18");
|
2020-07-17 06:07:09 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
float AnycubicTFTClass::CodeValue() {
|
2020-10-24 22:13:10 +00:00
|
|
|
return (strtod(&TFTcmdbuffer[TFTbufindr][TFTstrchr_pointer - TFTcmdbuffer[TFTbufindr] + 1], nullptr));
|
2020-07-17 06:07:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool AnycubicTFTClass::CodeSeen(char code) {
|
|
|
|
TFTstrchr_pointer = strchr(TFTcmdbuffer[TFTbufindr], code);
|
2020-10-24 22:13:10 +00:00
|
|
|
return !!TFTstrchr_pointer; // Return True if a character was found
|
2020-07-17 06:07:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool AnycubicTFTClass::IsNozzleHomed() {
|
2021-03-12 12:54:42 +00:00
|
|
|
const float xPosition = getAxisPosition_mm((axis_t) X);
|
|
|
|
const float yPosition = getAxisPosition_mm((axis_t) Y);
|
2020-07-17 06:07:09 +00:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
|
|
|
void AnycubicTFTClass::HandleSpecialMenu() {
|
|
|
|
/**
|
|
|
|
* NOTE: that the file selection command actual lowercases the entire selected file/foldername, so charracter comparisons need to be lowercase.
|
|
|
|
*/
|
|
|
|
if (SelectedDirectory[0] == '<') {
|
|
|
|
switch (SelectedDirectory[1]) {
|
|
|
|
case 'e': // "<exit>"
|
|
|
|
SpecialMenu = false;
|
|
|
|
return;
|
|
|
|
break;
|
|
|
|
|
|
|
|
#if ENABLED(PROBE_MANUALLY)
|
|
|
|
case '0':
|
|
|
|
switch (SelectedDirectory[2]) {
|
|
|
|
case '1': // "<01ZUp0.1>"
|
|
|
|
SERIAL_ECHOLNPGM("Special Menu: Z Up 0.1");
|
2021-03-12 12:54:42 +00:00
|
|
|
injectCommands_P(PSTR("G91\nG1 Z+0.1\nG90"));
|
2020-07-17 06:07:09 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case '2': // "<02ZUp0.02>"
|
|
|
|
SERIAL_ECHOLNPGM("Special Menu: Z Up 0.02");
|
2021-03-12 12:54:42 +00:00
|
|
|
injectCommands_P(PSTR("G91\nG1 Z+0.02\nG90"));
|
2020-07-17 06:07:09 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case '3': // "<03ZDn0.02>"
|
|
|
|
SERIAL_ECHOLNPGM("Special Menu: Z Down 0.02");
|
2021-03-12 12:54:42 +00:00
|
|
|
injectCommands_P(PSTR("G91\nG1 Z-0.02\nG90"));
|
2020-07-17 06:07:09 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case '4': // "<04ZDn0.1>"
|
|
|
|
SERIAL_ECHOLNPGM("Special Menu: Z Down 0.1");
|
2021-03-12 12:54:42 +00:00
|
|
|
injectCommands_P(PSTR("G91\nG1 Z-0.1\nG90"));
|
2020-07-17 06:07:09 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case '5': // "<05PrehtBed>"
|
|
|
|
SERIAL_ECHOLNPGM("Special Menu: Preheat Bed");
|
2021-03-12 12:54:42 +00:00
|
|
|
injectCommands_P(PSTR("M140 S65"));
|
2020-07-17 06:07:09 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case '6': // "<06SMeshLvl>"
|
|
|
|
SERIAL_ECHOLNPGM("Special Menu: Start Mesh Leveling");
|
2021-03-12 12:54:42 +00:00
|
|
|
injectCommands_P(PSTR("G29S1"));
|
2020-07-17 06:07:09 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case '7': // "<07MeshNPnt>"
|
|
|
|
SERIAL_ECHOLNPGM("Special Menu: Next Mesh Point");
|
2021-03-12 12:54:42 +00:00
|
|
|
injectCommands_P(PSTR("G29S2"));
|
2020-07-17 06:07:09 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case '8': // "<08HtEndPID>"
|
|
|
|
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
|
2021-03-12 12:54:42 +00:00
|
|
|
injectCommands_P(PSTR("M106 S204\nG4 P500\nM303 E0 S215 C15 U1"));
|
2020-07-17 06:07:09 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case '9': // "<09HtBedPID>"
|
|
|
|
SERIAL_ECHOLNPGM("Special Menu: Auto Tune Hotbed Pid");
|
2021-03-12 12:54:42 +00:00
|
|
|
injectCommands_P(PSTR("M303 E-1 S65 C6 U1"));
|
2020-07-17 06:07:09 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case '1':
|
|
|
|
switch (SelectedDirectory[2]) {
|
|
|
|
case '0': // "<10FWDeflts>"
|
|
|
|
SERIAL_ECHOLNPGM("Special Menu: Load FW Defaults");
|
2021-03-12 12:54:42 +00:00
|
|
|
injectCommands_P(PSTR("M502\nM300 P105 S1661\nM300 P210 S1108"));
|
2020-07-17 06:07:09 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case '1': // "<11SvEEPROM>"
|
|
|
|
SERIAL_ECHOLNPGM("Special Menu: Save EEPROM");
|
2021-03-12 12:54:42 +00:00
|
|
|
injectCommands_P(PSTR("M500\nM300 P105 S1108\nM300 P210 S1661"));
|
2020-07-17 06:07:09 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
#else // if ENABLED(PROBE_MANUALLY)
|
|
|
|
case '0':
|
|
|
|
switch (SelectedDirectory[2]) {
|
|
|
|
case '1': // "<01PrehtBed>"
|
|
|
|
SERIAL_ECHOLNPGM("Special Menu: Preheat Bed");
|
2021-03-12 12:54:42 +00:00
|
|
|
injectCommands_P(PSTR("M140 S65"));
|
2020-07-17 06:07:09 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case '2': // "<02ABL>"
|
|
|
|
SERIAL_ECHOLNPGM("Special Menu: Auto Bed Leveling");
|
2021-03-12 12:54:42 +00:00
|
|
|
injectCommands_P(PSTR("G29N"));
|
2020-07-17 06:07:09 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case '3': // "<03HtendPID>"
|
|
|
|
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
|
2021-03-12 12:54:42 +00:00
|
|
|
injectCommands_P(PSTR("M106 S204\nG4 P500\nM303 E0 S215 C15 U1"));
|
2020-07-17 06:07:09 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case '4': // "<04HtbedPID>"
|
|
|
|
SERIAL_ECHOLNPGM("Special Menu: Auto Tune Hotbed Pid");
|
2021-03-12 12:54:42 +00:00
|
|
|
injectCommands_P(PSTR("M303 E-1 S65 C6 U1"));
|
2020-07-17 06:07:09 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case '5': // "<05FWDeflts>"
|
|
|
|
SERIAL_ECHOLNPGM("Special Menu: Load FW Defaults");
|
2021-03-12 12:54:42 +00:00
|
|
|
injectCommands_P(PSTR("M502\nM300 P105 S1661\nM300 P210 S1108"));
|
2020-07-17 06:07:09 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case '6': // "<06SvEEPROM>"
|
|
|
|
SERIAL_ECHOLNPGM("Special Menu: Save EEPROM");
|
2021-03-12 12:54:42 +00:00
|
|
|
injectCommands_P(PSTR("M500\nM300 P105 S1108\nM300 P210 S1661"));
|
2020-07-17 06:07:09 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case '7': // <07SendM108>
|
|
|
|
SERIAL_ECHOLNPGM("Special Menu: Send User Confirmation");
|
2021-03-12 12:54:42 +00:00
|
|
|
injectCommands_P(PSTR("M108"));
|
2020-07-17 06:07:09 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
#endif // PROBE_MANUALLY
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2020-08-06 10:38:18 +00:00
|
|
|
#if ENABLED(ANYCUBIC_LCD_DEBUG)
|
2020-07-17 06:07:09 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
SERIAL_ECHOPGM("TFT Serial Debug: Attempted to HandleSpecialMenu on non-special menu... ");
|
|
|
|
SERIAL_ECHOLN(SelectedDirectory);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void AnycubicTFTClass::RenderCurrentFileList() {
|
|
|
|
#if ENABLED(SDSUPPORT)
|
|
|
|
uint16_t selectedNumber = 0;
|
|
|
|
SelectedDirectory[0] = 0;
|
|
|
|
SelectedFile[0] = 0;
|
2021-03-12 12:54:42 +00:00
|
|
|
FileList currentFileList;
|
2020-07-17 06:07:09 +00:00
|
|
|
|
2020-08-06 10:38:18 +00:00
|
|
|
SENDLINE_PGM("FN "); // Filelist start
|
2020-07-17 06:07:09 +00:00
|
|
|
|
2021-03-12 12:54:42 +00:00
|
|
|
if (!isMediaInserted() && !SpecialMenu) {
|
2020-08-06 10:38:18 +00:00
|
|
|
SENDLINE_DBG_PGM("J02", "TFT Serial Debug: No SD Card mounted to render Current File List... J02");
|
2020-07-17 06:07:09 +00:00
|
|
|
|
2020-08-06 10:38:18 +00:00
|
|
|
SENDLINE_PGM("<Special_Menu>");
|
|
|
|
SENDLINE_PGM("<Special_Menu>");
|
2020-07-17 06:07:09 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
if (CodeSeen('S'))
|
|
|
|
selectedNumber = CodeValue();
|
|
|
|
|
|
|
|
if (SpecialMenu)
|
|
|
|
RenderSpecialMenu(selectedNumber);
|
2020-09-01 03:27:42 +00:00
|
|
|
else if (selectedNumber <= currentFileList.count())
|
2020-07-17 06:07:09 +00:00
|
|
|
RenderCurrentFolder(selectedNumber);
|
|
|
|
}
|
2020-08-06 10:38:18 +00:00
|
|
|
SENDLINE_PGM("END"); // Filelist stop
|
2020-07-17 06:07:09 +00:00
|
|
|
#endif // SDSUPPORT
|
|
|
|
}
|
|
|
|
|
|
|
|
void AnycubicTFTClass::RenderSpecialMenu(uint16_t selectedNumber) {
|
|
|
|
switch (selectedNumber) {
|
|
|
|
#if ENABLED(PROBE_MANUALLY)
|
|
|
|
case 0: // First Page
|
2020-08-06 10:38:18 +00:00
|
|
|
SENDLINE_PGM("<01ZUp0.1>");
|
|
|
|
SENDLINE_PGM("<Z Up 0.1>");
|
|
|
|
SENDLINE_PGM("<02ZUp0.02>");
|
|
|
|
SENDLINE_PGM("<Z Up 0.02>");
|
|
|
|
SENDLINE_PGM("<03ZDn0.02>");
|
|
|
|
SENDLINE_PGM("<Z Down 0.02>");
|
|
|
|
SENDLINE_PGM("<04ZDn0.1>");
|
|
|
|
SENDLINE_PGM("<Z Down 0.1>");
|
2020-07-17 06:07:09 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 4: // Second Page
|
2020-08-06 10:38:18 +00:00
|
|
|
SENDLINE_PGM("<05PrehtBed>");
|
|
|
|
SENDLINE_PGM("<Preheat bed>");
|
|
|
|
SENDLINE_PGM("<06SMeshLvl>");
|
|
|
|
SENDLINE_PGM("<Start Mesh Leveling>");
|
|
|
|
SENDLINE_PGM("<07MeshNPnt>");
|
|
|
|
SENDLINE_PGM("<Next Mesh Point>");
|
|
|
|
SENDLINE_PGM("<08HtEndPID>");
|
|
|
|
SENDLINE_PGM("<Auto Tune Hotend PID>");
|
2020-07-17 06:07:09 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 8: // Third Page
|
2020-08-06 10:38:18 +00:00
|
|
|
SENDLINE_PGM("<09HtBedPID>");
|
|
|
|
SENDLINE_PGM("<Auto Tune Hotbed PID>");
|
|
|
|
SENDLINE_PGM("<10FWDeflts>");
|
|
|
|
SENDLINE_PGM("<Load FW Defaults>");
|
|
|
|
SENDLINE_PGM("<11SvEEPROM>");
|
|
|
|
SENDLINE_PGM("<Save EEPROM>");
|
|
|
|
SENDLINE_PGM("<Exit>");
|
|
|
|
SENDLINE_PGM("<Exit>");
|
2020-07-17 06:07:09 +00:00
|
|
|
break;
|
|
|
|
#else
|
|
|
|
case 0: // First Page
|
2020-08-06 10:38:18 +00:00
|
|
|
SENDLINE_PGM("<01PrehtBed>");
|
|
|
|
SENDLINE_PGM("<Preheat bed>");
|
|
|
|
SENDLINE_PGM("<02ABL>");
|
|
|
|
SENDLINE_PGM("<Auto Bed Leveling>");
|
|
|
|
SENDLINE_PGM("<03HtEndPID>");
|
|
|
|
SENDLINE_PGM("<Auto Tune Hotend PID>");
|
|
|
|
SENDLINE_PGM("<04HtBedPID>");
|
|
|
|
SENDLINE_PGM("<Auto Tune Hotbed PID>");
|
2020-07-17 06:07:09 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 4: // Second Page
|
2020-08-06 10:38:18 +00:00
|
|
|
SENDLINE_PGM("<05FWDeflts>");
|
|
|
|
SENDLINE_PGM("<Load FW Defaults>");
|
|
|
|
SENDLINE_PGM("<06SvEEPROM>");
|
|
|
|
SENDLINE_PGM("<Save EEPROM>");
|
|
|
|
SENDLINE_PGM("<07SendM108>");
|
|
|
|
SENDLINE_PGM("<Send User Confirmation>");
|
|
|
|
SENDLINE_PGM("<Exit>");
|
|
|
|
SENDLINE_PGM("<Exit>");
|
2020-07-17 06:07:09 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
#endif // PROBE_MANUALLY
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void AnycubicTFTClass::RenderCurrentFolder(uint16_t selectedNumber) {
|
2021-03-12 12:54:42 +00:00
|
|
|
FileList currentFileList;
|
2020-07-17 06:07:09 +00:00
|
|
|
uint16_t cnt = selectedNumber;
|
|
|
|
uint16_t max_files;
|
|
|
|
uint16_t dir_files = currentFileList.count();
|
|
|
|
|
|
|
|
if ((dir_files - selectedNumber) < 4)
|
|
|
|
max_files = dir_files;
|
|
|
|
else
|
|
|
|
max_files = selectedNumber + 3;
|
|
|
|
|
|
|
|
for (cnt = selectedNumber; cnt <= max_files; cnt++) {
|
|
|
|
if (cnt == 0) { // Special Entry
|
|
|
|
if (currentFileList.isAtRootDir()) {
|
2020-08-06 10:38:18 +00:00
|
|
|
SENDLINE_PGM("<specialmnu>");
|
|
|
|
SENDLINE_PGM("<Special Menu>");
|
2020-07-17 06:07:09 +00:00
|
|
|
}
|
|
|
|
else {
|
2020-08-06 10:38:18 +00:00
|
|
|
SENDLINE_PGM("/..");
|
|
|
|
SENDLINE_PGM("/..");
|
2020-07-17 06:07:09 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
currentFileList.seek(cnt - 1, false);
|
|
|
|
|
2020-08-06 10:38:18 +00:00
|
|
|
#if ENABLED(ANYCUBIC_LCD_DEBUG)
|
2020-07-17 06:07:09 +00:00
|
|
|
SERIAL_ECHOLN(currentFileList.filename());
|
|
|
|
#endif
|
|
|
|
if (currentFileList.isDir()) {
|
2020-08-06 10:38:18 +00:00
|
|
|
SEND_PGM("/");
|
|
|
|
SENDLINE(currentFileList.shortFilename());
|
|
|
|
SEND_PGM("/");
|
2020-10-01 23:09:39 +00:00
|
|
|
SENDLINE(currentFileList.filename());
|
2020-07-17 06:07:09 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
else {
|
2020-08-06 10:38:18 +00:00
|
|
|
SENDLINE(currentFileList.shortFilename());
|
2020-10-01 23:09:39 +00:00
|
|
|
SENDLINE(currentFileList.filename());
|
2020-07-17 06:07:09 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void AnycubicTFTClass::OnPrintTimerStarted() {
|
|
|
|
#if ENABLED(SDSUPPORT)
|
|
|
|
if (mediaPrintingState == AMPRINTSTATE_PRINTING)
|
2020-08-06 10:38:18 +00:00
|
|
|
SENDLINE_DBG_PGM("J04", "TFT Serial Debug: Starting SD Print... J04"); // J04 Starting Print
|
2020-07-17 06:07:09 +00:00
|
|
|
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
void AnycubicTFTClass::OnPrintTimerPaused() {
|
|
|
|
#if ENABLED(SDSUPPORT)
|
2021-03-12 12:54:42 +00:00
|
|
|
if (isPrintingFromMedia()) {
|
2020-07-17 06:07:09 +00:00
|
|
|
mediaPrintingState = AMPRINTSTATE_PAUSED;
|
|
|
|
mediaPauseState = AMPAUSESTATE_PARKING;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
void AnycubicTFTClass::OnPrintTimerStopped() {
|
|
|
|
#if ENABLED(SDSUPPORT)
|
|
|
|
if (mediaPrintingState == AMPRINTSTATE_PRINTING) {
|
|
|
|
mediaPrintingState = AMPRINTSTATE_NOT_PRINTING;
|
|
|
|
mediaPauseState = AMPAUSESTATE_NOT_PAUSED;
|
2020-08-06 10:38:18 +00:00
|
|
|
SENDLINE_DBG_PGM("J14", "TFT Serial Debug: SD Print Completed... J14");
|
2020-07-17 06:07:09 +00:00
|
|
|
}
|
|
|
|
// otherwise it was stopped by the printer so don't send print completed signal to TFT
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2021-04-24 00:14:49 +00:00
|
|
|
#define ROUND(val) int((val)+0.5f)
|
|
|
|
|
2020-07-17 06:07:09 +00:00
|
|
|
void AnycubicTFTClass::GetCommandFromTFT() {
|
2020-10-24 22:13:10 +00:00
|
|
|
char *starpos = nullptr;
|
2020-09-25 01:28:48 +00:00
|
|
|
while (LCD_SERIAL.available() > 0 && TFTbuflen < TFTBUFSIZE) {
|
|
|
|
serial3_char = LCD_SERIAL.read();
|
2020-07-17 06:07:09 +00:00
|
|
|
if (serial3_char == '\n' ||
|
|
|
|
serial3_char == '\r' ||
|
|
|
|
serial3_char == ':' ||
|
|
|
|
serial3_count >= (TFT_MAX_CMD_SIZE - 1)
|
|
|
|
) {
|
|
|
|
|
|
|
|
if (!serial3_count) return; // if empty line
|
|
|
|
|
|
|
|
TFTcmdbuffer[TFTbufindw][serial3_count] = 0; // terminate string
|
|
|
|
|
2020-10-24 22:13:10 +00:00
|
|
|
if ((strchr(TFTcmdbuffer[TFTbufindw], 'A') != nullptr)) {
|
2020-07-17 06:07:09 +00:00
|
|
|
int16_t a_command;
|
|
|
|
TFTstrchr_pointer = strchr(TFTcmdbuffer[TFTbufindw], 'A');
|
2020-10-24 22:13:10 +00:00
|
|
|
a_command = ((int)((strtod(&TFTcmdbuffer[TFTbufindw][TFTstrchr_pointer - TFTcmdbuffer[TFTbufindw] + 1], nullptr))));
|
2020-07-17 06:07:09 +00:00
|
|
|
|
2020-08-06 10:38:18 +00:00
|
|
|
#if ENABLED(ANYCUBIC_LCD_DEBUG)
|
2021-02-05 05:22:42 +00:00
|
|
|
if ((a_command > 7) && (a_command != 20)) // No debugging of status polls, please!
|
|
|
|
SERIAL_ECHOLNPAIR("TFT Serial Command: ", TFTcmdbuffer[TFTbufindw]);
|
2020-07-17 06:07:09 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
switch (a_command) {
|
|
|
|
case 0: { // A0 GET HOTEND TEMP
|
2021-04-24 00:14:49 +00:00
|
|
|
const celsius_float_t hotendActualTemp = getActualTemp_celsius(E0);
|
|
|
|
SEND_PGM_VAL("A0V ", ROUND(hotendActualTemp));
|
2020-07-17 06:07:09 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 1: { // A1 GET HOTEND TARGET TEMP
|
2021-04-24 00:14:49 +00:00
|
|
|
const celsius_float_t hotendTargetTemp = getTargetTemp_celsius(E0);
|
|
|
|
SEND_PGM_VAL("A1V ", ROUND(hotendTargetTemp));
|
2020-07-17 06:07:09 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 2: { // A2 GET HOTBED TEMP
|
2021-04-24 00:14:49 +00:00
|
|
|
const celsius_float_t heatedBedActualTemp = getActualTemp_celsius(BED);
|
|
|
|
SEND_PGM_VAL("A2V ", ROUND(heatedBedActualTemp));
|
2020-07-17 06:07:09 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 3: { // A3 GET HOTBED TARGET TEMP
|
2021-04-24 00:14:49 +00:00
|
|
|
const celsius_float_t heatedBedTargetTemp = getTargetTemp_celsius(BED);
|
|
|
|
SEND_PGM_VAL("A3V ", ROUND(heatedBedTargetTemp));
|
2020-09-28 23:53:40 +00:00
|
|
|
} break;
|
2020-07-17 06:07:09 +00:00
|
|
|
|
2020-09-28 23:53:40 +00:00
|
|
|
case 4: { // A4 GET FAN SPEED
|
2021-04-13 08:09:21 +00:00
|
|
|
SEND_PGM_VAL("A4V ", int(getActualFan_percent(FAN0)));
|
2020-09-28 23:53:40 +00:00
|
|
|
} break;
|
2020-07-17 06:07:09 +00:00
|
|
|
|
2020-09-28 23:53:40 +00:00
|
|
|
case 5: { // A5 GET CURRENT COORDINATE
|
2021-03-12 12:54:42 +00:00
|
|
|
const float xPosition = getAxisPosition_mm(X),
|
|
|
|
yPosition = getAxisPosition_mm(Y),
|
|
|
|
zPosition = getAxisPosition_mm(Z);
|
2021-01-13 00:05:49 +00:00
|
|
|
SEND_PGM("A5V X: "); LCD_SERIAL.print(xPosition);
|
|
|
|
SEND_PGM( " Y: "); LCD_SERIAL.print(yPosition);
|
|
|
|
SEND_PGM( " Z: "); LCD_SERIAL.print(zPosition);
|
2020-08-06 10:38:18 +00:00
|
|
|
SENDLINE_PGM("");
|
2020-09-28 23:53:40 +00:00
|
|
|
} break;
|
2020-07-17 06:07:09 +00:00
|
|
|
|
|
|
|
case 6: // A6 GET SD CARD PRINTING STATUS
|
|
|
|
#if ENABLED(SDSUPPORT)
|
2021-03-12 12:54:42 +00:00
|
|
|
if (isPrintingFromMedia()) {
|
2020-08-06 10:38:18 +00:00
|
|
|
SEND_PGM("A6V ");
|
2021-03-12 12:54:42 +00:00
|
|
|
if (isMediaInserted())
|
|
|
|
SENDLINE(ui8tostr3rj(getProgress_percent()));
|
2020-09-28 23:53:40 +00:00
|
|
|
else
|
2020-08-06 10:38:18 +00:00
|
|
|
SENDLINE_DBG_PGM("J02", "TFT Serial Debug: No SD Card mounted to return printing status... J02");
|
2020-07-17 06:07:09 +00:00
|
|
|
}
|
2020-09-28 23:53:40 +00:00
|
|
|
else
|
2020-08-06 10:38:18 +00:00
|
|
|
SENDLINE_PGM("A6V ---");
|
2020-07-17 06:07:09 +00:00
|
|
|
#endif
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 7: { // A7 GET PRINTING TIME
|
2021-03-12 12:54:42 +00:00
|
|
|
const uint32_t elapsedSeconds = getProgress_seconds_elapsed();
|
2020-08-06 10:38:18 +00:00
|
|
|
SEND_PGM("A7V ");
|
2020-07-17 06:07:09 +00:00
|
|
|
if (elapsedSeconds != 0) { // print time
|
2020-09-28 23:53:40 +00:00
|
|
|
const uint32_t elapsedMinutes = elapsedSeconds / 60;
|
|
|
|
SEND(ui8tostr2(elapsedMinutes / 60));
|
2020-08-06 10:38:18 +00:00
|
|
|
SEND_PGM(" H ");
|
2020-09-28 23:53:40 +00:00
|
|
|
SEND(ui8tostr2(elapsedMinutes % 60));
|
2020-08-06 10:38:18 +00:00
|
|
|
SENDLINE_PGM(" M");
|
2020-07-17 06:07:09 +00:00
|
|
|
}
|
2020-09-28 23:53:40 +00:00
|
|
|
else
|
2020-08-06 10:38:18 +00:00
|
|
|
SENDLINE_PGM(" 999:999");
|
2020-07-17 06:07:09 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 8: // A8 GET SD LIST
|
|
|
|
#if ENABLED(SDSUPPORT)
|
|
|
|
SelectedFile[0] = 0;
|
|
|
|
RenderCurrentFileList();
|
|
|
|
#endif
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 9: // A9 pause sd print
|
|
|
|
#if ENABLED(SDSUPPORT)
|
2021-03-12 12:54:42 +00:00
|
|
|
if (isPrintingFromMedia())
|
2020-07-17 06:07:09 +00:00
|
|
|
PausePrint();
|
|
|
|
#endif
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 10: // A10 resume sd print
|
|
|
|
#if ENABLED(SDSUPPORT)
|
2021-03-12 12:54:42 +00:00
|
|
|
if (isPrintingFromMediaPaused())
|
2020-07-17 06:07:09 +00:00
|
|
|
ResumePrint();
|
|
|
|
#endif
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 11: // A11 STOP SD PRINT
|
2020-09-28 23:53:40 +00:00
|
|
|
TERN_(SDSUPPORT, StopPrint());
|
2020-07-17 06:07:09 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 12: // A12 kill
|
|
|
|
kill(PSTR(STR_ERR_KILLED));
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 13: // A13 SELECTION FILE
|
|
|
|
#if ENABLED(SDSUPPORT)
|
2021-03-12 12:54:42 +00:00
|
|
|
if (isMediaInserted()) {
|
2020-07-17 06:07:09 +00:00
|
|
|
starpos = (strchr(TFTstrchr_pointer + 4, '*'));
|
|
|
|
if (TFTstrchr_pointer[4] == '/') {
|
|
|
|
strcpy(SelectedDirectory, TFTstrchr_pointer + 5);
|
|
|
|
SelectedFile[0] = 0;
|
2020-08-06 10:38:18 +00:00
|
|
|
SENDLINE_DBG_PGM("J21", "TFT Serial Debug: Clear file selection... J21 "); // J21 Not File Selected
|
|
|
|
SENDLINE_PGM("");
|
2020-07-17 06:07:09 +00:00
|
|
|
}
|
|
|
|
else if (TFTstrchr_pointer[4] == '<') {
|
|
|
|
strcpy(SelectedDirectory, TFTstrchr_pointer + 4);
|
|
|
|
SpecialMenu = true;
|
|
|
|
SelectedFile[0] = 0;
|
2020-08-06 10:38:18 +00:00
|
|
|
SENDLINE_DBG_PGM("J21", "TFT Serial Debug: Clear file selection... J21 "); // J21 Not File Selected
|
|
|
|
SENDLINE_PGM("");
|
2020-07-17 06:07:09 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
SelectedDirectory[0] = 0;
|
|
|
|
|
2020-10-24 22:13:10 +00:00
|
|
|
if (starpos) *(starpos - 1) = '\0';
|
2020-07-17 06:07:09 +00:00
|
|
|
|
|
|
|
strcpy(SelectedFile, TFTstrchr_pointer + 4);
|
2020-08-06 10:38:18 +00:00
|
|
|
SENDLINE_DBG_PGM_VAL("J20", "TFT Serial Debug: File Selected... J20 ", SelectedFile); // J20 File Selected
|
2020-07-17 06:07:09 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 14: // A14 START PRINTING
|
|
|
|
#if ENABLED(SDSUPPORT)
|
2021-03-12 12:54:42 +00:00
|
|
|
if (!isPrinting() && strlen(SelectedFile) > 0)
|
2020-07-17 06:07:09 +00:00
|
|
|
StartPrint();
|
|
|
|
#endif
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 15: // A15 RESUMING FROM OUTAGE
|
|
|
|
// TODO: JBA implement resume form outage
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 16: { // A16 set hotend temp
|
|
|
|
unsigned int tempvalue;
|
|
|
|
if (CodeSeen('S')) {
|
|
|
|
tempvalue = constrain(CodeValue(), 0, 275);
|
2021-04-24 00:06:55 +00:00
|
|
|
setTargetTemp_celsius(tempvalue, (extruder_t)E0);
|
2020-07-17 06:07:09 +00:00
|
|
|
}
|
2021-03-12 12:54:42 +00:00
|
|
|
else if (CodeSeen('C') && !isPrinting()) {
|
|
|
|
if (getAxisPosition_mm(Z) < 10)
|
|
|
|
injectCommands_P(PSTR("G1 Z10")); // RASE Z AXIS
|
2020-07-17 06:07:09 +00:00
|
|
|
tempvalue = constrain(CodeValue(), 0, 275);
|
2021-04-24 00:06:55 +00:00
|
|
|
setTargetTemp_celsius(tempvalue, (extruder_t)E0);
|
2020-07-17 06:07:09 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2020-09-28 23:53:40 +00:00
|
|
|
case 17: { // A17 set heated bed temp
|
2020-07-17 06:07:09 +00:00
|
|
|
unsigned int tempbed;
|
|
|
|
if (CodeSeen('S')) {
|
|
|
|
tempbed = constrain(CodeValue(), 0, 100);
|
2021-03-12 12:54:42 +00:00
|
|
|
setTargetTemp_celsius(tempbed, (heater_t)BED);
|
2020-07-17 06:07:09 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2020-09-28 23:53:40 +00:00
|
|
|
case 18: { // A18 set fan speed
|
2020-07-17 06:07:09 +00:00
|
|
|
float fanPercent;
|
|
|
|
if (CodeSeen('S')) {
|
|
|
|
fanPercent = CodeValue();
|
|
|
|
fanPercent = constrain(fanPercent, 0, 100);
|
2021-03-12 12:54:42 +00:00
|
|
|
setTargetFan_percent(fanPercent, FAN0);
|
2020-07-17 06:07:09 +00:00
|
|
|
}
|
2020-09-28 23:53:40 +00:00
|
|
|
else
|
2020-07-17 06:07:09 +00:00
|
|
|
fanPercent = 100;
|
|
|
|
|
2021-03-12 12:54:42 +00:00
|
|
|
setTargetFan_percent(fanPercent, FAN0);
|
2020-08-06 10:38:18 +00:00
|
|
|
SENDLINE_PGM("");
|
2020-07-17 06:07:09 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 19: // A19 stop stepper drivers - sent on stop extrude command and on turn motors off command
|
2021-03-12 12:54:42 +00:00
|
|
|
if (!isPrinting()) {
|
2020-07-17 06:07:09 +00:00
|
|
|
quickstop_stepper();
|
|
|
|
disable_all_steppers();
|
|
|
|
}
|
|
|
|
|
2020-08-06 10:38:18 +00:00
|
|
|
SENDLINE_PGM("");
|
2020-07-17 06:07:09 +00:00
|
|
|
break;
|
|
|
|
|
2020-09-28 23:53:40 +00:00
|
|
|
case 20: // A20 read printing speed
|
2020-07-17 06:07:09 +00:00
|
|
|
if (CodeSeen('S'))
|
|
|
|
feedrate_percentage = constrain(CodeValue(), 40, 999);
|
|
|
|
else
|
2020-08-06 10:38:18 +00:00
|
|
|
SEND_PGM_VAL("A20V ", feedrate_percentage);
|
2020-07-17 06:07:09 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 21: // A21 all home
|
2021-03-12 12:54:42 +00:00
|
|
|
if (!isPrinting() && !isPrintingFromMediaPaused()) {
|
2020-07-17 06:07:09 +00:00
|
|
|
if (CodeSeen('X') || CodeSeen('Y') || CodeSeen('Z')) {
|
|
|
|
if (CodeSeen('X'))
|
2021-03-12 12:54:42 +00:00
|
|
|
injectCommands_P(PSTR("G28X"));
|
2020-07-17 06:07:09 +00:00
|
|
|
if (CodeSeen('Y'))
|
2021-03-12 12:54:42 +00:00
|
|
|
injectCommands_P(PSTR("G28Y"));
|
2020-07-17 06:07:09 +00:00
|
|
|
if (CodeSeen('Z'))
|
2021-03-12 12:54:42 +00:00
|
|
|
injectCommands_P(PSTR("G28Z"));
|
2020-07-17 06:07:09 +00:00
|
|
|
}
|
|
|
|
else if (CodeSeen('C')) {
|
2021-03-12 12:54:42 +00:00
|
|
|
injectCommands_P(G28_STR);
|
2020-07-17 06:07:09 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 22: // A22 move X/Y/Z or extrude
|
2021-03-12 12:54:42 +00:00
|
|
|
if (!isPrinting()) {
|
2020-07-17 06:07:09 +00:00
|
|
|
float coorvalue;
|
|
|
|
unsigned int movespeed = 0;
|
|
|
|
char commandStr[30];
|
|
|
|
char fullCommandStr[38];
|
|
|
|
|
|
|
|
commandStr[0] = 0; // empty string
|
|
|
|
if (CodeSeen('F')) // Set feedrate
|
|
|
|
movespeed = CodeValue();
|
|
|
|
|
|
|
|
if (CodeSeen('X')) { // Move in X direction
|
|
|
|
coorvalue = CodeValue();
|
|
|
|
if ((coorvalue <= 0.2) && coorvalue > 0)
|
|
|
|
sprintf_P(commandStr, PSTR("G1 X0.1F%i"), movespeed);
|
|
|
|
else if ((coorvalue <= -0.1) && coorvalue > -1)
|
|
|
|
sprintf_P(commandStr, PSTR("G1 X-0.1F%i"), movespeed);
|
|
|
|
else
|
|
|
|
sprintf_P(commandStr, PSTR("G1 X%iF%i"), int(coorvalue), movespeed);
|
|
|
|
}
|
|
|
|
else if (CodeSeen('Y')) { // Move in Y direction
|
|
|
|
coorvalue = CodeValue();
|
|
|
|
if ((coorvalue <= 0.2) && coorvalue > 0)
|
|
|
|
sprintf_P(commandStr, PSTR("G1 Y0.1F%i"), movespeed);
|
|
|
|
else if ((coorvalue <= -0.1) && coorvalue > -1)
|
|
|
|
sprintf_P(commandStr, PSTR("G1 Y-0.1F%i"), movespeed);
|
|
|
|
else
|
|
|
|
sprintf_P(commandStr, PSTR("G1 Y%iF%i"), int(coorvalue), movespeed);
|
|
|
|
}
|
|
|
|
else if (CodeSeen('Z')) { // Move in Z direction
|
|
|
|
coorvalue = CodeValue();
|
|
|
|
if ((coorvalue <= 0.2) && coorvalue > 0)
|
|
|
|
sprintf_P(commandStr, PSTR("G1 Z0.1F%i"), movespeed);
|
|
|
|
else if ((coorvalue <= -0.1) && coorvalue > -1)
|
|
|
|
sprintf_P(commandStr, PSTR("G1 Z-0.1F%i"), movespeed);
|
|
|
|
else
|
|
|
|
sprintf_P(commandStr, PSTR("G1 Z%iF%i"), int(coorvalue), movespeed);
|
|
|
|
}
|
|
|
|
else if (CodeSeen('E')) { // Extrude
|
|
|
|
coorvalue = CodeValue();
|
|
|
|
if ((coorvalue <= 0.2) && coorvalue > 0)
|
|
|
|
sprintf_P(commandStr, PSTR("G1 E0.1F%i"), movespeed);
|
|
|
|
else if ((coorvalue <= -0.1) && coorvalue > -1)
|
|
|
|
sprintf_P(commandStr, PSTR("G1 E-0.1F%i"), movespeed);
|
|
|
|
else
|
|
|
|
sprintf_P(commandStr, PSTR("G1 E%iF500"), int(coorvalue));
|
|
|
|
}
|
|
|
|
|
|
|
|
if (strlen(commandStr) > 0) {
|
|
|
|
sprintf_P(fullCommandStr, PSTR("G91\n%s\nG90"), commandStr);
|
2020-08-06 10:38:18 +00:00
|
|
|
#if ENABLED(ANYCUBIC_LCD_DEBUG)
|
2020-07-17 06:07:09 +00:00
|
|
|
SERIAL_ECHOPGM("TFT Serial Debug: A22 Move final request with gcode... ");
|
|
|
|
SERIAL_ECHOLN(fullCommandStr);
|
|
|
|
#endif
|
2021-03-12 12:54:42 +00:00
|
|
|
injectCommands(fullCommandStr);
|
2020-07-17 06:07:09 +00:00
|
|
|
}
|
|
|
|
}
|
2020-08-06 10:38:18 +00:00
|
|
|
SENDLINE_PGM("");
|
2020-07-17 06:07:09 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 23: // A23 preheat pla
|
2021-03-12 12:54:42 +00:00
|
|
|
if (!isPrinting()) {
|
|
|
|
if (getAxisPosition_mm(Z) < 10)
|
|
|
|
injectCommands_P(PSTR("G1 Z10")); // RASE Z AXIS
|
2020-07-17 06:07:09 +00:00
|
|
|
|
2021-04-24 00:06:55 +00:00
|
|
|
setTargetTemp_celsius(PREHEAT_1_TEMP_BED, (heater_t)BED);
|
|
|
|
setTargetTemp_celsius(PREHEAT_1_TEMP_HOTEND, (extruder_t)E0);
|
2020-08-06 10:38:18 +00:00
|
|
|
SENDLINE_PGM("OK");
|
2020-07-17 06:07:09 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 24:// A24 preheat abs
|
2021-03-12 12:54:42 +00:00
|
|
|
if (!isPrinting()) {
|
|
|
|
if (getAxisPosition_mm(Z) < 10)
|
|
|
|
injectCommands_P(PSTR("G1 Z10")); // RASE Z AXIS
|
2020-07-17 06:07:09 +00:00
|
|
|
|
2021-04-24 00:06:55 +00:00
|
|
|
setTargetTemp_celsius(PREHEAT_2_TEMP_BED, (heater_t)BED);
|
|
|
|
setTargetTemp_celsius(PREHEAT_2_TEMP_HOTEND, (extruder_t)E0);
|
2020-08-06 10:38:18 +00:00
|
|
|
SENDLINE_PGM("OK");
|
2020-07-17 06:07:09 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 25: // A25 cool down
|
2021-03-12 12:54:42 +00:00
|
|
|
if (!isPrinting()) {
|
|
|
|
setTargetTemp_celsius(0, (heater_t) BED);
|
|
|
|
setTargetTemp_celsius(0, (extruder_t) E0);
|
2020-07-17 06:07:09 +00:00
|
|
|
|
2020-08-06 10:38:18 +00:00
|
|
|
SENDLINE_DBG_PGM("J12", "TFT Serial Debug: Cooling down... J12"); // J12 cool down
|
2020-07-17 06:07:09 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 26: // A26 refresh SD
|
|
|
|
#if ENABLED(SDSUPPORT)
|
2021-03-12 12:54:42 +00:00
|
|
|
if (isMediaInserted()) {
|
2020-07-17 06:07:09 +00:00
|
|
|
if (strlen(SelectedDirectory) > 0) {
|
2021-03-12 12:54:42 +00:00
|
|
|
FileList currentFileList;
|
2020-07-17 06:07:09 +00:00
|
|
|
if ((SelectedDirectory[0] == '.') && (SelectedDirectory[1] == '.')) {
|
|
|
|
currentFileList.upDir();
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
if (SelectedDirectory[0] == '<')
|
|
|
|
HandleSpecialMenu();
|
|
|
|
else
|
|
|
|
currentFileList.changeDir(SelectedDirectory);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
2020-08-06 10:38:18 +00:00
|
|
|
SENDLINE_DBG_PGM("J02", "TFT Serial Debug: No SD Card mounted to refresh SD A26... J02");
|
2020-07-17 06:07:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
SelectedDirectory[0] = 0;
|
|
|
|
#endif
|
|
|
|
break;
|
|
|
|
|
|
|
|
#if ENABLED(SERVO_ENDSTOPS)
|
|
|
|
case 27: break; // A27 servos angles adjust
|
|
|
|
#endif
|
|
|
|
|
|
|
|
case 28: // A28 filament test
|
|
|
|
if (CodeSeen('O'))
|
|
|
|
NOOP;
|
|
|
|
else if (CodeSeen('C'))
|
|
|
|
NOOP;
|
2020-08-06 10:38:18 +00:00
|
|
|
SENDLINE_PGM("");
|
2020-07-17 06:07:09 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 33: // A33 get version info
|
2020-08-06 10:38:18 +00:00
|
|
|
SEND_PGM("J33 ");
|
|
|
|
SENDLINE_PGM(DETAILED_BUILD_VERSION);
|
2020-07-17 06:07:09 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
TFTbufindw = (TFTbufindw + 1) % TFTBUFSIZE;
|
|
|
|
TFTbuflen += 1;
|
|
|
|
serial3_count = 0; // clear buffer
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
TFTcmdbuffer[TFTbufindw][serial3_count++] = serial3_char;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void AnycubicTFTClass::DoSDCardStateCheck() {
|
|
|
|
#if ENABLED(SDSUPPORT) && PIN_EXISTS(SD_DETECT)
|
2021-03-12 12:54:42 +00:00
|
|
|
bool isInserted = isMediaInserted();
|
2020-07-17 06:07:09 +00:00
|
|
|
if (isInserted)
|
2020-08-06 10:38:18 +00:00
|
|
|
SENDLINE_DBG_PGM("J00", "TFT Serial Debug: SD card state changed... isInserted");
|
2020-07-17 06:07:09 +00:00
|
|
|
else
|
2020-08-06 10:38:18 +00:00
|
|
|
SENDLINE_DBG_PGM("J01", "TFT Serial Debug: SD card state changed... !isInserted");
|
2020-07-17 06:07:09 +00:00
|
|
|
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
void AnycubicTFTClass::DoFilamentRunoutCheck() {
|
|
|
|
#if ENABLED(FILAMENT_RUNOUT_SENSOR)
|
2021-03-12 12:54:42 +00:00
|
|
|
// NOTE: getFilamentRunoutState() only returns the runout state if the job is printing
|
2020-07-17 06:07:09 +00:00
|
|
|
// we want to actually check the status of the pin here, regardless of printstate
|
2020-11-11 06:39:23 +00:00
|
|
|
if (READ(FIL_RUNOUT1_PIN)) {
|
2020-07-17 06:07:09 +00:00
|
|
|
if (mediaPrintingState == AMPRINTSTATE_PRINTING || mediaPrintingState == AMPRINTSTATE_PAUSED || mediaPrintingState == AMPRINTSTATE_PAUSE_REQUESTED) {
|
|
|
|
// play tone to indicate filament is out
|
2021-03-12 12:54:42 +00:00
|
|
|
injectCommands_P(PSTR("\nM300 P200 S1567\nM300 P200 S1174\nM300 P200 S1567\nM300 P200 S1174\nM300 P2000 S1567"));
|
2020-07-17 06:07:09 +00:00
|
|
|
|
|
|
|
// tell the user that the filament has run out and wait
|
2020-08-06 10:38:18 +00:00
|
|
|
SENDLINE_DBG_PGM("J23", "TFT Serial Debug: Blocking filament prompt... J23");
|
2020-07-17 06:07:09 +00:00
|
|
|
}
|
|
|
|
else {
|
2020-08-06 10:38:18 +00:00
|
|
|
SENDLINE_DBG_PGM("J15", "TFT Serial Debug: Non blocking filament runout... J15");
|
2020-07-17 06:07:09 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif // FILAMENT_RUNOUT_SENSOR
|
|
|
|
}
|
|
|
|
|
|
|
|
void AnycubicTFTClass::StartPrint() {
|
|
|
|
#if ENABLED(SDSUPPORT)
|
2021-03-12 12:54:42 +00:00
|
|
|
if (!isPrinting() && strlen(SelectedFile) > 0) {
|
2020-08-06 10:38:18 +00:00
|
|
|
#if ENABLED(ANYCUBIC_LCD_DEBUG)
|
2020-07-17 06:07:09 +00:00
|
|
|
SERIAL_ECHOPGM("TFT Serial Debug: About to print file ... ");
|
2021-03-12 12:54:42 +00:00
|
|
|
SERIAL_ECHO(isPrinting());
|
2020-07-17 06:07:09 +00:00
|
|
|
SERIAL_ECHOPGM(" ");
|
|
|
|
SERIAL_ECHOLN(SelectedFile);
|
|
|
|
#endif
|
|
|
|
mediaPrintingState = AMPRINTSTATE_PRINTING;
|
|
|
|
mediaPauseState = AMPAUSESTATE_NOT_PAUSED;
|
2021-03-12 12:54:42 +00:00
|
|
|
printFile(SelectedFile);
|
2020-07-17 06:07:09 +00:00
|
|
|
}
|
|
|
|
#endif // SDUPPORT
|
|
|
|
}
|
|
|
|
|
|
|
|
void AnycubicTFTClass::PausePrint() {
|
|
|
|
#if ENABLED(SDSUPPORT)
|
2021-03-12 12:54:42 +00:00
|
|
|
if (isPrintingFromMedia() && mediaPrintingState != AMPRINTSTATE_STOP_REQUESTED && mediaPauseState == AMPAUSESTATE_NOT_PAUSED) {
|
2020-07-17 06:07:09 +00:00
|
|
|
mediaPrintingState = AMPRINTSTATE_PAUSE_REQUESTED;
|
|
|
|
mediaPauseState = AMPAUSESTATE_NOT_PAUSED; // need the userconfirm method to update pause state
|
2020-08-06 10:38:18 +00:00
|
|
|
SENDLINE_DBG_PGM("J05", "TFT Serial Debug: SD print pause started... J05"); // J05 printing pause
|
2020-07-17 06:07:09 +00:00
|
|
|
|
|
|
|
// for some reason pausing the print doesn't retract the extruder so force a manual one here
|
2021-03-12 12:54:42 +00:00
|
|
|
injectCommands_P(PSTR("G91\nG1 E-2 F1800\nG90"));
|
|
|
|
pausePrint();
|
2020-07-17 06:07:09 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
void AnycubicTFTClass::ResumePrint() {
|
|
|
|
#if ENABLED(SDSUPPORT)
|
|
|
|
#if ENABLED(FILAMENT_RUNOUT_SENSOR)
|
2020-11-11 06:39:23 +00:00
|
|
|
if (READ(FIL_RUNOUT1_PIN)) {
|
2020-08-06 10:38:18 +00:00
|
|
|
#if ENABLED(ANYCUBIC_LCD_DEBUG)
|
2020-07-17 06:07:09 +00:00
|
|
|
SERIAL_ECHOLNPGM("TFT Serial Debug: Resume Print with filament sensor still tripped... ");
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// trigger the user message box
|
|
|
|
DoFilamentRunoutCheck();
|
|
|
|
|
|
|
|
// re-enable the continue button
|
2020-08-06 10:38:18 +00:00
|
|
|
SENDLINE_DBG_PGM("J18", "TFT Serial Debug: Resume Print with filament sensor still tripped... J18");
|
2020-07-17 06:07:09 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
if (mediaPauseState == AMPAUSESTATE_HEATER_TIMEOUT) {
|
|
|
|
mediaPauseState = AMPAUSESTATE_REHEATING;
|
|
|
|
// TODO: JBA I don't think J05 just disables the continue button, i think it injects a rogue M25. So taking this out
|
|
|
|
// // disable the continue button
|
2020-08-06 10:38:18 +00:00
|
|
|
// SENDLINE_DBG_PGM("J05", "TFT Serial Debug: Resume called with heater timeout... J05"); // J05 printing pause
|
2020-07-17 06:07:09 +00:00
|
|
|
|
|
|
|
// reheat the nozzle
|
2021-03-12 12:54:42 +00:00
|
|
|
setUserConfirmed();
|
2020-07-17 06:07:09 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
mediaPrintingState = AMPRINTSTATE_PRINTING;
|
|
|
|
mediaPauseState = AMPAUSESTATE_NOT_PAUSED;
|
|
|
|
|
2020-08-06 10:38:18 +00:00
|
|
|
SENDLINE_DBG_PGM("J04", "TFT Serial Debug: SD print resumed... J04"); // J04 printing form sd card now
|
2021-03-12 12:54:42 +00:00
|
|
|
resumePrint();
|
2020-07-17 06:07:09 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
void AnycubicTFTClass::StopPrint() {
|
|
|
|
#if ENABLED(SDSUPPORT)
|
|
|
|
mediaPrintingState = AMPRINTSTATE_STOP_REQUESTED;
|
|
|
|
mediaPauseState = AMPAUSESTATE_NOT_PAUSED;
|
2020-08-06 10:38:18 +00:00
|
|
|
SENDLINE_DBG_PGM("J16", "TFT Serial Debug: SD print stop called... J16");
|
2020-07-17 06:07:09 +00:00
|
|
|
|
|
|
|
// for some reason stopping the print doesn't retract the extruder so force a manual one here
|
2021-03-12 12:54:42 +00:00
|
|
|
injectCommands_P(PSTR("G91\nG1 E-2 F1800\nG90"));
|
|
|
|
stopPrint();
|
2020-07-17 06:07:09 +00:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2020-08-06 10:38:18 +00:00
|
|
|
#endif // ANYCUBIC_LCD_I3MEGA
|