Power Loss Recovery for volumetric extrusion (#15734)

This commit is contained in:
The-Force 2019-10-31 20:09:37 +01:00 committed by Scott Lahteine
parent 4e6e02bc3e
commit c6f694a247
2 changed files with 39 additions and 0 deletions

View File

@ -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) {

View File

@ -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