Merge branch 'master' into 12864-full

This commit is contained in:
David Ramiro 2019-03-13 17:09:00 +01:00
commit 0ca58ca7a6
No known key found for this signature in database
GPG Key ID: 5B042737EBEEB736
8 changed files with 1348 additions and 1123 deletions

View File

@ -33,6 +33,8 @@
#include "stepper.h" #include "stepper.h"
#include "serial.h" #include "serial.h"
#include "printcounter.h" #include "printcounter.h"
#include "macros.h"
#include "buzzer.h"
#ifdef ANYCUBIC_TFT_MODEL #ifdef ANYCUBIC_TFT_MODEL
#include "AnycubicTFT.h" #include "AnycubicTFT.h"
@ -136,58 +138,74 @@ void AnycubicTFTClass::KillTFT()
void AnycubicTFTClass::StartPrint(){ void AnycubicTFTClass::StartPrint(){
if (TFTstate==ANYCUBIC_TFT_STATE_SDPAUSE) { // resuming from SD pause // are we resuming from a pause?
if((!PausedByRunout) && (!PausedByFilamentChange)) // was that a regular pause? if (TFTstate==ANYCUBIC_TFT_STATE_SDPAUSE) {
{ // was that a regular pause?
enqueue_and_echo_commands_P(PSTR("G91")); // relative mode if((!PausedByRunout) && (!PausedByFilamentChange) && (!PausedByNozzleTimeout)) {
enqueue_and_echo_commands_P(PSTR("G1 Z-10 F240")); // lower nozzle again enqueue_and_echo_commands_P(PSTR("M24")); // unpark nozzle
enqueue_and_echo_commands_P(PSTR("G90")); // absolute mode #ifdef ANYCUBIC_TFT_DEBUG
SERIAL_ECHOLNPGM("DEBUG: M24 Resume from regular pause");
#endif
IsParked=false; // remove parked flag
} }
} }
starttime=millis(); starttime=millis();
#ifdef SDSUPPORT #ifdef SDSUPPORT
if((!PausedByRunout) && (!PausedByFilamentChange)) // was that a regular pause? // was that a regular pause or are we starting a print?
{ if((!PausedByRunout) && (!PausedByFilamentChange) && (!PausedByNozzleTimeout)) {
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 // resuming from a pause that was caused by filament runout
{ else if((PausedByRunout) && (!PausedByFilamentChange) && (!PausedByNozzleTimeout)) {
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 = IsParked = false; // clear flags
#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? // was M600 called and the nozzle is not timed out?
{ else if((!PausedByRunout) && (PausedByFilamentChange) && (!PausedByNozzleTimeout)) {
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 display 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) {
// nozzle was timed out before, do not enter printing state yet
TFTstate=ANYCUBIC_TFT_STATE_SDPAUSE_REQ;
#ifdef ANYCUBIC_TFT_DEBUG
SERIAL_ECHOLNPGM("DEBUG: Set Pause again because of timeout");
#endif
// clear the timeout flag to ensure the print continues on the
// next push of CONTINUE
PausedByNozzleTimeout=false;
#ifdef ANYCUBIC_TFT_DEBUG
SERIAL_ECHOLNPGM("DEBUG: Nozzle timeout flag cleared");
#endif
} else {
// regular resume/start or all specific resume routines are done,
// set printing state again
TFTstate=ANYCUBIC_TFT_STATE_SDPRINT; TFTstate=ANYCUBIC_TFT_STATE_SDPRINT;
} }
}
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
@ -195,7 +213,9 @@ void AnycubicTFTClass::PausePrint(){
#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 IsParked = true;
// show filament runout prompt on screen
ANYCUBIC_SERIAL_PROTOCOLPGM("J23");
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");
@ -204,15 +224,17 @@ void AnycubicTFTClass::PausePrint(){
#endif #endif
TFTstate=ANYCUBIC_TFT_STATE_SDPAUSE_REQ; TFTstate=ANYCUBIC_TFT_STATE_SDPAUSE_REQ;
#ifdef ANYCUBIC_FILAMENT_RUNOUT_SENSOR #ifdef ANYCUBIC_FILAMENT_RUNOUT_SENSOR
// regular pause
if(FilamentTestStatus) { if(FilamentTestStatus) {
ANYCUBIC_SERIAL_PROTOCOLPGM("J05");// J05 pausing ANYCUBIC_SERIAL_PROTOCOLPGM("J05");
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
// pause because of filament sensor
} else { } else {
// Pause because of "out of filament" // show filament runout prompt on screen
ANYCUBIC_SERIAL_PROTOCOLPGM("J23"); //J23 FILAMENT LACK with the prompt box don't disappear ANYCUBIC_SERIAL_PROTOCOLPGM("J23");
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");
@ -222,63 +244,95 @@ void AnycubicTFTClass::PausePrint(){
} }
void AnycubicTFTClass::StopPrint(){ void AnycubicTFTClass::StopPrint(){
#ifdef SDSUPPORT // stop print, disable heaters
card.stopSDPrint(); card.stopSDPrint();
#endif
clear_command_queue(); clear_command_queue();
if((current_position[Z_AXIS]<150)) #ifdef ANYCUBIC_TFT_DEBUG
{ SERIAL_ECHOLNPGM("DEBUG: Stopped and cleared");
enqueue_and_echo_commands_P(PSTR("G91")); #endif
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();
print_job_timer.stop(); print_job_timer.stop();
thermalManager.disable_all_heaters(); thermalManager.disable_all_heaters();
IsParked = false; // we are not parked yet, do it in the display state routine
// turn off fan, cancel any heatups and set display state
#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
wait_for_heatup=false;
TFTstate=ANYCUBIC_TFT_STATE_SDSTOP_REQ; TFTstate=ANYCUBIC_TFT_STATE_SDSTOP_REQ;
} }
void AnycubicTFTClass::FilamentChangeResume(){ void AnycubicTFTClass::FilamentChangeResume(){
enqueue_and_echo_commands_P(PSTR("M108")); // call M108 to break out of M600 pause // call M108 to break out of M600 pause
HOTEND_LOOP() thermalManager.reset_heater_idle_timer(e); // resume heating if timed out enqueue_and_echo_commands_P(PSTR("M108"));
wait_for_heatup = false;
wait_for_user = false; // remove waiting flags
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 called");
#endif #endif
// remove waiting flags
wait_for_heatup = false;
wait_for_user = false;
// resume with proper progress state
card.startFileprint();
#ifdef ANYCUBIC_TFT_DEBUG
SERIAL_ECHOLNPGM("DEBUG: M108 Resume done");
#endif
} }
void AnycubicTFTClass::FilamentChangePause(){ void AnycubicTFTClass::FilamentChangePause(){
// set filament change flag to ensure the M108 routine
// gets used when the user hits CONTINUE
PausedByFilamentChange=true; PausedByFilamentChange=true;
// call M600 and set display state to paused
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;
#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
// enable heaters again
HOTEND_LOOP() thermalManager.reset_heater_idle_timer(e);
#ifdef ANYCUBIC_TFT_DEBUG
SERIAL_ECHOLNPGM("DEBUG: Clear flags");
#endif
nozzle_timed_out = false;
// clear waiting flags
wait_for_user = false;
wait_for_heatup = false;
// set pause state to show CONTINUE button again
TFTstate=ANYCUBIC_TFT_STATE_SDPAUSE_REQ;
}
void AnycubicTFTClass::ParkAfterStop(){
// only park the nozzle if homing was done before
if (!axis_unhomed_error()) {
// raize nozzle by 25mm respecting Z_MAX_POS
do_blocking_move_to_z(MIN(current_position[Z_AXIS] + 25, Z_MAX_POS), 5);
#ifdef ANYCUBIC_TFT_DEBUG
SERIAL_ECHOLNPGM("DEBUG: SDSTOP: Park Z");
#endif
// move bed and hotend to park position
do_blocking_move_to_xy((X_MIN_POS + 10), (Y_MAX_POS - 10), 100);
#ifdef ANYCUBIC_TFT_DEBUG
SERIAL_ECHOLNPGM("DEBUG: SDSTOP: Park XY");
#endif
}
enqueue_and_echo_commands_P(PSTR("M84")); // disable stepper motors
enqueue_and_echo_commands_P(PSTR("M27")); // force report of SD status
}
float AnycubicTFTClass::CodeValue() float AnycubicTFTClass::CodeValue()
{ {
@ -304,9 +358,13 @@ void AnycubicTFTClass::HandleSpecialMenu()
} 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"));
buzzer.tone(105, 1108);
buzzer.tone(210, 1661);
} 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"));
buzzer.tone(105, 1661);
buzzer.tone(210, 1108);
} 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"));
@ -541,25 +599,31 @@ void AnycubicTFTClass::StateHandler()
#endif #endif
break; break;
case ANYCUBIC_TFT_STATE_SDPAUSE_REQ: case ANYCUBIC_TFT_STATE_SDPAUSE_REQ:
ANYCUBIC_SERIAL_PROTOCOLPGM("J18");
ANYCUBIC_SERIAL_ENTER();
#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)) {
{ // no flags, this is a regular pause.
#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 if(!IsParked) {
enqueue_and_echo_commands_P(PSTR("G1 E-2 F1800")); // retract 2mm // park head and retract 2mm
enqueue_and_echo_commands_P(PSTR("G1 Z10 F240")); // lift nozzle by 10mm enqueue_and_echo_commands_P(PSTR("M125 L2"));
enqueue_and_echo_commands_P(PSTR("G90")); // absolute mode IsParked = true;
} else if((PausedByRunout)) }
{ } else if((PausedByRunout)) {
// filament runout, retract and beep
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-3 F1800")); // retract 3mm enqueue_and_echo_commands_P(PSTR("G1 E-3 F1800")); // retract 3mm
enqueue_and_echo_commands_P(PSTR("G90")); // absolute mode enqueue_and_echo_commands_P(PSTR("G90")); // absolute mode
enqueue_and_echo_commands_P(PSTR("M300 S1567 P1000")); // alert user with beeps buzzer.tone(200, 1567);
enqueue_and_echo_commands_P(PSTR("M300 S2093 P3000")); buzzer.tone(200, 1174);
buzzer.tone(200, 1567);
buzzer.tone(200, 1174);
buzzer.tone(2000, 1567);
#ifdef ANYCUBIC_TFT_DEBUG #ifdef ANYCUBIC_TFT_DEBUG
SERIAL_ECHOLNPGM("DEBUG: Filament runout - Retract, beep and park."); SERIAL_ECHOLNPGM("DEBUG: Filament runout - Retract, beep and park.");
#endif #endif
@ -572,8 +636,6 @@ void AnycubicTFTClass::StateHandler()
TFTstate=ANYCUBIC_TFT_STATE_SDPAUSE_OOF; TFTstate=ANYCUBIC_TFT_STATE_SDPAUSE_OOF;
} }
#endif #endif
ANYCUBIC_SERIAL_PROTOCOLPGM("J18");// J18 pausing print done
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
@ -582,14 +644,20 @@ void AnycubicTFTClass::StateHandler()
break; break;
case ANYCUBIC_TFT_STATE_SDSTOP_REQ: case ANYCUBIC_TFT_STATE_SDSTOP_REQ:
#ifdef SDSUPPORT #ifdef SDSUPPORT
if((!card.sdprinting) && (!planner.movesplanned())) {
ANYCUBIC_SERIAL_PROTOCOLPGM("J16");// J16 stop print ANYCUBIC_SERIAL_PROTOCOLPGM("J16");// J16 stop print
ANYCUBIC_SERIAL_ENTER(); ANYCUBIC_SERIAL_ENTER();
if((!card.sdprinting) && (!planner.movesplanned())) {
// enter idle display state
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")); }
// did we park the hotend already?
if((!IsParked) && (!card.sdprinting) && (!planner.movesplanned())) {
enqueue_and_echo_commands_P(PSTR("G91\nG1 E-1 F1800\nG90")); //retract
ParkAfterStop();
IsParked = true;
} }
#endif #endif
break; break;
@ -603,38 +671,50 @@ 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) {
{ // filament sensor pin changed, save current timestamp.
FilamentRunoutCounter++; const millis_t fil_ms = millis();
if(FilamentRunoutCounter>=31600) static millis_t fil_delay;
{
FilamentRunoutCounter=0; // since this is inside a loop, only set delay time once
#ifdef SDSUPPORT if (FilamentSetMillis) {
if((card.sdprinting==true)) #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;
}
// if three seconds passed and the sensor is still triggered,
// we trigger the filament runout status
if ((FilamentTestStatus>FilamentTestLastStatus) && (ELAPSED(fil_ms, fil_delay))) {
if (!IsParked){
#ifdef ANYCUBIC_TFT_DEBUG
SERIAL_ECHOLNPGM("DEBUG: 3000ms delay done");
#endif
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
#ifdef SDSUPPORT
}
#endif #endif
FilamentTestLastStatus=FilamentTestStatus; FilamentTestLastStatus=FilamentTestStatus;
} }
} }
else if(FilamentTestStatus!=FilamentTestLastStatus) FilamentTestLastStatus=FilamentTestStatus;
{ }
FilamentRunoutCounter=0;
}
else if(FilamentTestStatus!=FilamentTestLastStatus) {
FilamentSetMillis=true; // set the timestamps on the next loop again
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");
@ -805,6 +885,9 @@ void AnycubicTFTClass::GetCommandFromTFT()
SERIAL_ECHOLNPGM("TFT Serial Debug: SD print started... J04"); SERIAL_ECHOLNPGM("TFT Serial Debug: SD print started... J04");
#endif #endif
} }
if (nozzle_timed_out) {
ReheatNozzle();
}
#endif #endif
break; break;
case 11: // A11 STOP SD PRINT case 11: // A11 STOP SD PRINT
@ -812,6 +895,10 @@ void AnycubicTFTClass::GetCommandFromTFT()
if((card.sdprinting) || (TFTstate==ANYCUBIC_TFT_STATE_SDOUTAGE)) if((card.sdprinting) || (TFTstate==ANYCUBIC_TFT_STATE_SDOUTAGE))
{ {
StopPrint(); StopPrint();
} else {
ANYCUBIC_SERIAL_PROTOCOLPGM("J16");
ANYCUBIC_SERIAL_ENTER();
TFTstate=ANYCUBIC_TFT_STATE_IDLE;
} }
#endif #endif
break; break;
@ -820,8 +907,7 @@ void AnycubicTFTClass::GetCommandFromTFT()
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((TFTstate!=ANYCUBIC_TFT_STATE_SDOUTAGE))
if((TFTstate!=ANYCUBIC_TFT_STATE_SDOUTAGE)) // allow special menu to be used while printing from USB
{ {
starpos = (strchr(TFTstrchr_pointer + 4,'*')); starpos = (strchr(TFTstrchr_pointer + 4,'*'));
if (TFTstrchr_pointer[4] == '/') { if (TFTstrchr_pointer[4] == '/') {
@ -857,6 +943,7 @@ void AnycubicTFTClass::GetCommandFromTFT()
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();
IsParked = false;
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

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];
@ -74,6 +75,7 @@ private:
uint8_t tmp_extruder=0; uint8_t tmp_extruder=0;
char LastSDstatus=0; char LastSDstatus=0;
uint16_t HeaterCheckCount=0; uint16_t HeaterCheckCount=0;
bool IsParked = false;
struct OutageDataStruct { struct OutageDataStruct {
char OutageDataVersion; char OutageDataVersion;
@ -100,6 +102,8 @@ private:
void HandleSpecialMenu(); void HandleSpecialMenu();
void FilamentChangePause(); void FilamentChangePause();
void FilamentChangeResume(); void FilamentChangeResume();
void ReheatNozzle();
void ParkAfterStop();
char SelectedDirectory[30]; char SelectedDirectory[30];
uint8_t SpecialMenu=false; uint8_t SpecialMenu=false;
@ -107,7 +111,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

@ -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

@ -228,6 +228,7 @@
* M867 - Enable/disable or toggle error correction for position encoder modules. * M867 - Enable/disable or toggle error correction for position encoder modules.
* M868 - Report or set position encoder module error correction threshold. * M868 - Report or set position encoder module error correction threshold.
* M869 - Report position encoder module error. * M869 - Report position encoder module error.
* M888 - Ultrabase cooldown: Let the parts cooling fan hover above the finished print to cool down the bed. EXPERIMENTAL FEATURE!
* M900 - Get or Set Linear Advance K-factor. (Requires LIN_ADVANCE) * M900 - Get or Set Linear Advance K-factor. (Requires LIN_ADVANCE)
* M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. (Requires at least one _DRIVER_TYPE defined as TMC2130/TMC2208/TMC2660) * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. (Requires at least one _DRIVER_TYPE defined as TMC2130/TMC2208/TMC2660)
* M907 - Set digital trimpot motor current using axis codes. (Requires a board with digital trimpots) * M907 - Set digital trimpot motor current using axis codes. (Requires a board with digital trimpots)
@ -519,6 +520,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 +7217,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 +7254,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 +7303,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 +7339,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);
@ -11381,6 +11404,56 @@ inline void gcode_M502() {
} }
#endif // MAX7219_GCODE #endif // MAX7219_GCODE
/**
* M888: Cooldown routine for the Anycubic Ultrabase (EXPERIMENTAL):
* This is meant to be placed at the end Gcode of your slicer.
* It hovers over the print bed and does circular movements while
* running the fan. Works best with custom fan ducts.
*
* T<int> Target bed temperature (min 15°C), 30°C if not specified
* S<int> Fan speed between 0 and 255, full speed if not specified
*/
inline void gcode_M888() {
// don't do this if the machine is not homed
if (axis_unhomed_error()) return;
const float cooldown_arc[2] = { 50, 50 };
const uint8_t cooldown_target = MAX((parser.ushortval('T', 30)), 15);
// set hotbed temperate to zero
thermalManager.setTargetBed(0);
SERIAL_PROTOCOLLNPGM("Ultrabase cooldown started");
// set fan to speed <S>, if undefined blast at full speed
uint8_t cooldown_fanspeed = parser.ushortval('S', 255);
fanSpeeds[0] = MIN(cooldown_fanspeed, 255U);
// raise z by 2mm and move to X50, Y50
do_blocking_move_to_z(MIN(current_position[Z_AXIS] + 2, Z_MAX_POS), 5);
do_blocking_move_to_xy(50, 50, 100);
while ((thermalManager.degBed() > cooldown_target)) {
// queue arc movement
gcode_get_destination();
plan_arc(destination, cooldown_arc, true);
SERIAL_PROTOCOLLNPGM("Target not reached, queued an arc");
// delay while arc is in progress
while (planner.movesplanned()) {
idle();
}
idle();
}
// the bed should be under <T> now
fanSpeeds[0]=0;
do_blocking_move_to_xy(MAX(X_MIN_POS, 10), MIN(Y_MAX_POS, 190), 100);
BUZZ(100, 659);
BUZZ(150, 1318);
enqueue_and_echo_commands_P(PSTR("M84"));
SERIAL_PROTOCOLLNPGM("M888 cooldown routine done");
}
#if ENABLED(LIN_ADVANCE) #if ENABLED(LIN_ADVANCE)
/** /**
* M900: Get or Set Linear Advance K-factor * M900: Get or Set Linear Advance K-factor
@ -13116,6 +13189,8 @@ void process_parsed_command() {
case 869: gcode_M869(); break; // M869: Report axis error case 869: gcode_M869(); break; // M869: Report axis error
#endif #endif
case 888: gcode_M888(); break; // M888: Ultrabase cooldown (EXPERIMENTAL)
#if ENABLED(LIN_ADVANCE) #if ENABLED(LIN_ADVANCE)
case 900: gcode_M900(); break; // M900: Set Linear Advance K factor case 900: gcode_M900(); break; // M900: Set Linear Advance K factor
#endif #endif

View File

@ -41,7 +41,7 @@
* Defines the version of the Marlin-AI3M build. Not to be confused with * Defines the version of the Marlin-AI3M build. Not to be confused with
* Marlin's own build number, e.g. 1.1.9. * Marlin's own build number, e.g. 1.1.9.
*/ */
#define CUSTOM_BUILD_VERSION "v1.4.2" #define CUSTOM_BUILD_VERSION "v1.4.4"
/** /**
* Verbose version identifier which should contain a reference to the location * Verbose version identifier which should contain a reference to the location
@ -54,7 +54,7 @@
* 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-24" #define STRING_DISTRIBUTION_DATE "2019-03-13"
/** /**
* Required minimum Configuration.h and Configuration_adv.h file versions. * Required minimum Configuration.h and Configuration_adv.h file versions.

View File

@ -137,7 +137,7 @@
#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 " MARLIN-AI3M_VERSION:" CUSTOM_BUILD_VERSION #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_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:"

103
README.md
View File

@ -7,21 +7,18 @@ This is my slightly customized version of the [Marlin Firmware](https://github.c
## RepRapDiscount Full Graphic Smart Controller branch ## RepRapDiscount Full Graphic Smart Controller branch
**This branch is prepared to be used with a 12864 display like the [RepRapDiscount Full Graphic Smart Controller](https://reprap.org/wiki/RepRapDiscount_Full_Graphic_Smart_Controller).** **This branch is prepared to be used with a 12864 display like the [RepRapDiscount Full Graphic Smart Controller](https://reprap.org/wiki/RepRapDiscount_Full_Graphic_Smart_Controller).**
--- This firmware works on every i3 Mega that has two Z-axis endstops. If you have an older model with only one Z endstop, a small [adjustment](https://github.com/davidramiro/Marlin-AI3M/wiki/Customization-&-Compiling#single-z-endstop) is required.
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.
Looking for a **BLtouch firmware**? Head [this way](https://github.com/MNieddu91/Marlin-AI3M-BLTouch)! Mounting and configuration instructions are included.
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). A German translation of the instructions can be found [here](https://kore.cc/i3mega/download/marlin-ai3m_german.pdf).
## 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.**
- 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.
**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 after pausing may show an error. Simply resume the print before canceling. Protip: Switch to OctoPrint.
## Why use this? ## Why use this?
While the i3 Mega is a great printer for its price and produces fantastic results in stock, there are some issues that are easily addressed: While the i3 Mega is a great printer for its price and produces fantastic results in stock, there are some issues that are easily addressed:
@ -34,7 +31,21 @@ While the i3 Mega is a great printer for its price and produces fantastic result
- 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, test it with a single GCode 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 (instructions below) and control it via display.
- The filament runout, pause and stop functionality have been overhauled and improved: The hotend now parks and retracts (on pause or stop) and purges automatically (on resume).
- Added `M888` cooldown routine for the Anycubic Ultrabase (EXPERIMENTAL): This is meant to be placed at the end Gcode of your slicer. It hovers over the print bed and does circular movements while running the fan. Works best with custom fan ducts.
- Optional parameters:
- `T<temperature>`: Target bed temperature (min 15°C), 30°C if not specified (do not set this under room temperature)
- `S<fan speed>`: Fan speed between 0 and 255, full speed if not specified
- e.g. `M888 S191 T25`: run the fan at 75% until the bed has cooled down to 25°C
## Known issues:
- Power outage support is not included
- 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.
**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.**
## How to flash this? ## How to flash this?
@ -51,8 +62,9 @@ I provided three different precompiled hex files: One for no modifications on th
### Or compile it yourself: ### Or compile it yourself:
- Download Arduino IDE - Download and install [Arduino IDE](https://www.arduino.cc/en/main/software)
- Clone or download this repo - Clone or download this repo
- Browse into the Marlin folder and run `Marlin.ino`
- In the IDE, under `Tools -> Board` select `Genuino Mega 2560` and `ATmega2560` - In the IDE, under `Tools -> Board` select `Genuino Mega 2560` and `ATmega2560`
- Open Marlin.ino in the Marlin directory of this repo - Open Marlin.ino in the Marlin directory of this repo
- [Customize if needed](https://github.com/davidramiro/Marlin-AI3M/wiki/Customization-&-Compiling) (e.g. motor directions and type at line `559` to `566` and line `857` to `865` in `Configuration.h`) - [Customize if needed](https://github.com/davidramiro/Marlin-AI3M/wiki/Customization-&-Compiling) (e.g. motor directions and type at line `559` to `566` and line `857` to `865` in `Configuration.h`)
@ -63,12 +75,16 @@ I provided three different precompiled hex files: One for no modifications on th
- Flash the hex with Cura, OctoPrint or similar - Flash the hex with Cura, OctoPrint or similar
- Use a tool with a terminal (OctoPrint, Pronterface, Repetier Host, ...) to send commands to your printer. - Use a tool with a terminal (OctoPrint, Pronterface, Repetier Host, ...) to send commands to your printer.
- Connect to the printer and send the following commands: - **Important** Connect to the printer and send the following commands:
- `M502` - load hard coded default values - `M502` - load hard coded default values
- `M500` - save them to EEPROM - `M500` - save them to EEPROM
#### Calibration and other instructions have been moved to the [Wiki](https://github.com/davidramiro/Marlin-AI3M/wiki/Calibration). **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).
## Manual Mesh Bed Leveling ## Manual Mesh Bed Leveling
@ -92,7 +108,7 @@ If you have issues with an uneven bed, this is a great feature.
- Your nozzle will now move to the first calibration position. - Your nozzle will now move to the first calibration position.
- Don't adjust the bed itself with screws, only use software from here on! - Don't adjust the bed itself with screws, only use software from here on!
- Use a paper - I recommend using thermopaper like a receipt or baking paper - Use a paper - I recommend using thermopaper like a receipt or baking paper
- Use the onscreen controls to lower or raise your nozzle until you feel a light resistance: (If you want to send the same command multiple times, select the item again, even though it is still marked red.) - Use the onscreen controls to lower or raise your nozzle until you feel a light resistance: (**If you want to send the same command multiple times, select the item again, even though it is still marked red.**)
![Z axis controls][control] ![Z axis controls][control]
@ -101,7 +117,7 @@ If you have issues with an uneven bed, this is a great feature.
![Next mesh point][next] ![Next mesh point][next]
- Repeat the last two steps until all 25 points are done. - Repeat the last two steps until all 25 points are done.
- Your printer will beep, wait 20 seconds and then save: - Your printer will beep, wait 20 seconds and then save (the printer will beep once more to confirm):
![Save to EEPROM][save] ![Save to EEPROM][save]
@ -118,15 +134,14 @@ If you have issues with an uneven bed, this is a great feature.
### After leveling: ### After leveling:
- Reboot the printer.
- To ensure your mesh gets used on every print from now on, go into your slicer settings and look for the start GCode - To ensure your mesh gets used on every print from now on, go into your slicer settings and look for the start GCode
- Look for the Z-homing (either just `G28` or `G28 Z0`) command and insert these two right underneath it: - Look for the Z-homing (either just `G28` or `G28 Z0`) command and insert these two right underneath it:
``` ```
M501 M501
M420 S1 M420 S1
``` ```
- Enjoy never having to worry about an uneven bed again! - Your printer should now correctly print first layers even on a warped bed.
- When working on the printer, installing a new hotend or nozzle or the bed warping over time, a new Mesh Leveling procedure is recommended.
#### Manual commands for use with OctoPrint etc.: #### Manual commands for use with OctoPrint etc.:
@ -145,6 +160,7 @@ G28
G26 C H200 P25 R25 G26 C H200 P25 R25
``` ```
- To adjust your filament's needed temperature, change the number of the `H` parameter - To adjust your filament's needed temperature, change the number of the `H` parameter
- Default bed temperature is 60°C, if you need another temperature, add e.g. `B80`
- If your leveling is good, you will have a complete pattern of your mesh on your bed that you can peel off in one piece - If your leveling is good, you will have a complete pattern of your mesh on your bed that you can peel off in one piece
- Don't worry if the test looks a bit messy, the important thing is just that the line width is the same all over the mesh - Don't worry if the test looks a bit messy, the important thing is just that the line width is the same all over the mesh
- Optional: Hang it up on a wall to display it as a trophy of how great your leveling skills are. - Optional: Hang it up on a wall to display it as a trophy of how great your leveling skills are.
@ -156,9 +172,9 @@ G26 C H200 P25 R25
[m600 demo]: https://kore.cc/i3mega/img/m600demo.jpg "M600 demo" [m600 demo]: https://kore.cc/i3mega/img/m600demo.jpg "M600 demo"
**Printing via USB is highly recommended for this.** **BETA: This now also works without USB printing, via SD & display.**
#### Configuration: #### Configuration (only needed once):
- 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. - 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.
@ -171,6 +187,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
@ -188,6 +207,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]
@ -218,6 +240,11 @@ M304
After flashing the new version, issue a `M502` and `M500`. After that, enter every line you saved before and finish by saving with `M500`. After flashing the new version, issue a `M502` and `M500`. After that, enter every line you saved before and finish by saving with `M500`.
## Something went wrong?
No worries. You can easily go back to the default firmware and restore the default settings.
- Flash the hex file from the [manufacturer's website](http://www.anycubic3d.com/support/show/594016.html) (in case it's offline, I have uploaded the stock firmwares [here](https://kore.cc/i3mega/download/stockFW/) as well).
- After flashing, send `M502` and `M500`. Now your machine is exactly as it came out of the box.
## Detailed changes: ## Detailed changes:
@ -231,10 +258,15 @@ After flashing the new version, issue a `M502` and `M500`. After that, enter eve
- G26 Mesh Validation enabled - G26 Mesh Validation enabled
- Some redundant code removed to save memory - Some redundant code removed to save memory
- Minor tweaks on default jerk and acceleration - Minor tweaks on default jerk and acceleration
- Printcounter enabled (`M78`) - Print statistics enabled (send `M78` to read them)
- `M600` filament change feature enabled - `M600` filament change feature enabled
- Screen resume for `M600` implemented - Implemented easy resume via display
- Filament runout, stop and pause behaviour tweaked - Filament runout behaviour tweaked
- Added purge and retract
- Move nozzle to park position on runout
- Prevent false positives by adding a small delay to the sensor
- Pause and stop behaviour tweaked
- Added `M888` cooldown routine for the Anycubic Ultrabase
## Changes by [derhopp](https://github.com/derhopp/): ## Changes by [derhopp](https://github.com/derhopp/):
@ -320,3 +352,26 @@ Notable contributors include:
## License ## License
Marlin is published under the [GPLv3 license](https://github.com/MarlinFirmware/Marlin/blob/1.0.x/COPYING.md) because we believe in open development. The GPL comes with both rights and obligations. Whether you use Marlin firmware as the driver for your open or closed-source product, you must keep Marlin open, and you must provide your compatible Marlin source code to end users upon request. The most straightforward way to comply with the Marlin license is to make a fork of Marlin on Github, perform your modifications, and direct users to your modified fork. Marlin is published under the [GPLv3 license](https://github.com/MarlinFirmware/Marlin/blob/1.0.x/COPYING.md) because we believe in open development. The GPL comes with both rights and obligations. Whether you use Marlin firmware as the driver for your open or closed-source product, you must keep Marlin open, and you must provide your compatible Marlin source code to end users upon request. The most straightforward way to comply with the Marlin license is to make a fork of Marlin on Github, perform your modifications, and direct users to your modified fork.
## Disclaimer
```
/*
* Flashing a custom firmware happens at your own risk.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS
* AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
```