mirror of
https://github.com/MarlinFirmware/Marlin.git
synced 2025-12-28 02:10:32 -07:00
parent
40beddeaa3
commit
5a0923ed28
17 changed files with 79 additions and 126 deletions
|
|
@ -1154,9 +1154,6 @@
|
|||
|
||||
#define FTM_DEFAULT_DYNFREQ_MODE dynFreqMode_DISABLED // Default mode of dynamic frequency calculation. (DISABLED, Z_BASED, MASS_BASED)
|
||||
|
||||
#define FTM_LINEAR_ADV_DEFAULT_ENA false // Default linear advance enable (true) or disable (false)
|
||||
#define FTM_LINEAR_ADV_DEFAULT_K 0.0f // Default linear advance gain. (Acceleration-based scaling factor.)
|
||||
|
||||
#define FTM_DEFAULT_SHAPER_X ftMotionShaper_NONE // Default shaper mode on X axis (NONE, ZV, ZVD, ZVDD, ZVDDD, EI, 2HEI, 3HEI, MZV)
|
||||
#define FTM_SHAPING_DEFAULT_FREQ_X 37.0f // (Hz) Default peak frequency used by input shapers
|
||||
#define FTM_SHAPING_ZETA_X 0.1f // Zeta used by input shapers for X axis
|
||||
|
|
@ -2388,13 +2385,17 @@
|
|||
* See https://marlinfw.org/docs/features/lin_advance.html for full instructions.
|
||||
*/
|
||||
//#define LIN_ADVANCE
|
||||
#if ENABLED(LIN_ADVANCE)
|
||||
|
||||
#if ANY(LIN_ADVANCE, FT_MOTION)
|
||||
#if ENABLED(DISTINCT_E_FACTORS)
|
||||
#define ADVANCE_K { 0.22 } // (mm) Compression length per 1mm/s extruder speed, per extruder
|
||||
#define ADVANCE_K { 0.22 } // (mm) Compression length per 1mm/s extruder speed, per extruder. Override with 'M900 T<tool> K<mm>'.
|
||||
#else
|
||||
#define ADVANCE_K 0.22 // (mm) Compression length applying to all extruders
|
||||
#define ADVANCE_K 0.22 // (mm) Compression length for all extruders. Override with 'M900 K<mm>'.
|
||||
#endif
|
||||
//#define ADVANCE_K_EXTRA // Add a second linear advance constant, configurable with M900 L.
|
||||
//#define ADVANCE_K_EXTRA // Add a second linear advance constant, configurable with 'M900 L'.
|
||||
#endif
|
||||
|
||||
#if ENABLED(LIN_ADVANCE)
|
||||
//#define LA_DEBUG // Print debug information to serial during operation. Disable for production use.
|
||||
//#define EXPERIMENTAL_I2S_LA // Allow I2S_STEPPER_STREAM to be used with LA. Performance degrades as the LA step rate reaches ~20kHz.
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
#include "../../../inc/MarlinConfig.h"
|
||||
|
||||
#if ENABLED(LIN_ADVANCE)
|
||||
#if HAS_LIN_ADVANCE_K
|
||||
|
||||
#include "../../gcode.h"
|
||||
#include "../../../module/planner.h"
|
||||
|
|
@ -194,4 +194,4 @@ void GcodeSuite::M900_report(const bool forReplay/*=true*/) {
|
|||
}
|
||||
}
|
||||
|
||||
#endif // LIN_ADVANCE
|
||||
#endif // HAS_LIN_ADVANCE_K
|
||||
|
|
|
|||
|
|
@ -114,13 +114,6 @@ void say_shaping() {
|
|||
SERIAL_EOL();
|
||||
#endif
|
||||
}
|
||||
|
||||
#if HAS_EXTRUDERS
|
||||
if (c.active) {
|
||||
SERIAL_ECHO_TERNARY(c.linearAdvEna, "Linear Advance ", "en", "dis", "abled");
|
||||
SERIAL_ECHOLNPGM(". Gain: ", c.linearAdvK);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void GcodeSuite::M493_report(const bool forReplay/*=true*/) {
|
||||
|
|
@ -134,9 +127,6 @@ void GcodeSuite::M493_report(const bool forReplay/*=true*/) {
|
|||
#if HAS_DYNAMIC_FREQ
|
||||
, " D", c.dynFreqMode
|
||||
#endif
|
||||
#if HAS_EXTRUDERS
|
||||
, " P", c.linearAdvEna, " K", c.linearAdvK
|
||||
#endif
|
||||
// Axis Synchronization
|
||||
, " H", c.axis_sync_enabled
|
||||
);
|
||||
|
|
@ -172,7 +162,6 @@ void GcodeSuite::M493_report(const bool forReplay/*=true*/) {
|
|||
* Linear / Pressure Advance:
|
||||
*
|
||||
* P<bool> Enable (1) or Disable (0) Linear Advance pressure control
|
||||
* K<gain> Set Linear Advance gain
|
||||
*
|
||||
* Specifying Axes (for A,C,F,I,Q):
|
||||
*
|
||||
|
|
@ -251,28 +240,6 @@ void GcodeSuite::M493() {
|
|||
|
||||
#endif // NUM_AXES_SHAPED > 0
|
||||
|
||||
#if HAS_EXTRUDERS
|
||||
|
||||
// Pressure control (linear advance) parameter.
|
||||
if (parser.seen('P')) {
|
||||
const bool val = parser.value_bool();
|
||||
ftMotion.cfg.linearAdvEna = val;
|
||||
flag.report = true;
|
||||
}
|
||||
|
||||
// Pressure control (linear advance) gain parameter.
|
||||
if (parser.seenval('K')) {
|
||||
const float val = parser.value_float();
|
||||
if (WITHIN(val, 0.0f, 10.0f)) {
|
||||
ftMotion.cfg.linearAdvK = val;
|
||||
flag.report = true;
|
||||
}
|
||||
else // Value out of range.
|
||||
SERIAL_ECHOLNPGM("Linear Advance gain out of range.");
|
||||
}
|
||||
|
||||
#endif // HAS_EXTRUDERS
|
||||
|
||||
// Parse 'H' Axis Synchronization parameter.
|
||||
if (parser.seenval('H')) {
|
||||
const bool enabled = parser.value_bool();
|
||||
|
|
|
|||
|
|
@ -1038,7 +1038,7 @@ void GcodeSuite::process_parsed_command(bool no_ok/*=false*/) {
|
|||
case 871: M871(); break; // M871: Print/reset/clear first layer temperature offset values
|
||||
#endif
|
||||
|
||||
#if ENABLED(LIN_ADVANCE)
|
||||
#if HAS_LIN_ADVANCE_K
|
||||
case 900: M900(); break; // M900: Set advance K factor.
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -309,7 +309,7 @@
|
|||
*
|
||||
* M871 - Print/Reset/Clear first layer temperature offset values. (Requires PTC_PROBE, PTC_BED, or PTC_HOTEND)
|
||||
* M876 - Handle Prompt Response. (Requires HOST_PROMPT_SUPPORT and not EMERGENCY_PARSER)
|
||||
* M900 - Set / Report Linear Advance K-factor. (Requires LIN_ADVANCE)
|
||||
* M900 - Set / Report Linear Advance K-factor (Requires LIN_ADVANCE or FT_MOTION) and Smoothing Tau factor (Requires SMOOTH_LIN_ADVANCE).
|
||||
* M906 - Set / Report motor current in milliamps using axis codes XYZE, etc. Report values if no axis codes given. (Requires *_DRIVER_TYPE TMC(2130|2160|5130|5160|2208|2209|2240|2660))
|
||||
* M907 - Set digital trimpot motor current using axis codes. (Requires a board with digital trimpots)
|
||||
* M908 - Control digital trimpot directly. (Requires HAS_MOTOR_CURRENT_DAC or DIGIPOTSS_PIN)
|
||||
|
|
@ -1249,7 +1249,7 @@ private:
|
|||
static void M871();
|
||||
#endif
|
||||
|
||||
#if ENABLED(LIN_ADVANCE)
|
||||
#if HAS_LIN_ADVANCE_K
|
||||
static void M900();
|
||||
static void M900_report(const bool forReplay=true);
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -745,6 +745,10 @@
|
|||
#error "FTM_SHAPING_DEFAULT_[XY]_FREQ is now FTM_SHAPING_DEFAULT_FREQ_[XY]."
|
||||
#elif defined(SDSS)
|
||||
#error "SDSS is now SD_SS_PIN."
|
||||
#elif defined(FTM_LINEAR_ADV_DEFAULT_ENA)
|
||||
#error "FTM_LINEAR_ADV_DEFAULT_ENA is obsolete and should be removed."
|
||||
#elif defined(FTM_LINEAR_ADV_DEFAULT_K)
|
||||
#error "FTM_LINEAR_ADV_DEFAULT_K is now set with ADVANCE_K and should be removed."
|
||||
#endif
|
||||
|
||||
// SDSS renamed to SD_SS_PIN
|
||||
|
|
|
|||
|
|
@ -346,11 +346,12 @@
|
|||
#if ALL(FT_MOTION, HAS_EXTRUDERS)
|
||||
#define FTM_HAS_LIN_ADVANCE 1
|
||||
#endif
|
||||
|
||||
#if HAS_JUNCTION_DEVIATION && ANY(LIN_ADVANCE, FTM_HAS_LIN_ADVANCE)
|
||||
#if ANY(FTM_HAS_LIN_ADVANCE, LIN_ADVANCE)
|
||||
#define HAS_LIN_ADVANCE_K 1
|
||||
#endif
|
||||
#if HAS_JUNCTION_DEVIATION && ENABLED(LIN_ADVANCE)
|
||||
#define HAS_LINEAR_E_JERK 1
|
||||
#endif
|
||||
|
||||
#if ENABLED(LIN_ADVANCE) && DISABLED(SMOOTH_LIN_ADVANCE)
|
||||
#define HAS_ROUGH_LIN_ADVANCE 1
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -848,26 +848,15 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L
|
|||
#endif
|
||||
|
||||
/**
|
||||
* Linear Advance 1.5 - Check K value range
|
||||
* Linear Advance requirements
|
||||
*/
|
||||
#if ENABLED(LIN_ADVANCE)
|
||||
#if ENABLED(DISTINCT_E_FACTORS)
|
||||
constexpr float lak[] = ADVANCE_K;
|
||||
static_assert(COUNT(lak) <= DISTINCT_E, "The ADVANCE_K array has too many elements (i.e., more than " STRINGIFY(DISTINCT_E) ").");
|
||||
#define _LIN_ASSERT(N) static_assert(N >= COUNT(lak) || WITHIN(lak[N], 0, 10), "ADVANCE_K values must be from 0 to 10 (Changed in LIN_ADVANCE v1.5, Marlin 1.1.9).");
|
||||
REPEAT(DISTINCT_E, _LIN_ASSERT)
|
||||
#undef _LIN_ASSERT
|
||||
#else
|
||||
static_assert(WITHIN(ADVANCE_K, 0, 10), "ADVANCE_K must be from 0 to 10 (Changed in LIN_ADVANCE v1.5, Marlin 1.1.9).");
|
||||
#endif
|
||||
|
||||
// Incompatible with Direct Stepping
|
||||
#if ENABLED(DIRECT_STEPPING)
|
||||
#error "DIRECT_STEPPING is incompatible with LIN_ADVANCE. (Extrusion is controlled externally by the Step Daemon.)"
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Smooth Linear Advance
|
||||
*/
|
||||
// Smooth Linear Advance
|
||||
#if ENABLED(SMOOTH_LIN_ADVANCE)
|
||||
#ifndef CPU_32_BIT
|
||||
#error "SMOOTH_LIN_ADVANCE requires a 32-bit CPU."
|
||||
|
|
@ -875,9 +864,23 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L
|
|||
#error "INPUT_SHAPING_E_SYNC requires INPUT_SHAPING_X or INPUT_SHAPING_Y."
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif // LIN_ADVANCE
|
||||
|
||||
/**
|
||||
* Linear Advance and FT Motion - Check K value range
|
||||
*/
|
||||
#if HAS_LIN_ADVANCE_K
|
||||
#if ENABLED(DISTINCT_E_FACTORS)
|
||||
constexpr float lak[] = ADVANCE_K;
|
||||
static_assert(COUNT(lak) <= DISTINCT_E, "The ADVANCE_K array has too many elements (i.e., more than " STRINGIFY(DISTINCT_E) ").");
|
||||
#define _LIN_ASSERT(N) static_assert(N >= COUNT(lak) || WITHIN(lak[N], 0, 10), "ADVANCE_K values must be from 0 to 10.");
|
||||
REPEAT(DISTINCT_E, _LIN_ASSERT)
|
||||
#undef _LIN_ASSERT
|
||||
#else
|
||||
static_assert(WITHIN(ADVANCE_K, 0, 10), "ADVANCE_K must be from 0 to 10.");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Nonlinear Extrusion requirements
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -2686,7 +2686,7 @@ void applyMaxAccel() { planner.set_max_acceleration(hmiValue.axis, menuData.valu
|
|||
void setJDmm() { setPFloatOnClick(MIN_JD_MM, MAX_JD_MM, 3, applyJDmm); }
|
||||
#endif
|
||||
|
||||
#if ENABLED(LIN_ADVANCE)
|
||||
#if HAS_LIN_ADVANCE_K
|
||||
#define LA_FDIGITS 3
|
||||
void applyLA_K() { planner.set_advance_k(menuData.value / POW(10, LA_FDIGITS)); }
|
||||
void setLA_K() { setFloatOnClick(0, 10, LA_FDIGITS, planner.get_advance_k(), applyLA_K); }
|
||||
|
|
@ -3677,7 +3677,7 @@ void drawTuneMenu() {
|
|||
|
||||
void drawMotionMenu() {
|
||||
constexpr uint8_t items = (4
|
||||
+ COUNT_ENABLED(EDITABLE_STEPS_PER_UNIT, EDITABLE_HOMING_FEEDRATE, LIN_ADVANCE, SHAPING_MENU, ADAPTIVE_STEP_SMOOTHING_TOGGLE)
|
||||
+ COUNT_ENABLED(EDITABLE_STEPS_PER_UNIT, EDITABLE_HOMING_FEEDRATE, HAS_LIN_ADVANCE_K, SMOOTH_LIN_ADVANCE, SHAPING_MENU, ADAPTIVE_STEP_SMOOTHING_TOGGLE)
|
||||
+ 2
|
||||
);
|
||||
checkkey = ID_Menu;
|
||||
|
|
@ -3696,7 +3696,7 @@ void drawMotionMenu() {
|
|||
#if ENABLED(EDITABLE_HOMING_FEEDRATE)
|
||||
MENU_ITEM(ICON_Homing, MSG_HOMING_FEEDRATE, onDrawSubMenu, drawHomingFRMenu);
|
||||
#endif
|
||||
#if ENABLED(LIN_ADVANCE)
|
||||
#if HAS_LIN_ADVANCE_K
|
||||
static float editable_k;
|
||||
editable_k = planner.get_advance_k();
|
||||
EDIT_ITEM(ICON_MaxAccelerated, MSG_ADVANCE_K, onDrawLA_K, setLA_K, &editable_k);
|
||||
|
|
|
|||
|
|
@ -121,10 +121,10 @@
|
|||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
#define PROUI_ITEM_PLR // Tune > Power-loss Recovery
|
||||
#endif
|
||||
#if ENABLED(HAS_JUNCTION_DEVIATION)
|
||||
#if HAS_JUNCTION_DEVIATION
|
||||
#define PROUI_ITEM_JD // Tune > Junction Deviation
|
||||
#endif
|
||||
#if ENABLED(LIN_ADVANCE)
|
||||
#if HAS_LIN_ADVANCE_K
|
||||
#define PROUI_ITEM_ADVK 1 // Tune > Linear Advance
|
||||
#endif
|
||||
#if ANY(HAS_PID_HEATING, MPC_AUTOTUNE) && DISABLED(DISABLE_TUNING_GRAPH)
|
||||
|
|
|
|||
|
|
@ -499,12 +499,6 @@ void menu_move() {
|
|||
}
|
||||
#endif
|
||||
|
||||
#if HAS_EXTRUDERS
|
||||
EDIT_ITEM(bool, MSG_LINEAR_ADVANCE, &c.linearAdvEna);
|
||||
if (c.linearAdvEna || ENABLED(FT_MOTION_NO_MENU_TOGGLE))
|
||||
EDIT_ITEM(float42_52, MSG_ADVANCE_K, &c.linearAdvK, 0.0f, 10.0f);
|
||||
#endif
|
||||
|
||||
EDIT_ITEM(bool, MSG_FTM_AXIS_SYNC, &c.axis_sync_enabled);
|
||||
|
||||
#if ENABLED(FTM_SMOOTHING)
|
||||
|
|
@ -578,12 +572,6 @@ void menu_move() {
|
|||
SUBMENU_S(_dmode(), MSG_FTM_DYN_MODE, menu_ftm_dyn_mode);
|
||||
#endif
|
||||
|
||||
#if HAS_EXTRUDERS
|
||||
EDIT_ITEM(bool, MSG_LINEAR_ADVANCE, &c.linearAdvEna);
|
||||
if (c.linearAdvEna || ENABLED(FT_MOTION_NO_MENU_TOGGLE))
|
||||
EDIT_ITEM(float42_52, MSG_ADVANCE_K, &c.linearAdvK, 0.0f, 10.0f);
|
||||
#endif
|
||||
|
||||
#if ENABLED(FTM_SMOOTHING)
|
||||
CARTES_MAP(_SMOO_MENU_ITEM);
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -612,12 +612,13 @@ void FTMotion::generateTrajectoryPointsFromBlock() {
|
|||
LOGICAL_AXIS_MAP_LC(_SET_TRAJ);
|
||||
|
||||
#if FTM_HAS_LIN_ADVANCE
|
||||
if (cfg.linearAdvEna) {
|
||||
const float advK = planner.get_advance_k();
|
||||
if (advK) {
|
||||
float traj_e = traj.e[traj_idx_set];
|
||||
if (use_advance_lead) {
|
||||
// Don't apply LA to retract/unretract blocks
|
||||
float e_rate = (traj_e - prev_traj_e) * (FTM_FS);
|
||||
traj.e[traj_idx_set] += e_rate * cfg.linearAdvK;
|
||||
traj.e[traj_idx_set] += e_rate * advK;
|
||||
}
|
||||
prev_traj_e = traj_e;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -73,11 +73,6 @@ typedef struct FTConfig {
|
|||
|
||||
#endif // HAS_FTM_SHAPING
|
||||
|
||||
#if HAS_EXTRUDERS
|
||||
bool linearAdvEna = FTM_LINEAR_ADV_DEFAULT_ENA; // Linear advance enable configuration.
|
||||
float linearAdvK = FTM_LINEAR_ADV_DEFAULT_K; // Linear advance gain.
|
||||
#endif
|
||||
|
||||
TrajectoryType trajectory_type = TrajectoryType::FTM_TRAJECTORY_TYPE; // Trajectory generator type
|
||||
float poly6_acceleration_overshoot; // Overshoot factor for Poly6 (1.25 to 2.0)
|
||||
} ft_config_t;
|
||||
|
|
@ -126,11 +121,6 @@ class FTMotion {
|
|||
#undef _SET_SMOOTH
|
||||
#endif
|
||||
|
||||
#if HAS_EXTRUDERS
|
||||
cfg.linearAdvEna = FTM_LINEAR_ADV_DEFAULT_ENA;
|
||||
cfg.linearAdvK = FTM_LINEAR_ADV_DEFAULT_K;
|
||||
#endif
|
||||
|
||||
cfg.poly6_acceleration_overshoot = FTM_POLY6_ACCELERATION_OVERSHOOT;
|
||||
|
||||
setTrajectoryType(TrajectoryType::FTM_TRAJECTORY_TYPE);
|
||||
|
|
|
|||
|
|
@ -234,7 +234,7 @@ float Planner::previous_nominal_speed;
|
|||
int32_t Planner::xy_freq_min_interval_us = LROUND(1000000.0f / (XY_FREQUENCY_LIMIT));
|
||||
#endif
|
||||
|
||||
#if ENABLED(LIN_ADVANCE)
|
||||
#if HAS_LIN_ADVANCE_K
|
||||
float Planner::extruder_advance_K[DISTINCT_E]; // Initialized by settings.load
|
||||
#if ENABLED(SMOOTH_LIN_ADVANCE)
|
||||
uint32_t Planner::extruder_advance_K_q27[DISTINCT_E];
|
||||
|
|
@ -881,11 +881,9 @@ void Planner::calculate_trapezoid_for_block(block_t * const block, const float e
|
|||
|
||||
#if ENABLED(SMOOTH_LIN_ADVANCE)
|
||||
block->cruise_time = plateau_steps > 0 ? float(plateau_steps) * float(STEPPER_TIMER_RATE) / float(cruise_rate) : 0;
|
||||
#endif
|
||||
|
||||
#if HAS_ROUGH_LIN_ADVANCE
|
||||
#elif HAS_ROUGH_LIN_ADVANCE
|
||||
if (block->la_advance_rate) {
|
||||
const float comp = extruder_advance_K[E_INDEX_N(block->extruder)] * block->steps.e / block->step_event_count;
|
||||
const float comp = get_advance_k(block->extruder) * block->steps.e / block->step_event_count;
|
||||
block->max_adv_steps = cruise_rate * comp;
|
||||
block->final_adv_steps = final_rate * comp;
|
||||
}
|
||||
|
|
@ -2403,7 +2401,7 @@ bool Planner::_populate_block(
|
|||
// Start with print or travel acceleration
|
||||
accel = CEIL((esteps ? settings.acceleration : settings.travel_acceleration) * steps_per_mm);
|
||||
|
||||
#if ANY(LIN_ADVANCE, FTM_HAS_LIN_ADVANCE)
|
||||
#if HAS_LIN_ADVANCE_K
|
||||
// Linear advance is currently not ready for HAS_I_AXIS
|
||||
#define MAX_E_JERK(N) TERN(HAS_LINEAR_E_JERK, max_e_jerk[E_INDEX_N(N)], max_jerk.e)
|
||||
|
||||
|
|
@ -2416,11 +2414,7 @@ bool Planner::_populate_block(
|
|||
* Check the appropriate K value for Standard or Fixed-Time Motion.
|
||||
*/
|
||||
if (esteps && dm.e) {
|
||||
const bool ftm_active = TERN0(FTM_HAS_LIN_ADVANCE, ftMotion.cfg.active),
|
||||
ftm_la_active = TERN0(FTM_HAS_LIN_ADVANCE, ftm_active && ftMotion.cfg.linearAdvEna);
|
||||
const float advK = ftm_active
|
||||
? (ftm_la_active ? TERN0(FTM_HAS_LIN_ADVANCE, ftMotion.cfg.linearAdvK) : 0)
|
||||
: TERN0(HAS_ROUGH_LIN_ADVANCE, extruder_advance_K[E_INDEX_N(extruder)]);
|
||||
const float advK = get_advance_k(extruder);
|
||||
if (advK) {
|
||||
float e_D_ratio = (target_float.e - position_float.e) /
|
||||
TERN(IS_KINEMATIC, block->millimeters,
|
||||
|
|
@ -2434,17 +2428,20 @@ bool Planner::_populate_block(
|
|||
// This assumes no one will use a retract length of 0mm < retr_length < ~0.2mm
|
||||
// and no one will print 100mm wide lines using 3mm filament or 35mm wide lines using 1.75mm filament.
|
||||
use_adv_lead = e_D_ratio <= 3.0f;
|
||||
if (use_adv_lead && TERN0(HAS_ROUGH_LIN_ADVANCE, !ftm_active)) {
|
||||
// For Standard Motion LA: Scale E acceleration so it'll be possible to jump to the advance speed
|
||||
const uint32_t max_accel_steps_per_s2 = (MAX_E_JERK(extruder) / (advK * e_D_ratio)) * steps_per_mm;
|
||||
if (accel > max_accel_steps_per_s2) {
|
||||
accel = max_accel_steps_per_s2;
|
||||
if (TERN0(LA_DEBUG, DEBUGGING(INFO))) SERIAL_ECHOLNPGM("Acceleration limited to max_accel_steps_per_s2 (", max_accel_steps_per_s2, ")");
|
||||
|
||||
#if HAS_ROUGH_LIN_ADVANCE
|
||||
if (use_adv_lead && TERN1(FT_MOTION, !ftMotion.cfg.active)) {
|
||||
// For Standard Motion LA: Scale E acceleration so it'll be possible to jump to the advance speed
|
||||
const uint32_t max_accel_steps_per_s2 = (MAX_E_JERK(extruder) / (advK * e_D_ratio)) * steps_per_mm;
|
||||
if (accel > max_accel_steps_per_s2) {
|
||||
accel = max_accel_steps_per_s2;
|
||||
if (TERN0(LA_DEBUG, DEBUGGING(INFO))) SERIAL_ECHOLNPGM("Acceleration limited to max_accel_steps_per_s2 (", max_accel_steps_per_s2, ")");
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#endif // LIN_ADVANCE || FTM_HAS_LIN_ADVANCE
|
||||
#endif // HAS_LIN_ADVANCE_K
|
||||
|
||||
// Limit acceleration per axis
|
||||
if (block->step_event_count <= acceleration_long_cutoff) {
|
||||
|
|
@ -2475,7 +2472,7 @@ bool Planner::_populate_block(
|
|||
block->la_scaling = 0;
|
||||
if (use_adv_lead) {
|
||||
// The Bresenham algorithm will convert this step rate into extruder steps
|
||||
block->la_advance_rate = extruder_advance_K[E_INDEX_N(extruder)] * block->acceleration_steps_per_s2;
|
||||
block->la_advance_rate = get_advance_k(extruder) * block->acceleration_steps_per_s2;
|
||||
|
||||
// Reduce LA ISR frequency by calling it only often enough to ensure that there will
|
||||
// never be more than four extruder steps per call
|
||||
|
|
|
|||
|
|
@ -530,7 +530,7 @@ class Planner {
|
|||
static constexpr bool leveling_active = false;
|
||||
#endif
|
||||
|
||||
#if ENABLED(LIN_ADVANCE)
|
||||
#if HAS_LIN_ADVANCE_K
|
||||
static float extruder_advance_K[DISTINCT_E];
|
||||
static void set_advance_k(const float k, const uint8_t e=active_extruder) {
|
||||
UNUSED(e);
|
||||
|
|
@ -541,13 +541,14 @@ class Planner {
|
|||
UNUSED(e);
|
||||
return extruder_advance_K[E_INDEX_N(e)];
|
||||
}
|
||||
#if ENABLED(SMOOTH_LIN_ADVANCE)
|
||||
static uint32_t get_advance_k_q27(const uint8_t e=active_extruder) {
|
||||
UNUSED(e);
|
||||
return extruder_advance_K_q27[E_INDEX_N(e)];
|
||||
}
|
||||
#endif
|
||||
#endif // LIN_ADVANCE
|
||||
#endif
|
||||
|
||||
#if ENABLED(SMOOTH_LIN_ADVANCE)
|
||||
static uint32_t get_advance_k_q27(const uint8_t e=active_extruder) {
|
||||
UNUSED(e);
|
||||
return extruder_advance_K_q27[E_INDEX_N(e)];
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* The current position of the tool in absolute steps
|
||||
|
|
|
|||
|
|
@ -498,7 +498,7 @@ typedef struct SettingsDataStruct {
|
|||
//
|
||||
// LIN_ADVANCE
|
||||
//
|
||||
#if ENABLED(LIN_ADVANCE)
|
||||
#if HAS_LIN_ADVANCE_K
|
||||
float planner_extruder_advance_K[DISTINCT_E]; // M900 K planner.extruder_advance_K
|
||||
#if ENABLED(SMOOTH_LIN_ADVANCE)
|
||||
float stepper_extruder_advance_tau[DISTINCT_E]; // M900 U stepper.extruder_advance_tau
|
||||
|
|
@ -1564,7 +1564,7 @@ void MarlinSettings::postprocess() {
|
|||
// Linear Advance
|
||||
//
|
||||
{
|
||||
#if ENABLED(LIN_ADVANCE)
|
||||
#if HAS_LIN_ADVANCE_K
|
||||
_FIELD_TEST(planner_extruder_advance_K);
|
||||
EEPROM_WRITE(planner.extruder_advance_K);
|
||||
#if ENABLED(SMOOTH_LIN_ADVANCE)
|
||||
|
|
@ -2649,7 +2649,7 @@ void MarlinSettings::postprocess() {
|
|||
//
|
||||
// Linear Advance
|
||||
//
|
||||
#if ENABLED(LIN_ADVANCE)
|
||||
#if HAS_LIN_ADVANCE_K
|
||||
{
|
||||
float extruder_advance_K[DISTINCT_E];
|
||||
_FIELD_TEST(planner_extruder_advance_K);
|
||||
|
|
@ -2665,7 +2665,7 @@ void MarlinSettings::postprocess() {
|
|||
DISTINCT_E_LOOP() stepper.set_advance_tau(tau[e], e);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
#endif // HAS_LIN_ADVANCE_K
|
||||
|
||||
//
|
||||
// Motor Current PWM
|
||||
|
|
@ -4098,7 +4098,7 @@ void MarlinSettings::reset() {
|
|||
//
|
||||
// Linear Advance
|
||||
//
|
||||
TERN_(LIN_ADVANCE, gcode.M900_report(forReplay));
|
||||
TERN_(HAS_LIN_ADVANCE_K, gcode.M900_report(forReplay));
|
||||
|
||||
//
|
||||
// Motor Current (SPI or PWM)
|
||||
|
|
|
|||
|
|
@ -312,7 +312,7 @@ SPI_FLASH_BACKUP = build_src_filter=+<src/gcode/control/M9
|
|||
PLATFORM_M997_SUPPORT = build_src_filter=+<src/gcode/control/M997.cpp>
|
||||
HAS_TOOLCHANGE = build_src_filter=+<src/gcode/control/T.cpp>
|
||||
FT_MOTION = build_src_filter=+<src/module/ft_motion.cpp> +<src/module/ft_motion> +<src/gcode/feature/ft_motion>
|
||||
LIN_ADVANCE = build_src_filter=+<src/gcode/feature/advance>
|
||||
HAS_LIN_ADVANCE_K = build_src_filter=+<src/gcode/feature/advance>
|
||||
PHOTO_GCODE = build_src_filter=+<src/gcode/feature/camera>
|
||||
CONTROLLER_FAN_EDITABLE = build_src_filter=+<src/gcode/feature/controllerfan>
|
||||
HAS_ZV_SHAPING = build_src_filter=+<src/gcode/feature/input_shaping>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue