mirror of
https://github.com/MarlinFirmware/Marlin.git
synced 2025-01-22 17:52:57 +00:00
🚸 PLR: Add FR and Flow (#27201)
Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
This commit is contained in:
parent
1e0719dac5
commit
9a6d4b5e56
7 changed files with 35 additions and 61 deletions
|
@ -205,6 +205,9 @@ void PrintJobRecovery::save(const bool force/*=false*/, const float zraise/*=POW
|
|||
// info.sdpos and info.current_position are pre-filled from the Stepper ISR
|
||||
|
||||
info.feedrate = uint16_t(MMS_TO_MMM(feedrate_mm_s));
|
||||
info.feedrate_percentage = feedrate_percentage;
|
||||
COPY(info.flow_percentage, planner.flow_percentage);
|
||||
|
||||
info.zraise = zraise;
|
||||
info.flag.raised = raised; // Was Z raised before power-off?
|
||||
|
||||
|
@ -216,7 +219,7 @@ void PrintJobRecovery::save(const bool force/*=false*/, const float zraise/*=POW
|
|||
#if DISABLED(NO_VOLUMETRICS)
|
||||
info.flag.volumetric_enabled = parser.volumetric_enabled;
|
||||
#if HAS_MULTI_EXTRUDER
|
||||
EXTRUDER_LOOP() info.filament_size[e] = planner.filament_size[e];
|
||||
COPY(info.filament_size, planner.filament_size);
|
||||
#else
|
||||
if (parser.volumetric_enabled) info.filament_size[0] = planner.filament_size[active_extruder];
|
||||
#endif
|
||||
|
@ -269,7 +272,10 @@ void PrintJobRecovery::save(const bool force/*=false*/, const float zraise/*=POW
|
|||
|
||||
#if POWER_LOSS_RETRACT_LEN
|
||||
// Retract filament now
|
||||
gcode.process_subcommands_now(F("G1 F3000 E-" STRINGIFY(POWER_LOSS_RETRACT_LEN)));
|
||||
const uint16_t old_flow = planner.flow_percentage[active_extruder];
|
||||
planner.set_flow(active_extruder, 100);
|
||||
gcode.process_subcommands_now(F("G1F3000E-" STRINGIFY(POWER_LOSS_RETRACT_LEN)));
|
||||
planner.set_flow(active_extruder, old_flow);
|
||||
#endif
|
||||
|
||||
#if POWER_LOSS_ZRAISE
|
||||
|
@ -555,8 +561,12 @@ void PrintJobRecovery::resume() {
|
|||
// Move back down to the saved Z for printing
|
||||
PROCESS_SUBCOMMANDS_NOW(TS(F("G1F600Z"), p_float_t(z_print, 3)));
|
||||
|
||||
// Restore the feedrate
|
||||
// Restore the feedrate and percentage
|
||||
PROCESS_SUBCOMMANDS_NOW(TS(F("G1F"), info.feedrate));
|
||||
feedrate_percentage = info.feedrate_percentage;
|
||||
|
||||
// Flowrate percentage
|
||||
EXTRUDER_LOOP() planner.set_flow(e, info.flow_percentage[e]);
|
||||
|
||||
// Restore E position with G92.9
|
||||
PROCESS_SUBCOMMANDS_NOW(TS(F("G92.9E"), p_float_t(resume_pos.e, 3)));
|
||||
|
@ -589,7 +599,8 @@ void PrintJobRecovery::resume() {
|
|||
}
|
||||
DEBUG_EOL();
|
||||
|
||||
DEBUG_ECHOLNPGM("feedrate: ", info.feedrate);
|
||||
DEBUG_ECHOLN(F("feedrate: "), info.feedrate, F(" x "), info.feedrate_percentage, '%');
|
||||
EXTRUDER_LOOP() DEBUG_ECHOLN('E', e + 1, F(" flow %: "), info.flow_percentage[e]);
|
||||
|
||||
DEBUG_ECHOLNPGM("zraise: ", info.zraise, " ", info.flag.raised ? "(before)" : "");
|
||||
|
||||
|
|
|
@ -59,6 +59,8 @@ typedef struct {
|
|||
// Machine state
|
||||
xyze_pos_t current_position;
|
||||
uint16_t feedrate;
|
||||
int16_t feedrate_percentage;
|
||||
uint16_t flow_percentage[EXTRUDERS];
|
||||
|
||||
float zraise;
|
||||
|
||||
|
|
|
@ -828,7 +828,7 @@ void JyersDWIN::drawStatusArea(const bool icons/*=false*/) {
|
|||
}
|
||||
if (planner.flow_percentage[0] != flow) {
|
||||
flow = planner.flow_percentage[0];
|
||||
dwinDrawIntValue(true, true, 0, DWIN_FONT_STAT, getColor(eeprom_settings.status_area_text, COLOR_WHITE), COLOR_BG_BLACK, 3, 116 + 2 * STAT_CHR_W, 417, planner.flow_percentage[0]);
|
||||
dwinDrawIntValue(true, true, 0, DWIN_FONT_STAT, getColor(eeprom_settings.status_area_text, COLOR_WHITE), COLOR_BG_BLACK, 3, 116 + 2 * STAT_CHR_W, 417, flow);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -51,42 +51,22 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
|
|||
if (event != LV_EVENT_RELEASED) return;
|
||||
switch (obj->mks_obj_id) {
|
||||
case ID_C_ADD:
|
||||
if (!editingFlowrate) {
|
||||
if (feedrate_percentage < MAX_EXT_SPEED_PERCENT - uiCfg.stepPrintSpeed)
|
||||
feedrate_percentage += uiCfg.stepPrintSpeed;
|
||||
else
|
||||
feedrate_percentage = MAX_EXT_SPEED_PERCENT;
|
||||
}
|
||||
if (!editingFlowrate)
|
||||
feedrate_percentage = _MIN(MAX_EXT_SPEED_PERCENT, feedrate_percentage + uiCfg.stepPrintSpeed);
|
||||
else {
|
||||
if (planner.flow_percentage[0] < MAX_EXT_SPEED_PERCENT - uiCfg.stepPrintSpeed)
|
||||
planner.flow_percentage[0] += uiCfg.stepPrintSpeed;
|
||||
else
|
||||
planner.flow_percentage[0] = MAX_EXT_SPEED_PERCENT;
|
||||
planner.refresh_e_factor(0);
|
||||
#if HAS_MULTI_EXTRUDER
|
||||
planner.flow_percentage[1] = planner.flow_percentage[0];
|
||||
planner.refresh_e_factor(1);
|
||||
#endif
|
||||
const int16_t new_flow = _MIN(MAX_EXT_SPEED_PERCENT, planner.flow_percentage[0] + uiCfg.stepPrintSpeed);
|
||||
planner.set_flow(0, new_flow);
|
||||
TERN_(HAS_MULTI_EXTRUDER, planner.set_flow(1, new_flow));
|
||||
}
|
||||
disp_print_speed();
|
||||
break;
|
||||
case ID_C_DEC:
|
||||
if (!editingFlowrate) {
|
||||
if (feedrate_percentage > MIN_EXT_SPEED_PERCENT + uiCfg.stepPrintSpeed)
|
||||
feedrate_percentage -= uiCfg.stepPrintSpeed;
|
||||
else
|
||||
feedrate_percentage = MIN_EXT_SPEED_PERCENT;
|
||||
}
|
||||
if (!editingFlowrate)
|
||||
feedrate_percentage = _MAX(MIN_EXT_SPEED_PERCENT, feedrate_percentage + uiCfg.stepPrintSpeed);
|
||||
else {
|
||||
if (planner.flow_percentage[0] > MIN_EXT_SPEED_PERCENT + uiCfg.stepPrintSpeed)
|
||||
planner.flow_percentage[0] -= uiCfg.stepPrintSpeed;
|
||||
else
|
||||
planner.flow_percentage[0] = MIN_EXT_SPEED_PERCENT;
|
||||
planner.refresh_e_factor(0);
|
||||
#if HAS_MULTI_EXTRUDER
|
||||
planner.flow_percentage[1] = planner.flow_percentage[0];
|
||||
planner.refresh_e_factor(1);
|
||||
#endif
|
||||
const int16_t new_flow = _MAX(MIN_EXT_SPEED_PERCENT, planner.flow_percentage[0] - uiCfg.stepPrintSpeed);
|
||||
planner.set_flow(0, new_flow);
|
||||
TERN_(HAS_MULTI_EXTRUDER, planner.set_flow(1, new_flow));
|
||||
}
|
||||
disp_print_speed();
|
||||
break;
|
||||
|
@ -101,12 +81,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
|
|||
disp_print_speed();
|
||||
break;
|
||||
case ID_C_STEP:
|
||||
if (uiCfg.stepPrintSpeed == 1)
|
||||
uiCfg.stepPrintSpeed = 5;
|
||||
else if (uiCfg.stepPrintSpeed == 5)
|
||||
uiCfg.stepPrintSpeed = 10;
|
||||
else
|
||||
uiCfg.stepPrintSpeed = 1;
|
||||
uiCfg.stepPrintSpeed = (uiCfg.stepPrintSpeed == 5) ? 10 : (uiCfg.stepPrintSpeed == 1) ? 5 : 1;
|
||||
disp_speed_step();
|
||||
break;
|
||||
case ID_C_RETURN:
|
||||
|
|
|
@ -102,12 +102,8 @@ static void btn_ok_event_cb(lv_obj_t *btn, lv_event_t event) {
|
|||
card.openFileRead(cur_name);
|
||||
if (card.isFileOpen()) {
|
||||
feedrate_percentage = 100;
|
||||
planner.flow_percentage[0] = 100;
|
||||
planner.e_factor[0] = planner.flow_percentage[0] * 0.01f;
|
||||
#if HAS_MULTI_EXTRUDER
|
||||
planner.flow_percentage[1] = 100;
|
||||
planner.e_factor[1] = planner.flow_percentage[1] * 0.01f;
|
||||
#endif
|
||||
TERN_(HAS_EXTRUDERS, planner.set_flow(0, 100));
|
||||
TERN_(HAS_MULTI_EXTRUDER, planner.set_flow(1, 100));
|
||||
card.startOrResumeFilePrinting();
|
||||
TERN_(POWER_LOSS_RECOVERY, recovery.prepare());
|
||||
once_flag = false;
|
||||
|
|
|
@ -660,12 +660,8 @@ char *creat_title_text() {
|
|||
card.openFileRead(cur_name);
|
||||
if (card.isFileOpen()) {
|
||||
feedrate_percentage = 100;
|
||||
planner.flow_percentage[0] = 100;
|
||||
planner.e_factor[0] = planner.flow_percentage[0] * 0.01;
|
||||
#if HAS_MULTI_EXTRUDER
|
||||
planner.flow_percentage[1] = 100;
|
||||
planner.e_factor[1] = planner.flow_percentage[1] * 0.01;
|
||||
#endif
|
||||
TERN_(HAS_EXTRUDERS, planner.set_flow(0, 100));
|
||||
TERN_(HAS_MULTI_EXTRUDER, planner.set_flow(1, 100));
|
||||
card.startOrResumeFilePrinting();
|
||||
TERN_(POWER_LOSS_RECOVERY, recovery.prepare());
|
||||
once_flag = false;
|
||||
|
|
|
@ -1011,14 +1011,8 @@ static void wifi_gcode_exec(uint8_t * const cmd_line) {
|
|||
if (card.isFileOpen()) {
|
||||
//saved_feedrate_percentage = feedrate_percentage;
|
||||
feedrate_percentage = 100;
|
||||
#if HAS_EXTRUDERS
|
||||
planner.flow_percentage[0] = 100;
|
||||
planner.e_factor[0] = planner.flow_percentage[0] * 0.01f;
|
||||
#endif
|
||||
#if HAS_MULTI_EXTRUDER
|
||||
planner.flow_percentage[1] = 100;
|
||||
planner.e_factor[1] = planner.flow_percentage[1] * 0.01f;
|
||||
#endif
|
||||
TERN_(HAS_EXTRUDERS, planner.set_flow(0, 100));
|
||||
TERN_(HAS_MULTI_EXTRUDER, planner.set_flow(1, 100));
|
||||
card.startOrResumeFilePrinting();
|
||||
TERN_(POWER_LOSS_RECOVERY, recovery.prepare());
|
||||
once_flag = false;
|
||||
|
|
Loading…
Reference in a new issue