Add ability to disable Power Loss Recovery on BBL machines (#11582)

* Add ability to disable Power Loss Recovery

* Fix typo in PrintConfig.hpp for power loss recovery

* Attempt to resolve Unknown option exception: disable_power_less_recovery

Add disable_power_loss_recovery property to any json which had scan_first_layer

* Revert "Attempt to resolve Unknown option exception: disable_power_less_recovery"

This reverts commit ddaf34b317f8797540235b8f7d179b1c9b6d10f8.

* Fix typo

* Change attribution from BBS to Orca in PrintConfig.cpp

* Mini refactor power loss recovery handling in GCode export

- Moved power loss recovery G-code generation to a new method in GCodeWriter.
- Support Marlin 2

* Update comments and power loss recovery handling

* Implement power loss recovery G-code commands

Added functions to start and end power loss recovery with appropriate G-code commands and comments.

* Add power loss recovery methods to GCodeWriter

* refactor and fix build errors

---------

Co-authored-by: Michael Rook <michael@rook.id.au>
Co-authored-by: Ioannis Giannakas <59056762+igiannakas@users.noreply.github.com>
Co-authored-by: SoftFever <softfeverever@gmail.com>
This commit is contained in:
Michael Rook
2025-12-11 02:19:57 +11:00
committed by GitHub
parent 8fbb47a3b9
commit 14b755ce5e
9 changed files with 54 additions and 25 deletions

View File

@@ -1,5 +1,6 @@
#include "GCodeWriter.hpp"
#include "CustomGCode.hpp"
#include "PrintConfig.hpp"
#include <algorithm>
#include <iomanip>
#include <iostream>
@@ -442,6 +443,23 @@ std::string GCodeWriter::reset_e(bool force)
}
}
std::string GCodeWriter::enable_power_loss_recovery(bool enable)
{
std::ostringstream gcode;
if (m_is_bbl_printers) {
gcode << "; start tracking Power Loss Recovery https://wiki.bambulab.com/en/knowledge-sharing/power-loss-recovery\n";
gcode << "M1003 S" << (enable ? "1" : "0") << "\n";
}
else if (FLAVOR_IS(gcfMarlinFirmware)) {
gcode << "; start tracking Power-loss Recovery https://marlinfw.org/docs/gcode/M413.html\n";
gcode << "M413 S" << (enable ? "1" : "0") << "\n";
}
return gcode.str();
}
std::string GCodeWriter::update_progress(unsigned int num, unsigned int tot, bool allow_100) const
{
if (FLAVOR_IS_NOT(gcfMakerWare) && FLAVOR_IS_NOT(gcfSailfish))