Power-Loss cleanup
This commit is contained in:
parent
f8e83f79c5
commit
7e902b7e29
|
@ -180,10 +180,10 @@ void PrintJobRecovery::save(const bool force/*=false*/, const float zraise/*=0*/
|
||||||
|
|
||||||
// Machine state
|
// Machine state
|
||||||
info.current_position = current_position;
|
info.current_position = current_position;
|
||||||
|
info.feedrate = uint16_t(feedrate_mm_s * 60.0f);
|
||||||
info.zraise = zraise;
|
info.zraise = zraise;
|
||||||
TERN_(HAS_HOME_OFFSET, info.home_offset = home_offset);
|
TERN_(HAS_HOME_OFFSET, info.home_offset = home_offset);
|
||||||
TERN_(HAS_POSITION_SHIFT, info.position_shift = position_shift);
|
TERN_(HAS_POSITION_SHIFT, info.position_shift = position_shift);
|
||||||
info.feedrate = uint16_t(feedrate_mm_s * 60.0f);
|
|
||||||
|
|
||||||
#if HAS_MULTI_EXTRUDER
|
#if HAS_MULTI_EXTRUDER
|
||||||
info.active_extruder = active_extruder;
|
info.active_extruder = active_extruder;
|
||||||
|
@ -209,7 +209,7 @@ void PrintJobRecovery::save(const bool force/*=false*/, const float zraise/*=0*/
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if HAS_LEVELING
|
#if HAS_LEVELING
|
||||||
info.leveling = planner.leveling_active;
|
info.flag.leveling = planner.leveling_active;
|
||||||
info.fade = TERN0(ENABLE_LEVELING_FADE_HEIGHT, planner.z_fade_height);
|
info.fade = TERN0(ENABLE_LEVELING_FADE_HEIGHT, planner.z_fade_height);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -220,12 +220,12 @@ void PrintJobRecovery::save(const bool force/*=false*/, const float zraise/*=0*/
|
||||||
info.retract_hop = fwretract.current_hop;
|
info.retract_hop = fwretract.current_hop;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Relative axis modes
|
|
||||||
info.axis_relative = gcode.axis_relative;
|
|
||||||
|
|
||||||
// Elapsed print job time
|
// Elapsed print job time
|
||||||
info.print_job_elapsed = print_job_timer.duration();
|
info.print_job_elapsed = print_job_timer.duration();
|
||||||
|
|
||||||
|
// Relative axis modes
|
||||||
|
info.axis_relative = gcode.axis_relative;
|
||||||
|
|
||||||
// Misc. Marlin flags
|
// Misc. Marlin flags
|
||||||
info.flag.dryrun = !!(marlin_debug_flags & MARLIN_DEBUG_DRYRUN);
|
info.flag.dryrun = !!(marlin_debug_flags & MARLIN_DEBUG_DRYRUN);
|
||||||
info.flag.allow_cold_extrusion = TERN0(PREVENT_COLD_EXTRUSION, thermalManager.allow_cold_extrude);
|
info.flag.allow_cold_extrusion = TERN0(PREVENT_COLD_EXTRUSION, thermalManager.allow_cold_extrude);
|
||||||
|
@ -457,8 +457,8 @@ void PrintJobRecovery::resume() {
|
||||||
#if HAS_LEVELING
|
#if HAS_LEVELING
|
||||||
// Restore leveling state before 'G92 Z' to ensure
|
// Restore leveling state before 'G92 Z' to ensure
|
||||||
// the Z stepper count corresponds to the native Z.
|
// the Z stepper count corresponds to the native Z.
|
||||||
if (info.fade || info.leveling) {
|
if (info.fade || info.flag.leveling) {
|
||||||
sprintf_P(cmd, PSTR("M420 S%i Z%s"), int(info.leveling), dtostrf(info.fade, 1, 1, str_1));
|
sprintf_P(cmd, PSTR("M420 S%i Z%s"), int(info.flag.leveling), dtostrf(info.fade, 1, 1, str_1));
|
||||||
gcode.process_subcommands_now(cmd);
|
gcode.process_subcommands_now(cmd);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -507,15 +507,15 @@ void PrintJobRecovery::resume() {
|
||||||
sprintf_P(cmd, PSTR("G92.9 E%s"), dtostrf(info.current_position.e, 1, 3, str_1));
|
sprintf_P(cmd, PSTR("G92.9 E%s"), dtostrf(info.current_position.e, 1, 3, str_1));
|
||||||
gcode.process_subcommands_now(cmd);
|
gcode.process_subcommands_now(cmd);
|
||||||
|
|
||||||
// Relative axis modes
|
|
||||||
gcode.axis_relative = info.axis_relative;
|
|
||||||
|
|
||||||
TERN_(HAS_HOME_OFFSET, home_offset = info.home_offset);
|
TERN_(HAS_HOME_OFFSET, home_offset = info.home_offset);
|
||||||
TERN_(HAS_POSITION_SHIFT, position_shift = info.position_shift);
|
TERN_(HAS_POSITION_SHIFT, position_shift = info.position_shift);
|
||||||
#if HAS_HOME_OFFSET || HAS_POSITION_SHIFT
|
#if HAS_HOME_OFFSET || HAS_POSITION_SHIFT
|
||||||
LOOP_XYZ(i) update_workspace_offset((AxisEnum)i);
|
LOOP_XYZ(i) update_workspace_offset((AxisEnum)i);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Relative axis modes
|
||||||
|
gcode.axis_relative = info.axis_relative;
|
||||||
|
|
||||||
#if ENABLED(DEBUG_POWER_LOSS_RECOVERY)
|
#if ENABLED(DEBUG_POWER_LOSS_RECOVERY)
|
||||||
const uint8_t old_flags = marlin_debug_flags;
|
const uint8_t old_flags = marlin_debug_flags;
|
||||||
marlin_debug_flags |= MARLIN_DEBUG_ECHO;
|
marlin_debug_flags |= MARLIN_DEBUG_ECHO;
|
||||||
|
@ -598,7 +598,7 @@ void PrintJobRecovery::resume() {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if HAS_LEVELING
|
#if HAS_LEVELING
|
||||||
DEBUG_ECHOLNPAIR("leveling: ", int(info.leveling), " fade: ", info.fade);
|
DEBUG_ECHOLNPAIR("leveling: ", int(info.flag.leveling), " fade: ", info.fade);
|
||||||
#endif
|
#endif
|
||||||
#if ENABLED(FWRETRACT)
|
#if ENABLED(FWRETRACT)
|
||||||
DEBUG_ECHOPGM("retract: ");
|
DEBUG_ECHOPGM("retract: ");
|
||||||
|
|
|
@ -47,42 +47,24 @@ typedef struct {
|
||||||
|
|
||||||
// Machine state
|
// Machine state
|
||||||
xyze_pos_t current_position;
|
xyze_pos_t current_position;
|
||||||
|
uint16_t feedrate;
|
||||||
float zraise;
|
float zraise;
|
||||||
|
|
||||||
#if HAS_HOME_OFFSET
|
|
||||||
xyz_pos_t home_offset;
|
|
||||||
#endif
|
|
||||||
#if HAS_POSITION_SHIFT
|
|
||||||
xyz_pos_t position_shift;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
uint16_t feedrate;
|
TERN_(HAS_HOME_OFFSET, xyz_pos_t home_offset);
|
||||||
|
TERN_(HAS_POSITION_SHIFT, xyz_pos_t position_shift);
|
||||||
#if HAS_MULTI_EXTRUDER
|
TERN_(HAS_MULTI_EXTRUDER, uint8_t active_extruder);
|
||||||
uint8_t active_extruder;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if DISABLED(NO_VOLUMETRICS)
|
#if DISABLED(NO_VOLUMETRICS)
|
||||||
bool volumetric_enabled;
|
bool volumetric_enabled;
|
||||||
float filament_size[EXTRUDERS];
|
float filament_size[EXTRUDERS];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if HAS_HOTEND
|
TERN_(HAS_HOTEND, int16_t target_temperature[HOTENDS]);
|
||||||
int16_t target_temperature[HOTENDS];
|
TERN_(HAS_HEATED_BED, int16_t target_temperature_bed);
|
||||||
#endif
|
TERN_(HAS_FAN, uint8_t fan_speed[FAN_COUNT]);
|
||||||
|
|
||||||
#if HAS_HEATED_BED
|
TERN_(HAS_LEVELING, float fade);
|
||||||
int16_t target_temperature_bed;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if HAS_FAN
|
|
||||||
uint8_t fan_speed[FAN_COUNT];
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if HAS_LEVELING
|
|
||||||
bool leveling;
|
|
||||||
float fade;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if ENABLED(FWRETRACT)
|
#if ENABLED(FWRETRACT)
|
||||||
float retract[EXTRUDERS], retract_hop;
|
float retract[EXTRUDERS], retract_hop;
|
||||||
|
@ -92,13 +74,8 @@ typedef struct {
|
||||||
#if ENABLED(MIXING_EXTRUDER)
|
#if ENABLED(MIXING_EXTRUDER)
|
||||||
//uint_fast8_t selected_vtool;
|
//uint_fast8_t selected_vtool;
|
||||||
//mixer_comp_t color[NR_MIXING_VIRTUAL_TOOLS][MIXING_STEPPERS];
|
//mixer_comp_t color[NR_MIXING_VIRTUAL_TOOLS][MIXING_STEPPERS];
|
||||||
#if ENABLED(GRADIENT_MIX)
|
TERN_(GRADIENT_MIX, gradient_t gradient);
|
||||||
gradient_t gradient;
|
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
|
|
||||||
// Relative axis modes
|
|
||||||
uint8_t axis_relative;
|
|
||||||
|
|
||||||
// SD Filename and position
|
// SD Filename and position
|
||||||
char sd_filename[MAXPATHNAMELENGTH];
|
char sd_filename[MAXPATHNAMELENGTH];
|
||||||
|
@ -107,10 +84,14 @@ typedef struct {
|
||||||
// Job elapsed time
|
// Job elapsed time
|
||||||
millis_t print_job_elapsed;
|
millis_t print_job_elapsed;
|
||||||
|
|
||||||
|
// Relative axis modes
|
||||||
|
uint8_t axis_relative;
|
||||||
|
|
||||||
// Misc. Marlin flags
|
// Misc. Marlin flags
|
||||||
struct {
|
struct {
|
||||||
bool dryrun:1; // M111 S8
|
bool dryrun:1; // M111 S8
|
||||||
bool allow_cold_extrusion:1; // M302 P1
|
bool allow_cold_extrusion:1; // M302 P1
|
||||||
|
TERN_(HAS_LEVELING, bool leveling:1);
|
||||||
} flag;
|
} flag;
|
||||||
|
|
||||||
uint8_t valid_foot;
|
uint8_t valid_foot;
|
||||||
|
|
Loading…
Reference in a new issue