ADVANCE_K per-extruder (#24821)

Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
This commit is contained in:
Giuliano Zaro
2022-10-10 20:49:37 +02:00
committed by Scott Lahteine
parent 8481264566
commit 0203e32c73
13 changed files with 68 additions and 52 deletions

View File

@ -2772,7 +2772,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/
#if ENABLED(LIN_ADVANCE)
case ADVANCED_LA:
if (draw) {
Draw_Menu_Item(row, ICON_MaxAccelerated, F("Lin Advance Kp"));
Draw_Menu_Item(row, ICON_MaxAccelerated, F("Lin Advance K"));
Draw_Float(planner.extruder_advance_K[0], row, false, 100);
}
else

View File

@ -712,17 +712,17 @@ namespace ExtUI {
#if ENABLED(POWER_LOSS_RECOVERY)
bool getPowerLossRecoveryEnabled() { return recovery.enabled; }
void setPowerLossRecoveryEnabled(const bool value) { recovery.enable(value); }
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;
return (extruder < EXTRUDERS) ? planner.extruder_advance_K[E_INDEX_N(extruder - E0)] : 0;
}
void setLinearAdvance_mm_mm_s(const_float_t value, const extruder_t extruder) {
if (extruder < EXTRUDERS)
planner.extruder_advance_K[extruder - E0] = constrain(value, 0, 10);
planner.extruder_advance_K[E_INDEX_N(extruder - E0)] = constrain(value, 0, 10);
}
#endif

View File

@ -109,9 +109,9 @@ void menu_backlash();
BACK_ITEM(MSG_ADVANCED_SETTINGS);
#if ENABLED(LIN_ADVANCE)
#if EXTRUDERS == 1
#if DISTINCT_E < 2
EDIT_ITEM(float42_52, MSG_ADVANCE_K, &planner.extruder_advance_K[0], 0, 10);
#elif HAS_MULTI_EXTRUDER
#else
EXTRUDER_LOOP()
EDIT_ITEM_N(float42_52, e, MSG_ADVANCE_K_E, &planner.extruder_advance_K[e], 0, 10);
#endif
@ -687,11 +687,11 @@ void menu_advanced_settings() {
#if DISABLED(NO_VOLUMETRICS) || ENABLED(ADVANCED_PAUSE_FEATURE)
SUBMENU(MSG_FILAMENT, menu_advanced_filament);
#elif ENABLED(LIN_ADVANCE)
#if EXTRUDERS == 1
#if DISTINCT_E < 2
EDIT_ITEM(float42_52, MSG_ADVANCE_K, &planner.extruder_advance_K[0], 0, 10);
#elif HAS_MULTI_EXTRUDER
LOOP_L_N(n, E_STEPPERS)
EDIT_ITEM_N(float42_52, n, MSG_ADVANCE_K_E, &planner.extruder_advance_K[n], 0, 10);
#else
EXTRUDER_LOOP()
EDIT_ITEM_N(float42_52, n, MSG_ADVANCE_K_E, &planner.extruder_advance_K[e], 0, 10);
#endif
#endif

View File

@ -210,9 +210,9 @@ void menu_tune() {
// Advance K:
//
#if ENABLED(LIN_ADVANCE) && DISABLED(SLIM_LCD_MENUS)
#if EXTRUDERS == 1
#if DISTINCT_E < 2
EDIT_ITEM(float42_52, MSG_ADVANCE_K, &planner.extruder_advance_K[0], 0, 10);
#elif HAS_MULTI_EXTRUDER
#else
EXTRUDER_LOOP()
EDIT_ITEM_N(float42_52, e, MSG_ADVANCE_K_E, &planner.extruder_advance_K[e], 0, 10);
#endif