mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-06-11 14:33:04 +00:00
Emit Disable Power Loss Recovery (#11616)
* Emit Disable Power Loss Recovery Now only works if it's enabled but the goal it's to force disable it. With this change it will always emit the command for BBL or Marlin 2. Co-Authored-By: Michael Rook <54159303+michaelr0@users.noreply.github.com> * Refactor power loss recovery G-code comments * Return empty power loss recovery when no compatible printer * Update power loss recovery comments Update label and tooltip for power loss recovery * Add enum for power loss recovery mode Refactored power loss recovery configuration to use a new PowerLossRecoveryMode enum instead of a boolean. Updated GCodeWriter and related logic to handle the new enum, allowing for 'printer_configuration', 'enable', and 'disable' options. Updated config handling, legacy value conversion, and default values accordingly. * Update PrintConfig.cpp --------- Co-authored-by: Michael Rook <54159303+michaelr0@users.noreply.github.com> Co-authored-by: SoftFever <softfeverever@gmail.com>
This commit is contained in:
@@ -444,23 +444,28 @@ std::string GCodeWriter::reset_e(bool force)
|
||||
}
|
||||
}
|
||||
|
||||
std::string GCodeWriter::enable_power_loss_recovery(bool enable)
|
||||
std::string GCodeWriter::enable_power_loss_recovery(PowerLossRecoveryMode mode)
|
||||
{
|
||||
std::ostringstream gcode;
|
||||
|
||||
|
||||
if (mode == PowerLossRecoveryMode::PrinterConfiguration)
|
||||
return std::string();
|
||||
|
||||
const bool enable = mode == PowerLossRecoveryMode::Enable;
|
||||
|
||||
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";
|
||||
gcode << "M1003 S" << (enable ? "1" : "0");
|
||||
}
|
||||
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";
|
||||
gcode << "M413 S" << (enable ? "1" : "0");
|
||||
} else {
|
||||
return std::string();
|
||||
}
|
||||
|
||||
if (GCodeWriter::full_gcode_comment) gcode << " ; set Power-loss Recovery";
|
||||
gcode << "\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))
|
||||
|
||||
Reference in New Issue
Block a user