Skip to content

Commit

Permalink
🔧 Wrap POWER_LOSS_RETRACT_LEN (#26695)
Browse files Browse the repository at this point in the history
  • Loading branch information
vovodroid authored Jan 24, 2024
1 parent 7fbd9ec commit ed1391e
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 13 deletions.
22 changes: 14 additions & 8 deletions Marlin/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@
#define PID_FAN_SCALING_LIN_FACTOR (PID_FAN_SCALING_AT_FULL_SPEED-DEFAULT_Kf)/255.0

#else
#define PID_FAN_SCALING_LIN_FACTOR (0) // Power loss due to cooling = Kf * (fan_speed)
#define PID_FAN_SCALING_LIN_FACTOR (0) // Power-loss due to cooling = Kf * (fan_speed)
#define DEFAULT_Kf 10 // A constant value added to the PID-tuner
#define PID_FAN_SCALING_MIN_SPEED 10 // Minimum fan speed at which to enable PID_FAN_SCALING
#endif
Expand Down Expand Up @@ -1540,6 +1540,7 @@
* Axis moves <= 1/2 the axis length and Extruder moves <= EXTRUDE_MAXLENGTH
* will be shown in the move submenus.
*/

#define MANUAL_MOVE_DISTANCE_MM 10, 1.0, 0.1 // (mm)
//#define MANUAL_MOVE_DISTANCE_MM 100, 50, 10, 1.0, 0.1 // (mm)
//#define MANUAL_MOVE_DISTANCE_MM 500, 100, 50, 10, 1.0, 0.1 // (mm)
Expand Down Expand Up @@ -1744,21 +1745,26 @@
*/
//#define POWER_LOSS_RECOVERY
#if ENABLED(POWER_LOSS_RECOVERY)
#define PLR_ENABLED_DEFAULT false // Power Loss Recovery enabled by default. (Set with 'M413 Sn' & M500)
#define PLR_ENABLED_DEFAULT false // Power-Loss Recovery enabled by default. (Set with 'M413 Sn' & M500)
//#define PLR_BED_THRESHOLD BED_MAXTEMP // (°C) Skip user confirmation at or above this bed temperature (0 to disable)
//#define BACKUP_POWER_SUPPLY // Backup power / UPS to move the steppers on power loss
//#define POWER_LOSS_ZRAISE 2 // (mm) Z axis raise on resume (on power loss with UPS)
//#define POWER_LOSS_PIN 44 // Pin to detect power loss. Set to -1 to disable default pin on boards without module.
//#define POWER_LOSS_STATE HIGH // State of pin indicating power loss

//#define POWER_LOSS_PIN 44 // Pin to detect power-loss. Set to -1 to disable default pin on boards without module, or comment to use board default.
//#define POWER_LOSS_STATE HIGH // State of pin indicating power-loss
//#define POWER_LOSS_PULLUP // Set pullup / pulldown as appropriate for your sensor
//#define POWER_LOSS_PULLDOWN
//#define POWER_LOSS_PURGE_LEN 20 // (mm) Length of filament to purge on resume
//#define POWER_LOSS_RETRACT_LEN 10 // (mm) Length of filament to retract on fail. Requires backup power.

//#define POWER_LOSS_ZRAISE 2 // (mm) Z axis raise on resume (on power-loss with UPS)
//#define POWER_LOSS_PURGE_LEN 20 // (mm) Length of filament to purge on resume

// Without a POWER_LOSS_PIN the following option helps reduce wear on the SD card,
// especially with "vase mode" printing. Set too high and vases cannot be continued.
#define POWER_LOSS_MIN_Z_CHANGE 0.05 // (mm) Minimum Z change before saving power-loss data

//#define BACKUP_POWER_SUPPLY // Backup power / UPS to move the steppers on power-loss
#if ENABLED(BACKUP_POWER_SUPPLY)
//#define POWER_LOSS_RETRACT_LEN 10 // (mm) Length of filament to retract on fail

This comment has been minimized.

Copy link
@vovodroid

vovodroid Jan 25, 2024

Author Contributor

@thinkyhead Why not also wrap POWER_LOSS_ZRAISE inside BACKUP_POWER_SUPPLY?

#endif

// Enable if Z homing is needed for proper recovery. 99.9% of the time this should be disabled!
//#define POWER_LOSS_RECOVER_ZHOME
#if ENABLED(POWER_LOSS_RECOVER_ZHOME)
Expand Down
7 changes: 3 additions & 4 deletions Marlin/src/feature/powerloss.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,16 +75,15 @@ uint32_t PrintJobRecovery::cmd_sdpos, // = 0

PrintJobRecovery recovery;

#ifndef POWER_LOSS_PURGE_LEN
#define POWER_LOSS_PURGE_LEN 0
#endif

#if DISABLED(BACKUP_POWER_SUPPLY)
#undef POWER_LOSS_RETRACT_LEN // No retract at outage without backup power
#endif
#ifndef POWER_LOSS_RETRACT_LEN
#define POWER_LOSS_RETRACT_LEN 0
#endif
#ifndef POWER_LOSS_PURGE_LEN
#define POWER_LOSS_PURGE_LEN 0
#endif

// Allow power-loss recovery to be aborted
#define PLR_CAN_ABORT
Expand Down
5 changes: 4 additions & 1 deletion Marlin/src/feature/powerloss.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,11 @@
#define POWER_LOSS_STATE HIGH
#endif

#if DISABLED(BACKUP_POWER_SUPPLY)
#undef POWER_LOSS_ZRAISE // No Z raise at outage without backup power
#endif
#ifndef POWER_LOSS_ZRAISE
#define POWER_LOSS_ZRAISE 2
#define POWER_LOSS_ZRAISE 2 // Default Z-raise on outage or resume
#endif

//#define DEBUG_POWER_LOSS_RECOVERY
Expand Down

0 comments on commit ed1391e

Please sign in to comment.