Fix Ender 3 V2 DWIN manual move (#20837)

This commit is contained in:
Scott Lahteine 2021-01-24 20:13:02 -06:00
parent bed027f41f
commit 786bba39ff

View file

@ -132,8 +132,9 @@
#define FEEDRATE_E (60) #define FEEDRATE_E (60)
// Mininum unit (0.1) : multiple (10) // Minimum unit (0.1) : multiple (10)
#define MINUNITMULT 10 #define UNITFDIGITS 1
#define MINUNITMULT pow(10, UNITFDIGITS)
#define ENCODER_WAIT 20 #define ENCODER_WAIT 20
#define DWIN_SCROLL_UPDATE_INTERVAL 2000 #define DWIN_SCROLL_UPDATE_INTERVAL 2000
@ -1171,8 +1172,8 @@ void HMI_Move_X() {
} }
NOLESS(HMI_ValueStruct.Move_X_scale, (X_MIN_POS) * MINUNITMULT); NOLESS(HMI_ValueStruct.Move_X_scale, (X_MIN_POS) * MINUNITMULT);
NOMORE(HMI_ValueStruct.Move_X_scale, (X_MAX_POS) * MINUNITMULT); NOMORE(HMI_ValueStruct.Move_X_scale, (X_MAX_POS) * MINUNITMULT);
current_position.x = HMI_ValueStruct.Move_X_scale / 10; current_position.x = HMI_ValueStruct.Move_X_scale / MINUNITMULT;
DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Select_Color, 3, 1, 216, MBASE(1), HMI_ValueStruct.Move_X_scale); DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Select_Color, 3, UNITFDIGITS, 216, MBASE(1), HMI_ValueStruct.Move_X_scale);
DWIN_UpdateLCD(); DWIN_UpdateLCD();
} }
} }
@ -1194,8 +1195,8 @@ void HMI_Move_Y() {
} }
NOLESS(HMI_ValueStruct.Move_Y_scale, (Y_MIN_POS) * MINUNITMULT); NOLESS(HMI_ValueStruct.Move_Y_scale, (Y_MIN_POS) * MINUNITMULT);
NOMORE(HMI_ValueStruct.Move_Y_scale, (Y_MAX_POS) * MINUNITMULT); NOMORE(HMI_ValueStruct.Move_Y_scale, (Y_MAX_POS) * MINUNITMULT);
current_position.y = HMI_ValueStruct.Move_Y_scale / 10; current_position.y = HMI_ValueStruct.Move_Y_scale / MINUNITMULT;
DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Select_Color, 3, 1, 216, MBASE(2), HMI_ValueStruct.Move_Y_scale); DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Select_Color, 3, UNITFDIGITS, 216, MBASE(2), HMI_ValueStruct.Move_Y_scale);
DWIN_UpdateLCD(); DWIN_UpdateLCD();
} }
} }
@ -1206,7 +1207,7 @@ void HMI_Move_Z() {
if (Apply_Encoder(encoder_diffState, HMI_ValueStruct.Move_Z_scale)) { if (Apply_Encoder(encoder_diffState, HMI_ValueStruct.Move_Z_scale)) {
checkkey = AxisMove; checkkey = AxisMove;
EncoderRate.enabled = false; EncoderRate.enabled = false;
DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 1, 216, MBASE(3), HMI_ValueStruct.Move_Z_scale); DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, UNITFDIGITS, 216, MBASE(3), HMI_ValueStruct.Move_Z_scale);
if (!planner.is_full()) { if (!planner.is_full()) {
// Wait for planner moves to finish! // Wait for planner moves to finish!
planner.synchronize(); planner.synchronize();
@ -1217,8 +1218,8 @@ void HMI_Move_Z() {
} }
NOLESS(HMI_ValueStruct.Move_Z_scale, Z_MIN_POS * MINUNITMULT); NOLESS(HMI_ValueStruct.Move_Z_scale, Z_MIN_POS * MINUNITMULT);
NOMORE(HMI_ValueStruct.Move_Z_scale, Z_MAX_POS * MINUNITMULT); NOMORE(HMI_ValueStruct.Move_Z_scale, Z_MAX_POS * MINUNITMULT);
current_position.z = HMI_ValueStruct.Move_Z_scale / 10; current_position.z = HMI_ValueStruct.Move_Z_scale / MINUNITMULT;
DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Select_Color, 3, 1, 216, MBASE(3), HMI_ValueStruct.Move_Z_scale); DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Select_Color, 3, UNITFDIGITS, 216, MBASE(3), HMI_ValueStruct.Move_Z_scale);
DWIN_UpdateLCD(); DWIN_UpdateLCD();
} }
} }
@ -1233,7 +1234,7 @@ void HMI_Move_Z() {
checkkey = AxisMove; checkkey = AxisMove;
EncoderRate.enabled = false; EncoderRate.enabled = false;
last_E_scale = HMI_ValueStruct.Move_E_scale; last_E_scale = HMI_ValueStruct.Move_E_scale;
DWIN_Draw_Signed_Float(font8x16, Color_Bg_Black, 3, 1, 216, MBASE(4), HMI_ValueStruct.Move_E_scale); DWIN_Draw_Signed_Float(font8x16, Color_Bg_Black, 3, UNITFDIGITS, 216, MBASE(4), HMI_ValueStruct.Move_E_scale);
if (!planner.is_full()) { if (!planner.is_full()) {
planner.synchronize(); // Wait for planner moves to finish! planner.synchronize(); // Wait for planner moves to finish!
planner.buffer_line(current_position, MMM_TO_MMS(FEEDRATE_E), active_extruder); planner.buffer_line(current_position, MMM_TO_MMS(FEEDRATE_E), active_extruder);
@ -1245,8 +1246,8 @@ void HMI_Move_Z() {
HMI_ValueStruct.Move_E_scale = last_E_scale + (EXTRUDE_MAXLENGTH) * MINUNITMULT; HMI_ValueStruct.Move_E_scale = last_E_scale + (EXTRUDE_MAXLENGTH) * MINUNITMULT;
else if ((last_E_scale - HMI_ValueStruct.Move_E_scale) > (EXTRUDE_MAXLENGTH) * MINUNITMULT) else if ((last_E_scale - HMI_ValueStruct.Move_E_scale) > (EXTRUDE_MAXLENGTH) * MINUNITMULT)
HMI_ValueStruct.Move_E_scale = last_E_scale - (EXTRUDE_MAXLENGTH) * MINUNITMULT; HMI_ValueStruct.Move_E_scale = last_E_scale - (EXTRUDE_MAXLENGTH) * MINUNITMULT;
current_position.e = HMI_ValueStruct.Move_E_scale / 10; current_position.e = HMI_ValueStruct.Move_E_scale / MINUNITMULT;
DWIN_Draw_Signed_Float(font8x16, Select_Color, 3, 1, 216, MBASE(4), HMI_ValueStruct.Move_E_scale); DWIN_Draw_Signed_Float(font8x16, Select_Color, 3, UNITFDIGITS, 216, MBASE(4), HMI_ValueStruct.Move_E_scale);
DWIN_UpdateLCD(); DWIN_UpdateLCD();
} }
} }
@ -1503,7 +1504,7 @@ void HMI_MaxAccelerationXYZE() {
NOMORE(HMI_ValueStruct.Max_Jerk, default_max_jerk[HMI_flag.jerk_axis] * 2 * MINUNITMULT); NOMORE(HMI_ValueStruct.Max_Jerk, default_max_jerk[HMI_flag.jerk_axis] * 2 * MINUNITMULT);
NOLESS(HMI_ValueStruct.Max_Jerk, (MIN_MAXJERK) * MINUNITMULT); NOLESS(HMI_ValueStruct.Max_Jerk, (MIN_MAXJERK) * MINUNITMULT);
// MaxJerk value // MaxJerk value
DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Select_Color, 3, 1, 210, MBASE(select_jerk.now), HMI_ValueStruct.Max_Jerk); DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Select_Color, 3, UNITFDIGITS, 210, MBASE(select_jerk.now), HMI_ValueStruct.Max_Jerk);
} }
} }
@ -1525,7 +1526,7 @@ void HMI_StepXYZE() {
NOMORE(HMI_ValueStruct.Max_Step, 999.9 * MINUNITMULT); NOMORE(HMI_ValueStruct.Max_Step, 999.9 * MINUNITMULT);
NOLESS(HMI_ValueStruct.Max_Step, MIN_STEP); NOLESS(HMI_ValueStruct.Max_Step, MIN_STEP);
// Step value // Step value
DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Select_Color, 3, 1, 210, MBASE(select_step.now), HMI_ValueStruct.Max_Step); DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Select_Color, 3, UNITFDIGITS, 210, MBASE(select_step.now), HMI_ValueStruct.Max_Step);
} }
} }
@ -2317,13 +2318,12 @@ void HMI_Prepare() {
select_axis.reset(); select_axis.reset();
Draw_Move_Menu(); Draw_Move_Menu();
DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 1, 216, MBASE(1), current_position.x * MINUNITMULT); DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, UNITFDIGITS, 216, MBASE(1), current_position.x * MINUNITMULT);
DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 1, 216, MBASE(2), current_position.y * MINUNITMULT); DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, UNITFDIGITS, 216, MBASE(2), current_position.y * MINUNITMULT);
DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 1, 216, MBASE(3), current_position.z * MINUNITMULT); DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, UNITFDIGITS, 216, MBASE(3), current_position.z * MINUNITMULT);
#if HAS_HOTEND #if HAS_HOTEND
current_position.e = HMI_ValueStruct.Move_E_scale = 0.0; HMI_ValueStruct.Move_E_scale = current_position.e * MINUNITMULT;
sync_plan_position_e(); DWIN_Draw_Signed_Float(font8x16, Color_Bg_Black, 3, 1, 216, MBASE(4), HMI_ValueStruct.Move_E_scale);
DWIN_Draw_Signed_Float(font8x16, Color_Bg_Black, 3, 1, 216, MBASE(4), 0.0);
#endif #endif
break; break;
case PREPARE_CASE_DISA: // Disable steppers case PREPARE_CASE_DISA: // Disable steppers
@ -2573,8 +2573,7 @@ void HMI_AxisMove() {
if (HMI_flag.ETempTooLow_flag) { if (HMI_flag.ETempTooLow_flag) {
if (encoder_diffState == ENCODER_DIFF_ENTER) { if (encoder_diffState == ENCODER_DIFF_ENTER) {
HMI_flag.ETempTooLow_flag = false; HMI_flag.ETempTooLow_flag = false;
current_position.e = HMI_ValueStruct.Move_E_scale = 0; HMI_ValueStruct.Move_E_scale = current_position.e * MINUNITMULT;
sync_plan_position_e();
Draw_Move_Menu(); Draw_Move_Menu();
DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 1, 216, MBASE(1), HMI_ValueStruct.Move_X_scale); DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 1, 216, MBASE(1), HMI_ValueStruct.Move_X_scale);
DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 1, 216, MBASE(2), HMI_ValueStruct.Move_Y_scale); DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 1, 216, MBASE(2), HMI_ValueStruct.Move_Y_scale);
@ -3020,11 +3019,11 @@ inline void Draw_Max_Accel_Menu() {
Draw_Back_First(); Draw_Back_First();
LOOP_L_N(i, 3 + ENABLED(HAS_HOTEND)) Draw_Menu_Line(i + 1, ICON_MaxSpeedJerkX + i); LOOP_L_N(i, 3 + ENABLED(HAS_HOTEND)) Draw_Menu_Line(i + 1, ICON_MaxSpeedJerkX + i);
DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 1, 210, MBASE(1), planner.max_jerk[X_AXIS] * MINUNITMULT); DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, UNITFDIGITS, 210, MBASE(1), planner.max_jerk[X_AXIS] * MINUNITMULT);
DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 1, 210, MBASE(2), planner.max_jerk[Y_AXIS] * MINUNITMULT); DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, UNITFDIGITS, 210, MBASE(2), planner.max_jerk[Y_AXIS] * MINUNITMULT);
DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 1, 210, MBASE(3), planner.max_jerk[Z_AXIS] * MINUNITMULT); DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, UNITFDIGITS, 210, MBASE(3), planner.max_jerk[Z_AXIS] * MINUNITMULT);
#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, UNITFDIGITS, 210, MBASE(4), planner.max_jerk[E_AXIS] * MINUNITMULT);
#endif #endif
} }
#endif #endif
@ -3068,11 +3067,11 @@ inline void Draw_Steps_Menu() {
Draw_Back_First(); Draw_Back_First();
LOOP_L_N(i, 3 + ENABLED(HAS_HOTEND)) Draw_Menu_Line(i + 1, ICON_StepX + i); LOOP_L_N(i, 3 + ENABLED(HAS_HOTEND)) Draw_Menu_Line(i + 1, ICON_StepX + i);
DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 1, 210, MBASE(1), planner.settings.axis_steps_per_mm[X_AXIS] * MINUNITMULT); DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, UNITFDIGITS, 210, MBASE(1), planner.settings.axis_steps_per_mm[X_AXIS] * MINUNITMULT);
DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 1, 210, MBASE(2), planner.settings.axis_steps_per_mm[Y_AXIS] * MINUNITMULT); DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, UNITFDIGITS, 210, MBASE(2), planner.settings.axis_steps_per_mm[Y_AXIS] * MINUNITMULT);
DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 1, 210, MBASE(3), planner.settings.axis_steps_per_mm[Z_AXIS] * MINUNITMULT); DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, UNITFDIGITS, 210, MBASE(3), planner.settings.axis_steps_per_mm[Z_AXIS] * MINUNITMULT);
#if HAS_HOTEND #if HAS_HOTEND
DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 1, 210, MBASE(4), planner.settings.axis_steps_per_mm[E_AXIS] * MINUNITMULT); DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, UNITFDIGITS, 210, MBASE(4), planner.settings.axis_steps_per_mm[E_AXIS] * MINUNITMULT);
#endif #endif
} }
@ -3419,7 +3418,7 @@ void HMI_MaxAcceleration() {
checkkey = MaxJerk_value; checkkey = MaxJerk_value;
HMI_flag.jerk_axis = AxisEnum(select_jerk.now - 1); HMI_flag.jerk_axis = AxisEnum(select_jerk.now - 1);
HMI_ValueStruct.Max_Jerk = planner.max_jerk[HMI_flag.jerk_axis] * MINUNITMULT; HMI_ValueStruct.Max_Jerk = planner.max_jerk[HMI_flag.jerk_axis] * MINUNITMULT;
DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Select_Color, 3, 1, 210, MBASE(select_jerk.now), HMI_ValueStruct.Max_Jerk); DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Select_Color, 3, UNITFDIGITS, 210, MBASE(select_jerk.now), HMI_ValueStruct.Max_Jerk);
EncoderRate.enabled = true; EncoderRate.enabled = true;
} }
else { // Back else { // Back
@ -3449,7 +3448,7 @@ void HMI_Step() {
checkkey = Step_value; checkkey = Step_value;
HMI_flag.step_axis = AxisEnum(select_step.now - 1); HMI_flag.step_axis = AxisEnum(select_step.now - 1);
HMI_ValueStruct.Max_Step = planner.settings.axis_steps_per_mm[HMI_flag.step_axis] * MINUNITMULT; HMI_ValueStruct.Max_Step = planner.settings.axis_steps_per_mm[HMI_flag.step_axis] * MINUNITMULT;
DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Select_Color, 3, 1, 210, MBASE(select_step.now), HMI_ValueStruct.Max_Step); DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Select_Color, 3, UNITFDIGITS, 210, MBASE(select_step.now), HMI_ValueStruct.Max_Step);
EncoderRate.enabled = true; EncoderRate.enabled = true;
} }
else { // Back else { // Back