Merge upstream changes from Marlin 2.1.1

This commit is contained in:
Stefan Kalscheuer
2022-09-03 09:23:32 +02:00
parent 626283aadb
commit 986e416c7f
1610 changed files with 73839 additions and 40857 deletions

View File

@@ -94,6 +94,10 @@
#include "../../feature/caselight.h"
#endif
#if ENABLED(POWER_LOSS_RECOVERY)
#include "../../feature/powerloss.h"
#endif
#if ENABLED(BABYSTEPPING)
#include "../../feature/babystep.h"
#endif
@@ -165,7 +169,7 @@ namespace ExtUI {
}
void yield() {
if (!flags.printer_killed) thermalManager.manage_heater();
if (!flags.printer_killed) thermalManager.task();
}
void enableHeater(const extruder_t extruder) {
@@ -385,8 +389,10 @@ namespace ExtUI {
return !thermalManager.tooColdToExtrude(extruder - E0);
}
GcodeSuite::MarlinBusyState getHostKeepaliveState() { return TERN0(HOST_KEEPALIVE_FEATURE, gcode.busy_state); }
bool getHostKeepaliveIsPaused() { return TERN0(HOST_KEEPALIVE_FEATURE, gcode.host_keepalive_is_paused()); }
#if ENABLED(HOST_KEEPALIVE_FEATURE)
GcodeSuite::MarlinBusyState getHostKeepaliveState() { return gcode.busy_state; }
bool getHostKeepaliveIsPaused() { return gcode.host_keepalive_is_paused(); }
#endif
#if HAS_SOFTWARE_ENDSTOPS
bool getSoftEndstopState() { return soft_endstop._enabled; }
@@ -414,6 +420,15 @@ namespace ExtUI {
#if AXIS_IS_TMC(K)
case K: return stepperK.getMilliamps();
#endif
#if AXIS_IS_TMC(U)
case U: return stepperU.getMilliamps();
#endif
#if AXIS_IS_TMC(V)
case V: return stepperV.getMilliamps();
#endif
#if AXIS_IS_TMC(W)
case W: return stepperW.getMilliamps();
#endif
#if AXIS_IS_TMC(X2)
case X2: return stepperX2.getMilliamps();
#endif
@@ -483,6 +498,15 @@ namespace ExtUI {
#if AXIS_IS_TMC(K)
case K: stepperK.rms_current(constrain(mA, 400, 1500)); break;
#endif
#if AXIS_IS_TMC(U)
case U: stepperU.rms_current(constrain(mA, 400, 1500)); break;
#endif
#if AXIS_IS_TMC(V)
case V: stepperV.rms_current(constrain(mA, 400, 1500)); break;
#endif
#if AXIS_IS_TMC(W)
case W: stepperW.rms_current(constrain(mA, 400, 1500)); break;
#endif
#if AXIS_IS_TMC(X2)
case X2: stepperX2.rms_current(constrain(mA, 400, 1500)); break;
#endif
@@ -540,6 +564,9 @@ namespace ExtUI {
OPTCODE(I_SENSORLESS, case I: return stepperI.homing_threshold())
OPTCODE(J_SENSORLESS, case J: return stepperJ.homing_threshold())
OPTCODE(K_SENSORLESS, case K: return stepperK.homing_threshold())
OPTCODE(U_SENSORLESS, case U: return stepperU.homing_threshold())
OPTCODE(V_SENSORLESS, case V: return stepperV.homing_threshold())
OPTCODE(W_SENSORLESS, case W: return stepperW.homing_threshold())
OPTCODE(X2_SENSORLESS, case X2: return stepperX2.homing_threshold())
OPTCODE(Y2_SENSORLESS, case Y2: return stepperY2.homing_threshold())
OPTCODE(Z2_SENSORLESS, case Z2: return stepperZ2.homing_threshold())
@@ -569,6 +596,15 @@ namespace ExtUI {
#if K_SENSORLESS
case K: stepperK.homing_threshold(value); break;
#endif
#if U_SENSORLESS
case U: stepperU.homing_threshold(value); break;
#endif
#if V_SENSORLESS
case V: stepperV.homing_threshold(value); break;
#endif
#if W_SENSORLESS
case W: stepperW.homing_threshold(value); break;
#endif
#if X2_SENSORLESS
case X2: stepperX2.homing_threshold(value); break;
#endif
@@ -620,7 +656,7 @@ namespace ExtUI {
}
void setAxisMaxFeedrate_mm_s(const feedRate_t value, const axis_t axis) {
planner.set_max_feedrate(axis, value);
planner.set_max_feedrate((AxisEnum)axis, value);
}
void setAxisMaxFeedrate_mm_s(const feedRate_t value, const extruder_t extruder) {
@@ -638,7 +674,7 @@ namespace ExtUI {
}
void setAxisMaxAcceleration_mm_s2(const_float_t value, const axis_t axis) {
planner.set_max_acceleration(axis, value);
planner.set_max_acceleration((AxisEnum)axis, value);
}
void setAxisMaxAcceleration_mm_s2(const_float_t value, const extruder_t extruder) {
@@ -674,6 +710,11 @@ namespace ExtUI {
#endif
#endif
#if ENABLED(POWER_LOSS_RECOVERY)
bool getPowerLossRecoveryEnabled() { return recovery.enabled; }
void setPowerLossRecoveryEnabled(const bool value) { recovery.enable(value); }
#endif
#if ENABLED(LIN_ADVANCE)
float getLinearAdvance_mm_mm_s(const extruder_t extruder) {
return (extruder < EXTRUDERS) ? planner.extruder_advance_K[extruder - E0] : 0;
@@ -705,7 +746,7 @@ namespace ExtUI {
uint8_t getIDEX_Mode() { return dual_x_carriage_mode; }
#endif
#if PREHEAT_COUNT
#if HAS_PREHEAT
uint16_t getMaterial_preset_E(const uint16_t index) { return ui.material_preset[index].hotend_temp; }
#if HAS_HEATED_BED
uint16_t getMaterial_preset_B(const uint16_t index) { return ui.material_preset[index].bed_temp; }
@@ -852,16 +893,16 @@ namespace ExtUI {
#endif
#if ENABLED(BACKLASH_GCODE)
float getAxisBacklash_mm(const axis_t axis) { return backlash.distance_mm[axis]; }
float getAxisBacklash_mm(const axis_t axis) { return backlash.get_distance_mm((AxisEnum)axis); }
void setAxisBacklash_mm(const_float_t value, const axis_t axis)
{ backlash.distance_mm[axis] = constrain(value,0,5); }
{ backlash.set_distance_mm((AxisEnum)axis, constrain(value,0,5)); }
float getBacklashCorrection_percent() { return ui8_to_percent(backlash.correction); }
void setBacklashCorrection_percent(const_float_t value) { backlash.correction = map(constrain(value, 0, 100), 0, 100, 0, 255); }
float getBacklashCorrection_percent() { return backlash.get_correction() * 100.0f; }
void setBacklashCorrection_percent(const_float_t value) { backlash.set_correction(constrain(value, 0, 100) / 100.0f); }
#ifdef BACKLASH_SMOOTHING_MM
float getBacklashSmoothing_mm() { return backlash.smoothing_mm; }
void setBacklashSmoothing_mm(const_float_t value) { backlash.smoothing_mm = constrain(value, 0, 999); }
float getBacklashSmoothing_mm() { return backlash.get_smoothing_mm(); }
void setBacklashSmoothing_mm(const_float_t value) { backlash.set_smoothing_mm(constrain(value, 0, 999)); }
#endif
#endif
@@ -878,11 +919,11 @@ namespace ExtUI {
#if HAS_MESH
bed_mesh_t& getMeshArray() { return Z_VALUES_ARR; }
float getMeshPoint(const xy_uint8_t &pos) { return Z_VALUES(pos.x, pos.y); }
bed_mesh_t& getMeshArray() { return bedlevel.z_values; }
float getMeshPoint(const xy_uint8_t &pos) { return bedlevel.z_values[pos.x][pos.y]; }
void setMeshPoint(const xy_uint8_t &pos, const_float_t zoff) {
if (WITHIN(pos.x, 0, (GRID_MAX_POINTS_X) - 1) && WITHIN(pos.y, 0, (GRID_MAX_POINTS_Y) - 1)) {
Z_VALUES(pos.x, pos.y) = zoff;
bedlevel.z_values[pos.x][pos.y] = zoff;
TERN_(ABL_BILINEAR_SUBDIVISION, bed_level_virt_interpolate());
}
}
@@ -895,12 +936,10 @@ namespace ExtUI {
if (x_target != current_position.x || y_target != current_position.y) {
// If moving across bed, raise nozzle to safe height over bed
feedrate_mm_s = Z_PROBE_FEEDRATE_FAST;
destination = current_position;
destination.z = Z_CLEARANCE_BETWEEN_PROBES;
destination.set(current_position.x, current_position.y, Z_CLEARANCE_BETWEEN_PROBES);
prepare_line_to_destination();
feedrate_mm_s = XY_PROBE_FEEDRATE;
destination.x = x_target;
destination.y = y_target;
destination.set(x_target, y_target);
prepare_line_to_destination();
}
feedrate_mm_s = Z_PROBE_FEEDRATE_FAST;
@@ -918,7 +957,7 @@ namespace ExtUI {
#endif // HAS_LEVELING
#if ENABLED(HOST_PROMPT_SUPPORT)
void setHostResponse(const uint8_t response) { host_response_handler(response); }
void setHostResponse(const uint8_t response) { hostui.handle_response(response); }
#endif
#if ENABLED(PRINTCOUNTER)
@@ -1034,16 +1073,10 @@ namespace ExtUI {
void setFeedrate_percent(const_float_t value) { feedrate_percentage = constrain(value, 10, 500); }
void coolDown() {
#if HAS_HOTEND
HOTEND_LOOP() thermalManager.setTargetHotend(0, e);
#endif
TERN_(HAS_HEATED_BED, thermalManager.setTargetBed(0));
TERN_(HAS_FAN, thermalManager.zero_fan_speeds());
}
void coolDown() { thermalManager.cooldown(); }
bool awaitingUserConfirm() {
return TERN0(HAS_RESUME_CONTINUE, wait_for_user) || getHostKeepaliveIsPaused();
return TERN0(HAS_RESUME_CONTINUE, wait_for_user) || TERN0(HOST_KEEPALIVE_FEATURE, getHostKeepaliveIsPaused());
}
void setUserConfirmed() { TERN_(HAS_RESUME_CONTINUE, wait_for_user = false); }
@@ -1077,16 +1110,25 @@ namespace ExtUI {
void resumePrint() { ui.resume_print(); }
void stopPrint() { ui.abort_print(); }
void onUserConfirmRequired_P(PGM_P const pstr) {
char msg[strlen_P(pstr) + 1];
strcpy_P(msg, pstr);
onUserConfirmRequired(msg);
// Simplest approach is to make an SRAM copy
void onUserConfirmRequired(FSTR_P const fstr) {
#ifdef __AVR__
char msg[strlen_P(FTOP(fstr)) + 1];
strcpy_P(msg, FTOP(fstr));
onUserConfirmRequired(msg);
#else
onUserConfirmRequired(FTOP(fstr));
#endif
}
void onStatusChanged_P(PGM_P const pstr) {
char msg[strlen_P(pstr) + 1];
strcpy_P(msg, pstr);
onStatusChanged(msg);
void onStatusChanged(FSTR_P const fstr) {
#ifdef __AVR__
char msg[strlen_P(FTOP(fstr)) + 1];
strcpy_P(msg, FTOP(fstr));
onStatusChanged(msg);
#else
onStatusChanged(FTOP(fstr));
#endif
}
FileList::FileList() { refresh(); }
@@ -1149,11 +1191,11 @@ namespace ExtUI {
// At the moment we hook into MarlinUI methods, but this could be cleaned up in the future
void MarlinUI::init() { ExtUI::onStartup(); }
void MarlinUI::init_lcd() { ExtUI::onStartup(); }
void MarlinUI::update() { ExtUI::onIdle(); }
void MarlinUI::kill_screen(PGM_P const error, PGM_P const component) {
void MarlinUI::kill_screen(FSTR_P const error, FSTR_P const component) {
using namespace ExtUI;
if (!flags.printer_killed) {
flags.printer_killed = true;