Merge pull request #4635 from 3d-gussner/MK3_PP_improvements
Power Panic and LCD menu
This commit is contained in:
commit
0c9bf5d435
|
|
@ -313,11 +313,18 @@ extern LongTimer safetyTimer;
|
||||||
// the print is paused, that still counts as a "running" print.
|
// the print is paused, that still counts as a "running" print.
|
||||||
bool printJobOngoing();
|
bool printJobOngoing();
|
||||||
|
|
||||||
|
// Make debug_printer_states available everywhere
|
||||||
|
#ifdef DEBUG_PRINTER_STATES
|
||||||
|
void debug_printer_states();
|
||||||
|
#endif //DEBUG_PRINTER_STATES
|
||||||
|
|
||||||
// Printing is paused according to SD or host indicators
|
// Printing is paused according to SD or host indicators
|
||||||
bool printingIsPaused();
|
bool printingIsPaused();
|
||||||
|
|
||||||
bool printer_active();
|
bool printer_active();
|
||||||
|
|
||||||
|
bool printer_recovering();
|
||||||
|
|
||||||
//! Beware - mcode_in_progress is set as soon as the command gets really processed,
|
//! 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
|
//! which is not the same as posting the M600 command into the command queue
|
||||||
//! There can be a considerable lag between posting M600 and its real processing which might result
|
//! There can be a considerable lag between posting M600 and its real processing which might result
|
||||||
|
|
|
||||||
|
|
@ -312,7 +312,7 @@ static bool chdkActive = false;
|
||||||
//! @{
|
//! @{
|
||||||
bool saved_printing = false; //!< Print is paused and saved in RAM
|
bool saved_printing = false; //!< Print is paused and saved in RAM
|
||||||
uint32_t saved_sdpos = 0; //!< SD card position, or line number in case of USB printing
|
uint32_t saved_sdpos = 0; //!< SD card position, or line number in case of USB printing
|
||||||
uint8_t saved_printing_type = PowerPanic::PRINT_TYPE_SD;
|
uint8_t saved_printing_type = PowerPanic::PRINT_TYPE_NONE;
|
||||||
float saved_pos[NUM_AXIS] = { X_COORD_INVALID, 0, 0, 0 };
|
float saved_pos[NUM_AXIS] = { X_COORD_INVALID, 0, 0, 0 };
|
||||||
uint16_t saved_feedrate2 = 0; //!< Default feedrate (truncated from float)
|
uint16_t saved_feedrate2 = 0; //!< Default feedrate (truncated from float)
|
||||||
static int saved_feedmultiply2 = 0;
|
static int saved_feedmultiply2 = 0;
|
||||||
|
|
@ -523,8 +523,63 @@ bool __attribute__((noinline)) printer_active() {
|
||||||
|| (lcd_commands_type != LcdCommands::Idle)
|
|| (lcd_commands_type != LcdCommands::Idle)
|
||||||
|| MMU2::mmu2.MMU_PRINT_SAVED()
|
|| MMU2::mmu2.MMU_PRINT_SAVED()
|
||||||
|| homing_flag
|
|| homing_flag
|
||||||
|| mesh_bed_leveling_flag
|
|| mesh_bed_leveling_flag;
|
||||||
|| (eeprom_read_byte((uint8_t*)EEPROM_UVLO) != PowerPanic::NO_PENDING_RECOVERY);
|
}
|
||||||
|
|
||||||
|
#ifdef DEBUG_PRINTER_STATES
|
||||||
|
//! @brief debug printer states
|
||||||
|
//!
|
||||||
|
//! This outputs a lot over serial and should be only used
|
||||||
|
//! - when debugging LCD menus
|
||||||
|
//! - or other functions related to these states
|
||||||
|
//! To reduce the output feel free to comment out the lines you
|
||||||
|
//! aren't troubleshooting.
|
||||||
|
|
||||||
|
void debug_printer_states()
|
||||||
|
{
|
||||||
|
printf_P(PSTR("DBG:printJobOngoing() = %d\n"), (int)printJobOngoing());
|
||||||
|
printf_P(PSTR("DBG:IS_SD_PRINTING = %d\n"), (int)IS_SD_PRINTING);
|
||||||
|
printf_P(PSTR("DBG:printer_recovering() = %d\n"), (int)printer_recovering());
|
||||||
|
printf_P(PSTR("DBG:heating_status = %d\n"), (int)heating_status);
|
||||||
|
printf_P(PSTR("DBG:GetPrinterState() = %d\n"), (int)GetPrinterState());
|
||||||
|
printf_P(PSTR("DBG:babystep_allowed_strict() = %d\n"), (int)babystep_allowed_strict());
|
||||||
|
printf_P(PSTR("DBG:lcd_commands_type = %d\n"), (int)lcd_commands_type);
|
||||||
|
printf_P(PSTR("DBG:farm_mode = %d\n"), (int)farm_mode);
|
||||||
|
printf_P(PSTR("DBG:moves_planned() = %d\n"), (int)moves_planned());
|
||||||
|
printf_P(PSTR("DBG:Stopped = %d\n"), (int)Stopped);
|
||||||
|
printf_P(PSTR("DBG:usb_timer.running() = %d\n"), (int)usb_timer.running());
|
||||||
|
printf_P(PSTR("DBG:M79_timer_get_status() = %d\n"), (int)M79_timer_get_status());
|
||||||
|
printf_P(PSTR("DBG:print_job_timer.isRunning() = %d\n"), (int)print_job_timer.isRunning());
|
||||||
|
printf_P(PSTR("DBG:printingIsPaused() = %d\n"), (int)printingIsPaused());
|
||||||
|
printf_P(PSTR("DBG:did_pause_print = %d\n"), (int)did_pause_print);
|
||||||
|
printf_P(PSTR("DBG:print_job_timer.isPaused() = %d\n"), (int)print_job_timer.isPaused());
|
||||||
|
printf_P(PSTR("DBG:saved_printing = %d\n"), (int)saved_printing);
|
||||||
|
printf_P(PSTR("DBG:saved_printing_type = %d\n"), (int)saved_printing_type);
|
||||||
|
printf_P(PSTR("DBG:homing_flag = %d\n"), (int)homing_flag);
|
||||||
|
printf_P(PSTR("DBG:mesh_bed_leveling_flag = %d\n"), (int)mesh_bed_leveling_flag);
|
||||||
|
printf_P(PSTR("DBG:get_temp_error() = %d\n"), (int)get_temp_error());
|
||||||
|
printf_P(PSTR("DBG:card.mounted = %d\n"), (int)card.mounted);
|
||||||
|
printf_P(PSTR("DBG:card.isFileOpen() = %d\n"), (int)card.isFileOpen());
|
||||||
|
printf_P(PSTR("DBG:fan_check_error = %d\n"), (int)fan_check_error);
|
||||||
|
printf_P(PSTR("DBG:processing_tcode = %d\n"), (int)processing_tcode);
|
||||||
|
printf_P(PSTR("DBG:nextSheet = %d\n"), (int)eeprom_next_initialized_sheet(eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet))));
|
||||||
|
printf_P(PSTR("DBG:eFilamentAction = %d\n"), (int)eFilamentAction);
|
||||||
|
printf_P(PSTR("DBG:MMU2::mmu2.Enabled() = %d\n"), (int)MMU2::mmu2.Enabled());
|
||||||
|
printf_P(PSTR("DBG:MMU2::mmu2.MMU_PRINT_SAVED() = %d\n"), (int)MMU2::mmu2.MMU_PRINT_SAVED());
|
||||||
|
printf_P(PSTR("DBG:MMU2::mmu2.FindaDetectsFilament() = %d\n"), (int)MMU2::mmu2.FindaDetectsFilament());
|
||||||
|
printf_P(PSTR("DBG:fsensor.getFilamentPresent() = %d\n"), (int)fsensor.getFilamentPresent());
|
||||||
|
printf_P(PSTR("DBG:MMU CUTTER ENABLED = %d\n"), (int)eeprom_read_byte((uint8_t*)EEPROM_MMU_CUTTER_ENABLED));
|
||||||
|
printf_P(PSTR("DBG:fsensor.isEnabled() = %d\n"), (int)fsensor.isEnabled());
|
||||||
|
printf_P(PSTR("DBG:fsensor.getAutoLoadEnabled() = %d\n"), (int)fsensor.getAutoLoadEnabled());
|
||||||
|
printf_P(PSTR("DBG:custom_message_type = %d\n"), (int)custom_message_type);
|
||||||
|
printf_P(PSTR("DBG:uvlo_auto_recovery_ready = %d\n"), (int)uvlo_auto_recovery_ready);
|
||||||
|
SERIAL_ECHOLN("");
|
||||||
|
}
|
||||||
|
#endif //End DEBUG_PRINTER_STATES
|
||||||
|
|
||||||
|
// Block LCD menus when
|
||||||
|
bool __attribute__((noinline)) printer_recovering() {
|
||||||
|
return (eeprom_read_byte((uint8_t*)EEPROM_UVLO) != PowerPanic::NO_PENDING_RECOVERY);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Currently only used in one place, allowed to be inlined
|
// Currently only used in one place, allowed to be inlined
|
||||||
|
|
@ -1461,6 +1516,7 @@ void setup()
|
||||||
eeprom_update_byte_notify((uint8_t*)EEPROM_TEMP_CAL_ACTIVE, 0);
|
eeprom_update_byte_notify((uint8_t*)EEPROM_TEMP_CAL_ACTIVE, 0);
|
||||||
}
|
}
|
||||||
eeprom_init_default_byte((uint8_t*)EEPROM_UVLO, PowerPanic::NO_PENDING_RECOVERY);
|
eeprom_init_default_byte((uint8_t*)EEPROM_UVLO, PowerPanic::NO_PENDING_RECOVERY);
|
||||||
|
eeprom_init_default_byte((uint8_t*)EEPROM_UVLO_Z_LIFTED, 0);
|
||||||
eeprom_init_default_byte((uint8_t*)EEPROM_SD_SORT, 0);
|
eeprom_init_default_byte((uint8_t*)EEPROM_SD_SORT, 0);
|
||||||
|
|
||||||
//mbl_mode_init();
|
//mbl_mode_init();
|
||||||
|
|
@ -1581,32 +1637,33 @@ void setup()
|
||||||
fw_crash_init();
|
fw_crash_init();
|
||||||
|
|
||||||
#ifdef UVLO_SUPPORT
|
#ifdef UVLO_SUPPORT
|
||||||
if (eeprom_read_byte((uint8_t*)EEPROM_UVLO) != PowerPanic::NO_PENDING_RECOVERY) { //previous print was terminated by UVLO
|
if (printer_recovering()) { //previous print was terminated by UVLO
|
||||||
manage_heater(); // Update temperatures
|
manage_heater(); // Update temperatures
|
||||||
#ifdef DEBUG_UVLO_AUTOMATIC_RECOVER
|
//Restore printing type
|
||||||
printf_P(_N("Power panic detected!\nCurrent bed temp:%d\nSaved bed temp:%d\n"), (int)degBed(), eeprom_read_byte((uint8_t*)EEPROM_UVLO_TARGET_BED));
|
saved_printing_type = eeprom_read_byte((uint8_t*)EEPROM_UVLO_PRINT_TYPE);
|
||||||
#endif
|
#ifdef DEBUG_UVLO_AUTOMATIC_RECOVER
|
||||||
uvlo_auto_recovery_ready = (degBed() > ( (float)eeprom_read_byte((uint8_t*)EEPROM_UVLO_TARGET_BED) - AUTOMATIC_UVLO_BED_TEMP_OFFSET));
|
printf_P(_N("Power panic detected!\nCurrent bed temp:%d\nSaved bed temp:%d\n"), (int)degBed(), eeprom_read_byte((uint8_t*)EEPROM_UVLO_TARGET_BED));
|
||||||
if (uvlo_auto_recovery_ready){
|
#endif //DEBUG_UVLO_AUTOMATIC_RECOVER
|
||||||
#ifdef DEBUG_UVLO_AUTOMATIC_RECOVER
|
uvlo_auto_recovery_ready = (degBed() > ( (float)eeprom_read_byte((uint8_t*)EEPROM_UVLO_TARGET_BED) - AUTOMATIC_UVLO_BED_TEMP_OFFSET));
|
||||||
|
if (uvlo_auto_recovery_ready){
|
||||||
|
#ifdef DEBUG_UVLO_AUTOMATIC_RECOVER
|
||||||
puts_P(_N("Automatic recovery!"));
|
puts_P(_N("Automatic recovery!"));
|
||||||
#endif
|
#endif //DEBUG_UVLO_AUTOMATIC_RECOVER
|
||||||
recover_print(1);
|
recover_print(1);
|
||||||
}
|
} else {
|
||||||
else{
|
#ifdef DEBUG_UVLO_AUTOMATIC_RECOVER
|
||||||
#ifdef DEBUG_UVLO_AUTOMATIC_RECOVER
|
|
||||||
puts_P(_N("Normal recovery!"));
|
puts_P(_N("Normal recovery!"));
|
||||||
#endif
|
#endif //DEBUG_UVLO_AUTOMATIC_RECOVER
|
||||||
if (eeprom_read_byte((uint8_t*)EEPROM_UVLO) == PowerPanic::PRINT_TYPE_HOST) {
|
if (saved_printing_type == PowerPanic::PRINT_TYPE_HOST) {
|
||||||
|
recover_print(0);
|
||||||
|
} else {
|
||||||
|
const uint8_t btn = lcd_show_fullscreen_message_yes_no_and_wait_P(_T(MSG_RECOVER_PRINT), false);
|
||||||
|
if ( btn == LCD_LEFT_BUTTON_CHOICE) {
|
||||||
recover_print(0);
|
recover_print(0);
|
||||||
} else {
|
} else { // LCD_MIDDLE_BUTTON_CHOICE
|
||||||
const uint8_t btn = lcd_show_fullscreen_message_yes_no_and_wait_P(_T(MSG_RECOVER_PRINT), false);
|
cancel_saved_printing();
|
||||||
if ( btn == LCD_LEFT_BUTTON_CHOICE) {
|
|
||||||
recover_print(0);
|
|
||||||
} else { // LCD_MIDDLE_BUTTON_CHOICE
|
|
||||||
eeprom_update_byte_notify((uint8_t*)EEPROM_UVLO, PowerPanic::NO_PENDING_RECOVERY);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -4117,62 +4174,53 @@ void process_commands()
|
||||||
if (farm_prusa_code_seen()) {}
|
if (farm_prusa_code_seen()) {}
|
||||||
else if(code_seen_P(PSTR("FANPINTST"))) {
|
else if(code_seen_P(PSTR("FANPINTST"))) {
|
||||||
gcode_PRUSA_BadRAMBoFanTest();
|
gcode_PRUSA_BadRAMBoFanTest();
|
||||||
}
|
} else if (code_seen_P(PSTR("FAN"))) { // PRUSA FAN
|
||||||
else if (code_seen_P(PSTR("FAN"))) { // PRUSA FAN
|
|
||||||
printf_P(_N("E0:%d RPM\nPRN0:%d RPM\n"), 60*fan_speed[0], 60*fan_speed[1]);
|
printf_P(_N("E0:%d RPM\nPRN0:%d RPM\n"), 60*fan_speed[0], 60*fan_speed[1]);
|
||||||
}
|
} else if (code_seen_P(PSTR("uvlo"))) { // PRUSA uvlo
|
||||||
else if (code_seen_P(PSTR("uvlo"))) // PRUSA uvlo
|
if (eeprom_read_byte((uint8_t*)EEPROM_UVLO_PRINT_TYPE) == PowerPanic::PRINT_TYPE_SD) {
|
||||||
{
|
|
||||||
if (eeprom_read_byte((uint8_t*)EEPROM_UVLO_PRINT_TYPE) == PowerPanic::PRINT_TYPE_SD)
|
|
||||||
{
|
|
||||||
// M24 - Start SD print
|
// M24 - Start SD print
|
||||||
enquecommand_P(MSG_M24);
|
enquecommand_P(MSG_M24);
|
||||||
|
|
||||||
// Print is recovered, clear the recovery flag
|
// Print is recovered, clear the recovery flag
|
||||||
eeprom_update_byte_notify((uint8_t*)EEPROM_UVLO, PowerPanic::NO_PENDING_RECOVERY);
|
eeprom_update_byte_notify((uint8_t*)EEPROM_UVLO, PowerPanic::NO_PENDING_RECOVERY);
|
||||||
}
|
eeprom_update_byte_notify((uint8_t*)EEPROM_UVLO_Z_LIFTED, 0);
|
||||||
else if (eeprom_read_byte((uint8_t*)EEPROM_UVLO_PRINT_TYPE) == PowerPanic::PRINT_TYPE_HOST)
|
} else if (eeprom_read_byte((uint8_t*)EEPROM_UVLO_PRINT_TYPE) == PowerPanic::PRINT_TYPE_HOST) {
|
||||||
{
|
|
||||||
// For Host prints we need to start the timer so that the pause has any effect
|
// For Host prints we need to start the timer so that the pause has any effect
|
||||||
// this will allow g-codes to be processed while in the paused state
|
// this will allow g-codes to be processed while in the paused state
|
||||||
// For SD prints, M24 starts the timer
|
// For SD prints, M24 starts the timer
|
||||||
print_job_timer.start();
|
print_job_timer.start();
|
||||||
|
usb_timer.start();
|
||||||
|
|
||||||
// Park the extruder to the side and don't resume the print
|
// Park the extruder to the side and don't resume the print
|
||||||
// we must assume that the host as not fully booted up at this point
|
// we must assume that the host as not fully booted up at this point
|
||||||
lcd_pause_print();
|
lcd_pause_print();
|
||||||
}
|
}
|
||||||
}
|
} else if (code_seen_P(PSTR("MMURES"))) { // PRUSA MMURES
|
||||||
else if (code_seen_P(PSTR("MMURES"))) // PRUSA MMURES
|
MMU2::mmu2.Reset(MMU2::MMU2::Software);
|
||||||
{
|
} else if (code_seen_P(PSTR("RESET"))) { // PRUSA RESET
|
||||||
MMU2::mmu2.Reset(MMU2::MMU2::Software);
|
|
||||||
}
|
|
||||||
else if (code_seen_P(PSTR("RESET"))) { // PRUSA RESET
|
|
||||||
#if defined(XFLASH) && defined(BOOTAPP)
|
#if defined(XFLASH) && defined(BOOTAPP)
|
||||||
boot_app_magic = 0;
|
boot_app_magic = 0;
|
||||||
#endif //defined(XFLASH) && defined(BOOTAPP)
|
#endif //defined(XFLASH) && defined(BOOTAPP)
|
||||||
softReset();
|
softReset();
|
||||||
}
|
} else if (code_seen_P(PSTR("SN"))) { // PRUSA SN
|
||||||
else if (code_seen_P(PSTR("SN"))) { // PRUSA SN
|
char SN[20];
|
||||||
char SN[20];
|
eeprom_read_block(SN, (uint8_t*)EEPROM_PRUSA_SN, 20);
|
||||||
eeprom_read_block(SN, (uint8_t*)EEPROM_PRUSA_SN, 20);
|
if (SN[19])
|
||||||
if (SN[19])
|
puts_P(PSTR("SN invalid"));
|
||||||
puts_P(PSTR("SN invalid"));
|
else
|
||||||
else
|
puts(SN);
|
||||||
puts(SN);
|
} else if(code_seen_P(PSTR("Fir"))){ // PRUSA Fir
|
||||||
}
|
|
||||||
else if(code_seen_P(PSTR("Fir"))){ // PRUSA Fir
|
|
||||||
|
|
||||||
SERIAL_PROTOCOLLNPGM(FW_VERSION_FULL);
|
SERIAL_PROTOCOLLNPGM(FW_VERSION_FULL);
|
||||||
|
|
||||||
} else if(code_seen_P(PSTR("Rev"))){ // PRUSA Rev
|
} else if(code_seen_P(PSTR("Rev"))){ // PRUSA Rev
|
||||||
|
|
||||||
SERIAL_PROTOCOLLNPGM(FILAMENT_SIZE "-" ELECTRONICS "-" NOZZLE_TYPE );
|
SERIAL_PROTOCOLLNPGM(FILAMENT_SIZE "-" ELECTRONICS "-" NOZZLE_TYPE );
|
||||||
|
|
||||||
} else if(code_seen_P(PSTR("Lang"))) { // PRUSA Lang
|
} else if(code_seen_P(PSTR("Lang"))) { // PRUSA Lang
|
||||||
lang_reset();
|
lang_reset();
|
||||||
|
|
||||||
} else if(code_seen_P(PSTR("Lz"))) { // PRUSA Lz
|
} else if(code_seen_P(PSTR("Lz"))) { // PRUSA Lz
|
||||||
eeprom_update_word_notify(reinterpret_cast<uint16_t *>(&(EEPROM_Sheets_base->s[(eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)))].z_offset)),0);
|
eeprom_update_word_notify(reinterpret_cast<uint16_t *>(&(EEPROM_Sheets_base->s[(eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)))].z_offset)),0);
|
||||||
|
|
||||||
} else if(code_seen_P(PSTR("FR"))) { // PRUSA FR
|
} else if(code_seen_P(PSTR("FR"))) { // PRUSA FR
|
||||||
|
|
@ -4190,21 +4238,17 @@ void process_commands()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (code_seen_P(PSTR("nozzle"))) { // PRUSA nozzle
|
} else if (code_seen_P(PSTR("nozzle"))) { // PRUSA nozzle
|
||||||
uint16_t nDiameter;
|
uint16_t nDiameter;
|
||||||
if(code_seen('D'))
|
if(code_seen('D')) {
|
||||||
{
|
nDiameter=(uint16_t)(code_value()*1000.0+0.5); // [,um]
|
||||||
nDiameter=(uint16_t)(code_value()*1000.0+0.5); // [,um]
|
nozzle_diameter_check(nDiameter);
|
||||||
nozzle_diameter_check(nDiameter);
|
} else if(code_seen_P(PSTR("set")) && farm_mode) {
|
||||||
}
|
strchr_pointer++; // skip 1st char (~ 's')
|
||||||
else if(code_seen_P(PSTR("set")) && farm_mode)
|
strchr_pointer++; // skip 2nd char (~ 'e')
|
||||||
{
|
nDiameter=(uint16_t)(code_value()*1000.0+0.5); // [,um]
|
||||||
strchr_pointer++; // skip 1st char (~ 's')
|
eeprom_update_byte_notify((uint8_t*)EEPROM_NOZZLE_DIAMETER,(uint8_t)ClNozzleDiameter::_Diameter_Undef); // for correct synchronization after farm-mode exiting
|
||||||
strchr_pointer++; // skip 2nd char (~ 'e')
|
eeprom_update_word_notify((uint16_t*)EEPROM_NOZZLE_DIAMETER_uM,nDiameter);
|
||||||
nDiameter=(uint16_t)(code_value()*1000.0+0.5); // [,um]
|
} else SERIAL_PROTOCOLLN((float)eeprom_read_word((uint16_t*)EEPROM_NOZZLE_DIAMETER_uM)/1000.0);
|
||||||
eeprom_update_byte_notify((uint8_t*)EEPROM_NOZZLE_DIAMETER,(uint8_t)ClNozzleDiameter::_Diameter_Undef); // for correct synchronization after farm-mode exiting
|
|
||||||
eeprom_update_word_notify((uint16_t*)EEPROM_NOZZLE_DIAMETER_uM,nDiameter);
|
|
||||||
}
|
|
||||||
else SERIAL_PROTOCOLLN((float)eeprom_read_word((uint16_t*)EEPROM_NOZZLE_DIAMETER_uM)/1000.0);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(*CMDBUFFER_CURRENT_STRING == 'G')
|
else if(*CMDBUFFER_CURRENT_STRING == 'G')
|
||||||
|
|
@ -5999,9 +6043,12 @@ Sigma_Exit:
|
||||||
SetHostStatusScreenName(str.GetUnquotedString());
|
SetHostStatusScreenName(str.GetUnquotedString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#ifdef DEBUG_PRINTER_STATES
|
||||||
|
debug_printer_states();
|
||||||
|
#endif //DEBUG_PRINTER_STATES
|
||||||
|
|
||||||
if (eeprom_read_byte((uint8_t*)EEPROM_UVLO_PRINT_TYPE) == PowerPanic::PRINT_TYPE_HOST
|
if (eeprom_read_byte((uint8_t*)EEPROM_UVLO_PRINT_TYPE) == PowerPanic::PRINT_TYPE_HOST
|
||||||
&& eeprom_read_byte((uint8_t*)EEPROM_UVLO) != PowerPanic::NO_PENDING_RECOVERY
|
&& printer_recovering()
|
||||||
&& printingIsPaused()) {
|
&& printingIsPaused()) {
|
||||||
// The print is in a paused state. The print was recovered following a power panic
|
// The print is in a paused state. The print was recovered following a power panic
|
||||||
// but up to this point the printer has been waiting for the M79 from the host
|
// but up to this point the printer has been waiting for the M79 from the host
|
||||||
|
|
@ -11024,7 +11071,8 @@ void restore_print_from_ram_and_continue(float e_move)
|
||||||
set_destination_to_current();
|
set_destination_to_current();
|
||||||
|
|
||||||
restore_print_file_state();
|
restore_print_file_state();
|
||||||
|
eeprom_update_byte_notify((uint8_t*)EEPROM_UVLO, PowerPanic::NO_PENDING_RECOVERY);
|
||||||
|
eeprom_update_byte_notify((uint8_t*)EEPROM_UVLO_Z_LIFTED, 0);
|
||||||
lcd_setstatuspgm(MSG_WELCOME);
|
lcd_setstatuspgm(MSG_WELCOME);
|
||||||
saved_printing_type = PowerPanic::PRINT_TYPE_NONE;
|
saved_printing_type = PowerPanic::PRINT_TYPE_NONE;
|
||||||
saved_printing = false;
|
saved_printing = false;
|
||||||
|
|
@ -11035,6 +11083,7 @@ void restore_print_from_ram_and_continue(float e_move)
|
||||||
void cancel_saved_printing()
|
void cancel_saved_printing()
|
||||||
{
|
{
|
||||||
eeprom_update_byte_notify((uint8_t*)EEPROM_UVLO, PowerPanic::NO_PENDING_RECOVERY);
|
eeprom_update_byte_notify((uint8_t*)EEPROM_UVLO, PowerPanic::NO_PENDING_RECOVERY);
|
||||||
|
eeprom_update_byte_notify((uint8_t*)EEPROM_UVLO_Z_LIFTED, 0);
|
||||||
saved_start_position[0] = SAVED_START_POSITION_UNSET;
|
saved_start_position[0] = SAVED_START_POSITION_UNSET;
|
||||||
saved_printing_type = PowerPanic::PRINT_TYPE_NONE;
|
saved_printing_type = PowerPanic::PRINT_TYPE_NONE;
|
||||||
saved_printing = false;
|
saved_printing = false;
|
||||||
|
|
|
||||||
|
|
@ -83,7 +83,7 @@ static_assert(sizeof(Sheets) == EEPROM_SHEETS_SIZEOF, "Sizeof(Sheets) is not EEP
|
||||||
|
|
||||||
To convert hex to dec https://www.rapidtables.com/convert/number/hex-to-decimal.html
|
To convert hex to dec https://www.rapidtables.com/convert/number/hex-to-decimal.html
|
||||||
|
|
||||||
Version: 1.0.2
|
Version: 3.14.0
|
||||||
|
|
||||||
---------------------------------------------------------------------------------
|
---------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
@ -382,6 +382,8 @@ static_assert(sizeof(Sheets) == EEPROM_SHEETS_SIZEOF, "Sizeof(Sheets) is not EEP
|
||||||
| 0x0C94 3220 | uint8 | EEPROM_KILL_PENDING_FLAG | 42h, ffh | ffh | Kill pending flag (0x42 magic value) | kill() | D3 Ax0c94 C1
|
| 0x0C94 3220 | uint8 | EEPROM_KILL_PENDING_FLAG | 42h, ffh | ffh | Kill pending flag (0x42 magic value) | kill() | D3 Ax0c94 C1
|
||||||
| 0x0C91 3217 | char[3] | EEPROM_FILENAME_EXTENSION | ??? | ffffffffh | DOS 8.3 filename extension | Power Panic | D3 Ax0c91 C1
|
| 0x0C91 3217 | char[3] | EEPROM_FILENAME_EXTENSION | ??? | ffffffffh | DOS 8.3 filename extension | Power Panic | D3 Ax0c91 C1
|
||||||
| 0x0C80 3200 | char[17]| EEPROM_CUSTOM_MENDEL_NAME | Prusa i3 MK3S| ffffffffffffffffff... | Custom Printer Name | | D3 Ax0c80 C17
|
| 0x0C80 3200 | char[17]| EEPROM_CUSTOM_MENDEL_NAME | Prusa i3 MK3S| ffffffffffffffffff... | Custom Printer Name | | D3 Ax0c80 C17
|
||||||
|
| 0x0C7F 3199 | bool | EEPROM_UVLO_Z_LIFTED | 00h 0 | 00h | Power Panic Z axis NOT lifted | Power Panic | D3 Ax0c7f C1
|
||||||
|
| ^ | ^ | ^ | 01h 1 | 01h | Power Panic Z axis lifted | ^ | ^
|
||||||
|
|
||||||
|Address begin|Bit/Type | Name | Valid values | Default/FactoryReset | Description |Gcode/Function| Debug code
|
|Address begin|Bit/Type | Name | Valid values | Default/FactoryReset | Description |Gcode/Function| Debug code
|
||||||
| :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--:
|
| :--: | :--: | :--: | :--: | :--: | :--: | :--: | :--:
|
||||||
|
|
@ -621,9 +623,10 @@ static Sheets * const EEPROM_Sheets_base = (Sheets*)(EEPROM_SHEETS_BASE);
|
||||||
#define EEPROM_KILL_PENDING_FLAG (EEPROM_KILL_MESSAGE-1) //uint8
|
#define EEPROM_KILL_PENDING_FLAG (EEPROM_KILL_MESSAGE-1) //uint8
|
||||||
#define EEPROM_FILENAME_EXTENSION (EEPROM_KILL_PENDING_FLAG - 3) // 3 x char
|
#define EEPROM_FILENAME_EXTENSION (EEPROM_KILL_PENDING_FLAG - 3) // 3 x char
|
||||||
#define EEPROM_CUSTOM_MENDEL_NAME (EEPROM_FILENAME_EXTENSION-17) //char[17]
|
#define EEPROM_CUSTOM_MENDEL_NAME (EEPROM_FILENAME_EXTENSION-17) //char[17]
|
||||||
|
#define EEPROM_UVLO_Z_LIFTED (EEPROM_CUSTOM_MENDEL_NAME-1) //bool
|
||||||
|
|
||||||
//This is supposed to point to last item to allow EEPROM overrun check. Please update when adding new items.
|
//This is supposed to point to last item to allow EEPROM overrun check. Please update when adding new items.
|
||||||
#define EEPROM_LAST_ITEM EEPROM_FILENAME_EXTENSION
|
#define EEPROM_LAST_ITEM EEPROM_UVLO_Z_LIFTED
|
||||||
// !!!!!
|
// !!!!!
|
||||||
// !!!!! this is end of EEPROM section ... all updates MUST BE inserted before this mark !!!!!
|
// !!!!! this is end of EEPROM section ... all updates MUST BE inserted before this mark !!!!!
|
||||||
// !!!!!
|
// !!!!!
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ void uvlo_() {
|
||||||
unsigned long time_start = _millis();
|
unsigned long time_start = _millis();
|
||||||
|
|
||||||
// True if a print is already saved to RAM
|
// True if a print is already saved to RAM
|
||||||
const bool sd_print_saved_in_ram = saved_printing && (saved_printing_type == PowerPanic::PRINT_TYPE_SD);
|
const bool print_saved_in_ram = saved_printing && (saved_printing_type != PowerPanic::PRINT_TYPE_NONE);
|
||||||
const bool pos_invalid = mesh_bed_leveling_flag || homing_flag;
|
const bool pos_invalid = mesh_bed_leveling_flag || homing_flag;
|
||||||
|
|
||||||
// Conserve as much power as soon as possible
|
// Conserve as much power as soon as possible
|
||||||
|
|
@ -66,7 +66,7 @@ void uvlo_() {
|
||||||
tmc2130_setup_chopper(E_AXIS, tmc2130_mres[E_AXIS]);
|
tmc2130_setup_chopper(E_AXIS, tmc2130_mres[E_AXIS]);
|
||||||
#endif //TMC2130
|
#endif //TMC2130
|
||||||
|
|
||||||
if (!sd_print_saved_in_ram && !isPartialBackupAvailable)
|
if (!print_saved_in_ram && !isPartialBackupAvailable)
|
||||||
{
|
{
|
||||||
saved_bed_temperature = target_temperature_bed;
|
saved_bed_temperature = target_temperature_bed;
|
||||||
saved_extruder_temperature = target_temperature[active_extruder];
|
saved_extruder_temperature = target_temperature[active_extruder];
|
||||||
|
|
@ -78,7 +78,7 @@ void uvlo_() {
|
||||||
disable_heater();
|
disable_heater();
|
||||||
|
|
||||||
// Fetch data not included in a partial back-up
|
// Fetch data not included in a partial back-up
|
||||||
if (!sd_print_saved_in_ram) {
|
if (!print_saved_in_ram) {
|
||||||
// Calculate the file position, from which to resume this print.
|
// Calculate the file position, from which to resume this print.
|
||||||
save_print_file_state();
|
save_print_file_state();
|
||||||
|
|
||||||
|
|
@ -99,7 +99,7 @@ void uvlo_() {
|
||||||
|
|
||||||
// When there is no position already saved, then we must grab whatever the current position is.
|
// When there is no position already saved, then we must grab whatever the current position is.
|
||||||
// This is most likely a position where the printer is in the middle of a G-code move
|
// This is most likely a position where the printer is in the middle of a G-code move
|
||||||
if (!sd_print_saved_in_ram && !isPartialBackupAvailable)
|
if (!print_saved_in_ram && !isPartialBackupAvailable)
|
||||||
{
|
{
|
||||||
memcpy(saved_pos, current_position, sizeof(saved_pos));
|
memcpy(saved_pos, current_position, sizeof(saved_pos));
|
||||||
if (pos_invalid) saved_pos[X_AXIS] = X_COORD_INVALID;
|
if (pos_invalid) saved_pos[X_AXIS] = X_COORD_INVALID;
|
||||||
|
|
@ -192,6 +192,9 @@ void uvlo_() {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Finally store the "power outage" flag.
|
// Finally store the "power outage" flag.
|
||||||
|
if (did_pause_print) {
|
||||||
|
eeprom_update_byte_notify((uint8_t*)EEPROM_UVLO_Z_LIFTED, 1);
|
||||||
|
}
|
||||||
eeprom_update_byte_notify((uint8_t*)EEPROM_UVLO, PowerPanic::PENDING_RECOVERY);
|
eeprom_update_byte_notify((uint8_t*)EEPROM_UVLO, PowerPanic::PENDING_RECOVERY);
|
||||||
|
|
||||||
// Increment power failure counter
|
// Increment power failure counter
|
||||||
|
|
@ -286,7 +289,7 @@ void setup_uvlo_interrupt() {
|
||||||
EIMSK |= (1 << 4);
|
EIMSK |= (1 << 4);
|
||||||
|
|
||||||
// check if power was lost before we armed the interrupt
|
// check if power was lost before we armed the interrupt
|
||||||
if(!(PINE & (1 << 4)) && eeprom_read_byte((uint8_t*)EEPROM_UVLO) != PowerPanic::NO_PENDING_RECOVERY)
|
if(!(PINE & (1 << 4)) && printer_recovering())
|
||||||
{
|
{
|
||||||
SERIAL_ECHOLNRPGM(MSG_INT4);
|
SERIAL_ECHOLNRPGM(MSG_INT4);
|
||||||
uvlo_drain_reset();
|
uvlo_drain_reset();
|
||||||
|
|
@ -315,11 +318,17 @@ void recover_print(uint8_t automatic) {
|
||||||
// Recover position, temperatures and extrude_multipliers
|
// Recover position, temperatures and extrude_multipliers
|
||||||
bool mbl_was_active = recover_machine_state_after_power_panic();
|
bool mbl_was_active = recover_machine_state_after_power_panic();
|
||||||
|
|
||||||
// Lift the print head 25mm, first to avoid collisions with oozed material with the print,
|
// Undo PP Z Lift by setting current Z pos to + Z_PAUSE_LIFT
|
||||||
// and second also so one may remove the excess priming material.
|
// With first PP or Pause + PP the Z has been already lift.
|
||||||
if(eeprom_read_byte((uint8_t*)EEPROM_UVLO) == PowerPanic::PENDING_RECOVERY)
|
// After a reboot the printer doesn't know the Z height and we have to set its previous value
|
||||||
{
|
if(eeprom_read_byte((uint8_t*)EEPROM_UVLO_Z_LIFTED) == 1 ) {
|
||||||
enquecommandf_P(PSTR("G1 Z%.3f F800"), current_position[Z_AXIS] + 25);
|
current_position[Z_AXIS] += Z_PAUSE_LIFT;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Lift the print head ONCE plus Z_PAUSE_LIFT first to avoid collisions with oozed material with the print,
|
||||||
|
if(eeprom_read_byte((uint8_t*)EEPROM_UVLO_Z_LIFTED) == 0) {
|
||||||
|
enquecommandf_P(PSTR("G1 Z%.3f F800"), current_position[Z_AXIS] + Z_PAUSE_LIFT);
|
||||||
|
eeprom_update_byte_notify((uint8_t*)EEPROM_UVLO_Z_LIFTED, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Home X and Y axes. Homing just X and Y shall not touch the babystep and the world2machine
|
// Home X and Y axes. Homing just X and Y shall not touch the babystep and the world2machine
|
||||||
|
|
@ -328,7 +337,10 @@ void recover_print(uint8_t automatic) {
|
||||||
// Set the target bed and nozzle temperatures and wait.
|
// Set the target bed and nozzle temperatures and wait.
|
||||||
enquecommandf_P(PSTR("M104 S%d"), target_temperature[active_extruder]);
|
enquecommandf_P(PSTR("M104 S%d"), target_temperature[active_extruder]);
|
||||||
enquecommandf_P(PSTR("M140 S%d"), target_temperature_bed);
|
enquecommandf_P(PSTR("M140 S%d"), target_temperature_bed);
|
||||||
enquecommandf_P(PSTR("M109 S%d"), target_temperature[active_extruder]);
|
//No need to wait for hotend heatup while host printing, as print will pause and wait for host.
|
||||||
|
if (eeprom_read_byte((uint8_t*)EEPROM_UVLO_PRINT_TYPE) == PowerPanic::PRINT_TYPE_SD) {
|
||||||
|
enquecommandf_P(PSTR("M109 S%d"), target_temperature[active_extruder]);
|
||||||
|
}
|
||||||
enquecommand_P(MSG_M83); //E axis relative mode
|
enquecommand_P(MSG_M83); //E axis relative mode
|
||||||
|
|
||||||
// If not automatically recoreverd (long power loss)
|
// If not automatically recoreverd (long power loss)
|
||||||
|
|
@ -426,7 +438,7 @@ void restore_print_from_eeprom(bool mbl_was_active) {
|
||||||
SERIAL_ECHOPGM(", feedmultiply:");
|
SERIAL_ECHOPGM(", feedmultiply:");
|
||||||
MYSERIAL.println(feedmultiply_rec);
|
MYSERIAL.println(feedmultiply_rec);
|
||||||
|
|
||||||
if (eeprom_read_byte((uint8_t*)EEPROM_UVLO_PRINT_TYPE) == PowerPanic::PRINT_TYPE_SD)
|
if (saved_printing_type == PowerPanic::PRINT_TYPE_SD)
|
||||||
{ // M23
|
{ // M23
|
||||||
restore_file_from_sd();
|
restore_file_from_sd();
|
||||||
}
|
}
|
||||||
|
|
@ -468,12 +480,12 @@ void restore_print_from_eeprom(bool mbl_was_active) {
|
||||||
|
|
||||||
// SD: Position in file, USB: g-code line number
|
// SD: Position in file, USB: g-code line number
|
||||||
uint32_t position = eeprom_read_dword((uint32_t*)(EEPROM_FILE_POSITION));
|
uint32_t position = eeprom_read_dword((uint32_t*)(EEPROM_FILE_POSITION));
|
||||||
if (eeprom_read_byte((uint8_t*)EEPROM_UVLO_PRINT_TYPE) == PowerPanic::PRINT_TYPE_SD)
|
if (saved_printing_type == PowerPanic::PRINT_TYPE_SD)
|
||||||
{
|
{
|
||||||
// Set a position in the file.
|
// Set a position in the file.
|
||||||
enquecommandf_P(PSTR("M26 S%lu"), position);
|
enquecommandf_P(PSTR("M26 S%lu"), position);
|
||||||
}
|
}
|
||||||
else if (eeprom_read_byte((uint8_t*)EEPROM_UVLO_PRINT_TYPE) == PowerPanic::PRINT_TYPE_HOST)
|
else if (saved_printing_type == PowerPanic::PRINT_TYPE_HOST)
|
||||||
{
|
{
|
||||||
// Set line number
|
// Set line number
|
||||||
enquecommandf_P(PSTR("M110 N%lu"), position);
|
enquecommandf_P(PSTR("M110 N%lu"), position);
|
||||||
|
|
@ -482,4 +494,5 @@ void restore_print_from_eeprom(bool mbl_was_active) {
|
||||||
enquecommand_P(PSTR("G4 S0"));
|
enquecommand_P(PSTR("G4 S0"));
|
||||||
enquecommand_P(PSTR("PRUSA uvlo"));
|
enquecommand_P(PSTR("PRUSA uvlo"));
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif //UVLO_SUPPORT
|
#endif //UVLO_SUPPORT
|
||||||
|
|
|
||||||
|
|
@ -5228,13 +5228,17 @@ static void lcd_main_menu()
|
||||||
MENU_ITEM_FUNCTION_P(PSTR("tst - Restore"), lcd_menu_test_restore);
|
MENU_ITEM_FUNCTION_P(PSTR("tst - Restore"), lcd_menu_test_restore);
|
||||||
#endif //RESUME_DEBUG
|
#endif //RESUME_DEBUG
|
||||||
|
|
||||||
|
#ifdef DEBUG_PRINTER_STATES
|
||||||
|
debug_printer_states();
|
||||||
|
#endif //End DEBUG_PRINTER_STATES
|
||||||
|
|
||||||
#ifdef TMC2130_DEBUG
|
#ifdef TMC2130_DEBUG
|
||||||
MENU_ITEM_FUNCTION_P(PSTR("recover print"), recover_print);
|
MENU_ITEM_FUNCTION_P(PSTR("recover print"), recover_print);
|
||||||
MENU_ITEM_FUNCTION_P(PSTR("power panic"), uvlo_);
|
MENU_ITEM_FUNCTION_P(PSTR("power panic"), uvlo_);
|
||||||
#endif //TMC2130_DEBUG
|
#endif //TMC2130_DEBUG
|
||||||
|
|
||||||
// Menu item for reprint
|
// Menu item for reprint
|
||||||
if(!printer_active() && (heating_status == HeatingStatus::NO_HEATING)) {
|
if (!printer_active() && !printer_recovering() && (heating_status == HeatingStatus::NO_HEATING)) {
|
||||||
if ((GetPrinterState() == PrinterState::SDPrintingFinished) && card.mounted) {
|
if ((GetPrinterState() == PrinterState::SDPrintingFinished) && card.mounted) {
|
||||||
MENU_ITEM_FUNCTION_P(_T(MSG_REPRINT), lcd_reprint_from_eeprom);
|
MENU_ITEM_FUNCTION_P(_T(MSG_REPRINT), lcd_reprint_from_eeprom);
|
||||||
} else if ((GetPrinterState() == PrinterState::HostPrintingFinished) && M79_timer_get_status()) {
|
} else if ((GetPrinterState() == PrinterState::HostPrintingFinished) && M79_timer_get_status()) {
|
||||||
|
|
@ -5249,45 +5253,43 @@ static void lcd_main_menu()
|
||||||
if (farm_mode)
|
if (farm_mode)
|
||||||
MENU_ITEM_FUNCTION_P(_T(MSG_FILAMENTCHANGE), lcd_colorprint_change);//8
|
MENU_ITEM_FUNCTION_P(_T(MSG_FILAMENTCHANGE), lcd_colorprint_change);//8
|
||||||
|
|
||||||
if ( moves_planned() || printer_active() ) {
|
if (!printer_recovering()) {
|
||||||
MENU_ITEM_SUBMENU_P(_T(MSG_TUNE), lcd_tune_menu);
|
if ( moves_planned() || printer_active()) {
|
||||||
} else if (!Stopped) {
|
MENU_ITEM_SUBMENU_P(_T(MSG_TUNE), lcd_tune_menu);
|
||||||
MENU_ITEM_SUBMENU_P(_i("Preheat"), lcd_preheat_menu);////MSG_PREHEAT c=18
|
} else if (!Stopped) {
|
||||||
if (M79_timer_get_status()) {
|
MENU_ITEM_SUBMENU_P(_i("Preheat"), lcd_preheat_menu);////MSG_PREHEAT c=18
|
||||||
if(GetPrinterState() == PrinterState::IsReady) {
|
if (M79_timer_get_status()) {
|
||||||
MENU_ITEM_FUNCTION_P(_T(MSG_SET_NOT_READY), lcd_printer_ready_state_toggle);
|
if(GetPrinterState() == PrinterState::IsReady) {
|
||||||
} else {
|
MENU_ITEM_FUNCTION_P(_T(MSG_SET_NOT_READY), lcd_printer_ready_state_toggle);
|
||||||
MENU_ITEM_FUNCTION_P(_T(MSG_SET_READY), lcd_printer_ready_state_toggle);
|
} else {
|
||||||
|
MENU_ITEM_FUNCTION_P(_T(MSG_SET_READY), lcd_printer_ready_state_toggle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (mesh_bed_leveling_flag == false && homing_flag == false && !printingIsPaused() && !processing_tcode) {
|
||||||
|
if (usb_timer.running()) {
|
||||||
|
MENU_ITEM_FUNCTION_P(_T(MSG_PAUSE_PRINT), lcd_pause_usb_print);
|
||||||
|
} else if (IS_SD_PRINTING) {
|
||||||
|
MENU_ITEM_FUNCTION_P(_T(MSG_PAUSE_PRINT), lcd_pause_print);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (mesh_bed_leveling_flag == false && homing_flag == false && !printingIsPaused() && !processing_tcode) {
|
if (printingIsPaused()
|
||||||
if (usb_timer.running()) {
|
|
||||||
MENU_ITEM_FUNCTION_P(_T(MSG_PAUSE_PRINT), lcd_pause_usb_print);
|
|
||||||
} else if (IS_SD_PRINTING) {
|
|
||||||
MENU_ITEM_FUNCTION_P(_T(MSG_PAUSE_PRINT), lcd_pause_print);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(printingIsPaused())
|
|
||||||
{
|
|
||||||
// only allow resuming if hardware errors (temperature or fan) are cleared
|
// only allow resuming if hardware errors (temperature or fan) are cleared
|
||||||
if(!get_temp_error()
|
&& !get_temp_error()
|
||||||
#ifdef FANCHECK
|
#ifdef FANCHECK
|
||||||
&& fan_check_error != EFCE_REPORTED
|
&& fan_check_error != EFCE_REPORTED
|
||||||
#endif //FANCHECK
|
#endif //FANCHECK
|
||||||
) {
|
&& (saved_printing_type != PowerPanic::PRINT_TYPE_NONE || saved_printing)
|
||||||
if (saved_printing) {
|
&& custom_message_type != CustomMsg::Resuming) {
|
||||||
|
if (saved_printing_type == PowerPanic::PRINT_TYPE_SD) {
|
||||||
MENU_ITEM_SUBMENU_P(_T(MSG_RESUME_PRINT), lcd_resume_print);
|
MENU_ITEM_SUBMENU_P(_T(MSG_RESUME_PRINT), lcd_resume_print);
|
||||||
} else {
|
} else if ((saved_printing_type == PowerPanic::PRINT_TYPE_HOST) && (M79_timer_get_status())) {
|
||||||
MENU_ITEM_SUBMENU_P(_T(MSG_RESUME_PRINT), lcd_resume_usb_print);
|
MENU_ITEM_SUBMENU_P(_T(MSG_RESUME_PRINT), lcd_resume_usb_print);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if((printJobOngoing()
|
if((printJobOngoing() || printingIsPaused() || (printer_recovering()))
|
||||||
|| printingIsPaused()
|
&& (custom_message_type != CustomMsg::MeshBedLeveling) && !processing_tcode) {
|
||||||
|| (eeprom_read_byte((uint8_t*)EEPROM_UVLO) != PowerPanic::NO_PENDING_RECOVERY))
|
|
||||||
&& (custom_message_type != CustomMsg::MeshBedLeveling)
|
|
||||||
&& !processing_tcode) {
|
|
||||||
MENU_ITEM_SUBMENU_P(_T(MSG_STOP_PRINT), lcd_sdcard_stop);
|
MENU_ITEM_SUBMENU_P(_T(MSG_STOP_PRINT), lcd_sdcard_stop);
|
||||||
}
|
}
|
||||||
#ifdef THERMAL_MODEL
|
#ifdef THERMAL_MODEL
|
||||||
|
|
@ -5297,81 +5299,87 @@ static void lcd_main_menu()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// only allow starting SD print if hardware errors (temperature or fan) are cleared
|
// only allow starting SD print if hardware errors (temperature or fan) are cleared
|
||||||
if(!get_temp_error()
|
if (!printer_recovering() && !printer_active() && !get_temp_error()
|
||||||
&& !printer_active()
|
|
||||||
#ifdef FANCHECK
|
#ifdef FANCHECK
|
||||||
&& fan_check_error != EFCE_REPORTED
|
&& fan_check_error != EFCE_REPORTED
|
||||||
#endif //FANCHECK
|
#endif //FANCHECK
|
||||||
)
|
) {
|
||||||
{
|
|
||||||
#ifdef SDSUPPORT //!@todo SDSUPPORT undefined creates several issues in source code
|
#ifdef SDSUPPORT //!@todo SDSUPPORT undefined creates several issues in source code
|
||||||
if (card.mounted || lcd_commands_type != LcdCommands::Idle) {
|
if (card.mounted
|
||||||
if (!card.isFileOpen()) {
|
|| lcd_commands_type != LcdCommands::Idle) {
|
||||||
if (!usb_timer.running() && (lcd_commands_type == LcdCommands::Idle)) {
|
if (!card.isFileOpen()) {
|
||||||
bMain=true; // flag ('fake parameter') for 'lcd_sdcard_menu()' function
|
if (!usb_timer.running() && (lcd_commands_type == LcdCommands::Idle)) {
|
||||||
MENU_ITEM_SUBMENU_P(_T(MSG_CARD_MENU), lcd_sdcard_menu);
|
bMain=true; // flag ('fake parameter') for 'lcd_sdcard_menu()' function
|
||||||
}
|
MENU_ITEM_SUBMENU_P(_T(MSG_CARD_MENU), lcd_sdcard_menu);
|
||||||
|
}
|
||||||
#if SDCARDDETECT < 1
|
#if SDCARDDETECT < 1
|
||||||
MENU_ITEM_GCODE_P(_i("Change SD card"), PSTR("M21")); // SD-card changed by user ////MSG_CNG_SDCARD c=18
|
MENU_ITEM_GCODE_P(_i("Change SD card"), PSTR("M21")); // SD-card changed by user ////MSG_CNG_SDCARD c=18
|
||||||
#endif //SDCARDDETECT
|
#endif //SDCARDDETECT
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
bMain=true; // flag (i.e. 'fake parameter') for 'lcd_sdcard_menu()' function
|
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 c=18
|
MENU_ITEM_BACK_P(_i("No SD card")); ////MSG_NO_CARD c=18
|
||||||
#if SDCARDDETECT < 1
|
#if SDCARDDETECT < 1
|
||||||
MENU_ITEM_GCODE_P(_i("Init. SD card"), PSTR("M21")); // Manually initialize the SD-card via user interface ////MSG_INIT_SDCARD c=18
|
MENU_ITEM_GCODE_P(_i("Init. SD card"), PSTR("M21")); // Manually initialize the SD-card via user interface ////MSG_INIT_SDCARD c=18
|
||||||
#endif //SDCARDDETECT
|
#endif //SDCARDDETECT
|
||||||
}
|
}
|
||||||
#endif //SDSUPPORT
|
#endif //SDSUPPORT
|
||||||
}
|
if(!farm_mode) {
|
||||||
|
const int8_t sheet = eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet));
|
||||||
if(!printer_active() && !farm_mode) {
|
const int8_t nextSheet = eeprom_next_initialized_sheet(sheet);
|
||||||
const int8_t sheet = eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet));
|
if ((nextSheet >= 0) && (sheet != nextSheet)) { // show menu only if we have 2 or more sheets initialized
|
||||||
const int8_t nextSheet = eeprom_next_initialized_sheet(sheet);
|
MENU_ITEM_FUNCTION_E(EEPROM_Sheets_base->s[sheet], eeprom_switch_to_next_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);
|
|
||||||
}
|
|
||||||
#ifdef QUICK_NOZZLE_CHANGE
|
#ifdef QUICK_NOZZLE_CHANGE
|
||||||
SETTINGS_NOZZLE;
|
SETTINGS_NOZZLE;
|
||||||
#endif //QUICK_NOZZLE_CHANGE
|
#endif //QUICK_NOZZLE_CHANGE
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( ! ( printer_active() || (eFilamentAction != FilamentAction::None) || Stopped ) ) {
|
|
||||||
if (MMU2::mmu2.Enabled()) {
|
|
||||||
if(!MMU2::mmu2.FindaDetectsFilament() && !fsensor.getFilamentPresent()) {
|
|
||||||
// The MMU 'Load filament' state machine will reject the command if any
|
|
||||||
// filament sensor is reporting a detected filament
|
|
||||||
MENU_ITEM_SUBMENU_P(_T(MSG_PRELOAD_TO_MMU), mmu_preload_filament_menu);
|
|
||||||
}
|
|
||||||
MENU_ITEM_SUBMENU_P(_i("Load to nozzle"), lcd_mmuLoadFilament);////MSG_LOAD_TO_NOZZLE c=18
|
|
||||||
MENU_ITEM_SUBMENU_P(_T(MSG_UNLOAD_FILAMENT), lcd_mmuUnloadFilament);
|
|
||||||
MENU_ITEM_SUBMENU_P(_T(MSG_EJECT_FROM_MMU), lcd_mmuEjectFilament);
|
|
||||||
#ifdef MMU_HAS_CUTTER
|
|
||||||
if (eeprom_read_byte((uint8_t*)EEPROM_MMU_CUTTER_ENABLED) != 0) {
|
|
||||||
MENU_ITEM_SUBMENU_P(_T(MSG_CUT_FILAMENT), lcd_mmuCutFilament);
|
|
||||||
}
|
|
||||||
#endif //MMU_HAS_CUTTER
|
|
||||||
} else {
|
|
||||||
#ifdef FILAMENT_SENSOR
|
|
||||||
if (fsensor.isEnabled() && fsensor.getAutoLoadEnabled()) {
|
|
||||||
MENU_ITEM_SUBMENU_P(_i("AutoLoad filament"), lcd_menu_AutoLoadFilament);////MSG_AUTOLOAD_FILAMENT c=18
|
|
||||||
}
|
|
||||||
else
|
|
||||||
#endif //FILAMENT_SENSOR
|
|
||||||
{
|
|
||||||
MENU_ITEM_SUBMENU_P(_T(MSG_LOAD_FILAMENT), lcd_LoadFilament);
|
|
||||||
}
|
|
||||||
MENU_ITEM_SUBMENU_P(_T(MSG_UNLOAD_FILAMENT), lcd_unLoadFilament);
|
|
||||||
}
|
}
|
||||||
MENU_ITEM_SUBMENU_P(_T(MSG_SETTINGS), lcd_settings_menu);
|
|
||||||
if(!printingIsPaused()) MENU_ITEM_SUBMENU_P(_T(MSG_CALIBRATION), lcd_calibration_menu);
|
if (!((eFilamentAction != FilamentAction::None) || Stopped )) {
|
||||||
|
if (MMU2::mmu2.Enabled()) {
|
||||||
|
if(!MMU2::mmu2.FindaDetectsFilament() && !fsensor.getFilamentPresent()) {
|
||||||
|
// The MMU 'Load filament' state machine will reject the command if any
|
||||||
|
// filament sensor is reporting a detected filament
|
||||||
|
MENU_ITEM_SUBMENU_P(_T(MSG_PRELOAD_TO_MMU), mmu_preload_filament_menu);
|
||||||
|
}
|
||||||
|
MENU_ITEM_SUBMENU_P(_i("Load to nozzle"), lcd_mmuLoadFilament);////MSG_LOAD_TO_NOZZLE c=18
|
||||||
|
MENU_ITEM_SUBMENU_P(_T(MSG_UNLOAD_FILAMENT), lcd_mmuUnloadFilament);
|
||||||
|
MENU_ITEM_SUBMENU_P(_T(MSG_EJECT_FROM_MMU), lcd_mmuEjectFilament);
|
||||||
|
#ifdef MMU_HAS_CUTTER
|
||||||
|
if (eeprom_read_byte((uint8_t*)EEPROM_MMU_CUTTER_ENABLED) != 0) {
|
||||||
|
MENU_ITEM_SUBMENU_P(_T(MSG_CUT_FILAMENT), lcd_mmuCutFilament);
|
||||||
|
}
|
||||||
|
#endif //MMU_HAS_CUTTER
|
||||||
|
} else {
|
||||||
|
#ifdef FILAMENT_SENSOR
|
||||||
|
if (fsensor.isEnabled()) {
|
||||||
|
if (!fsensor.getFilamentPresent()) {
|
||||||
|
if (fsensor.getAutoLoadEnabled()) {
|
||||||
|
MENU_ITEM_SUBMENU_P(_i("AutoLoad filament"), lcd_menu_AutoLoadFilament);////MSG_AUTOLOAD_FILAMENT c=18
|
||||||
|
} else {
|
||||||
|
MENU_ITEM_SUBMENU_P(_T(MSG_LOAD_FILAMENT), lcd_LoadFilament);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
MENU_ITEM_SUBMENU_P(_T(MSG_UNLOAD_FILAMENT), lcd_unLoadFilament);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
#endif //FILAMENT_SENSOR
|
||||||
|
MENU_ITEM_SUBMENU_P(_T(MSG_LOAD_FILAMENT), lcd_LoadFilament);
|
||||||
|
MENU_ITEM_SUBMENU_P(_T(MSG_UNLOAD_FILAMENT), lcd_unLoadFilament);
|
||||||
|
#ifdef FILAMENT_SENSOR
|
||||||
|
}
|
||||||
|
#endif //FILAMENT_SENSOR
|
||||||
|
}
|
||||||
|
MENU_ITEM_SUBMENU_P(_T(MSG_SETTINGS), lcd_settings_menu);
|
||||||
|
MENU_ITEM_SUBMENU_P(_T(MSG_CALIBRATION), lcd_calibration_menu);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MENU_ITEM_SUBMENU_P(_i("Statistics"), lcd_menu_statistics);////MSG_STATISTICS c=18
|
MENU_ITEM_SUBMENU_P(_i("Statistics"), lcd_menu_statistics);////MSG_STATISTICS c=18
|
||||||
|
|
||||||
#if defined(TMC2130) || defined(FILAMENT_SENSOR)
|
#if defined(TMC2130) || defined(FILAMENT_SENSOR)
|
||||||
MENU_ITEM_SUBMENU_P(_i("Fail stats"), lcd_menu_fails_stats);////MSG_FAIL_STATS c=18
|
MENU_ITEM_SUBMENU_P(_i("Fail stats"), lcd_menu_fails_stats);////MSG_FAIL_STATS c=18
|
||||||
#endif
|
#endif
|
||||||
if (MMU2::mmu2.Enabled()) {
|
if (MMU2::mmu2.Enabled()) {
|
||||||
MENU_ITEM_SUBMENU_P(_i("Fail stats MMU"), lcd_menu_fails_stats_mmu);////MSG_MMU_FAIL_STATS c=18
|
MENU_ITEM_SUBMENU_P(_i("Fail stats MMU"), lcd_menu_fails_stats_mmu);////MSG_MMU_FAIL_STATS c=18
|
||||||
|
|
|
||||||
|
|
@ -136,16 +136,16 @@ extern LcdCommands lcd_commands_type;
|
||||||
|
|
||||||
enum class CustomMsg : uint_least8_t
|
enum class CustomMsg : uint_least8_t
|
||||||
{
|
{
|
||||||
Status, //!< status message from lcd_status_message variable
|
Status, //!< 0 status message from lcd_status_message variable
|
||||||
MeshBedLeveling, //!< Mesh bed leveling in progress
|
MeshBedLeveling, //!< 1 Mesh bed leveling in progress
|
||||||
FilamentLoading, //!< Loading filament in progress
|
FilamentLoading, //!< 2 Loading filament in progress
|
||||||
PidCal, //!< PID tuning in progress
|
PidCal, //!< 3 PID tuning in progress
|
||||||
TempCal, //!< PINDA temperature calibration
|
TempCal, //!< 4 PINDA temperature calibration
|
||||||
TempCompPreheat, //!< Temperature compensation preheat
|
TempCompPreheat, //!< 5 Temperature compensation preheat
|
||||||
M0Wait, //!< M0/M1 Wait command working even from SD
|
M0Wait, //!< 6 M0/M1 Wait command working even from SD
|
||||||
M117, //!< M117 Set the status line message on the LCD
|
M117, //!< 7 M117 Set the status line message on the LCD
|
||||||
Resuming, //!< Resuming message
|
Resuming, //!< 8 Resuming message
|
||||||
MMUProgress, ///< MMU progress message
|
MMUProgress, ///< 9 MMU progress message
|
||||||
};
|
};
|
||||||
|
|
||||||
extern CustomMsg custom_message_type;
|
extern CustomMsg custom_message_type;
|
||||||
|
|
|
||||||
|
|
@ -125,6 +125,7 @@
|
||||||
|
|
||||||
#define DEBUG_DCODE2
|
#define DEBUG_DCODE2
|
||||||
#define DEBUG_DCODE3
|
#define DEBUG_DCODE3
|
||||||
|
//#define DEBUG_PRINTER_STATES
|
||||||
|
|
||||||
//#define DEBUG_EEPROM_CHANGES //Uses +1188 bytes Flash +6 bytes SRAM
|
//#define DEBUG_EEPROM_CHANGES //Uses +1188 bytes Flash +6 bytes SRAM
|
||||||
//#define DEBUG_BUILD
|
//#define DEBUG_BUILD
|
||||||
|
|
|
||||||
|
|
@ -126,6 +126,7 @@
|
||||||
|
|
||||||
#define DEBUG_DCODE2
|
#define DEBUG_DCODE2
|
||||||
#define DEBUG_DCODE3
|
#define DEBUG_DCODE3
|
||||||
|
//#define DEBUG_PRINTER_STATES
|
||||||
|
|
||||||
//#define DEBUG_EEPROM_CHANGES //Uses +1188 bytes Flash +6 bytes SRAM
|
//#define DEBUG_EEPROM_CHANGES //Uses +1188 bytes Flash +6 bytes SRAM
|
||||||
//#define DEBUG_BUILD
|
//#define DEBUG_BUILD
|
||||||
|
|
|
||||||
|
|
@ -125,6 +125,7 @@
|
||||||
|
|
||||||
#define DEBUG_DCODE2
|
#define DEBUG_DCODE2
|
||||||
#define DEBUG_DCODE3
|
#define DEBUG_DCODE3
|
||||||
|
//#define DEBUG_PRINTER_STATES
|
||||||
|
|
||||||
//#define DEBUG_EEPROM_CHANGES //Uses +1188 bytes Flash +6 bytes SRAM
|
//#define DEBUG_EEPROM_CHANGES //Uses +1188 bytes Flash +6 bytes SRAM
|
||||||
//#define DEBUG_BUILD
|
//#define DEBUG_BUILD
|
||||||
|
|
|
||||||
|
|
@ -126,6 +126,7 @@
|
||||||
|
|
||||||
#define DEBUG_DCODE2
|
#define DEBUG_DCODE2
|
||||||
#define DEBUG_DCODE3
|
#define DEBUG_DCODE3
|
||||||
|
//#define DEBUG_PRINTER_STATES
|
||||||
|
|
||||||
//#define DEBUG_EEPROM_CHANGES //Uses +1188 bytes Flash +6 bytes SRAM
|
//#define DEBUG_EEPROM_CHANGES //Uses +1188 bytes Flash +6 bytes SRAM
|
||||||
//#define DEBUG_BUILD
|
//#define DEBUG_BUILD
|
||||||
|
|
|
||||||
|
|
@ -164,6 +164,7 @@
|
||||||
#define DEBUG_DCODE6
|
#define DEBUG_DCODE6
|
||||||
|
|
||||||
//#define DEBUG_PULLUP_CRASH //Test Pullup crash
|
//#define DEBUG_PULLUP_CRASH //Test Pullup crash
|
||||||
|
//#define DEBUG_PRINTER_STATES
|
||||||
|
|
||||||
//#define DEBUG_EEPROM_CHANGES //Uses +1188 bytes Flash +6 bytes SRAM
|
//#define DEBUG_EEPROM_CHANGES //Uses +1188 bytes Flash +6 bytes SRAM
|
||||||
//#define DEBUG_BUILD
|
//#define DEBUG_BUILD
|
||||||
|
|
|
||||||
|
|
@ -164,6 +164,7 @@
|
||||||
#define DEBUG_DCODE6
|
#define DEBUG_DCODE6
|
||||||
|
|
||||||
//#define DEBUG_PULLUP_CRASH //Test Pullup crash
|
//#define DEBUG_PULLUP_CRASH //Test Pullup crash
|
||||||
|
//#define DEBUG_PRINTER_STATES
|
||||||
|
|
||||||
//#define DEBUG_EEPROM_CHANGES //Uses +1188 bytes Flash +6 bytes SRAM
|
//#define DEBUG_EEPROM_CHANGES //Uses +1188 bytes Flash +6 bytes SRAM
|
||||||
//#define DEBUG_BUILD
|
//#define DEBUG_BUILD
|
||||||
|
|
|
||||||
|
|
@ -164,6 +164,7 @@
|
||||||
#define DEBUG_DCODE6
|
#define DEBUG_DCODE6
|
||||||
|
|
||||||
//#define DEBUG_PULLUP_CRASH //Test Pullup crash
|
//#define DEBUG_PULLUP_CRASH //Test Pullup crash
|
||||||
|
//#define DEBUG_PRINTER_STATES
|
||||||
|
|
||||||
//#define DEBUG_EEPROM_CHANGES //Uses +1188 bytes Flash +6 bytes SRAM
|
//#define DEBUG_EEPROM_CHANGES //Uses +1188 bytes Flash +6 bytes SRAM
|
||||||
//#define DEBUG_BUILD
|
//#define DEBUG_BUILD
|
||||||
|
|
|
||||||
|
|
@ -166,6 +166,7 @@
|
||||||
#define DEBUG_DCODE6
|
#define DEBUG_DCODE6
|
||||||
|
|
||||||
//#define DEBUG_PULLUP_CRASH //Test Pullup crash
|
//#define DEBUG_PULLUP_CRASH //Test Pullup crash
|
||||||
|
//#define DEBUG_PRINTER_STATES
|
||||||
|
|
||||||
//#define DEBUG_EEPROM_CHANGES //Uses +1188 bytes Flash +6 bytes SRAM
|
//#define DEBUG_EEPROM_CHANGES //Uses +1188 bytes Flash +6 bytes SRAM
|
||||||
//#define DEBUG_BUILD
|
//#define DEBUG_BUILD
|
||||||
|
|
|
||||||
|
|
@ -166,6 +166,7 @@
|
||||||
#define DEBUG_DCODE6
|
#define DEBUG_DCODE6
|
||||||
|
|
||||||
//#define DEBUG_PULLUP_CRASH //Test Pullup crash
|
//#define DEBUG_PULLUP_CRASH //Test Pullup crash
|
||||||
|
//#define DEBUG_PRINTER_STATES
|
||||||
|
|
||||||
//#define DEBUG_EEPROM_CHANGES //Uses +1188 bytes Flash +6 bytes SRAM
|
//#define DEBUG_EEPROM_CHANGES //Uses +1188 bytes Flash +6 bytes SRAM
|
||||||
//#define DEBUG_BUILD
|
//#define DEBUG_BUILD
|
||||||
|
|
|
||||||
|
|
@ -166,6 +166,7 @@
|
||||||
#define DEBUG_DCODE6
|
#define DEBUG_DCODE6
|
||||||
|
|
||||||
//#define DEBUG_PULLUP_CRASH //Test Pullup crash
|
//#define DEBUG_PULLUP_CRASH //Test Pullup crash
|
||||||
|
//#define DEBUG_PRINTER_STATES
|
||||||
|
|
||||||
//#define DEBUG_EEPROM_CHANGES //Uses +1188 bytes Flash +6 bytes SRAM
|
//#define DEBUG_EEPROM_CHANGES //Uses +1188 bytes Flash +6 bytes SRAM
|
||||||
//#define DEBUG_BUILD
|
//#define DEBUG_BUILD
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue