Power Loss Recovery for volumetric extrusion (#15734)
This commit is contained in:
parent
4e6e02bc3e
commit
c6f694a247
2 changed files with 39 additions and 0 deletions
|
@ -183,6 +183,15 @@ void PrintJobRecovery::save(const bool force/*=false*/, const bool save_queue/*=
|
|||
info.active_extruder = active_extruder;
|
||||
#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
|
||||
HOTEND_LOOP() info.target_temperature[e] = thermalManager.temp_hotend[e].target;
|
||||
#endif
|
||||
|
@ -291,6 +300,27 @@ void PrintJobRecovery::resume() {
|
|||
gcode.process_subcommands_now(cmd);
|
||||
#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
|
||||
const int16_t bt = info.target_temperature_bed;
|
||||
if (bt) {
|
||||
|
|
|
@ -59,6 +59,15 @@ typedef struct {
|
|||
uint8_t active_extruder;
|
||||
#endif
|
||||
|
||||
#if DISABLED(NO_VOLUMETRICS)
|
||||
bool volumetric_enabled;
|
||||
#if EXTRUDERS > 1
|
||||
float filament_size[EXTRUDERS];
|
||||
#else
|
||||
float filament_size;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if HOTENDS
|
||||
int16_t target_temperature[HOTENDS];
|
||||
#endif
|
||||
|
|
Reference in a new issue