Fix E3V2 DWIN Jerk Menu (#20352)

* Fix E3V2 DWIN build without CLASSIC_JERK
* Fix jerk edits applying to wrong index
This commit is contained in:
Jason Smith 2020-12-02 01:31:06 -08:00 committed by Scott Lahteine
parent f42d15437b
commit 1c695e130e
2 changed files with 82 additions and 69 deletions

View File

@ -185,7 +185,10 @@ bool dwin_abort_flag = false; // Flag to reset feedrate, return to Home
constexpr float default_max_feedrate[] = DEFAULT_MAX_FEEDRATE; constexpr float default_max_feedrate[] = DEFAULT_MAX_FEEDRATE;
constexpr float default_max_acceleration[] = DEFAULT_MAX_ACCELERATION; constexpr float default_max_acceleration[] = DEFAULT_MAX_ACCELERATION;
constexpr float default_max_jerk[] = { DEFAULT_XJERK, DEFAULT_YJERK, DEFAULT_ZJERK, DEFAULT_EJERK };
#if HAS_CLASSIC_JERK
constexpr float default_max_jerk[] = { DEFAULT_XJERK, DEFAULT_YJERK, DEFAULT_ZJERK, DEFAULT_EJERK };
#endif
uint8_t Percentrecord = 0; uint8_t Percentrecord = 0;
uint16_t remain_time = 0; uint16_t remain_time = 0;
@ -1492,8 +1495,8 @@ void HMI_MaxAccelerationXYZE() {
if (Apply_Encoder(encoder_diffState, HMI_ValueStruct.Max_Jerk)) { if (Apply_Encoder(encoder_diffState, HMI_ValueStruct.Max_Jerk)) {
checkkey = MaxJerk; checkkey = MaxJerk;
EncoderRate.enabled = false; EncoderRate.enabled = false;
if (WITHIN(HMI_flag.step_axis, X_AXIS, E_AXIS)) if (WITHIN(HMI_flag.jerk_axis, X_AXIS, E_AXIS))
planner.set_max_jerk(HMI_flag.step_axis, HMI_ValueStruct.Max_Jerk / 10); planner.set_max_jerk(HMI_flag.jerk_axis, HMI_ValueStruct.Max_Jerk / 10);
DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 1, 210, MBASE(select_jerk.now), HMI_ValueStruct.Max_Jerk); DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 1, 210, MBASE(select_jerk.now), HMI_ValueStruct.Max_Jerk);
return; return;
} }
@ -2955,7 +2958,8 @@ inline void Draw_Max_Accel_Menu() {
#endif #endif
} }
inline void Draw_Max_Jerk_Menu() { #if HAS_CLASSIC_JERK
inline void Draw_Max_Jerk_Menu() {
Clear_Main_Window(); Clear_Main_Window();
if (HMI_IsChinese()) { if (HMI_IsChinese()) {
@ -3023,7 +3027,8 @@ inline void Draw_Max_Jerk_Menu() {
#if HAS_HOTEND #if HAS_HOTEND
DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 1, 210, MBASE(4), planner.max_jerk[E_AXIS] * MINUNITMULT); DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 1, 210, MBASE(4), planner.max_jerk[E_AXIS] * MINUNITMULT);
#endif #endif
} }
#endif
inline void Draw_Steps_Menu() { inline void Draw_Steps_Menu() {
Clear_Main_Window(); Clear_Main_Window();
@ -3636,7 +3641,9 @@ void DWIN_HandleScreen() {
#endif #endif
case MaxSpeed: HMI_MaxSpeed(); break; case MaxSpeed: HMI_MaxSpeed(); break;
case MaxAcceleration: HMI_MaxAcceleration(); break; case MaxAcceleration: HMI_MaxAcceleration(); break;
#if HAS_CLASSIC_JERK
case MaxJerk: HMI_MaxJerk(); break; case MaxJerk: HMI_MaxJerk(); break;
#endif
case Step: HMI_Step(); break; case Step: HMI_Step(); break;
case Move_X: HMI_Move_X(); break; case Move_X: HMI_Move_X(); break;
case Move_Y: HMI_Move_Y(); break; case Move_Y: HMI_Move_Y(); break;
@ -3657,7 +3664,9 @@ void DWIN_HandleScreen() {
case PrintSpeed: HMI_PrintSpeed(); break; case PrintSpeed: HMI_PrintSpeed(); break;
case MaxSpeed_value: HMI_MaxFeedspeedXYZE(); break; case MaxSpeed_value: HMI_MaxFeedspeedXYZE(); break;
case MaxAcceleration_value: HMI_MaxAccelerationXYZE(); break; case MaxAcceleration_value: HMI_MaxAccelerationXYZE(); break;
#if HAS_CLASSIC_JERK
case MaxJerk_value: HMI_MaxJerkXYZE(); break; case MaxJerk_value: HMI_MaxJerkXYZE(); break;
#endif
case Step_value: HMI_StepXYZE(); break; case Step_value: HMI_StepXYZE(); break;
default: break; default: break;
} }

View File

@ -13,4 +13,8 @@ use_example_configs "Creality/Ender-3 V2"
opt_enable MARLIN_DEV_MODE opt_enable MARLIN_DEV_MODE
exec_test $1 $2 "Ender 3 v2" "$3" exec_test $1 $2 "Ender 3 v2" "$3"
use_example_configs "Creality/Ender-3 V2"
opt_disable CLASSIC_JERK
exec_test $1 $2 "Ender 3 v2 w/o CLASSIC_JERK" "$3"
restore_configs restore_configs