diff --git a/Firmware/Configuration.h b/Firmware/Configuration.h index 832a64e6d..d1f67069b 100644 --- a/Firmware/Configuration.h +++ b/Firmware/Configuration.h @@ -7,8 +7,8 @@ #define STR(x) STR_HELPER(x) // Firmware version -#define FW_VERSION "3.5.2" -#define FW_COMMIT_NR 1999 +#define FW_VERSION "3.5.3" +#define FW_COMMIT_NR 2007 // FW_VERSION_UNKNOWN means this is an unofficial build. // The firmware should only be checked into github with this symbol. #define FW_DEV_VERSION FW_VERSION_UNKNOWN diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 08df94088..8511a83f1 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -3037,7 +3037,7 @@ static void gcode_M600(bool automatic, float x_position, float y_position, float lcd_set_cursor(0, 2); lcd_puts_P(_T(MSG_PLEASE_WAIT)); - mmu_command(MMU_CMD_R0); + mmu_command(MmuCmd::R0); manage_response(false, false); } } @@ -6933,7 +6933,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) return; //dont execute the same T-code twice in a row } st_synchronize(); - mmu_command(MMU_CMD_T0 + tmp_extruder); + mmu_command(MmuCmd::T0 + tmp_extruder); manage_response(true, true, MMU_TCODE_MOVE); } } @@ -6974,7 +6974,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) printf_P(PSTR("Duplicit T-code ignored.\n")); return; //dont execute the same T-code twice in a row } - mmu_command(MMU_CMD_T0 + tmp_extruder); + mmu_command(MmuCmd::T0 + tmp_extruder); manage_response(true, true, MMU_TCODE_MOVE); mmu_continue_loading(); @@ -7482,7 +7482,7 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) //default argument s #ifdef FILAMENT_SENSOR if (mmu_enabled == false) { - if ((mcode_in_progress != 600) && (!bFilamentAutoloadFlag)) //M600 not in progress, preHeat @ autoLoad menu not active + if ((mcode_in_progress != 600) && (eFilamentAction != e_FILAMENT_ACTION_autoLoad)) //M600 not in progress, preHeat @ autoLoad menu not active { if (!moves_planned() && !IS_SD_PRINTING && !is_usb_printing && (lcd_commands_type != LCD_COMMAND_V2_CAL) && !wizard_active) { @@ -7502,9 +7502,8 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) //default argument s } else { - bFilamentLoad=true; // i.e. filament loading mode + eFilamentAction=e_FILAMENT_ACTION_autoLoad; bFilamentFirstRun=false; - bFilamentAutoloadFlag=true; if(target_temperature[0]>=EXTRUDE_MINTEMP) { bFilamentPreheatState=true; diff --git a/Firmware/mmu.cpp b/Firmware/mmu.cpp index 5d4b9eecd..8dfef148e 100644 --- a/Firmware/mmu.cpp +++ b/Firmware/mmu.cpp @@ -22,7 +22,7 @@ #define MMU_TODELAY 100 #define MMU_TIMEOUT 10 -#define MMU_CMD_TIMEOUT 45000ul //5min timeout for mmu commands (except P0) +#define MMU_CMD_TIMEOUT 45000ul //45s timeout for mmu commands (except P0) #define MMU_P0_TIMEOUT 3000ul //timeout for P0 command: 3seconds #define MMU_MAX_RESEND_ATTEMPTS 2 @@ -30,18 +30,36 @@ #define MMU_RST_PIN 76 #endif //MMU_HWRESET +namespace +{ + enum class S : uint_least8_t + { + WaitStealthMode, + GetFindaInit, + GetBuildNr, + GetVersion, + Init, + Disabled, + Idle, + GetFinda, + WaitCmd, //!< wait for command response + Pause, + GetDrvError, //!< get power failures count + }; +} + bool mmu_enabled = false; bool mmu_ready = false; bool mmu_fil_loaded = false; //if true: blocks execution of duplicit T-codes -static int8_t mmu_state = 0; +static S mmu_state = S::Disabled; -uint8_t mmu_cmd = 0; +MmuCmd mmu_cmd = MmuCmd::None; //idler ir sensor uint8_t mmu_idl_sens = 0; bool ir_sensor_detected = false; -bool mmu_loading_flag = false; +bool mmu_loading_flag = false; //when set to true, we assume that mmu2 unload was finished and loading phase is now performed; printer can send 'A' to mmu2 to abort loading process uint8_t mmu_extruder = MMU_FILAMENT_UNKNOWN; @@ -57,10 +75,27 @@ int16_t mmu_buildnr = -1; uint32_t mmu_last_request = 0; uint32_t mmu_last_response = 0; -uint8_t mmu_last_cmd = 0; +MmuCmd mmu_last_cmd = MmuCmd::None; uint16_t mmu_power_failures = 0; +#ifdef MMU_DEBUG +static const auto DEBUG_PUTS_P = puts_P; +static const auto DEBUG_PRINTF_P = printf_P; +#else //MMU_DEBUG +#define DEBUG_PUTS_P(str) +#define DEBUG_PRINTF_P( __fmt, ... ) +#endif //MMU_DEBUG + +#if defined(MMU_FINDA_DEBUG) && defined(MMU_DEBUG) +static const auto FDEBUG_PUTS_P = puts_P; +static const auto FDEBUG_PRINTF_P = printf_P; +#else +#define FDEBUG_PUTS_P(str) +#define FDEBUG_PRINTF_P( __fmt, ... ) +#endif //defined(MMU_FINDA_DEBUG) && defined(MMU_DEBUG) + + //clear rx buffer void mmu_clr_rx_buf(void) { @@ -114,12 +149,11 @@ void mmu_init(void) uart2_init(); //init uart2 _delay_ms(10); //wait 10ms for sure mmu_reset(); //reset mmu (HW or SW), do not wait for response - mmu_state = -1; + mmu_state = S::Init; PIN_INP(IR_SENSOR_PIN); //input mode PIN_SET(IR_SENSOR_PIN); //pullup } - //if IR_SENSOR defined, always returns true //otherwise check for ir sensor and returns true if idler IR sensor was detected, otherwise returns false bool check_for_ir_sensor() @@ -151,205 +185,150 @@ bool check_for_ir_sensor() void mmu_loop(void) { static uint8_t mmu_attempt_nr = 0; - int filament = 0; // printf_P(PSTR("MMU loop, state=%d\n"), mmu_state); switch (mmu_state) { - case 0: + case S::Disabled: return; - case -1: + case S::Init: if (mmu_rx_start() > 0) { -#ifdef MMU_DEBUG - puts_P(PSTR("MMU => 'start'")); - puts_P(PSTR("MMU <= 'S1'")); -#endif //MMU_DEBUG + DEBUG_PUTS_P(PSTR("MMU => 'start'")); + DEBUG_PUTS_P(PSTR("MMU <= 'S1'")); mmu_puts_P(PSTR("S1\n")); //send 'read version' request - mmu_state = -2; + mmu_state = S::GetVersion; } else if (_millis() > 30000) //30sec after reset disable mmu { puts_P(PSTR("MMU not responding - DISABLED")); - mmu_state = 0; + mmu_state = S::Disabled; } return; - case -2: + case S::GetVersion: if (mmu_rx_ok() > 0) { fscanf_P(uart2io, PSTR("%u"), &mmu_version); //scan version from buffer -#ifdef MMU_DEBUG - printf_P(PSTR("MMU => '%dok'\n"), mmu_version); - puts_P(PSTR("MMU <= 'S2'")); -#endif //MMU_DEBUG + DEBUG_PRINTF_P(PSTR("MMU => '%dok'\n"), mmu_version); + DEBUG_PUTS_P(PSTR("MMU <= 'S2'")); mmu_puts_P(PSTR("S2\n")); //send 'read buildnr' request - mmu_state = -3; + mmu_state = S::GetBuildNr; } return; - case -3: + case S::GetBuildNr: if (mmu_rx_ok() > 0) { fscanf_P(uart2io, PSTR("%u"), &mmu_buildnr); //scan buildnr from buffer -#ifdef MMU_DEBUG - printf_P(PSTR("MMU => '%dok'\n"), mmu_buildnr); -#endif //MMU_DEBUG + DEBUG_PRINTF_P(PSTR("MMU => '%dok'\n"), mmu_buildnr); bool version_valid = mmu_check_version(); if (!version_valid) mmu_show_warning(); else puts_P(PSTR("MMU version valid")); if ((PRINTER_TYPE == PRINTER_MK3) || (PRINTER_TYPE == PRINTER_MK3_SNMM)) { -#if defined MMU_DEBUG && defined MMU_FINDA_DEBUG - puts_P(PSTR("MMU <= 'P0'")); -#endif //MMU_DEBUG && MMU_FINDA_DEBUG + FDEBUG_PUTS_P(PSTR("MMU <= 'P0'")); mmu_puts_P(PSTR("P0\n")); //send 'read finda' request - mmu_state = -4; + mmu_state = S::GetFindaInit; } else { -#ifdef MMU_DEBUG - puts_P(PSTR("MMU <= 'M1'")); -#endif //MMU_DEBUG + DEBUG_PUTS_P(PSTR("MMU <= 'M1'")); mmu_puts_P(PSTR("M1\n")); //set mmu mode to stealth - mmu_state = -5; + mmu_state = S::WaitStealthMode; } } return; - case -5: + case S::WaitStealthMode: if (mmu_rx_ok() > 0) { -#if defined MMU_DEBUG && defined MMU_FINDA_DEBUG - puts_P(PSTR("MMU <= 'P0'")); -#endif //MMU_DEBUG && MMU_FINDA_DEBUG + FDEBUG_PUTS_P(PSTR("MMU <= 'P0'")); mmu_puts_P(PSTR("P0\n")); //send 'read finda' request - mmu_state = -4; + mmu_state = S::GetFindaInit; } return; - case -4: + case S::GetFindaInit: if (mmu_rx_ok() > 0) { fscanf_P(uart2io, PSTR("%hhu"), &mmu_finda); //scan finda from buffer -#if defined MMU_DEBUG && defined MMU_FINDA_DEBUG - printf_P(PSTR("MMU => '%dok'\n"), mmu_finda); -#endif //MMU_DEBUG && MMU_FINDA_DEBUG + FDEBUG_PRINTF_P(PSTR("MMU => '%dok'\n"), mmu_finda); puts_P(PSTR("MMU - ENABLED")); mmu_enabled = true; - mmu_state = 1; + mmu_state = S::Idle; } return; - case 1: - if (mmu_cmd) //command request ? + case S::Idle: + if (mmu_cmd != MmuCmd::None) //command request ? { - if ((mmu_cmd >= MMU_CMD_T0) && (mmu_cmd <= MMU_CMD_T4)) + if ((mmu_cmd >= MmuCmd::T0) && (mmu_cmd <= MmuCmd::T4)) { - filament = mmu_cmd - MMU_CMD_T0; -#ifdef MMU_DEBUG - printf_P(PSTR("MMU <= 'T%d'\n"), filament); -#endif //MMU_DEBUG + const uint8_t filament = mmu_cmd - MmuCmd::T0; + DEBUG_PRINTF_P(PSTR("MMU <= 'T%d'\n"), filament); mmu_printf_P(PSTR("T%d\n"), filament); - mmu_state = 3; // wait for response + mmu_state = S::WaitCmd; // wait for response mmu_fil_loaded = true; mmu_idl_sens = 1; } - else if ((mmu_cmd >= MMU_CMD_L0) && (mmu_cmd <= MMU_CMD_L4)) + else if ((mmu_cmd >= MmuCmd::L0) && (mmu_cmd <= MmuCmd::L4)) { - filament = mmu_cmd - MMU_CMD_L0; -#ifdef MMU_DEBUG - printf_P(PSTR("MMU <= 'L%d'\n"), filament); -#endif //MMU_DEBUG + const uint8_t filament = mmu_cmd - MmuCmd::L0; + DEBUG_PRINTF_P(PSTR("MMU <= 'L%d'\n"), filament); mmu_printf_P(PSTR("L%d\n"), filament); - mmu_state = 3; // wait for response + mmu_state = S::WaitCmd; // wait for response } - else if (mmu_cmd == MMU_CMD_C0) + else if (mmu_cmd == MmuCmd::C0) { -#ifdef MMU_DEBUG - printf_P(PSTR("MMU <= 'C0'\n")); -#endif //MMU_DEBUG + DEBUG_PRINTF_P(PSTR("MMU <= 'C0'\n")); mmu_puts_P(PSTR("C0\n")); //send 'continue loading' - mmu_state = 3; + mmu_state = S::WaitCmd; mmu_idl_sens = 1; } - else if (mmu_cmd == MMU_CMD_U0) + else if (mmu_cmd == MmuCmd::U0) { -#ifdef MMU_DEBUG - printf_P(PSTR("MMU <= 'U0'\n")); -#endif //MMU_DEBUG + DEBUG_PRINTF_P(PSTR("MMU <= 'U0'\n")); mmu_puts_P(PSTR("U0\n")); //send 'unload current filament' mmu_fil_loaded = false; - mmu_state = 3; + mmu_state = S::WaitCmd; } - else if ((mmu_cmd >= MMU_CMD_E0) && (mmu_cmd <= MMU_CMD_E4)) + else if ((mmu_cmd >= MmuCmd::E0) && (mmu_cmd <= MmuCmd::E4)) { - int filament = mmu_cmd - MMU_CMD_E0; -#ifdef MMU_DEBUG - printf_P(PSTR("MMU <= 'E%d'\n"), filament); -#endif //MMU_DEBUG + const uint8_t filament = mmu_cmd - MmuCmd::E0; + DEBUG_PRINTF_P(PSTR("MMU <= 'E%d'\n"), filament); mmu_printf_P(PSTR("E%d\n"), filament); //send eject filament mmu_fil_loaded = false; - mmu_state = 3; // wait for response + mmu_state = S::WaitCmd; } - else if (mmu_cmd == MMU_CMD_R0) + else if (mmu_cmd == MmuCmd::R0) { -#ifdef MMU_DEBUG - printf_P(PSTR("MMU <= 'R0'\n")); -#endif //MMU_DEBUG + DEBUG_PRINTF_P(PSTR("MMU <= 'R0'\n")); mmu_puts_P(PSTR("R0\n")); //send recover after eject - mmu_state = 3; // wait for response + mmu_state = S::WaitCmd; } - else if (mmu_cmd == MMU_CMD_S3) + else if (mmu_cmd == MmuCmd::S3) { -#ifdef MMU_DEBUG - printf_P(PSTR("MMU <= 'S3'\n")); -#endif //MMU_DEBUG + DEBUG_PRINTF_P(PSTR("MMU <= 'S3'\n")); mmu_puts_P(PSTR("S3\n")); //send power failures request - mmu_state = 4; // power failures response + mmu_state = S::GetDrvError; + } + else if (mmu_cmd == MmuCmd::W0) + { + DEBUG_PRINTF_P(PSTR("MMU <= 'W0'\n")); + mmu_puts_P(PSTR("W0\n")); + mmu_state = S::Pause; } mmu_last_cmd = mmu_cmd; - mmu_cmd = 0; + mmu_cmd = MmuCmd::None; } else if ((mmu_last_response + 300) < _millis()) //request every 300ms { #ifndef IR_SENSOR if(check_for_ir_sensor()) ir_sensor_detected = true; #endif //IR_SENSOR not defined -#if defined MMU_DEBUG && defined MMU_FINDA_DEBUG - puts_P(PSTR("MMU <= 'P0'")); -#endif //MMU_DEBUG && MMU_FINDA_DEBUG + FDEBUG_PUTS_P(PSTR("MMU <= 'P0'")); mmu_puts_P(PSTR("P0\n")); //send 'read finda' request - mmu_state = 2; + mmu_state = S::GetFinda; } return; - case 2: //response to command P0 - if (mmu_rx_ok() > 0) - { - fscanf_P(uart2io, PSTR("%hhu"), &mmu_finda); //scan finda from buffer -#if defined MMU_DEBUG && MMU_FINDA_DEBUG - printf_P(PSTR("MMU => '%dok'\n"), mmu_finda); -#endif //MMU_DEBUG && MMU_FINDA_DEBUG - //printf_P(PSTR("Eact: %d\n"), int(e_active())); - if (!mmu_finda && CHECK_FSENSOR && fsensor_enabled) { - fsensor_stop_and_save_print(); - enquecommand_front_P(PSTR("FSENSOR_RECOVER")); //then recover - ad_markDepleted(mmu_extruder); - if (lcd_autoDepleteEnabled() && !ad_allDepleted()) - { - enquecommand_front_P(PSTR("M600 AUTO")); //save print and run M600 command - } - else - { - enquecommand_front_P(PSTR("M600")); //save print and run M600 command - } - } - mmu_state = 1; - if (mmu_cmd == 0) - mmu_ready = true; - } - else if ((mmu_last_request + MMU_P0_TIMEOUT) < _millis()) - { //resend request after timeout (30s) - mmu_state = 1; - } - return; - case 3: //response to mmu commands + case S::GetFinda: //response to command P0 if (mmu_idl_sens) { if (PIN_GET(IR_SENSOR_PIN) == 0 && mmu_loading_flag) @@ -366,47 +345,96 @@ void mmu_loop(void) } if (mmu_rx_ok() > 0) { -#ifdef MMU_DEBUG - printf_P(PSTR("MMU => 'ok'\n")); -#endif //MMU_DEBUG + fscanf_P(uart2io, PSTR("%hhu"), &mmu_finda); //scan finda from buffer + FDEBUG_PRINTF_P(PSTR("MMU => '%dok'\n"), mmu_finda); + //printf_P(PSTR("Eact: %d\n"), int(e_active())); + if (!mmu_finda && CHECK_FSENSOR && fsensor_enabled) { + fsensor_stop_and_save_print(); + enquecommand_front_P(PSTR("FSENSOR_RECOVER")); //then recover + ad_markDepleted(mmu_extruder); + if (lcd_autoDepleteEnabled() && !ad_allDepleted()) + { + enquecommand_front_P(PSTR("M600 AUTO")); //save print and run M600 command + } + else + { + enquecommand_front_P(PSTR("M600")); //save print and run M600 command + } + } + mmu_state = S::Idle; + if (mmu_cmd == MmuCmd::None) + mmu_ready = true; + } + else if ((mmu_last_request + MMU_P0_TIMEOUT) < _millis()) + { //resend request after timeout (30s) + mmu_state = S::Idle; + } + return; + case S::WaitCmd: //response to mmu commands + if (mmu_idl_sens) + { + if (PIN_GET(IR_SENSOR_PIN) == 0 && mmu_loading_flag) + { + DEBUG_PRINTF_P(PSTR("MMU <= 'A'\n")); + mmu_puts_P(PSTR("A\n")); //send 'abort' request + mmu_idl_sens = 0; + //printf_P(PSTR("MMU IDLER_SENSOR = 0 - ABORT\n")); + } + //else + //printf_P(PSTR("MMU IDLER_SENSOR = 1 - WAIT\n")); + } + if (mmu_rx_ok() > 0) + { + DEBUG_PRINTF_P(PSTR("MMU => 'ok'\n")); mmu_attempt_nr = 0; - mmu_last_cmd = 0; + mmu_last_cmd = MmuCmd::None; mmu_ready = true; - mmu_state = 1; + mmu_state = S::Idle; } else if ((mmu_last_request + MMU_CMD_TIMEOUT) < _millis()) { //resend request after timeout (5 min) - if (mmu_last_cmd) + if (mmu_last_cmd >= MmuCmd::T0 && mmu_last_cmd <= MmuCmd::T4) { if (mmu_attempt_nr++ < MMU_MAX_RESEND_ATTEMPTS) { -#ifdef MMU_DEBUG - printf_P(PSTR("MMU retry attempt nr. %d\n"), mmu_attempt_nr - 1); -#endif //MMU_DEBUG + DEBUG_PRINTF_P(PSTR("MMU retry attempt nr. %d\n"), mmu_attempt_nr - 1); mmu_cmd = mmu_last_cmd; } else { - mmu_cmd = 0; - mmu_last_cmd = 0; //check + mmu_cmd = MmuCmd::None; + mmu_last_cmd = MmuCmd::None; //check mmu_attempt_nr = 0; } } - mmu_state = 1; + mmu_state = S::Idle; } return; - case 4: + case S::Pause: + if (mmu_rx_ok() > 0) + { + DEBUG_PRINTF_P(PSTR("MMU => 'ok', resume print\n")); + mmu_attempt_nr = 0; + mmu_last_cmd = MmuCmd::None; + mmu_ready = true; + mmu_state = S::Idle; + lcd_resume_print(); + } + if (mmu_cmd != MmuCmd::None) + { + mmu_state = S::Idle; + } + return; + case S::GetDrvError: if (mmu_rx_ok() > 0) { fscanf_P(uart2io, PSTR("%d"), &mmu_power_failures); //scan power failures -#ifdef MMU_DEBUG - printf_P(PSTR("MMU => 'ok'\n")); -#endif //MMU_DEBUG - mmu_last_cmd = 0; + DEBUG_PRINTF_P(PSTR("MMU => 'ok'\n")); + mmu_last_cmd = MmuCmd::None; mmu_ready = true; - mmu_state = 1; + mmu_state = S::Idle; } else if ((mmu_last_request + MMU_CMD_TIMEOUT) < _millis()) { //resend request after timeout (5 min) - mmu_state = 1; + mmu_state = S::Idle; } } } @@ -437,20 +465,20 @@ int8_t mmu_set_filament_type(uint8_t extruder, uint8_t filament) //! Call manage_response() after enqueuing to process command. //! If T command is enqueued, it disables current for extruder motor if TMC2130 driver present. //! If T or L command is enqueued, it marks filament loaded in AutoDeplete module. -void mmu_command(uint8_t cmd) +void mmu_command(MmuCmd cmd) { - if ((cmd >= MMU_CMD_T0) && (cmd <= MMU_CMD_T4)) + if ((cmd >= MmuCmd::T0) && (cmd <= MmuCmd::T4)) { //disable extruder motor #ifdef TMC2130 tmc2130_set_pwr(E_AXIS, 0); #endif //TMC2130 //printf_P(PSTR("E-axis disabled\n")); - ad_markLoaded(cmd - MMU_CMD_T0); + ad_markLoaded(cmd - MmuCmd::T0); } - if ((cmd >= MMU_CMD_L0) && (cmd <= MMU_CMD_L4)) + if ((cmd >= MmuCmd::L0) && (cmd <= MmuCmd::L4)) { - ad_markLoaded(cmd - MMU_CMD_L0); + ad_markLoaded(cmd - MmuCmd::L0); } mmu_cmd = cmd; @@ -489,20 +517,30 @@ bool can_extrude() return true; } +static void get_response_print_info(uint8_t move) { + printf_P(PSTR("mmu_get_response - begin move: "), move); + switch (move) { + case MMU_LOAD_MOVE: printf_P(PSTR("load\n")); break; + case MMU_UNLOAD_MOVE: printf_P(PSTR("unload\n")); break; + case MMU_TCODE_MOVE: printf_P(PSTR("T-code\n")); break; + case MMU_NO_MOVE: printf_P(PSTR("no move\n")); break; + default: printf_P(PSTR("error: unknown move\n")); break; + } +} + bool mmu_get_response(uint8_t move) { - mmu_loading_flag = false; - printf_P(PSTR("mmu_get_response - begin move:%d\n"), move); + get_response_print_info(move); KEEPALIVE_STATE(IN_PROCESS); - while (mmu_cmd != 0) + while (mmu_cmd != MmuCmd::None) { delay_keep_alive(100); } while (!mmu_ready) { - if ((mmu_state != 3) && (mmu_last_cmd == 0)) + if ((mmu_state != S::WaitCmd) && (mmu_last_cmd == MmuCmd::None)) break; switch (move) { @@ -547,7 +585,7 @@ bool mmu_get_response(uint8_t move) disable_e0(); //turn off E-stepper to prevent overheating and alow filament pull-out if necessary delay_keep_alive(MMU_LOAD_TIME_MS); move = MMU_LOAD_MOVE; - printf_P(PSTR("mmu_get_response - begin move:%d\n"), move); + get_response_print_info(move); } break; case MMU_NO_MOVE: @@ -586,7 +624,7 @@ void manage_response(bool move_axes, bool turn_off_nozzle, uint8_t move) float x_position_bckp = current_position[X_AXIS]; float y_position_bckp = current_position[Y_AXIS]; uint8_t screen = 0; //used for showing multiscreen messages - + mmu_loading_flag = false; while(!response) { response = mmu_get_response(move); //wait for "ok" from mmu @@ -661,6 +699,7 @@ void manage_response(bool move_axes, bool turn_off_nozzle, uint8_t move) } else if (mmu_print_saved) { printf_P(PSTR("MMU starts responding\n")); + mmu_loading_flag = false; if (turn_off_nozzle) { lcd_clear(); @@ -794,7 +833,7 @@ void mmu_M600_load_filament(bool automatic) // printf_P(PSTR("T code: %d \n"), tmp_extruder); // mmu_printf_P(PSTR("T%d\n"), tmp_extruder); - mmu_command(MMU_CMD_T0 + tmp_extruder); + mmu_command(MmuCmd::T0 + tmp_extruder); manage_response(false, true, MMU_LOAD_MOVE); mmu_continue_loading(); @@ -885,8 +924,8 @@ void display_loading() void extr_adj(int extruder) //loading filament for SNMM { #ifndef SNMM - uint8_t cmd = MMU_CMD_L0 + extruder; - if (cmd > MMU_CMD_L4) + MmuCmd cmd = MmuCmd::L0 + extruder; + if (cmd > MmuCmd::L4) { printf_P(PSTR("Filament out of range %d \n"),extruder); return; @@ -1006,7 +1045,7 @@ void extr_unload() mmu_filament_ramming(); - mmu_command(MMU_CMD_U0); + mmu_command(MmuCmd::U0); // get response manage_response(false, true, MMU_UNLOAD_MOVE); @@ -1066,7 +1105,13 @@ void extr_unload() } else { - show_preheat_nozzle_warning(); + eFilamentAction=e_FILAMENT_ACTION_mmuUnLoad; + bFilamentFirstRun=false; + if(target_temperature[0]>=EXTRUDE_MINTEMP) { + bFilamentPreheatState=true; + mFilamentItem(target_temperature[0]); + } + else menu_submenu(mFilamentMenu); } //lcd_return_to_status(); } @@ -1303,7 +1348,7 @@ void lcd_mmu_load_to_nozzle(uint8_t filament_nr) lcd_set_cursor(0, 1); lcd_puts_P(_T(MSG_LOADING_FILAMENT)); lcd_print(" "); lcd_print(tmp_extruder + 1); - mmu_command(MMU_CMD_T0 + tmp_extruder); + mmu_command(MmuCmd::T0 + tmp_extruder); manage_response(true, true, MMU_TCODE_MOVE); mmu_continue_loading(); mmu_extruder = tmp_extruder; //filament change is finished @@ -1340,12 +1385,12 @@ void mmu_eject_filament(uint8_t filament, bool recover) current_position[E_AXIS] -= 80; plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 2500 / 60, active_extruder); st_synchronize(); - mmu_command(MMU_CMD_E0 + filament); + mmu_command(MmuCmd::E0 + filament); manage_response(false, false, MMU_UNLOAD_MOVE); if (recover) { lcd_show_fullscreen_message_and_wait_P(_i("Please remove filament and then press the knob.")); - mmu_command(MMU_CMD_R0); + mmu_command(MmuCmd::R0); manage_response(false, false); } @@ -1362,46 +1407,62 @@ void mmu_eject_filament(uint8_t filament, bool recover) } } +static void load_more() +{ + for (uint8_t i = 0; i < MMU_IDLER_SENSOR_ATTEMPTS_NR; i++) + { + if (PIN_GET(IR_SENSOR_PIN) == 0) return; + DEBUG_PRINTF_P(PSTR("Additional load attempt nr. %d\n"), i); + mmu_command(MmuCmd::C0); + manage_response(true, true, MMU_LOAD_MOVE); + } +} + void mmu_continue_loading() { + if (ir_sensor_detected) + { + load_more(); - if (ir_sensor_detected) { - for (uint8_t i = 0; i < MMU_IDLER_SENSOR_ATTEMPTS_NR; i++) { - if (PIN_GET(IR_SENSOR_PIN) == 0) return; -#ifdef MMU_DEBUG - printf_P(PSTR("Additional load attempt nr. %d\n"), i); -#endif // MMU_DEBUG - mmu_command(MMU_CMD_C0); - manage_response(true, true, MMU_LOAD_MOVE); - } if (PIN_GET(IR_SENSOR_PIN) != 0) { uint8_t mmu_load_fail = eeprom_read_byte((uint8_t*)EEPROM_MMU_LOAD_FAIL); uint16_t mmu_load_fail_tot = eeprom_read_word((uint16_t*)EEPROM_MMU_LOAD_FAIL_TOT); if(mmu_load_fail < 255) eeprom_update_byte((uint8_t*)EEPROM_MMU_LOAD_FAIL, mmu_load_fail + 1); if(mmu_load_fail_tot < 65535) eeprom_update_word((uint16_t*)EEPROM_MMU_LOAD_FAIL_TOT, mmu_load_fail_tot + 1); - char cmd[3]; - //pause print, show error message and then repeat last T-code - stop_and_save_print_to_ram(0, 0); - //lift z - current_position[Z_AXIS] += Z_PAUSE_LIFT; - if (current_position[Z_AXIS] > Z_MAX_POS) current_position[Z_AXIS] = Z_MAX_POS; - plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 15, active_extruder); - st_synchronize(); + mmu_command(MmuCmd::T0 + tmp_extruder); + manage_response(true, true, MMU_TCODE_MOVE); + load_more(); - //Move XY to side - current_position[X_AXIS] = X_PAUSE_POS; - current_position[Y_AXIS] = Y_PAUSE_POS; - plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 50, active_extruder); - st_synchronize(); - //set nozzle target temperature to 0 - setAllTargetHotends(0); - lcd_setstatuspgm(_i("MMU load failed "));////MSG_RECOVERING_PRINT c=20 r=1 - mmu_fil_loaded = false; //so we can retry same T-code again - isPrintPaused = true; + if (PIN_GET(IR_SENSOR_PIN) != 0) + { + //pause print, show error message and then repeat last T-code + stop_and_save_print_to_ram(0, 0); + + //lift z + current_position[Z_AXIS] += Z_PAUSE_LIFT; + if (current_position[Z_AXIS] > Z_MAX_POS) current_position[Z_AXIS] = Z_MAX_POS; + plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 15, active_extruder); + st_synchronize(); + + //Move XY to side + current_position[X_AXIS] = X_PAUSE_POS; + current_position[Y_AXIS] = Y_PAUSE_POS; + plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 50, active_extruder); + st_synchronize(); + + mmu_command(MmuCmd::U0); + manage_response(false, true, MMU_UNLOAD_MOVE); + + setAllTargetHotends(0); + lcd_setstatuspgm(_i("MMU load failed "));////MSG_RECOVERING_PRINT c=20 r=1 + mmu_fil_loaded = false; //so we can retry same T-code again + isPrintPaused = true; + mmu_command(MmuCmd::W0); + } } } else { //mmu_ir_sensor_detected == false - mmu_command(MMU_CMD_C0); + mmu_command(MmuCmd::C0); } } diff --git a/Firmware/mmu.h b/Firmware/mmu.h index 473ee99d7..71930ae7c 100644 --- a/Firmware/mmu.h +++ b/Firmware/mmu.h @@ -32,26 +32,40 @@ extern uint16_t mmu_power_failures; #define MMU_LOAD_FEEDRATE 19.02f //mm/s #define MMU_LOAD_TIME_MS 2000 //should be fine tuned to load time for shortest allowed PTFE tubing and maximum loading speed -#define MMU_CMD_NONE 0 -#define MMU_CMD_T0 0x10 -#define MMU_CMD_T1 0x11 -#define MMU_CMD_T2 0x12 -#define MMU_CMD_T3 0x13 -#define MMU_CMD_T4 0x14 -#define MMU_CMD_L0 0x20 -#define MMU_CMD_L1 0x21 -#define MMU_CMD_L2 0x22 -#define MMU_CMD_L3 0x23 -#define MMU_CMD_L4 0x24 -#define MMU_CMD_C0 0x30 -#define MMU_CMD_U0 0x40 -#define MMU_CMD_E0 0x50 -#define MMU_CMD_E1 0x51 -#define MMU_CMD_E2 0x52 -#define MMU_CMD_E3 0x53 -#define MMU_CMD_E4 0x54 -#define MMU_CMD_R0 0x60 -#define MMU_CMD_S3 0x73 +enum class MmuCmd : uint_least8_t +{ + None, + T0, + T1, + T2, + T3, + T4, + L0, + L1, + L2, + L3, + L4, + C0, + U0, + E0, + E1, + E2, + E3, + E4, + R0, + S3, + W0, +}; + +inline MmuCmd operator+ (MmuCmd cmd, uint8_t filament) +{ + return static_cast(static_cast(cmd) + filament ); +} + +inline uint8_t operator- (MmuCmd cmda, MmuCmd cmdb) +{ + return (static_cast(cmda) - static_cast(cmdb)); +} extern int mmu_puts_P(const char* str); @@ -70,7 +84,7 @@ extern void mmu_reset(void); extern int8_t mmu_set_filament_type(uint8_t extruder, uint8_t filament); -extern void mmu_command(uint8_t cmd); +extern void mmu_command(MmuCmd cmd); extern bool mmu_get_response(uint8_t move = 0); diff --git a/Firmware/pins_Rambo_1_0.h b/Firmware/pins_Rambo_1_0.h index b973fd302..bb6eb026d 100644 --- a/Firmware/pins_Rambo_1_0.h +++ b/Firmware/pins_Rambo_1_0.h @@ -102,7 +102,7 @@ #define SDCARDDETECT 72 -#define IR_SENSOR_PIN 62 //idler sensor @PK0 (digital pin 62/A8) +#define IR_SENSOR_PIN 20 //idler sensor // Support for an 8 bit logic analyzer, for example the Saleae. // Channels 0-2 are fast, they could generate 2.667Mhz waveform with a software loop. diff --git a/Firmware/pins_Rambo_1_3.h b/Firmware/pins_Rambo_1_3.h index b051c4f4b..c1adf5969 100644 --- a/Firmware/pins_Rambo_1_3.h +++ b/Firmware/pins_Rambo_1_3.h @@ -102,7 +102,7 @@ #define SDCARDDETECT 15 -#define IR_SENSOR_PIN 23 // idler sensor @PA1 (digital pin 23, "Z-MAX" connector) +#define IR_SENSOR_PIN 20 //idler sensor // Support for an 8 bit logic analyzer, for example the Saleae. // Channels 0-2 are fast, they could generate 2.667Mhz waveform with a software loop. diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 9614c9a4d..c7df6b66d 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -142,6 +142,9 @@ static void lcd_menu_fails_stats_mmu_print(); static void lcd_menu_fails_stats_mmu_total(); static void lcd_menu_show_sensors_state(); +static void mmu_fil_eject_menu(); +static void mmu_load_to_nozzle_menu(); + #if defined(TMC2130) || defined(FILAMENT_SENSOR) static void lcd_menu_fails_stats(); #endif //TMC2130 or FILAMENT_SENSOR @@ -1784,7 +1787,7 @@ void lcd_return_to_status() lcd_refresh(); // to maybe revive the LCD if static electricity killed it. menu_goto(lcd_status_screen, 0, false, true); menu_depth = 0; - bFilamentAutoloadFlag=false; + eFilamentAction=e_FILAMENT_ACTION_none; // i.e. non-autoLoad } //! @brief Pause print, disable nozzle heater, move to park position @@ -1986,7 +1989,7 @@ static void lcd_menu_fails_stats_mmu_total() // MMU load fails 000 // ////////////////////// - mmu_command(MMU_CMD_S3); + mmu_command(MmuCmd::S3); lcd_timeoutToStatus.stop(); //infinite timeout uint8_t fails = eeprom_read_byte((uint8_t*)EEPROM_MMU_FAIL_TOT); uint16_t load_fails = eeprom_read_byte((uint8_t*)EEPROM_MMU_LOAD_FAIL_TOT); @@ -2300,21 +2303,32 @@ void lcd_set_filament_oq_meass() } +eFILAMENT_ACTION eFilamentAction=e_FILAMENT_ACTION_none; // must be initialized as 'non-autoLoad' bool bFilamentFirstRun; -bool bFilamentLoad; bool bFilamentPreheatState; -bool bFilamentAutoloadFlag; static void mFilamentPrompt() { lcd_set_cursor(0,0); lcdui_print_temp(LCD_STR_THERMOMETER[0],(int)degHotend(0),(int)degTargetHotend(0)); lcd_set_cursor(0,2); -lcd_puts_P(_i("Press the knob")); +lcd_puts_P(_i("Press the knob")); ////MSG_ c=20 r=1 lcd_set_cursor(0,3); -if(bFilamentLoad) - lcd_puts_P(_i("to load filament")); -else lcd_puts_P(_i("to unload filament")); +switch(eFilamentAction) + { + case e_FILAMENT_ACTION_Load: + case e_FILAMENT_ACTION_autoLoad: + case e_FILAMENT_ACTION_mmuLoad: + lcd_puts_P(_i("to load filament")); ////MSG_ c=20 r=1 + break; + case e_FILAMENT_ACTION_unLoad: + case e_FILAMENT_ACTION_mmuUnLoad: + lcd_puts_P(_i("to unload filament")); ////MSG_ c=20 r=1 + break; + case e_FILAMENT_ACTION_mmuEject: + lcd_puts_P(_i("to eject filament")); ////MSG_ c=20 r=1 + break; + } if(lcd_clicked()) { menu_back(); @@ -2322,17 +2336,31 @@ if(lcd_clicked()) if(!bFilamentPreheatState) { menu_back(); - setTargetHotend0(0.0); +//-// setTargetHotend0(0.0); } - if(bFilamentLoad) + switch(eFilamentAction) { - loading_flag = true; - enquecommand_P(PSTR("M701")); // load filament + case e_FILAMENT_ACTION_Load: + case e_FILAMENT_ACTION_autoLoad: + loading_flag = true; + enquecommand_P(PSTR("M701")); // load filament + break; + case e_FILAMENT_ACTION_unLoad: + enquecommand_P(PSTR("M702")); // unload filament + break; + case e_FILAMENT_ACTION_mmuLoad: + menu_submenu(mmu_load_to_nozzle_menu); + break; + case e_FILAMENT_ACTION_mmuUnLoad: + extr_unload(); + break; + case e_FILAMENT_ACTION_mmuEject: + menu_submenu(mmu_fil_eject_menu); + break; } - else enquecommand_P(PSTR("M702")); // unload filament + if(eFilamentAction==e_FILAMENT_ACTION_autoLoad) + eFilamentAction=e_FILAMENT_ACTION_none; // i.e. non-autoLoad } -if(bFilamentLoad) // i.e. not necessary for preHeat @ unload - bFilamentAutoloadFlag=false; } void mFilamentItem(uint16_t nTemp) @@ -2346,11 +2374,23 @@ lcd_timeoutToStatus.stop(); lcd_set_cursor(0,0); lcdui_print_temp(LCD_STR_THERMOMETER[0],(int)degHotend(0),(int)degTargetHotend(0)); lcd_set_cursor(0,1); -if(bFilamentLoad) - lcd_puts_P(_i("Preheating to load")); -else lcd_puts_P(_i("Preheating to unload")); +switch(eFilamentAction) + { + case e_FILAMENT_ACTION_Load: + case e_FILAMENT_ACTION_autoLoad: + case e_FILAMENT_ACTION_mmuLoad: + lcd_puts_P(_i("Preheating to load")); ////MSG_ c=20 r=1 + break; + case e_FILAMENT_ACTION_unLoad: + case e_FILAMENT_ACTION_mmuUnLoad: + lcd_puts_P(_i("Preheating to unload")); ////MSG_ c=20 r=1 + break; + case e_FILAMENT_ACTION_mmuEject: + lcd_puts_P(_i("Preheating to eject")); ////MSG_ c=20 r=1 + break; + } lcd_set_cursor(0,3); -lcd_puts_P(_i(">Cancel")); +lcd_puts_P(_i(">Cancel")); ////MSG_ c=20 r=1 if(lcd_clicked()) { if(!bFilamentPreheatState) @@ -2360,8 +2400,8 @@ if(lcd_clicked()) } else setTargetHotend0((float)nTargetOld); menu_back(); - if(bFilamentLoad) // i.e. not necessary for preHeat @ unload - bFilamentAutoloadFlag=false; + if(eFilamentAction==e_FILAMENT_ACTION_autoLoad) + eFilamentAction=e_FILAMENT_ACTION_none; // i.e. non-autoLoad } else if(!isHeatingHotend0()) { @@ -2410,8 +2450,8 @@ mFilamentItem(FLEX_PREHEAT_HOTEND_TEMP); void mFilamentBack() { menu_back(); -if(bFilamentLoad) // i.e. not necessary for preHeat @ unload - bFilamentAutoloadFlag=false; +if(eFilamentAction==e_FILAMENT_ACTION_autoLoad) + eFilamentAction=e_FILAMENT_ACTION_none; // i.e. non-autoLoad } void mFilamentMenu() @@ -2436,7 +2476,7 @@ if((degHotend0()>EXTRUDE_MINTEMP)&&bFilamentFirstRun) enquecommand_P(PSTR("M702")); // unload filament } else { - bFilamentLoad=false; // i.e. filament unloading mode + eFilamentAction=e_FILAMENT_ACTION_unLoad; bFilamentFirstRun=false; if(target_temperature[0]>=EXTRUDE_MINTEMP) { @@ -2670,7 +2710,7 @@ static void lcd_LoadFilament() } else { - bFilamentLoad=true; // i.e. filament loading mode + eFilamentAction=e_FILAMENT_ACTION_Load; bFilamentFirstRun=false; if(target_temperature[0]>=EXTRUDE_MINTEMP) { @@ -5585,6 +5625,8 @@ static void fil_load_menu() } static void mmu_load_to_nozzle_menu() +{ +if (degHotend0() > EXTRUDE_MINTEMP) { MENU_BEGIN(); MENU_ITEM_BACK_P(_T(MSG_MAIN)); @@ -5595,8 +5637,21 @@ static void mmu_load_to_nozzle_menu() MENU_ITEM_FUNCTION_P(_i("Load filament 5"), mmu_load_to_nozzle_4); MENU_END(); } +else { + eFilamentAction=e_FILAMENT_ACTION_mmuLoad; + bFilamentFirstRun=false; + if(target_temperature[0]>=EXTRUDE_MINTEMP) + { + bFilamentPreheatState=true; + mFilamentItem(target_temperature[0]); + } + else mFilamentMenu(); + } +} static void mmu_fil_eject_menu() +{ +if (degHotend0() > EXTRUDE_MINTEMP) { MENU_BEGIN(); MENU_ITEM_BACK_P(_T(MSG_MAIN)); @@ -5605,9 +5660,19 @@ static void mmu_fil_eject_menu() MENU_ITEM_FUNCTION_P(_i("Eject filament 3"), mmu_eject_fil_2); MENU_ITEM_FUNCTION_P(_i("Eject filament 4"), mmu_eject_fil_3); MENU_ITEM_FUNCTION_P(_i("Eject filament 5"), mmu_eject_fil_4); - MENU_END(); } +else { + eFilamentAction=e_FILAMENT_ACTION_mmuEject; + bFilamentFirstRun=false; + if(target_temperature[0]>=EXTRUDE_MINTEMP) + { + bFilamentPreheatState=true; + mFilamentItem(target_temperature[0]); + } + else mFilamentMenu(); + } +} #ifdef SNMM static void fil_unload_menu() @@ -6077,8 +6142,8 @@ static void lcd_main_menu() { MENU_ITEM_SUBMENU_P(_T(MSG_LOAD_FILAMENT), fil_load_menu); MENU_ITEM_SUBMENU_P(_i("Load to nozzle"), mmu_load_to_nozzle_menu); - MENU_ITEM_GCODE_P(_T(MSG_UNLOAD_FILAMENT), PSTR("M702 C")); - MENU_ITEM_SUBMENU_P(_i("Eject filament"), mmu_fil_eject_menu); + MENU_ITEM_FUNCTION_P(_T(MSG_UNLOAD_FILAMENT), extr_unload); + MENU_ITEM_SUBMENU_P(_i("Eject filament"), mmu_fil_eject_menu); } else { @@ -7208,7 +7273,7 @@ static bool selftest_irsensor() mmu_filament_ramming(); } progress = lcd_selftest_screen(testScreen::fsensor, progress, 1, true, 0); - mmu_command(MMU_CMD_U0); + mmu_command(MmuCmd::U0); manage_response(false, false); for(uint_least8_t i = 0; i < 200; ++i) diff --git a/Firmware/ultralcd.h b/Firmware/ultralcd.h index c692de537..bf3e4697b 100644 --- a/Firmware/ultralcd.h +++ b/Firmware/ultralcd.h @@ -133,10 +133,11 @@ void extr_unload_used(); #endif //SNMM void extr_unload(); +typedef enum + {e_FILAMENT_ACTION_none,e_FILAMENT_ACTION_Load,e_FILAMENT_ACTION_autoLoad,e_FILAMENT_ACTION_unLoad,e_FILAMENT_ACTION_mmuLoad,e_FILAMENT_ACTION_mmuUnLoad,e_FILAMENT_ACTION_mmuEject} eFILAMENT_ACTION; // 'none' state is used as flag for (filament) autoLoad (i.e. opposite for 'autoLoad' state) +extern eFILAMENT_ACTION eFilamentAction; extern bool bFilamentFirstRun; -extern bool bFilamentLoad; extern bool bFilamentPreheatState; -extern bool bFilamentAutoloadFlag; void mFilamentItem(uint16_t nTemp); void mFilamentMenu(); void unload_filament(); diff --git a/Firmware/variants/1_75mm_MK25S-RAMBo10a-E3Dv6full.h b/Firmware/variants/1_75mm_MK25S-RAMBo10a-E3Dv6full.h new file mode 100644 index 000000000..53b545e8b --- /dev/null +++ b/Firmware/variants/1_75mm_MK25S-RAMBo10a-E3Dv6full.h @@ -0,0 +1,505 @@ +#ifndef CONFIGURATION_PRUSA_H +#define CONFIGURATION_PRUSA_H + +#include +/*------------------------------------ + GENERAL SETTINGS + *------------------------------------*/ + +// Printer revision +#define PRINTER_TYPE PRINTER_MK25S +#define FILAMENT_SIZE "1_75mm_MK25S" +#define NOZZLE_TYPE "E3Dv6full" + +// Developer flag +#define DEVELOPER + +// Printer name +#define CUSTOM_MENDEL_NAME "Prusa i3 MK2.5S" + +// Electronics +#define MOTHERBOARD BOARD_RAMBO_MINI_1_0 + +#define HEATBED_V2 +#define STEEL_SHEET +#define TACH0PULLUP + +// Uncomment the below for the E3D PT100 temperature sensor (with or without PT100 Amplifier) +//#define E3D_PT100_EXTRUDER_WITH_AMP +//#define E3D_PT100_EXTRUDER_NO_AMP +//#define E3D_PT100_BED_WITH_AMP +//#define E3D_PT100_BED_NO_AMP + + +/*------------------------------------ + AXIS SETTINGS + *------------------------------------*/ + +// Steps per unit {X,Y,Z,E} +#define DEFAULT_AXIS_STEPS_PER_UNIT {100,100,3200/8,133} + +// Endstop inverting +#define X_MIN_ENDSTOP_INVERTING 0 // set to 1 to invert the logic of the endstop. +#define Y_MIN_ENDSTOP_INVERTING 0 // set to 1 to invert the logic of the endstop. +#define Z_MIN_ENDSTOP_INVERTING 0 // set to 1 to invert the logic of the endstop. + +// Direction inverting +#define INVERT_X_DIR 0 // for Mendel set to 0, for Orca set to 1 +#define INVERT_Y_DIR 0 // for Mendel set to 1, for Orca set to 0 +#define INVERT_Z_DIR 0 // for Mendel set to 0, for Orca set to 1 +#define INVERT_E0_DIR 1 // for direct drive extruder v9 set to 1, for geared extruder set to 0 +#define INVERT_E1_DIR 1 // for direct drive extruder v9 set to 1, for geared extruder set to 0 +#define INVERT_E2_DIR 1 // for direct drive extruder v9 set to 1, for geared extruder set to 0 + +// Home position +#define MANUAL_X_HOME_POS 0 +#define MANUAL_Y_HOME_POS -2.2 +#define MANUAL_Z_HOME_POS 0.2 + +// Travel limits after homing +#define X_MAX_POS 250 +#define X_MIN_POS 0 +#define Y_MAX_POS 210 +#define Y_MIN_POS -4 +#define Z_MAX_POS 210 +#define Z_MIN_POS 0.15 + +// Canceled home position +#define X_CANCEL_POS 50 +#define Y_CANCEL_POS 190 + +//Pause print position +#define X_PAUSE_POS 50 +#define Y_PAUSE_POS 190 +#define Z_PAUSE_LIFT 20 + +#define NUM_AXIS 4 // The axis order in all axis related arrays is X, Y, Z, E +#define HOMING_FEEDRATE {3000, 3000, 800, 0} // set the homing speeds (mm/min) // 3000 is also valid for stallGuard homing. Valid range: 2200 - 3000 + +/** + * [0,0] steel sheet print area point X coordinate in bed print area coordinates + */ +#define SHEET_PRINT_ZERO_REF_X 0.f +/** + * [0,0] steel sheet print area point Y coordinate in bed print area coordinates + */ +#define SHEET_PRINT_ZERO_REF_Y 0.f + +#define DEFAULT_MAX_FEEDRATE {200, 200, 12, 120} // (mm/sec) max feedrate (M203) +#define DEFAULT_MAX_FEEDRATE_SILENT {172, 172, 12, 120} // (mm/sec) max feedrate (M203), silent mode +#define DEFAULT_MAX_ACCELERATION {1000, 1000, 200, 5000} // (mm/sec^2) max acceleration (M201) +#define DEFAULT_MAX_ACCELERATION_SILENT {960, 960, 200, 5000} // (mm/sec^2) max acceleration (M201), silent mode + +#define DEFAULT_ACCELERATION 1250 // X, Y, Z and E max acceleration in mm/s^2 for printing moves (M204S) +#define DEFAULT_RETRACT_ACCELERATION 1250 // X, Y, Z and E max acceleration in mm/s^2 for retracts (M204T) + +#define MANUAL_FEEDRATE {2700, 2700, 1000, 100} // set the speeds for manual moves (mm/min) + +//number of bytes from end of the file to start check +#define END_FILE_SECTION 20000 + +#define Z_AXIS_ALWAYS_ON 1 + +// New XYZ calibration +#define NEW_XYZCAL + +// Fan check +#define FANCHECK + +// Safety timer +#define SAFETYTIMER +#define DEFAULT_SAFETYTIMER_TIME_MINS 30 + +// Filament sensor +#define FILAMENT_SENSOR +#define IR_SENSOR + + +#define DEBUG_DCODE3 + +//#define DEBUG_BUILD +#ifdef DEBUG_BUILD +//#define _NO_ASM +#define DEBUG_DCODES //D codes +#define DEBUG_STACK_MONITOR //Stack monitor in stepper ISR +//#define DEBUG_FSENSOR_LOG //Reports fsensor status to serial +//#define DEBUG_CRASHDET_COUNTERS //Display crash-detection counters on LCD +//#define DEBUG_RESUME_PRINT //Resume/save print debug enable +//#define DEBUG_UVLO_AUTOMATIC_RECOVER // Power panic automatic recovery debug output +//#define DEBUG_DISABLE_XMINLIMIT //x min limit ignored +//#define DEBUG_DISABLE_XMAXLIMIT //x max limit ignored +//#define DEBUG_DISABLE_YMINLIMIT //y min limit ignored +//#define DEBUG_DISABLE_YMAXLIMIT //y max limit ignored +//#define DEBUG_DISABLE_ZMINLIMIT //z min limit ignored +//#define DEBUG_DISABLE_ZMAXLIMIT //z max limit ignored +//#define DEBUG_DISABLE_STARTMSGS //no startup messages +//#define DEBUG_DISABLE_MINTEMP //mintemp error ignored +//#define DEBUG_DISABLE_SWLIMITS //sw limits ignored +//#define DEBUG_DISABLE_LCD_STATUS_LINE //empty four lcd line +//#define DEBUG_DISABLE_PREVENT_EXTRUDER //cold extrusion and long extrusion allowed +//#define DEBUG_DISABLE_PRUSA_STATISTICS //disable prusa_statistics() mesages +//#define DEBUG_XSTEP_DUP_PIN 21 //duplicate x-step output to pin 21 (SCL on P3) +//#define DEBUG_YSTEP_DUP_PIN 21 //duplicate y-step output to pin 21 (SCL on P3) +//#define DEBUG_DISABLE_FANCHECK //disable fan check (no ISR INT7, check disabled) +//#define DEBUG_DUMP_TO_2ND_SERIAL //dump received characters to 2nd serial line +//#define DEBUG_STEPPER_TIMER_MISSED // Stop on stepper timer overflow, beep and display a message. +//#define PLANNER_DIAGNOSTICS // Show the planner queue status on printer display. +//#define CMD_DIAGNOSTICS //Show cmd queue length on printer display +#endif /* DEBUG_BUILD */ + +//#define FSENSOR_QUALITY + + +/*------------------------------------ + EXTRUDER SETTINGS + *------------------------------------*/ + +// Mintemps +#define HEATER_0_MINTEMP 30 +#define HEATER_1_MINTEMP 5 +#define HEATER_2_MINTEMP 5 +#define HEATER_MINTEMP_DELAY 15000 // [ms] ! if changed, check maximal allowed value @ ShortTimer +#if HEATER_MINTEMP_DELAY>USHRT_MAX +#error "Check maximal allowed value @ ShortTimer (see HEATER_MINTEMP_DELAY definition)" +#endif +#define BED_MINTEMP 30 +#define BED_MINTEMP_DELAY 50000 // [ms] ! if changed, check maximal allowed value @ ShortTimer +#if BED_MINTEMP_DELAY>USHRT_MAX +#error "Check maximal allowed value @ ShortTimer (see BED_MINTEMP_DELAY definition)" +#endif + +// Maxtemps +#if defined(E3D_PT100_EXTRUDER_WITH_AMP) || defined(E3D_PT100_EXTRUDER_NO_AMP) +#define HEATER_0_MAXTEMP 410 +#else +#define HEATER_0_MAXTEMP 305 +#endif +#define HEATER_1_MAXTEMP 305 +#define HEATER_2_MAXTEMP 305 +#define BED_MAXTEMP 125 + +#if defined(E3D_PT100_EXTRUDER_WITH_AMP) || defined(E3D_PT100_EXTRUDER_NO_AMP) +// Define PID constants for extruder with PT100 +#define DEFAULT_Kp 21.70 +#define DEFAULT_Ki 1.60 +#define DEFAULT_Kd 73.76 +#else +// Define PID constants for extruder +//#define DEFAULT_Kp 40.925 +//#define DEFAULT_Ki 4.875 +//#define DEFAULT_Kd 86.085 +#define DEFAULT_Kp 16.13 +#define DEFAULT_Ki 1.1625 +#define DEFAULT_Kd 56.23 +#endif + +// Extrude mintemp +#define EXTRUDE_MINTEMP 175 + +// Extruder cooling fans +#define EXTRUDER_0_AUTO_FAN_PIN 8 +#define EXTRUDER_1_AUTO_FAN_PIN -1 +#define EXTRUDER_2_AUTO_FAN_PIN -1 +#define EXTRUDER_AUTO_FAN_TEMPERATURE 50 +#define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed + + +/*------------------------------------ + LOAD/UNLOAD FILAMENT SETTINGS + *------------------------------------*/ + +// Load filament commands +#define LOAD_FILAMENT_0 "M83" +#define LOAD_FILAMENT_1 "G1 E70 F400" +#define LOAD_FILAMENT_2 "G1 E40 F100" + +// Unload filament commands +#define UNLOAD_FILAMENT_0 "M83" +#define UNLOAD_FILAMENT_1 "G1 E-80 F7000" + +/*------------------------------------ + CHANGE FILAMENT SETTINGS + *------------------------------------*/ + +// Filament change configuration +#define FILAMENTCHANGEENABLE +#ifdef FILAMENTCHANGEENABLE +#define FILAMENTCHANGE_XPOS 211 +#define FILAMENTCHANGE_YPOS 0 +#define FILAMENTCHANGE_ZADD 2 +#define FILAMENTCHANGE_FIRSTRETRACT -2 +#define FILAMENTCHANGE_FINALRETRACT -80 + +#define FILAMENTCHANGE_FIRSTFEED 70 //E distance in mm for fast filament loading sequence used used in filament change (M600) +#define FILAMENTCHANGE_FINALFEED 25 //E distance in mm for slow filament loading sequence used used in filament change (M600) and filament load (M701) +#define FILAMENTCHANGE_RECFEED 5 + +#define FILAMENTCHANGE_XYFEED 50 +#define FILAMENTCHANGE_EFEED_FIRST 20 // feedrate in mm/s for fast filament loading sequence used in filament change (M600) +#define FILAMENTCHANGE_EFEED_FINAL 3.3f // feedrate in mm/s for slow filament loading sequence used in filament change (M600) and filament load (M701) +//#define FILAMENTCHANGE_RFEED 400 +#define FILAMENTCHANGE_RFEED 7000 / 60 +#define FILAMENTCHANGE_EXFEED 2 +#define FILAMENTCHANGE_ZFEED 15 + +#endif + +/*------------------------------------ + ADDITIONAL FEATURES SETTINGS + *------------------------------------*/ + +// Define Prusa filament runout sensor +//#define FILAMENT_RUNOUT_SUPPORT + +#ifdef FILAMENT_RUNOUT_SUPPORT +#define FILAMENT_RUNOUT_SENSOR 1 +#endif + +// temperature runaway +#define TEMP_RUNAWAY_BED_HYSTERESIS 5 +#define TEMP_RUNAWAY_BED_TIMEOUT 360 + +#define TEMP_RUNAWAY_EXTRUDER_HYSTERESIS 15 +#define TEMP_RUNAWAY_EXTRUDER_TIMEOUT 45 + +/*------------------------------------ + MOTOR CURRENT SETTINGS + *------------------------------------*/ + +// Motor Current setting for BIG RAMBo +#define DIGIPOT_MOTOR_CURRENT {135,135,135,135,135} // Values 0-255 (RAMBO 135 = ~0.75A, 185 = ~1A) +#define DIGIPOT_MOTOR_CURRENT_LOUD {135,135,135,135,135} + +// Motor Current settings for RAMBo mini PWM value = MotorCurrentSetting * 255 / range +#if MOTHERBOARD == BOARD_RAMBO_MINI_1_0 || MOTHERBOARD == BOARD_RAMBO_MINI_1_3 +#define MOTOR_CURRENT_PWM_RANGE 2000 +#define DEFAULT_PWM_MOTOR_CURRENT {270, 830, 450} // {XY,Z,E} +#define DEFAULT_PWM_MOTOR_CURRENT_LOUD {540, 830, 500} // {XY,Z,E} +#define Z_SILENT 0 +#define Z_HIGH_POWER 200 +#endif + +/*------------------------------------ + BED SETTINGS + *------------------------------------*/ + +// Define Mesh Bed Leveling system to enable it +#define MESH_BED_LEVELING +#ifdef MESH_BED_LEVELING + +#define MBL_Z_STEP 0.01 + +// Mesh definitions +#define MESH_MIN_X 35 +#define MESH_MAX_X 238 +#define MESH_MIN_Y 6 +#define MESH_MAX_Y 202 + +// Mesh upsample definition +#define MESH_NUM_X_POINTS 7 +#define MESH_NUM_Y_POINTS 7 +// Mesh measure definition +#define MESH_MEAS_NUM_X_POINTS 3 +#define MESH_MEAS_NUM_Y_POINTS 3 + +// Maximum bed level correction value +#define BED_ADJUSTMENT_UM_MAX 100 + +#define MESH_HOME_Z_CALIB 0.2 +#define MESH_HOME_Z_SEARCH 5 //Z lift for homing, mesh bed leveling etc. + +#define X_PROBE_OFFSET_FROM_EXTRUDER 23 // Z probe to nozzle X offset: -left +right +#define Y_PROBE_OFFSET_FROM_EXTRUDER 5 // Z probe to nozzle Y offset: -front +behind +#define Z_PROBE_OFFSET_FROM_EXTRUDER -0.4 // Z probe to nozzle Z offset: -below (always!) +#endif + +// Bed Temperature Control +// Select PID or bang-bang with PIDTEMPBED. If bang-bang, BED_LIMIT_SWITCHING will enable hysteresis +// +// Uncomment this to enable PID on the bed. It uses the same frequency PWM as the extruder. +// If your PID_dT above is the default, and correct for your hardware/configuration, that means 7.689Hz, +// which is fine for driving a square wave into a resistive load and does not significantly impact you FET heating. +// This also works fine on a Fotek SSR-10DA Solid State Relay into a 250W heater. +// If your configuration is significantly different than this and you don't understand the issues involved, you probably +// shouldn't use bed PID until someone else verifies your hardware works. +// If this is enabled, find your own PID constants below. +#define PIDTEMPBED +// +//#define BED_LIMIT_SWITCHING + +// This sets the max power delivered to the bed, and replaces the HEATER_BED_DUTY_CYCLE_DIVIDER option. +// all forms of bed control obey this (PID, bang-bang, bang-bang with hysteresis) +// setting this to anything other than 255 enables a form of PWM to the bed just like HEATER_BED_DUTY_CYCLE_DIVIDER did, +// so you shouldn't use it unless you are OK with PWM on your bed. (see the comment on enabling PIDTEMPBED) +#define MAX_BED_POWER 255 // limits duty cycle to bed; 255=full current + +// Bed temperature compensation settings +#define BED_OFFSET 10 +#define BED_OFFSET_START 40 +#define BED_OFFSET_CENTER 50 + + +#ifdef PIDTEMPBED +//120v 250W silicone heater into 4mm borosilicate (MendelMax 1.5+) +//from FOPDT model - kp=.39 Tp=405 Tdead=66, Tc set to 79.2, aggressive factor of .15 (vs .1, 1, 10) +#if defined(E3D_PT100_BED_WITH_AMP) || defined(E3D_PT100_BED_NO_AMP) +// Define PID constants for extruder with PT100 +#define DEFAULT_bedKp 21.70 +#define DEFAULT_bedKi 1.60 +#define DEFAULT_bedKd 73.76 +#else +#define DEFAULT_bedKp 126.13 +#define DEFAULT_bedKi 4.30 +#define DEFAULT_bedKd 924.76 +#endif + +//120v 250W silicone heater into 4mm borosilicate (MendelMax 1.5+) +//from pidautotune +// #define DEFAULT_bedKp 97.1 +// #define DEFAULT_bedKi 1.41 +// #define DEFAULT_bedKd 1675.16 + +// FIND YOUR OWN: "M303 E-1 C8 S90" to run autotune on the bed at 90 degreesC for 8 cycles. +#endif // PIDTEMPBED + + +/*----------------------------------- + PREHEAT SETTINGS + *------------------------------------*/ + +#define FARM_PREHEAT_HOTEND_TEMP 250 +#define FARM_PREHEAT_HPB_TEMP 40 +#define FARM_PREHEAT_FAN_SPEED 0 + +#define PLA_PREHEAT_HOTEND_TEMP 215 +#define PLA_PREHEAT_HPB_TEMP 60 +#define PLA_PREHEAT_FAN_SPEED 0 + +#define ABS_PREHEAT_HOTEND_TEMP 255 +#define ABS_PREHEAT_HPB_TEMP 100 +#define ABS_PREHEAT_FAN_SPEED 0 + +#define HIPS_PREHEAT_HOTEND_TEMP 220 +#define HIPS_PREHEAT_HPB_TEMP 100 +#define HIPS_PREHEAT_FAN_SPEED 0 + +#define PP_PREHEAT_HOTEND_TEMP 254 +#define PP_PREHEAT_HPB_TEMP 100 +#define PP_PREHEAT_FAN_SPEED 0 + +#define PET_PREHEAT_HOTEND_TEMP 230 +#define PET_PREHEAT_HPB_TEMP 85 +#define PET_PREHEAT_FAN_SPEED 0 + +#define FLEX_PREHEAT_HOTEND_TEMP 240 +#define FLEX_PREHEAT_HPB_TEMP 50 +#define FLEX_PREHEAT_FAN_SPEED 0 + +/*------------------------------------ + THERMISTORS SETTINGS + *------------------------------------*/ + +// +//--NORMAL IS 4.7kohm PULLUP!-- 1kohm pullup can be used on hotend sensor, using correct resistor and table +// +//// Temperature sensor settings: +// -2 is thermocouple with MAX6675 (only for sensor 0) +// -1 is thermocouple with AD595 +// 0 is not used +// 1 is 100k thermistor - best choice for EPCOS 100k (4.7k pullup) +// 2 is 200k thermistor - ATC Semitec 204GT-2 (4.7k pullup) +// 3 is Mendel-parts thermistor (4.7k pullup) +// 4 is 10k thermistor !! do not use it for a hotend. It gives bad resolution at high temp. !! +// 5 is 100K thermistor - ATC Semitec 104GT-2 (Used in ParCan & J-Head) (4.7k pullup) +// 6 is 100k EPCOS - Not as accurate as table 1 (created using a fluke thermocouple) (4.7k pullup) +// 7 is 100k Honeywell thermistor 135-104LAG-J01 (4.7k pullup) +// 71 is 100k Honeywell thermistor 135-104LAF-J01 (4.7k pullup) +// 8 is 100k 0603 SMD Vishay NTCS0603E3104FXT (4.7k pullup) +// 9 is 100k GE Sensing AL03006-58.2K-97-G1 (4.7k pullup) +// 10 is 100k RS thermistor 198-961 (4.7k pullup) +// 11 is 100k beta 3950 1% thermistor (4.7k pullup) +// 12 is 100k 0603 SMD Vishay NTCS0603E3104FXT (4.7k pullup) (calibrated for Makibox hot bed) +// 13 is 100k Hisens 3950 1% up to 300°C for hotend "Simple ONE " & "Hotend "All In ONE" +// 20 is the PT100 circuit found in the Ultimainboard V2.x +// 60 is 100k Maker's Tool Works Kapton Bed Thermistor beta=3950 +// +// 1k ohm pullup tables - This is not normal, you would have to have changed out your 4.7k for 1k +// (but gives greater accuracy and more stable PID) +// 51 is 100k thermistor - EPCOS (1k pullup) +// 52 is 200k thermistor - ATC Semitec 204GT-2 (1k pullup) +// 55 is 100k thermistor - ATC Semitec 104GT-2 (Used in ParCan & J-Head) (1k pullup) +// +// 1047 is Pt1000 with 4k7 pullup +// 1010 is Pt1000 with 1k pullup (non standard) +// 147 is Pt100 with 4k7 pullup +// 148 is E3D Pt100 with 4k7 pullup and no PT100 Amplifier on a MiniRambo 1.3a +// 247 is Pt100 with 4k7 pullup and PT100 Amplifier +// 110 is Pt100 with 1k pullup (non standard) + +#if defined(E3D_PT100_EXTRUDER_WITH_AMP) +#define TEMP_SENSOR_0 247 +#elif defined(E3D_PT100_EXTRUDER_NO_AMP) +#define TEMP_SENSOR_0 148 +#else +#define TEMP_SENSOR_0 5 +#endif +#define TEMP_SENSOR_1 0 +#define TEMP_SENSOR_2 0 +#if defined(E3D_PT100_BED_WITH_AMP) +#define TEMP_SENSOR_BED 247 +#elif defined(E3D_PT100_BED_NO_AMP) +#define TEMP_SENSOR_BED 148 +#else +#define TEMP_SENSOR_BED 1 +#endif +#define TEMP_SENSOR_PINDA 1 + +#define STACK_GUARD_TEST_VALUE 0xA2A2 + +#define MAX_BED_TEMP_CALIBRATION 50 +#define MAX_HOTEND_TEMP_CALIBRATION 50 + +#define MAX_E_STEPS_PER_UNIT 250 +#define MIN_E_STEPS_PER_UNIT 100 + +#define Z_BABYSTEP_MIN -3999 +#define Z_BABYSTEP_MAX 0 + +#define PINDA_PREHEAT_X 20 +#define PINDA_PREHEAT_Y 60 +#define PINDA_PREHEAT_Z 0.15 +/* +#define PINDA_PREHEAT_X 70 +#define PINDA_PREHEAT_Y -3 +#define PINDA_PREHEAT_Z 1*/ +#define PINDA_HEAT_T 120 //time in s + +#define PINDA_MIN_T 50 +#define PINDA_STEP_T 10 +#define PINDA_MAX_T 100 + +#define PING_TIME 60 //time in s +#define PING_TIME_LONG 600 //10 min; used when length of commands buffer > 0 to avoid 0 triggering when dealing with long gcodes +#define PING_ALLERT_PERIOD 60 //time in s + +#define NC_TIME 10 //time in s for periodic important status messages sending which needs reponse from monitoring +#define NC_BUTTON_LONG_PRESS 15 //time in s + +#define LONG_PRESS_TIME 1000 //time in ms for button long press +#define BUTTON_BLANKING_TIME 200 //time in ms for blanking after button release + +#define DEFAULT_PID_TEMP 210 + +#define MIN_PRINT_FAN_SPEED 75 + + +#define M600_TIMEOUT 600 //seconds + +//#define SUPPORT_VERBOSITY + +#define MMU_REQUIRED_FW_BUILDNR 132 +//#define MMU_DEBUG //print communication between MMU2 and printer on serial + +#define MMU_IDLER_SENSOR_ATTEMPTS_NR 21 //max. number of attempts to load filament if first load failed; value for max bowden length and case when loading fails right at the beginning + +#endif //__CONFIGURATION_PRUSA_H diff --git a/Firmware/variants/1_75mm_MK25S-RAMBo13a-E3Dv6full.h b/Firmware/variants/1_75mm_MK25S-RAMBo13a-E3Dv6full.h new file mode 100644 index 000000000..e786b70ff --- /dev/null +++ b/Firmware/variants/1_75mm_MK25S-RAMBo13a-E3Dv6full.h @@ -0,0 +1,506 @@ +#ifndef CONFIGURATION_PRUSA_H +#define CONFIGURATION_PRUSA_H + +#include +/*------------------------------------ + GENERAL SETTINGS + *------------------------------------*/ + +// Printer revision +#define PRINTER_TYPE PRINTER_MK25S +#define FILAMENT_SIZE "1_75mm_MK25" +#define NOZZLE_TYPE "E3Dv6full" + +// Developer flag +#define DEVELOPER + +// Printer name +#define CUSTOM_MENDEL_NAME "Prusa i3 MK2.5S" + +// Electronics +#define MOTHERBOARD BOARD_RAMBO_MINI_1_3 + +#define HEATBED_V2 +#define STEEL_SHEET +#define TACH0PULLUP + +// Uncomment the below for the E3D PT100 temperature sensor (with or without PT100 Amplifier) +//#define E3D_PT100_EXTRUDER_WITH_AMP +//#define E3D_PT100_EXTRUDER_NO_AMP +//#define E3D_PT100_BED_WITH_AMP +//#define E3D_PT100_BED_NO_AMP + + +/*------------------------------------ + AXIS SETTINGS + *------------------------------------*/ + +// Steps per unit {X,Y,Z,E} +#define DEFAULT_AXIS_STEPS_PER_UNIT {100,100,3200/8,133} + +// Endstop inverting +#define X_MIN_ENDSTOP_INVERTING 0 // set to 1 to invert the logic of the endstop. +#define Y_MIN_ENDSTOP_INVERTING 0 // set to 1 to invert the logic of the endstop. +#define Z_MIN_ENDSTOP_INVERTING 0 // set to 1 to invert the logic of the endstop. + +// Direction inverting +#define INVERT_X_DIR 0 // for Mendel set to 0, for Orca set to 1 +#define INVERT_Y_DIR 0 // for Mendel set to 1, for Orca set to 0 +#define INVERT_Z_DIR 0 // for Mendel set to 0, for Orca set to 1 +#define INVERT_E0_DIR 1 // for direct drive extruder v9 set to 1, for geared extruder set to 0 +#define INVERT_E1_DIR 1 // for direct drive extruder v9 set to 1, for geared extruder set to 0 +#define INVERT_E2_DIR 1 // for direct drive extruder v9 set to 1, for geared extruder set to 0 + +// Home position +#define MANUAL_X_HOME_POS 0 +#define MANUAL_Y_HOME_POS -2.2 +#define MANUAL_Z_HOME_POS 0.2 + +// Travel limits after homing +#define X_MAX_POS 250 +#define X_MIN_POS 0 +#define Y_MAX_POS 210 +#define Y_MIN_POS -4 +#define Z_MAX_POS 210 +#define Z_MIN_POS 0.15 + +// Canceled home position +#define X_CANCEL_POS 50 +#define Y_CANCEL_POS 190 + +//Pause print position +#define X_PAUSE_POS 50 +#define Y_PAUSE_POS 190 +#define Z_PAUSE_LIFT 20 + +#define NUM_AXIS 4 // The axis order in all axis related arrays is X, Y, Z, E +#define HOMING_FEEDRATE {3000, 3000, 800, 0} // set the homing speeds (mm/min) // 3000 is also valid for stallGuard homing. Valid range: 2200 - 3000 + +/** + * [0,0] steel sheet print area point X coordinate in bed print area coordinates + */ +#define SHEET_PRINT_ZERO_REF_X 0.f +/** + * [0,0] steel sheet print area point Y coordinate in bed print area coordinates + */ +#define SHEET_PRINT_ZERO_REF_Y 0.f + +#define DEFAULT_MAX_FEEDRATE {200, 200, 12, 120} // (mm/sec) max feedrate (M203) +#define DEFAULT_MAX_FEEDRATE_SILENT {172, 172, 12, 120} // (mm/sec) max feedrate (M203), silent mode +#define DEFAULT_MAX_ACCELERATION {1000, 1000, 200, 5000} // (mm/sec^2) max acceleration (M201) +#define DEFAULT_MAX_ACCELERATION_SILENT {960, 960, 200, 5000} // (mm/sec^2) max acceleration (M201), silent mode + + +#define DEFAULT_ACCELERATION 1250 // X, Y, Z and E max acceleration in mm/s^2 for printing moves (M204S) +#define DEFAULT_RETRACT_ACCELERATION 1250 // X, Y, Z and E max acceleration in mm/s^2 for retracts (M204T) + +#define MANUAL_FEEDRATE {2700, 2700, 1000, 100} // set the speeds for manual moves (mm/min) + +//number of bytes from end of the file to start check +#define END_FILE_SECTION 20000 + +#define Z_AXIS_ALWAYS_ON 1 + +// New XYZ calibration +#define NEW_XYZCAL + +// Fan check +#define FANCHECK + +// Safety timer +#define SAFETYTIMER +#define DEFAULT_SAFETYTIMER_TIME_MINS 30 + +// Filament sensor +#define FILAMENT_SENSOR +#define IR_SENSOR + + +#define DEBUG_DCODE3 + +//#define DEBUG_BUILD +#ifdef DEBUG_BUILD +//#define _NO_ASM +#define DEBUG_DCODES //D codes +#define DEBUG_STACK_MONITOR //Stack monitor in stepper ISR +//#define DEBUG_FSENSOR_LOG //Reports fsensor status to serial +//#define DEBUG_CRASHDET_COUNTERS //Display crash-detection counters on LCD +//#define DEBUG_RESUME_PRINT //Resume/save print debug enable +//#define DEBUG_UVLO_AUTOMATIC_RECOVER // Power panic automatic recovery debug output +//#define DEBUG_DISABLE_XMINLIMIT //x min limit ignored +//#define DEBUG_DISABLE_XMAXLIMIT //x max limit ignored +//#define DEBUG_DISABLE_YMINLIMIT //y min limit ignored +//#define DEBUG_DISABLE_YMAXLIMIT //y max limit ignored +//#define DEBUG_DISABLE_ZMINLIMIT //z min limit ignored +//#define DEBUG_DISABLE_ZMAXLIMIT //z max limit ignored +//#define DEBUG_DISABLE_STARTMSGS //no startup messages +//#define DEBUG_DISABLE_MINTEMP //mintemp error ignored +//#define DEBUG_DISABLE_SWLIMITS //sw limits ignored +//#define DEBUG_DISABLE_LCD_STATUS_LINE //empty four lcd line +//#define DEBUG_DISABLE_PREVENT_EXTRUDER //cold extrusion and long extrusion allowed +//#define DEBUG_DISABLE_PRUSA_STATISTICS //disable prusa_statistics() mesages +//#define DEBUG_XSTEP_DUP_PIN 21 //duplicate x-step output to pin 21 (SCL on P3) +//#define DEBUG_YSTEP_DUP_PIN 21 //duplicate y-step output to pin 21 (SCL on P3) +//#define DEBUG_DISABLE_FANCHECK //disable fan check (no ISR INT7, check disabled) +//#define DEBUG_DUMP_TO_2ND_SERIAL //dump received characters to 2nd serial line +//#define DEBUG_STEPPER_TIMER_MISSED // Stop on stepper timer overflow, beep and display a message. +//#define PLANNER_DIAGNOSTICS // Show the planner queue status on printer display. +//#define CMD_DIAGNOSTICS //Show cmd queue length on printer display +#endif /* DEBUG_BUILD */ + +//#define FSENSOR_QUALITY + + +/*------------------------------------ + EXTRUDER SETTINGS + *------------------------------------*/ + +// Mintemps +#define HEATER_0_MINTEMP 30 +#define HEATER_1_MINTEMP 5 +#define HEATER_2_MINTEMP 5 +#define HEATER_MINTEMP_DELAY 15000 // [ms] ! if changed, check maximal allowed value @ ShortTimer +#if HEATER_MINTEMP_DELAY>USHRT_MAX +#error "Check maximal allowed value @ ShortTimer (see HEATER_MINTEMP_DELAY definition)" +#endif +#define BED_MINTEMP 30 +#define BED_MINTEMP_DELAY 50000 // [ms] ! if changed, check maximal allowed value @ ShortTimer +#if BED_MINTEMP_DELAY>USHRT_MAX +#error "Check maximal allowed value @ ShortTimer (see BED_MINTEMP_DELAY definition)" +#endif + +// Maxtemps +#if defined(E3D_PT100_EXTRUDER_WITH_AMP) || defined(E3D_PT100_EXTRUDER_NO_AMP) +#define HEATER_0_MAXTEMP 410 +#else +#define HEATER_0_MAXTEMP 305 +#endif +#define HEATER_1_MAXTEMP 305 +#define HEATER_2_MAXTEMP 305 +#define BED_MAXTEMP 125 + +#if defined(E3D_PT100_EXTRUDER_WITH_AMP) || defined(E3D_PT100_EXTRUDER_NO_AMP) +// Define PID constants for extruder with PT100 +#define DEFAULT_Kp 21.70 +#define DEFAULT_Ki 1.60 +#define DEFAULT_Kd 73.76 +#else +// Define PID constants for extruder +//#define DEFAULT_Kp 40.925 +//#define DEFAULT_Ki 4.875 +//#define DEFAULT_Kd 86.085 +#define DEFAULT_Kp 16.13 +#define DEFAULT_Ki 1.1625 +#define DEFAULT_Kd 56.23 +#endif + +// Extrude mintemp +#define EXTRUDE_MINTEMP 175 + +// Extruder cooling fans +#define EXTRUDER_0_AUTO_FAN_PIN 8 +#define EXTRUDER_1_AUTO_FAN_PIN -1 +#define EXTRUDER_2_AUTO_FAN_PIN -1 +#define EXTRUDER_AUTO_FAN_TEMPERATURE 50 +#define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed + + +/*------------------------------------ + LOAD/UNLOAD FILAMENT SETTINGS + *------------------------------------*/ + +// Load filament commands +#define LOAD_FILAMENT_0 "M83" +#define LOAD_FILAMENT_1 "G1 E70 F400" +#define LOAD_FILAMENT_2 "G1 E40 F100" + +// Unload filament commands +#define UNLOAD_FILAMENT_0 "M83" +#define UNLOAD_FILAMENT_1 "G1 E-80 F7000" + +/*------------------------------------ + CHANGE FILAMENT SETTINGS + *------------------------------------*/ + +// Filament change configuration +#define FILAMENTCHANGEENABLE +#ifdef FILAMENTCHANGEENABLE +#define FILAMENTCHANGE_XPOS 211 +#define FILAMENTCHANGE_YPOS 0 +#define FILAMENTCHANGE_ZADD 2 +#define FILAMENTCHANGE_FIRSTRETRACT -2 +#define FILAMENTCHANGE_FINALRETRACT -80 + +#define FILAMENTCHANGE_FIRSTFEED 70 //E distance in mm for fast filament loading sequence used used in filament change (M600) +#define FILAMENTCHANGE_FINALFEED 25 //E distance in mm for slow filament loading sequence used used in filament change (M600) and filament load (M701) +#define FILAMENTCHANGE_RECFEED 5 + +#define FILAMENTCHANGE_XYFEED 50 +#define FILAMENTCHANGE_EFEED_FIRST 20 // feedrate in mm/s for fast filament loading sequence used in filament change (M600) +#define FILAMENTCHANGE_EFEED_FINAL 3.3f // feedrate in mm/s for slow filament loading sequence used in filament change (M600) and filament load (M701) +//#define FILAMENTCHANGE_RFEED 400 +#define FILAMENTCHANGE_RFEED 7000 / 60 +#define FILAMENTCHANGE_EXFEED 2 +#define FILAMENTCHANGE_ZFEED 15 + +#endif + +/*------------------------------------ + ADDITIONAL FEATURES SETTINGS + *------------------------------------*/ + +// Define Prusa filament runout sensor +//#define FILAMENT_RUNOUT_SUPPORT + +#ifdef FILAMENT_RUNOUT_SUPPORT +#define FILAMENT_RUNOUT_SENSOR 1 +#endif + +// temperature runaway +#define TEMP_RUNAWAY_BED_HYSTERESIS 5 +#define TEMP_RUNAWAY_BED_TIMEOUT 360 + +#define TEMP_RUNAWAY_EXTRUDER_HYSTERESIS 15 +#define TEMP_RUNAWAY_EXTRUDER_TIMEOUT 45 + +/*------------------------------------ + MOTOR CURRENT SETTINGS + *------------------------------------*/ + +// Motor Current setting for BIG RAMBo +#define DIGIPOT_MOTOR_CURRENT {135,135,135,135,135} // Values 0-255 (RAMBO 135 = ~0.75A, 185 = ~1A) +#define DIGIPOT_MOTOR_CURRENT_LOUD {135,135,135,135,135} + +// Motor Current settings for RAMBo mini PWM value = MotorCurrentSetting * 255 / range +#if MOTHERBOARD == BOARD_RAMBO_MINI_1_0 || MOTHERBOARD == BOARD_RAMBO_MINI_1_3 +#define MOTOR_CURRENT_PWM_RANGE 2000 +#define DEFAULT_PWM_MOTOR_CURRENT {270, 830, 450} // {XY,Z,E} +#define DEFAULT_PWM_MOTOR_CURRENT_LOUD {540, 830, 500} // {XY,Z,E} +#define Z_SILENT 0 +#define Z_HIGH_POWER 200 +#endif + +/*------------------------------------ + BED SETTINGS + *------------------------------------*/ + +// Define Mesh Bed Leveling system to enable it +#define MESH_BED_LEVELING +#ifdef MESH_BED_LEVELING + +#define MBL_Z_STEP 0.01 + +// Mesh definitions +#define MESH_MIN_X 35 +#define MESH_MAX_X 238 +#define MESH_MIN_Y 6 +#define MESH_MAX_Y 202 + +// Mesh upsample definition +#define MESH_NUM_X_POINTS 7 +#define MESH_NUM_Y_POINTS 7 +// Mesh measure definition +#define MESH_MEAS_NUM_X_POINTS 3 +#define MESH_MEAS_NUM_Y_POINTS 3 + +// Maximum bed level correction value +#define BED_ADJUSTMENT_UM_MAX 100 + +#define MESH_HOME_Z_CALIB 0.2 +#define MESH_HOME_Z_SEARCH 5 //Z lift for homing, mesh bed leveling etc. + +#define X_PROBE_OFFSET_FROM_EXTRUDER 23 // Z probe to nozzle X offset: -left +right +#define Y_PROBE_OFFSET_FROM_EXTRUDER 5 // Z probe to nozzle Y offset: -front +behind +#define Z_PROBE_OFFSET_FROM_EXTRUDER -0.4 // Z probe to nozzle Z offset: -below (always!) +#endif + +// Bed Temperature Control +// Select PID or bang-bang with PIDTEMPBED. If bang-bang, BED_LIMIT_SWITCHING will enable hysteresis +// +// Uncomment this to enable PID on the bed. It uses the same frequency PWM as the extruder. +// If your PID_dT above is the default, and correct for your hardware/configuration, that means 7.689Hz, +// which is fine for driving a square wave into a resistive load and does not significantly impact you FET heating. +// This also works fine on a Fotek SSR-10DA Solid State Relay into a 250W heater. +// If your configuration is significantly different than this and you don't understand the issues involved, you probably +// shouldn't use bed PID until someone else verifies your hardware works. +// If this is enabled, find your own PID constants below. +#define PIDTEMPBED +// +//#define BED_LIMIT_SWITCHING + +// This sets the max power delivered to the bed, and replaces the HEATER_BED_DUTY_CYCLE_DIVIDER option. +// all forms of bed control obey this (PID, bang-bang, bang-bang with hysteresis) +// setting this to anything other than 255 enables a form of PWM to the bed just like HEATER_BED_DUTY_CYCLE_DIVIDER did, +// so you shouldn't use it unless you are OK with PWM on your bed. (see the comment on enabling PIDTEMPBED) +#define MAX_BED_POWER 255 // limits duty cycle to bed; 255=full current + +// Bed temperature compensation settings +#define BED_OFFSET 10 +#define BED_OFFSET_START 40 +#define BED_OFFSET_CENTER 50 + + +#ifdef PIDTEMPBED +//120v 250W silicone heater into 4mm borosilicate (MendelMax 1.5+) +//from FOPDT model - kp=.39 Tp=405 Tdead=66, Tc set to 79.2, aggressive factor of .15 (vs .1, 1, 10) +#if defined(E3D_PT100_BED_WITH_AMP) || defined(E3D_PT100_BED_NO_AMP) +// Define PID constants for extruder with PT100 +#define DEFAULT_bedKp 21.70 +#define DEFAULT_bedKi 1.60 +#define DEFAULT_bedKd 73.76 +#else +#define DEFAULT_bedKp 126.13 +#define DEFAULT_bedKi 4.30 +#define DEFAULT_bedKd 924.76 +#endif + +//120v 250W silicone heater into 4mm borosilicate (MendelMax 1.5+) +//from pidautotune +// #define DEFAULT_bedKp 97.1 +// #define DEFAULT_bedKi 1.41 +// #define DEFAULT_bedKd 1675.16 + +// FIND YOUR OWN: "M303 E-1 C8 S90" to run autotune on the bed at 90 degreesC for 8 cycles. +#endif // PIDTEMPBED + + +/*----------------------------------- + PREHEAT SETTINGS + *------------------------------------*/ + +#define FARM_PREHEAT_HOTEND_TEMP 250 +#define FARM_PREHEAT_HPB_TEMP 40 +#define FARM_PREHEAT_FAN_SPEED 0 + +#define PLA_PREHEAT_HOTEND_TEMP 215 +#define PLA_PREHEAT_HPB_TEMP 60 +#define PLA_PREHEAT_FAN_SPEED 0 + +#define ABS_PREHEAT_HOTEND_TEMP 255 +#define ABS_PREHEAT_HPB_TEMP 100 +#define ABS_PREHEAT_FAN_SPEED 0 + +#define HIPS_PREHEAT_HOTEND_TEMP 220 +#define HIPS_PREHEAT_HPB_TEMP 100 +#define HIPS_PREHEAT_FAN_SPEED 0 + +#define PP_PREHEAT_HOTEND_TEMP 254 +#define PP_PREHEAT_HPB_TEMP 100 +#define PP_PREHEAT_FAN_SPEED 0 + +#define PET_PREHEAT_HOTEND_TEMP 230 +#define PET_PREHEAT_HPB_TEMP 85 +#define PET_PREHEAT_FAN_SPEED 0 + +#define FLEX_PREHEAT_HOTEND_TEMP 240 +#define FLEX_PREHEAT_HPB_TEMP 50 +#define FLEX_PREHEAT_FAN_SPEED 0 + +/*------------------------------------ + THERMISTORS SETTINGS + *------------------------------------*/ + +// +//--NORMAL IS 4.7kohm PULLUP!-- 1kohm pullup can be used on hotend sensor, using correct resistor and table +// +//// Temperature sensor settings: +// -2 is thermocouple with MAX6675 (only for sensor 0) +// -1 is thermocouple with AD595 +// 0 is not used +// 1 is 100k thermistor - best choice for EPCOS 100k (4.7k pullup) +// 2 is 200k thermistor - ATC Semitec 204GT-2 (4.7k pullup) +// 3 is Mendel-parts thermistor (4.7k pullup) +// 4 is 10k thermistor !! do not use it for a hotend. It gives bad resolution at high temp. !! +// 5 is 100K thermistor - ATC Semitec 104GT-2 (Used in ParCan & J-Head) (4.7k pullup) +// 6 is 100k EPCOS - Not as accurate as table 1 (created using a fluke thermocouple) (4.7k pullup) +// 7 is 100k Honeywell thermistor 135-104LAG-J01 (4.7k pullup) +// 71 is 100k Honeywell thermistor 135-104LAF-J01 (4.7k pullup) +// 8 is 100k 0603 SMD Vishay NTCS0603E3104FXT (4.7k pullup) +// 9 is 100k GE Sensing AL03006-58.2K-97-G1 (4.7k pullup) +// 10 is 100k RS thermistor 198-961 (4.7k pullup) +// 11 is 100k beta 3950 1% thermistor (4.7k pullup) +// 12 is 100k 0603 SMD Vishay NTCS0603E3104FXT (4.7k pullup) (calibrated for Makibox hot bed) +// 13 is 100k Hisens 3950 1% up to 300°C for hotend "Simple ONE " & "Hotend "All In ONE" +// 20 is the PT100 circuit found in the Ultimainboard V2.x +// 60 is 100k Maker's Tool Works Kapton Bed Thermistor beta=3950 +// +// 1k ohm pullup tables - This is not normal, you would have to have changed out your 4.7k for 1k +// (but gives greater accuracy and more stable PID) +// 51 is 100k thermistor - EPCOS (1k pullup) +// 52 is 200k thermistor - ATC Semitec 204GT-2 (1k pullup) +// 55 is 100k thermistor - ATC Semitec 104GT-2 (Used in ParCan & J-Head) (1k pullup) +// +// 1047 is Pt1000 with 4k7 pullup +// 1010 is Pt1000 with 1k pullup (non standard) +// 147 is Pt100 with 4k7 pullup +// 148 is E3D Pt100 with 4k7 pullup and no PT100 Amplifier on a MiniRambo 1.3a +// 247 is Pt100 with 4k7 pullup and PT100 Amplifier +// 110 is Pt100 with 1k pullup (non standard) + +#if defined(E3D_PT100_EXTRUDER_WITH_AMP) +#define TEMP_SENSOR_0 247 +#elif defined(E3D_PT100_EXTRUDER_NO_AMP) +#define TEMP_SENSOR_0 148 +#else +#define TEMP_SENSOR_0 5 +#endif +#define TEMP_SENSOR_1 0 +#define TEMP_SENSOR_2 0 +#if defined(E3D_PT100_BED_WITH_AMP) +#define TEMP_SENSOR_BED 247 +#elif defined(E3D_PT100_BED_NO_AMP) +#define TEMP_SENSOR_BED 148 +#else +#define TEMP_SENSOR_BED 1 +#endif +#define TEMP_SENSOR_PINDA 1 + +#define STACK_GUARD_TEST_VALUE 0xA2A2 + +#define MAX_BED_TEMP_CALIBRATION 50 +#define MAX_HOTEND_TEMP_CALIBRATION 50 + +#define MAX_E_STEPS_PER_UNIT 250 +#define MIN_E_STEPS_PER_UNIT 100 + +#define Z_BABYSTEP_MIN -3999 +#define Z_BABYSTEP_MAX 0 + +#define PINDA_PREHEAT_X 20 +#define PINDA_PREHEAT_Y 60 +#define PINDA_PREHEAT_Z 0.15 +/* +#define PINDA_PREHEAT_X 70 +#define PINDA_PREHEAT_Y -3 +#define PINDA_PREHEAT_Z 1*/ +#define PINDA_HEAT_T 120 //time in s + +#define PINDA_MIN_T 50 +#define PINDA_STEP_T 10 +#define PINDA_MAX_T 100 + +#define PING_TIME 60 //time in s +#define PING_TIME_LONG 600 //10 min; used when length of commands buffer > 0 to avoid 0 triggering when dealing with long gcodes +#define PING_ALLERT_PERIOD 60 //time in s + +#define NC_TIME 10 //time in s for periodic important status messages sending which needs reponse from monitoring +#define NC_BUTTON_LONG_PRESS 15 //time in s + +#define LONG_PRESS_TIME 1000 //time in ms for button long press +#define BUTTON_BLANKING_TIME 200 //time in ms for blanking after button release + +#define DEFAULT_PID_TEMP 210 + +#define MIN_PRINT_FAN_SPEED 75 + + +#define M600_TIMEOUT 600 //seconds + +//#define SUPPORT_VERBOSITY + +#define MMU_REQUIRED_FW_BUILDNR 132 +//#define MMU_DEBUG //print communication between MMU2 and printer on serial + +#define MMU_IDLER_SENSOR_ATTEMPTS_NR 21 //max. number of attempts to load filament if first load failed; value for max bowden length and case when loading fails right at the beginning + +#endif //__CONFIGURATION_PRUSA_H diff --git a/Firmware/variants/1_75mm_MK3S-EINSy10a-E3Dv6full.h b/Firmware/variants/1_75mm_MK3S-EINSy10a-E3Dv6full.h new file mode 100644 index 000000000..37512071c --- /dev/null +++ b/Firmware/variants/1_75mm_MK3S-EINSy10a-E3Dv6full.h @@ -0,0 +1,631 @@ +#ifndef CONFIGURATION_PRUSA_H +#define CONFIGURATION_PRUSA_H + +#include +/*------------------------------------ + GENERAL SETTINGS + *------------------------------------*/ + +// Printer revision +#define PRINTER_TYPE PRINTER_MK3S +#define FILAMENT_SIZE "1_75mm_MK3" +#define NOZZLE_TYPE "E3Dv6full" + +// Developer flag +#define DEVELOPER + +// Printer name +#define CUSTOM_MENDEL_NAME "Prusa i3 MK3S" + +// Electronics +#define MOTHERBOARD BOARD_EINSY_1_0a +#define STEEL_SHEET +#define HAS_SECOND_SERIAL_PORT + + +// Uncomment the below for the E3D PT100 temperature sensor (with or without PT100 Amplifier) +//#define E3D_PT100_EXTRUDER_WITH_AMP +//#define E3D_PT100_EXTRUDER_NO_AMP +//#define E3D_PT100_BED_WITH_AMP +//#define E3D_PT100_BED_NO_AMP + + +/*------------------------------------ + AXIS SETTINGS + *------------------------------------*/ + +// Steps per unit {X,Y,Z,E} +//#define DEFAULT_AXIS_STEPS_PER_UNIT {100,100,3200/8,140} +#define DEFAULT_AXIS_STEPS_PER_UNIT {100,100,3200/8,280} +//#define DEFAULT_AXIS_STEPS_PER_UNIT {100,100,3200/8,560} + +// Endstop inverting +#define X_MIN_ENDSTOP_INVERTING 0 // set to 1 to invert the logic of the endstop. +#define Y_MIN_ENDSTOP_INVERTING 0 // set to 1 to invert the logic of the endstop. +#define Z_MIN_ENDSTOP_INVERTING 0 // set to 1 to invert the logic of the endstop. + +// Direction inverting +#define INVERT_X_DIR 1 // for Mendel set to 0, for Orca set to 1 +#define INVERT_Y_DIR 0 // for Mendel set to 1, for Orca set to 0 +#define INVERT_Z_DIR 1 // for Mendel set to 0, for Orca set to 1 +#define INVERT_E0_DIR 0 // for direct drive extruder v9 set to 1, for geared extruder set to 0 +#define INVERT_E1_DIR 0 // for direct drive extruder v9 set to 1, for geared extruder set to 0 +#define INVERT_E2_DIR 0 // for direct drive extruder v9 set to 1, for geared extruder set to 0 + +// Home position +#define MANUAL_X_HOME_POS 0 +#define MANUAL_Y_HOME_POS -2.2 +#define MANUAL_Z_HOME_POS 0.2 + +// Travel limits after homing +#define X_MAX_POS 255 +#define X_MIN_POS 0 +#define Y_MAX_POS 212.5 +#define Y_MIN_POS -4 //orig -4 +#define Z_MAX_POS 210 +#define Z_MIN_POS 0.15 + +// Canceled home position +#define X_CANCEL_POS 50 +#define Y_CANCEL_POS 190 + +//Pause print position +#define X_PAUSE_POS 50 +#define Y_PAUSE_POS 190 +#define Z_PAUSE_LIFT 20 + +#define NUM_AXIS 4 // The axis order in all axis related arrays is X, Y, Z, E +#define HOMING_FEEDRATE {3000, 3000, 800, 0} // set the homing speeds (mm/min) // 3000 is also valid for stallGuard homing. Valid range: 2200 - 3000 + +//#define DEFAULT_Y_OFFSET 4.f // Default distance of Y_MIN_POS point from endstop, when the printer is not calibrated. +/** + * [0,0] steel sheet print area point X coordinate in bed print area coordinates + */ +#define SHEET_PRINT_ZERO_REF_X 0.f +/** + * [0,0] steel sheet print area point Y coordinate in bed print area coordinates + */ +#define SHEET_PRINT_ZERO_REF_Y -2.f + +#define DEFAULT_MAX_FEEDRATE {200, 200, 12, 120} // (mm/sec) max feedrate (M203) +#define DEFAULT_MAX_FEEDRATE_SILENT {100, 100, 12, 120} // (mm/sec) max feedrate (M203), silent mode + +#define DEFAULT_MAX_ACCELERATION {1000, 1000, 200, 5000} // (mm/sec^2) max acceleration (M201) +#define DEFAULT_MAX_ACCELERATION_SILENT {960, 960, 200, 5000} // (mm/sec^2) max acceleration (M201), silent mode + + +#define DEFAULT_ACCELERATION 1250 // X, Y, Z and E max acceleration in mm/s^2 for printing moves (M204S) +#define DEFAULT_RETRACT_ACCELERATION 1250 // X, Y, Z and E max acceleration in mm/s^2 for retracts (M204T) + +#define MANUAL_FEEDRATE {2700, 2700, 1000, 100} // set the speeds for manual moves (mm/min) + +//Silent mode limits +#define SILENT_MAX_ACCEL_XY 960ul // max acceleration in silent mode in mm/s^2 +#define SILENT_MAX_FEEDRATE_XY 100 // max feedrate in mm/s + +//Normal mode limits +#define NORMAL_MAX_ACCEL_XY 2500ul // max acceleration in normal mode in mm/s^2 +#define NORMAL_MAX_FEEDRATE_XY 200 // max feedrate in mm/s + +//number of bytes from end of the file to start check +#define END_FILE_SECTION 20000 + +#define Z_AXIS_ALWAYS_ON 1 + +//Crash detection +#define CRASHDET_TIMER 45 //seconds +#define CRASHDET_COUNTER_MAX 3 + +// New XYZ calibration +#define NEW_XYZCAL + +// Watchdog support +#define WATCHDOG + +// Power panic +#define UVLO_SUPPORT + +// Fan check +#define FANCHECK + +// Safety timer +#define SAFETYTIMER +#define DEFAULT_SAFETYTIMER_TIME_MINS 30 + +// Filament sensor +#define FILAMENT_SENSOR +#define IR_SENSOR + +// Backlash - +//#define BACKLASH_X +//#define BACKLASH_Y + + +// Minimum ambient temperature limit to start triggering MINTEMP errors [C] +// this value is litlebit higher that real limit, because ambient termistor is on the board and is temperated from it, +// temperature inside the case is around 31C for ambient temperature 25C, when the printer is powered on long time and idle +// the real limit is 15C (same as MINTEMP limit), this is because 15C is end of scale for both used thermistors (bed, heater) +#define MINTEMP_MINAMBIENT 25 +#define MINTEMP_MINAMBIENT_RAW 978 + +#define DEBUG_DCODE3 + +//#define DEBUG_BUILD +//#define DEBUG_SEC_LANG //secondary language debug output at startup +//#define DEBUG_W25X20CL //debug external spi flash +#ifdef DEBUG_BUILD +//#define _NO_ASM +#define DEBUG_DCODES //D codes +#define DEBUG_STACK_MONITOR //Stack monitor in stepper ISR +//#define DEBUG_FSENSOR_LOG //Reports fsensor status to serial +//#define DEBUG_CRASHDET_COUNTERS //Display crash-detection counters on LCD +//#define DEBUG_RESUME_PRINT //Resume/save print debug enable +//#define DEBUG_UVLO_AUTOMATIC_RECOVER // Power panic automatic recovery debug output +//#define DEBUG_DISABLE_XMINLIMIT //x min limit ignored +//#define DEBUG_DISABLE_XMAXLIMIT //x max limit ignored +//#define DEBUG_DISABLE_YMINLIMIT //y min limit ignored +//#define DEBUG_DISABLE_YMAXLIMIT //y max limit ignored +//#define DEBUG_DISABLE_ZMINLIMIT //z min limit ignored +//#define DEBUG_DISABLE_ZMAXLIMIT //z max limit ignored +#define DEBUG_DISABLE_STARTMSGS //no startup messages +//#define DEBUG_DISABLE_MINTEMP //mintemp error ignored +//#define DEBUG_DISABLE_SWLIMITS //sw limits ignored +//#define DEBUG_DISABLE_LCD_STATUS_LINE //empty four lcd line +//#define DEBUG_DISABLE_PREVENT_EXTRUDER //cold extrusion and long extrusion allowed +//#define DEBUG_DISABLE_PRUSA_STATISTICS //disable prusa_statistics() mesages +//#define DEBUG_DISABLE_FORCE_SELFTEST //disable force selftest +//#define DEBUG_XSTEP_DUP_PIN 21 //duplicate x-step output to pin 21 (SCL on P3) +//#define DEBUG_YSTEP_DUP_PIN 21 //duplicate y-step output to pin 21 (SCL on P3) +//#define DEBUG_DISABLE_FANCHECK //disable fan check (no ISR INT7, check disabled) +//#define DEBUG_DISABLE_FSENSORCHECK //disable fsensor check (no ISR INT7, check disabled) +#define DEBUG_DUMP_TO_2ND_SERIAL //dump received characters to 2nd serial line +#define DEBUG_STEPPER_TIMER_MISSED // Stop on stepper timer overflow, beep and display a message. +#define PLANNER_DIAGNOSTICS // Show the planner queue status on printer display. +#define CMD_DIAGNOSTICS //Show cmd queue length on printer display +#endif /* DEBUG_BUILD */ + +//#define FSENSOR_QUALITY + + +#define LINEARITY_CORRECTION +#define TMC2130_LINEARITY_CORRECTION +#define TMC2130_LINEARITY_CORRECTION_XYZ +//#define TMC2130_VARIABLE_RESOLUTION + + + +/*------------------------------------ + TMC2130 default settings + *------------------------------------*/ + +#define TMC2130_FCLK 12000000 // fclk = 12MHz + +#define TMC2130_USTEPS_XY 16 // microstep resolution for XY axes +#define TMC2130_USTEPS_Z 16 // microstep resolution for Z axis +#define TMC2130_USTEPS_E 32 // microstep resolution for E axis +#define TMC2130_INTPOL_XY 1 // extrapolate 256 for XY axes +#define TMC2130_INTPOL_Z 1 // extrapolate 256 for Z axis +#define TMC2130_INTPOL_E 1 // extrapolate 256 for E axis + +#define TMC2130_PWM_GRAD_X 2 // PWMCONF +#define TMC2130_PWM_AMPL_X 230 // PWMCONF +#define TMC2130_PWM_AUTO_X 1 // PWMCONF +#define TMC2130_PWM_FREQ_X 2 // PWMCONF + +#define TMC2130_PWM_GRAD_Y 2 // PWMCONF +#define TMC2130_PWM_AMPL_Y 235 // PWMCONF +#define TMC2130_PWM_AUTO_Y 1 // PWMCONF +#define TMC2130_PWM_FREQ_Y 2 // PWMCONF + +#define TMC2130_PWM_GRAD_Z 4 // PWMCONF +#define TMC2130_PWM_AMPL_Z 200 // PWMCONF +#define TMC2130_PWM_AUTO_Z 1 // PWMCONF +#define TMC2130_PWM_FREQ_Z 2 // PWMCONF + +#define TMC2130_PWM_GRAD_E 4 // PWMCONF +#define TMC2130_PWM_AMPL_E 240 // PWMCONF +#define TMC2130_PWM_AUTO_E 1 // PWMCONF +#define TMC2130_PWM_FREQ_E 2 // PWMCONF + +#define TMC2130_TOFF_XYZ 3 // CHOPCONF // fchop = 27.778kHz +#define TMC2130_TOFF_E 3 // CHOPCONF // fchop = 27.778kHz +//#define TMC2130_TOFF_E 4 // CHOPCONF // fchop = 21.429kHz +//#define TMC2130_TOFF_E 5 // CHOPCONF // fchop = 17.442kHz + +//#define TMC2130_STEALTH_E // Extruder stealthChop mode +//#define TMC2130_CNSTOFF_E // Extruder constant-off-time mode (similar to MK2) + +//#define TMC2130_PWM_DIV 683 // PWM frequency divider (1024, 683, 512, 410) +#define TMC2130_PWM_DIV 512 // PWM frequency divider (1024, 683, 512, 410) +#define TMC2130_PWM_CLK (2 * TMC2130_FCLK / TMC2130_PWM_DIV) // PWM frequency (23.4kHz, 35.1kHz, 46.9kHz, 58.5kHz for 12MHz fclk) + +#define TMC2130_TPWMTHRS 0 // TPWMTHRS - Sets the switching speed threshold based on TSTEP from stealthChop to spreadCycle mode +#define TMC2130_THIGH 0 // THIGH - unused + +//#define TMC2130_TCOOLTHRS_X 450 // TCOOLTHRS - coolstep treshold +//#define TMC2130_TCOOLTHRS_Y 450 // TCOOLTHRS - coolstep treshold +#define TMC2130_TCOOLTHRS_X 430 // TCOOLTHRS - coolstep treshold +#define TMC2130_TCOOLTHRS_Y 430 // TCOOLTHRS - coolstep treshold +#define TMC2130_TCOOLTHRS_Z 500 // TCOOLTHRS - coolstep treshold +#define TMC2130_TCOOLTHRS_E 500 // TCOOLTHRS - coolstep treshold + +#define TMC2130_SG_HOMING 1 // stallguard homing +#define TMC2130_SG_THRS_X 3 // stallguard sensitivity for X axis +#define TMC2130_SG_THRS_Y 3 // stallguard sensitivity for Y axis +#define TMC2130_SG_THRS_Z 4 // stallguard sensitivity for Z axis +#define TMC2130_SG_THRS_E 3 // stallguard sensitivity for E axis + +//new settings is possible for vsense = 1, running current value > 31 set vsense to zero and shift both currents by 1 bit right (Z axis only) +#define TMC2130_CURRENTS_H {16, 20, 35, 30} // default holding currents for all axes +#define TMC2130_CURRENTS_R {16, 20, 35, 30} // default running currents for all axes +#define TMC2130_UNLOAD_CURRENT_R 12 // lowe current for M600 to protect filament sensor + +#define TMC2130_STEALTH_Z + +//#define TMC2130_SERVICE_CODES_M910_M918 + +//#define TMC2130_DEBUG +//#define TMC2130_DEBUG_WR +//#define TMC2130_DEBUG_RD + + +/*------------------------------------ + EXTRUDER SETTINGS + *------------------------------------*/ + +// Mintemps +#define HEATER_0_MINTEMP 15 +#define HEATER_1_MINTEMP 5 +#define HEATER_2_MINTEMP 5 +#define HEATER_MINTEMP_DELAY 15000 // [ms] ! if changed, check maximal allowed value @ ShortTimer +#if HEATER_MINTEMP_DELAY>USHRT_MAX +#error "Check maximal allowed value @ ShortTimer (see HEATER_MINTEMP_DELAY definition)" +#endif +#define BED_MINTEMP 15 +#define BED_MINTEMP_DELAY 50000 // [ms] ! if changed, check maximal allowed value @ ShortTimer +#if BED_MINTEMP_DELAY>USHRT_MAX +#error "Check maximal allowed value @ ShortTimer (see BED_MINTEMP_DELAY definition)" +#endif + +// Maxtemps +#if defined(E3D_PT100_EXTRUDER_WITH_AMP) || defined(E3D_PT100_EXTRUDER_NO_AMP) +#define HEATER_0_MAXTEMP 410 +#else +#define HEATER_0_MAXTEMP 305 +#endif +#define HEATER_1_MAXTEMP 305 +#define HEATER_2_MAXTEMP 305 +#define BED_MAXTEMP 125 + +#if defined(E3D_PT100_EXTRUDER_WITH_AMP) || defined(E3D_PT100_EXTRUDER_NO_AMP) +// Define PID constants for extruder with PT100 +#define DEFAULT_Kp 21.70 +#define DEFAULT_Ki 1.60 +#define DEFAULT_Kd 73.76 +#else +// Define PID constants for extruder +//#define DEFAULT_Kp 40.925 +//#define DEFAULT_Ki 4.875 +//#define DEFAULT_Kd 86.085 +#define DEFAULT_Kp 16.13 +#define DEFAULT_Ki 1.1625 +#define DEFAULT_Kd 56.23 +#endif + +// Extrude mintemp +#define EXTRUDE_MINTEMP 175 + +// Extruder cooling fans +#define EXTRUDER_0_AUTO_FAN_PIN 8 +#define EXTRUDER_1_AUTO_FAN_PIN -1 +#define EXTRUDER_2_AUTO_FAN_PIN -1 +#define EXTRUDER_AUTO_FAN_TEMPERATURE 50 +#define EXTRUDER_AUTO_FAN_SPEED 255 // == full speed + + + +/*------------------------------------ + LOAD/UNLOAD FILAMENT SETTINGS + *------------------------------------*/ + +// Load filament commands +#define LOAD_FILAMENT_0 "M83" +#define LOAD_FILAMENT_1 "G1 E70 F400" +#define LOAD_FILAMENT_2 "G1 E40 F100" + +// Unload filament commands +#define UNLOAD_FILAMENT_0 "M83" +#define UNLOAD_FILAMENT_1 "G1 E-80 F7000" + +/*------------------------------------ + CHANGE FILAMENT SETTINGS + *------------------------------------*/ + +// Filament change configuration +#define FILAMENTCHANGEENABLE +#ifdef FILAMENTCHANGEENABLE +#define FILAMENTCHANGE_XPOS 211 +#define FILAMENTCHANGE_YPOS 0 +#define FILAMENTCHANGE_ZADD 2 +#define FILAMENTCHANGE_FIRSTRETRACT -2 +#define FILAMENTCHANGE_FINALRETRACT -80 + +#define FILAMENTCHANGE_FIRSTFEED 70 //E distance in mm for fast filament loading sequence used used in filament change (M600) +#define FILAMENTCHANGE_FINALFEED 25 //E distance in mm for slow filament loading sequence used used in filament change (M600) and filament load (M701) +#define FILAMENTCHANGE_RECFEED 5 + +#define FILAMENTCHANGE_XYFEED 50 +#define FILAMENTCHANGE_EFEED_FIRST 20 // feedrate in mm/s for fast filament loading sequence used in filament change (M600) +#define FILAMENTCHANGE_EFEED_FINAL 3.3f // feedrate in mm/s for slow filament loading sequence used in filament change (M600) and filament load (M701) +//#define FILAMENTCHANGE_RFEED 400 +#define FILAMENTCHANGE_RFEED 7000 / 60 +#define FILAMENTCHANGE_EXFEED 2 +#define FILAMENTCHANGE_ZFEED 15 + +#endif + +/*------------------------------------ + ADDITIONAL FEATURES SETTINGS + *------------------------------------*/ + +// Define Prusa filament runout sensor +//#define FILAMENT_RUNOUT_SUPPORT + +#ifdef FILAMENT_RUNOUT_SUPPORT +#define FILAMENT_RUNOUT_SENSOR 1 +#endif + +// temperature runaway +#define TEMP_RUNAWAY_BED_HYSTERESIS 5 +#define TEMP_RUNAWAY_BED_TIMEOUT 360 + +#define TEMP_RUNAWAY_EXTRUDER_HYSTERESIS 15 +#define TEMP_RUNAWAY_EXTRUDER_TIMEOUT 45 + +/*------------------------------------ + MOTOR CURRENT SETTINGS + *------------------------------------*/ + +// Motor Current settings for Einsy/tmc = 0..63 +#define MOTOR_CURRENT_PWM_RANGE 63 + +/*------------------------------------ + BED SETTINGS + *------------------------------------*/ + +// Define Mesh Bed Leveling system to enable it +#define MESH_BED_LEVELING +#ifdef MESH_BED_LEVELING + +#define MBL_Z_STEP 0.01 + +// Mesh definitions +#define MESH_MIN_X 35 +#define MESH_MAX_X 238 +#define MESH_MIN_Y 6 +#define MESH_MAX_Y 202 + +// Mesh upsample definition +#define MESH_NUM_X_POINTS 7 +#define MESH_NUM_Y_POINTS 7 +// Mesh measure definition +#define MESH_MEAS_NUM_X_POINTS 3 +#define MESH_MEAS_NUM_Y_POINTS 3 + +// Maximum bed level correction value +#define BED_ADJUSTMENT_UM_MAX 100 + +#define MESH_HOME_Z_CALIB 0.2 +#define MESH_HOME_Z_SEARCH 5 //Z lift for homing, mesh bed leveling etc. + +#define X_PROBE_OFFSET_FROM_EXTRUDER 23 // Z probe to nozzle X offset: -left +right +#define Y_PROBE_OFFSET_FROM_EXTRUDER 5 // Z probe to nozzle Y offset: -front +behind +#define Z_PROBE_OFFSET_FROM_EXTRUDER -0.4 // Z probe to nozzle Z offset: -below (always!) +#endif + +// Bed Temperature Control +// Select PID or bang-bang with PIDTEMPBED. If bang-bang, BED_LIMIT_SWITCHING will enable hysteresis +// +// Uncomment this to enable PID on the bed. It uses the same frequency PWM as the extruder. +// If your PID_dT above is the default, and correct for your hardware/configuration, that means 7.689Hz, +// which is fine for driving a square wave into a resistive load and does not significantly impact you FET heating. +// This also works fine on a Fotek SSR-10DA Solid State Relay into a 250W heater. +// If your configuration is significantly different than this and you don't understand the issues involved, you probably +// shouldn't use bed PID until someone else verifies your hardware works. +// If this is enabled, find your own PID constants below. +#define PIDTEMPBED +// +//#define BED_LIMIT_SWITCHING + +// This sets the max power delivered to the bed, and replaces the HEATER_BED_DUTY_CYCLE_DIVIDER option. +// all forms of bed control obey this (PID, bang-bang, bang-bang with hysteresis) +// setting this to anything other than 255 enables a form of PWM to the bed just like HEATER_BED_DUTY_CYCLE_DIVIDER did, +// so you shouldn't use it unless you are OK with PWM on your bed. (see the comment on enabling PIDTEMPBED) +#define MAX_BED_POWER 255 // limits duty cycle to bed; 255=full current + +// Bed temperature compensation settings +#define BED_OFFSET 10 +#define BED_OFFSET_START 40 +#define BED_OFFSET_CENTER 50 + + +#ifdef PIDTEMPBED +//120v 250W silicone heater into 4mm borosilicate (MendelMax 1.5+) +//from FOPDT model - kp=.39 Tp=405 Tdead=66, Tc set to 79.2, aggressive factor of .15 (vs .1, 1, 10) +#if defined(E3D_PT100_BED_WITH_AMP) || defined(E3D_PT100_BED_NO_AMP) +// Define PID constants for extruder with PT100 +#define DEFAULT_bedKp 21.70 +#define DEFAULT_bedKi 1.60 +#define DEFAULT_bedKd 73.76 +#else +#define DEFAULT_bedKp 126.13 +#define DEFAULT_bedKi 4.30 +#define DEFAULT_bedKd 924.76 +#endif + +//120v 250W silicone heater into 4mm borosilicate (MendelMax 1.5+) +//from pidautotune +// #define DEFAULT_bedKp 97.1 +// #define DEFAULT_bedKi 1.41 +// #define DEFAULT_bedKd 1675.16 + +// FIND YOUR OWN: "M303 E-1 C8 S90" to run autotune on the bed at 90 degreesC for 8 cycles. +#endif // PIDTEMPBED + +//connect message when communication with monitoring broken +//#define FARM_CONNECT_MESSAGE + +/*----------------------------------- + PREHEAT SETTINGS + *------------------------------------*/ + +#define FARM_PREHEAT_HOTEND_TEMP 250 +#define FARM_PREHEAT_HPB_TEMP 60 +#define FARM_PREHEAT_FAN_SPEED 0 + +#define PLA_PREHEAT_HOTEND_TEMP 215 +#define PLA_PREHEAT_HPB_TEMP 60 +#define PLA_PREHEAT_FAN_SPEED 0 + +#define ABS_PREHEAT_HOTEND_TEMP 255 +#define ABS_PREHEAT_HPB_TEMP 100 +#define ABS_PREHEAT_FAN_SPEED 0 + +#define HIPS_PREHEAT_HOTEND_TEMP 220 +#define HIPS_PREHEAT_HPB_TEMP 100 +#define HIPS_PREHEAT_FAN_SPEED 0 + +#define PP_PREHEAT_HOTEND_TEMP 254 +#define PP_PREHEAT_HPB_TEMP 100 +#define PP_PREHEAT_FAN_SPEED 0 + +#define PET_PREHEAT_HOTEND_TEMP 230 +#define PET_PREHEAT_HPB_TEMP 85 +#define PET_PREHEAT_FAN_SPEED 0 + +#define FLEX_PREHEAT_HOTEND_TEMP 240 +#define FLEX_PREHEAT_HPB_TEMP 50 +#define FLEX_PREHEAT_FAN_SPEED 0 + +/*------------------------------------ + THERMISTORS SETTINGS + *------------------------------------*/ + +// +//--NORMAL IS 4.7kohm PULLUP!-- 1kohm pullup can be used on hotend sensor, using correct resistor and table +// +//// Temperature sensor settings: +// -2 is thermocouple with MAX6675 (only for sensor 0) +// -1 is thermocouple with AD595 +// 0 is not used +// 1 is 100k thermistor - best choice for EPCOS 100k (4.7k pullup) +// 2 is 200k thermistor - ATC Semitec 204GT-2 (4.7k pullup) +// 3 is Mendel-parts thermistor (4.7k pullup) +// 4 is 10k thermistor !! do not use it for a hotend. It gives bad resolution at high temp. !! +// 5 is 100K thermistor - ATC Semitec 104GT-2 (Used in ParCan & J-Head) (4.7k pullup) +// 6 is 100k EPCOS - Not as accurate as table 1 (created using a fluke thermocouple) (4.7k pullup) +// 7 is 100k Honeywell thermistor 135-104LAG-J01 (4.7k pullup) +// 71 is 100k Honeywell thermistor 135-104LAF-J01 (4.7k pullup) +// 8 is 100k 0603 SMD Vishay NTCS0603E3104FXT (4.7k pullup) +// 9 is 100k GE Sensing AL03006-58.2K-97-G1 (4.7k pullup) +// 10 is 100k RS thermistor 198-961 (4.7k pullup) +// 11 is 100k beta 3950 1% thermistor (4.7k pullup) +// 12 is 100k 0603 SMD Vishay NTCS0603E3104FXT (4.7k pullup) (calibrated for Makibox hot bed) +// 13 is 100k Hisens 3950 1% up to 300°C for hotend "Simple ONE " & "Hotend "All In ONE" +// 20 is the PT100 circuit found in the Ultimainboard V2.x +// 60 is 100k Maker's Tool Works Kapton Bed Thermistor beta=3950 +// +// 1k ohm pullup tables - This is not normal, you would have to have changed out your 4.7k for 1k +// (but gives greater accuracy and more stable PID) +// 51 is 100k thermistor - EPCOS (1k pullup) +// 52 is 200k thermistor - ATC Semitec 204GT-2 (1k pullup) +// 55 is 100k thermistor - ATC Semitec 104GT-2 (Used in ParCan & J-Head) (1k pullup) +// +// 1047 is Pt1000 with 4k7 pullup +// 1010 is Pt1000 with 1k pullup (non standard) +// 147 is Pt100 with 4k7 pullup +// 148 is E3D Pt100 with 4k7 pullup and no PT100 Amplifier on a MiniRambo 1.3a +// 247 is Pt100 with 4k7 pullup and PT100 Amplifier +// 110 is Pt100 with 1k pullup (non standard) + +#if defined(E3D_PT100_EXTRUDER_WITH_AMP) +#define TEMP_SENSOR_0 247 +#elif defined(E3D_PT100_EXTRUDER_NO_AMP) +#define TEMP_SENSOR_0 148 +#else +#define TEMP_SENSOR_0 5 +#endif +#define TEMP_SENSOR_1 0 +#define TEMP_SENSOR_2 0 +#if defined(E3D_PT100_BED_WITH_AMP) +#define TEMP_SENSOR_BED 247 +#elif defined(E3D_PT100_BED_NO_AMP) +#define TEMP_SENSOR_BED 148 +#else +#define TEMP_SENSOR_BED 1 +#endif +#define TEMP_SENSOR_PINDA 1 +#define TEMP_SENSOR_AMBIENT 2000 + +#define STACK_GUARD_TEST_VALUE 0xA2A2 + +#define MAX_BED_TEMP_CALIBRATION 50 +#define MAX_HOTEND_TEMP_CALIBRATION 50 + +#define MAX_E_STEPS_PER_UNIT 250 +#define MIN_E_STEPS_PER_UNIT 100 + +#define Z_BABYSTEP_MIN -3999 +#define Z_BABYSTEP_MAX 0 + +#define PINDA_PREHEAT_X 20 +#define PINDA_PREHEAT_Y 60 +#define PINDA_PREHEAT_Z 0.15 +/* +#define PINDA_PREHEAT_X 70 +#define PINDA_PREHEAT_Y -3 +#define PINDA_PREHEAT_Z 1*/ +#define PINDA_HEAT_T 120 //time in s + +#define PINDA_MIN_T 50 +#define PINDA_STEP_T 10 +#define PINDA_MAX_T 100 + +#define PING_TIME 60 //time in s +#define PING_TIME_LONG 600 //10 min; used when length of commands buffer > 0 to avoid 0 triggering when dealing with long gcodes +#define PING_ALLERT_PERIOD 60 //time in s + +#define NC_TIME 10 //time in s for periodic important status messages sending which needs reponse from monitoring +#define NC_BUTTON_LONG_PRESS 15 //time in s + +#define LONG_PRESS_TIME 1000 //time in ms for button long press +#define BUTTON_BLANKING_TIME 200 //time in ms for blanking after button release + +#define DEFAULT_PID_TEMP 210 + +#define MIN_PRINT_FAN_SPEED 75 + + +// How much shall the print head be lifted on power panic? +// Ideally the Z axis will reach a zero phase of the stepper driver on power outage. To simplify this, +// UVLO_Z_AXIS_SHIFT shall be an integer multiply of the stepper driver cycle, that is 4x full step. +// For example, the Prusa i3 MK2 with 16 microsteps per full step has Z stepping of 400 microsteps per mm. +// At 400 microsteps per mm, a full step lifts the Z axis by 0.04mm, and a stepper driver cycle is 0.16mm. +// The following example, 12 * (4 * 16 / 400) = 12 * 0.16mm = 1.92mm. +//#define UVLO_Z_AXIS_SHIFT 1.92 +#define UVLO_Z_AXIS_SHIFT 0.64 +// If power panic occured, and the current temperature is higher then target temperature before interrupt minus this offset, print will be recovered automatically. +#define AUTOMATIC_UVLO_BED_TEMP_OFFSET 5 + +#define HEATBED_V2 + +#define M600_TIMEOUT 600 //seconds + +//#define SUPPORT_VERBOSITY + +#define MMU_REQUIRED_FW_BUILDNR 83 +#define MMU_HWRESET +#define MMU_DEBUG //print communication between MMU2 and printer on serial +#define MMU_IDLER_SENSOR_ATTEMPTS_NR 21 //max. number of attempts to load filament if first load failed; value for max bowden length and case when loading fails right at the beginning + +#endif //__CONFIGURATION_PRUSA_H