11 Commits

Author SHA1 Message Date
David Ramiro
1a5804f260 Implement nozzle reheating on timeout via display
- Raise nozzle timeout to 10 minutes
- Use continue button as reheat trigger
- Manage nozzle_timed_out variable via display
- Add PausedByNozzleTimeout flag to enter correct routine on display
- Bump version to 1.4.3
2019-03-08 16:30:56 +01:00
David Ramiro
cea54723e7 Use realtime on filament sensor
Instead of incrementing a variable on every iteration on the filament sensor trigger loop, we now use a real time macro that ensure better repeatability and is easier to customize.
2019-03-08 16:05:54 +01:00
David Ramiro
90e27ff21b Fix indentation
Improve readability and fix #ifdef and #endif indentations
2019-03-08 01:25:21 +01:00
David Ramiro
85c32a2bb6 Fix Z movement on abort
- Referencing #29
- Adding audio feedback to special menu M500 and M502
2019-03-06 22:59:46 +01:00
David Ramiro
2c53c33d52 Tweak M600 display resume
- Add startFileprint(); call to M108 display routine to fix progress and ensure "printing done" gets shown
- Add SD printing check in marlin_main.cpp M600 routine to skip TFTstate if not necessary (e.g. USB printing)
- Move routine to the top again to ensure immediate execution
2019-02-24 15:48:03 +01:00
David Ramiro
8fc01144f1 Set SDPAUSE state on M600 regardless of prior TFTstate
Move the routine to a better position and set the state regardless of SDPRINT status.

This ensures that M600 makes the display show a continue button every time. Before, it was only behaving correctly for the first instance of M600.
2019-02-23 11:16:29 +01:00
David Ramiro
8448c67846 Streamline build identification 2019-02-23 00:31:25 +01:00
David Ramiro
e822d53f2f Merge branch 'master' into dev 2019-02-23 00:26:33 +01:00
David Ramiro
30bbf59cb0 Increase filament rounout trigger delay
In some cases, the filament runout was triggered erratically, we are now waiting for the trigger to last a few moments until we start the routine.
2019-02-22 22:26:58 +01:00
David Ramiro
0f5745e281 Update README.md 2019-02-21 10:30:21 +01:00
David Ramiro
d6f2b7dcf2 Update README.md 2019-02-19 19:15:28 +01:00
9 changed files with 1240 additions and 1135 deletions

View File

