Skip to content

Commit

Permalink
include proui
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Apr 1, 2023
1 parent e653fbd commit 7bab1ec
Show file tree
Hide file tree
Showing 3 changed files with 133 additions and 138 deletions.
83 changes: 46 additions & 37 deletions Marlin/src/lcd/e3v2/common/limits.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,62 +22,71 @@
#pragma once

/*****************************************************************************
* @file lcd/e3v2/common/limits.h
* @brief Limits for UI values
****************************************************************************/
* @file lcd/e3v2/common/limits.h
* @brief Limits for UI values
****************************************************************************/

#include "../../../inc/MarlinConfig.h"

// If max edit values are not specified use default *DEFAULT_MAX_MULTIPLIER
// If max edit values are not specified use default * DEFAULT_MAX_MULTIPLIER
#define DEFAULT_MAX_MULTIPLIER 2

//
// Feedrate limits

//
#define MIN_FEEDRATE_EDIT_VALUE 1

constexpr float min_feedrate_edit_values[] = { MIN_FEEDRATE_EDIT_VALUE, MIN_FEEDRATE_EDIT_VALUE, MIN_FEEDRATE_EDIT_VALUE, MIN_FEEDRATE_EDIT_VALUE };
constexpr float default_max_feedrate[] = DEFAULT_MAX_FEEDRATE;
constexpr float max_feedrate_edit_values[] =
#ifdef MAX_FEEDRATE_EDIT_VALUES
MAX_FEEDRATE_EDIT_VALUES
#else
{ default_max_feedrate[X_AXIS] * DEFAULT_MAX_MULTIPLIER, default_max_feedrate[Y_AXIS] * DEFAULT_MAX_MULTIPLIER, default_max_feedrate[Z_AXIS] * DEFAULT_MAX_MULTIPLIER, default_max_feedrate[E_AXIS] * DEFAULT_MAX_MULTIPLIER }
#endif
;
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 =
#ifdef MAX_FEEDRATE_EDIT_VALUES
MAX_FEEDRATE_EDIT_VALUES
#else
default_max_feedrate * DEFAULT_MAX_MULTIPLIER
#endif
;

//
// Acceleration limits

//
#define MIN_ACCELERATION_EDIT_VALUE 1

constexpr float min_acceleration_edit_values[] = { MIN_ACCELERATION_EDIT_VALUE, MIN_ACCELERATION_EDIT_VALUE, MIN_ACCELERATION_EDIT_VALUE, MIN_ACCELERATION_EDIT_VALUE };
constexpr float default_max_acceleration[] = DEFAULT_MAX_ACCELERATION;
constexpr float max_acceleration_edit_values[] =
#ifdef MAX_ACCEL_EDIT_VALUES
MAX_ACCEL_EDIT_VALUES
#else
{ default_max_acceleration[X_AXIS] * DEFAULT_MAX_MULTIPLIER, default_max_acceleration[Y_AXIS] * DEFAULT_MAX_MULTIPLIER, default_max_acceleration[Z_AXIS] * DEFAULT_MAX_MULTIPLIER, default_max_acceleration[E_AXIS] * DEFAULT_MAX_MULTIPLIER }
#endif
;
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 * DEFAULT_MAX_MULTIPLIER
#endif
;

//
// Max jerk limits

//
#define MIN_JERK_EDIT_VALUE 0.1

#if HAS_CLASSIC_JERK
constexpr float min_jerk_edit_values[] = { MIN_JERK_EDIT_VALUE, MIN_JERK_EDIT_VALUE, MIN_JERK_EDIT_VALUE, MIN_JERK_EDIT_VALUE };
constexpr float max_jerk_edit_values[] =
#ifdef MAX_JERK_EDIT_VALUES
MAX_JERK_EDIT_VALUES
#else
{ DEFAULT_XJERK * DEFAULT_MAX_MULTIPLIER, DEFAULT_YJERK * DEFAULT_MAX_MULTIPLIER, DEFAULT_ZJERK * DEFAULT_MAX_MULTIPLIER, DEFAULT_EJERK * DEFAULT_MAX_MULTIPLIER }
#endif
;
constexpr xyze_float_t min_jerk_edit_values = LOGICAL_AXIS_ARRAY_1(MIN_JERK_EDIT_VALUE),
max_jerk_edit_values =
#ifdef MAX_JERK_EDIT_VALUES
MAX_JERK_EDIT_VALUES
#else
xyze_float_t(LOGICAL_AXIS_ARRAY(
DEFAULT_EJERK,
DEFAULT_XJERK, DEFAULT_YJERK, DEFAULT_ZJERK,
DEFAULT_IJERK, DEFAULT_JJERK, DEFAULT_KJERK,
DEFAULT_UJERK, DEFAULT_VJERK, DEFAULT_WJERK
)) * DEFAULT_MAX_MULTIPLIER;
#endif
;
#endif

