Browse Source

Cosmetic updates from 14044

Scott Lahteine 4 years ago
parent
commit
1088846cae

+ 6
- 3
Marlin/src/Marlin.cpp View File

@@ -687,9 +687,12 @@ void idle(
687 687
 
688 688
   #if ENABLED(I2C_POSITION_ENCODERS)
689 689
     static millis_t i2cpem_next_update_ms;
690
-    if (planner.has_blocks_queued() && ELAPSED(millis(), i2cpem_next_update_ms)) {
691
-      I2CPEM.update();
692
-      i2cpem_next_update_ms = millis() + I2CPE_MIN_UPD_TIME_MS;
690
+    if (planner.has_blocks_queued()) {
691
+      const millis_t ms = millis();
692
+      if (ELAPSED(ms, i2cpem_next_update_ms)) {
693
+        I2CPEM.update();
694
+        i2cpem_next_update_ms = ms + I2CPE_MIN_UPD_TIME_MS;
695
+      }
693 696
     }
694 697
   #endif
695 698
 

+ 3
- 5
Marlin/src/feature/tmc_util.h View File

@@ -348,17 +348,15 @@ void test_tmc_connection(const bool test_x, const bool test_y, const bool test_z
348 348
 #endif
349 349
 
350 350
 /**
351
- * TMC2130 specific sensorless homing using stallGuard2.
351
+ * TMC2130-specific sensorless homing using stallGuard2.
352 352
  * stallGuard2 only works when in spreadCycle mode.
353
- * spreadCycle and stealthChop are mutually exclusive.
353
+ * spreadCycle and stealthChop are mutually-exclusive.
354 354
  *
355 355
  * Defined here because of limitations with templates and headers.
356 356
  */
357 357
 #if USE_SENSORLESS
358 358
   // Track enabled status of stealthChop and only re-enable where applicable
359
-  struct sensorless_t {
360
-    bool x, y, z, x2, y2, z2, z3;
361
-  };
359
+  struct sensorless_t { bool x, y, z, x2, y2, z2, z3; };
362 360
 
363 361
   bool tmc_enable_stallguard(TMC2130Stepper &st);
364 362
   void tmc_disable_stallguard(TMC2130Stepper &st, const bool restore_stealth);

+ 1
- 1
Marlin/src/gcode/calibrate/G28.cpp View File

@@ -78,7 +78,7 @@
78 78
                 fr_mm_s = _MIN(homing_feedrate(X_AXIS), homing_feedrate(Y_AXIS)) * SQRT(sq(mlratio) + 1.0);
79 79
 
80 80
     #if ENABLED(SENSORLESS_HOMING)
81
-      sensorless_t stealth_states { false, false, false, false, false, false, false };
81
+      sensorless_t stealth_states { false };
82 82
       stealth_states.x = tmc_enable_stallguard(stepperX);
83 83
       stealth_states.y = tmc_enable_stallguard(stepperY);
84 84
       #if AXIS_HAS_STALLGUARD(X2)

+ 1
- 1
Marlin/src/gcode/config/M200-M205.cpp View File

@@ -65,7 +65,7 @@ void GcodeSuite::M201() {
65 65
       planner.settings.max_acceleration_mm_per_s2[a] = parser.value_axis_units((AxisEnum)a);
66 66
     }
67 67
   }
68
-  // steps per sq second need to be updated to agree with the units per sq second (as they are what is used in the planner)
68
+
69 69
   planner.reset_acceleration_rates();
70 70
 }
71 71
 

+ 14
- 12
Marlin/src/inc/SanityCheck.h View File

@@ -2060,22 +2060,24 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
2060 2060
 
2061 2061
   #if ENABLED(DELTA) && !BOTH(STEALTHCHOP_XY, STEALTHCHOP_Z)
2062 2062
     #error "SENSORLESS_HOMING on DELTA currently requires STEALTHCHOP_XY and STEALTHCHOP_Z."
2063
-  #elif X_SENSORLESS && X_HOME_DIR == -1 && (X_MIN_ENDSTOP_INVERTING != X_ENDSTOP_INVERTING || DISABLED(ENDSTOPPULLUP_XMIN))
2064
-    #error "SENSORLESS_HOMING requires X_MIN_ENDSTOP_INVERTING and ENDSTOPPULLUP_XMIN when homing to X_MIN."
2065
-  #elif X_SENSORLESS && X_HOME_DIR ==  1 && (X_MAX_ENDSTOP_INVERTING != X_ENDSTOP_INVERTING || DISABLED(ENDSTOPPULLUP_XMAX))
2066
-    #error "SENSORLESS_HOMING requires X_MAX_ENDSTOP_INVERTING and ENDSTOPPULLUP_XMAX when homing to X_MAX."
2067
-  #elif Y_SENSORLESS && Y_HOME_DIR == -1 && (Y_MIN_ENDSTOP_INVERTING != Y_ENDSTOP_INVERTING || DISABLED(ENDSTOPPULLUP_YMIN))
2068
-    #error "SENSORLESS_HOMING requires Y_MIN_ENDSTOP_INVERTING and ENDSTOPPULLUP_YMIN when homing to Y_MIN."
2069
-  #elif Y_SENSORLESS && Y_HOME_DIR ==  1 && (Y_MAX_ENDSTOP_INVERTING != Y_ENDSTOP_INVERTING || DISABLED(ENDSTOPPULLUP_YMAX))
2070
-    #error "SENSORLESS_HOMING requires Y_MAX_ENDSTOP_INVERTING and ENDSTOPPULLUP_YMAX when homing to Y_MAX."
2071
-  #elif Z_SENSORLESS && Z_HOME_DIR == -1 && (Z_MIN_ENDSTOP_INVERTING != Z_ENDSTOP_INVERTING || DISABLED(ENDSTOPPULLUP_ZMIN))
2072
-    #error "SENSORLESS_HOMING requires Z_MIN_ENDSTOP_INVERTING and ENDSTOPPULLUP_ZMIN when homing to Z_MIN."
2073
-  #elif Z_SENSORLESS && Z_HOME_DIR ==  1 && (Z_MAX_ENDSTOP_INVERTING != Z_ENDSTOP_INVERTING || DISABLED(ENDSTOPPULLUP_ZMAX))
2074
-    #error "SENSORLESS_HOMING requires Z_MAX_ENDSTOP_INVERTING and ENDSTOPPULLUP_ZMAX when homing to Z_MAX."
2075 2063
   #elif ENDSTOP_NOISE_THRESHOLD
2076 2064
     #error "SENSORLESS_HOMING is incompatible with ENDSTOP_NOISE_THRESHOLD."
2077 2065
   #elif !(X_SENSORLESS || Y_SENSORLESS || Z_SENSORLESS)
2078 2066
     #error "SENSORLESS_HOMING requires a TMC stepper driver with StallGuard on X, Y, or Z axes."
2067
+  #elif DISABLED(SPI_ENDSTOPS)
2068
+    #if   X_SENSORLESS && X_HOME_DIR < 0 && (X_MIN_ENDSTOP_INVERTING != X_ENDSTOP_INVERTING || DISABLED(ENDSTOPPULLUP_XMIN))
2069
+      #error "SENSORLESS_HOMING requires X_MIN_ENDSTOP_INVERTING and ENDSTOPPULLUP_XMIN when homing to X_MIN."
2070
+    #elif X_SENSORLESS && X_HOME_DIR > 0 && (X_MAX_ENDSTOP_INVERTING != X_ENDSTOP_INVERTING || DISABLED(ENDSTOPPULLUP_XMAX))
2071
+      #error "SENSORLESS_HOMING requires X_MAX_ENDSTOP_INVERTING and ENDSTOPPULLUP_XMAX when homing to X_MAX."
2072
+    #elif Y_SENSORLESS && Y_HOME_DIR < 0 && (Y_MIN_ENDSTOP_INVERTING != Y_ENDSTOP_INVERTING || DISABLED(ENDSTOPPULLUP_YMIN))
2073
+      #error "SENSORLESS_HOMING requires Y_MIN_ENDSTOP_INVERTING and ENDSTOPPULLUP_YMIN when homing to Y_MIN."
2074
+    #elif Y_SENSORLESS && Y_HOME_DIR > 0 && (Y_MAX_ENDSTOP_INVERTING != Y_ENDSTOP_INVERTING || DISABLED(ENDSTOPPULLUP_YMAX))
2075
+      #error "SENSORLESS_HOMING requires Y_MAX_ENDSTOP_INVERTING and ENDSTOPPULLUP_YMAX when homing to Y_MAX."
2076
+    #elif Z_SENSORLESS && Z_HOME_DIR < 0 && (Z_MIN_ENDSTOP_INVERTING != Z_ENDSTOP_INVERTING || DISABLED(ENDSTOPPULLUP_ZMIN))
2077
+      #error "SENSORLESS_HOMING requires Z_MIN_ENDSTOP_INVERTING and ENDSTOPPULLUP_ZMIN when homing to Z_MIN."
2078
+    #elif Z_SENSORLESS && Z_HOME_DIR > 0 && (Z_MAX_ENDSTOP_INVERTING != Z_ENDSTOP_INVERTING || DISABLED(ENDSTOPPULLUP_ZMAX))
2079
+      #error "SENSORLESS_HOMING requires Z_MAX_ENDSTOP_INVERTING and ENDSTOPPULLUP_ZMAX when homing to Z_MAX."
2080
+    #endif
2079 2081
   #endif
2080 2082
 
2081 2083
   #undef X_ENDSTOP_INVERTING

+ 1
- 1
Marlin/src/module/delta.cpp View File

@@ -227,7 +227,7 @@ void home_delta() {
227 227
 
228 228
   // Disable stealthChop if used. Enable diag1 pin on driver.
229 229
   #if ENABLED(SENSORLESS_HOMING)
230
-    sensorless_t stealth_states { false, false, false, false, false, false, false };
230
+    sensorless_t stealth_states { false };
231 231
     stealth_states.x = tmc_enable_stallguard(stepperX);
232 232
     stealth_states.y = tmc_enable_stallguard(stepperY);
233 233
     stealth_states.z = tmc_enable_stallguard(stepperZ);

+ 2
- 3
Marlin/src/module/endstops.cpp View File

@@ -783,14 +783,13 @@ void Endstops::update() {
783 783
   bool Endstops::monitor_flag = false;
784 784
 
785 785
   /**
786
-   * monitors endstops & Z probe for changes
786
+   * Monitor Endstops and Z Probe for changes
787 787
    *
788 788
    * If a change is detected then the LED is toggled and
789
-   * a message is sent out the serial port
789
+   * a message is sent out the serial port.
790 790
    *
791 791
    * Yes, we could miss a rapid back & forth change but
792 792
    * that won't matter because this is all manual.
793
-   *
794 793
    */
795 794
   void Endstops::monitor() {
796 795
 

+ 6
- 17
Marlin/src/module/endstops.h View File

@@ -29,27 +29,16 @@
29 29
 #include <stdint.h>
30 30
 
31 31
 enum EndstopEnum : char {
32
-  X_MIN,
33
-  Y_MIN,
34
-  Z_MIN,
35
-  Z_MIN_PROBE,
36
-  X_MAX,
37
-  Y_MAX,
38
-  Z_MAX,
39
-  X2_MIN,
40
-  X2_MAX,
41
-  Y2_MIN,
42
-  Y2_MAX,
43
-  Z2_MIN,
44
-  Z2_MAX,
45
-  Z3_MIN,
46
-  Z3_MAX
32
+  X_MIN,  Y_MIN,  Z_MIN,  Z_MIN_PROBE,
33
+  X_MAX,  Y_MAX,  Z_MAX,
34
+  X2_MIN, X2_MAX,
35
+  Y2_MIN, Y2_MAX,
36
+  Z2_MIN, Z2_MAX,
37
+  Z3_MIN, Z3_MAX
47 38
 };
48 39
 
49 40
 class Endstops {
50
-
51 41
   public:
52
-
53 42
     #if HAS_EXTRA_ENDSTOPS
54 43
       typedef uint16_t esbits_t;
55 44
       #if ENABLED(X_DUAL_ENDSTOPS)

+ 1
- 1
Marlin/src/module/motion.cpp View File

@@ -1071,7 +1071,7 @@ float get_homing_bump_feedrate(const AxisEnum axis) {
1071 1071
    * Set sensorless homing if the axis has it, accounting for Core Kinematics.
1072 1072
    */
1073 1073
   sensorless_t start_sensorless_homing_per_axis(const AxisEnum axis) {
1074
-    sensorless_t stealth_states { false, false, false, false, false, false, false };
1074
+    sensorless_t stealth_states { false };
1075 1075
 
1076 1076
     switch (axis) {
1077 1077
       default: break;

+ 1
- 1
Marlin/src/module/probe.cpp View File

@@ -540,7 +540,7 @@ static bool do_probe_move(const float z, const float fr_mm_s) {
540 540
 
541 541
   // Disable stealthChop if used. Enable diag1 pin on driver.
542 542
   #if ENABLED(SENSORLESS_PROBING)
543
-    sensorless_t stealth_states { false, false, false, false, false, false, false };
543
+    sensorless_t stealth_states { false };
544 544
     #if ENABLED(DELTA)
545 545
       stealth_states.x = tmc_enable_stallguard(stepperX);
546 546
       stealth_states.y = tmc_enable_stallguard(stepperY);

Loading…
Cancel
Save