@@ -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>
@@ -33,6 +33,7 @@
#include "stepper.h" #include "stepper.h"
#include "serial.h" #include "serial.h"
#include "printcounter.h" #include "printcounter.h"
#include "macros.h"
#ifdef ANYCUBIC_TFT_MODEL #ifdef ANYCUBIC_TFT_MODEL
#include "AnycubicTFT.h" #include "AnycubicTFT.h"
@@ -51,24 +52,24 @@ char *itostr2(const uint8_t &x)
} }
#ifndef ULTRA_LCD #ifndef ULTRA_LCD
#define DIGIT(n) ('0' + (n)) #define DIGIT(n) ('0' + (n))
#define DIGIMOD(n, f) DIGIT((n)/(f) % 10) #define DIGIMOD(n, f) DIGIT((n)/(f) % 10)
#define RJDIGIT(n, f) ((n) >= (f) ? DIGIMOD(n, f) : ' ') #define RJDIGIT(n, f) ((n) >= (f) ? DIGIMOD(n, f) : ' ')
#define MINUSOR(n, alt) (n >= 0 ? (alt) : (n = -n, '-')) #define MINUSOR(n, alt) (n >= 0 ? (alt) : (n = -n, '-'))
char* itostr3(const int x) { char* itostr3(const int x) {
int xx = x; int xx = x;
_conv[4] = MINUSOR(xx, RJDIGIT(xx, 100)); _conv[4] = MINUSOR(xx, RJDIGIT(xx, 100));
_conv[5] = RJDIGIT(xx, 10); _conv[5] = RJDIGIT(xx, 10);
_conv[6] = DIGIMOD(xx, 1); _conv[6] = DIGIMOD(xx, 1);
return &_conv[4]; return &_conv[4];
} }
// Convert signed float to fixed-length string with 023.45 / -23.45 format // Convert signed float to fixed-length string with 023.45 / -23.45 format
char *ftostr32(const float &x) { char *ftostr32(const float &x) {
long xx = x * 100; long xx = x * 100;
_conv[1] = MINUSOR(xx, DIGIMOD(xx, 10000)); _conv[1] = MINUSOR(xx, DIGIMOD(xx, 10000));
_conv[2] = DIGIMOD(xx, 1000); _conv[2] = DIGIMOD(xx, 1000);
@@ -77,7 +78,7 @@ char *ftostr32(const float &x) {
_conv[5] = DIGIMOD(xx, 10); _conv[5] = DIGIMOD(xx, 10);
_conv[6] = DIGIMOD(xx, 1); _conv[6] = DIGIMOD(xx, 1);
return &_conv[1]; return &_conv[1];
} }
#endif #endif
@@ -93,23 +94,23 @@ void AnycubicTFTClass::Setup() {
ANYCUBIC_SERIAL_PROTOCOLPGM("J12"); // J12 Ready ANYCUBIC_SERIAL_PROTOCOLPGM("J12"); // J12 Ready
ANYCUBIC_SERIAL_ENTER(); ANYCUBIC_SERIAL_ENTER();
#if ENABLED(SDSUPPORT) && PIN_EXISTS(SD_DETECT) #if ENABLED(SDSUPPORT) && PIN_EXISTS(SD_DETECT)
pinMode(SD_DETECT_PIN, INPUT); pinMode(SD_DETECT_PIN, INPUT);
WRITE(SD_DETECT_PIN, HIGH); WRITE(SD_DETECT_PIN, HIGH);
#endif #endif
#if ENABLED(ANYCUBIC_FILAMENT_RUNOUT_SENSOR) #if ENABLED(ANYCUBIC_FILAMENT_RUNOUT_SENSOR)
pinMode(FIL_RUNOUT_PIN,INPUT); pinMode(FIL_RUNOUT_PIN,INPUT);
WRITE(FIL_RUNOUT_PIN,HIGH); WRITE(FIL_RUNOUT_PIN,HIGH);
if(READ(FIL_RUNOUT_PIN)==true) if(READ(FIL_RUNOUT_PIN)==true)
{ {
ANYCUBIC_SERIAL_PROTOCOLPGM("J15"); //J15 FILAMENT LACK ANYCUBIC_SERIAL_PROTOCOLPGM("J15"); //J15 FILAMENT LACK
ANYCUBIC_SERIAL_ENTER(); ANYCUBIC_SERIAL_ENTER();
#ifdef ANYCUBIC_TFT_DEBUG #ifdef ANYCUBIC_TFT_DEBUG
SERIAL_ECHOLNPGM("TFT Serial Debug: Filament runout... J15"); SERIAL_ECHOLNPGM("TFT Serial Debug: Filament runout... J15");
#endif #endif
} }
#endif #endif
SelectedDirectory[0]=0; SelectedDirectory[0]=0;
SpecialMenu=false; SpecialMenu=false;
@@ -129,15 +130,15 @@ void AnycubicTFTClass::KillTFT()
{ {
ANYCUBIC_SERIAL_PROTOCOLPGM("J11"); // J11 Kill ANYCUBIC_SERIAL_PROTOCOLPGM("J11"); // J11 Kill
ANYCUBIC_SERIAL_ENTER(); ANYCUBIC_SERIAL_ENTER();
#ifdef ANYCUBIC_TFT_DEBUG #ifdef ANYCUBIC_TFT_DEBUG
SERIAL_ECHOLNPGM("TFT Serial Debug: Kill command... J11"); SERIAL_ECHOLNPGM("TFT Serial Debug: Kill command... J11");
#endif #endif
} }
void AnycubicTFTClass::StartPrint(){ void AnycubicTFTClass::StartPrint(){
if (TFTstate==ANYCUBIC_TFT_STATE_SDPAUSE) { // resuming from SD pause if (TFTstate==ANYCUBIC_TFT_STATE_SDPAUSE) { // resuming from SD pause
if((!PausedByRunout) && (!PausedByFilamentChange)) // was that a regular pause? if((!PausedByRunout) && (!PausedByFilamentChange) && (!PausedByNozzleTimeout)) // was that a regular pause?
{ {
enqueue_and_echo_commands_P(PSTR("G91")); // relative mode enqueue_and_echo_commands_P(PSTR("G91")); // relative mode
enqueue_and_echo_commands_P(PSTR("G1 Z-10 F240")); // lower nozzle again enqueue_and_echo_commands_P(PSTR("G1 Z-10 F240")); // lower nozzle again
@@ -146,136 +147,162 @@ void AnycubicTFTClass::StartPrint(){
} }
} }
starttime=millis(); starttime=millis();
#ifdef SDSUPPORT #ifdef SDSUPPORT
if((!PausedByRunout) && (!PausedByFilamentChange)) // was that a regular pause? if((!PausedByRunout) && (!PausedByFilamentChange) && (!PausedByNozzleTimeout)) // was that a regular pause?
{ {
card.startFileprint(); // start or resume regularly card.startFileprint(); // start or resume regularly
} }
else if((PausedByRunout) && (!PausedByFilamentChange)) // resuming from a pause that was caused by filament runout else if((PausedByRunout) && (!PausedByFilamentChange) && (!PausedByNozzleTimeout)) // resuming from a pause that was caused by filament runout
{ {
enqueue_and_echo_commands_P(PSTR("M24")); // unpark nozzle and resume enqueue_and_echo_commands_P(PSTR("M24")); // unpark nozzle and resume
#ifdef ANYCUBIC_TFT_DEBUG #ifdef ANYCUBIC_TFT_DEBUG
SERIAL_ECHOLNPGM("DEBUG: M24 Resume from Filament Runout"); SERIAL_ECHOLNPGM("DEBUG: M24 Resume from Filament Runout");
#endif #endif
PausedByRunout=false; // clear flag PausedByRunout=false; // clear flag
#ifdef ANYCUBIC_TFT_DEBUG #ifdef ANYCUBIC_TFT_DEBUG
SERIAL_ECHOLNPGM("DEBUG: Filament Pause Flag cleared"); SERIAL_ECHOLNPGM("DEBUG: Filament Pause Flag cleared");
#endif #endif
} }
else if((!PausedByRunout) && (PausedByFilamentChange)) // was M600 called? else if((!PausedByRunout) && (PausedByFilamentChange) && (!PausedByNozzleTimeout)) // was M600 called and the nozzle is not timed out?
{ {
FilamentChangeResume(); // enter M108 routine #ifdef ANYCUBIC_TFT_DEBUG
#ifdef ANYCUBIC_TFT_DEBUG
SERIAL_ECHOLNPGM("DEBUG: Start M108 routine"); SERIAL_ECHOLNPGM("DEBUG: Start M108 routine");
#endif #endif
FilamentChangeResume(); // enter M108 routine
PausedByFilamentChange=false; // clear flag PausedByFilamentChange=false; // clear flag
#ifdef ANYCUBIC_TFT_DEBUG #ifdef ANYCUBIC_TFT_DEBUG
SERIAL_ECHOLNPGM("DEBUG: Filament Change Flag cleared"); SERIAL_ECHOLNPGM("DEBUG: Filament Change Flag cleared");
#endif #endif
} }
#endif #endif
if (!PausedByNozzleTimeout) {
TFTstate=ANYCUBIC_TFT_STATE_SDPRINT; TFTstate=ANYCUBIC_TFT_STATE_SDPRINT;
} else {
TFTstate=ANYCUBIC_TFT_STATE_SDPAUSE_REQ;
#ifdef ANYCUBIC_TFT_DEBUG
SERIAL_ECHOLNPGM("DEBUG: Set Pause again because of timeout");
#endif
PausedByNozzleTimeout=false;
#ifdef ANYCUBIC_TFT_DEBUG
SERIAL_ECHOLNPGM("DEBUG: Nozzle timeout flag cleared");
#endif
}
} }
void AnycubicTFTClass::PausePrint(){ void AnycubicTFTClass::PausePrint(){
#ifdef SDSUPPORT #ifdef SDSUPPORT
if((!PausedByRunout)) // is this a regular pause? if((!PausedByRunout)) // is this a regular pause?
{ {
card.pauseSDPrint(); // pause print regularly card.pauseSDPrint(); // pause print regularly
#ifdef ANYCUBIC_TFT_DEBUG #ifdef ANYCUBIC_TFT_DEBUG
SERIAL_ECHOLNPGM("DEBUG: Regular Pause"); SERIAL_ECHOLNPGM("DEBUG: Regular Pause");
#endif #endif
} }
else // pause caused by filament runout else // pause caused by filament runout
{ {
#ifdef ANYCUBIC_TFT_DEBUG #ifdef ANYCUBIC_TFT_DEBUG
SERIAL_ECHOLNPGM("DEBUG: Filament Runout Pause"); SERIAL_ECHOLNPGM("DEBUG: Filament Runout Pause");
#endif #endif
enqueue_and_echo_commands_P(PSTR("M25")); // pause print and park nozzle enqueue_and_echo_commands_P(PSTR("M25")); // pause print and park nozzle
#ifdef ANYCUBIC_TFT_DEBUG #ifdef ANYCUBIC_TFT_DEBUG
SERIAL_ECHOLNPGM("DEBUG: M25 sent, parking nozzle"); SERIAL_ECHOLNPGM("DEBUG: M25 sent, parking nozzle");
#endif #endif
ANYCUBIC_SERIAL_PROTOCOLPGM("J23"); //J23 Show Filament Lack prompt on screen ANYCUBIC_SERIAL_PROTOCOLPGM("J23"); //J23 Show Filament Lack prompt on screen
ANYCUBIC_SERIAL_ENTER(); ANYCUBIC_SERIAL_ENTER();
#ifdef ANYCUBIC_TFT_DEBUG #ifdef ANYCUBIC_TFT_DEBUG
SERIAL_ECHOLNPGM("DEBUG: J23 Show filament prompt"); SERIAL_ECHOLNPGM("DEBUG: J23 Show filament prompt");
#endif #endif
} }
#endif #endif
TFTstate=ANYCUBIC_TFT_STATE_SDPAUSE_REQ; TFTstate=ANYCUBIC_TFT_STATE_SDPAUSE_REQ;
#ifdef ANYCUBIC_FILAMENT_RUNOUT_SENSOR #ifdef ANYCUBIC_FILAMENT_RUNOUT_SENSOR
if(FilamentTestStatus) { if(FilamentTestStatus) {
ANYCUBIC_SERIAL_PROTOCOLPGM("J05");// J05 pausing ANYCUBIC_SERIAL_PROTOCOLPGM("J05");// J05 pausing
ANYCUBIC_SERIAL_ENTER(); ANYCUBIC_SERIAL_ENTER();
#ifdef ANYCUBIC_TFT_DEBUG #ifdef ANYCUBIC_TFT_DEBUG
SERIAL_ECHOLNPGM("TFT Serial Debug: SD print paused... J05"); SERIAL_ECHOLNPGM("TFT Serial Debug: SD print paused... J05");
#endif #endif
} else { } else {
// Pause because of "out of filament" // Pause because of "out of filament"
ANYCUBIC_SERIAL_PROTOCOLPGM("J23"); //J23 FILAMENT LACK with the prompt box don't disappear ANYCUBIC_SERIAL_PROTOCOLPGM("J23"); //J23 FILAMENT LACK with the prompt box don't disappear
ANYCUBIC_SERIAL_ENTER(); ANYCUBIC_SERIAL_ENTER();
#ifdef ANYCUBIC_TFT_DEBUG #ifdef ANYCUBIC_TFT_DEBUG
SERIAL_ECHOLNPGM("TFT Serial Debug: Filament runout while printing... J23"); SERIAL_ECHOLNPGM("TFT Serial Debug: Filament runout while printing... J23");
#endif #endif
} }
#endif #endif
} }
void AnycubicTFTClass::StopPrint(){ void AnycubicTFTClass::StopPrint(){
#ifdef SDSUPPORT
#ifdef SDSUPPORT
card.stopSDPrint(); card.stopSDPrint();
#endif #endif
clear_command_queue(); clear_command_queue();
if((current_position[Z_AXIS]<150))
{
enqueue_and_echo_commands_P(PSTR("G91"));
enqueue_and_echo_commands_P(PSTR("G1 Z20 F240"));
enqueue_and_echo_commands_P(PSTR("G90"));
}
else if ((current_position[Z_AXIS]<190))
{
enqueue_and_echo_commands_P(PSTR("G91"));
enqueue_and_echo_commands_P(PSTR("G1 Z10 F240"));
enqueue_and_echo_commands_P(PSTR("G90"));
}
else if ((current_position[Z_AXIS]<200))
{
enqueue_and_echo_commands_P(PSTR("G91"));
enqueue_and_echo_commands_P(PSTR("G1 Z5 F240"));
enqueue_and_echo_commands_P(PSTR("G90"));
}
else if ((current_position[Z_AXIS]>=200))
{
enqueue_and_echo_commands_P(PSTR("G91"));
enqueue_and_echo_commands_P(PSTR("G1 Z1 F240"));
enqueue_and_echo_commands_P(PSTR("G90"));
}
quickstop_stepper(); quickstop_stepper();
print_job_timer.stop(); print_job_timer.stop();
thermalManager.disable_all_heaters(); thermalManager.disable_all_heaters();
if((current_position[Z_AXIS]<150))
{
enqueue_and_echo_commands_P(PSTR("G91\nG1 Z20 F240\nG90"));
}
else if ((current_position[Z_AXIS]<190))
{
enqueue_and_echo_commands_P(PSTR("G91\nG1 Z10 F240\nG90"));
}
else if ((current_position[Z_AXIS]<200))
{
enqueue_and_echo_commands_P(PSTR("G91\nG1 Z5 F240\nG90"));
}
else if ((current_position[Z_AXIS]>=200))
{
enqueue_and_echo_commands_P(PSTR("G91\nG1 Z1 F240\G90"));
}
#if FAN_COUNT > 0 #if FAN_COUNT > 0
for (uint8_t i = 0; i < FAN_COUNT; i++) fanSpeeds[i] = 0; for (uint8_t i = 0; i < FAN_COUNT; i++) fanSpeeds[i] = 0;
#endif #endif
TFTstate=ANYCUBIC_TFT_STATE_SDSTOP_REQ; TFTstate=ANYCUBIC_TFT_STATE_SDSTOP_REQ;
enqueue_and_echo_commands_P(PSTR("M27")); // force report of SD status
} }
void AnycubicTFTClass::FilamentChangeResume(){ void AnycubicTFTClass::FilamentChangeResume(){
enqueue_and_echo_commands_P(PSTR("M108")); // call M108 to break out of M600 pause enqueue_and_echo_commands_P(PSTR("M108")); // call M108 to break out of M600 pause
HOTEND_LOOP() thermalManager.reset_heater_idle_timer(e); // resume heating if timed out #ifdef ANYCUBIC_TFT_DEBUG
SERIAL_ECHOLNPGM("DEBUG: M108 called");
#endif
wait_for_heatup = false; wait_for_heatup = false;
wait_for_user = false; // remove waiting flags wait_for_user = false; // remove waiting flags
// TFTstate=ANYCUBIC_TFT_STATE_SDPRINT; card.startFileprint(); // resume with proper progress state
#ifdef ANYCUBIC_TFT_DEBUG #ifdef ANYCUBIC_TFT_DEBUG
SERIAL_ECHOLNPGM("DEBUG: M108 Resume called"); SERIAL_ECHOLNPGM("DEBUG: M108 Resume done");
#endif #endif
} }
void AnycubicTFTClass::FilamentChangePause(){ void AnycubicTFTClass::FilamentChangePause(){
PausedByFilamentChange=true;
enqueue_and_echo_commands_P(PSTR("M600")); enqueue_and_echo_commands_P(PSTR("M600"));
TFTstate=ANYCUBIC_TFT_STATE_SDPAUSE_REQ; // set TFT state to paused TFTstate=ANYCUBIC_TFT_STATE_SDPAUSE_REQ; // set TFT state to paused
#ifdef ANYCUBIC_TFT_DEBUG #ifdef ANYCUBIC_TFT_DEBUG
SERIAL_ECHOLNPGM("DEBUG: M600 Pause called"); SERIAL_ECHOLNPGM("DEBUG: M600 Pause called");
#endif #endif
}
void AnycubicTFTClass::ReheatNozzle(){
#ifdef ANYCUBIC_TFT_DEBUG
SERIAL_ECHOLNPGM("DEBUG: Send reheat M108");
#endif
enqueue_and_echo_commands_P(PSTR("M108"));
#ifdef ANYCUBIC_TFT_DEBUG
SERIAL_ECHOLNPGM("DEBUG: Resume heating");
#endif
HOTEND_LOOP() thermalManager.reset_heater_idle_timer(e); // resume heating if timed out
#ifdef ANYCUBIC_TFT_DEBUG
SERIAL_ECHOLNPGM("DEBUG: Clear flags");
#endif
nozzle_timed_out = false;
wait_for_user = false;
wait_for_heatup = false;
TFTstate=ANYCUBIC_TFT_STATE_SDPAUSE_REQ;
} }
@@ -302,10 +329,10 @@ void AnycubicTFTClass::HandleSpecialMenu()
enqueue_and_echo_commands_P(PSTR("M303 E-1 S60 C6 U1")); enqueue_and_echo_commands_P(PSTR("M303 E-1 S60 C6 U1"));
} else if (strcmp(SelectedDirectory, "<save eeprom>")==0) { } else if (strcmp(SelectedDirectory, "<save eeprom>")==0) {
SERIAL_PROTOCOLLNPGM("Special Menu: Save EEPROM"); SERIAL_PROTOCOLLNPGM("Special Menu: Save EEPROM");
enqueue_and_echo_commands_P(PSTR("M500")); enqueue_and_echo_commands_P(PSTR("M500\nM300 S1108 P105\nM300 S1661 P210"));
} else if (strcmp(SelectedDirectory, "<load fw defaults>")==0) { } else if (strcmp(SelectedDirectory, "<load fw defaults>")==0) {
SERIAL_PROTOCOLLNPGM("Special Menu: Load FW Defaults"); SERIAL_PROTOCOLLNPGM("Special Menu: Load FW Defaults");
enqueue_and_echo_commands_P(PSTR("M502")); enqueue_and_echo_commands_P(PSTR("M502\nM300 S1661 P105\nM300 S1108 P210"));
} else if (strcmp(SelectedDirectory, "<preheat bed>")==0) { } else if (strcmp(SelectedDirectory, "<preheat bed>")==0) {
SERIAL_PROTOCOLLNPGM("Special Menu: Preheat Bed"); SERIAL_PROTOCOLLNPGM("Special Menu: Preheat Bed");
enqueue_and_echo_commands_P(PSTR("M140 S60")); enqueue_and_echo_commands_P(PSTR("M140 S60"));
@@ -329,7 +356,6 @@ void AnycubicTFTClass::HandleSpecialMenu()
enqueue_and_echo_commands_P(PSTR("G91\nG1 Z-0.1\nG90")); enqueue_and_echo_commands_P(PSTR("G91\nG1 Z-0.1\nG90"));
} else if (strcmp(SelectedDirectory, "<filamentchange pause>")==0) { } else if (strcmp(SelectedDirectory, "<filamentchange pause>")==0) {
SERIAL_PROTOCOLLNPGM("Special Menu: FilamentChange Pause"); SERIAL_PROTOCOLLNPGM("Special Menu: FilamentChange Pause");
PausedByFilamentChange=true;
FilamentChangePause(); FilamentChangePause();
} else if (strcmp(SelectedDirectory, "<filamentchange resume>")==0) { } else if (strcmp(SelectedDirectory, "<filamentchange resume>")==0) {
SERIAL_PROTOCOLLNPGM("Special Menu: FilamentChange Resume"); SERIAL_PROTOCOLLNPGM("Special Menu: FilamentChange Resume");
@@ -387,7 +413,7 @@ void AnycubicTFTClass::Ls()
break; break;
} }
} }
#ifdef SDSUPPORT #ifdef SDSUPPORT
else if(card.cardOK) else if(card.cardOK)
{ {
uint16_t cnt=filenumber; uint16_t cnt=filenumber;
@@ -418,7 +444,7 @@ void AnycubicTFTClass::Ls()
} }
} else { } else {
card.getfilename(cnt-1); card.getfilename(cnt-1);
// card.getfilename(cnt); // card.getfilename(cnt);
if(card.filenameIsDir) { if(card.filenameIsDir) {
ANYCUBIC_SERIAL_PROTOCOLPGM("/"); ANYCUBIC_SERIAL_PROTOCOLPGM("/");
@@ -437,7 +463,7 @@ void AnycubicTFTClass::Ls()
} }
} }
} }
#endif #endif
else { else {
ANYCUBIC_SERIAL_PROTOCOLLNPGM("<Special_Menu>"); ANYCUBIC_SERIAL_PROTOCOLLNPGM("<Special_Menu>");
ANYCUBIC_SERIAL_PROTOCOLLNPGM("<Special_Menu>"); ANYCUBIC_SERIAL_PROTOCOLLNPGM("<Special_Menu>");
@@ -446,7 +472,7 @@ void AnycubicTFTClass::Ls()
void AnycubicTFTClass::CheckSDCardChange() void AnycubicTFTClass::CheckSDCardChange()
{ {
#ifdef SDSUPPORT #ifdef SDSUPPORT
if (LastSDstatus != IS_SD_INSERTED()) if (LastSDstatus != IS_SD_INSERTED())
{ {
LastSDstatus = IS_SD_INSERTED(); LastSDstatus = IS_SD_INSERTED();
@@ -456,21 +482,21 @@ void AnycubicTFTClass::CheckSDCardChange()
card.initsd(); card.initsd();
ANYCUBIC_SERIAL_PROTOCOLPGM("J00"); // J00 SD Card inserted ANYCUBIC_SERIAL_PROTOCOLPGM("J00"); // J00 SD Card inserted
ANYCUBIC_SERIAL_ENTER(); ANYCUBIC_SERIAL_ENTER();
#ifdef ANYCUBIC_TFT_DEBUG #ifdef ANYCUBIC_TFT_DEBUG
SERIAL_ECHOLNPGM("TFT Serial Debug: SD card inserted... J00"); SERIAL_ECHOLNPGM("TFT Serial Debug: SD card inserted... J00");
#endif #endif
} }
else else
{ {
ANYCUBIC_SERIAL_PROTOCOLPGM("J01"); // J01 SD Card removed ANYCUBIC_SERIAL_PROTOCOLPGM("J01"); // J01 SD Card removed
ANYCUBIC_SERIAL_ENTER(); ANYCUBIC_SERIAL_ENTER();
#ifdef ANYCUBIC_TFT_DEBUG #ifdef ANYCUBIC_TFT_DEBUG
SERIAL_ECHOLNPGM("TFT Serial Debug: SD card removed... J01"); SERIAL_ECHOLNPGM("TFT Serial Debug: SD card removed... J01");
#endif #endif
} }
} }
#endif #endif
} }
void AnycubicTFTClass::CheckHeaterError() void AnycubicTFTClass::CheckHeaterError()
@@ -482,9 +508,9 @@ void AnycubicTFTClass::CheckHeaterError()
HeaterCheckCount = 0; HeaterCheckCount = 0;
ANYCUBIC_SERIAL_PROTOCOLPGM("J10"); // J10 Hotend temperature abnormal ANYCUBIC_SERIAL_PROTOCOLPGM("J10"); // J10 Hotend temperature abnormal
ANYCUBIC_SERIAL_ENTER(); ANYCUBIC_SERIAL_ENTER();
#ifdef ANYCUBIC_TFT_DEBUG #ifdef ANYCUBIC_TFT_DEBUG
SERIAL_ECHOLNPGM("TFT Serial Debug: Hotend temperature abnormal... J20"); SERIAL_ECHOLNPGM("TFT Serial Debug: Hotend temperature abnormal... J20");
#endif #endif
} }
else else
@@ -502,17 +528,17 @@ 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();
// --> Send print info to display... most probably print started via gcode // --> Send print info to display... most probably print started via gcode
} }
#endif #endif
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()) {
@@ -523,32 +549,32 @@ void AnycubicTFTClass::StateHandler()
TFTstate=ANYCUBIC_TFT_STATE_IDLE; TFTstate=ANYCUBIC_TFT_STATE_IDLE;
ANYCUBIC_SERIAL_PROTOCOLPGM("J14");// J14 print done ANYCUBIC_SERIAL_PROTOCOLPGM("J14");// J14 print done
ANYCUBIC_SERIAL_ENTER(); ANYCUBIC_SERIAL_ENTER();
#ifdef ANYCUBIC_TFT_DEBUG #ifdef ANYCUBIC_TFT_DEBUG
SERIAL_ECHOLNPGM("TFT Serial Debug: SD print done... J14"); SERIAL_ECHOLNPGM("TFT Serial Debug: SD print done... J14");
#endif #endif
} }
} }
#endif #endif
break; break;
case ANYCUBIC_TFT_STATE_SDPAUSE: case ANYCUBIC_TFT_STATE_SDPAUSE:
break; break;
case ANYCUBIC_TFT_STATE_SDPAUSE_OOF: case ANYCUBIC_TFT_STATE_SDPAUSE_OOF:
#ifdef ANYCUBIC_FILAMENT_RUNOUT_SENSOR #ifdef ANYCUBIC_FILAMENT_RUNOUT_SENSOR
if(!FilamentTestStatus) { if(!FilamentTestStatus) {
// We got filament again // We got filament again
TFTstate=ANYCUBIC_TFT_STATE_SDPAUSE; TFTstate=ANYCUBIC_TFT_STATE_SDPAUSE;
} }
#endif #endif
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
if((!PausedByRunout) && (!PausedByFilamentChange)) if((!PausedByRunout) && (!PausedByFilamentChange) && (!PausedByNozzleTimeout))
{ {
#ifdef ANYCUBIC_TFT_DEBUG #ifdef ANYCUBIC_TFT_DEBUG
SERIAL_ECHOLNPGM("DEBUG: Regular Pause requested"); SERIAL_ECHOLNPGM("DEBUG: Regular Pause requested");
#endif #endif
enqueue_and_echo_commands_P(PSTR("G91")); // relative mode enqueue_and_echo_commands_P(PSTR("G91")); // relative mode
enqueue_and_echo_commands_P(PSTR("G1 E-2 F1800")); // retract 2mm enqueue_and_echo_commands_P(PSTR("G1 E-2 F1800")); // retract 2mm
enqueue_and_echo_commands_P(PSTR("G1 Z10 F240")); // lift nozzle by 10mm enqueue_and_echo_commands_P(PSTR("G1 Z10 F240")); // lift nozzle by 10mm
@@ -564,34 +590,34 @@ void AnycubicTFTClass::StateHandler()
SERIAL_ECHOLNPGM("DEBUG: Filament runout - Retract, beep and park."); SERIAL_ECHOLNPGM("DEBUG: Filament runout - Retract, beep and park.");
#endif #endif
} }
#ifdef ANYCUBIC_FILAMENT_RUNOUT_SENSOR #ifdef ANYCUBIC_FILAMENT_RUNOUT_SENSOR
if(FilamentTestStatus) { if(FilamentTestStatus) {
TFTstate=ANYCUBIC_TFT_STATE_SDPAUSE; TFTstate=ANYCUBIC_TFT_STATE_SDPAUSE;
} else { } else {
// Pause because of "out of filament" // Pause because of "out of filament"
TFTstate=ANYCUBIC_TFT_STATE_SDPAUSE_OOF; TFTstate=ANYCUBIC_TFT_STATE_SDPAUSE_OOF;
} }
#endif #endif
ANYCUBIC_SERIAL_PROTOCOLPGM("J18");// J18 pausing print done ANYCUBIC_SERIAL_PROTOCOLPGM("J18");// J18 pausing print done
ANYCUBIC_SERIAL_ENTER(); ANYCUBIC_SERIAL_ENTER();
#ifdef ANYCUBIC_TFT_DEBUG #ifdef ANYCUBIC_TFT_DEBUG
SERIAL_ECHOLNPGM("TFT Serial Debug: SD print paused done... J18"); SERIAL_ECHOLNPGM("TFT Serial Debug: SD print paused done... J18");
#endif #endif
} }
#endif #endif
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
enqueue_and_echo_commands_P(PSTR("M84")); enqueue_and_echo_commands_P(PSTR("M84"));
} }
#endif #endif
break; break;
default: default:
break; break;
@@ -600,47 +626,62 @@ void AnycubicTFTClass::StateHandler()
void AnycubicTFTClass::FilamentRunout() void AnycubicTFTClass::FilamentRunout()
{ {
#if ENABLED(ANYCUBIC_FILAMENT_RUNOUT_SENSOR) #if ENABLED(ANYCUBIC_FILAMENT_RUNOUT_SENSOR)
FilamentTestStatus=READ(FIL_RUNOUT_PIN)&0xff; FilamentTestStatus=READ(FIL_RUNOUT_PIN)&0xff;
if(FilamentTestStatus>FilamentTestLastStatus) if(FilamentTestStatus>FilamentTestLastStatus)
{ {
FilamentRunoutCounter++; // something changed! save current timestamp.
if(FilamentRunoutCounter>=15800) const millis_t fil_ms = millis();
{ static millis_t fil_delay;
FilamentRunoutCounter=0;
#ifdef SDSUPPORT // since this is inside a loop, only set delay time once
if (FilamentSetMillis){
#ifdef ANYCUBIC_TFT_DEBUG
SERIAL_ECHOLNPGM("DEBUG: Set filament trigger time");
#endif
// set the delayed timestamp to 3000ms later
fil_delay = fil_ms + 3000UL;
// this doesn't need to run until the filament is recovered again
FilamentSetMillis=false;
}
// have three seconds passed?
if ((FilamentTestStatus>FilamentTestLastStatus) && (fil_ms>fil_delay)) {
#ifdef ANYCUBIC_TFT_DEBUG
SERIAL_ECHOLNPGM("DEBUG: 3000ms delay done");
#endif
#ifdef SDSUPPORT
if((card.sdprinting==true)) if((card.sdprinting==true))
{ {
PausedByRunout=true; // set runout pause flag PausedByRunout=true; // set runout pause flag
#ifdef ANYCUBIC_TFT_DEBUG #ifdef ANYCUBIC_TFT_DEBUG
SERIAL_ECHOLNPGM("DEBUG: Filament Pause Flag set"); SERIAL_ECHOLNPGM("DEBUG: Filament Pause Flag set");
#endif #endif
PausePrint(); PausePrint();
} }
else if((card.sdprinting==false)) else if((card.sdprinting==false))
{ {
#endif
ANYCUBIC_SERIAL_PROTOCOLPGM("J15"); //J15 FILAMENT LACK ANYCUBIC_SERIAL_PROTOCOLPGM("J15"); //J15 FILAMENT LACK
ANYCUBIC_SERIAL_ENTER(); ANYCUBIC_SERIAL_ENTER();
#ifdef ANYCUBIC_TFT_DEBUG #ifdef ANYCUBIC_TFT_DEBUG
SERIAL_ECHOLNPGM("TFT Serial Debug: Filament runout... J15"); SERIAL_ECHOLNPGM("TFT Serial Debug: Filament runout... J15");
#endif #endif
#ifdef SDSUPPORT
}
#endif
FilamentTestLastStatus=FilamentTestStatus; FilamentTestLastStatus=FilamentTestStatus;
} }
#endif
}
} }
else if(FilamentTestStatus!=FilamentTestLastStatus) else if(FilamentTestStatus!=FilamentTestLastStatus)
{ {
FilamentRunoutCounter=0; // set the timestamps on the next loop again
FilamentSetMillis=true;
FilamentTestLastStatus=FilamentTestStatus; FilamentTestLastStatus=FilamentTestStatus;
#ifdef ANYCUBIC_TFT_DEBUG #ifdef ANYCUBIC_TFT_DEBUG
SERIAL_ECHOLNPGM("TFT Serial Debug: Filament runout recovered"); SERIAL_ECHOLNPGM("TFT Serial Debug: Filament runout recovered");
#endif #endif
} }
#endif #endif
} }
void AnycubicTFTClass::GetCommandFromTFT() void AnycubicTFTClass::GetCommandFromTFT()
@@ -665,10 +706,10 @@ void AnycubicTFTClass::GetCommandFromTFT()
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))));
#ifdef ANYCUBIC_TFT_DEBUG #ifdef ANYCUBIC_TFT_DEBUG
if ((a_command>7) && (a_command != 20)) // No debugging of status polls, please! if ((a_command>7) && (a_command != 20)) // No debugging of status polls, please!
SERIAL_ECHOLNPAIR("TFT Serial Command: ", TFTcmdbuffer[TFTbufindw]); SERIAL_ECHOLNPAIR("TFT Serial Command: ", TFTcmdbuffer[TFTbufindw]);
#endif #endif
switch(a_command) { switch(a_command) {
@@ -723,7 +764,7 @@ void AnycubicTFTClass::GetCommandFromTFT()
ANYCUBIC_SERIAL_ENTER(); ANYCUBIC_SERIAL_ENTER();
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)
@@ -738,7 +779,7 @@ void AnycubicTFTClass::GetCommandFromTFT()
else else
ANYCUBIC_SERIAL_PROTOCOLPGM("A6V ---"); ANYCUBIC_SERIAL_PROTOCOLPGM("A6V ---");
ANYCUBIC_SERIAL_ENTER(); ANYCUBIC_SERIAL_ENTER();
#endif #endif
break; break;
case 7://A7 GET PRINTING TIME case 7://A7 GET PRINTING TIME
{ {
@@ -762,7 +803,7 @@ void AnycubicTFTClass::GetCommandFromTFT()
break; break;
} }
case 8: // A8 GET SD LIST case 8: // A8 GET SD LIST
#ifdef SDSUPPORT #ifdef SDSUPPORT
SelectedDirectory[0]=0; SelectedDirectory[0]=0;
if(!IS_SD_INSERTED()) if(!IS_SD_INSERTED())
{ {
@@ -780,10 +821,10 @@ void AnycubicTFTClass::GetCommandFromTFT()
ANYCUBIC_SERIAL_PROTOCOLPGM("END"); // Filelist stop ANYCUBIC_SERIAL_PROTOCOLPGM("END"); // Filelist stop
ANYCUBIC_SERIAL_ENTER(); ANYCUBIC_SERIAL_ENTER();
} }
#endif #endif
break; break;
case 9: // A9 pause sd print case 9: // A9 pause sd print
#ifdef SDSUPPORT #ifdef SDSUPPORT
if(card.sdprinting) if(card.sdprinting)
{ {
PausePrint(); PausePrint();
@@ -792,34 +833,37 @@ void AnycubicTFTClass::GetCommandFromTFT()
{ {
StopPrint(); StopPrint();
} }
#endif #endif
break; break;
case 10: // A10 resume sd print case 10: // A10 resume sd print
#ifdef SDSUPPORT #ifdef SDSUPPORT
if((TFTstate==ANYCUBIC_TFT_STATE_SDPAUSE) || (TFTstate==ANYCUBIC_TFT_STATE_SDOUTAGE)) if((TFTstate==ANYCUBIC_TFT_STATE_SDPAUSE) || (TFTstate==ANYCUBIC_TFT_STATE_SDOUTAGE))
{ {
StartPrint(); StartPrint();
ANYCUBIC_SERIAL_PROTOCOLPGM("J04");// J04 printing form sd card now ANYCUBIC_SERIAL_PROTOCOLPGM("J04");// J04 printing form sd card now
ANYCUBIC_SERIAL_ENTER(); ANYCUBIC_SERIAL_ENTER();
#ifdef ANYCUBIC_TFT_DEBUG #ifdef ANYCUBIC_TFT_DEBUG
SERIAL_ECHOLNPGM("TFT Serial Debug: SD print started... J04"); SERIAL_ECHOLNPGM("TFT Serial Debug: SD print started... J04");
#endif #endif
} }
#endif if (nozzle_timed_out) {
ReheatNozzle();
}
#endif
break; break;
case 11: // A11 STOP SD PRINT case 11: // A11 STOP SD PRINT
#ifdef SDSUPPORT #ifdef SDSUPPORT
if((card.sdprinting) || (TFTstate==ANYCUBIC_TFT_STATE_SDOUTAGE)) if((card.sdprinting) || (TFTstate==ANYCUBIC_TFT_STATE_SDOUTAGE))
{ {
StopPrint(); StopPrint();
} }
#endif #endif
break; break;
case 12: // A12 kill case 12: // A12 kill
kill(PSTR(MSG_KILLED)); kill(PSTR(MSG_KILLED));
break; break;
case 13: // A13 SELECTION FILE case 13: // A13 SELECTION FILE
#ifdef SDSUPPORT #ifdef SDSUPPORT
//if((!planner.movesplanned()) && (TFTstate!=ANYCUBIC_TFT_STATE_SDPAUSE) && (TFTstate!=ANYCUBIC_TFT_STATE_SDOUTAGE)) //if((!planner.movesplanned()) && (TFTstate!=ANYCUBIC_TFT_STATE_SDPAUSE) && (TFTstate!=ANYCUBIC_TFT_STATE_SDOUTAGE))
if((TFTstate!=ANYCUBIC_TFT_STATE_SDOUTAGE)) // allow special menu to be used while printing from USB if((TFTstate!=ANYCUBIC_TFT_STATE_SDOUTAGE)) // allow special menu to be used while printing from USB
{ {
@@ -837,36 +881,36 @@ void AnycubicTFTClass::GetCommandFromTFT()
if (card.isFileOpen()) { if (card.isFileOpen()) {
ANYCUBIC_SERIAL_PROTOCOLPGM("J20"); // J20 Open successful ANYCUBIC_SERIAL_PROTOCOLPGM("J20"); // J20 Open successful
ANYCUBIC_SERIAL_ENTER(); ANYCUBIC_SERIAL_ENTER();
#ifdef ANYCUBIC_TFT_DEBUG #ifdef ANYCUBIC_TFT_DEBUG
SERIAL_ECHOLNPGM("TFT Serial Debug: File open successful... J20"); SERIAL_ECHOLNPGM("TFT Serial Debug: File open successful... J20");
#endif #endif
} else { } else {
ANYCUBIC_SERIAL_PROTOCOLPGM("J21"); // J21 Open failed ANYCUBIC_SERIAL_PROTOCOLPGM("J21"); // J21 Open failed
ANYCUBIC_SERIAL_ENTER(); ANYCUBIC_SERIAL_ENTER();
#ifdef ANYCUBIC_TFT_DEBUG #ifdef ANYCUBIC_TFT_DEBUG
SERIAL_ECHOLNPGM("TFT Serial Debug: File open failed... J21"); SERIAL_ECHOLNPGM("TFT Serial Debug: File open failed... J21");
#endif #endif
} }
} }
ANYCUBIC_SERIAL_ENTER(); ANYCUBIC_SERIAL_ENTER();
} }
#endif #endif
break; break;
case 14: // A14 START PRINTING case 14: // A14 START PRINTING
#ifdef SDSUPPORT #ifdef SDSUPPORT
if((!planner.movesplanned()) && (TFTstate!=ANYCUBIC_TFT_STATE_SDPAUSE) && (TFTstate!=ANYCUBIC_TFT_STATE_SDOUTAGE) && (card.isFileOpen())) if((!planner.movesplanned()) && (TFTstate!=ANYCUBIC_TFT_STATE_SDPAUSE) && (TFTstate!=ANYCUBIC_TFT_STATE_SDOUTAGE) && (card.isFileOpen()))
{ {
StartPrint(); StartPrint();
ANYCUBIC_SERIAL_PROTOCOLPGM("J04"); // J04 Starting Print ANYCUBIC_SERIAL_PROTOCOLPGM("J04"); // J04 Starting Print
ANYCUBIC_SERIAL_ENTER(); ANYCUBIC_SERIAL_ENTER();
#ifdef ANYCUBIC_TFT_DEBUG #ifdef ANYCUBIC_TFT_DEBUG
SERIAL_ECHOLNPGM("TFT Serial Debug: Starting SD Print... J04"); SERIAL_ECHOLNPGM("TFT Serial Debug: Starting SD Print... J04");
#endif #endif
} }
#endif #endif
break; break;
case 15: // A15 RESUMING FROM OUTAGE case 15: // A15 RESUMING FROM OUTAGE
// if((!planner.movesplanned())&&(!TFTresumingflag)) //if((!planner.movesplanned())&&(!TFTresumingflag))
// { // {
// if(card.cardOK) // if(card.cardOK)
// FlagResumFromOutage=true; // FlagResumFromOutage=true;
@@ -875,7 +919,7 @@ void AnycubicTFTClass::GetCommandFromTFT()
// starttime=millis(); // starttime=millis();
// ANYCUBIC_SERIAL_SUCC_START; // ANYCUBIC_SERIAL_SUCC_START;
// } // }
// ANYCUBIC_SERIAL_ENTER(); //ANYCUBIC_SERIAL_ENTER();
break; break;
case 16: // A16 set hotend temp case 16: // A16 set hotend temp
{ {
@@ -916,9 +960,9 @@ void AnycubicTFTClass::GetCommandFromTFT()
break; break;
case 19: // A19 stop stepper drivers case 19: // A19 stop stepper drivers
if((!planner.movesplanned()) if((!planner.movesplanned())
#ifdef SDSUPPORT #ifdef SDSUPPORT
&&(!card.sdprinting) &&(!card.sdprinting)
#endif #endif
) )
{ {
quickstop_stepper(); quickstop_stepper();
@@ -1028,13 +1072,13 @@ void AnycubicTFTClass::GetCommandFromTFT()
thermalManager.setTargetBed(0); thermalManager.setTargetBed(0);
ANYCUBIC_SERIAL_PROTOCOLPGM("J12"); // J12 cool down ANYCUBIC_SERIAL_PROTOCOLPGM("J12"); // J12 cool down
ANYCUBIC_SERIAL_ENTER(); ANYCUBIC_SERIAL_ENTER();
#ifdef ANYCUBIC_TFT_DEBUG #ifdef ANYCUBIC_TFT_DEBUG
SERIAL_ECHOLNPGM("TFT Serial Debug: Cooling down... J12"); SERIAL_ECHOLNPGM("TFT Serial Debug: Cooling down... J12");
#endif #endif
} }
break; break;
case 26: // A26 refresh SD case 26: // A26 refresh SD
#ifdef SDSUPPORT #ifdef SDSUPPORT
if (SelectedDirectory[0]==0) { if (SelectedDirectory[0]==0) {
card.initsd(); card.initsd();
} else { } else {
@@ -1055,16 +1099,16 @@ void AnycubicTFTClass::GetCommandFromTFT()
{ {
ANYCUBIC_SERIAL_PROTOCOLPGM("J02"); // J02 SD Card initilized ANYCUBIC_SERIAL_PROTOCOLPGM("J02"); // J02 SD Card initilized
ANYCUBIC_SERIAL_ENTER(); ANYCUBIC_SERIAL_ENTER();
#ifdef ANYCUBIC_TFT_DEBUG #ifdef ANYCUBIC_TFT_DEBUG
SERIAL_ECHOLNPGM("TFT Serial Debug: SD card initialized... J02"); SERIAL_ECHOLNPGM("TFT Serial Debug: SD card initialized... J02");
#endif #endif
} }
#endif #endif
break; break;
#ifdef SERVO_ENDSTOPS #ifdef SERVO_ENDSTOPS
case 27: // A27 servos angles adjust case 27: // A27 servos angles adjust
break; break;
#endif #endif
case 28: // A28 filament test case 28: // A28 filament test
{ {
if(CodeSeen('O')); if(CodeSeen('O'));
@@ -1077,49 +1121,49 @@ void AnycubicTFTClass::GetCommandFromTFT()
case 30: // A30 assist leveling, the original function was canceled case 30: // A30 assist leveling, the original function was canceled
if(CodeSeen('S')) { if(CodeSeen('S')) {
#ifdef ANYCUBIC_TFT_DEBUG #ifdef ANYCUBIC_TFT_DEBUG
SERIAL_ECHOLNPGM("TFT Entering level menue..."); SERIAL_ECHOLNPGM("TFT Entering level menue...");
#endif #endif
} else if(CodeSeen('O')) { } else if(CodeSeen('O')) {
#ifdef ANYCUBIC_TFT_DEBUG #ifdef ANYCUBIC_TFT_DEBUG
SERIAL_ECHOLNPGM("TFT Leveling started and movint to front left..."); SERIAL_ECHOLNPGM("TFT Leveling started and movint to front left...");
#endif #endif
enqueue_and_echo_commands_P(PSTR("G91\nG1 Z10 F240\nG90\nG28\nG29\nG1 X20 Y20 F6000\nG1 Z0 F240")); enqueue_and_echo_commands_P(PSTR("G91\nG1 Z10 F240\nG90\nG28\nG29\nG1 X20 Y20 F6000\nG1 Z0 F240"));
} else if(CodeSeen('T')) { } else if(CodeSeen('T')) {
#ifdef ANYCUBIC_TFT_DEBUG #ifdef ANYCUBIC_TFT_DEBUG
SERIAL_ECHOLNPGM("TFT Level checkpoint front right..."); SERIAL_ECHOLNPGM("TFT Level checkpoint front right...");
#endif #endif
enqueue_and_echo_commands_P(PSTR("G1 Z5 F240\nG1 X190 Y20 F6000\nG1 Z0 F240")); enqueue_and_echo_commands_P(PSTR("G1 Z5 F240\nG1 X190 Y20 F6000\nG1 Z0 F240"));
} else if(CodeSeen('C')) { } else if(CodeSeen('C')) {
#ifdef ANYCUBIC_TFT_DEBUG #ifdef ANYCUBIC_TFT_DEBUG
SERIAL_ECHOLNPGM("TFT Level checkpoint back right..."); SERIAL_ECHOLNPGM("TFT Level checkpoint back right...");
#endif #endif
enqueue_and_echo_commands_P(PSTR("G1 Z5 F240\nG1 X190 Y190 F6000\nG1 Z0 F240")); enqueue_and_echo_commands_P(PSTR("G1 Z5 F240\nG1 X190 Y190 F6000\nG1 Z0 F240"));
} else if(CodeSeen('Q')) { } else if(CodeSeen('Q')) {
#ifdef ANYCUBIC_TFT_DEBUG #ifdef ANYCUBIC_TFT_DEBUG
SERIAL_ECHOLNPGM("TFT Level checkpoint back right..."); SERIAL_ECHOLNPGM("TFT Level checkpoint back right...");
#endif #endif
enqueue_and_echo_commands_P(PSTR("G1 Z5 F240\nG1 X190 Y20 F6000\nG1 Z0 F240")); enqueue_and_echo_commands_P(PSTR("G1 Z5 F240\nG1 X190 Y20 F6000\nG1 Z0 F240"));
} else if(CodeSeen('H')) { } else if(CodeSeen('H')) {
#ifdef ANYCUBIC_TFT_DEBUG #ifdef ANYCUBIC_TFT_DEBUG
SERIAL_ECHOLNPGM("TFT Level check no heating..."); SERIAL_ECHOLNPGM("TFT Level check no heating...");
#endif #endif
// enqueue_and_echo_commands_P(PSTR("... TBD ...")); //enqueue_and_echo_commands_P(PSTR("... TBD ..."));
ANYCUBIC_SERIAL_PROTOCOLPGM("J22"); // J22 Test print done ANYCUBIC_SERIAL_PROTOCOLPGM("J22"); // J22 Test print done
ANYCUBIC_SERIAL_ENTER(); ANYCUBIC_SERIAL_ENTER();
#ifdef ANYCUBIC_TFT_DEBUG #ifdef ANYCUBIC_TFT_DEBUG
SERIAL_ECHOLNPGM("TFT Serial Debug: Leveling print test done... J22"); SERIAL_ECHOLNPGM("TFT Serial Debug: Leveling print test done... J22");
#endif #endif
} else if(CodeSeen('L')) { } else if(CodeSeen('L')) {
#ifdef ANYCUBIC_TFT_DEBUG #ifdef ANYCUBIC_TFT_DEBUG
SERIAL_ECHOLNPGM("TFT Level check heating..."); SERIAL_ECHOLNPGM("TFT Level check heating...");
#endif #endif
// enqueue_and_echo_commands_P(PSTR("... TBD ...")); //enqueue_and_echo_commands_P(PSTR("... TBD ..."));
ANYCUBIC_SERIAL_PROTOCOLPGM("J22"); // J22 Test print done ANYCUBIC_SERIAL_PROTOCOLPGM("J22"); // J22 Test print done
ANYCUBIC_SERIAL_ENTER(); ANYCUBIC_SERIAL_ENTER();
#ifdef ANYCUBIC_TFT_DEBUG #ifdef ANYCUBIC_TFT_DEBUG
SERIAL_ECHOLNPGM("TFT Serial Debug: Leveling print test with heating done... J22"); SERIAL_ECHOLNPGM("TFT Serial Debug: Leveling print test with heating done... J22");
#endif #endif
} }
ANYCUBIC_SERIAL_SUCC_START; ANYCUBIC_SERIAL_SUCC_START;
ANYCUBIC_SERIAL_ENTER(); ANYCUBIC_SERIAL_ENTER();
@@ -1128,7 +1172,7 @@ void AnycubicTFTClass::GetCommandFromTFT()
case 31: // A31 zoffset case 31: // A31 zoffset
if((!planner.movesplanned())&&(TFTstate!=ANYCUBIC_TFT_STATE_SDPAUSE) && (TFTstate!=ANYCUBIC_TFT_STATE_SDOUTAGE)) if((!planner.movesplanned())&&(TFTstate!=ANYCUBIC_TFT_STATE_SDPAUSE) && (TFTstate!=ANYCUBIC_TFT_STATE_SDOUTAGE))
{ {
#if HAS_BED_PROBE #if HAS_BED_PROBE
char value[30]; char value[30];
char *s_zoffset; char *s_zoffset;
//if((current_position[Z_AXIS]<10)) //if((current_position[Z_AXIS]<10))
@@ -1138,12 +1182,12 @@ void AnycubicTFTClass::GetCommandFromTFT()
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();
#ifdef ANYCUBIC_TFT_DEBUG #ifdef ANYCUBIC_TFT_DEBUG
SERIAL_ECHOPGM("TFT sending current z-probe offset data... <"); SERIAL_ECHOPGM("TFT sending current z-probe offset data... <");
SERIAL_ECHOPGM("A9V "); SERIAL_ECHOPGM("A9V ");
SERIAL_ECHO(itostr3(int(zprobe_zoffset*100.00 + 0.5))); SERIAL_ECHO(itostr3(int(zprobe_zoffset*100.00 + 0.5)));
SERIAL_ECHOLNPGM(">"); SERIAL_ECHOLNPGM(">");
#endif #endif
} }
if(CodeSeen('D')) if(CodeSeen('D'))
{ {
@@ -1153,15 +1197,15 @@ void AnycubicTFTClass::GetCommandFromTFT()
enqueue_and_echo_command(value); // Apply Z-Probe offset enqueue_and_echo_command(value); // Apply Z-Probe offset
enqueue_and_echo_commands_P(PSTR("M500")); // Save to EEPROM enqueue_and_echo_commands_P(PSTR("M500")); // Save to EEPROM
} }
#endif #endif
} }
ANYCUBIC_SERIAL_ENTER(); ANYCUBIC_SERIAL_ENTER();
break; break;
case 32: // A32 clean leveling beep flag case 32: // A32 clean leveling beep flag
if(CodeSeen('S')) { if(CodeSeen('S')) {
#ifdef ANYCUBIC_TFT_DEBUG #ifdef ANYCUBIC_TFT_DEBUG
SERIAL_ECHOLNPGM("TFT Level saving data..."); SERIAL_ECHOLNPGM("TFT Level saving data...");
#endif #endif
enqueue_and_echo_commands_P(PSTR("M500\nM420 S1\nG1 Z10 F240\nG1 X0 Y0 F6000")); enqueue_and_echo_commands_P(PSTR("M500\nM420 S1\nG1 Z10 F240\nG1 X0 Y0 F6000"));
ANYCUBIC_SERIAL_SUCC_START; ANYCUBIC_SERIAL_SUCC_START;
ANYCUBIC_SERIAL_ENTER(); ANYCUBIC_SERIAL_ENTER();
@@ -1207,26 +1251,26 @@ void AnycubicTFTClass::HeatingStart()
{ {
ANYCUBIC_SERIAL_PROTOCOLPGM("J06"); // J07 hotend heating start ANYCUBIC_SERIAL_PROTOCOLPGM("J06"); // J07 hotend heating start
ANYCUBIC_SERIAL_ENTER(); ANYCUBIC_SERIAL_ENTER();
#ifdef ANYCUBIC_TFT_DEBUG #ifdef ANYCUBIC_TFT_DEBUG
SERIAL_ECHOLNPGM("TFT Serial Debug: Nozzle is heating... J06"); SERIAL_ECHOLNPGM("TFT Serial Debug: Nozzle is heating... J06");
#endif #endif
} }
void AnycubicTFTClass::HeatingDone() void AnycubicTFTClass::HeatingDone()
{ {
ANYCUBIC_SERIAL_PROTOCOLPGM("J07"); // J07 hotend heating done ANYCUBIC_SERIAL_PROTOCOLPGM("J07"); // J07 hotend heating done
ANYCUBIC_SERIAL_ENTER(); ANYCUBIC_SERIAL_ENTER();
#ifdef ANYCUBIC_TFT_DEBUG #ifdef ANYCUBIC_TFT_DEBUG
SERIAL_ECHOLNPGM("TFT Serial Debug: Nozzle heating is done... J07"); SERIAL_ECHOLNPGM("TFT Serial Debug: Nozzle heating is done... J07");
#endif #endif
if(TFTstate==ANYCUBIC_TFT_STATE_SDPRINT) if(TFTstate==ANYCUBIC_TFT_STATE_SDPRINT)
{ {
ANYCUBIC_SERIAL_PROTOCOLPGM("J04"); // J04 printing from sd card ANYCUBIC_SERIAL_PROTOCOLPGM("J04"); // J04 printing from sd card
ANYCUBIC_SERIAL_ENTER(); ANYCUBIC_SERIAL_ENTER();
#ifdef ANYCUBIC_TFT_DEBUG #ifdef ANYCUBIC_TFT_DEBUG
SERIAL_ECHOLNPGM("TFT Serial Debug: Continuing SD print after heating... J04"); SERIAL_ECHOLNPGM("TFT Serial Debug: Continuing SD print after heating... J04");
#endif #endif
} }
} }
@@ -1234,18 +1278,18 @@ void AnycubicTFTClass::BedHeatingStart()
{ {
ANYCUBIC_SERIAL_PROTOCOLPGM("J08"); // J08 hotbed heating start ANYCUBIC_SERIAL_PROTOCOLPGM("J08"); // J08 hotbed heating start
ANYCUBIC_SERIAL_ENTER(); ANYCUBIC_SERIAL_ENTER();
#ifdef ANYCUBIC_TFT_DEBUG #ifdef ANYCUBIC_TFT_DEBUG
SERIAL_ECHOLNPGM("TFT Serial Debug: Bed is heating... J08"); SERIAL_ECHOLNPGM("TFT Serial Debug: Bed is heating... J08");
#endif #endif
} }
void AnycubicTFTClass::BedHeatingDone() void AnycubicTFTClass::BedHeatingDone()
{ {
ANYCUBIC_SERIAL_PROTOCOLPGM("J09"); // J09 hotbed heating done ANYCUBIC_SERIAL_PROTOCOLPGM("J09"); // J09 hotbed heating done
ANYCUBIC_SERIAL_ENTER(); ANYCUBIC_SERIAL_ENTER();
#ifdef ANYCUBIC_TFT_DEBUG #ifdef ANYCUBIC_TFT_DEBUG
SERIAL_ECHOLNPGM("TFT Serial Debug: Bed heating is done... J09"); SERIAL_ECHOLNPGM("TFT Serial Debug: Bed heating is done... J09");
#endif #endif
} }

View File

@@ -58,6 +58,7 @@ public:
char TFTstate=ANYCUBIC_TFT_STATE_IDLE; char TFTstate=ANYCUBIC_TFT_STATE_IDLE;
bool PausedByRunout=false; bool PausedByRunout=false;
bool PausedByFilamentChange=false; bool PausedByFilamentChange=false;
bool PausedByNozzleTimeout=false;
private: private:
char TFTcmdbuffer[TFTBUFSIZE][TFT_MAX_CMD_SIZE]; char TFTcmdbuffer[TFTBUFSIZE][TFT_MAX_CMD_SIZE];
@@ -100,6 +101,7 @@ private:
void HandleSpecialMenu(); void HandleSpecialMenu();
void FilamentChangePause(); void FilamentChangePause();
void FilamentChangeResume(); void FilamentChangeResume();
void ReheatNozzle();
char SelectedDirectory[30]; char SelectedDirectory[30];
uint8_t SpecialMenu=false; uint8_t SpecialMenu=false;
@@ -107,7 +109,8 @@ private:
#if ENABLED(ANYCUBIC_FILAMENT_RUNOUT_SENSOR) #if ENABLED(ANYCUBIC_FILAMENT_RUNOUT_SENSOR)
char FilamentTestStatus=false; char FilamentTestStatus=false;
char FilamentTestLastStatus=false; char FilamentTestLastStatus=false;
long FilamentRunoutCounter=0; bool FilamentSetMillis=true;
#endif #endif
}; };

View File

@@ -81,10 +81,10 @@
// User-specified version info of this build to display in [Pronterface, etc] terminal window during // User-specified version info of this build to display in [Pronterface, etc] terminal window during
// startup. Implementation of an idea by Prof Braino to inform user that any changes made to this // startup. Implementation of an idea by Prof Braino to inform user that any changes made to this
// build by the user have been successfully uploaded into firmware. // build by the user have been successfully uploaded into firmware.
#define STRING_CONFIG_H_AUTHOR "davidramiro - v1.4.0" // Who made the changes. #define STRING_CONFIG_H_AUTHOR "(davidramiro)" // Who made the changes.
#define SHOW_BOOTSCREEN #define SHOW_BOOTSCREEN
#define STRING_SPLASH_LINE1 SHORT_BUILD_VERSION // will be shown during bootup in line 1 #define STRING_SPLASH_LINE1 SHORT_BUILD_VERSION // will be shown during bootup in line 1
#define STRING_SPLASH_LINE2 WEBSITE_URL // will be shown during bootup in line 2 #define STRING_SPLASH_LINE2 CUSTOM_BUILD_VERSION // will be shown during bootup in line 2
/** /**
* *** VENDORS PLEASE READ *** * *** VENDORS PLEASE READ ***

View File

@@ -1009,7 +1009,7 @@
#define FILAMENT_UNLOAD_DELAY 5000 // (ms) Delay for the filament to cool after retract. #define FILAMENT_UNLOAD_DELAY 5000 // (ms) Delay for the filament to cool after retract.
#define FILAMENT_UNLOAD_PURGE_LENGTH 8 // (mm) An unretract is done, then this length is purged. #define FILAMENT_UNLOAD_PURGE_LENGTH 8 // (mm) An unretract is done, then this length is purged.
#define PAUSE_PARK_NOZZLE_TIMEOUT 300 // (seconds) Time limit before the nozzle is turned off for safety. #define PAUSE_PARK_NOZZLE_TIMEOUT 600 // (seconds) Time limit before the nozzle is turned off for safety.
#define FILAMENT_CHANGE_ALERT_BEEPS 10 // Number of alert beeps to play when a response is needed. #define FILAMENT_CHANGE_ALERT_BEEPS 10 // Number of alert beeps to play when a response is needed.
#define PAUSE_PARK_NO_STEPPER_TIMEOUT // Enable for XYZ steppers to stay powered on during filament change. #define PAUSE_PARK_NO_STEPPER_TIMEOUT // Enable for XYZ steppers to stay powered on during filament change.

View File

@@ -271,6 +271,9 @@ FORCE_INLINE bool all_axes_known() { return (axis_known_position & xyz_bits) ==
extern volatile bool wait_for_heatup; extern volatile bool wait_for_heatup;
// Making sure this flag can be cleared by the Anycubic display
extern volatile bool nozzle_timed_out;
#if HAS_RESUME_CONTINUE #if HAS_RESUME_CONTINUE
extern volatile bool wait_for_user; extern volatile bool wait_for_user;
#endif #endif

View File

@@ -519,6 +519,9 @@ static bool relative_mode; // = false;
// For M109 and M190, this flag may be cleared (by M108) to exit the wait loop // For M109 and M190, this flag may be cleared (by M108) to exit the wait loop
volatile bool wait_for_heatup = true; volatile bool wait_for_heatup = true;
// Making sure this flag can be cleared by the Anycubic display
volatile bool nozzle_timed_out = false;
// For M0/M1, this flag may be cleared (by M108) to exit the wait-for-user loop // For M0/M1, this flag may be cleared (by M108) to exit the wait-for-user loop
#if HAS_RESUME_CONTINUE #if HAS_RESUME_CONTINUE
volatile bool wait_for_user; // = false; volatile bool wait_for_user; // = false;
@@ -7213,7 +7216,11 @@ inline void gcode_M17() {
* Used by M125 and M600 * Used by M125 and M600
*/ */
static void wait_for_filament_reload(const int8_t max_beep_count=0) { static void wait_for_filament_reload(const int8_t max_beep_count=0) {
bool nozzle_timed_out = false; nozzle_timed_out = false;
nozzle_timed_out = false;
#ifdef ANYCUBIC_TFT_MODEL
AnycubicTFT.PausedByNozzleTimeout = false;
#endif
#if ENABLED(ULTIPANEL) #if ENABLED(ULTIPANEL)
lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_INSERT); lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_INSERT);
@@ -7246,6 +7253,14 @@ inline void gcode_M17() {
nozzle_timed_out |= thermalManager.is_heater_idle(e); nozzle_timed_out |= thermalManager.is_heater_idle(e);
if (nozzle_timed_out) { if (nozzle_timed_out) {
#ifdef ANYCUBIC_TFT_MODEL
AnycubicTFT.PausedByNozzleTimeout=true;
#ifdef ANYCUBIC_TFT_DEBUG
SERIAL_ECHOLNPGM("DEBUG: Nozzle timeout flag set");
#endif
#endif
#if ENABLED(ULTIPANEL) #if ENABLED(ULTIPANEL)
lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_CLICK_TO_HEAT_NOZZLE); lcd_advanced_pause_show_message(ADVANCED_PAUSE_MESSAGE_CLICK_TO_HEAT_NOZZLE);
#endif #endif
@@ -7287,6 +7302,9 @@ inline void gcode_M17() {
wait_for_user = true; // Wait for user to load filament wait_for_user = true; // Wait for user to load filament
nozzle_timed_out = false; nozzle_timed_out = false;
#ifdef ANYCUBIC_TFT_DEBUG
AnycubicTFT.PausedByNozzleTimeout = false;
#endif
#if HAS_BUZZER #if HAS_BUZZER
filament_change_beep(max_beep_count, true); filament_change_beep(max_beep_count, true);
@@ -7320,7 +7338,11 @@ inline void gcode_M17() {
if (!did_pause_print) return; if (!did_pause_print) return;
// Re-enable the heaters if they timed out // Re-enable the heaters if they timed out
bool nozzle_timed_out = false; nozzle_timed_out = false;
#ifdef ANYCUBIC_TFT_MODEL
AnycubicTFT.PausedByNozzleTimeout = false;
#endif
HOTEND_LOOP() { HOTEND_LOOP() {
nozzle_timed_out |= thermalManager.is_heater_idle(e); nozzle_timed_out |= thermalManager.is_heater_idle(e);
thermalManager.reset_heater_idle_timer(e); thermalManager.reset_heater_idle_timer(e);
@@ -10992,12 +11014,23 @@ inline void gcode_M502() {
* Default values are used for omitted arguments. * Default values are used for omitted arguments.
*/ */
inline void gcode_M600() { inline void gcode_M600() {
#ifdef SDSUPPORT #ifdef SDSUPPORT
if ((AnycubicTFT.TFTstate==ANYCUBIC_TFT_STATE_SDPRINT)){ if (card.sdprinting) { // are we printing from sd?
AnycubicTFT.TFTstate=ANYCUBIC_TFT_STATE_SDPAUSE_REQ; #ifdef ANYCUBIC_TFT_DEBUG
AnycubicTFT.PausedByFilamentChange=true; SERIAL_ECHOLNPGM("DEBUG: Enter M600 TFTstate routine");
#endif
AnycubicTFT.TFTstate=ANYCUBIC_TFT_STATE_SDPAUSE_REQ; // enter correct display state to show resume button
#ifdef ANYCUBIC_TFT_DEBUG
SERIAL_ECHOLNPGM("DEBUG: Set TFTstate to SDPAUSE_REQ");
#endif
AnycubicTFT.PausedByFilamentChange=true; // set flag to ensure correct resume routine gets executed
#ifdef ANYCUBIC_TFT_DEBUG
SERIAL_ECHOLNPGM("DEBUG: Set filament change flag");
#endif
} }
#endif #endif
point_t park_point = NOZZLE_PARK_POINT; point_t park_point = NOZZLE_PARK_POINT;
if (get_target_extruder_from_command(600)) return; if (get_target_extruder_from_command(600)) return;
@@ -15132,6 +15165,9 @@ void setup() {
SERIAL_ECHOPGM(MSG_MARLIN); SERIAL_ECHOPGM(MSG_MARLIN);
SERIAL_CHAR(' '); SERIAL_CHAR(' ');
SERIAL_ECHOLNPGM(SHORT_BUILD_VERSION); SERIAL_ECHOLNPGM(SHORT_BUILD_VERSION);
SERIAL_ECHOPGM(MSG_MARLIN_AI3M);
SERIAL_CHAR(' ');
SERIAL_ECHOLNPGM(CUSTOM_BUILD_VERSION);
SERIAL_EOL(); SERIAL_EOL();
#if defined(STRING_DISTRIBUTION_DATE) && defined(STRING_CONFIG_H_AUTHOR) #if defined(STRING_DISTRIBUTION_DATE) && defined(STRING_CONFIG_H_AUTHOR)

View File

@@ -37,18 +37,24 @@
*/ */
#define SHORT_BUILD_VERSION "1.1.9" #define SHORT_BUILD_VERSION "1.1.9"
/**
* Defines the version of the Marlin-AI3M build. Not to be confused with
* Marlin's own build number, e.g. 1.1.9.
*/
#define CUSTOM_BUILD_VERSION "v1.4.3"
/** /**
* Verbose version identifier which should contain a reference to the location * Verbose version identifier which should contain a reference to the location
* from where the binary was downloaded or the source code was compiled. * from where the binary was downloaded or the source code was compiled.
*/ */
#define DETAILED_BUILD_VERSION SHORT_BUILD_VERSION " (Github, davidramiro)" #define DETAILED_BUILD_VERSION SHORT_BUILD_VERSION "(Github, davidramiro)"
/** /**
* The STRING_DISTRIBUTION_DATE represents when the binary file was built, * The STRING_DISTRIBUTION_DATE represents when the binary file was built,
* here we define this default string as the date where the latest release * here we define this default string as the date where the latest release
* version was tagged. * version was tagged.
*/ */
#define STRING_DISTRIBUTION_DATE "2019-02-18" #define STRING_DISTRIBUTION_DATE "2019-03-06"
/** /**
* Required minimum Configuration.h and Configuration_adv.h file versions. * Required minimum Configuration.h and Configuration_adv.h file versions.
@@ -78,7 +84,7 @@
* has a distinct Github fork— the Source Code URL should just be the main * has a distinct Github fork— the Source Code URL should just be the main
* Marlin repository. * Marlin repository.
*/ */
#define SOURCE_CODE_URL "https://github.com/MarlinFirmware/Marlin" #define SOURCE_CODE_URL "https://github.com/davidramiro/Marlin-AI3M"
/** /**
* Default generic printer UUID. * Default generic printer UUID.

View File

@@ -137,7 +137,8 @@
#define MSG_INVALID_EXTRUDER "Invalid extruder" #define MSG_INVALID_EXTRUDER "Invalid extruder"
#define MSG_INVALID_SOLENOID "Invalid solenoid" #define MSG_INVALID_SOLENOID "Invalid solenoid"
#define MSG_ERR_NO_THERMISTORS "No thermistors - no temperature" #define MSG_ERR_NO_THERMISTORS "No thermistors - no temperature"
#define MSG_M115_REPORT "FIRMWARE_NAME:Marlin " DETAILED_BUILD_VERSION " SOURCE_CODE_URL:" SOURCE_CODE_URL " PROTOCOL_VERSION:" PROTOCOL_VERSION " MACHINE_TYPE:" MACHINE_NAME " EXTRUDER_COUNT:" STRINGIFY(EXTRUDERS) " UUID:" MACHINE_UUID #define MSG_M115_REPORT "FIRMWARE_NAME:Marlin " DETAILED_BUILD_VERSION " MARLIN-AI3M_VERSION:" CUSTOM_BUILD_VERSION " SOURCE_CODE_URL:" SOURCE_CODE_URL " PROTOCOL_VERSION:" PROTOCOL_VERSION " MACHINE_TYPE:" MACHINE_NAME " EXTRUDER_COUNT:" STRINGIFY(EXTRUDERS) " UUID:" MACHINE_UUID
#define MSG_MARLIN_AI3M "Marlin-AI3M"
#define MSG_COUNT_X " Count X:" #define MSG_COUNT_X " Count X:"
#define MSG_COUNT_A " Count A:" #define MSG_COUNT_A " Count A:"
#define MSG_ERR_KILLED "Printer halted. kill() called!" #define MSG_ERR_KILLED "Printer halted. kill() called!"

View File

@@ -9,25 +9,23 @@ Feel free to discuss issues and work with me further optimizing this firmware!
I am running this version on an i3 Mega Ultrabase V3 (for distinction of the different versions, check [this Thingiverse thread](https://www.thingiverse.com/groups/anycubic-i3-mega/forums/general/topic:27064)). I am running this version on an i3 Mega Ultrabase V3 (for distinction of the different versions, check [this Thingiverse thread](https://www.thingiverse.com/groups/anycubic-i3-mega/forums/general/topic:27064)).
Basically, this should work on every Ultrabase version that has two Z-axis endstops. Basically, this should work on every Ultrabase version that has two Z-axis endstops.
The new Mega-S should work too, but you will need to enter those two commands to make the new extruder work: The new **Mega-S** should work too, but you will need to enter two additional commands after flashing the firmware, mentioned in the instructions below.
```
M92 E384 Looking for a **BLtouch firmware**? Head [this way](https://github.com/MNieddu91/Marlin-AI3M-BLTouch)! Mounting and configuration instructions are included.
M500
```
Afterwards, calibration is highly recommended as per the instructions on the [Wiki](https://github.com/davidramiro/Marlin-AI3M/wiki/Extruder-Calibration/).
Note: This is just a firmware, not magic. A big part of print quality still depends on your slicer settings and mechanical condition of your machine. Note: This is just a firmware, not magic. A big part of print quality still depends on your slicer settings and mechanical condition of your machine.
#### Make sure to take a look at the [Wiki](https://github.com/davidramiro/Marlin-AI3M/wiki/), especially the [FAQ](https://github.com/davidramiro/Marlin-AI3M/wiki/Frequently-Asked-Questions). #### Make sure to take a look at the [Wiki](https://github.com/davidramiro/Marlin-AI3M/wiki/), especially the [FAQ](https://github.com/davidramiro/Marlin-AI3M/wiki/Frequently-Asked-Questions).
A German translation of the instructions can be found [here](https://kore.cc/i3mega/download/marlin-ai3m_german.pdf).
## Known issues: ## Known issues:
- **Cura users: Please turn off jerk and acceleration control in your print settings (not visible by default, select advanced visibility to unlock them). Cura's high default jerk and acceleration might cause shifted layers if you use TMC2208.** - Power outage support is not included
- Estimated print times from your slicer might be slightly off. - Estimated print times from your slicer might be slightly off.
- Special characters on any file or folders name on the SD card will cause the file menu to freeze. Simply replace or remove every special character (Chinese, Arabic, Russian, accents, German & Scandinavian umlauts, ...) from the name. Symbols like dashes or underscores are no problem. - Special characters on any file or folders name on the SD card will cause the file menu to freeze. Simply replace or remove every special character (Chinese, Arabic, Russian, accents, German & Scandinavian umlauts, ...) from the name. Symbols like dashes or underscores are no problem.
**Important note: On the SD card that comes with the printer there is a folder with Chinese characters in it by default. Please rename or remove it.** **Important note: On the SD card that comes with the printer there is a folder with Chinese characters in it by default. Please rename or remove it.**
- Cancelling prints via display is buggy sometimes, simply reboot the printer when the menu shows an error. Protip: Switch to OctoPrint. - Cancelling prints after pausing may show an error. Simply resume the print before canceling. Protip: Switch to OctoPrint.
## Why use this? ## Why use this?
@@ -40,7 +38,7 @@ While the i3 Mega is a great printer for its price and produces fantastic result
- Even better print quality by adding Linear Advance, S-Curve Acceleration and some tweaks on jerk and acceleration. - Even better print quality by adding Linear Advance, S-Curve Acceleration and some tweaks on jerk and acceleration.
- Thermal runaway protection: Reducing fire risk by detecting a faulty or misaligned thermistor. - Thermal runaway protection: Reducing fire risk by detecting a faulty or misaligned thermistor.
- Very loud stock stepper motor drivers, easily replaced by Watterott or FYSETC TMC2208. To do that, you'd usually have to flip the connectors on the board, this is not necessary using this firmware. - Very loud stock stepper motor drivers, easily replaced by Watterott or FYSETC TMC2208. To do that, you'd usually have to flip the connectors on the board, this is not necessary using this firmware.
- No need to slice and upload custom bed leveling tests, simply start one with a simple G26 command. - No need to slice and upload custom bed leveling tests, test it with a single GCode command
- Easily start an auto PID tune or mesh bed leveling via the special menu (insert SD card, select special menu and press the round arrow) - Easily start an auto PID tune or mesh bed leveling via the special menu (insert SD card, select special menu and press the round arrow)
- Filament change feature enabled: Switch colors/material mid print with `M600` (instructions below) - Filament change feature enabled: Switch colors/material mid print with `M600` (instructions below)
@@ -52,10 +50,10 @@ I provided three different precompiled hex files: One for no modifications on th
- Download the precompiled firmware here: [Releases](https://github.com/davidramiro/Marlin-AI3M/releases) - Download the precompiled firmware here: [Releases](https://github.com/davidramiro/Marlin-AI3M/releases)
- Choose the correct hex file: - Choose the correct hex file:
- For TMC2208 with connectors in original orientation, use `Marlin-AI3M-XXXXXX-TMC2208.hex` - For TMC2208 with connectors in original orientation, use `Marlin-AI3M-vx.x.x-TMC2208.hex`
- If you use TMC2208 and already reversed your connectors, use `Marlin-AI3M-XXXXXX-TMC2208_reversed.hex` - If you use TMC2208 and already reversed your connectors, use `Marlin-AI3M-vx.x.x-TMC2208_reversed.hex`
- If you use a newer version of the TMC2208 that doesn't require the connector to be reversed (TMC2208 "v2.0" written on the PCB, chip on the top side), please also use `Marlin-AI3M-XXXXXX-TMC2208_reversed.hex`. - If you use a newer version of the TMC2208 that doesn't require the connector to be reversed (TMC2208 "v2.0" written on the PCB, chip on the top side), please also use `Marlin-AI3M-vx.x.x-TMC2208_reversed.hex`.
- If you use the original stepper motor drivers, use `Marlin-AI3M-XXXXXX-stock_drivers.hex`. - If you use the original stepper motor drivers, use `Marlin-AI3M-vx.x.x-stock_drivers.hex`.
### Or compile it yourself: ### Or compile it yourself:
@@ -75,6 +73,11 @@ I provided three different precompiled hex files: One for no modifications on th
- `M502` - load hard coded default values - `M502` - load hard coded default values
- `M500` - save them to EEPROM - `M500` - save them to EEPROM
**If you are using this on a Mega-S, those two additional commands are necessary:**
- `M92 E384` - set correct steps for the new extruder
- `M500` - save them
- I highly recommend calibrating the extruder.
#### Calibration and other instructions have been moved to the [Wiki](https://github.com/davidramiro/Marlin-AI3M/wiki/Calibration). #### Calibration and other instructions have been moved to the [Wiki](https://github.com/davidramiro/Marlin-AI3M/wiki/Calibration).
@@ -169,6 +172,7 @@ G26 C H200 P25 R25
#### Configuration: #### Configuration:
- Send `M603 L0 U0` to use manual loading & unloading. - Send `M603 L0 U0` to use manual loading & unloading.
- Send `M603 L538 U555` to use automatic loading & unloading - Send `M603 L538 U555` to use automatic loading & unloading
- The `L` and `U` paramters define the load and unload length in mm. The values above work well on a stock setup, if you modded your extruder, bowden tube or hotend, you might need to adjust those.
- Save with `M500` - Save with `M500`
#### Filament change process (manual loading): #### Filament change process (manual loading):
@@ -178,6 +182,9 @@ G26 C H200 P25 R25
- Place `M600` in your GCode at the desired layer or send it via terminal - Place `M600` in your GCode at the desired layer or send it via terminal
- Alternatively: Use `FilamentChange Pause` in the Special Menu - Alternatively: Use `FilamentChange Pause` in the Special Menu
- The nozzle will park and your printer will beep - The nozzle will park and your printer will beep
- For safety reasons, the printer will turn off the hotend after 10 minutes. If you see the temperature being under the target:
- SD printing: Click `CONTINUE` **(only once!)** on the screen and wait for the hotend to heat up again.
- USB printing: Send `M108` and wait for the hotend to heat up again.
- Remove the filament from the bowden tube - Remove the filament from the bowden tube
- Insert the new filament right up to the nozzle, just until a bit of plastic oozes out - Insert the new filament right up to the nozzle, just until a bit of plastic oozes out
- Remove the excess filament from the nozzle with tweezers - Remove the excess filament from the nozzle with tweezers
@@ -195,6 +202,9 @@ G26 C H200 P25 R25
- Alternatively: Use `FilamentChange Pause` in the Special Menu - Alternatively: Use `FilamentChange Pause` in the Special Menu
- The nozzle will park - The nozzle will park
- The printer will remove the filament right up to the extruder and beep when finished - The printer will remove the filament right up to the extruder and beep when finished
- For safety reasons, the printer will turn off the hotend after 10 minutes. If you see the temperature being under the target:
- SD printing: Click `CONTINUE` **(only once!)** on the screen and wait for the hotend to heat up again.
- USB printing: Send `M108` and wait for the hotend to heat up again.
- Insert the new filament just up to the end of the bowden fitting, as shown here: - Insert the new filament just up to the end of the bowden fitting, as shown here:
![Load Filament][m600 load] ![Load Filament][m600 load]
@@ -228,7 +238,7 @@ After flashing the new version, issue a `M502` and `M500`. After that, enter eve
## Detailed changes: ## Detailed changes:
- Thermal runaway protection enabled and tweaked - Thermal runaway protection thresholds tweaked
- Manual mesh bed leveling enabled ([check this link](https://github.com/MarlinFirmware/Marlin/wiki/Manual-Mesh-Bed-Leveling) to learn more about it) - Manual mesh bed leveling enabled ([check this link](https://github.com/MarlinFirmware/Marlin/wiki/Manual-Mesh-Bed-Leveling) to learn more about it)
- Heatbed PID mode enabled - Heatbed PID mode enabled
- TMC2208 configured in standalone mode - TMC2208 configured in standalone mode
@@ -240,6 +250,8 @@ After flashing the new version, issue a `M502` and `M500`. After that, enter eve
- Minor tweaks on default jerk and acceleration - Minor tweaks on default jerk and acceleration
- Printcounter enabled (`M78`) - Printcounter enabled (`M78`)
- `M600` filament change feature enabled - `M600` filament change feature enabled
- Screen resume for `M600` implemented
- Filament runout, stop and pause behaviour tweaked
## Changes by [derhopp](https://github.com/derhopp/): ## Changes by [derhopp](https://github.com/derhopp/):