Minor E3 V2 dwin cleanup

This commit is contained in:
Scott Lahteine 2021-03-17 02:48:21 -05:00
parent 9823a37362
commit deaefbf1dc

View File

@ -1469,19 +1469,21 @@ void HMI_PrintSpeed() {
} }
} }
#define LAST_AXIS TERN(HAS_HOTEND, E_AXIS, Z_AXIS)
void HMI_MaxFeedspeedXYZE() { void HMI_MaxFeedspeedXYZE() {
ENCODER_DiffState encoder_diffState = Encoder_ReceiveAnalyze(); ENCODER_DiffState encoder_diffState = Encoder_ReceiveAnalyze();
if (encoder_diffState != ENCODER_DIFF_NO) { if (encoder_diffState != ENCODER_DIFF_NO) {
if (Apply_Encoder(encoder_diffState, HMI_ValueStruct.Max_Feedspeed)) { if (Apply_Encoder(encoder_diffState, HMI_ValueStruct.Max_Feedspeed)) {
checkkey = MaxSpeed; checkkey = MaxSpeed;
EncoderRate.enabled = false; EncoderRate.enabled = false;
if (WITHIN(HMI_flag.feedspeed_axis, X_AXIS, E_AXIS)) if (WITHIN(HMI_flag.feedspeed_axis, X_AXIS, LAST_AXIS))
planner.set_max_feedrate(HMI_flag.feedspeed_axis, HMI_ValueStruct.Max_Feedspeed); planner.set_max_feedrate(HMI_flag.feedspeed_axis, HMI_ValueStruct.Max_Feedspeed);
DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 4, 210, MBASE(select_speed.now), HMI_ValueStruct.Max_Feedspeed); DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 4, 210, MBASE(select_speed.now), HMI_ValueStruct.Max_Feedspeed);
return; return;
} }
// MaxFeedspeed limit // MaxFeedspeed limit
if (WITHIN(HMI_flag.feedspeed_axis, X_AXIS, E_AXIS)) if (WITHIN(HMI_flag.feedspeed_axis, X_AXIS, LAST_AXIS))
NOMORE(HMI_ValueStruct.Max_Feedspeed, default_max_feedrate[HMI_flag.feedspeed_axis] * 2); NOMORE(HMI_ValueStruct.Max_Feedspeed, default_max_feedrate[HMI_flag.feedspeed_axis] * 2);
if (HMI_ValueStruct.Max_Feedspeed < MIN_MAXFEEDSPEED) HMI_ValueStruct.Max_Feedspeed = MIN_MAXFEEDSPEED; if (HMI_ValueStruct.Max_Feedspeed < MIN_MAXFEEDSPEED) HMI_ValueStruct.Max_Feedspeed = MIN_MAXFEEDSPEED;
// MaxFeedspeed value // MaxFeedspeed value
@ -1495,17 +1497,13 @@ void HMI_MaxAccelerationXYZE() {
if (Apply_Encoder(encoder_diffState, HMI_ValueStruct.Max_Acceleration)) { if (Apply_Encoder(encoder_diffState, HMI_ValueStruct.Max_Acceleration)) {
checkkey = MaxAcceleration; checkkey = MaxAcceleration;
EncoderRate.enabled = false; EncoderRate.enabled = false;
if (HMI_flag.acc_axis == X_AXIS) planner.set_max_acceleration(X_AXIS, HMI_ValueStruct.Max_Acceleration); if (WITHIN(HMI_flag.acc_axis, X_AXIS, LAST_AXIS))
else if (HMI_flag.acc_axis == Y_AXIS) planner.set_max_acceleration(Y_AXIS, HMI_ValueStruct.Max_Acceleration); planner.set_max_acceleration(HMI_flag.acc_axis, HMI_ValueStruct.Max_Acceleration);
else if (HMI_flag.acc_axis == Z_AXIS) planner.set_max_acceleration(Z_AXIS, HMI_ValueStruct.Max_Acceleration);
#if HAS_HOTEND
else if (HMI_flag.acc_axis == E_AXIS) planner.set_max_acceleration(E_AXIS, HMI_ValueStruct.Max_Acceleration);
#endif
DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 4, 210, MBASE(select_acc.now), HMI_ValueStruct.Max_Acceleration); DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 4, 210, MBASE(select_acc.now), HMI_ValueStruct.Max_Acceleration);
return; return;
} }
// MaxAcceleration limit // MaxAcceleration limit
if (WITHIN(HMI_flag.acc_axis, X_AXIS, E_AXIS)) if (WITHIN(HMI_flag.acc_axis, X_AXIS, LAST_AXIS))
NOMORE(HMI_ValueStruct.Max_Acceleration, default_max_acceleration[HMI_flag.acc_axis] * 2); NOMORE(HMI_ValueStruct.Max_Acceleration, default_max_acceleration[HMI_flag.acc_axis] * 2);
if (HMI_ValueStruct.Max_Acceleration < MIN_MAXACCELERATION) HMI_ValueStruct.Max_Acceleration = MIN_MAXACCELERATION; if (HMI_ValueStruct.Max_Acceleration < MIN_MAXACCELERATION) HMI_ValueStruct.Max_Acceleration = MIN_MAXACCELERATION;
// MaxAcceleration value // MaxAcceleration value
@ -1521,13 +1519,13 @@ void HMI_MaxAccelerationXYZE() {
if (Apply_Encoder(encoder_diffState, HMI_ValueStruct.Max_Jerk_scaled)) { if (Apply_Encoder(encoder_diffState, HMI_ValueStruct.Max_Jerk_scaled)) {
checkkey = MaxJerk; checkkey = MaxJerk;
EncoderRate.enabled = false; EncoderRate.enabled = false;
if (WITHIN(HMI_flag.jerk_axis, X_AXIS, E_AXIS)) if (WITHIN(HMI_flag.jerk_axis, X_AXIS, LAST_AXIS))
planner.set_max_jerk(HMI_flag.jerk_axis, HMI_ValueStruct.Max_Jerk_scaled / 10); planner.set_max_jerk(HMI_flag.jerk_axis, HMI_ValueStruct.Max_Jerk_scaled / 10);
DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 1, 210, MBASE(select_jerk.now), HMI_ValueStruct.Max_Jerk_scaled); DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 1, 210, MBASE(select_jerk.now), HMI_ValueStruct.Max_Jerk_scaled);
return; return;
} }
// MaxJerk limit // MaxJerk limit
if (WITHIN(HMI_flag.jerk_axis, X_AXIS, E_AXIS)) if (WITHIN(HMI_flag.jerk_axis, X_AXIS, LAST_AXIS))
NOMORE(HMI_ValueStruct.Max_Jerk_scaled, default_max_jerk[HMI_flag.jerk_axis] * 2 * MINUNITMULT); NOMORE(HMI_ValueStruct.Max_Jerk_scaled, default_max_jerk[HMI_flag.jerk_axis] * 2 * MINUNITMULT);
NOLESS(HMI_ValueStruct.Max_Jerk_scaled, (MIN_MAXJERK) * MINUNITMULT); NOLESS(HMI_ValueStruct.Max_Jerk_scaled, (MIN_MAXJERK) * MINUNITMULT);
// MaxJerk value // MaxJerk value
@ -1543,13 +1541,13 @@ void HMI_StepXYZE() {
if (Apply_Encoder(encoder_diffState, HMI_ValueStruct.Max_Step_scaled)) { if (Apply_Encoder(encoder_diffState, HMI_ValueStruct.Max_Step_scaled)) {
checkkey = Step; checkkey = Step;
EncoderRate.enabled = false; EncoderRate.enabled = false;
if (WITHIN(HMI_flag.step_axis, X_AXIS, E_AXIS)) if (WITHIN(HMI_flag.step_axis, X_AXIS, LAST_AXIS))
planner.settings.axis_steps_per_mm[HMI_flag.step_axis] = HMI_ValueStruct.Max_Step_scaled / 10; planner.settings.axis_steps_per_mm[HMI_flag.step_axis] = HMI_ValueStruct.Max_Step_scaled / 10;
DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 1, 210, MBASE(select_step.now), HMI_ValueStruct.Max_Step_scaled); DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 1, 210, MBASE(select_step.now), HMI_ValueStruct.Max_Step_scaled);
return; return;
} }
// Step limit // Step limit
if (WITHIN(HMI_flag.step_axis, X_AXIS, E_AXIS)) if (WITHIN(HMI_flag.step_axis, X_AXIS, LAST_AXIS))
NOMORE(HMI_ValueStruct.Max_Step_scaled, 999.9 * MINUNITMULT); NOMORE(HMI_ValueStruct.Max_Step_scaled, 999.9 * MINUNITMULT);
NOLESS(HMI_ValueStruct.Max_Step_scaled, MIN_STEP); NOLESS(HMI_ValueStruct.Max_Step_scaled, MIN_STEP);
// Step value // Step value