Skip to content

Commit

Permalink
Merge pull request #3146 from thinkyhead/rc_enabled_true_false
Browse files Browse the repository at this point in the history
Support "true" and "false" in the ENABLED macro
  • Loading branch information
thinkyhead committed Mar 16, 2016
2 parents 2ef49a9 + 4b64879 commit d7c6fd5
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 16 deletions.
8 changes: 4 additions & 4 deletions Marlin/Marlin_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6999,16 +6999,16 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) {

if (stepper_inactive_time && ms > previous_cmd_ms + stepper_inactive_time
&& !ignore_stepper_queue && !blocks_queued()) {
#if DISABLE_INACTIVE_X == true
#if ENABLED(DISABLE_INACTIVE_X)
disable_x();
#endif
#if DISABLE_INACTIVE_Y == true
#if ENABLED(DISABLE_INACTIVE_Y)
disable_y();
#endif
#if DISABLE_INACTIVE_Z == true
#if ENABLED(DISABLE_INACTIVE_Z)
disable_z();
#endif
#if DISABLE_INACTIVE_E == true
#if ENABLED(DISABLE_INACTIVE_E)
disable_e0();
disable_e1();
disable_e2();
Expand Down
8 changes: 5 additions & 3 deletions Marlin/macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@

// Macros to support option testing
#define _CAT(a, ...) a ## __VA_ARGS__
#define SWITCH_ENABLED_0 0
#define SWITCH_ENABLED_1 1
#define SWITCH_ENABLED_ 1
#define SWITCH_ENABLED_false 0
#define SWITCH_ENABLED_true 1
#define SWITCH_ENABLED_0 0
#define SWITCH_ENABLED_1 1
#define SWITCH_ENABLED_ 1
#define ENABLED(b) _CAT(SWITCH_ENABLED_, b)
#define DISABLED(b) (!_CAT(SWITCH_ENABLED_, b))

Expand Down
26 changes: 17 additions & 9 deletions Marlin/planner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -421,15 +421,23 @@ void check_axes_activity() {
block_index = next_block_index(block_index);
}
}
if (DISABLE_X && !axis_active[X_AXIS]) disable_x();
if (DISABLE_Y && !axis_active[Y_AXIS]) disable_y();
if (DISABLE_Z && !axis_active[Z_AXIS]) disable_z();
if (DISABLE_E && !axis_active[E_AXIS]) {
disable_e0();
disable_e1();
disable_e2();
disable_e3();
}
#if ENABLED(DISABLE_X)
if (!axis_active[X_AXIS]) disable_x();
#endif
#if ENABLED(DISABLE_Y)
if (!axis_active[Y_AXIS]) disable_y();
#endif
#if ENABLED(DISABLE_Z)
if (!axis_active[Z_AXIS]) disable_z();
#endif
#if ENABLED(DISABLE_E)
if (!axis_active[E_AXIS]) {
disable_e0();
disable_e1();
disable_e2();
disable_e3();
}
#endif

#if HAS_FAN
#ifdef FAN_KICKSTART_TIME
Expand Down

0 comments on commit d7c6fd5

Please sign in to comment.