Browse Source

Power Loss Recovery for volumetric extrusion (#15734)

pull/1/head
The-Force 5 years ago
committed by Scott Lahteine
parent
commit
c6f694a247
  1. 30
      Marlin/src/feature/power_loss_recovery.cpp
  2. 9
      Marlin/src/feature/power_loss_recovery.h

30
Marlin/src/feature/power_loss_recovery.cpp

@ -183,6 +183,15 @@ void PrintJobRecovery::save(const bool force/*=false*/, const bool save_queue/*=
info.active_extruder = active_extruder; info.active_extruder = active_extruder;
#endif #endif
#if DISABLED(NO_VOLUMETRICS)
info.volumetric_enabled = parser.volumetric_enabled;
#if EXTRUDERS > 1
for (int8_t e = 0; e < EXTRUDERS; e++) info.filament_size[e] = planner.filament_size[e];
#else
if (parser.volumetric_enabled) info.filament_size = planner.filament_size[active_extruder];
#endif
#endif
#if EXTRUDERS #if EXTRUDERS
HOTEND_LOOP() info.target_temperature[e] = thermalManager.temp_hotend[e].target; HOTEND_LOOP() info.target_temperature[e] = thermalManager.temp_hotend[e].target;
#endif #endif
@ -291,6 +300,27 @@ void PrintJobRecovery::resume() {
gcode.process_subcommands_now(cmd); gcode.process_subcommands_now(cmd);
#endif #endif
// Recover volumetric extrusion state
#if DISABLED(NO_VOLUMETRICS)
#if EXTRUDERS > 1
for (int8_t e = 0; e < EXTRUDERS; e++) {
dtostrf(info.filament_size[e], 1, 3, str_1);
sprintf_P(cmd, PSTR("M200 T%i D%s"), e, str_1);
gcode.process_subcommands_now(cmd);
}
if (!info.volumetric_enabled) {
sprintf_P(cmd, PSTR("M200 T%i D0"), info.active_extruder);
gcode.process_subcommands_now(cmd);
}
#else
if (info.volumetric_enabled) {
dtostrf(info.filament_size, 1, 3, str_1);
sprintf_P(cmd, PSTR("M200 D%s"), str_1);
gcode.process_subcommands_now(cmd);
}
#endif
#endif
#if HAS_HEATED_BED #if HAS_HEATED_BED
const int16_t bt = info.target_temperature_bed; const int16_t bt = info.target_temperature_bed;
if (bt) { if (bt) {

9
Marlin/src/feature/power_loss_recovery.h

@ -59,6 +59,15 @@ typedef struct {
uint8_t active_extruder; uint8_t active_extruder;
#endif #endif
#if DISABLED(NO_VOLUMETRICS)
bool volumetric_enabled;
#if EXTRUDERS > 1
float filament_size[EXTRUDERS];
#else
float filament_size;
#endif
#endif
#if HOTENDS #if HOTENDS
int16_t target_temperature[HOTENDS]; int16_t target_temperature[HOTENDS];
#endif #endif

Loading…
Cancel
Save