Pārlūkot izejas kodu

Minor E3 V2 dwin cleanup

Scott Lahteine 3 gadus atpakaļ
vecāks
revīzija
deaefbf1dc
1 mainītis faili ar 11 papildinājumiem un 13 dzēšanām
  1. 11
    13
      Marlin/src/lcd/dwin/e3v2/dwin.cpp

+ 11
- 13
Marlin/src/lcd/dwin/e3v2/dwin.cpp Parādīt failu

@@ -1469,19 +1469,21 @@ void HMI_PrintSpeed() {
1469 1469
   }
1470 1470
 }
1471 1471
 
1472
+#define LAST_AXIS TERN(HAS_HOTEND, E_AXIS, Z_AXIS)
1473
+
1472 1474
 void HMI_MaxFeedspeedXYZE() {
1473 1475
   ENCODER_DiffState encoder_diffState = Encoder_ReceiveAnalyze();
1474 1476
   if (encoder_diffState != ENCODER_DIFF_NO) {
1475 1477
     if (Apply_Encoder(encoder_diffState, HMI_ValueStruct.Max_Feedspeed)) {
1476 1478
       checkkey = MaxSpeed;
1477 1479
       EncoderRate.enabled = false;
1478
-      if (WITHIN(HMI_flag.feedspeed_axis, X_AXIS, E_AXIS))
1480
+      if (WITHIN(HMI_flag.feedspeed_axis, X_AXIS, LAST_AXIS))
1479 1481
         planner.set_max_feedrate(HMI_flag.feedspeed_axis, HMI_ValueStruct.Max_Feedspeed);
1480 1482
       DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 4, 210, MBASE(select_speed.now), HMI_ValueStruct.Max_Feedspeed);
1481 1483
       return;
1482 1484
     }
1483 1485
     // MaxFeedspeed limit
1484
-    if (WITHIN(HMI_flag.feedspeed_axis, X_AXIS, E_AXIS))
1486
+    if (WITHIN(HMI_flag.feedspeed_axis, X_AXIS, LAST_AXIS))
1485 1487
       NOMORE(HMI_ValueStruct.Max_Feedspeed, default_max_feedrate[HMI_flag.feedspeed_axis] * 2);
1486 1488
     if (HMI_ValueStruct.Max_Feedspeed < MIN_MAXFEEDSPEED) HMI_ValueStruct.Max_Feedspeed = MIN_MAXFEEDSPEED;
1487 1489
     // MaxFeedspeed value
@@ -1495,17 +1497,13 @@ void HMI_MaxAccelerationXYZE() {
1495 1497
     if (Apply_Encoder(encoder_diffState, HMI_ValueStruct.Max_Acceleration)) {
1496 1498
       checkkey = MaxAcceleration;
1497 1499
       EncoderRate.enabled = false;
1498
-      if (HMI_flag.acc_axis == X_AXIS) planner.set_max_acceleration(X_AXIS, HMI_ValueStruct.Max_Acceleration);
1499
-      else if (HMI_flag.acc_axis == Y_AXIS) planner.set_max_acceleration(Y_AXIS, HMI_ValueStruct.Max_Acceleration);
1500
-      else if (HMI_flag.acc_axis == Z_AXIS) planner.set_max_acceleration(Z_AXIS, HMI_ValueStruct.Max_Acceleration);
1501
-      #if HAS_HOTEND
1502
-        else if (HMI_flag.acc_axis == E_AXIS) planner.set_max_acceleration(E_AXIS, HMI_ValueStruct.Max_Acceleration);
1503
-      #endif
1500
+      if (WITHIN(HMI_flag.acc_axis, X_AXIS, LAST_AXIS))
1501
+        planner.set_max_acceleration(HMI_flag.acc_axis, HMI_ValueStruct.Max_Acceleration);
1504 1502
       DWIN_Draw_IntValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 4, 210, MBASE(select_acc.now), HMI_ValueStruct.Max_Acceleration);
1505 1503
       return;
1506 1504
     }
1507 1505
     // MaxAcceleration limit
1508
-    if (WITHIN(HMI_flag.acc_axis, X_AXIS, E_AXIS))
1506
+    if (WITHIN(HMI_flag.acc_axis, X_AXIS, LAST_AXIS))
1509 1507
       NOMORE(HMI_ValueStruct.Max_Acceleration, default_max_acceleration[HMI_flag.acc_axis] * 2);
1510 1508
     if (HMI_ValueStruct.Max_Acceleration < MIN_MAXACCELERATION) HMI_ValueStruct.Max_Acceleration = MIN_MAXACCELERATION;
1511 1509
     // MaxAcceleration value
@@ -1521,13 +1519,13 @@ void HMI_MaxAccelerationXYZE() {
1521 1519
       if (Apply_Encoder(encoder_diffState, HMI_ValueStruct.Max_Jerk_scaled)) {
1522 1520
         checkkey = MaxJerk;
1523 1521
         EncoderRate.enabled = false;
1524
-        if (WITHIN(HMI_flag.jerk_axis, X_AXIS, E_AXIS))
1522
+        if (WITHIN(HMI_flag.jerk_axis, X_AXIS, LAST_AXIS))
1525 1523
           planner.set_max_jerk(HMI_flag.jerk_axis, HMI_ValueStruct.Max_Jerk_scaled / 10);
1526 1524
         DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 1, 210, MBASE(select_jerk.now), HMI_ValueStruct.Max_Jerk_scaled);
1527 1525
         return;
1528 1526
       }
1529 1527
       // MaxJerk limit
1530
-      if (WITHIN(HMI_flag.jerk_axis, X_AXIS, E_AXIS))
1528
+      if (WITHIN(HMI_flag.jerk_axis, X_AXIS, LAST_AXIS))
1531 1529
         NOMORE(HMI_ValueStruct.Max_Jerk_scaled, default_max_jerk[HMI_flag.jerk_axis] * 2 * MINUNITMULT);
1532 1530
       NOLESS(HMI_ValueStruct.Max_Jerk_scaled, (MIN_MAXJERK) * MINUNITMULT);
1533 1531
       // MaxJerk value
@@ -1543,13 +1541,13 @@ void HMI_StepXYZE() {
1543 1541
     if (Apply_Encoder(encoder_diffState, HMI_ValueStruct.Max_Step_scaled)) {
1544 1542
       checkkey = Step;
1545 1543
       EncoderRate.enabled = false;
1546
-      if (WITHIN(HMI_flag.step_axis, X_AXIS, E_AXIS))
1544
+      if (WITHIN(HMI_flag.step_axis, X_AXIS, LAST_AXIS))
1547 1545
         planner.settings.axis_steps_per_mm[HMI_flag.step_axis] = HMI_ValueStruct.Max_Step_scaled / 10;
1548 1546
       DWIN_Draw_FloatValue(true, true, 0, font8x16, Color_White, Color_Bg_Black, 3, 1, 210, MBASE(select_step.now), HMI_ValueStruct.Max_Step_scaled);
1549 1547
       return;
1550 1548
     }
1551 1549
     // Step limit
1552
-    if (WITHIN(HMI_flag.step_axis, X_AXIS, E_AXIS))
1550
+    if (WITHIN(HMI_flag.step_axis, X_AXIS, LAST_AXIS))
1553 1551
       NOMORE(HMI_ValueStruct.Max_Step_scaled, 999.9 * MINUNITMULT);
1554 1552
     NOLESS(HMI_ValueStruct.Max_Step_scaled, MIN_STEP);
1555 1553
     // Step value

Notiek ielāde…
Atcelt
Saglabāt