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