Optimize Power-Loss Recovery (#12440)

This commit is contained in:
Scott Lahteine
2018-11-16 20:47:07 -06:00
committed by GitHub
parent ca21ac6b9b
commit d97e31db4c
23 changed files with 586 additions and 363 deletions

View File

@ -253,7 +253,7 @@
#define MSG_PAUSE_PRINT _UxGT("Pozastavit tisk")
#define MSG_RESUME_PRINT _UxGT("Obnovit tisk")
#define MSG_STOP_PRINT _UxGT("Zastavit tisk")
#define MSG_POWER_LOSS_RECOVERY _UxGT("Obnova vypadku")
#define MSG_OUTAGE_RECOVERY _UxGT("Obnova vypadku")
#define MSG_CARD_MENU _UxGT("Tisknout z SD")
#define MSG_NO_CARD _UxGT("Žádná SD karta")
#define MSG_DWELL _UxGT("Uspáno...")

View File

@ -268,7 +268,7 @@
#define MSG_PAUSE_PRINT _UxGT("SD-Druck pausieren")
#define MSG_RESUME_PRINT _UxGT("SD-Druck fortsetzen")
#define MSG_STOP_PRINT _UxGT("SD-Druck abbrechen")
#define MSG_POWER_LOSS_RECOVERY _UxGT("Wiederh. n. Stroma.")
#define MSG_OUTAGE_RECOVERY _UxGT("Wiederh. n. Stroma.")
#define MSG_CARD_MENU _UxGT("Druck v. SD-Karte")
#define MSG_NO_CARD _UxGT("Keine SD-Karte")
#define MSG_DWELL _UxGT("Warten...")

View File

@ -728,8 +728,8 @@
#ifndef MSG_STOP_PRINT
#define MSG_STOP_PRINT _UxGT("Stop print")
#endif
#ifndef MSG_POWER_LOSS_RECOVERY
#define MSG_POWER_LOSS_RECOVERY _UxGT("Power-Loss Recovery")
#ifndef MSG_OUTAGE_RECOVERY
#define MSG_OUTAGE_RECOVERY _UxGT("Outage Recovery")
#endif
#ifndef MSG_CARD_MENU
#define MSG_CARD_MENU _UxGT("Print from SD")

View File

@ -266,7 +266,7 @@
#define MSG_PAUSE_PRINT _UxGT("Pausa stampa")
#define MSG_RESUME_PRINT _UxGT("Riprendi stampa")
#define MSG_STOP_PRINT _UxGT("Arresta stampa")
#define MSG_POWER_LOSS_RECOVERY _UxGT("Ripresa da PowerLoss")
#define MSG_OUTAGE_RECOVERY _UxGT("Ripresa da PowerLoss")
#define MSG_CARD_MENU _UxGT("Stampa da SD")
#define MSG_NO_CARD _UxGT("SD non presente")
#define MSG_DWELL _UxGT("Sospensione...")

View File

@ -259,7 +259,7 @@
#define MSG_PAUSE_PRINT _UxGT("일시정지")
#define MSG_RESUME_PRINT _UxGT("재시작")
#define MSG_STOP_PRINT _UxGT("출력중지")
#define MSG_POWER_LOSS_RECOVERY _UxGT("Power-Loss Recovery")
#define MSG_OUTAGE_RECOVERY _UxGT("Outage Recovery")
#define MSG_CARD_MENU _UxGT("SD 카드출력")
#define MSG_NO_CARD _UxGT("SD 카드없음")
#define MSG_DWELL _UxGT("슬립모드...")

View File

@ -273,7 +273,7 @@
#define MSG_PAUSE_PRINT _UxGT("Pausar impressão")
#define MSG_RESUME_PRINT _UxGT("Resumir impressão")
#define MSG_STOP_PRINT _UxGT("Parar impressão")
#define MSG_POWER_LOSS_RECOVERY _UxGT("Recuperar Impressão")
#define MSG_OUTAGE_RECOVERY _UxGT("Recuperar Impressão")
#define MSG_CARD_MENU _UxGT("Imprimir do SD")
#define MSG_NO_CARD _UxGT("Sem cartão SD")
#define MSG_DWELL _UxGT("Dormindo...")

View File

@ -278,7 +278,7 @@
#define MSG_PAUSE_PRINT _UxGT("Pozastaviť tlač")
#define MSG_RESUME_PRINT _UxGT("Obnoviť tlač")
#define MSG_STOP_PRINT _UxGT("Zastaviť tlač")
#define MSG_POWER_LOSS_RECOVERY _UxGT("Obnova po výp. nap.")
#define MSG_OUTAGE_RECOVERY _UxGT("Obnova po výp. nap.")
#define MSG_CARD_MENU _UxGT("Tlačiť z SD")
#define MSG_NO_CARD _UxGT("Žiadna SD karta")
#define MSG_DWELL _UxGT("Spím...")

View File

@ -36,6 +36,10 @@
#include "../../feature/runout.h"
#endif
#if ENABLED(POWER_LOSS_RECOVERY)
#include "../../feature/power_loss_recovery.h"
#endif
#define HAS_DEBUG_MENU ENABLED(LCD_PROGRESS_BAR_TEST)
void menu_advanced_settings();
@ -350,6 +354,10 @@ void menu_configuration() {
MENU_ITEM_EDIT_CALLBACK(bool, MSG_RUNOUT_SENSOR_ENABLE, &runout.enabled, runout.reset);
#endif
#if ENABLED(POWER_LOSS_RECOVERY)
MENU_ITEM_EDIT_CALLBACK(bool, MSG_OUTAGE_RECOVERY, &recovery.enabled, recovery.changed);
#endif
#if DISABLED(SLIM_LCD_MENUS)
// Preheat configurations
MENU_ITEM(submenu, MSG_PREHEAT_1_SETTINGS, menu_preheat_material1_settings);

View File

@ -34,58 +34,8 @@
#include "../../feature/power_loss_recovery.h"
static void lcd_power_loss_recovery_resume() {
char cmd[20];
// Return to status now
ui.return_to_status();
// Turn leveling off and home
enqueue_and_echo_commands_P(PSTR("M420 S0\nG28 R0"
#if ENABLED(MARLIN_DEV_MODE)
" S"
#elif !IS_KINEMATIC
" X Y"
#endif
));
#if HAS_HEATED_BED
const int16_t bt = job_recovery_info.target_temperature_bed;
if (bt) {
// Restore the bed temperature
sprintf_P(cmd, PSTR("M190 S%i"), bt);
enqueue_and_echo_command(cmd);
}
#endif
// Restore all hotend temperatures
HOTEND_LOOP() {
const int16_t et = job_recovery_info.target_temperature[e];
if (et) {
#if HOTENDS > 1
sprintf_P(cmd, PSTR("T%i"), e);
enqueue_and_echo_command(cmd);
#endif
sprintf_P(cmd, PSTR("M109 S%i"), et);
enqueue_and_echo_command(cmd);
}
}
#if HOTENDS > 1
sprintf_P(cmd, PSTR("T%i"), job_recovery_info.active_hotend);
enqueue_and_echo_command(cmd);
#endif
// Restore print cooling fan speeds
for (uint8_t i = 0; i < FAN_COUNT; i++) {
uint8_t f = job_recovery_info.fan_speed[i];
if (f) {
sprintf_P(cmd, PSTR("M106 P%i S%i"), i, f);
enqueue_and_echo_command(cmd);
}
}
// Start draining the job recovery command queue
job_recovery_phase = JOB_RECOVERY_YES;
enqueue_and_echo_commands_P(PSTR("M1000"));
}
static void lcd_power_loss_recovery_cancel() {
@ -97,7 +47,7 @@ static void lcd_power_loss_recovery_cancel() {
void menu_job_recovery() {
ui.defer_status_screen(true);
START_MENU();
STATIC_ITEM(MSG_POWER_LOSS_RECOVERY);
STATIC_ITEM(MSG_OUTAGE_RECOVERY);
MENU_ITEM(function, MSG_RESUME_PRINT, lcd_power_loss_recovery_resume);
MENU_ITEM(function, MSG_STOP_PRINT, lcd_power_loss_recovery_cancel);
END_MENU();

View File

@ -65,7 +65,7 @@
#if ENABLED(MENU_ADDAUTOSTART)
void lcd_autostart_sd() { card.beginautostart(); }
inline void lcd_autostart_sd() { card.beginautostart(); }
#endif

View File

@ -659,13 +659,6 @@ void MarlinUI::update() {
#endif // SDSUPPORT && SD_DETECT_PIN
#if ENABLED(POWER_LOSS_RECOVERY)
if (job_recovery_commands_count && job_recovery_phase == JOB_RECOVERY_IDLE) {
goto_screen(menu_job_recovery);
job_recovery_phase = JOB_RECOVERY_MAYBE; // Waiting for a response
}
#endif
const millis_t ms = millis();
if (ELAPSED(ms, next_lcd_update_ms)
#if HAS_GRAPHICAL_LCD