2018-11-17 02:47:07 +00:00
|
|
|
/**
|
|
|
|
* Marlin 3D Printer Firmware
|
2019-06-28 04:57:50 +00:00
|
|
|
* Copyright (c) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
2018-11-17 02:47:07 +00:00
|
|
|
*
|
|
|
|
* Based on Sprinter and grbl.
|
2019-06-28 04:57:50 +00:00
|
|
|
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
2018-11-17 02:47:07 +00:00
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "../../../inc/MarlinConfig.h"
|
|
|
|
|
|
|
|
#if ENABLED(POWER_LOSS_RECOVERY)
|
|
|
|
|
|
|
|
#include "../../gcode.h"
|
|
|
|
#include "../../../feature/power_loss_recovery.h"
|
|
|
|
#include "../../../module/motion.h"
|
|
|
|
#include "../../../lcd/ultralcd.h"
|
2020-01-04 03:00:44 +00:00
|
|
|
#if ENABLED(EXTENSIBLE_UI)
|
|
|
|
#include "../../../lcd/extensible_ui/ui_api.h"
|
|
|
|
#endif
|
2018-11-17 02:47:07 +00:00
|
|
|
|
2019-04-06 01:02:46 +00:00
|
|
|
#define DEBUG_OUT ENABLED(DEBUG_POWER_LOSS_RECOVERY)
|
|
|
|
#include "../../../core/debug_out.h"
|
2018-11-17 02:47:07 +00:00
|
|
|
|
2019-04-06 01:02:46 +00:00
|
|
|
void menu_job_recovery();
|
2018-11-17 02:47:07 +00:00
|
|
|
|
2019-04-06 01:02:46 +00:00
|
|
|
inline void plr_error(PGM_P const prefix) {
|
|
|
|
#if ENABLED(DEBUG_POWER_LOSS_RECOVERY)
|
|
|
|
DEBUG_ECHO_START();
|
2018-11-17 02:47:07 +00:00
|
|
|
serialprintPGM(prefix);
|
2019-04-06 01:02:46 +00:00
|
|
|
DEBUG_ECHOLNPGM(" Power-Loss Recovery Data");
|
|
|
|
#else
|
|
|
|
UNUSED(prefix);
|
|
|
|
#endif
|
|
|
|
}
|
2018-11-17 02:47:07 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* M1000: Resume from power-loss (undocumented)
|
|
|
|
* - With 'S' go to the Resume/Cancel menu
|
|
|
|
* - With no parameters, run recovery commands
|
|
|
|
*/
|
|
|
|
void GcodeSuite::M1000() {
|
|
|
|
|
|
|
|
if (recovery.valid()) {
|
2019-11-20 23:40:21 +00:00
|
|
|
if (parser.seen('S')) {
|
|
|
|
#if HAS_LCD_MENU
|
|
|
|
ui.goto_screen(menu_job_recovery);
|
2020-01-04 03:00:44 +00:00
|
|
|
#elif ENABLED(EXTENSIBLE_UI)
|
|
|
|
ExtUI::OnPowerLossResume();
|
2019-11-20 23:40:21 +00:00
|
|
|
#else
|
|
|
|
SERIAL_ECHO_MSG("Resume requires LCD.");
|
|
|
|
#endif
|
|
|
|
}
|
2018-11-17 02:47:07 +00:00
|
|
|
else
|
|
|
|
recovery.resume();
|
|
|
|
}
|
2019-04-06 01:02:46 +00:00
|
|
|
else
|
|
|
|
plr_error(recovery.info.valid_head ? PSTR("No") : PSTR("Invalid"));
|
2018-11-17 02:47:07 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // POWER_LOSS_RECOVERY
|