Browse Source

Merge pull request #3146 from thinkyhead/rc_enabled_true_false

Support "true" and "false" in the ENABLED macro
Scott Lahteine 8 years ago
parent
commit
d7c6fd5c2f
3 changed files with 26 additions and 16 deletions
  1. 4
    4
      Marlin/Marlin_main.cpp
  2. 5
    3
      Marlin/macros.h
  3. 17
    9
      Marlin/planner.cpp

+ 4
- 4
Marlin/Marlin_main.cpp View File

@@ -6999,16 +6999,16 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) {
6999 6999
 
7000 7000
   if (stepper_inactive_time && ms > previous_cmd_ms + stepper_inactive_time
7001 7001
       && !ignore_stepper_queue && !blocks_queued()) {
7002
-    #if DISABLE_INACTIVE_X == true
7002
+    #if ENABLED(DISABLE_INACTIVE_X)
7003 7003
       disable_x();
7004 7004
     #endif
7005
-    #if DISABLE_INACTIVE_Y == true
7005
+    #if ENABLED(DISABLE_INACTIVE_Y)
7006 7006
       disable_y();
7007 7007
     #endif
7008
-    #if DISABLE_INACTIVE_Z == true
7008
+    #if ENABLED(DISABLE_INACTIVE_Z)
7009 7009
       disable_z();
7010 7010
     #endif
7011
-    #if DISABLE_INACTIVE_E == true
7011
+    #if ENABLED(DISABLE_INACTIVE_E)
7012 7012
       disable_e0();
7013 7013
       disable_e1();
7014 7014
       disable_e2();

+ 5
- 3
Marlin/macros.h View File

@@ -17,9 +17,11 @@
17 17
 
18 18
 // Macros to support option testing
19 19
 #define _CAT(a, ...) a ## __VA_ARGS__
20
-#define SWITCH_ENABLED_0 0
21
-#define SWITCH_ENABLED_1 1
22
-#define SWITCH_ENABLED_  1
20
+#define SWITCH_ENABLED_false 0
21
+#define SWITCH_ENABLED_true  1
22
+#define SWITCH_ENABLED_0     0
23
+#define SWITCH_ENABLED_1     1
24
+#define SWITCH_ENABLED_      1
23 25
 #define ENABLED(b) _CAT(SWITCH_ENABLED_, b)
24 26
 #define DISABLED(b) (!_CAT(SWITCH_ENABLED_, b))
25 27
 

+ 17
- 9
Marlin/planner.cpp View File

@@ -421,15 +421,23 @@ void check_axes_activity() {
421 421
       block_index = next_block_index(block_index);
422 422
     }
423 423
   }
424
-  if (DISABLE_X && !axis_active[X_AXIS]) disable_x();
425
-  if (DISABLE_Y && !axis_active[Y_AXIS]) disable_y();
426
-  if (DISABLE_Z && !axis_active[Z_AXIS]) disable_z();
427
-  if (DISABLE_E && !axis_active[E_AXIS]) {
428
-    disable_e0();
429
-    disable_e1();
430
-    disable_e2();
431
-    disable_e3();
432
-  }
424
+  #if ENABLED(DISABLE_X)
425
+    if (!axis_active[X_AXIS]) disable_x();
426
+  #endif
427
+  #if ENABLED(DISABLE_Y)
428
+    if (!axis_active[Y_AXIS]) disable_y();
429
+  #endif
430
+  #if ENABLED(DISABLE_Z)
431
+    if (!axis_active[Z_AXIS]) disable_z();
432
+  #endif
433
+  #if ENABLED(DISABLE_E)
434
+    if (!axis_active[E_AXIS]) {
435
+      disable_e0();
436
+      disable_e1();
437
+      disable_e2();
438
+      disable_e3();
439
+    }
440
+  #endif
433 441
 
434 442
   #if HAS_FAN
435 443
     #ifdef FAN_KICKSTART_TIME

Loading…
Cancel
Save