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

@@ -3084,11 +3084,10 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato
m_sorted_layer_filaments.emplace_back(lt.extruders);
}
//BBS: close powerlost recovery
// Orca: finish tracking power lost recovery
{
if (is_bbl_printers && m_second_layer_things_done) {
file.write("; close powerlost recovery\n");
file.write("M1003 S0\n");
if (m_second_layer_things_done && print.config().enable_power_loss_recovery.value == true) {
file.write(m_writer.enable_power_loss_recovery(false));
}
}
++ finished_objects;
@@ -3166,12 +3165,9 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato
m_sorted_layer_filaments.emplace_back(lt.extruders);
}
//BBS: close powerlost recovery
{
if (is_bbl_printers && m_second_layer_things_done) {
file.write("; close powerlost recovery\n");
file.write("M1003 S0\n");
}
// Orca: finish tracking power lost recovery
if (m_second_layer_things_done && print.config().enable_power_loss_recovery.value == true) {
file.write(m_writer.enable_power_loss_recovery(false));
}
if (m_wipe_tower)
// Purge the extruder, pull out the active filament.
@@ -4386,21 +4382,21 @@ LayerResult GCode::process_layer(
}
if (!first_layer && !m_second_layer_things_done) {
if (print.is_BBL_printer()) {
// BBS: open powerlost recovery
{
gcode += "; open powerlost recovery\n";
gcode += "M1003 S1\n";
// Orca: start tracking power lost recovery
if (print.config().enable_power_loss_recovery.value == true) {
gcode += m_writer.enable_power_loss_recovery(true);
}
// BBS: open first layer inspection at second layer
if (print.config().scan_first_layer.value) {
// BBS: retract first to avoid droping when scan model
gcode += this->retract();
gcode += "M976 S1 P1 ; scan model before printing 2nd layer\n";
gcode += "M400 P100\n";
gcode += this->unretract();
if (print.is_BBL_printer()) {
// BBS: open first layer inspection at second layer
if (print.config().scan_first_layer.value) {
// BBS: retract first to avoid droping when scan model
gcode += this->retract();
gcode += "M976 S1 P1 ; scan model before printing 2nd layer\n";
gcode += "M400 P100\n";
gcode += this->unretract();
}
}
}
// Reset acceleration at sencond layer
// Orca: only set once, don't need to call set_accel_and_jerk
if (m_config.default_acceleration.value > 0 && m_config.initial_layer_acceleration.value > 0) {