1
0
mirror of https://github.com/MarlinFirmware/Marlin.git synced 2024-11-26 13:25:54 +00:00

🚸 EDITABLE_HOMING_FEEDRATE for ProUI (#27469)

This commit is contained in:
Andrew 2024-10-20 00:30:05 -04:00 committed by GitHub
parent 4c0e612376
commit 9192ae5213
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 134 additions and 49 deletions

View File

@ -36,13 +36,15 @@
//
#define MIN_FEEDRATE_EDIT_VALUE 1
constexpr xyze_float_t min_feedrate_edit_values = LOGICAL_AXIS_ARRAY_1(MIN_FEEDRATE_EDIT_VALUE),
default_max_feedrate = DEFAULT_MAX_FEEDRATE,
max_feedrate_edit_values =
constexpr xyze_feedrate_t min_feedrate_edit_values = LOGICAL_AXIS_ARRAY_1(MIN_FEEDRATE_EDIT_VALUE);
#if !defined(MAX_FEEDRATE_EDIT_VALUES) && defined(DEFAULT_MAX_MULTIPLIER)
constexpr xyze_feedrate_t default_max_feedrate = DEFAULT_MAX_FEEDRATE;
#endif
constexpr xyze_feedrate_t max_feedrate_edit_values =
#ifdef MAX_FEEDRATE_EDIT_VALUES
MAX_FEEDRATE_EDIT_VALUES
#else
default_max_feedrate * float(DEFAULT_MAX_MULTIPLIER)
default_max_feedrate * DEFAULT_MAX_MULTIPLIER
#endif
;
@ -51,35 +53,39 @@ constexpr xyze_float_t min_feedrate_edit_values = LOGICAL_AXIS_ARRAY_1(MIN_FEEDR
//
#define MIN_ACCELERATION_EDIT_VALUE 1
constexpr xyze_float_t min_acceleration_edit_values = LOGICAL_AXIS_ARRAY_1(MIN_ACCELERATION_EDIT_VALUE),
default_max_acceleration = DEFAULT_MAX_ACCELERATION,
max_acceleration_edit_values =
#ifdef MAX_ACCEL_EDIT_VALUES
MAX_ACCEL_EDIT_VALUES
#else
default_max_acceleration * float(DEFAULT_MAX_MULTIPLIER)
#endif
;
constexpr xyze_float_t min_acceleration_edit_values = LOGICAL_AXIS_ARRAY_1(MIN_ACCELERATION_EDIT_VALUE);
#if !defined(MAX_ACCEL_EDIT_VALUES) && defined(DEFAULT_MAX_MULTIPLIER)
constexpr xyze_float_t default_max_acceleration = DEFAULT_MAX_ACCELERATION;
#endif
constexpr xyze_float_t max_acceleration_edit_values =
#ifdef MAX_ACCEL_EDIT_VALUES
MAX_ACCEL_EDIT_VALUES
#else
default_max_acceleration * DEFAULT_MAX_MULTIPLIER
#endif
;
//
// Max jerk limits
// Max Jerk limits
//
#define MIN_JERK_EDIT_VALUE 0.1
#define DEFAULT_MAX_JERK_MULTIPLIER 2
#if ENABLED(CLASSIC_JERK)
constexpr xyze_float_t min_jerk_edit_values = LOGICAL_AXIS_ARRAY_1(MIN_JERK_EDIT_VALUE),
default_jerk = LOGICAL_AXIS_ARRAY(
DEFAULT_EJERK,
DEFAULT_XJERK, DEFAULT_YJERK, DEFAULT_ZJERK,
DEFAULT_IJERK, DEFAULT_JJERK, DEFAULT_KJERK,
DEFAULT_UJERK, DEFAULT_VJERK, DEFAULT_WJERK
),
max_jerk_edit_values =
#define MIN_JERK_EDIT_VALUE 0.1
constexpr xyze_float_t min_jerk_edit_values = LOGICAL_AXIS_ARRAY_1(MIN_JERK_EDIT_VALUE);
#if !defined(MAX_JERK_EDIT_VALUES) && defined(DEFAULT_MAX_MULTIPLIER)
#define DEFAULT_MAX_JERK_MULTIPLIER 2
constexpr xyze_float_t default_jerk = LOGICAL_AXIS_ARRAY(
DEFAULT_EJERK,
DEFAULT_XJERK, DEFAULT_YJERK, DEFAULT_ZJERK,
DEFAULT_IJERK, DEFAULT_JJERK, DEFAULT_KJERK,
DEFAULT_UJERK, DEFAULT_VJERK, DEFAULT_WJERK
);
#endif
constexpr xyze_float_t max_jerk_edit_values =
#ifdef MAX_JERK_EDIT_VALUES
MAX_JERK_EDIT_VALUES
#else
default_jerk * float(DEFAULT_MAX_JERK_MULTIPLIER)
default_jerk * DEFAULT_MAX_JERK_MULTIPLIER
#endif
;
#endif
@ -89,12 +95,33 @@ constexpr xyze_float_t min_acceleration_edit_values = LOGICAL_AXIS_ARRAY_1(MIN_A
//
#define MIN_STEPS_EDIT_VALUE 1
constexpr xyze_float_t min_steps_edit_values = LOGICAL_AXIS_ARRAY_1(MIN_STEPS_EDIT_VALUE),
default_steps = DEFAULT_AXIS_STEPS_PER_UNIT,
max_steps_edit_values =
constexpr xyze_float_t min_steps_edit_values = LOGICAL_AXIS_ARRAY_1(MIN_STEPS_EDIT_VALUE);
#if !defined(MAX_STEPS_EDIT_VALUES) && defined(DEFAULT_MAX_MULTIPLIER)
constexpr xyze_float_t default_steps = DEFAULT_AXIS_STEPS_PER_UNIT;
#endif
constexpr xyze_float_t max_steps_edit_values =
#ifdef MAX_STEPS_EDIT_VALUES
MAX_STEPS_EDIT_VALUES
#else
default_steps * float(DEFAULT_MAX_MULTIPLIER)
default_steps * DEFAULT_MAX_MULTIPLIER
#endif
;
//
// Homing Feedrate limits
//
#if ENABLED(EDITABLE_HOMING_FEEDRATE)
#define MIN_HOMING_EDIT_VALUE 1
constexpr xyz_uint_t min_homing_edit_values = NUM_AXIS_ARRAY_1(MIN_HOMING_EDIT_VALUE);
#ifdef DEFAULT_MAX_MULTIPLIER
constexpr xyz_uint_t default_homing = HOMING_FEEDRATE_MM_M;
#endif
constexpr xyz_uint_t max_homing_edit_values =
#ifdef DEFAULT_MAX_MULTIPLIER
default_homing * DEFAULT_MAX_MULTIPLIER
#else
{ 10000, 10000, 3000 }
#endif
;
#endif

View File

@ -270,6 +270,9 @@ Menu *stepsMenu = nullptr;
#if ENABLED(INDIVIDUAL_AXIS_HOMING_SUBMENU)
Menu *homingMenu = nullptr;
#endif
#if ENABLED(EDITABLE_HOMING_FEEDRATE)
Menu *homingFRMenu = nullptr;
#endif
#if ENABLED(FWRETRACT)
Menu *fwRetractMenu = nullptr;
#endif
@ -2598,13 +2601,13 @@ void setFlow() { setPIntOnClick(FLOW_EDIT_MIN, FLOW_EDIT_MAX, []{ planner.refres
void applyMaxSpeed() { planner.set_max_feedrate(hmiValue.axis, menuData.value / MINUNITMULT); }
#if HAS_X_AXIS
void setMaxSpeedX() { hmiValue.axis = X_AXIS, setFloatOnClick(min_feedrate_edit_values.x, max_feedrate_edit_values.x, UNITFDIGITS, planner.settings.max_feedrate_mm_s[X_AXIS], applyMaxSpeed); }
void setMaxSpeedX() { hmiValue.axis = X_AXIS; setFloatOnClick(min_feedrate_edit_values.x, max_feedrate_edit_values.x, UNITFDIGITS, planner.settings.max_feedrate_mm_s[X_AXIS], applyMaxSpeed); }
#endif
#if HAS_Y_AXIS
void setMaxSpeedY() { hmiValue.axis = Y_AXIS, setFloatOnClick(min_feedrate_edit_values.y, max_feedrate_edit_values.y, UNITFDIGITS, planner.settings.max_feedrate_mm_s[Y_AXIS], applyMaxSpeed); }
void setMaxSpeedY() { hmiValue.axis = Y_AXIS; setFloatOnClick(min_feedrate_edit_values.y, max_feedrate_edit_values.y, UNITFDIGITS, planner.settings.max_feedrate_mm_s[Y_AXIS], applyMaxSpeed); }
#endif
#if HAS_Z_AXIS
void setMaxSpeedZ() { hmiValue.axis = Z_AXIS, setFloatOnClick(min_feedrate_edit_values.z, max_feedrate_edit_values.z, UNITFDIGITS, planner.settings.max_feedrate_mm_s[Z_AXIS], applyMaxSpeed); }
void setMaxSpeedZ() { hmiValue.axis = Z_AXIS; setFloatOnClick(min_feedrate_edit_values.z, max_feedrate_edit_values.z, UNITFDIGITS, planner.settings.max_feedrate_mm_s[Z_AXIS], applyMaxSpeed); }
#endif
#if HAS_HOTEND
void setMaxSpeedE() { hmiValue.axis = E_AXIS; setFloatOnClick(min_feedrate_edit_values.e, max_feedrate_edit_values.e, UNITFDIGITS, planner.settings.max_feedrate_mm_s[E_AXIS], applyMaxSpeed); }
@ -2612,13 +2615,13 @@ void applyMaxSpeed() { planner.set_max_feedrate(hmiValue.axis, menuData.value /
void applyMaxAccel() { planner.set_max_acceleration(hmiValue.axis, menuData.value); }
#if HAS_X_AXIS
void setMaxAccelX() { hmiValue.axis = X_AXIS, setIntOnClick(min_acceleration_edit_values.x, max_acceleration_edit_values.x, planner.settings.max_acceleration_mm_per_s2[X_AXIS], applyMaxAccel); }
void setMaxAccelX() { hmiValue.axis = X_AXIS; setIntOnClick(min_acceleration_edit_values.x, max_acceleration_edit_values.x, planner.settings.max_acceleration_mm_per_s2[X_AXIS], applyMaxAccel); }
#endif
#if HAS_Y_AXIS
void setMaxAccelY() { hmiValue.axis = Y_AXIS, setIntOnClick(min_acceleration_edit_values.y, max_acceleration_edit_values.y, planner.settings.max_acceleration_mm_per_s2[Y_AXIS], applyMaxAccel); }
void setMaxAccelY() { hmiValue.axis = Y_AXIS; setIntOnClick(min_acceleration_edit_values.y, max_acceleration_edit_values.y, planner.settings.max_acceleration_mm_per_s2[Y_AXIS], applyMaxAccel); }
#endif
#if HAS_Z_AXIS
void setMaxAccelZ() { hmiValue.axis = Z_AXIS, setIntOnClick(min_acceleration_edit_values.z, max_acceleration_edit_values.z, planner.settings.max_acceleration_mm_per_s2[Z_AXIS], applyMaxAccel); }
void setMaxAccelZ() { hmiValue.axis = Z_AXIS; setIntOnClick(min_acceleration_edit_values.z, max_acceleration_edit_values.z, planner.settings.max_acceleration_mm_per_s2[Z_AXIS], applyMaxAccel); }
#endif
#if HAS_HOTEND
void setMaxAccelE() { hmiValue.axis = E_AXIS; setIntOnClick(min_acceleration_edit_values.e, max_acceleration_edit_values.e, planner.settings.max_acceleration_mm_per_s2[E_AXIS], applyMaxAccel); }
@ -2627,13 +2630,13 @@ void applyMaxAccel() { planner.set_max_acceleration(hmiValue.axis, menuData.valu
#if ENABLED(CLASSIC_JERK)
void applyMaxJerk() { planner.set_max_jerk(hmiValue.axis, menuData.value / MINUNITMULT); }
#if HAS_X_AXIS
void setMaxJerkX() { hmiValue.axis = X_AXIS, setFloatOnClick(min_jerk_edit_values.x, max_jerk_edit_values.x, UNITFDIGITS, planner.max_jerk.x, applyMaxJerk); }
void setMaxJerkX() { hmiValue.axis = X_AXIS; setFloatOnClick(min_jerk_edit_values.x, max_jerk_edit_values.x, UNITFDIGITS, planner.max_jerk.x, applyMaxJerk); }
#endif
#if HAS_Y_AXIS
void setMaxJerkY() { hmiValue.axis = Y_AXIS, setFloatOnClick(min_jerk_edit_values.y, max_jerk_edit_values.y, UNITFDIGITS, planner.max_jerk.y, applyMaxJerk); }
void setMaxJerkY() { hmiValue.axis = Y_AXIS; setFloatOnClick(min_jerk_edit_values.y, max_jerk_edit_values.y, UNITFDIGITS, planner.max_jerk.y, applyMaxJerk); }
#endif
#if HAS_Z_AXIS
void setMaxJerkZ() { hmiValue.axis = Z_AXIS, setFloatOnClick(min_jerk_edit_values.z, max_jerk_edit_values.z, UNITFDIGITS, planner.max_jerk.z, applyMaxJerk); }
void setMaxJerkZ() { hmiValue.axis = Z_AXIS; setFloatOnClick(min_jerk_edit_values.z, max_jerk_edit_values.z, UNITFDIGITS, planner.max_jerk.z, applyMaxJerk); }
#endif
#if HAS_HOTEND
void setMaxJerkE() { hmiValue.axis = E_AXIS; setFloatOnClick(min_jerk_edit_values.e, max_jerk_edit_values.e, UNITFDIGITS, planner.max_jerk.e, applyMaxJerk); }
@ -2648,17 +2651,39 @@ void applyMaxAccel() { planner.set_max_acceleration(hmiValue.axis, menuData.valu
#endif
#if HAS_X_AXIS
void setStepsX() { hmiValue.axis = X_AXIS, setPFloatOnClick( min_steps_edit_values.x, max_steps_edit_values.x, UNITFDIGITS); }
void setStepsX() { hmiValue.axis = X_AXIS; setPFloatOnClick( min_steps_edit_values.x, max_steps_edit_values.x, UNITFDIGITS); }
#endif
#if HAS_Y_AXIS
void setStepsY() { hmiValue.axis = Y_AXIS, setPFloatOnClick( min_steps_edit_values.y, max_steps_edit_values.y, UNITFDIGITS); }
void setStepsY() { hmiValue.axis = Y_AXIS; setPFloatOnClick( min_steps_edit_values.y, max_steps_edit_values.y, UNITFDIGITS); }
#endif
#if HAS_Z_AXIS
void setStepsZ() { hmiValue.axis = Z_AXIS, setPFloatOnClick( min_steps_edit_values.z, max_steps_edit_values.z, UNITFDIGITS); }
void setStepsZ() { hmiValue.axis = Z_AXIS; setPFloatOnClick( min_steps_edit_values.z, max_steps_edit_values.z, UNITFDIGITS); }
#endif
#if HAS_HOTEND
void setStepsE() { hmiValue.axis = E_AXIS; setPFloatOnClick( min_steps_edit_values.e, max_steps_edit_values.e, UNITFDIGITS); }
#endif
#if ENABLED(EDITABLE_HOMING_FEEDRATE)
void updateHomingFR(AxisEnum axis, feedRate_t value) {
switch (axis) {
case X_AXIS: homing_feedrate_mm_m.x = value; break;
case Y_AXIS: homing_feedrate_mm_m.y = value; break;
case Z_AXIS: homing_feedrate_mm_m.z = value; break;
default: break;
}
}
void applyHomingFR() { updateHomingFR(HMI_value.axis, MenuData.Value); }
#if HAS_X_AXIS
void setHomingX() { hmiValue.axis = X_AXIS; setIntOnClick(min_homing_edit_values.x, max_homing_edit_values.x, homing_feedrate_mm_m.x, applyHomingFR); }
#endif
#if HAS_Y_AXIS
void setHomingY() { hmiValue.axis = Y_AXIS; setIntOnClick(min_homing_edit_values.y, max_homing_edit_values.y, homing_feedrate_mm_m.x, applyHomingFR); }
#endif
#if HAS_Z_AXIS
void setHomingZ() { hmiValue.axis = Z_AXIS; setIntOnClick(min_homing_edit_values.z, max_homing_edit_values.z, homing_feedrate_mm_m.x, applyHomingFR); }
#endif
#endif
#if ENABLED(FWRETRACT)
void returnFWRetractMenu() { (previousMenu == filSetMenu) ? drawFilSetMenu() : drawTuneMenu(); }
void setRetractLength() { setPFloatOnClick( 0, 10, UNITFDIGITS); }
@ -3545,7 +3570,7 @@ void drawTuneMenu() {
void drawMotionMenu() {
checkkey = ID_Menu;
if (SET_MENU_R(motionMenu, selrect({1, 16, 28, 13}), MSG_MOTION, 10)) {
if (SET_MENU_R(motionMenu, selrect({1, 16, 28, 13}), MSG_MOTION, 11)) {
BACK_ITEM(drawControlMenu);
MENU_ITEM(ICON_MaxSpeed, MSG_SPEED, onDrawSpeed, drawMaxSpeedMenu);
MENU_ITEM(ICON_MaxAccelerated, MSG_ACCELERATION, onDrawAcc, drawMaxAccelMenu);
@ -3554,6 +3579,12 @@ void drawMotionMenu() {
#elif HAS_JUNCTION_DEVIATION
EDIT_ITEM(ICON_JDmm, MSG_JUNCTION_DEVIATION, onDrawPFloat3Menu, setJDmm, &planner.junction_deviation_mm);
#endif
#if ENABLED(EDITABLE_STEPS_PER_UNIT)
MENU_ITEM(ICON_Step, MSG_STEPS_PER_MM, onDrawSteps, drawStepsMenu);
#endif
#if ENABLED(EDITABLE_HOMING_FEEDRATE)
MENU_ITEM(ICON_Homing, MSG_HOMING_FEEDRATE, onDrawSubMenu, drawHomingFRMenu);
#endif
#if ENABLED(LIN_ADVANCE)
EDIT_ITEM(ICON_MaxAccelerated, MSG_ADVANCE_K, onDrawPFloat3Menu, setLA_K, &planner.extruder_advance_K[0]);
#endif
@ -3563,9 +3594,6 @@ void drawMotionMenu() {
#if ENABLED(ADAPTIVE_STEP_SMOOTHING_TOGGLE)
EDIT_ITEM(ICON_UBLActive, MSG_STEP_SMOOTHING, onDrawChkbMenu, setAdaptiveStepSmoothing, &stepper.adaptive_step_smoothing_enabled);
#endif
#if ENABLED(EDITABLE_STEPS_PER_UNIT)
MENU_ITEM(ICON_Step, MSG_STEPS_PER_MM, onDrawSteps, drawStepsMenu);
#endif
EDIT_ITEM(ICON_Flow, MSG_FLOW, onDrawPIntMenu, setFlow, &planner.flow_percentage[0]);
EDIT_ITEM(ICON_Speed, MSG_SPEED, onDrawPIntMenu, setSpeed, &feedrate_percentage);
}
@ -3764,6 +3792,30 @@ void drawMaxAccelMenu() {
#endif
#if ENABLED(EDITABLE_HOMING_FEEDRATE)
void drawHomingFRMenu() {
checkkey = ID_Menu;
if (SET_MENU(homingFRMenu, MSG_HOMING_FEEDRATE, 4)) {
BACK_ITEM(drawMotionMenu);
#if HAS_X_AXIS
static uint16_t xhome = static_cast<uint16_t>(homing_feedrate_mm_m.x);
EDIT_ITEM(ICON_MaxSpeedJerkX, MSG_HOMING_FEEDRATE_X, onDrawPIntMenu, setHomingX, &xhome);
#endif
#if HAS_Y_AXIS
static uint16_t yhome = static_cast<uint16_t>(homing_feedrate_mm_m.y);
EDIT_ITEM(ICON_MaxSpeedJerkY, MSG_HOMING_FEEDRATE_Y, onDrawPIntMenu, setHomingY, &yhome);
#endif
#if HAS_Z_AXIS
static uint16_t zhome = static_cast<uint16_t>(homing_feedrate_mm_m.z);
EDIT_ITEM(ICON_MaxSpeedJerkZ, MSG_HOMING_FEEDRATE_Z, onDrawPIntMenu, setHomingZ, &zhome);
#endif
}
updateMenu(homingFRMenu);
}
#endif
//=============================================================================
// UI editable custom colors
//=============================================================================

View File

@ -372,6 +372,9 @@ void drawMaxAccelMenu();
#if ENABLED(INDIVIDUAL_AXIS_HOMING_SUBMENU)
void drawHomingMenu();
#endif
#if ENABLED(EDITABLE_HOMING_FEEDRATE)
void drawHomingFRMenu();
#endif
#if ENABLED(FWRETRACT)
void drawFWRetractMenu();
#endif

View File

@ -390,14 +390,14 @@ CustomMenuItem** Menu::items() {
int8_t Menu::count() {
return MenuItemCount;
};
}
/* MenuItem Class ===========================================================*/
void CustomMenuItem::draw(int8_t line) {
if (line < 0 || line >= TROWS) return;
if (onDraw != nullptr) (*onDraw)(static_cast<MenuItem*>(this), line);
};
}
void CustomMenuItem::redraw(bool erase/*=false*/) {
const int8_t line = currentMenu->line(this->pos);
@ -436,7 +436,7 @@ void MenuItem::setFrame(uint8_t id, uint16_t x1, uint16_t y1, uint16_t x2, uint1
MenuItemPtr::MenuItemPtr(uint8_t cicon, const char * const text, OnDrawItem ondraw, OnClickItem onclick, void* val) : MenuItem(cicon, text, ondraw, onclick) {
value = val;
};
}
// Menu auxiliary functions ===================================================

View File

@ -1101,6 +1101,9 @@ namespace LanguageWide_en {
LSTR MSG_INFO_PRINT_LONGEST = _UxGT("Longest Job Time");
LSTR MSG_INFO_PRINT_FILAMENT = _UxGT("Extruded Total");
LSTR MSG_HOMING_FEEDRATE_N = _UxGT("@ Homing Feedrate");
LSTR MSG_HOMING_FEEDRATE_X = _UxGT("X Homing Feedrate");
LSTR MSG_HOMING_FEEDRATE_Y = _UxGT("Y Homing Feedrate");
LSTR MSG_HOMING_FEEDRATE_Z = _UxGT("Z Homing Feedrate");
LSTR MSG_EEPROM_INITIALIZED = _UxGT("Default Settings Restored");
#endif
}