//
// Steps per mm limits

//
#define MIN_STEPS_EDIT_VALUE 1

constexpr float min_steps_edit_values[] = { MIN_STEPS_EDIT_VALUE, MIN_STEPS_EDIT_VALUE, MIN_STEPS_EDIT_VALUE, MIN_STEPS_EDIT_VALUE };
constexpr float default_steps[] = DEFAULT_AXIS_STEPS_PER_UNIT;
constexpr float max_steps_edit_values[] = { default_steps[X_AXIS] * DEFAULT_MAX_MULTIPLIER, default_steps[Y_AXIS] * DEFAULT_MAX_MULTIPLIER, default_steps[Z_AXIS] * DEFAULT_MAX_MULTIPLIER, default_steps[E_AXIS] * DEFAULT_MAX_MULTIPLIER };
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 = default_steps * DEFAULT_MAX_MULTIPLIER;
130 changes: 71 additions & 59 deletions Marlin/src/lcd/e3v2/jyersui/dwin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2360,7 +2360,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/
Draw_Float(planner.settings.max_feedrate_mm_s[X_AXIS], row, false, FEEDRATE_UNIT);
}
else
Modify_Value(planner.settings.max_feedrate_mm_s[X_AXIS], min_feedrate_edit_values[X_AXIS], max_feedrate_edit_values[X_AXIS], FEEDRATE_UNIT);
Modify_Value(planner.settings.max_feedrate_mm_s[X_AXIS], min_feedrate_edit_values.x, max_feedrate_edit_values.x, FEEDRATE_UNIT);
break;

#if HAS_Y_AXIS
Expand All @@ -2370,7 +2370,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/
Draw_Float(planner.settings.max_feedrate_mm_s[Y_AXIS], row, false, FEEDRATE_UNIT);
}
else
Modify_Value(planner.settings.max_feedrate_mm_s[Y_AXIS], min_feedrate_edit_values[Y_AXIS], max_feedrate_edit_values[Y_AXIS], FEEDRATE_UNIT);
Modify_Value(planner.settings.max_feedrate_mm_s[Y_AXIS], min_feedrate_edit_values.y, max_feedrate_edit_values.y, FEEDRATE_UNIT);
break;
#endif

Expand All @@ -2381,7 +2381,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/
Draw_Float(planner.settings.max_feedrate_mm_s[Z_AXIS], row, false, FEEDRATE_UNIT);
}
else
Modify_Value(planner.settings.max_feedrate_mm_s[Z_AXIS], min_feedrate_edit_values[Z_AXIS], max_feedrate_edit_values[Z_AXIS], FEEDRATE_UNIT);
Modify_Value(planner.settings.max_feedrate_mm_s[Z_AXIS], min_feedrate_edit_values.z, max_feedrate_edit_values.z, FEEDRATE_UNIT);
break;
#endif

Expand All @@ -2392,7 +2392,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/
Draw_Float(planner.settings.max_feedrate_mm_s[E_AXIS], row, false, FEEDRATE_UNIT);
}
else
Modify_Value(planner.settings.max_feedrate_mm_s[E_AXIS], min_feedrate_edit_values[E_AXIS], max_feedrate_edit_values[E_AXIS], FEEDRATE_UNIT);
Modify_Value(planner.settings.max_feedrate_mm_s[E_AXIS], min_feedrate_edit_values.e, max_feedrate_edit_values.e, FEEDRATE_UNIT);
break;
#endif
}
Expand Down Expand Up @@ -2420,23 +2420,23 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/
Draw_Float(planner.settings.max_acceleration_mm_per_s2[X_AXIS], row, false, ACCELERATION_UNIT);
}
else
Modify_Value(planner.settings.max_acceleration_mm_per_s2[X_AXIS], min_acceleration_edit_values[X_AXIS], max_acceleration_edit_values[X_AXIS], ACCELERATION_UNIT);
Modify_Value(planner.settings.max_acceleration_mm_per_s2[X_AXIS], min_acceleration_edit_values.x, max_acceleration_edit_values.x, ACCELERATION_UNIT);
break;
case ACCEL_Y:
if (draw) {
Draw_Menu_Item(row, ICON_MaxAccY, F("Y Axis"));
Draw_Float(planner.settings.max_acceleration_mm_per_s2[Y_AXIS], row, false, ACCELERATION_UNIT);
}
else
Modify_Value(planner.settings.max_acceleration_mm_per_s2[Y_AXIS], min_acceleration_edit_values[Y_AXIS], max_acceleration_edit_values[Y_AXIS], ACCELERATION_UNIT);
Modify_Value(planner.settings.max_acceleration_mm_per_s2[Y_AXIS], min_acceleration_edit_values.y, max_acceleration_edit_values.y, ACCELERATION_UNIT);
break;
case ACCEL_Z:
if (draw) {
Draw_Menu_Item(row, ICON_MaxAccZ, F("Z Axis"));
Draw_Float(planner.settings.max_acceleration_mm_per_s2[Z_AXIS], row, false, ACCELERATION_UNIT);
}
else
Modify_Value(planner.settings.max_acceleration_mm_per_s2[Z_AXIS], min_acceleration_edit_values[Z_AXIS], max_acceleration_edit_values[Z_AXIS], ACCELERATION_UNIT);
Modify_Value(planner.settings.max_acceleration_mm_per_s2[Z_AXIS], min_acceleration_edit_values.z, max_acceleration_edit_values.z, ACCELERATION_UNIT);
break;
#if HAS_HOTEND
case ACCEL_E:
Expand All @@ -2445,7 +2445,7 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/
Draw_Float(planner.settings.max_acceleration_mm_per_s2[E_AXIS], row, false, ACCELERATION_UNIT);
}
else
Modify_Value(planner.settings.max_acceleration_mm_per_s2[E_AXIS], min_acceleration_edit_values[E_AXIS], max_acceleration_edit_values[E_AXIS], ACCELERATION_UNIT);
Modify_Value(planner.settings.max_acceleration_mm_per_s2[E_AXIS], min_acceleration_edit_values.e, max_acceleration_edit_values.e, ACCELERATION_UNIT);
break;
#endif
}
Expand All @@ -2467,38 +2467,44 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/
else
Draw_Menu(Motion, MOTION_JERK);
break;
case JERK_X:
if (draw) {
Draw_Menu_Item(row, ICON_MaxSpeedJerkX, F("X Axis"));
Draw_Float(planner.max_jerk.x, row, false, JERK_UNIT);
}
else
Modify_Value(planner.max_jerk.x, min_jerk_edit_values[X_AXIS], max_jerk_edit_values[X_AXIS], JERK_UNIT);
break;
case JERK_Y:
if (draw) {
Draw_Menu_Item(row, ICON_MaxSpeedJerkY, F("Y Axis"));
Draw_Float(planner.max_jerk.y, row, false, JERK_UNIT);
}
else
Modify_Value(planner.max_jerk.y, min_jerk_edit_values[Y_AXIS], max_jerk_edit_values[Y_AXIS], JERK_UNIT);
break;
case JERK_Z:
if (draw) {
Draw_Menu_Item(row, ICON_MaxSpeedJerkZ, F("Z Axis"));
Draw_Float(planner.max_jerk.z, row, false, JERK_UNIT);
}
else
Modify_Value(planner.max_jerk.z, min_jerk_edit_values[Z_AXIS], max_jerk_edit_values[Z_AXIS], JERK_UNIT);
break;
#if HAS_X_AXIS
case JERK_X:
if (draw) {
Draw_Menu_Item(row, ICON_MaxSpeedJerkX, F("X Axis"));
Draw_Float(planner.max_jerk.x, row, false, JERK_UNIT);
}
else
Modify_Value(planner.max_jerk.x, min_jerk_edit_values.x, max_jerk_edit_values.x, JERK_UNIT);
break;
#endif
#if HAS_Y_AXIS
case JERK_Y:
if (draw) {
Draw_Menu_Item(row, ICON_MaxSpeedJerkY, F("Y Axis"));
Draw_Float(planner.max_jerk.y, row, false, JERK_UNIT);
}
else
Modify_Value(planner.max_jerk.y, min_jerk_edit_values.y, max_jerk_edit_values.y, JERK_UNIT);
break;
#endif
#if HAS_Z_AXIS
case JERK_Z:
if (draw) {
Draw_Menu_Item(row, ICON_MaxSpeedJerkZ, F("Z Axis"));
Draw_Float(planner.max_jerk.z, row, false, JERK_UNIT);
}
else
Modify_Value(planner.max_jerk.z, min_jerk_edit_values.z, max_jerk_edit_values.z, JERK_UNIT);
break;
#endif
#if HAS_HOTEND
case JERK_E:
if (draw) {
Draw_Menu_Item(row, ICON_MaxSpeedJerkE, F("Extruder"));
Draw_Float(planner.max_jerk.e, row, false, JERK_UNIT);
}
else
Modify_Value(planner.max_jerk.e, min_jerk_edit_values[E_AXIS], max_jerk_edit_values[E_AXIS], JERK_UNIT);
Modify_Value(planner.max_jerk.e, min_jerk_edit_values.e, max_jerk_edit_values.e, JERK_UNIT);
break;
#endif
}
Expand All @@ -2519,39 +2525,45 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/
Draw_Menu_Item(row, ICON_Back, F("Back"));
else
Draw_Menu(Motion, MOTION_STEPS);
break;
case STEPS_X:
if (draw) {
Draw_Menu_Item(row, ICON_StepX, F("X Axis"));
Draw_Float(planner.settings.axis_steps_per_mm[X_AXIS], row, false, STEPS_UNIT);
}
else
Modify_Value(planner.settings.axis_steps_per_mm[X_AXIS], min_steps_edit_values[X_AXIS], max_steps_edit_values[X_AXIS], STEPS_UNIT);
break;
case STEPS_Y:
if (draw) {
Draw_Menu_Item(row, ICON_StepY, F("Y Axis"));
Draw_Float(planner.settings.axis_steps_per_mm[Y_AXIS], row, false, STEPS_UNIT);
}
else
Modify_Value(planner.settings.axis_steps_per_mm[Y_AXIS], min_steps_edit_values[Y_AXIS], max_steps_edit_values[Y_AXIS], STEPS_UNIT);
break;
case STEPS_Z:
if (draw) {
Draw_Menu_Item(row, ICON_StepZ, F("Z Axis"));
Draw_Float(planner.settings.axis_steps_per_mm[Z_AXIS], row, false, STEPS_UNIT);
}
else
Modify_Value(planner.settings.axis_steps_per_mm[Z_AXIS], min_steps_edit_values[Z_AXIS], max_steps_edit_values[Z_AXIS], STEPS_UNIT);
break;
break;
#if HAS_X_AXIS
case STEPS_X:
if (draw) {
Draw_Menu_Item(row, ICON_StepX, F("X Axis"));
Draw_Float(planner.settings.axis_steps_per_mm[X_AXIS], row, false, STEPS_UNIT);
}
else
Modify_Value(planner.settings.axis_steps_per_mm[X_AXIS], min_steps_edit_values.x, max_steps_edit_values.x, STEPS_UNIT);
break;
#endif
#if HAS_Y_AXIS
case STEPS_Y:
if (draw) {
Draw_Menu_Item(row, ICON_StepY, F("Y Axis"));
Draw_Float(planner.settings.axis_steps_per_mm[Y_AXIS], row, false, STEPS_UNIT);
}
else
Modify_Value(planner.settings.axis_steps_per_mm[Y_AXIS], min_steps_edit_values.y, max_steps_edit_values.y, STEPS_UNIT);
break;
#endif
#if HAS_Z_AXIS
case STEPS_Z:
if (draw) {
Draw_Menu_Item(row, ICON_StepZ, F("Z Axis"));
Draw_Float(planner.settings.axis_steps_per_mm[Z_AXIS], row, false, STEPS_UNIT);
}
else
Modify_Value(planner.settings.axis_steps_per_mm[Z_AXIS], min_steps_edit_values.z, max_steps_edit_values.z, STEPS_UNIT);
break;
#endif
#if HAS_HOTEND
case STEPS_E:
if (draw) {
Draw_Menu_Item(row, ICON_StepE, F("Extruder"));
Draw_Float(planner.settings.axis_steps_per_mm[E_AXIS], row, false, STEPS_UNIT);
}
else
Modify_Value(planner.settings.axis_steps_per_mm[E_AXIS], min_steps_edit_values[E_AXIS], max_steps_edit_values[E_AXIS], STEPS_UNIT);
Modify_Value(planner.settings.axis_steps_per_mm[E_AXIS], min_steps_edit_values.e, max_steps_edit_values.e, STEPS_UNIT);
break;
#endif
}
Expand Down
Loading

0 comments on commit 7bab1ec

Please sign in to comment.