diff --git a/Firmware/Marlin.h b/Firmware/Marlin.h index a1b6fe4e..cc2766b4 100755 --- a/Firmware/Marlin.h +++ b/Firmware/Marlin.h @@ -377,7 +377,7 @@ extern uint16_t gcode_in_progress; extern LongTimer safetyTimer; #define PRINT_PERCENT_DONE_INIT 0xff -#define PRINTER_ACTIVE (IS_SD_PRINTING || is_usb_printing || isPrintPaused || (custom_message_type == CustomMsg::TempCal) || saved_printing || (lcd_commands_type == LcdCommands::Layer1Cal) || mmu_print_saved) +#define PRINTER_ACTIVE (IS_SD_PRINTING || is_usb_printing || isPrintPaused || (custom_message_type == CustomMsg::TempCal) || saved_printing || (lcd_commands_type == LcdCommands::Layer1Cal) || mmu_print_saved || homing_flag || mesh_bed_leveling_flag) //! Beware - mcode_in_progress is set as soon as the command gets really processed, //! which is not the same as posting the M600 command into the command queue diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 2db85d01..23a734d7 100755 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -756,7 +756,7 @@ static void factory_reset(char level) lang_reset(); // Force the "Follow calibration flow" message at the next boot up. calibration_status_store(CALIBRATION_STATUS_Z_CALIBRATION); - eeprom_write_byte((uint8_t*)EEPROM_WIZARD_ACTIVE, 1); //run wizard + eeprom_write_byte((uint8_t*)EEPROM_WIZARD_ACTIVE, 2); //run wizard farm_mode = false; eeprom_update_byte((uint8_t*)EEPROM_FARM_MODE, farm_mode); @@ -1564,7 +1564,7 @@ void setup() lcd_show_fullscreen_message_and_wait_P(_i("Old settings found. Default PID, Esteps etc. will be set.")); //if EEPROM version or printer type was changed, inform user that default setting were loaded////MSG_DEFAULT_SETTINGS_LOADED c=20 r=5 Config_StoreSettings(); } - if (eeprom_read_byte((uint8_t*)EEPROM_WIZARD_ACTIVE) == 1) { + if (eeprom_read_byte((uint8_t*)EEPROM_WIZARD_ACTIVE) >= 1) { lcd_wizard(WizState::Run); } if (eeprom_read_byte((uint8_t*)EEPROM_WIZARD_ACTIVE) == 0) { //dont show calibration status messages if wizard is currently active @@ -1826,8 +1826,7 @@ void loop() } #ifdef FANCHECK - if (fan_check_error && isPrintPaused) - { + if (fan_check_error && isPrintPaused && !IS_SD_PRINTING) { KEEPALIVE_STATE(PAUSED_FOR_USER); host_keepalive(); //prevent timeouts since usb processing is disabled until print is resumed. This is for a crude way of pausing a print on all hosts. } @@ -2723,8 +2722,7 @@ static void gcode_G28(bool home_x_axis, long home_x_value, bool home_y_axis, lon current_position[Z_AXIS] = st_get_position_mm(Z_AXIS); #endif - // Reset baby stepping to zero, if the babystepping has already been loaded before. The babystepsTodo value will be - // consumed during the first movements following this statement. + // Reset baby stepping to zero, if the babystepping has already been loaded before. if (home_z) babystep_undo(); @@ -3734,12 +3732,13 @@ There are reasons why some G Codes aren't in numerical order. void process_commands() { #ifdef FANCHECK - if(fan_check_error == EFCE_DETECTED){ - fan_check_error = EFCE_REPORTED; - // SERIAL_PROTOCOLLNRPGM(MSG_OCTOPRINT_PAUSED); - lcd_pause_print(); - cmdqueue_serial_disabled = true; - } + if(fan_check_error == EFCE_DETECTED) { + fan_check_error = EFCE_REPORTED; + if (is_usb_printing) + lcd_pause_usb_print(); + else + lcd_pause_print(); + } #endif if (!buflen) return; //empty command @@ -4754,6 +4753,7 @@ if(eSoundMode!=e_SOUND_MODE_SILENT) */ case 30: { + homing_flag = true; st_synchronize(); // TODO: make sure the bed_level_rotation_matrix is identity or the planner will get set incorectly int l_feedmultiply = setup_for_endstop_move(); @@ -4765,6 +4765,7 @@ if(eSoundMode!=e_SOUND_MODE_SILENT) printf_P(_N("%S X: %.5f Y: %.5f Z: %.5f\n"), _T(MSG_BED), _x, _y, _z); clean_up_after_endstop_move(l_feedmultiply); + homing_flag = false; } break; @@ -4855,6 +4856,8 @@ if(eSoundMode!=e_SOUND_MODE_SILENT) break; } } + + homing_flag = true; // keep homing on to avoid babystepping while the LCD is enabled lcd_update_enable(true); KEEPALIVE_STATE(NOT_BUSY); //no need to print busy messages as we print current temperatures periodicaly SERIAL_ECHOLNPGM("PINDA probe calibration start"); @@ -4899,6 +4902,7 @@ if(eSoundMode!=e_SOUND_MODE_SILENT) bool find_z_result = find_bed_induction_sensor_point_z(-1.f); if (find_z_result == false) { lcd_temp_cal_show_result(find_z_result); + homing_flag = false; break; } zero_z = current_position[Z_AXIS]; @@ -4949,9 +4953,9 @@ if(eSoundMode!=e_SOUND_MODE_SILENT) printf_P(_N("\nPINDA temperature: %.1f Z shift (mm): %.3f"), current_temperature_pinda, current_position[Z_AXIS] - zero_z); EEPROM_save_B(EEPROM_PROBE_TEMP_SHIFT + i * 2, &z_shift); - } lcd_temp_cal_show_result(true); + homing_flag = false; #else //PINDA_THERMISTOR @@ -5161,8 +5165,7 @@ if(eSoundMode!=e_SOUND_MODE_SILENT) mbl.reset(); //reset mesh bed leveling - // Reset baby stepping to zero, if the babystepping has already been loaded before. The babystepsTodo value will be - // consumed during the first movements following this statement. + // Reset baby stepping to zero, if the babystepping has already been loaded before. babystep_undo(); // Cycle through all points and probe them @@ -8134,9 +8137,9 @@ Sigma_Exit: /*! ### M602 - Resume print M602: Resume print */ - case 602: { - if (isPrintPaused) - lcd_resume_print(); + case 602: + { + if (isPrintPaused) lcd_resume_print(); } break; @@ -9690,7 +9693,7 @@ void manage_inactivity_IR_ANALOG_Check(uint16_t &nFSCheckCount, ClFsensorPCB isV void manage_inactivity(bool ignore_stepper_queue/*=false*/) //default argument set in Marlin.h { #ifdef FILAMENT_SENSOR -bool bInhibitFlag; +bool bInhibitFlag = false; #ifdef IR_SENSOR_ANALOG static uint16_t nFSCheckCount=0; #endif // IR_SENSOR_ANALOG @@ -9698,16 +9701,11 @@ static uint16_t nFSCheckCount=0; if (mmu_enabled == false) { //-// if (mcode_in_progress != 600) //M600 not in progress -#ifdef PAT9125 - bInhibitFlag=(menu_menu==lcd_menu_extruder_info); // Support::ExtruderInfo menu active -#endif // PAT9125 -#ifdef IR_SENSOR - bInhibitFlag=(menu_menu==lcd_menu_show_sensors_state); // Support::SensorInfo menu active + if (!PRINTER_ACTIVE) bInhibitFlag=(menu_menu==lcd_menu_show_sensors_state); //Block Filament sensor actions if PRINTER is not active and Support::SensorInfo menu active #ifdef IR_SENSOR_ANALOG - bInhibitFlag=bInhibitFlag||bMenuFSDetect; // Settings::HWsetup::FSdetect menu active + bInhibitFlag=bInhibitFlag||bMenuFSDetect; // Block Filament sensor actions if Settings::HWsetup::FSdetect menu active #endif // IR_SENSOR_ANALOG -#endif // IR_SENSOR - if ((mcode_in_progress != 600) && (eFilamentAction != FilamentAction::AutoLoad) && (!bInhibitFlag) && (menu_menu != lcd_move_e)) //M600 not in progress, preHeat @ autoLoad menu not active, Support::ExtruderInfo/SensorInfo menu not active + if ((mcode_in_progress != 600) && (eFilamentAction != FilamentAction::AutoLoad) && (!bInhibitFlag) && (menu_menu != lcd_move_e)) //M600 not in progress, preHeat @ autoLoad menu not active { if (!moves_planned() && !IS_SD_PRINTING && !is_usb_printing && (lcd_commands_type != LcdCommands::Layer1Cal) && ! eeprom_read_byte((uint8_t*)EEPROM_WIZARD_ACTIVE)) { diff --git a/Firmware/eeprom.h b/Firmware/eeprom.h index f9f93b7d..6fa80aa4 100644 --- a/Firmware/eeprom.h +++ b/Firmware/eeprom.h @@ -408,7 +408,7 @@ static_assert(sizeof(Sheets) == EEPROM_SHEETS_SIZEOF, "Sizeof(Sheets) is not EEP #define EEPROM_POWER_COUNT (EEPROM_FERROR_COUNT - 1) // uint8 (orig EEPROM_UVLO_MESH_BED_LEVELING-17) #define EEPROM_XYZ_CAL_SKEW (EEPROM_POWER_COUNT - 4) // float for skew backup -#define EEPROM_WIZARD_ACTIVE (EEPROM_XYZ_CAL_SKEW - 1) +#define EEPROM_WIZARD_ACTIVE (EEPROM_XYZ_CAL_SKEW - 1) // 0: wizard not active, 1: wizard active, 2: wizard active without yes/no = forced calibrate Z after shipping/service prep. #define EEPROM_BELTSTATUS_X (EEPROM_WIZARD_ACTIVE - 2) // uint16 #define EEPROM_BELTSTATUS_Y (EEPROM_BELTSTATUS_X - 2) // uint16 diff --git a/Firmware/mesh_bed_calibration.cpp b/Firmware/mesh_bed_calibration.cpp index fb79022f..b4490e93 100644 --- a/Firmware/mesh_bed_calibration.cpp +++ b/Firmware/mesh_bed_calibration.cpp @@ -3030,8 +3030,6 @@ static void shift_z(float delta) plan_set_z_position(current_position[Z_AXIS]); } -#define BABYSTEP_LOADZ_BY_PLANNER - // Number of baby steps applied static int babystepLoadZ = 0; @@ -3062,20 +3060,12 @@ void babystep_load() void babystep_apply() { babystep_load(); -#ifdef BABYSTEP_LOADZ_BY_PLANNER shift_z(- float(babystepLoadZ) / float(cs.axis_steps_per_unit[Z_AXIS])); -#else - babystepsTodoZadd(babystepLoadZ); -#endif /* BABYSTEP_LOADZ_BY_PLANNER */ } void babystep_undo() { -#ifdef BABYSTEP_LOADZ_BY_PLANNER shift_z(float(babystepLoadZ) / float(cs.axis_steps_per_unit[Z_AXIS])); -#else - babystepsTodoZsubtract(babystepLoadZ); -#endif /* BABYSTEP_LOADZ_BY_PLANNER */ babystepLoadZ = 0; } diff --git a/Firmware/messages.c b/Firmware/messages.c index aa05ad99..fccf5c62 100644 --- a/Firmware/messages.c +++ b/Firmware/messages.c @@ -70,6 +70,7 @@ const char MSG_MMU_LOAD_FAILS[] PROGMEM_I1 = ISTR("MMU load fails"); ////c=15 const char MSG_NO[] PROGMEM_I1 = ISTR("No"); //// const char MSG_NOZZLE[] PROGMEM_I1 = ISTR("Nozzle"); //// const char MSG_PAPER[] PROGMEM_I1 = ISTR("Place a sheet of paper under the nozzle during the calibration of first 4 points. If the nozzle catches the paper, power off the printer immediately."); ////c=20 r=10 +const char MSG_PAUSE_PRINT[] PROGMEM_I1 = ISTR("Pause print");////c=18 const char MSG_PLACE_STEEL_SHEET[] PROGMEM_I1 = ISTR("Please place steel sheet on heatbed."); ////c=20 r=4 const char MSG_PLEASE_WAIT[] PROGMEM_I1 = ISTR("Please wait"); ////c=20 const char MSG_POWER_FAILURES[] PROGMEM_I1 = ISTR("Power failures"); ////c=15 @@ -116,6 +117,8 @@ const char MSG_WIZARD_CALIBRATION_FAILED[] PROGMEM_I1 = ISTR("Please check our h const char MSG_WIZARD_DONE[] PROGMEM_I1 = ISTR("All is done. Happy printing!"); ////c=20 r=8 const char MSG_WIZARD_HEATING[] PROGMEM_I1 = ISTR("Preheating nozzle. Please wait."); ////c=20 r=3 const char MSG_WIZARD_QUIT[] PROGMEM_I1 = ISTR("You can always resume the Wizard from Calibration -> Wizard."); ////c=20 r=8 +const char MSG_WIZARD_WELCOME[] PROGMEM_I1 = ISTR("Hi, I am your Original Prusa i3 printer. Would you like me to guide you through the setup process?"); //// c=20 r=7 +const char MSG_WIZARD_WELCOME_SHIPPING[] PROGMEM_I1 = ISTR("Hi, I am your Original Prusa i3 printer. I will guide you through a short setup process, in which the Z-axis will be calibrated. Then, you will be ready to print."); ////c=20 r=16 const char MSG_YES[] PROGMEM_I1 = ISTR("Yes"); //// const char MSG_V2_CALIBRATION[] PROGMEM_I1 = ISTR("First layer cal."); ////c=18 const char WELCOME_MSG[] PROGMEM_I1 = ISTR(CUSTOM_MENDEL_NAME " OK."); ////c=20 @@ -188,7 +191,9 @@ const char MSG_ENDSTOP_OPEN[] PROGMEM_N1 = "open"; //// const char MSG_POWERUP[] PROGMEM_N1 = "PowerUp"; //// const char MSG_ERR_STOPPED[] PROGMEM_N1 = "Printer stopped due to errors. Fix the error and use M999 to restart. (Temperature is reset. Set it after restarting)"; //// const char MSG_ENDSTOP_HIT[] PROGMEM_N1 = "TRIGGERED"; //// +const char MSG_OCTOPRINT_PAUSE[] PROGMEM_N1 = "// action:pause"; //// const char MSG_OCTOPRINT_PAUSED[] PROGMEM_N1 = "// action:paused"; //// +const char MSG_OCTOPRINT_RESUME[] PROGMEM_N1 = "// action:resume"; //// const char MSG_OCTOPRINT_RESUMED[] PROGMEM_N1 = "// action:resumed"; //// const char MSG_OCTOPRINT_CANCEL[] PROGMEM_N1 = "// action:cancel"; //// const char MSG_FANCHECK_EXTRUDER[] PROGMEM_N1 = "Err: EXTR. FAN ERROR"; ////c=20 diff --git a/Firmware/messages.h b/Firmware/messages.h index a5b672fa..412b7b66 100644 --- a/Firmware/messages.h +++ b/Firmware/messages.h @@ -69,6 +69,7 @@ extern const char MSG_MMU_LOAD_FAILS[]; extern const char MSG_NO[]; extern const char MSG_NOZZLE[]; extern const char MSG_PAPER[]; +extern const char MSG_PAUSE_PRINT[]; extern const char MSG_PLACE_STEEL_SHEET[]; extern const char MSG_PLEASE_WAIT[]; extern const char MSG_POWER_FAILURES[]; @@ -116,6 +117,8 @@ extern const char MSG_WIZARD_CALIBRATION_FAILED[]; extern const char MSG_WIZARD_DONE[]; extern const char MSG_WIZARD_HEATING[]; extern const char MSG_WIZARD_QUIT[]; +extern const char MSG_WIZARD_WELCOME[]; +extern const char MSG_WIZARD_WELCOME_SHIPPING[]; extern const char MSG_YES[]; extern const char MSG_V2_CALIBRATION[]; extern const char WELCOME_MSG[]; @@ -188,7 +191,9 @@ extern const char MSG_ERR_STOPPED[]; extern const char MSG_ENDSTOP_HIT[]; extern const char MSG_EJECT_FILAMENT[]; extern const char MSG_CUT_FILAMENT[]; +extern const char MSG_OCTOPRINT_PAUSE[]; extern const char MSG_OCTOPRINT_PAUSED[]; +extern const char MSG_OCTOPRINT_RESUME[]; extern const char MSG_OCTOPRINT_RESUMED[]; extern const char MSG_OCTOPRINT_CANCEL[]; extern const char MSG_FANCHECK_EXTRUDER[]; diff --git a/Firmware/optiboot_w25x20cl.cpp b/Firmware/optiboot_w25x20cl.cpp index dce4074e..a18c8832 100644 --- a/Firmware/optiboot_w25x20cl.cpp +++ b/Firmware/optiboot_w25x20cl.cpp @@ -7,6 +7,7 @@ #include "w25x20cl.h" #include "stk500.h" #include "bootapp.h" +#include #define OPTIBOOT_MAJVER 6 #define OPTIBOOT_CUSTOMVER 0 @@ -39,14 +40,10 @@ static unsigned const int __attribute__((section(".version"))) #endif static void watchdogConfig(uint8_t x) { + CRITICAL_SECTION_START WDTCSR = _BV(WDCE) | _BV(WDE); WDTCSR = x; -} - -static void watchdogReset() { - __asm__ __volatile__ ( - "wdr\n" - ); + CRITICAL_SECTION_END } #define RECV_READY ((UCSR0A & _BV(RXC0)) != 0) @@ -63,7 +60,7 @@ static uint8_t getch(void) { * the application "soon", if it keeps happening. (Note that we * don't care that an invalid char is returned...) */ - watchdogReset(); + wdt_reset(); } ch = UDR0; return ch; @@ -117,7 +114,7 @@ uint8_t optiboot_w25x20cl_enter() // Handshake sequence: Initialize the serial line, flush serial line, send magic, receive magic. // If the magic is not received on time, or it is not received correctly, continue to the application. { - watchdogReset(); + wdt_reset(); unsigned long boot_timeout = 2000000; unsigned long boot_timer = 0; const char *ptr = entry_magic_send; @@ -125,7 +122,7 @@ uint8_t optiboot_w25x20cl_enter() const uint8_t selectedSerialPort_bak = selectedSerialPort; // Flush the serial line. while (RECV_READY) { - watchdogReset(); + wdt_reset(); // Dummy register read (discard) (void)(*(char *)UDR0); } @@ -135,14 +132,14 @@ uint8_t optiboot_w25x20cl_enter() // Send the initial magic string. while (ptr != end) putch(pgm_read_byte(ptr ++)); - watchdogReset(); + wdt_reset(); // Wait for two seconds until a magic string (constant entry_magic) is received // from the serial line. ptr = entry_magic_receive; end = strlen_P(entry_magic_receive) + ptr; while (ptr != end) { while (rx_buffer.head == SerialHead) { - watchdogReset(); + wdt_reset(); delayMicroseconds(1); if (++ boot_timer > boot_timeout) { @@ -159,7 +156,7 @@ uint8_t optiboot_w25x20cl_enter() selectedSerialPort = selectedSerialPort_bak; //revert Serial setting return 0; } - watchdogReset(); + wdt_reset(); } cbi(UCSR0B, RXCIE0); //disable the MarlinSerial0 interrupt // Send the cfm magic string. diff --git a/Firmware/temperature.cpp b/Firmware/temperature.cpp index 3a70da21..35b05f0e 100755 --- a/Firmware/temperature.cpp +++ b/Firmware/temperature.cpp @@ -2047,18 +2047,18 @@ FORCE_INLINE static void temperature_isr() if(curTodo>0) { - asm("cli"); + CRITICAL_SECTION_START; babystep(axis,/*fwd*/true); babystepsTodo[axis]--; //less to do next time - asm("sei"); + CRITICAL_SECTION_END; } else if(curTodo<0) { - asm("cli"); + CRITICAL_SECTION_START; babystep(axis,/*fwd*/false); babystepsTodo[axis]++; //less to do next time - asm("sei"); + CRITICAL_SECTION_END; } } #endif //BABYSTEPPING diff --git a/Firmware/temperature.h b/Firmware/temperature.h index da88a53c..0bf94472 100755 --- a/Firmware/temperature.h +++ b/Firmware/temperature.h @@ -99,13 +99,10 @@ extern bool bedPWMDisabled; float unscalePID_d(float d); #endif - - -#ifdef BABYSTEPPING - extern volatile int babystepsTodo[3]; -#endif -void resetPID(uint8_t extruder); + +#ifdef BABYSTEPPING +extern volatile int babystepsTodo[3]; inline void babystepsTodoZadd(int n) { @@ -115,15 +112,9 @@ inline void babystepsTodoZadd(int n) CRITICAL_SECTION_END } } +#endif -inline void babystepsTodoZsubtract(int n) -{ - if (n != 0) { - CRITICAL_SECTION_START - babystepsTodo[Z_AXIS] -= n; - CRITICAL_SECTION_END - } -} +void resetPID(uint8_t extruder); //high level conversion routines, for use outside of temperature.cpp //inline so that there is no performance decrease. diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 5b7b8f59..ec74bf4b 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -673,8 +673,7 @@ void lcdui_print_time(void) { //if remaining print time estimation is available print it else print elapsed time int chars = 0; - if ((PRINTER_ACTIVE) && (starttime != 0)) - { + if (PRINTER_ACTIVE) { uint16_t print_t = 0; uint16_t print_tr = 0; uint16_t print_tc = 0; @@ -682,31 +681,20 @@ void lcdui_print_time(void) char suff_doubt = ' '; #ifdef TMC2130 - if (SilentModeMenu != SILENT_MODE_OFF) - { + if (SilentModeMenu != SILENT_MODE_OFF) { if (print_time_remaining_silent != PRINT_TIME_REMAINING_INIT) - { print_tr = print_time_remaining_silent; - } //#ifdef CLOCK_INTERVAL_TIME if (print_time_to_change_silent != PRINT_TIME_REMAINING_INIT) - { print_tc = print_time_to_change_silent; - } //#endif //CLOCK_INTERVAL_TIME - } - else - { + } else { #endif //TMC2130 if (print_time_remaining_normal != PRINT_TIME_REMAINING_INIT) - { print_tr = print_time_remaining_normal; - } //#ifdef CLOCK_INTERVAL_TIME if (print_time_to_change_normal != PRINT_TIME_REMAINING_INIT) - { print_tc = print_time_to_change_normal; - } //#endif //CLOCK_INTERVAL_TIME #ifdef TMC2130 } @@ -714,30 +702,22 @@ void lcdui_print_time(void) //#ifdef CLOCK_INTERVAL_TIME if (clock_interval == CLOCK_INTERVAL_TIME*2) - { clock_interval = 0; - } + clock_interval++; - if (print_tc != 0 && clock_interval > CLOCK_INTERVAL_TIME) - { + if (print_tc != 0 && clock_interval > CLOCK_INTERVAL_TIME) { print_t = print_tc; suff = 'C'; - } - else + } else //#endif //CLOCK_INTERVAL_TIME - if (print_tr != 0) - { + if (print_tr != 0) { print_t = print_tr; suff = 'R'; - } - else - { - print_t = _millis() / 60000 - starttime / 60000; - } + } else + print_t = _millis() / 60000 - starttime / 60000; - if (feedmultiply != 100 && (print_t == print_tr || print_t == print_tc)) - { + if (feedmultiply != 100 && (print_t == print_tr || print_t == print_tc)) { suff_doubt = '?'; print_t = 100ul * print_t / feedmultiply; } @@ -1555,17 +1535,22 @@ void lcd_return_to_status() eFilamentAction = FilamentAction::None; // i.e. non-autoLoad } -//! @brief Pause print, disable nozzle heater, move to park position +//! @brief Pause print, disable nozzle heater, move to park position, send host action "paused" void lcd_pause_print() { - SERIAL_PROTOCOLLNRPGM(MSG_OCTOPRINT_PAUSED); //pause for octoprint stop_and_save_print_to_ram(0.0, -default_retraction); lcd_return_to_status(); isPrintPaused = true; - if (LcdCommands::Idle == lcd_commands_type) - { + if (LcdCommands::Idle == lcd_commands_type) { lcd_commands_type = LcdCommands::LongPause; } + SERIAL_PROTOCOLLNRPGM(MSG_OCTOPRINT_PAUSED); +} + +//! @brief Send host action "pause" +void lcd_pause_usb_print() +{ + SERIAL_PROTOCOLLNRPGM(MSG_OCTOPRINT_PAUSE); } @@ -1613,8 +1598,8 @@ static void pgmtext_with_colon(const char *ipgmLabel, char *dst, uint8_t dstSize //! |01234567890123456789| //! |Nozzle FAN: 0000 RPM| FAN c=10 r=1 SPEED c=3 r=1 //! |Print FAN: 0000 RPM| FAN c=10 r=1 SPEED c=3 r=1 -//! |Fil. Xd:000 Yd:000 | Fil. c=4 r=1 -//! |Int: 000 Shut: 000 | Int: c=4 r=1 Shut: c=4 r=1 +//! | | +//! | | //! ---------------------- //! @endcode //! @todo Positioning of the messages and values on LCD aren't fixed to their exact place. This causes issues with translations. @@ -1628,40 +1613,14 @@ void lcd_menu_extruder_info() // NOT static due to using ins char nozzle[maxChars], print[maxChars]; pgmtext_with_colon(_i("Nozzle FAN"), nozzle, maxChars); ////c=10 r=1 pgmtext_with_colon(_i("Print FAN"), print, maxChars); ////c=10 r=1 - lcd_printf_P(_N("%s %4d RPM\n" "%s %4d RPM\n"), nozzle, 60*fan_speed[0], print, 60*fan_speed[1] ); - -#ifdef PAT9125 - // Display X and Y difference from Filament sensor - // Display Light intensity from Filament sensor - // Frame_Avg register represents the average brightness of all pixels within a frame (324 pixels). This - // value ranges from 0(darkest) to 255(brightest). - // Display LASER shutter time from Filament sensor - // Shutter register is an index of LASER shutter time. It is automatically controlled by the chip's internal - // auto-exposure algorithm. When the chip is tracking on a good reflection surface, the Shutter is small. - // When the chip is tracking on a poor reflection surface, the Shutter is large. Value ranges from 0 to 46. - if (mmu_enabled == false) - { - if (!fsensor_enabled) - lcd_puts_P(_N("Filament sensor\n" "is disabled.")); - else - { - if (!moves_planned() && !IS_SD_PRINTING && !is_usb_printing && (lcd_commands_type != LcdCommands::Layer1Cal)) - pat9125_update(); - lcd_printf_P(_N( - "Fil. Xd:%3d Yd:%3d\n" ////c=4 r=1 - "Int: %3d " ////c=4 r=1 - "Shut: %3d" ////c=4 r=1 - ), - pat9125_x, pat9125_y, - pat9125_b, pat9125_s - ); - } - } -#endif //PAT9125 - + lcd_printf_P(_N("%s %4d RPM\n" "%s %4d RPM\n"), nozzle, 60*fan_speed[0], print, 60*fan_speed[1] ); menu_back_if_clicked(); } +static uint16_t __attribute__((noinline)) clamp999(uint16_t v){ + return v > 999 ? 999 : v; +} + //! @brief Show Fails Statistics MMU //! //! @code{.unparsed} @@ -1695,13 +1654,11 @@ static void lcd_menu_fails_stats_mmu() static void lcd_menu_fails_stats_mmu_print() { lcd_timeoutToStatus.stop(); //infinite timeout - uint8_t fails = eeprom_read_byte((uint8_t*)EEPROM_MMU_FAIL); - uint16_t load_fails = eeprom_read_byte((uint8_t*)EEPROM_MMU_LOAD_FAIL); lcd_home(); lcd_printf_P(PSTR("%S\n" " %-16.16S%-3d\n" " %-16.16S%-3d"), _T(MSG_LAST_PRINT_FAILURES), ////c=20 - _T(MSG_MMU_FAILS), fails, ////c=15 - _T(MSG_MMU_LOAD_FAILS), load_fails); ////c=15 + _T(MSG_MMU_FAILS), clamp999( eeprom_read_byte((uint8_t*)EEPROM_MMU_FAIL) ), ////c=14 + _T(MSG_MMU_LOAD_FAILS), clamp999( eeprom_read_byte((uint8_t*)EEPROM_MMU_LOAD_FAIL) )); ////c=14 menu_back_if_clicked_fb(); } @@ -1720,14 +1677,12 @@ static void lcd_menu_fails_stats_mmu_total() { 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); lcd_home(); lcd_printf_P(PSTR("%S\n" " %-16.16S%-3d\n" " %-16.16S%-3d\n" " %-16.16S%-3d"), _T(MSG_TOTAL_FAILURES), ////c=20 - _T(MSG_MMU_FAILS), fails, ////c=15 - _T(MSG_MMU_LOAD_FAILS), load_fails, ////c=15 - _i("MMU power fails"), mmu_power_failures); ////c=15 r=1 + _T(MSG_MMU_FAILS), clamp999( eeprom_read_word((uint16_t*)EEPROM_MMU_FAIL_TOT) ), ////c=14 + _T(MSG_MMU_LOAD_FAILS), clamp999( eeprom_read_word((uint16_t*)EEPROM_MMU_LOAD_FAIL_TOT) ), ////c=14 + _i("MMU power fails"), clamp999( mmu_power_failures )); ////c=14 r=1 menu_back_if_clicked_fb(); } @@ -1748,16 +1703,14 @@ static const char failStatsFmt[] PROGMEM = "%S\n" " %-16.16S%-3d\n" " %-16.16S%- static void lcd_menu_fails_stats_total() { lcd_timeoutToStatus.stop(); //infinite timeout - uint16_t power = eeprom_read_word((uint16_t*)EEPROM_POWER_COUNT_TOT); - uint16_t filam = eeprom_read_word((uint16_t*)EEPROM_FERROR_COUNT_TOT); - uint16_t crashX = eeprom_read_word((uint16_t*)EEPROM_CRASH_COUNT_X_TOT); - uint16_t crashY = eeprom_read_word((uint16_t*)EEPROM_CRASH_COUNT_Y_TOT); - lcd_home(); + lcd_home(); lcd_printf_P(failStatsFmt, _T(MSG_TOTAL_FAILURES), ////c=20 - _T(MSG_POWER_FAILURES), power, ////c=15 - _T(MSG_FIL_RUNOUTS), filam, ////c=15 - _T(MSG_CRASH), crashX, crashY); ////c=7 + _T(MSG_POWER_FAILURES), clamp999( eeprom_read_word((uint16_t*)EEPROM_POWER_COUNT_TOT) ), ////c=14 + _T(MSG_FIL_RUNOUTS), clamp999( eeprom_read_word((uint16_t*)EEPROM_FERROR_COUNT_TOT) ), ////c=14 + _T(MSG_CRASH), ////c=7 + clamp999( eeprom_read_word((uint16_t*)EEPROM_CRASH_COUNT_X_TOT) ), + clamp999( eeprom_read_word((uint16_t*)EEPROM_CRASH_COUNT_Y_TOT) )); menu_back_if_clicked_fb(); } @@ -1771,6 +1724,17 @@ static void lcd_menu_fails_stats_total() //! | Crash X 000 Y 000| MSG_CRASH c=7 //! ---------------------- //! @endcode +//! @brief Show Last Print Failures Statistics with PAT9125 +//! +//! @code{.unparsed} +//! |01234567890123456789| +//! |Last print failures | c=20 r=1 +//! | Power failures 000| c=14 r=1 +//! | Runouts H 000 S 000| c=14 r=1 +//! | Crash X:000 Y:000| c=7 r=1 +//! ---------------------- +//! @endcode + //! @todo Positioning of the messages and values on LCD aren't fixed to their exact place. This causes issues with translations. static void lcd_menu_fails_stats_print() { @@ -1846,7 +1810,7 @@ static void lcd_menu_fails_stats() { lcd_timeoutToStatus.stop(); //infinite timeout uint8_t filamentLast = eeprom_read_byte((uint8_t*)EEPROM_FERROR_COUNT); - uint16_t filamentTotal = eeprom_read_word((uint16_t*)EEPROM_FERROR_COUNT_TOT); + uint16_t filamentTotal = clamp999( eeprom_read_word((uint16_t*)EEPROM_FERROR_COUNT_TOT) ); lcd_home(); lcd_printf_P(failStatsFmt, _T(MSG_LAST_PRINT_FAILURES), ////c=20 @@ -2866,6 +2830,13 @@ void lcd_menu_statistics() static void _lcd_move(const char *name, int axis, int min, int max) { + if (homing_flag || mesh_bed_leveling_flag) + { + // printer entered a new state where axis move is forbidden + menu_back(); + return; + } + typedef struct { // 2bytes total bool initialized; // 1byte @@ -3087,6 +3058,13 @@ static void lcd_move_z() { */ static void lcd_babystep_z() { + if (homing_flag || mesh_bed_leveling_flag) + { + // printer changed to a new state where live Z is forbidden + menu_back(); + return; + } + typedef struct { int8_t status; @@ -3122,19 +3100,13 @@ static void lcd_babystep_z() lcd_timeoutToStatus.start(); } - if (lcd_encoder != 0) + if (lcd_encoder != 0) { - if (homing_flag) lcd_encoder = 0; _md->babystepMemZ += (int)lcd_encoder; if (_md->babystepMemZ < Z_BABYSTEP_MIN) _md->babystepMemZ = Z_BABYSTEP_MIN; //-3999 -> -9.99 mm else if (_md->babystepMemZ > Z_BABYSTEP_MAX) _md->babystepMemZ = Z_BABYSTEP_MAX; //0 - else - { - CRITICAL_SECTION_START - babystepsTodo[Z_AXIS] += (int)lcd_encoder; - CRITICAL_SECTION_END - } + else babystepsTodoZadd(lcd_encoder); _md->babystepMemMMZ = _md->babystepMemZ/cs.axis_steps_per_unit[Z_AXIS]; _delay(50); @@ -3940,6 +3912,16 @@ static void lcd_print_state(uint8_t state) } } +//! @brief Show sensor state +//! +//! @code{.unparsed} +//! |01234567890123456789| +//! |PINDA N/A FINDA N/A| MSG_PINDA c=6 MSG_FINDA c=6 +//! |Fil. sensor N/A| MSG_FSENSOR +//! |Xd 000 Yd 000| MSG_XD +//! |Int 000 Shut 000| +//! ---------------------- +//! @endcode static void lcd_show_sensors_state() { //0: N/A; 1: OFF; 2: ON @@ -3952,21 +3934,56 @@ static void lcd_show_sensors_state() { finda_state = mmu_finda; } - if (ir_sensor_detected) { - idler_state = !READ(IR_SENSOR_PIN); - } - lcd_puts_at_P(0, 0, _i("Sensor state")); - lcd_puts_at_P(1, 1, _i("PINDA:")); - lcd_set_cursor(LCD_WIDTH - 4, 1); + //lcd_puts_at_P(0, 0, _i("Sensor state")); + lcd_puts_at_P(0, 0, _i("PINDA")); + lcd_set_cursor(LCD_WIDTH - 14, 0); lcd_print_state(pinda_state); - lcd_puts_at_P(1, 2, _i("FINDA:")); - lcd_set_cursor(LCD_WIDTH - 4, 2); - lcd_print_state(finda_state); + if (mmu_enabled == true) + { + lcd_puts_at_P(10, 0, _i("FINDA")); + lcd_set_cursor(LCD_WIDTH - 3, 0); + lcd_print_state(finda_state); + } - lcd_puts_at_P(1, 3, _i("IR:")); - lcd_set_cursor(LCD_WIDTH - 4, 3); - lcd_print_state(idler_state); + if (ir_sensor_detected) { + idler_state = !READ(IR_SENSOR_PIN); + lcd_puts_at_P(0, 1, _i("Fil. sensor")); + lcd_set_cursor(LCD_WIDTH - 3, 1); + lcd_print_state(idler_state); + } + + +#ifdef PAT9125 + // Display X and Y difference from Filament sensor + // Display Light intensity from Filament sensor + // Frame_Avg register represents the average brightness of all pixels within a frame (324 pixels). This + // value ranges from 0(darkest) to 255(brightest). + // Display LASER shutter time from Filament sensor + // Shutter register is an index of LASER shutter time. It is automatically controlled by the chip's internal + // auto-exposure algorithm. When the chip is tracking on a good reflection surface, the Shutter is small. + // When the chip is tracking on a poor reflection surface, the Shutter is large. Value ranges from 0 to 46. + if (mmu_enabled == false) + { + //if (!fsensor_enabled) + // lcd_puts_P(_N("Filament sensor\n" "is disabled.")); + //else + //{ + if (!moves_planned() && !IS_SD_PRINTING && !is_usb_printing && (lcd_commands_type != LcdCommands::Layer1Cal)) + pat9125_update(); + lcd_set_cursor(0, 2); + lcd_printf_P(_N( + "Xd: %3d " + "Yd: %3d\n" ////c=4 r=1 + "Int: %3d " ////c=4 r=1 + "Shut: %3d" ////c=4 r=1 + ), + pat9125_x, pat9125_y, + pat9125_b, pat9125_s + ); + //} + } +#endif //PAT9125 } void lcd_menu_show_sensors_state() // NOT static due to using inside "Marlin_main" module ("manage_inactivity()") @@ -4942,7 +4959,7 @@ void lcd_wizard(WizState state) { using S = WizState; bool end = false; - int wizard_event; + int8_t wizard_event; const char *msg = NULL; // Make sure EEPROM_WIZARD_ACTIVE is true if entering using different entry point // other than WizState::Run - it is useful for debugging wizard. @@ -4966,14 +4983,18 @@ void lcd_wizard(WizState state) // Btw. the flag may even trigger the viper situation on normal start this way and the user won't be able to find out why. saved_printing = false; - wizard_event = lcd_show_multiscreen_message_yes_no_and_wait_P(_i("Hi, I am your Original Prusa i3 printer. Would you like me to guide you through the setup process?"), false, true);////MSG_WIZARD_WELCOME c=20 r=7 - if (wizard_event) { + if( eeprom_read_byte((uint8_t*)EEPROM_WIZARD_ACTIVE)==2){ + lcd_show_fullscreen_message_and_wait_P(MSG_WIZARD_WELCOME_SHIPPING); state = S::Restore; - eeprom_update_byte((uint8_t*)EEPROM_WIZARD_ACTIVE, 1); - } - else { - eeprom_update_byte((uint8_t*)EEPROM_WIZARD_ACTIVE, 0); - end = true; + } else { + wizard_event = lcd_show_multiscreen_message_yes_no_and_wait_P(MSG_WIZARD_WELCOME, false, true); + if (wizard_event) { + state = S::Restore; + eeprom_update_byte((uint8_t*)EEPROM_WIZARD_ACTIVE, 1); + } else { + eeprom_update_byte((uint8_t*)EEPROM_WIZARD_ACTIVE, 0); + end = true; + } } break; case S::Restore: @@ -5719,10 +5740,12 @@ static void lcd_settings_menu() MENU_ITEM_BACK_P(_T(MSG_MAIN)); MENU_ITEM_SUBMENU_P(_i("Temperature"), lcd_control_temperature_menu);////MSG_TEMPERATURE - if (!homing_flag) + + if (!PRINTER_ACTIVE || isPrintPaused) + { MENU_ITEM_SUBMENU_P(_i("Move axis"), lcd_move_menu_1mm);////MSG_MOVE_AXIS - if (!isPrintPaused) MENU_ITEM_GCODE_P(_i("Disable steppers"), PSTR("M84"));////MSG_DISABLE_STEPPERS + } SETTINGS_FILAMENT_SENSOR; @@ -5756,7 +5779,7 @@ static void lcd_settings_menu() MENU_ITEM_TOGGLE_P(_T(MSG_RPI_PORT), (selectedSerialPort == 0) ? _T(MSG_OFF) : _T(MSG_ON), lcd_second_serial_set); #endif //HAS_SECOND_SERIAL - if (!isPrintPaused && !homing_flag) + if (!isPrintPaused && !homing_flag && !mesh_bed_leveling_flag) MENU_ITEM_SUBMENU_P(_T(MSG_BABYSTEP_Z), lcd_babystep_z); #if (LANG_MODE != 0) @@ -6502,19 +6525,20 @@ static bool fan_error_selftest() return 0; } -//! @brief Resume paused print +//! @brief Resume paused print, send host action "resumed" //! @todo It is not good to call restore_print_from_ram_and_continue() from function called by lcd_update(), //! as restore_print_from_ram_and_continue() calls lcd_update() internally. void lcd_resume_print() { lcd_return_to_status(); lcd_reset_alert_level(); //for fan speed error - if (fan_error_selftest()) return; //abort if error persists + if (fan_error_selftest()) { + if (is_usb_printing) SERIAL_PROTOCOLLNRPGM(MSG_OCTOPRINT_PAUSED); + return; //abort if error persists + } cmdqueue_serial_disabled = false; - lcd_setstatuspgm(_T(MSG_FINISHING_MOVEMENTS)); st_synchronize(); - custom_message_type = CustomMsg::Resuming; isPrintPaused = false; restore_print_from_ram_and_continue(default_retraction); @@ -6524,6 +6548,12 @@ void lcd_resume_print() custom_message_type = CustomMsg::Status; } +//! @brief Resume paused USB/host print, send host action "resume" +void lcd_resume_usb_print() +{ + SERIAL_PROTOCOLLNRPGM(MSG_OCTOPRINT_RESUME); //resume octoprint +} + static void change_sheet() { eeprom_update_byte(&(EEPROM_Sheets_base->active_sheet), selected_sheet); @@ -6620,174 +6650,183 @@ static void lcd_sheet_menu() MENU_END(); } +//! @brief Show Main Menu +//! +//! @code{.unparsed} +//! |01234567890123456789| +//! | Info screen | allways +//! +//! | tst - Save | ifdef RESUME_DEBUG +//! | tst - Restore | ifdef RESUME_DEBUG +//! +//! | recover print | ifdef TMC2130_DEBUG +//! | power panic | ifdef TMC2130_DEBUG +//! +//! | Live adjust Z | printing + Z low +//! +//! | Change filament | farm mode +//! +//! | Tune | printing + paused +//! | Pause print | printing + not paused +//! | Resume print | printing + paused +//! | Stop print | printing or paused + NOT MBL +//! | Preheat | not printing + not paused +//! | Print from SD | not printing or paused +//! +//! | Switch sheet | farm mode +//! +//! | AutoLoad filament | not printing + not mmu or paused +//! | Load filament | not printing + mmu or paused +//! | Load to nozzle | not printing + mmu or paused +//! | Unload filament | not printing or paused +//! | Eject filament | not printing + mmu or paused +//! | Cut filament | not printing + mmu or paused + cut atctive +//! | Settings | not printing or paused +//! | Calibration | not printing +//! | Statistics | not printing +//! | Fail stats | allways +//! | Fail stats MMU | mmu +//! | Support | allways +//! @endcode static void lcd_main_menu() { - MENU_BEGIN(); + MENU_BEGIN(); - // Majkl superawesome menu + // Majkl superawesome menu - MENU_ITEM_BACK_P(_T(MSG_WATCH)); + MENU_ITEM_BACK_P(_T(MSG_WATCH)); #ifdef RESUME_DEBUG - if (!saved_printing) - MENU_ITEM_FUNCTION_P(PSTR("tst - Save"), lcd_menu_test_save); - else - MENU_ITEM_FUNCTION_P(PSTR("tst - Restore"), lcd_menu_test_restore); + if (!saved_printing) + MENU_ITEM_FUNCTION_P(PSTR("tst - Save"), lcd_menu_test_save); + else + MENU_ITEM_FUNCTION_P(PSTR("tst - Restore"), lcd_menu_test_restore); #endif //RESUME_DEBUG #ifdef TMC2130_DEBUG - MENU_ITEM_FUNCTION_P(PSTR("recover print"), recover_print); - MENU_ITEM_FUNCTION_P(PSTR("power panic"), uvlo_); + MENU_ITEM_FUNCTION_P(PSTR("recover print"), recover_print); + MENU_ITEM_FUNCTION_P(PSTR("power panic"), uvlo_); #endif //TMC2130_DEBUG - - if ( ( IS_SD_PRINTING || is_usb_printing || (lcd_commands_type == LcdCommands::Layer1Cal)) && (current_position[Z_AXIS] < Z_HEIGHT_HIDE_LIVE_ADJUST_MENU) && !homing_flag && !mesh_bed_leveling_flag) - { - MENU_ITEM_SUBMENU_P(_T(MSG_BABYSTEP_Z), lcd_babystep_z);//8 - } - if (farm_mode) - MENU_ITEM_FUNCTION_P(_T(MSG_FILAMENTCHANGE), lcd_colorprint_change);//8 - - if ( moves_planned() || IS_SD_PRINTING || is_usb_printing || (lcd_commands_type == LcdCommands::Layer1Cal)) - { - MENU_ITEM_SUBMENU_P(_i("Tune"), lcd_tune_menu);////MSG_TUNE - } else - { - MENU_ITEM_SUBMENU_P(_i("Preheat"), lcd_preheat_menu);////MSG_PREHEAT - } - - - if(isPrintPaused && saved_printing_type == PRINTING_TYPE_USB) - { -#ifdef FANCHECK - if((fan_check_error == EFCE_FIXED) || (fan_check_error == EFCE_OK)) - MENU_ITEM_SUBMENU_P(_T(MSG_RESUME_PRINT), lcd_resume_print);////MSG_RESUME_PRINT c=18 -#else - MENU_ITEM_SUBMENU_P(_T(MSG_RESUME_PRINT), lcd_resume_print);////MSG_RESUME_PRINT c=18 -#endif - } - -#ifdef SDSUPPORT - if (card.cardOK || lcd_commands_type == LcdCommands::Layer1Cal) - { - if (card.isFileOpen()) - { - if (mesh_bed_leveling_flag == false && homing_flag == false) { - if (card.sdprinting) - { - MENU_ITEM_FUNCTION_P(_i("Pause print"), lcd_pause_print);////MSG_PAUSE_PRINT - } - else if(isPrintPaused) - { - #ifdef FANCHECK - if((fan_check_error == EFCE_FIXED) || (fan_check_error == EFCE_OK)) - MENU_ITEM_SUBMENU_P(_T(MSG_RESUME_PRINT), lcd_resume_print);////MSG_RESUME_PRINT c=18 - #else - MENU_ITEM_SUBMENU_P(_T(MSG_RESUME_PRINT), lcd_resume_print);////MSG_RESUME_PRINT c=18 - #endif - - } - MENU_ITEM_SUBMENU_P(_T(MSG_STOP_PRINT), lcd_sdcard_stop); - } - } - else if (lcd_commands_type == LcdCommands::Layer1Cal && mesh_bed_leveling_flag == false && homing_flag == false) { - //MENU_ITEM_SUBMENU_P(_T(MSG_STOP_PRINT), lcd_sdcard_stop); - } - else - { - if (!is_usb_printing && (lcd_commands_type != LcdCommands::Layer1Cal)) - { - //if (farm_mode) MENU_ITEM_SUBMENU_P(MSG_FARM_CARD_MENU, lcd_farm_sdcard_menu); - /*else*/ { - bMain=true; // flag ('fake parameter') for 'lcd_sdcard_menu()' function - MENU_ITEM_SUBMENU_P(_T(MSG_CARD_MENU), lcd_sdcard_menu); - } - } -#if SDCARDDETECT < 1 - MENU_ITEM_GCODE_P(_i("Change SD card"), PSTR("M21")); // SD-card changed by user////MSG_CNG_SDCARD -#endif + if ( ( IS_SD_PRINTING || is_usb_printing || (lcd_commands_type == LcdCommands::Layer1Cal)) && (current_position[Z_AXIS] < Z_HEIGHT_HIDE_LIVE_ADJUST_MENU) && !homing_flag && !mesh_bed_leveling_flag) { + MENU_ITEM_SUBMENU_P(_T(MSG_BABYSTEP_Z), lcd_babystep_z);//8 } - - } else - { - bMain=true; // flag (i.e. 'fake parameter') for 'lcd_sdcard_menu()' function - MENU_ITEM_SUBMENU_P(_i("No SD card"), lcd_sdcard_menu);////MSG_NO_CARD -#if SDCARDDETECT < 1 - MENU_ITEM_GCODE_P(_i("Init. SD card"), PSTR("M21")); // Manually initialize the SD-card via user interface////MSG_INIT_SDCARD -#endif - } -#endif - if(!isPrintPaused && !IS_SD_PRINTING && !is_usb_printing && (lcd_commands_type != LcdCommands::Layer1Cal)) - { - if (!farm_mode) - { - const int8_t sheet = eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)); - const int8_t nextSheet = eeprom_next_initialized_sheet(sheet); - if ((nextSheet >= 0) && (sheet != nextSheet)) // show menu only if we have 2 or more sheets initialized - { - MENU_ITEM_FUNCTION_E(EEPROM_Sheets_base->s[sheet], eeprom_switch_to_next_sheet); + if (farm_mode) + MENU_ITEM_FUNCTION_P(_T(MSG_FILAMENTCHANGE), lcd_colorprint_change);//8 + + if ( moves_planned() || PRINTER_ACTIVE ) { + MENU_ITEM_SUBMENU_P(_i("Tune"), lcd_tune_menu);////MSG_TUNE + } else { + MENU_ITEM_SUBMENU_P(_i("Preheat"), lcd_preheat_menu);////MSG_PREHEAT + } + + if (mesh_bed_leveling_flag == false && homing_flag == false && !isPrintPaused) { + if (is_usb_printing) { + MENU_ITEM_FUNCTION_P(_T(MSG_PAUSE_PRINT), lcd_pause_usb_print);////MSG_PAUSE_PRINT c=18 + } else if (IS_SD_PRINTING) { + MENU_ITEM_FUNCTION_P(_T(MSG_PAUSE_PRINT), lcd_pause_print);////MSG_PAUSE_PRINT c=18 } } - } + if(isPrintPaused) + { +#ifdef FANCHECK + if((fan_check_error == EFCE_FIXED) || (fan_check_error == EFCE_OK)) +#endif //FANCHECK + { + if (is_usb_printing) { + MENU_ITEM_SUBMENU_P(_T(MSG_RESUME_PRINT), lcd_resume_usb_print);////MSG_RESUME_PRINT c=18 + } else { + MENU_ITEM_SUBMENU_P(_T(MSG_RESUME_PRINT), lcd_resume_print);////MSG_RESUME_PRINT c=18 + } + } + } + if((IS_SD_PRINTING || is_usb_printing || isPrintPaused) && (custom_message_type != CustomMsg::MeshBedLeveling)) { + MENU_ITEM_SUBMENU_P(_T(MSG_STOP_PRINT), lcd_sdcard_stop); + } +#ifdef SDSUPPORT //!@todo SDSUPPORT undefined creates several issues in source code + if (card.cardOK || lcd_commands_type == LcdCommands::Layer1Cal) { + if (!card.isFileOpen()) { + if (!is_usb_printing && (lcd_commands_type != LcdCommands::Layer1Cal)) { + //if (farm_mode) MENU_ITEM_SUBMENU_P(MSG_FARM_CARD_MENU, lcd_farm_sdcard_menu); + /*else*/{ + bMain=true; // flag ('fake parameter') for 'lcd_sdcard_menu()' function + MENU_ITEM_SUBMENU_P(_T(MSG_CARD_MENU), lcd_sdcard_menu); + } + } +#if SDCARDDETECT < 1 + MENU_ITEM_GCODE_P(_i("Change SD card"), PSTR("M21")); // SD-card changed by user////MSG_CNG_SDCARD +#endif //SDCARDDETECT + } + } else { + bMain=true; // flag (i.e. 'fake parameter') for 'lcd_sdcard_menu()' function + MENU_ITEM_SUBMENU_P(_i("No SD card"), lcd_sdcard_menu);////MSG_NO_CARD +#if SDCARDDETECT < 1 + MENU_ITEM_GCODE_P(_i("Init. SD card"), PSTR("M21")); // Manually initialize the SD-card via user interface////MSG_INIT_SDCARD +#endif //SDCARDDETECT + } +#endif //SDSUPPORT + if(!isPrintPaused && !IS_SD_PRINTING && !is_usb_printing && (lcd_commands_type != LcdCommands::Layer1Cal)) { + if (!farm_mode) { + const int8_t sheet = eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)); + const int8_t nextSheet = eeprom_next_initialized_sheet(sheet); + if ((nextSheet >= 0) && (sheet != nextSheet)) { // show menu only if we have 2 or more sheets initialized + MENU_ITEM_FUNCTION_E(EEPROM_Sheets_base->s[sheet], eeprom_switch_to_next_sheet); + } + } + } - if ( ! ( IS_SD_PRINTING || is_usb_printing || (lcd_commands_type == LcdCommands::Layer1Cal) ) ) - { - if (mmu_enabled) - { - MENU_ITEM_SUBMENU_P(_T(MSG_LOAD_FILAMENT), fil_load_menu); - MENU_ITEM_SUBMENU_P(_i("Load to nozzle"), mmu_load_to_nozzle_menu); + if ( ! ( IS_SD_PRINTING || is_usb_printing || (lcd_commands_type == LcdCommands::Layer1Cal) ) ) { + if (mmu_enabled) { + 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_FUNCTION_P(_T(MSG_UNLOAD_FILAMENT), extr_unload); //bFilamentFirstRun=true; - MENU_ITEM_SUBMENU_P(_T(MSG_UNLOAD_FILAMENT), mmu_unload_filament); - MENU_ITEM_SUBMENU_P(_T(MSG_EJECT_FILAMENT), mmu_fil_eject_menu); + MENU_ITEM_SUBMENU_P(_T(MSG_UNLOAD_FILAMENT), mmu_unload_filament); + MENU_ITEM_SUBMENU_P(_T(MSG_EJECT_FILAMENT), mmu_fil_eject_menu); #ifdef MMU_HAS_CUTTER - MENU_ITEM_SUBMENU_P(_T(MSG_CUT_FILAMENT), mmu_cut_filament_menu); + MENU_ITEM_SUBMENU_P(_T(MSG_CUT_FILAMENT), mmu_cut_filament_menu); #endif //MMU_HAS_CUTTER - } - else - { + } else { #ifdef SNMM - MENU_ITEM_SUBMENU_P(_T(MSG_UNLOAD_FILAMENT), fil_unload_menu); - MENU_ITEM_SUBMENU_P(_i("Change extruder"), change_extr_menu);////MSG_CHANGE_EXTR c=20 r=1 + MENU_ITEM_SUBMENU_P(_T(MSG_UNLOAD_FILAMENT), fil_unload_menu); + MENU_ITEM_SUBMENU_P(_i("Change extruder"), change_extr_menu);////MSG_CHANGE_EXTR c=20 r=1 #endif #ifdef FILAMENT_SENSOR - if ((fsensor_autoload_enabled == true) && (fsensor_enabled == true) && (mmu_enabled == false)) - MENU_ITEM_SUBMENU_P(_i("AutoLoad filament"), lcd_menu_AutoLoadFilament);////MSG_AUTOLOAD_FILAMENT c=18 - else + if ((fsensor_autoload_enabled == true) && (fsensor_enabled == true) && (mmu_enabled == false)) + MENU_ITEM_SUBMENU_P(_i("AutoLoad filament"), lcd_menu_AutoLoadFilament);////MSG_AUTOLOAD_FILAMENT c=18 + else #endif //FILAMENT_SENSOR - { - bFilamentFirstRun=true; - MENU_ITEM_SUBMENU_P(_T(MSG_LOAD_FILAMENT), lcd_LoadFilament); - } - bFilamentFirstRun=true; - MENU_ITEM_SUBMENU_P(_T(MSG_UNLOAD_FILAMENT), lcd_unLoadFilament); - } - MENU_ITEM_SUBMENU_P(_T(MSG_SETTINGS), lcd_settings_menu); + { + bFilamentFirstRun=true; + MENU_ITEM_SUBMENU_P(_T(MSG_LOAD_FILAMENT), lcd_LoadFilament); + } + bFilamentFirstRun=true; + MENU_ITEM_SUBMENU_P(_T(MSG_UNLOAD_FILAMENT), lcd_unLoadFilament); + } + MENU_ITEM_SUBMENU_P(_T(MSG_SETTINGS), lcd_settings_menu); if(!isPrintPaused) MENU_ITEM_SUBMENU_P(_T(MSG_MENU_CALIBRATION), lcd_calibration_menu); + } + + if (!is_usb_printing && (lcd_commands_type != LcdCommands::Layer1Cal)) { + MENU_ITEM_SUBMENU_P(_i("Statistics "), lcd_menu_statistics);////MSG_STATISTICS + } - } - - if (!is_usb_printing && (lcd_commands_type != LcdCommands::Layer1Cal)) - { - MENU_ITEM_SUBMENU_P(_i("Statistics "), lcd_menu_statistics);////MSG_STATISTICS - } - #if defined(TMC2130) || defined(FILAMENT_SENSOR) - MENU_ITEM_SUBMENU_P(_i("Fail stats"), lcd_menu_fails_stats); + MENU_ITEM_SUBMENU_P(_i("Fail stats"), lcd_menu_fails_stats); #endif - if (mmu_enabled) { - MENU_ITEM_SUBMENU_P(_i("Fail stats MMU"), lcd_menu_fails_stats_mmu); - } - MENU_ITEM_SUBMENU_P(_i("Support"), lcd_support_menu);////MSG_SUPPORT + if (mmu_enabled) { + MENU_ITEM_SUBMENU_P(_i("Fail stats MMU"), lcd_menu_fails_stats_mmu); + } + MENU_ITEM_SUBMENU_P(_i("Support"), lcd_support_menu);////MSG_SUPPORT #ifdef LCD_TEST MENU_ITEM_SUBMENU_P(_i("W25x20CL init"), lcd_test_menu);////MSG_SUPPORT #endif //LCD_TEST - MENU_END(); + MENU_END(); } @@ -6952,10 +6991,8 @@ static void lcd_tune_menu() SETTINGS_CUTTER; - if(farm_mode) - { - MENU_ITEM_TOGGLE_P(_T(MSG_FANS_CHECK), fans_check_enabled ? _T(MSG_ON) : _T(MSG_OFF), lcd_set_fan_check); - } + MENU_ITEM_TOGGLE_P(_T(MSG_FANS_CHECK), fans_check_enabled ? _T(MSG_ON) : _T(MSG_OFF), lcd_set_fan_check); + #ifdef TMC2130 if(!farm_mode) diff --git a/Firmware/ultralcd.h b/Firmware/ultralcd.h index ac8178cb..b4ec04ba 100755 --- a/Firmware/ultralcd.h +++ b/Firmware/ultralcd.h @@ -44,6 +44,7 @@ void lcd_change_success(); void lcd_loading_color(); void lcd_sdcard_stop(); void lcd_pause_print(); +void lcd_pause_usb_print(); void lcd_resume_print(); void lcd_print_stop(); void prusa_statistics(int _message, uint8_t _col_nr = 0); diff --git a/lang/lang_en.txt b/lang/lang_en.txt index 79848fe8..02d42080 100644 --- a/lang/lang_en.txt +++ b/lang/lang_en.txt @@ -142,6 +142,9 @@ #MSG_SD_REMOVED "Card removed" +# +"Checking file" + #MSG_NOT_COLOR "Color not correct" @@ -382,6 +385,9 @@ #MSG_LAST_PRINT_FAILURES c=20 "Last print failures" +#MSG_WIZARD_WELCOME_SHIPPING c=20 r=16 +"Hi, I am your Original Prusa i3 printer. I will guide you through a short setup process, in which the Z-axis will be calibrated. Then, you will be ready to print." + # "If you have additional steel sheets, calibrate their presets in Settings - HW Setup - Steel sheets." @@ -544,7 +550,7 @@ # "Nozzle FAN" -#MSG_PAUSE_PRINT +#MSG_PAUSE_PRINT c=18 "Pause print" #MSG_PID_RUNNING c=20 r=1 diff --git a/lang/lang_en_cz.txt b/lang/lang_en_cz.txt index ea2dbc83..bbf30748 100644 --- a/lang/lang_en_cz.txt +++ b/lang/lang_en_cz.txt @@ -190,6 +190,10 @@ "Card removed" "Karta vyjmuta" +# +"Checking file" +"\x00" + #MSG_NOT_COLOR "Color not correct" "Barva neni cista" @@ -510,6 +514,10 @@ "Last print failures" "Selhani posl. tisku" +#MSG_WIZARD_WELCOME_SHIPPING c=20 r=16 +"Hi, I am your Original Prusa i3 printer. I will guide you through a short setup process, in which the Z-axis will be calibrated. Then, you will be ready to print." +"Ahoj, jsem vase tiskarna Original Prusa i3. Provedu vas kratkym procesem nastaveni, ve kterem zkalibrujeme osu Z. Pak budete moct zacit tisknout." + # "If you have additional steel sheets, calibrate their presets in Settings - HW Setup - Steel sheets." "Mate-li vice tiskovych platu, kalibrujte je v menu Nastaveni - HW nastaveni - Tiskove platy" @@ -726,7 +734,7 @@ "Nozzle FAN" "Vent. trysky" -#MSG_PAUSE_PRINT +#MSG_PAUSE_PRINT c=18 "Pause print" "Pozastavit tisk" diff --git a/lang/lang_en_de.txt b/lang/lang_en_de.txt index ffc35678..02dc1a7f 100644 --- a/lang/lang_en_de.txt +++ b/lang/lang_en_de.txt @@ -190,6 +190,10 @@ "Card removed" "SD Karte entfernt" +# +"Checking file" +"\x00" + #MSG_NOT_COLOR "Color not correct" "Falsche Farbe" @@ -510,6 +514,10 @@ "Last print failures" "Letzte Druckfehler" +#MSG_WIZARD_WELCOME_SHIPPING c=20 r=16 +"Hi, I am your Original Prusa i3 printer. I will guide you through a short setup process, in which the Z-axis will be calibrated. Then, you will be ready to print." +"Hallo, ich bin Ihr Original Prusa i3 Drucker. Ich werde Sie durch einen kurzen Einrichtungsprozess fuehren, bei dem die Z-Achse kalibriert wird. Danach sind Sie bereit fuer den Druck." + # "If you have additional steel sheets, calibrate their presets in Settings - HW Setup - Steel sheets." "Wenn Sie zusaetzliche Stahlbleche haben, kalibrieren Sie deren Voreinstellungen unter Einstellungen - HW Setup - Stahlbleche." @@ -726,7 +734,7 @@ "Nozzle FAN" "Duesevent." -#MSG_PAUSE_PRINT +#MSG_PAUSE_PRINT c=18 "Pause print" "Druck pausieren" diff --git a/lang/lang_en_es.txt b/lang/lang_en_es.txt index b5bca765..76cfd6ac 100644 --- a/lang/lang_en_es.txt +++ b/lang/lang_en_es.txt @@ -190,6 +190,10 @@ "Card removed" "Tarjeta retirada" +# +"Checking file" +"\x00" + #MSG_NOT_COLOR "Color not correct" "Color no homogeneo" @@ -510,6 +514,10 @@ "Last print failures" "Ultimos imp. fallos" +#MSG_WIZARD_WELCOME_SHIPPING c=20 r=16 +"Hi, I am your Original Prusa i3 printer. I will guide you through a short setup process, in which the Z-axis will be calibrated. Then, you will be ready to print." +"Hola, soy tu impresora Original Prusa i3. Te guiare a traves de un breve proceso de configuracion, en el que se calibrara el eje Z. Despues, estaras listo para imprimir." + # "If you have additional steel sheets, calibrate their presets in Settings - HW Setup - Steel sheets." "Si tienes planchas de acero adicionales, calibra sus ajustes en Ajustes - Ajustes HW - Planchas acero." @@ -726,7 +734,7 @@ "Nozzle FAN" "Vent. capa" -#MSG_PAUSE_PRINT +#MSG_PAUSE_PRINT c=18 "Pause print" "Pausar impresion" diff --git a/lang/lang_en_fr.txt b/lang/lang_en_fr.txt index 7bd47294..77e31256 100644 --- a/lang/lang_en_fr.txt +++ b/lang/lang_en_fr.txt @@ -190,6 +190,10 @@ "Card removed" "Carte retiree" +# +"Checking file" +"\x00" + #MSG_NOT_COLOR "Color not correct" "Couleur incorrecte" @@ -510,6 +514,10 @@ "Last print failures" "Echecs derniere imp." +#MSG_WIZARD_WELCOME_SHIPPING c=20 r=16 +"Hi, I am your Original Prusa i3 printer. I will guide you through a short setup process, in which the Z-axis will be calibrated. Then, you will be ready to print." +"Bonjour, je suis votre imprimante Original Prusa i3. Je vais vous accompagner au cours d'un bref processus de reglage, qui permettra de calibrer le Z-axis. Apres cela, tout sera pret pour imprimer." + # "If you have additional steel sheets, calibrate their presets in Settings - HW Setup - Steel sheets." "Si vous avez d'autres feuilles d'acier, calibrez leurs pre-reglages dans Reglages - Config HW - Plaque en acier." @@ -726,7 +734,7 @@ "Nozzle FAN" "Vent. buse" -#MSG_PAUSE_PRINT +#MSG_PAUSE_PRINT c=18 "Pause print" "Pause de l'impr." diff --git a/lang/lang_en_it.txt b/lang/lang_en_it.txt index d4cac762..b0bebf1a 100644 --- a/lang/lang_en_it.txt +++ b/lang/lang_en_it.txt @@ -190,6 +190,10 @@ "Card removed" "SD rimossa" +# +"Checking file" +"\x00" + #MSG_NOT_COLOR "Color not correct" "Colore non puro" @@ -510,6 +514,10 @@ "Last print failures" "Errori ultima stampa" +#MSG_WIZARD_WELCOME_SHIPPING c=20 r=16 +"Hi, I am your Original Prusa i3 printer. I will guide you through a short setup process, in which the Z-axis will be calibrated. Then, you will be ready to print." +"Ciao, sono la tua stampante Original Prusa i3. Ti guidero attraverso un rapido processo in cui verra calibrato l'asse Z. Poi, sarai pronto a stampare." + # "If you have additional steel sheets, calibrate their presets in Settings - HW Setup - Steel sheets." "Se hai piastre d'acciaio aggiuntive, calibra i preset in Impostazioni - Setup HW - Piastre in Acciaio." @@ -726,7 +734,7 @@ "Nozzle FAN" "Ventola estrusore" -#MSG_PAUSE_PRINT +#MSG_PAUSE_PRINT c=18 "Pause print" "Metti in pausa" diff --git a/lang/lang_en_pl.txt b/lang/lang_en_pl.txt index bbdf0aca..89db5b6d 100644 --- a/lang/lang_en_pl.txt +++ b/lang/lang_en_pl.txt @@ -190,6 +190,10 @@ "Card removed" "Karta wyjeta" +# +"Checking file" +"\x00" + #MSG_NOT_COLOR "Color not correct" "Kolor zanieczysz." @@ -510,6 +514,10 @@ "Last print failures" "Ostatnie bledy druku" +#MSG_WIZARD_WELCOME_SHIPPING c=20 r=16 +"Hi, I am your Original Prusa i3 printer. I will guide you through a short setup process, in which the Z-axis will be calibrated. Then, you will be ready to print." +"Czesc, jestem Twoja drukarka Original Prusa i3. Przeprowadze Cie przez krotka kalibracje osi Z, po ktorej mozesz rozpoczac drukowanie." + # "If you have additional steel sheets, calibrate their presets in Settings - HW Setup - Steel sheets." "Jesli masz dodatkowe plyty stalowe, to skalibruj ich ustawienia w menu Ustawienia - Ustawienia HW - Plyty stalowe." @@ -726,7 +734,7 @@ "Nozzle FAN" "WentHotend" -#MSG_PAUSE_PRINT +#MSG_PAUSE_PRINT c=18 "Pause print" "Wstrzymanie wydruku"