More useful ENABLED / DISABLED macros (#17054)

This commit is contained in:
Scott Lahteine
2020-03-07 22:20:41 -06:00
committed by GitHub
parent 5eb6fb1c2f
commit 64d092935b
26 changed files with 636 additions and 766 deletions

View File

@ -48,24 +48,16 @@
#include "../MarlinCore.h"
#include "../HAL/shared/Delay.h"
#define HAS_SIDE_BY_SIDE (ENABLED(MAX7219_SIDE_BY_SIDE) && MAX7219_NUMBER_UNITS > 1)
#if ENABLED(MAX7219_SIDE_BY_SIDE) && MAX7219_NUMBER_UNITS > 1
#define HAS_SIDE_BY_SIDE 1
#endif
#if _ROT == 0 || _ROT == 180
#if HAS_SIDE_BY_SIDE
#define MAX7219_X_LEDS 8
#define MAX7219_Y_LEDS MAX7219_LINES
#else
#define MAX7219_Y_LEDS 8
#define MAX7219_X_LEDS MAX7219_LINES
#endif
#define MAX7219_X_LEDS TERN(HAS_SIDE_BY_SIDE, 8, MAX7219_LINES)
#define MAX7219_Y_LEDS TERN(HAS_SIDE_BY_SIDE, MAX7219_LINES, 8)
#elif _ROT == 90 || _ROT == 270
#if HAS_SIDE_BY_SIDE
#define MAX7219_Y_LEDS 8
#define MAX7219_X_LEDS MAX7219_LINES
#else
#define MAX7219_X_LEDS 8
#define MAX7219_Y_LEDS MAX7219_LINES
#endif
#define MAX7219_X_LEDS TERN(HAS_SIDE_BY_SIDE, MAX7219_LINES, 8)
#define MAX7219_Y_LEDS TERN(HAS_SIDE_BY_SIDE, 8, MAX7219_LINES)
#else
#error "MAX7219_ROTATE must be a multiple of +/- 90°."
#endif

View File

@ -55,14 +55,7 @@ void Babystep::add_mm(const AxisEnum axis, const float &mm) {
void Babystep::add_steps(const AxisEnum axis, const int16_t distance) {
#if ENABLED(BABYSTEP_WITHOUT_HOMING)
#define CAN_BABYSTEP(AXIS) true
#else
extern uint8_t axis_known_position;
#define CAN_BABYSTEP(AXIS) TEST(axis_known_position, AXIS)
#endif
if (!CAN_BABYSTEP(axis)) return;
if (DISABLED(BABYSTEP_WITHOUT_HOMING) && !TEST(axis_known_position, axis)) return;
accum += distance; // Count up babysteps for the UI
#if ENABLED(BABYSTEP_DISPLAY_TOTAL)

View File

@ -73,20 +73,12 @@ void BLTouch::init(const bool set_voltage/*=false*/) {
);
}
const bool should_set = last_written_mode != (false
#if ENABLED(BLTOUCH_SET_5V_MODE)
|| true
#endif
);
const bool should_set = last_written_mode != ENABLED(BLTOUCH_SET_5V_MODE);
#endif
if (should_set && set_voltage)
mode_conv_proc((false
#if ENABLED(BLTOUCH_SET_5V_MODE)
|| true
#endif
));
mode_conv_proc(ENABLED(BLTOUCH_SET_5V_MODE));
}
void BLTouch::clear() {

View File

@ -159,11 +159,7 @@ class PrintJobRecovery {
static inline void cancel() { purge(); card.autostart_index = 0; }
static void load();
static void save(const bool force=false
#if ENABLED(SAVE_EACH_CMD_MODE)
|| true
#endif
);
static void save(const bool force=ENABLED(SAVE_EACH_CMD_MODE));
#if PIN_EXISTS(POWER_LOSS)
static inline void outage() {