Browse Source

Fix compile-time PWM_PIN (#18793)

Co-authored-by: Scott Lahteine <github@thinkyhead.com>
giryan 3 years ago
parent
commit
f949287aec
No account linked to committer's email address
1 changed files with 19 additions and 10 deletions
  1. 19
    10
      Marlin/src/inc/SanityCheck.h

+ 19
- 10
Marlin/src/inc/SanityCheck.h View File

@@ -2106,27 +2106,33 @@ static_assert(hbm[Z_AXIS] >= 0, "HOMING_BUMP_MM.Z must be greater than or equal
2106 2106
 #endif
2107 2107
 #undef _RGB_TEST
2108 2108
 
2109
+#if DISABLED(NO_COMPILE_TIME_PWM)
2110
+  #define _TEST_PWM(P) PWM_PIN(P)
2111
+#else
2112
+  #define _TEST_PWM(P) 1 // pass
2113
+#endif
2114
+
2109 2115
 /**
2110 2116
  * Auto Fan check for PWM pins
2111 2117
  */
2112
-#if HAS_AUTO_FAN && EXTRUDER_AUTO_FAN_SPEED != 255 && DISABLED(NO_COMPILE_TIME_PWM)
2118
+#if HAS_AUTO_FAN && EXTRUDER_AUTO_FAN_SPEED != 255
2113 2119
   #define AF_ERR_SUFF "_AUTO_FAN_PIN is not a PWM pin. Set EXTRUDER_AUTO_FAN_SPEED to 255."
2114 2120
   #if HAS_AUTO_FAN_0
2115
-    static_assert(PWM_PIN(E0_AUTO_FAN_PIN), "E0" AF_ERR_SUFF);
2121
+    static_assert(_TEST_PWM(E0_AUTO_FAN_PIN), "E0" AF_ERR_SUFF);
2116 2122
   #elif HAS_AUTO_FAN_1
2117
-    static_assert(PWM_PIN(E1_AUTO_FAN_PIN), "E1" AF_ERR_SUFF);
2123
+    static_assert(_TEST_PWM(E1_AUTO_FAN_PIN), "E1" AF_ERR_SUFF);
2118 2124
   #elif HAS_AUTO_FAN_2
2119
-    static_assert(PWM_PIN(E2_AUTO_FAN_PIN), "E2" AF_ERR_SUFF);
2125
+    static_assert(_TEST_PWM(E2_AUTO_FAN_PIN), "E2" AF_ERR_SUFF);
2120 2126
   #elif HAS_AUTO_FAN_3
2121
-    static_assert(PWM_PIN(E3_AUTO_FAN_PIN), "E3" AF_ERR_SUFF);
2127
+    static_assert(_TEST_PWM(E3_AUTO_FAN_PIN), "E3" AF_ERR_SUFF);
2122 2128
   #elif HAS_AUTO_FAN_4
2123
-    static_assert(PWM_PIN(E4_AUTO_FAN_PIN), "E4" AF_ERR_SUFF);
2129
+    static_assert(_TEST_PWM(E4_AUTO_FAN_PIN), "E4" AF_ERR_SUFF);
2124 2130
   #elif HAS_AUTO_FAN_5
2125
-    static_assert(PWM_PIN(E5_AUTO_FAN_PIN), "E5" AF_ERR_SUFF);
2131
+    static_assert(_TEST_PWM(E5_AUTO_FAN_PIN), "E5" AF_ERR_SUFF);
2126 2132
   #elif HAS_AUTO_FAN_6
2127
-    static_assert(PWM_PIN(E6_AUTO_FAN_PIN), "E6" AF_ERR_SUFF);
2133
+    static_assert(_TEST_PWM(E6_AUTO_FAN_PIN), "E6" AF_ERR_SUFF);
2128 2134
   #elif HAS_AUTO_FAN_7
2129
-    static_assert(PWM_PIN(E7_AUTO_FAN_PIN), "E7" AF_ERR_SUFF);
2135
+    static_assert(_TEST_PWM(E7_AUTO_FAN_PIN), "E7" AF_ERR_SUFF);
2130 2136
   #endif
2131 2137
 #endif
2132 2138
 
@@ -2945,7 +2951,7 @@ static_assert(   _ARR_TEST(3,0) && _ARR_TEST(3,1) && _ARR_TEST(3,2)
2945 2951
   #elif ENABLED(SPINDLE_LASER_PWM)
2946 2952
     #if !defined(SPINDLE_LASER_PWM_PIN) || SPINDLE_LASER_PWM_PIN < 0
2947 2953
       #error "SPINDLE_LASER_PWM_PIN is required for SPINDLE_LASER_PWM."
2948
-    #elif !PWM_PIN(SPINDLE_LASER_PWM_PIN)
2954
+    #elif !_TEST_PWM(SPINDLE_LASER_PWM_PIN)
2949 2955
       #error "SPINDLE_LASER_PWM_PIN not assigned to a PWM pin."
2950 2956
     #elif !defined(SPINDLE_LASER_PWM_INVERT)
2951 2957
       #error "SPINDLE_LASER_PWM_INVERT is required for (SPINDLE|LASER)_FEATURE."
@@ -3037,3 +3043,6 @@ static_assert(   _ARR_TEST(3,0) && _ARR_TEST(3,1) && _ARR_TEST(3,2)
3037 3043
     #error "DIRECT_STEPPING is incompatible with LIN_ADVANCE. Enable in external planner if possible."
3038 3044
   #endif
3039 3045
 #endif
3046
+
3047
+// Misc. Cleanup
3048
+#undef _TEST_PWM

Loading…
Cancel
Save