Fix and improve PowerPanic
- No wait for heatup during host print recovery - No extra Z lift when power panic happens during paused print - added an extra EEPROM value - fixed `EEPROM_LAST_ITEM` - changed EEPROM version to 3.14.0 - Added `reset_uvlo` function
This commit is contained in:
parent
52275322a2
commit
1ac69247d7
|
|
@ -1516,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();
|
||||||
|
|
@ -4181,7 +4182,7 @@ void process_commands()
|
||||||
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);
|
reset_uvlo();
|
||||||
} 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
|
||||||
|
|
@ -11069,7 +11070,7 @@ 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((uint8_t*)EEPROM_UVLO, PowerPanic::NO_PENDING_RECOVERY);
|
reset_uvlo();
|
||||||
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;
|
||||||
|
|
@ -11079,7 +11080,7 @@ void restore_print_from_ram_and_continue(float e_move)
|
||||||
// Cancel the state related to a currently saved print
|
// Cancel the state related to a currently saved print
|
||||||
void cancel_saved_printing()
|
void cancel_saved_printing()
|
||||||
{
|
{
|
||||||
eeprom_update_byte_notify((uint8_t*)EEPROM_UVLO, PowerPanic::NO_PENDING_RECOVERY);
|
reset_uvlo();
|
||||||
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 !!!!!
|
||||||
// !!!!!
|
// !!!!!
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
@ -316,16 +319,16 @@ void recover_print(uint8_t automatic) {
|
||||||
bool mbl_was_active = recover_machine_state_after_power_panic();
|
bool mbl_was_active = recover_machine_state_after_power_panic();
|
||||||
|
|
||||||
// Undo PP Z Lift by setting current Z pos to + Z_PAUSE_LIFT
|
// Undo PP Z Lift by setting current Z pos to + Z_PAUSE_LIFT
|
||||||
|
// With first PP or Pause + PP the Z has been already lift.
|
||||||
// After a reboot the printer doesn't know the Z height and we have to set its previous value
|
// 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) == PowerPanic::PENDING_RECOVERY_RETRY) {
|
if(eeprom_read_byte((uint8_t*)EEPROM_UVLO_Z_LIFTED) == 1 ) {
|
||||||
current_position[Z_AXIS] += Z_PAUSE_LIFT;
|
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,
|
// 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) == PowerPanic::PENDING_RECOVERY)
|
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);
|
enquecommandf_P(PSTR("G1 Z%.3f F800"), current_position[Z_AXIS] + Z_PAUSE_LIFT);
|
||||||
eeprom_update_byte_notify((uint8_t*)EEPROM_UVLO, PowerPanic::PENDING_RECOVERY_RETRY);
|
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
|
||||||
|
|
@ -334,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)
|
||||||
|
|
@ -488,4 +494,9 @@ 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"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void reset_uvlo() {
|
||||||
|
eeprom_update_byte_notify((uint8_t*)EEPROM_UVLO, PowerPanic::NO_PENDING_RECOVERY);
|
||||||
|
eeprom_update_byte_notify((uint8_t*)EEPROM_UVLO_Z_LIFTED, 0);
|
||||||
|
}
|
||||||
#endif //UVLO_SUPPORT
|
#endif //UVLO_SUPPORT
|
||||||
|
|
|
||||||
|
|
@ -18,3 +18,4 @@ enum PrintType : uint8_t {
|
||||||
void uvlo_();
|
void uvlo_();
|
||||||
void recover_print(uint8_t automatic);
|
void recover_print(uint8_t automatic);
|
||||||
void setup_uvlo_interrupt();
|
void setup_uvlo_interrupt();
|
||||||
|
void reset_uvlo();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue