Skip to content

Commit

Permalink
🎨 Prefer axis element over index
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Dec 16, 2022
1 parent 7002e72 commit 379d388
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 33 deletions.
8 changes: 4 additions & 4 deletions Marlin/src/lcd/e3v2/creality/dwin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3395,11 +3395,11 @@ void Draw_Max_Accel_Menu() {

Draw_Back_First();
LOOP_L_N(i, 3 + ENABLED(HAS_HOTEND)) Draw_Menu_Line(i + 1, ICON_MaxSpeedJerkX + i);
Draw_Edit_Float3(1, planner.max_jerk[X_AXIS] * MINUNITMULT);
Draw_Edit_Float3(2, planner.max_jerk[Y_AXIS] * MINUNITMULT);
Draw_Edit_Float3(3, planner.max_jerk[Z_AXIS] * MINUNITMULT);
Draw_Edit_Float3(1, planner.max_jerk.x * MINUNITMULT);
Draw_Edit_Float3(2, planner.max_jerk.y * MINUNITMULT);
Draw_Edit_Float3(3, planner.max_jerk.z * MINUNITMULT);
#if HAS_HOTEND
Draw_Edit_Float3(4, planner.max_jerk[E_AXIS] * MINUNITMULT);
Draw_Edit_Float3(4, planner.max_jerk.e * MINUNITMULT);
#endif
}
#endif
Expand Down
16 changes: 8 additions & 8 deletions Marlin/src/lcd/e3v2/jyersui/dwin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2465,35 +2465,35 @@ void CrealityDWINClass::Menu_Item_Handler(uint8_t menu, uint8_t item, bool draw/
case JERK_X:
if (draw) {
Draw_Menu_Item(row, ICON_MaxSpeedJerkX, F("X Axis"));
Draw_Float(planner.max_jerk[X_AXIS], row, false, 10);
Draw_Float(planner.max_jerk.x, row, false, 10);
}
else
Modify_Value(planner.max_jerk[X_AXIS], 0, default_max_jerk[X_AXIS] * 2, 10);
Modify_Value(planner.max_jerk.x, 0, default_max_jerk[X_AXIS] * 2, 10);
break;
case JERK_Y:
if (draw) {
Draw_Menu_Item(row, ICON_MaxSpeedJerkY, F("Y Axis"));
Draw_Float(planner.max_jerk[Y_AXIS], row, false, 10);
Draw_Float(planner.max_jerk.y, row, false, 10);
}
else
Modify_Value(planner.max_jerk[Y_AXIS], 0, default_max_jerk[Y_AXIS] * 2, 10);
Modify_Value(planner.max_jerk.y, 0, default_max_jerk[Y_AXIS] * 2, 10);
break;
case JERK_Z:
if (draw) {
Draw_Menu_Item(row, ICON_MaxSpeedJerkZ, F("Z Axis"));
Draw_Float(planner.max_jerk[Z_AXIS], row, false, 10);
Draw_Float(planner.max_jerk.z, row, false, 10);
}
else
Modify_Value(planner.max_jerk[Z_AXIS], 0, default_max_jerk[Z_AXIS] * 2, 10);
Modify_Value(planner.max_jerk.z, 0, default_max_jerk[Z_AXIS] * 2, 10);
break;
#if HAS_HOTEND
case JERK_E:
if (draw) {
Draw_Menu_Item(row, ICON_MaxSpeedJerkE, F("Extruder"));
Draw_Float(planner.max_jerk[E_AXIS], row, false, 10);
Draw_Float(planner.max_jerk.e, row, false, 10);
}
else
Modify_Value(planner.max_jerk[E_AXIS], 0, default_max_jerk[E_AXIS] * 2, 10);
Modify_Value(planner.max_jerk.e, 0, default_max_jerk[E_AXIS] * 2, 10);
break;
#endif
}
Expand Down
16 changes: 8 additions & 8 deletions Marlin/src/lcd/e3v2/proui/dwin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2654,11 +2654,11 @@ void SetMaxAccelZ() { HMI_value.axis = Z_AXIS, SetIntOnClick(MIN_MAXACCELERATION

#if HAS_CLASSIC_JERK
void ApplyMaxJerk() { planner.set_max_jerk(HMI_value.axis, MenuData.Value / MINUNITMULT); }
void SetMaxJerkX() { HMI_value.axis = X_AXIS, SetFloatOnClick(MIN_MAXJERK, max_jerk_edit_values[X_AXIS], UNITFDIGITS, planner.max_jerk[X_AXIS], ApplyMaxJerk); }
void SetMaxJerkY() { HMI_value.axis = Y_AXIS, SetFloatOnClick(MIN_MAXJERK, max_jerk_edit_values[Y_AXIS], UNITFDIGITS, planner.max_jerk[Y_AXIS], ApplyMaxJerk); }
void SetMaxJerkZ() { HMI_value.axis = Z_AXIS, SetFloatOnClick(MIN_MAXJERK, max_jerk_edit_values[Z_AXIS], UNITFDIGITS, planner.max_jerk[Z_AXIS], ApplyMaxJerk); }
void SetMaxJerkX() { HMI_value.axis = X_AXIS, SetFloatOnClick(MIN_MAXJERK, max_jerk_edit_values[X_AXIS], UNITFDIGITS, planner.max_jerk.x, ApplyMaxJerk); }
void SetMaxJerkY() { HMI_value.axis = Y_AXIS, SetFloatOnClick(MIN_MAXJERK, max_jerk_edit_values[Y_AXIS], UNITFDIGITS, planner.max_jerk.y, ApplyMaxJerk); }
void SetMaxJerkZ() { HMI_value.axis = Z_AXIS, SetFloatOnClick(MIN_MAXJERK, max_jerk_edit_values[Z_AXIS], UNITFDIGITS, planner.max_jerk.z, ApplyMaxJerk); }
#if HAS_HOTEND
void SetMaxJerkE() { HMI_value.axis = E_AXIS; SetFloatOnClick(MIN_MAXJERK, max_jerk_edit_values[E_AXIS], UNITFDIGITS, planner.max_jerk[E_AXIS], ApplyMaxJerk); }
void SetMaxJerkE() { HMI_value.axis = E_AXIS; SetFloatOnClick(MIN_MAXJERK, max_jerk_edit_values[E_AXIS], UNITFDIGITS, planner.max_jerk.e, ApplyMaxJerk); }
#endif
#endif

Expand Down Expand Up @@ -3641,11 +3641,11 @@ void Draw_MaxAccel_Menu() {
SetMenuTitle({1, 16, 28, 13}, GET_TEXT_F(MSG_JERK));
MenuItemsPrepare(5);
BACK_ITEM(Draw_Motion_Menu);
EDIT_ITEM_F(ICON_MaxSpeedJerkX, MSG_VA_JERK, onDrawMaxJerkX, SetMaxJerkX, &planner.max_jerk[X_AXIS]);
EDIT_ITEM_F(ICON_MaxSpeedJerkY, MSG_VB_JERK, onDrawMaxJerkY, SetMaxJerkY, &planner.max_jerk[Y_AXIS]);
EDIT_ITEM_F(ICON_MaxSpeedJerkZ, MSG_VC_JERK, onDrawMaxJerkZ, SetMaxJerkZ, &planner.max_jerk[Z_AXIS]);
EDIT_ITEM_F(ICON_MaxSpeedJerkX, MSG_VA_JERK, onDrawMaxJerkX, SetMaxJerkX, &planner.max_jerk.x);
EDIT_ITEM_F(ICON_MaxSpeedJerkY, MSG_VB_JERK, onDrawMaxJerkY, SetMaxJerkY, &planner.max_jerk.y);
EDIT_ITEM_F(ICON_MaxSpeedJerkZ, MSG_VC_JERK, onDrawMaxJerkZ, SetMaxJerkZ, &planner.max_jerk.z);
#if HAS_HOTEND
EDIT_ITEM_F(ICON_MaxSpeedJerkE, MSG_VE_JERK, onDrawMaxJerkE, SetMaxJerkE, &planner.max_jerk[E_AXIS]);
EDIT_ITEM_F(ICON_MaxSpeedJerkE, MSG_VE_JERK, onDrawMaxJerkE, SetMaxJerkE, &planner.max_jerk.e);
#endif
}
CurrentMenu->draw();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ bool BaseMoveAxisScreen::onTouchHeld(uint8_t tag) {

void BaseMoveAxisScreen::raiseZtoTop() {
constexpr xyze_feedrate_t homing_feedrate = HOMING_FEEDRATE_MM_M;
setAxisPosition_mm(Z_MAX_POS - 5, Z, homing_feedrate[Z_AXIS]);
setAxisPosition_mm(Z_MAX_POS - 5, Z, homing_feedrate.z);
}

float BaseMoveAxisScreen::getManualFeedrate(uint8_t axis, float increment_mm) {
Expand Down
8 changes: 4 additions & 4 deletions Marlin/src/lcd/extui/mks_ui/draw_jerk_settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,16 +74,16 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) {
void lv_draw_jerk_settings() {
scr = lv_screen_create(JERK_UI, machine_menu.JerkConfTitle);

dtostrf(planner.max_jerk[X_AXIS], 1, 1, public_buf_l);
dtostrf(planner.max_jerk.x, 1, 1, public_buf_l);
lv_screen_menu_item_1_edit(scr, machine_menu.X_Jerk, PARA_UI_POS_X, PARA_UI_POS_Y, event_handler, ID_JERK_X, 0, public_buf_l);

dtostrf(planner.max_jerk[Y_AXIS], 1, 1, public_buf_l);
dtostrf(planner.max_jerk.y, 1, 1, public_buf_l);
lv_screen_menu_item_1_edit(scr, machine_menu.Y_Jerk, PARA_UI_POS_X, PARA_UI_POS_Y * 2, event_handler, ID_JERK_Y, 1, public_buf_l);

dtostrf(planner.max_jerk[Z_AXIS], 1, 1, public_buf_l);
dtostrf(planner.max_jerk.z, 1, 1, public_buf_l);
lv_screen_menu_item_1_edit(scr, machine_menu.Z_Jerk, PARA_UI_POS_X, PARA_UI_POS_Y * 3, event_handler, ID_JERK_Z, 2, public_buf_l);

dtostrf(planner.max_jerk[E_AXIS], 1, 1, public_buf_l);
dtostrf(planner.max_jerk.e, 1, 1, public_buf_l);
lv_screen_menu_item_1_edit(scr, machine_menu.E_Jerk, PARA_UI_POS_X, PARA_UI_POS_Y * 4, event_handler, ID_JERK_E, 3, public_buf_l);

lv_big_button_create(scr, "F:/bmp_back70x40.bin", common_menu.text_back, PARA_UI_BACK_POS_X, PARA_UI_BACK_POS_Y, event_handler, ID_JERK_RETURN, true);
Expand Down
16 changes: 8 additions & 8 deletions Marlin/src/lcd/extui/mks_ui/draw_number_key.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,22 +119,22 @@ static void disp_key_value() {

case XJerk:
#if HAS_CLASSIC_JERK
dtostrf(planner.max_jerk[X_AXIS], 1, 1, public_buf_m);
dtostrf(planner.max_jerk.x, 1, 1, public_buf_m);
#endif
break;
case YJerk:
#if HAS_CLASSIC_JERK
dtostrf(planner.max_jerk[Y_AXIS], 1, 1, public_buf_m);
dtostrf(planner.max_jerk.y, 1, 1, public_buf_m);
#endif
break;
case ZJerk:
#if HAS_CLASSIC_JERK
dtostrf(planner.max_jerk[Z_AXIS], 1, 1, public_buf_m);
dtostrf(planner.max_jerk.z, 1, 1, public_buf_m);
#endif
break;
case EJerk:
#if HAS_CLASSIC_JERK
dtostrf(planner.max_jerk[E_AXIS], 1, 1, public_buf_m);
dtostrf(planner.max_jerk.e, 1, 1, public_buf_m);
#endif
break;

Expand Down Expand Up @@ -307,10 +307,10 @@ static void set_value_confirm() {
case ZMaxFeedRate: planner.settings.max_feedrate_mm_s[Z_AXIS] = atof(key_value); break;
case E0MaxFeedRate: planner.settings.max_feedrate_mm_s[E_AXIS] = atof(key_value); break;
case E1MaxFeedRate: planner.settings.max_feedrate_mm_s[E_AXIS_N(1)] = atof(key_value); break;
case XJerk: TERN_(HAS_CLASSIC_JERK, planner.max_jerk[X_AXIS] = atof(key_value)); break;
case YJerk: TERN_(HAS_CLASSIC_JERK, planner.max_jerk[Y_AXIS] = atof(key_value)); break;
case ZJerk: TERN_(HAS_CLASSIC_JERK, planner.max_jerk[Z_AXIS] = atof(key_value)); break;
case EJerk: TERN_(HAS_CLASSIC_JERK, planner.max_jerk[E_AXIS] = atof(key_value)); break;
case XJerk: TERN_(HAS_CLASSIC_JERK, planner.max_jerk.x = atof(key_value)); break;
case YJerk: TERN_(HAS_CLASSIC_JERK, planner.max_jerk.y = atof(key_value)); break;
case ZJerk: TERN_(HAS_CLASSIC_JERK, planner.max_jerk.z = atof(key_value)); break;
case EJerk: TERN_(HAS_CLASSIC_JERK, planner.max_jerk.e = atof(key_value)); break;
case Xstep: planner.settings.axis_steps_per_mm[X_AXIS] = atof(key_value); planner.refresh_positioning(); break;
case Ystep: planner.settings.axis_steps_per_mm[Y_AXIS] = atof(key_value); planner.refresh_positioning(); break;
case Zstep: planner.settings.axis_steps_per_mm[Z_AXIS] = atof(key_value); planner.refresh_positioning(); break;
Expand Down

0 comments on commit 379d388

Please sign in to comment.