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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
26 changed files with 636 additions and 766 deletions

View File

@ -1047,7 +1047,7 @@
*/ */
//#define POWER_LOSS_RECOVERY //#define POWER_LOSS_RECOVERY
#if ENABLED(POWER_LOSS_RECOVERY) #if ENABLED(POWER_LOSS_RECOVERY)
//#define PLR_ENABLED_DEFAULT true // Power Loss Recovery enabled by default. (Set with 'M413 Sn' & M500) #define PLR_ENABLED_DEFAULT false // Power Loss Recovery enabled by default. (Set with 'M413 Sn' & M500)
//#define BACKUP_POWER_SUPPLY // Backup power / UPS to move the steppers on power loss //#define BACKUP_POWER_SUPPLY // Backup power / UPS to move the steppers on power loss
//#define POWER_LOSS_ZRAISE 2 // (mm) Z axis raise on resume (on power loss with UPS) //#define POWER_LOSS_ZRAISE 2 // (mm) Z axis raise on resume (on power loss with UPS)
//#define POWER_LOSS_PIN 44 // Pin to detect power loss. Set to -1 to disable default pin on boards without module. //#define POWER_LOSS_PIN 44 // Pin to detect power loss. Set to -1 to disable default pin on boards without module.

View File

@ -31,10 +31,10 @@
* Templatized 01 October 2018 by Eduardo José Tagle to allow multiple instances * Templatized 01 October 2018 by Eduardo José Tagle to allow multiple instances
*/ */
#include "../shared/MarlinSerial.h"
#include <WString.h> #include <WString.h>
#include "../../inc/MarlinConfigPre.h"
#ifndef SERIAL_PORT #ifndef SERIAL_PORT
#define SERIAL_PORT 0 #define SERIAL_PORT 0
#endif #endif
@ -261,12 +261,12 @@
static constexpr int PORT = serial; static constexpr int PORT = serial;
static constexpr unsigned int RX_SIZE = RX_BUFFER_SIZE; static constexpr unsigned int RX_SIZE = RX_BUFFER_SIZE;
static constexpr unsigned int TX_SIZE = TX_BUFFER_SIZE; static constexpr unsigned int TX_SIZE = TX_BUFFER_SIZE;
static constexpr bool XONOFF = bSERIAL_XON_XOFF; static constexpr bool XONOFF = ENABLED(SERIAL_XON_XOFF);
static constexpr bool EMERGENCYPARSER = bEMERGENCY_PARSER; static constexpr bool EMERGENCYPARSER = ENABLED(EMERGENCY_PARSER);
static constexpr bool DROPPED_RX = bSERIAL_STATS_DROPPED_RX; static constexpr bool DROPPED_RX = ENABLED(SERIAL_STATS_DROPPED_RX);
static constexpr bool RX_OVERRUNS = bSERIAL_STATS_RX_BUFFER_OVERRUNS; static constexpr bool RX_OVERRUNS = ENABLED(SERIAL_STATS_RX_BUFFER_OVERRUNS);
static constexpr bool RX_FRAMING_ERRORS = bSERIAL_STATS_RX_FRAMING_ERRORS; static constexpr bool RX_FRAMING_ERRORS = ENABLED(SERIAL_STATS_RX_FRAMING_ERRORS);
static constexpr bool MAX_RX_QUEUED = bSERIAL_STATS_MAX_RX_QUEUED; static constexpr bool MAX_RX_QUEUED = ENABLED(SERIAL_STATS_MAX_RX_QUEUED);
}; };
extern MarlinSerial<MarlinSerialCfg<SERIAL_PORT>> customizedSerial1; extern MarlinSerial<MarlinSerialCfg<SERIAL_PORT>> customizedSerial1;
@ -304,7 +304,7 @@
static constexpr bool XONOFF = false; static constexpr bool XONOFF = false;
static constexpr bool EMERGENCYPARSER = false; static constexpr bool EMERGENCYPARSER = false;
static constexpr bool DROPPED_RX = false; static constexpr bool DROPPED_RX = false;
static constexpr bool RX_OVERRUNS = bDGUS_SERIAL_STATS_RX_BUFFER_OVERRUNS; static constexpr bool RX_OVERRUNS = HAS_DGUS_LCD && ENABLED(DGUS_SERIAL_STATS_RX_BUFFER_OVERRUNS);
static constexpr bool RX_FRAMING_ERRORS = false; static constexpr bool RX_FRAMING_ERRORS = false;
static constexpr bool MAX_RX_QUEUED = false; static constexpr bool MAX_RX_QUEUED = false;
}; };

View File

@ -27,10 +27,10 @@
* Based on MarlinSerial for AVR, copyright (c) 2006 Nicholas Zambetti. All right reserved. * Based on MarlinSerial for AVR, copyright (c) 2006 Nicholas Zambetti. All right reserved.
*/ */
#include "../shared/MarlinSerial.h"
#include <WString.h> #include <WString.h>
#include "../../inc/MarlinConfigPre.h"
#define DEC 10 #define DEC 10
#define HEX 16 #define HEX 16
#define OCT 8 #define OCT 8
@ -163,12 +163,12 @@ struct MarlinSerialCfg {
static constexpr int PORT = serial; static constexpr int PORT = serial;
static constexpr unsigned int RX_SIZE = RX_BUFFER_SIZE; static constexpr unsigned int RX_SIZE = RX_BUFFER_SIZE;
static constexpr unsigned int TX_SIZE = TX_BUFFER_SIZE; static constexpr unsigned int TX_SIZE = TX_BUFFER_SIZE;
static constexpr bool XONOFF = bSERIAL_XON_XOFF; static constexpr bool XONOFF = ENABLED(SERIAL_XON_XOFF);
static constexpr bool EMERGENCYPARSER = bEMERGENCY_PARSER; static constexpr bool EMERGENCYPARSER = ENABLED(EMERGENCY_PARSER);
static constexpr bool DROPPED_RX = bSERIAL_STATS_DROPPED_RX; static constexpr bool DROPPED_RX = ENABLED(SERIAL_STATS_DROPPED_RX);
static constexpr bool RX_OVERRUNS = bSERIAL_STATS_RX_BUFFER_OVERRUNS; static constexpr bool RX_OVERRUNS = ENABLED(SERIAL_STATS_RX_BUFFER_OVERRUNS);
static constexpr bool RX_FRAMING_ERRORS = bSERIAL_STATS_RX_FRAMING_ERRORS; static constexpr bool RX_FRAMING_ERRORS = ENABLED(SERIAL_STATS_RX_FRAMING_ERRORS);
static constexpr bool MAX_RX_QUEUED = bSERIAL_STATS_MAX_RX_QUEUED; static constexpr bool MAX_RX_QUEUED = ENABLED(SERIAL_STATS_MAX_RX_QUEUED);
}; };
#if SERIAL_PORT >= 0 #if SERIAL_PORT >= 0

View File

@ -57,9 +57,7 @@
* Because PWM hardware channels all share the same frequency, along with the * Because PWM hardware channels all share the same frequency, along with the
* fallback software channels, FAST_PWM_FAN is incompatible with Servos. * fallback software channels, FAST_PWM_FAN is incompatible with Servos.
*/ */
#if NUM_SERVOS > 0 && ENABLED(FAST_PWM_FAN) static_assert(!(NUM_SERVOS && ENABLED(FAST_PWM_FAN)), "BLTOUCH and Servos are incompatible with FAST_PWM_FAN on LPC176x boards.");
#error "BLTOUCH and Servos are incompatible with FAST_PWM_FAN on LPC176x boards."
#endif
/** /**
* Test LPC176x-specific configuration values for errors at compile-time. * Test LPC176x-specific configuration values for errors at compile-time.
@ -69,13 +67,13 @@
// #error "SPINDLE_LASER_PWM_PIN must use SERVO0, SERVO1 or SERVO3 connector" // #error "SPINDLE_LASER_PWM_PIN must use SERVO0, SERVO1 or SERVO3 connector"
//#endif //#endif
#if IS_RE_ARM_BOARD && ENABLED(REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER) && HAS_DRIVER(TMC2130) && DISABLED(TMC_USE_SW_SPI) #if MB(RAMPS_14_RE_ARM_EFB, RAMPS_14_RE_ARM_EEB, RAMPS_14_RE_ARM_EFF, RAMPS_14_RE_ARM_EEF, RAMPS_14_RE_ARM_SF)
#error "Re-ARM with REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER and TMC2130 require TMC_USE_SW_SPI" #if ENABLED(REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER) && HAS_DRIVER(TMC2130) && DISABLED(TMC_USE_SW_SPI)
#error "Re-ARM with REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER and TMC2130 requires TMC_USE_SW_SPI."
#endif
#endif #endif
#if ENABLED(BAUD_RATE_GCODE) static_assert(DISABLED(BAUD_RATE_GCODE), "BAUD_RATE_GCODE is not yet supported on LPC176x.");
#error "BAUD_RATE_GCODE is not yet supported on LPC176x."
#endif
/** /**
* Flag any serial port conflicts * Flag any serial port conflicts

View File

@ -1,67 +0,0 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#pragma once
/**
* HAL/shared/MarlinSerial.h
*/
#include "../../inc/MarlinConfigPre.h"
constexpr bool
#if HAS_DGUS_LCD
bDGUS_SERIAL_STATS_RX_BUFFER_OVERRUNS = (false
#if ENABLED(DGUS_SERIAL_STATS_RX_BUFFER_OVERRUNS)
|| true
#endif
),
#endif
bSERIAL_XON_XOFF = (false
#if ENABLED(SERIAL_XON_XOFF)
|| true
#endif
),
bEMERGENCY_PARSER = (false
#if ENABLED(EMERGENCY_PARSER)
|| true
#endif
),
bSERIAL_STATS_DROPPED_RX = (false
#if ENABLED(SERIAL_STATS_DROPPED_RX)
|| true
#endif
),
bSERIAL_STATS_RX_BUFFER_OVERRUNS = (false
#if ENABLED(SERIAL_STATS_RX_BUFFER_OVERRUNS)
|| true
#endif
),
bSERIAL_STATS_RX_FRAMING_ERRORS = (false
#if ENABLED(SERIAL_STATS_RX_FRAMING_ERRORS)
|| true
#endif
),
bSERIAL_STATS_MAX_RX_QUEUED = (false
#if ENABLED(SERIAL_STATS_MAX_RX_QUEUED)
|| true
#endif
);

View File

@ -241,11 +241,8 @@ void setup_powerhold() {
OUT_WRITE(SUICIDE_PIN, !SUICIDE_PIN_INVERTING); OUT_WRITE(SUICIDE_PIN, !SUICIDE_PIN_INVERTING);
#endif #endif
#if ENABLED(PSU_CONTROL) #if ENABLED(PSU_CONTROL)
#if ENABLED(PSU_DEFAULT_OFF) powersupply_on = ENABLED(PSU_DEFAULT_OFF);
powersupply_on = true; PSU_OFF(); if (ENABLED(PSU_DEFAULT_OFF)) PSU_OFF(); else PSU_ON();
#else
powersupply_on = false; PSU_ON();
#endif
#endif #endif
} }
@ -425,14 +422,8 @@ void startOrResumeJob() {
switch (card.sdprinting_done_state) { switch (card.sdprinting_done_state) {
#if HAS_RESUME_CONTINUE // Display "Click to Continue..." #if HAS_RESUME_CONTINUE // Display "Click to Continue..."
case 1: case 1: // 30 min timeout with LCD, 1 min without
did_state = queue.enqueue_P(PSTR("M0Q1S" did_state = queue.enqueue_P(PSTR("M0Q1S" TERN(HAS_LCD_MENU, "1800", "60")));
#if HAS_LCD_MENU
"1800" // ...for 30 minutes with LCD
#else
"60" // ...for 1 minute with no LCD
#endif
));
break; break;
#endif #endif
@ -501,31 +492,19 @@ inline void manage_inactivity(const bool ignore_stepper_queue=false) {
} }
// Prevent steppers timing-out in the middle of M600 // Prevent steppers timing-out in the middle of M600
#if BOTH(ADVANCED_PAUSE_FEATURE, PAUSE_PARK_NO_STEPPER_TIMEOUT) #define STAY_TEST (BOTH(ADVANCED_PAUSE_FEATURE, PAUSE_PARK_NO_STEPPER_TIMEOUT) && did_pause_print)
#define MOVE_AWAY_TEST !did_pause_print
#else
#define MOVE_AWAY_TEST true
#endif
if (stepper_inactive_time) { if (stepper_inactive_time) {
static bool already_shutdown_steppers; // = false static bool already_shutdown_steppers; // = false
if (planner.has_blocks_queued()) if (planner.has_blocks_queued())
gcode.reset_stepper_timeout(); gcode.reset_stepper_timeout();
else if (MOVE_AWAY_TEST && !ignore_stepper_queue && ELAPSED(ms, gcode.previous_move_ms + stepper_inactive_time)) { else if (!STAY_TEST && !ignore_stepper_queue && ELAPSED(ms, gcode.previous_move_ms + stepper_inactive_time)) {
if (!already_shutdown_steppers) { if (!already_shutdown_steppers) {
already_shutdown_steppers = true; // L6470 SPI will consume 99% of free time without this already_shutdown_steppers = true; // L6470 SPI will consume 99% of free time without this
#if ENABLED(DISABLE_INACTIVE_X) if (ENABLED(DISABLE_INACTIVE_X)) DISABLE_AXIS_X();
DISABLE_AXIS_X(); if (ENABLED(DISABLE_INACTIVE_Y)) DISABLE_AXIS_Y();
#endif if (ENABLED(DISABLE_INACTIVE_Z)) DISABLE_AXIS_Z();
#if ENABLED(DISABLE_INACTIVE_Y) if (ENABLED(DISABLE_INACTIVE_E)) disable_e_steppers();
DISABLE_AXIS_Y();
#endif
#if ENABLED(DISABLE_INACTIVE_Z)
DISABLE_AXIS_Z();
#endif
#if ENABLED(DISABLE_INACTIVE_E)
disable_e_steppers();
#endif
#if HAS_LCD_MENU && ENABLED(AUTO_BED_LEVELING_UBL) #if HAS_LCD_MENU && ENABLED(AUTO_BED_LEVELING_UBL)
if (ubl.lcd_map_control) { if (ubl.lcd_map_control) {
ubl.lcd_map_control = false; ubl.lcd_map_control = false;
@ -1191,7 +1170,6 @@ void setup() {
*/ */
void loop() { void loop() {
do { do {
idle(); idle();
#if ENABLED(SDSUPPORT) #if ENABLED(SDSUPPORT)
@ -1204,9 +1182,5 @@ void loop() {
endstops.event_handler(); endstops.event_handler();
} while (false // Return to caller for best compatibility } while (ENABLED(__AVR__)); // Loop forever on slower (AVR) boards
#ifdef __AVR__
|| true // Loop forever on slower (AVR) boards
#endif
);
} }

View File

@ -82,100 +82,96 @@
#define _OR_ADTE(N,T) || AXIS_DRIVER_TYPE_E(N,T) #define _OR_ADTE(N,T) || AXIS_DRIVER_TYPE_E(N,T)
#define HAS_E_DRIVER(T) (0 RREPEAT2(E_STEPPERS, _OR_ADTE, T)) #define HAS_E_DRIVER(T) (0 RREPEAT2(E_STEPPERS, _OR_ADTE, T))
#define HAS_DRIVER(T) ( AXIS_DRIVER_TYPE_X(T) || AXIS_DRIVER_TYPE_X2(T) \ #define HAS_DRIVER(T) ( AXIS_DRIVER_TYPE_X(T) || AXIS_DRIVER_TYPE_Y(T) || AXIS_DRIVER_TYPE_Z(T) \
|| AXIS_DRIVER_TYPE_Y(T) || AXIS_DRIVER_TYPE_Y2(T) \ || AXIS_DRIVER_TYPE_X2(T) || AXIS_DRIVER_TYPE_Y2(T) || AXIS_DRIVER_TYPE_Z2(T) \
|| AXIS_DRIVER_TYPE_Z(T) || AXIS_DRIVER_TYPE_Z2(T) \ || AXIS_DRIVER_TYPE_Z3(T) || AXIS_DRIVER_TYPE_Z4(T) || HAS_E_DRIVER(T) )
|| AXIS_DRIVER_TYPE_Z3(T) || AXIS_DRIVER_TYPE_Z4(T) \
|| HAS_E_DRIVER(T) )
// Test for supported TMC drivers that require advanced configuration // Test for supported TMC drivers that require advanced configuration
// Does not match standalone configurations // Does not match standalone configurations
#define HAS_TRINAMIC_CONFIG ( HAS_DRIVER(TMC2130) \ #if ( HAS_DRIVER(TMC2130) || HAS_DRIVER(TMC2160) \
|| HAS_DRIVER(TMC2160) \ || HAS_DRIVER(TMC2208) || HAS_DRIVER(TMC2209) \
|| HAS_DRIVER(TMC2208) \
|| HAS_DRIVER(TMC2209) \
|| HAS_DRIVER(TMC2660) \ || HAS_DRIVER(TMC2660) \
|| HAS_DRIVER(TMC5130) \ || HAS_DRIVER(TMC5130) || HAS_DRIVER(TMC5160) )
|| HAS_DRIVER(TMC5160) ) #define HAS_TRINAMIC_CONFIG 1
#endif
#define HAS_TRINAMIC HAS_TRINAMIC_CONFIG #define HAS_TRINAMIC HAS_TRINAMIC_CONFIG
#define HAS_TRINAMIC_STANDALONE ( HAS_DRIVER(TMC2130_STANDALONE) \ #if ( HAS_DRIVER(TMC2130_STANDALONE) || HAS_DRIVER(TMC2160_STANDALONE) \
|| HAS_DRIVER(TMC2208_STANDALONE) \ || HAS_DRIVER(TMC2208_STANDALONE) || HAS_DRIVER(TMC2209_STANDALONE) \
|| HAS_DRIVER(TMC2209_STANDALONE) \ || HAS_DRIVER(TMC26X_STANDALONE) || HAS_DRIVER(TMC2660_STANDALONE) \
|| HAS_DRIVER(TMC26X_STANDALONE) \ || HAS_DRIVER(TMC5130_STANDALONE) || HAS_DRIVER(TMC5160_STANDALONE) )
|| HAS_DRIVER(TMC2660_STANDALONE) \ #define HAS_TRINAMIC_STANDALONE 1
|| HAS_DRIVER(TMC5130_STANDALONE) \ #endif
|| HAS_DRIVER(TMC5160_STANDALONE) \
|| HAS_DRIVER(TMC2160_STANDALONE) )
#define HAS_TMCX1X0 ( HAS_DRIVER(TMC2130) || HAS_DRIVER(TMC2160) \ #if HAS_DRIVER(TMC2130) || HAS_DRIVER(TMC2160) || HAS_DRIVER(TMC5130) || HAS_DRIVER(TMC5160)
|| HAS_DRIVER(TMC5130) || HAS_DRIVER(TMC5160)) #define HAS_TMCX1X0 1
#endif
#define HAS_TMC220x (HAS_DRIVER(TMC2208) || HAS_DRIVER(TMC2209)) #if HAS_DRIVER(TMC2208) || HAS_DRIVER(TMC2209)
#define HAS_TMC220x 1
#endif
#define AXIS_IS_TMC(A) ( AXIS_DRIVER_TYPE(A,TMC2130) \ #define AXIS_IS_TMC(A) ( AXIS_DRIVER_TYPE(A,TMC2130) || AXIS_DRIVER_TYPE(A,TMC2160) \
|| AXIS_DRIVER_TYPE(A,TMC2160) \ || AXIS_DRIVER_TYPE(A,TMC2208) || AXIS_DRIVER_TYPE(A,TMC2209) \
|| AXIS_DRIVER_TYPE(A,TMC2208) \
|| AXIS_DRIVER_TYPE(A,TMC2209) \
|| AXIS_DRIVER_TYPE(A,TMC2660) \ || AXIS_DRIVER_TYPE(A,TMC2660) \
|| AXIS_DRIVER_TYPE(A,TMC5130) \ || AXIS_DRIVER_TYPE(A,TMC5130) || AXIS_DRIVER_TYPE(A,TMC5160) )
|| AXIS_DRIVER_TYPE(A,TMC5160) )
// Test for a driver that uses SPI - this allows checking whether a _CS_ pin // Test for a driver that uses SPI - this allows checking whether a _CS_ pin
// is considered sensitive // is considered sensitive
#define AXIS_HAS_SPI(A) ( AXIS_DRIVER_TYPE(A,TMC2130) \ #define AXIS_HAS_SPI(A) ( AXIS_DRIVER_TYPE(A,TMC2130) || AXIS_DRIVER_TYPE(A,TMC2160) \
|| AXIS_DRIVER_TYPE(A,TMC2160) \
|| AXIS_DRIVER_TYPE(A,TMC2660) \ || AXIS_DRIVER_TYPE(A,TMC2660) \
|| AXIS_DRIVER_TYPE(A,TMC5130) \ || AXIS_DRIVER_TYPE(A,TMC5130) || AXIS_DRIVER_TYPE(A,TMC5160) )
|| AXIS_DRIVER_TYPE(A,TMC5160) )
#define AXIS_HAS_UART(A) ( AXIS_DRIVER_TYPE(A,TMC2208) \ #define AXIS_HAS_UART(A) ( AXIS_DRIVER_TYPE(A,TMC2208) || AXIS_DRIVER_TYPE(A,TMC2209) )
|| AXIS_DRIVER_TYPE(A,TMC2209) )
#define AXIS_HAS_RXTX AXIS_HAS_UART #define AXIS_HAS_RXTX AXIS_HAS_UART
#define AXIS_HAS_SW_SERIAL(A) ((AXIS_HAS_UART(A) && !defined(A##_HARDWARE_SERIAL))) #define AXIS_HAS_SW_SERIAL(A) ( AXIS_HAS_UART(A) && !defined(A##_HARDWARE_SERIAL) )
#define AXIS_HAS_STALLGUARD(A) ( AXIS_DRIVER_TYPE(A,TMC2130) \ #define AXIS_HAS_STALLGUARD(A) ( AXIS_DRIVER_TYPE(A,TMC2130) || AXIS_DRIVER_TYPE(A,TMC2160) \
|| AXIS_DRIVER_TYPE(A,TMC2160) \
|| AXIS_DRIVER_TYPE(A,TMC2209) \ || AXIS_DRIVER_TYPE(A,TMC2209) \
|| AXIS_DRIVER_TYPE(A,TMC2660) \ || AXIS_DRIVER_TYPE(A,TMC2660) \
|| AXIS_DRIVER_TYPE(A,TMC5130) \ || AXIS_DRIVER_TYPE(A,TMC5130) || AXIS_DRIVER_TYPE(A,TMC5160) )
|| AXIS_DRIVER_TYPE(A,TMC5160) )
#define AXIS_HAS_STEALTHCHOP(A) ( AXIS_DRIVER_TYPE(A,TMC2130) \ #define AXIS_HAS_STEALTHCHOP(A) ( AXIS_DRIVER_TYPE(A,TMC2130) || AXIS_DRIVER_TYPE(A,TMC2160) \
|| AXIS_DRIVER_TYPE(A,TMC2160) \ || AXIS_DRIVER_TYPE(A,TMC2208) || AXIS_DRIVER_TYPE(A,TMC2209) \
|| AXIS_DRIVER_TYPE(A,TMC2208) \ || AXIS_DRIVER_TYPE(A,TMC5130) || AXIS_DRIVER_TYPE(A,TMC5160) )
|| AXIS_DRIVER_TYPE(A,TMC2209) \
|| AXIS_DRIVER_TYPE(A,TMC5130) \
|| AXIS_DRIVER_TYPE(A,TMC5160) )
#define AXIS_HAS_SG_RESULT(A) ( AXIS_DRIVER_TYPE(A,TMC2130) \ #define AXIS_HAS_SG_RESULT(A) ( AXIS_DRIVER_TYPE(A,TMC2130) || AXIS_DRIVER_TYPE(A,TMC2160) \
|| AXIS_DRIVER_TYPE(A,TMC2160) \ || AXIS_DRIVER_TYPE(A,TMC2208) || AXIS_DRIVER_TYPE(A,TMC2209) )
|| AXIS_DRIVER_TYPE(A,TMC2208) \
|| AXIS_DRIVER_TYPE(A,TMC2209) )
#define AXIS_HAS_COOLSTEP(A) ( AXIS_DRIVER_TYPE(A,TMC2130) \ #define AXIS_HAS_COOLSTEP(A) ( AXIS_DRIVER_TYPE(A,TMC2130) \
|| AXIS_DRIVER_TYPE(A,TMC2209) \ || AXIS_DRIVER_TYPE(A,TMC2209) \
|| AXIS_DRIVER_TYPE(A,TMC5130) \ || AXIS_DRIVER_TYPE(A,TMC5130) || AXIS_DRIVER_TYPE(A,TMC5160) )
|| AXIS_DRIVER_TYPE(A,TMC5160) )
#define _OR_EAH(N,T) || AXIS_HAS_##T(E##N) #define _OR_EAH(N,T) || AXIS_HAS_##T(E##N)
#define E_AXIS_HAS(T) (0 _OR_EAH(0,T) _OR_EAH(1,T) _OR_EAH(2,T) _OR_EAH(3,T) _OR_EAH(4,T) _OR_EAH(5,T) _OR_EAH(6,T) _OR_EAH(7,T)) #define E_AXIS_HAS(T) (0 _OR_EAH(0,T) _OR_EAH(1,T) _OR_EAH(2,T) _OR_EAH(3,T) _OR_EAH(4,T) _OR_EAH(5,T) _OR_EAH(6,T) _OR_EAH(7,T))
#define ANY_AXIS_HAS(T) ( AXIS_HAS_##T(X) || AXIS_HAS_##T(X2) \ #define ANY_AXIS_HAS(T) ( AXIS_HAS_##T(X) || AXIS_HAS_##T(Y) || AXIS_HAS_##T(Z) \
|| AXIS_HAS_##T(Y) || AXIS_HAS_##T(Y2) \ || AXIS_HAS_##T(X2) || AXIS_HAS_##T(Y2) || AXIS_HAS_##T(Z2) \
|| AXIS_HAS_##T(Z) || AXIS_HAS_##T(Z2) \ || AXIS_HAS_##T(Z3) || AXIS_HAS_##T(Z4) || E_AXIS_HAS(T) )
|| AXIS_HAS_##T(Z3) || AXIS_HAS_##T(Z4) \
|| E_AXIS_HAS(T) )
#define HAS_STEALTHCHOP ANY_AXIS_HAS(STEALTHCHOP) #if ANY_AXIS_HAS(STEALTHCHOP)
#define HAS_STALLGUARD ANY_AXIS_HAS(STALLGUARD) #define HAS_STEALTHCHOP 1
#define HAS_SG_RESULT ANY_AXIS_HAS(SG_RESULT) #endif
#define HAS_COOLSTEP ANY_AXIS_HAS(COOLSTEP) #if ANY_AXIS_HAS(STALLGUARD)
#define HAS_TMC_UART ANY_AXIS_HAS(RXTX) #define HAS_STALLGUARD 1
#define HAS_TMC_SPI ANY_AXIS_HAS(SPI) #endif
#if ANY_AXIS_HAS(SG_RESULT)
#define HAS_SG_RESULT 1
#endif
#if ANY_AXIS_HAS(COOLSTEP)
#define HAS_COOLSTEP 1
#endif
#if ANY_AXIS_HAS(RXTX)
#define HAS_TMC_UART 1
#endif
#if ANY_AXIS_HAS(SPI)
#define HAS_TMC_SPI 1
#endif
// Defines that can't be evaluated now
#define HAS_TMC_SW_SERIAL ANY_AXIS_HAS(SW_SERIAL) #define HAS_TMC_SW_SERIAL ANY_AXIS_HAS(SW_SERIAL)
// //
@ -187,7 +183,11 @@
#define _SDCARD_ID(V) _CAT(_SDCARD_, V) #define _SDCARD_ID(V) _CAT(_SDCARD_, V)
#define SD_CONNECTION_IS(V) (_SDCARD_ID(SDCARD_CONNECTION) == _SDCARD_ID(V)) #define SD_CONNECTION_IS(V) (_SDCARD_ID(SDCARD_CONNECTION) == _SDCARD_ID(V))
#define HAS_L64XX (HAS_DRIVER(L6470) || HAS_DRIVER(L6474) || HAS_DRIVER(L6480) || HAS_DRIVER(POWERSTEP01)) #if HAS_DRIVER(L6470) || HAS_DRIVER(L6474) || HAS_DRIVER(L6480) || HAS_DRIVER(POWERSTEP01)
#define HAS_L64XX_NOT_L6474 (HAS_L64XX && !HAS_DRIVER(L6474)) #define HAS_L64XX 1
#endif
#if HAS_L64XX && !HAS_DRIVER(L6474)
#define HAS_L64XX_NOT_L6474 1
#endif
#define AXIS_IS_L64XX(A) (AXIS_DRIVER_TYPE_##A(L6470) || AXIS_DRIVER_TYPE_##A(L6474) || AXIS_DRIVER_TYPE_##A(L6480) || AXIS_DRIVER_TYPE_##A(POWERSTEP01)) #define AXIS_IS_L64XX(A) (AXIS_DRIVER_TYPE_##A(L6470) || AXIS_DRIVER_TYPE_##A(L6474) || AXIS_DRIVER_TYPE_##A(L6480) || AXIS_DRIVER_TYPE_##A(POWERSTEP01))

View File

@ -177,18 +177,23 @@
// Macros to support option testing // Macros to support option testing
#define _CAT(a,V...) a##V #define _CAT(a,V...) a##V
#define CAT(a,V...) _CAT(a,V) #define CAT(a,V...) _CAT(a,V)
#define SWITCH_ENABLED_false 0
#define SWITCH_ENABLED_true 1 #define _ISENA_ ~,1
#define SWITCH_ENABLED_0 0 #define _ISENA_1 ~,1
#define SWITCH_ENABLED_1 1 #define _ISENA_0x1 ~,1
#define SWITCH_ENABLED_0x0 0 #define _ISENA_true ~,1
#define SWITCH_ENABLED_0x1 1 #define _ISENA(V...) IS_PROBE(V)
#define SWITCH_ENABLED_ 1
#define _ENA_1(O) _CAT(SWITCH_ENABLED_, O) #define _ENA_1(O) _ISENA(CAT(_IS,CAT(ENA_, O)))
#define _DIS_1(O) !_ENA_1(O) #define _DIS_1(O) NOT(_ENA_1(O))
#define ENABLED(V...) DO(ENA,&&,V) #define ENABLED(V...) DO(ENA,&&,V)
#define DISABLED(V...) DO(DIS,&&,V) #define DISABLED(V...) DO(DIS,&&,V)
#define TERN(O,A,B) _TERN(_ENA_1(O),B,A) // OPTION converted to to '0' or '1'
#define _TERN(E,V...) __TERN(_CAT(T_,E),V) // Prepend 'T_' to get 'T_0' or 'T_1'
#define __TERN(T,V...) ___TERN(_CAT(_NO,T),V) // Prepend '_NO' to get '_NOT_0' or '_NOT_1'
#define ___TERN(P,V...) THIRD(P,V) // If first argument has a comma, A. Else B.
#define ANY(V...) !DISABLED(V) #define ANY(V...) !DISABLED(V)
#define NONE(V...) DISABLED(V) #define NONE(V...) DISABLED(V)
#define ALL(V...) ENABLED(V) #define ALL(V...) ENABLED(V)
@ -392,6 +397,7 @@
// //
#define FIRST(a,...) a #define FIRST(a,...) a
#define SECOND(a,b,...) b #define SECOND(a,b,...) b
#define THIRD(a,b,c,...) c
// Defer expansion // Defer expansion
#define EMPTY() #define EMPTY()

View File

@ -57,39 +57,23 @@ void safe_delay(millis_t ms) {
void log_machine_info() { void log_machine_info() {
SERIAL_ECHOLNPGM("Machine Type: " SERIAL_ECHOLNPGM("Machine Type: "
#if ENABLED(DELTA) TERN(DELTA, "Delta", "")
"Delta" TERN(IS_SCARA, "SCARA", "")
#elif IS_SCARA TERN(IS_CORE, "Core", "")
"SCARA" TERN(IS_CARTESIAN, "Cartesian", "")
#elif IS_CORE
"Core"
#else
"Cartesian"
#endif
); );
SERIAL_ECHOLNPGM("Probe: " SERIAL_ECHOLNPGM("Probe: "
#if ENABLED(PROBE_MANUALLY) TERN(PROBE_MANUALLY, "PROBE_MANUALLY", "")
"PROBE_MANUALLY" TERN(NOZZLE_AS_PROBE, "NOZZLE_AS_PROBE", "")
#elif ENABLED(NOZZLE_AS_PROBE) TERN(FIX_MOUNTED_PROBE, "FIX_MOUNTED_PROBE", "")
"NOZZLE_AS_PROBE" TERN(BLTOUCH, "BLTOUCH", "")
#elif ENABLED(FIX_MOUNTED_PROBE) TERN(HAS_Z_SERVO_PROBE, TERN(BLTOUCH, "BLTOUCH", "SERVO PROBE"), "")
"FIX_MOUNTED_PROBE" TERN(TOUCH_MI_PROBE, "TOUCH_MI_PROBE", "")
#elif ENABLED(BLTOUCH) TERN(Z_PROBE_SLED, "Z_PROBE_SLED", "")
"BLTOUCH" TERN(Z_PROBE_ALLEN_KEY, "Z_PROBE_ALLEN_KEY", "")
#elif HAS_Z_SERVO_PROBE TERN(SOLENOID_PROBE, "SOLENOID_PROBE", "")
"SERVO PROBE" TERN(PROBE_SELECTED, "", "NONE")
#elif ENABLED(TOUCH_MI_PROBE)
"TOUCH_MI_PROBE"
#elif ENABLED(Z_PROBE_SLED)
"Z_PROBE_SLED"
#elif ENABLED(Z_PROBE_ALLEN_KEY)
"Z_PROBE_ALLEN_KEY"
#elif ENABLED(SOLENOID_PROBE)
"SOLENOID_PROBE"
#else
"NONE"
#endif
); );
#if HAS_BED_PROBE #if HAS_BED_PROBE
@ -107,20 +91,10 @@ void safe_delay(millis_t ms) {
else else
SERIAL_ECHOPGM(" (Aligned With"); SERIAL_ECHOPGM(" (Aligned With");
if (probe.offset_xy.y > 0) { if (probe.offset_xy.y > 0)
#if IS_SCARA serialprintPGM(ENABLED(IS_SCARA) ? PSTR("-Distal") : PSTR("-Back"));
SERIAL_ECHOPGM("-Distal"); else if (probe.offset_xy.y < 0)
#else serialprintPGM(ENABLED(IS_SCARA) ? PSTR("-Proximal") : PSTR("-Front"));
SERIAL_ECHOPGM("-Back");
#endif
}
else if (probe.offset_xy.y < 0) {
#if IS_SCARA
SERIAL_ECHOPGM("-Proximal");
#else
SERIAL_ECHOPGM("-Front");
#endif
}
else if (probe.offset_xy.x != 0) else if (probe.offset_xy.x != 0)
SERIAL_ECHOPGM("-Center"); SERIAL_ECHOPGM("-Center");
@ -128,27 +102,18 @@ void safe_delay(millis_t ms) {
#endif #endif
if (probe.offset.z < 0) serialprintPGM(probe.offset.z < 0 ? PSTR("Below") : probe.offset.z > 0 ? PSTR("Above") : PSTR("Same Z as"));
SERIAL_ECHOPGM("Below");
else if (probe.offset.z > 0)
SERIAL_ECHOPGM("Above");
else
SERIAL_ECHOPGM("Same Z as");
SERIAL_ECHOLNPGM(" Nozzle)"); SERIAL_ECHOLNPGM(" Nozzle)");
#endif #endif
#if HAS_ABL_OR_UBL #if HAS_ABL_OR_UBL
SERIAL_ECHOPGM("Auto Bed Leveling: "); SERIAL_ECHOPGM("Auto Bed Leveling: "
#if ENABLED(AUTO_BED_LEVELING_LINEAR) TERN(AUTO_BED_LEVELING_LINEAR, "LINEAR", "")
SERIAL_ECHOLNPGM("LINEAR"); TERN(AUTO_BED_LEVELING_BILINEAR, "BILINEAR", "")
#elif ENABLED(AUTO_BED_LEVELING_BILINEAR) TERN(AUTO_BED_LEVELING_3POINT, "3POINT", "")
SERIAL_ECHOLNPGM("BILINEAR"); TERN(AUTO_BED_LEVELING_UBL, "UBL", "")
#elif ENABLED(AUTO_BED_LEVELING_3POINT) );
SERIAL_ECHOLNPGM("3POINT");
#elif ENABLED(AUTO_BED_LEVELING_UBL)
SERIAL_ECHOLNPGM("UBL");
#endif
if (planner.leveling_active) { if (planner.leveling_active) {
SERIAL_ECHOLNPGM(" (enabled)"); SERIAL_ECHOLNPGM(" (enabled)");

View File

@ -48,24 +48,16 @@
#include "../MarlinCore.h" #include "../MarlinCore.h"
#include "../HAL/shared/Delay.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 _ROT == 0 || _ROT == 180
#if HAS_SIDE_BY_SIDE #define MAX7219_X_LEDS TERN(HAS_SIDE_BY_SIDE, 8, MAX7219_LINES)
#define MAX7219_X_LEDS 8 #define MAX7219_Y_LEDS TERN(HAS_SIDE_BY_SIDE, MAX7219_LINES, 8)
#define MAX7219_Y_LEDS MAX7219_LINES
#else
#define MAX7219_Y_LEDS 8
#define MAX7219_X_LEDS MAX7219_LINES
#endif
#elif _ROT == 90 || _ROT == 270 #elif _ROT == 90 || _ROT == 270
#if HAS_SIDE_BY_SIDE #define MAX7219_X_LEDS TERN(HAS_SIDE_BY_SIDE, MAX7219_LINES, 8)
#define MAX7219_Y_LEDS 8 #define MAX7219_Y_LEDS TERN(HAS_SIDE_BY_SIDE, 8, MAX7219_LINES)
#define MAX7219_X_LEDS MAX7219_LINES
#else
#define MAX7219_X_LEDS 8
#define MAX7219_Y_LEDS MAX7219_LINES
#endif
#else #else
#error "MAX7219_ROTATE must be a multiple of +/- 90°." #error "MAX7219_ROTATE must be a multiple of +/- 90°."
#endif #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) { void Babystep::add_steps(const AxisEnum axis, const int16_t distance) {
#if ENABLED(BABYSTEP_WITHOUT_HOMING) if (DISABLED(BABYSTEP_WITHOUT_HOMING) && !TEST(axis_known_position, axis)) return;
#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;
accum += distance; // Count up babysteps for the UI accum += distance; // Count up babysteps for the UI
#if ENABLED(BABYSTEP_DISPLAY_TOTAL) #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 const bool should_set = last_written_mode != ENABLED(BLTOUCH_SET_5V_MODE);
#if ENABLED(BLTOUCH_SET_5V_MODE)
|| true
#endif
);
#endif #endif
if (should_set && set_voltage) if (should_set && set_voltage)
mode_conv_proc((false mode_conv_proc(ENABLED(BLTOUCH_SET_5V_MODE));
#if ENABLED(BLTOUCH_SET_5V_MODE)
|| true
#endif
));
} }
void BLTouch::clear() { void BLTouch::clear() {

View File

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

View File

@ -62,13 +62,7 @@
current_position.set(0.0, 0.0); current_position.set(0.0, 0.0);
sync_plan_position(); sync_plan_position();
const int x_axis_home_dir = const int x_axis_home_dir = x_home_dir(active_extruder);
#if ENABLED(DUAL_X_CARRIAGE)
x_home_dir(active_extruder)
#else
home_dir(X_AXIS)
#endif
;
const float mlx = max_length(X_AXIS), const float mlx = max_length(X_AXIS),
mly = max_length(Y_AXIS), mly = max_length(Y_AXIS),
@ -310,6 +304,8 @@ void GcodeSuite::G28() {
#if ENABLED(DELTA) #if ENABLED(DELTA)
constexpr bool doZ = true; // for NANODLP_Z_SYNC if your DLP is on a DELTA
home_delta(); home_delta();
#if ENABLED(IMPROVE_HOMING_RELIABILITY) #if ENABLED(IMPROVE_HOMING_RELIABILITY)
@ -330,12 +326,10 @@ void GcodeSuite::G28() {
#endif #endif
const float z_homing_height = ( const float z_homing_height =
#if ENABLED(UNKNOWN_Z_NO_RAISE) (DISABLED(UNKNOWN_Z_NO_RAISE) || TEST(axis_known_position, Z_AXIS))
!TEST(axis_known_position, Z_AXIS) ? 0 : ? (parser.seenval('R') ? parser.value_linear_units() : Z_HOMING_HEIGHT)
#endif : 0;
(parser.seenval('R') ? parser.value_linear_units() : Z_HOMING_HEIGHT)
);
if (z_homing_height && (doX || doY)) { if (z_homing_height && (doX || doY)) {
// Raise Z before homing any other axes and z is not already high enough (never lower z) // Raise Z before homing any other axes and z is not already high enough (never lower z)
@ -355,20 +349,13 @@ void GcodeSuite::G28() {
// Home Y (before X) // Home Y (before X)
#if ENABLED(HOME_Y_BEFORE_X) #if ENABLED(HOME_Y_BEFORE_X)
if (doY if (doY || (doX && ENABLED(CODEPENDENT_XY_HOMING)))
#if ENABLED(CODEPENDENT_XY_HOMING) homeaxis(Y_AXIS);
|| doX
#endif
) homeaxis(Y_AXIS);
#endif #endif
// Home X // Home X
if (doX if (doX || (doY && ENABLED(CODEPENDENT_XY_HOMING) && DISABLED(HOME_Y_BEFORE_X))) {
#if ENABLED(CODEPENDENT_XY_HOMING) && DISABLED(HOME_Y_BEFORE_X)
|| doY
#endif
) {
#if ENABLED(DUAL_X_CARRIAGE) #if ENABLED(DUAL_X_CARRIAGE)
@ -396,9 +383,8 @@ void GcodeSuite::G28() {
} }
// Home Y (after X) // Home Y (after X)
#if DISABLED(HOME_Y_BEFORE_X) if (DISABLED(HOME_Y_BEFORE_X) && doY)
if (doY) homeaxis(Y_AXIS); homeaxis(Y_AXIS);
#endif
#if ENABLED(IMPROVE_HOMING_RELIABILITY) #if ENABLED(IMPROVE_HOMING_RELIABILITY)
end_slow_homing(slow_homing); end_slow_homing(slow_homing);
@ -487,7 +473,7 @@ void GcodeSuite::G28() {
do_blocking_move_to_z(delta_clip_start_height); do_blocking_move_to_z(delta_clip_start_height);
#endif #endif
#if HAS_LEVELING && ENABLED(RESTORE_LEVELING_AFTER_G28) #if ENABLED(RESTORE_LEVELING_AFTER_G28)
set_bed_leveling_enabled(leveling_was_active); set_bed_leveling_enabled(leveling_was_active);
#endif #endif
@ -495,12 +481,7 @@ void GcodeSuite::G28() {
// Restore the active tool after homing // Restore the active tool after homing
#if HOTENDS > 1 && (DISABLED(DELTA) || ENABLED(DELTA_HOME_TO_SAFE_ZONE)) #if HOTENDS > 1 && (DISABLED(DELTA) || ENABLED(DELTA_HOME_TO_SAFE_ZONE))
#if EITHER(PARKING_EXTRUDER, DUAL_X_CARRIAGE) tool_change(old_tool_index, NONE(PARKING_EXTRUDER, DUAL_X_CARRIAGE)); // Do move if one of these
#define NO_FETCH false // fetch the previous toolhead
#else
#define NO_FETCH true
#endif
tool_change(old_tool_index, NO_FETCH);
#endif #endif
#if HAS_HOMING_CURRENT #if HAS_HOMING_CURRENT
@ -523,15 +504,8 @@ void GcodeSuite::G28() {
report_current_position(); report_current_position();
#if ENABLED(NANODLP_Z_SYNC) if (ENABLED(NANODLP_Z_SYNC) && (doZ || ENABLED(NANODLP_ALL_AXIS)))
#if ENABLED(NANODLP_ALL_AXIS)
#define _HOME_SYNC true // For any axis, output sync text.
#else
#define _HOME_SYNC doZ // Only for Z-axis
#endif
if (_HOME_SYNC)
SERIAL_ECHOLNPGM(STR_Z_MOVE_COMP); SERIAL_ECHOLNPGM(STR_Z_MOVE_COMP);
#endif
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("<<< G28"); if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("<<< G28");

View File

@ -56,8 +56,12 @@
#define CALIBRATION_MEASUREMENT_CERTAIN 0.5 // mm #define CALIBRATION_MEASUREMENT_CERTAIN 0.5 // mm
#endif #endif
#define HAS_X_CENTER BOTH(CALIBRATION_MEASURE_LEFT, CALIBRATION_MEASURE_RIGHT) #if BOTH(CALIBRATION_MEASURE_LEFT, CALIBRATION_MEASURE_RIGHT)
#define HAS_Y_CENTER BOTH(CALIBRATION_MEASURE_FRONT, CALIBRATION_MEASURE_BACK) #define HAS_X_CENTER 1
#endif
#if BOTH(CALIBRATION_MEASURE_FRONT, CALIBRATION_MEASURE_BACK)
#define HAS_Y_CENTER 1
#endif
enum side_t : uint8_t { TOP, RIGHT, FRONT, LEFT, BACK, NUM_SIDES }; enum side_t : uint8_t { TOP, RIGHT, FRONT, LEFT, BACK, NUM_SIDES };

View File

@ -54,39 +54,19 @@ void GcodeSuite::M115() {
#endif #endif
// SERIAL_XON_XOFF // SERIAL_XON_XOFF
cap_line(PSTR("SERIAL_XON_XOFF") cap_line(PSTR("SERIAL_XON_XOFF"), ENABLED(SERIAL_XON_XOFF));
#if ENABLED(SERIAL_XON_XOFF)
, true
#endif
);
// BINARY_FILE_TRANSFER (M28 B1) // BINARY_FILE_TRANSFER (M28 B1)
cap_line(PSTR("BINARY_FILE_TRANSFER") cap_line(PSTR("BINARY_FILE_TRANSFER"), ENABLED(BINARY_FILE_TRANSFER));
#if ENABLED(BINARY_FILE_TRANSFER)
, true
#endif
);
// EEPROM (M500, M501) // EEPROM (M500, M501)
cap_line(PSTR("EEPROM") cap_line(PSTR("EEPROM"), ENABLED(EEPROM_SETTINGS));
#if ENABLED(EEPROM_SETTINGS)
, true
#endif
);
// Volumetric Extrusion (M200) // Volumetric Extrusion (M200)
cap_line(PSTR("VOLUMETRIC") cap_line(PSTR("VOLUMETRIC"), DISABLED(NO_VOLUMETRICS));
#if DISABLED(NO_VOLUMETRICS)
, true
#endif
);
// AUTOREPORT_TEMP (M155) // AUTOREPORT_TEMP (M155)
cap_line(PSTR("AUTOREPORT_TEMP") cap_line(PSTR("AUTOREPORT_TEMP"), ENABLED(AUTO_REPORT_TEMPERATURES));
#if ENABLED(AUTO_REPORT_TEMPERATURES)
, true
#endif
);
// PROGRESS (M530 S L, M531 <file>, M532 X L) // PROGRESS (M530 S L, M531 <file>, M532 X L)
cap_line(PSTR("PROGRESS")); cap_line(PSTR("PROGRESS"));
@ -95,93 +75,42 @@ void GcodeSuite::M115() {
cap_line(PSTR("PRINT_JOB"), true); cap_line(PSTR("PRINT_JOB"), true);
// AUTOLEVEL (G29) // AUTOLEVEL (G29)
cap_line(PSTR("AUTOLEVEL") cap_line(PSTR("AUTOLEVEL"), ENABLED(HAS_AUTOLEVEL));
#if HAS_AUTOLEVEL
, true
#endif
);
// Z_PROBE (G30) // Z_PROBE (G30)
cap_line(PSTR("Z_PROBE") cap_line(PSTR("Z_PROBE"), ENABLED(HAS_BED_PROBE));
#if HAS_BED_PROBE
, true
#endif
);
// MESH_REPORT (M420 V) // MESH_REPORT (M420 V)
cap_line(PSTR("LEVELING_DATA") cap_line(PSTR("LEVELING_DATA"), ENABLED(HAS_LEVELING));
#if HAS_LEVELING
, true
#endif
);
// BUILD_PERCENT (M73) // BUILD_PERCENT (M73)
cap_line(PSTR("BUILD_PERCENT") cap_line(PSTR("BUILD_PERCENT"), ENABLED(LCD_SET_PROGRESS_MANUALLY));
#if ENABLED(LCD_SET_PROGRESS_MANUALLY)
, true
#endif
);
// SOFTWARE_POWER (M80, M81) // SOFTWARE_POWER (M80, M81)
cap_line(PSTR("SOFTWARE_POWER") cap_line(PSTR("SOFTWARE_POWER"), ENABLED(PSU_CONTROL));
#if ENABLED(PSU_CONTROL)
, true
#endif
);
// CASE LIGHTS (M355) // CASE LIGHTS (M355)
cap_line(PSTR("TOGGLE_LIGHTS") cap_line(PSTR("TOGGLE_LIGHTS"), ENABLED(HAS_CASE_LIGHT));
#if HAS_CASE_LIGHT
, true cap_line(PSTR("CASE_LIGHT_BRIGHTNESS"), TERN(HAS_CASE_LIGHT, PWM_PIN(CASE_LIGHT_PIN), 0));
#endif
);
cap_line(PSTR("CASE_LIGHT_BRIGHTNESS")
#if HAS_CASE_LIGHT
, PWM_PIN(CASE_LIGHT_PIN)
#endif
);
// EMERGENCY_PARSER (M108, M112, M410, M876) // EMERGENCY_PARSER (M108, M112, M410, M876)
cap_line(PSTR("EMERGENCY_PARSER") cap_line(PSTR("EMERGENCY_PARSER"), ENABLED(EMERGENCY_PARSER));
#if ENABLED(EMERGENCY_PARSER)
, true
#endif
);
// PROMPT SUPPORT (M876) // PROMPT SUPPORT (M876)
cap_line(PSTR("PROMPT_SUPPORT") cap_line(PSTR("PROMPT_SUPPORT"), ENABLED(HOST_PROMPT_SUPPORT));
#if ENABLED(HOST_PROMPT_SUPPORT)
, true
#endif
);
// AUTOREPORT_SD_STATUS (M27 extension) // AUTOREPORT_SD_STATUS (M27 extension)
cap_line(PSTR("AUTOREPORT_SD_STATUS") cap_line(PSTR("AUTOREPORT_SD_STATUS"), ENABLED(AUTO_REPORT_SD_STATUS));
#if ENABLED(AUTO_REPORT_SD_STATUS)
, true
#endif
);
// THERMAL_PROTECTION // THERMAL_PROTECTION
cap_line(PSTR("THERMAL_PROTECTION") cap_line(PSTR("THERMAL_PROTECTION"), ENABLED(THERMALLY_SAFE));
#if (ENABLED(THERMAL_PROTECTION_HOTENDS) || !EXTRUDERS) && (ENABLED(THERMAL_PROTECTION_BED) || !HAS_HEATED_BED) && (ENABLED(THERMAL_PROTECTION_CHAMBER) || !HAS_HEATED_CHAMBER)
, true
#endif
);
// MOTION_MODES (M80-M89) // MOTION_MODES (M80-M89)
cap_line(PSTR("MOTION_MODES") cap_line(PSTR("MOTION_MODES"), ENABLED(GCODE_MOTION_MODES));
#if ENABLED(GCODE_MOTION_MODES)
, true
#endif
);
// CHAMBER_TEMPERATURE (M141, M191) // CHAMBER_TEMPERATURE (M141, M191)
cap_line(PSTR("CHAMBER_TEMPERATURE") cap_line(PSTR("CHAMBER_TEMPERATURE"), ENABLED(HAS_HEATED_CHAMBER));
#if HAS_HEATED_CHAMBER
, true
#endif
);
#endif // EXTENDED_CAPABILITIES_REPORT #endif // EXTENDED_CAPABILITIES_REPORT
} }

View File

@ -26,6 +26,15 @@
* Conditionals that need to be set before Configuration_adv.h or pins.h * Conditionals that need to be set before Configuration_adv.h or pins.h
*/ */
#if ENABLED(MORGAN_SCARA)
#define IS_SCARA 1
#define IS_KINEMATIC 1
#elif ENABLED(DELTA)
#define IS_KINEMATIC 1
#else
#define IS_CARTESIAN 1
#endif
#if ENABLED(CARTESIO_UI) #if ENABLED(CARTESIO_UI)
#define DOGLCD #define DOGLCD
@ -193,7 +202,9 @@
#endif #endif
// 128x64 I2C OLED LCDs - SSD1306/SSD1309/SH1106 // 128x64 I2C OLED LCDs - SSD1306/SSD1309/SH1106
#define HAS_SSD1306_OLED_I2C ANY(U8GLIB_SSD1306, U8GLIB_SSD1309, U8GLIB_SH1106) #if ANY(U8GLIB_SSD1306, U8GLIB_SSD1309, U8GLIB_SH1106)
#define HAS_SSD1306_OLED_I2C 1
#endif
#if HAS_SSD1306_OLED_I2C #if HAS_SSD1306_OLED_I2C
#define IS_ULTRA_LCD #define IS_ULTRA_LCD
#define DOGLCD #define DOGLCD
@ -347,19 +358,34 @@
#endif #endif
// Extensible UI serial touch screens. (See src/lcd/extensible_ui) // Extensible UI serial touch screens. (See src/lcd/extensible_ui)
#if ANY(MALYAN_LCD, DGUS_LCD, TOUCH_UI_FTDI_EVE) #if ANY(DGUS_LCD_UI_ORIGIN, DGUS_LCD_UI_FYSETC, DGUS_LCD_UI_HIPRECY)
#define HAS_DGUS_LCD 1
#endif
#if ANY(HAS_DGUS_LCD, MALYAN_LCD, TOUCH_UI_FTDI_EVE)
#define IS_EXTUI #define IS_EXTUI
#define EXTENSIBLE_UI #define EXTENSIBLE_UI
#endif #endif
// Aliases for LCD features // Aliases for LCD features
#define HAS_SPI_LCD ENABLED(ULTRA_LCD) #if EITHER(ULTRA_LCD, EXTENSIBLE_UI)
#define HAS_DISPLAY (HAS_SPI_LCD || ENABLED(EXTENSIBLE_UI)) #define HAS_DISPLAY 1
#define HAS_GRAPHICAL_LCD ENABLED(DOGLCD) #if ENABLED(ULTRA_LCD)
#define HAS_CHARACTER_LCD (HAS_SPI_LCD && !HAS_GRAPHICAL_LCD) #define HAS_SPI_LCD 1
#define HAS_LCD_MENU (ENABLED(ULTIPANEL) && DISABLED(NO_LCD_MENUS)) #if ENABLED(DOGLCD)
#define HAS_ADC_BUTTONS ENABLED(ADC_KEYPAD) #define HAS_GRAPHICAL_LCD 1
#define HAS_DGUS_LCD ANY(DGUS_LCD_UI_ORIGIN, DGUS_LCD_UI_FYSETC, DGUS_LCD_UI_HIPRECY) #else
#define HAS_CHARACTER_LCD 1
#endif
#endif
#endif
#if ENABLED(ULTIPANEL) && DISABLED(NO_LCD_MENUS)
#define HAS_LCD_MENU 1
#endif
#if ENABLED(ADC_KEYPAD)
#define HAS_ADC_BUTTONS 1
#endif
#if HAS_GRAPHICAL_LCD #if HAS_GRAPHICAL_LCD
#ifndef LCD_PIXEL_WIDTH #ifndef LCD_PIXEL_WIDTH
@ -447,12 +473,17 @@
#define ARRAY_BY_HOTENDS(V...) ARRAY_N(HOTENDS, V) #define ARRAY_BY_HOTENDS(V...) ARRAY_N(HOTENDS, V)
#define ARRAY_BY_HOTENDS1(v1) ARRAY_BY_HOTENDS(v1, v1, v1, v1, v1, v1, v1, v1) #define ARRAY_BY_HOTENDS1(v1) ARRAY_BY_HOTENDS(v1, v1, v1, v1, v1, v1, v1, v1)
#define DO_SWITCH_EXTRUDER (ENABLED(SWITCHING_EXTRUDER) && (DISABLED(SWITCHING_NOZZLE) || SWITCHING_EXTRUDER_SERVO_NR != SWITCHING_NOZZLE_SERVO_NR)) #if ENABLED(SWITCHING_EXTRUDER) && (DISABLED(SWITCHING_NOZZLE) || SWITCHING_EXTRUDER_SERVO_NR != SWITCHING_NOZZLE_SERVO_NR)
#define SWITCHING_NOZZLE_TWO_SERVOS defined(SWITCHING_NOZZLE_E1_SERVO_NR) #define DO_SWITCH_EXTRUDER 1
#endif
#define HAS_DUPLICATION_MODE EITHER(DUAL_X_CARRIAGE, MULTI_NOZZLE_DUPLICATION) #ifdef SWITCHING_NOZZLE_E1_SERVO_NR
#define SWITCHING_NOZZLE_TWO_SERVOS 1
#endif
#define HAS_HOTEND_OFFSET (HOTENDS > 1) #if HOTENDS > 1
#define HAS_HOTEND_OFFSET 1
#endif
/** /**
* Default hotend offsets, if not defined * Default hotend offsets, if not defined
@ -509,6 +540,10 @@
#endif #endif
#endif #endif
#ifndef NUM_SERVOS
#define NUM_SERVOS 0
#endif
#ifndef PREHEAT_1_LABEL #ifndef PREHEAT_1_LABEL
#define PREHEAT_1_LABEL "PLA" #define PREHEAT_1_LABEL "PLA"
#endif #endif
@ -520,8 +555,12 @@
/** /**
* Set a flag for a servo probe (or BLTouch) * Set a flag for a servo probe (or BLTouch)
*/ */
#define HAS_Z_SERVO_PROBE (defined(Z_PROBE_SERVO_NR) && Z_PROBE_SERVO_NR >= 0) #if defined(Z_PROBE_SERVO_NR) && Z_PROBE_SERVO_NR >= 0
#define HAS_SERVO_ANGLES (HAS_Z_SERVO_PROBE || EITHER(SWITCHING_EXTRUDER, SWITCHING_NOZZLE)) #define HAS_Z_SERVO_PROBE 1
#endif
#if HAS_Z_SERVO_PROBE || EITHER(SWITCHING_EXTRUDER, SWITCHING_NOZZLE)
#define HAS_SERVO_ANGLES 1
#endif
#if !HAS_SERVO_ANGLES #if !HAS_SERVO_ANGLES
#undef EDITABLE_SERVO_ANGLES #undef EDITABLE_SERVO_ANGLES
#endif #endif
@ -529,20 +568,31 @@
/** /**
* Set flags for enabled probes * Set flags for enabled probes
*/ */
#define HAS_BED_PROBE (HAS_Z_SERVO_PROBE || ANY(FIX_MOUNTED_PROBE, NOZZLE_AS_PROBE, TOUCH_MI_PROBE, Z_PROBE_ALLEN_KEY, Z_PROBE_SLED, SOLENOID_PROBE, SENSORLESS_PROBING, RACK_AND_PINION_PROBE)) #if ANY(HAS_Z_SERVO_PROBE, FIX_MOUNTED_PROBE, NOZZLE_AS_PROBE, TOUCH_MI_PROBE, Z_PROBE_ALLEN_KEY, Z_PROBE_SLED, SOLENOID_PROBE, SENSORLESS_PROBING, RACK_AND_PINION_PROBE)
#define PROBE_SELECTED (HAS_BED_PROBE || EITHER(PROBE_MANUALLY, MESH_BED_LEVELING)) #define HAS_BED_PROBE 1
#endif
#if HAS_BED_PROBE || EITHER(PROBE_MANUALLY, MESH_BED_LEVELING)
#define PROBE_SELECTED 1
#endif
#if HAS_BED_PROBE #if HAS_BED_PROBE
#define HAS_PROBE_XY_OFFSET DISABLED(NOZZLE_AS_PROBE) #if DISABLED(NOZZLE_AS_PROBE)
#define HAS_CUSTOM_PROBE_PIN DISABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN) #define HAS_PROBE_XY_OFFSET 1
#define HOMING_Z_WITH_PROBE (Z_HOME_DIR < 0 && !HAS_CUSTOM_PROBE_PIN) #endif
#if DISABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN)
#define HAS_CUSTOM_PROBE_PIN 1
#endif
#if Z_HOME_DIR < 0 && !HAS_CUSTOM_PROBE_PIN
#define HOMING_Z_WITH_PROBE 1
#endif
#ifndef Z_PROBE_LOW_POINT #ifndef Z_PROBE_LOW_POINT
#define Z_PROBE_LOW_POINT -5 #define Z_PROBE_LOW_POINT -5
#endif #endif
#if ENABLED(Z_PROBE_ALLEN_KEY) #if ENABLED(Z_PROBE_ALLEN_KEY)
#define PROBE_TRIGGERED_WHEN_STOWED_TEST // Extra test for Allen Key Probe #define PROBE_TRIGGERED_WHEN_STOWED_TEST 1 // Extra test for Allen Key Probe
#endif #endif
#ifdef MULTIPLE_PROBING #if MULTIPLE_PROBING > 1
#if EXTRA_PROBING #if EXTRA_PROBING
#define TOTAL_PROBING (MULTIPLE_PROBING + EXTRA_PROBING) #define TOTAL_PROBING (MULTIPLE_PROBING + EXTRA_PROBING)
#else #else
@ -558,23 +608,6 @@
#define GRID_MAX_POINTS ((GRID_MAX_POINTS_X) * (GRID_MAX_POINTS_Y)) #define GRID_MAX_POINTS ((GRID_MAX_POINTS_X) * (GRID_MAX_POINTS_Y))
#endif #endif
#define HAS_EXTRA_ENDSTOPS ANY(X_DUAL_ENDSTOPS, Y_DUAL_ENDSTOPS, Z_MULTI_ENDSTOPS)
#define HAS_SOFTWARE_ENDSTOPS EITHER(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS)
#define HAS_RESUME_CONTINUE ANY(EXTENSIBLE_UI, NEWPANEL, EMERGENCY_PARSER)
#define HAS_COLOR_LEDS ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED)
#define HAS_LEDS_OFF_FLAG (BOTH(PRINTER_EVENT_LEDS, SDSUPPORT) && HAS_RESUME_CONTINUE)
#define HAS_PRINT_PROGRESS EITHER(SDSUPPORT, LCD_SET_PROGRESS_MANUALLY)
#define HAS_PRINT_PROGRESS_PERMYRIAD (HAS_PRINT_PROGRESS && EITHER(PRINT_PROGRESS_SHOW_DECIMALS, SHOW_REMAINING_TIME))
#define HAS_SERVICE_INTERVALS (ENABLED(PRINTCOUNTER) && (SERVICE_INTERVAL_1 > 0 || SERVICE_INTERVAL_2 > 0 || SERVICE_INTERVAL_3 > 0))
#define HAS_FILAMENT_SENSOR ENABLED(FILAMENT_RUNOUT_SENSOR)
#define HAS_GAMES ANY(MARLIN_BRICKOUT, MARLIN_INVADERS, MARLIN_SNAKE, MARLIN_MAZE)
#define HAS_GAME_MENU (1 < ENABLED(MARLIN_BRICKOUT) + ENABLED(MARLIN_INVADERS) + ENABLED(MARLIN_SNAKE) + ENABLED(MARLIN_MAZE))
#define IS_SCARA ENABLED(MORGAN_SCARA)
#define IS_KINEMATIC (ENABLED(DELTA) || IS_SCARA)
#define IS_CARTESIAN !IS_KINEMATIC
#ifndef INVERT_X_DIR #ifndef INVERT_X_DIR
#define INVERT_X_DIR false #define INVERT_X_DIR false
#endif #endif
@ -592,16 +625,15 @@
#define BOOT_MARLIN_LOGO_SMALL #define BOOT_MARLIN_LOGO_SMALL
#endif #endif
#define IS_RE_ARM_BOARD MB(RAMPS_14_RE_ARM_EFB, RAMPS_14_RE_ARM_EEB, RAMPS_14_RE_ARM_EFF, RAMPS_14_RE_ARM_EEF, RAMPS_14_RE_ARM_SF)
// Linear advance uses Jerk since E is an isolated axis
#define HAS_LINEAR_E_JERK (DISABLED(CLASSIC_JERK) && ENABLED(LIN_ADVANCE))
// This flag indicates some kind of jerk storage is needed // This flag indicates some kind of jerk storage is needed
#define HAS_CLASSIC_JERK (ENABLED(CLASSIC_JERK) || IS_KINEMATIC) #if ENABLED(CLASSIC_JERK) || IS_KINEMATIC
#define HAS_CLASSIC_JERK 1
#endif
// E jerk exists with JD disabled (of course) but also when Linear Advance is disabled on Delta/SCARA // E jerk exists with JD disabled (of course) but also when Linear Advance is disabled on Delta/SCARA
#define HAS_CLASSIC_E_JERK (ENABLED(CLASSIC_JERK) || (IS_KINEMATIC && DISABLED(LIN_ADVANCE))) #if ENABLED(CLASSIC_JERK) || (IS_KINEMATIC && DISABLED(LIN_ADVANCE))
#define HAS_CLASSIC_E_JERK 1
#endif
#ifndef SPI_SPEED #ifndef SPI_SPEED
#define SPI_SPEED SPI_FULL_SPEED #define SPI_SPEED SPI_FULL_SPEED

View File

@ -56,6 +56,50 @@
#undef SHOW_TEMP_ADC_VALUES #undef SHOW_TEMP_ADC_VALUES
#endif #endif
#if EITHER(DUAL_X_CARRIAGE, MULTI_NOZZLE_DUPLICATION)
#define HAS_DUPLICATION_MODE 1
#endif
#if ENABLED(PRINTCOUNTER) && (SERVICE_INTERVAL_1 > 0 || SERVICE_INTERVAL_2 > 0 || SERVICE_INTERVAL_3 > 0)
#define HAS_SERVICE_INTERVALS 1
#endif
#if ENABLED(FILAMENT_RUNOUT_SENSOR)
#define HAS_FILAMENT_SENSOR 1
#endif
#if EITHER(SDSUPPORT, LCD_SET_PROGRESS_MANUALLY)
#define HAS_PRINT_PROGRESS 1
#endif
#if HAS_PRINT_PROGRESS && EITHER(PRINT_PROGRESS_SHOW_DECIMALS, SHOW_REMAINING_TIME)
#define HAS_PRINT_PROGRESS_PERMYRIAD 1
#endif
#if ANY(MARLIN_BRICKOUT, MARLIN_INVADERS, MARLIN_SNAKE, MARLIN_MAZE)
#define HAS_GAMES 1
#if (1 < ENABLED(MARLIN_BRICKOUT) + ENABLED(MARLIN_INVADERS) + ENABLED(MARLIN_SNAKE) + ENABLED(MARLIN_MAZE))
#define HAS_GAME_MENU 1
#endif
#endif
#if ANY(X_DUAL_ENDSTOPS, Y_DUAL_ENDSTOPS, Z_MULTI_ENDSTOPS)
#define HAS_EXTRA_ENDSTOPS 1
#endif
#if EITHER(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS)
#define HAS_SOFTWARE_ENDSTOPS 1
#endif
#if ANY(EXTENSIBLE_UI, NEWPANEL, EMERGENCY_PARSER)
#define HAS_RESUME_CONTINUE 1
#endif
#if ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED)
#define HAS_COLOR_LEDS 1
#endif
#if ALL(HAS_RESUME_CONTINUE, PRINTER_EVENT_LEDS, SDSUPPORT)
#define HAS_LEDS_OFF_FLAG 1
#endif
#if !NUM_SERIAL #if !NUM_SERIAL
#undef BAUD_RATE_GCODE #undef BAUD_RATE_GCODE
#endif #endif
@ -65,10 +109,6 @@
#define NUM_Z_STEPPER_DRIVERS 1 #define NUM_Z_STEPPER_DRIVERS 1
#endif #endif
#ifndef PLR_ENABLED_DEFAULT
#define PLR_ENABLED_DEFAULT true
#endif
#if ENABLED(Z_STEPPER_ALIGN_KNOWN_STEPPER_POSITIONS) #if ENABLED(Z_STEPPER_ALIGN_KNOWN_STEPPER_POSITIONS)
#undef Z_STEPPER_ALIGN_AMP #undef Z_STEPPER_ALIGN_AMP
#endif #endif
@ -171,10 +211,14 @@
#endif #endif
// If platform requires early initialization of watchdog to properly boot // If platform requires early initialization of watchdog to properly boot
#define EARLY_WATCHDOG (ENABLED(USE_WATCHDOG) && defined(ARDUINO_ARCH_SAM)) #if ENABLED(USE_WATCHDOG) && defined(ARDUINO_ARCH_SAM)
#define EARLY_WATCHDOG 1
#endif
// Extensible UI pin mapping for RepRapDiscount // Extensible UI pin mapping for RepRapDiscount
#define TOUCH_UI_ULTIPANEL ENABLED(TOUCH_UI_FTDI_EVE) && ANY(AO_EXP1_PINMAP, AO_EXP2_PINMAP, CR10_TFT_PINMAP) #if ENABLED(TOUCH_UI_FTDI_EVE) && ANY(AO_EXP1_PINMAP, AO_EXP2_PINMAP, CR10_TFT_PINMAP)
#define TOUCH_UI_ULTIPANEL 1
#endif
// Poll-based jogging for joystick and other devices // Poll-based jogging for joystick and other devices
#if ENABLED(JOYSTICK) #if ENABLED(JOYSTICK)

View File

@ -30,6 +30,11 @@
// Extras for CI testing // Extras for CI testing
#endif #endif
// Linear advance uses Jerk since E is an isolated axis
#if DISABLED(CLASSIC_JERK) && ENABLED(LIN_ADVANCE)
#define HAS_LINEAR_E_JERK 1
#endif
#ifdef TEENSYDUINO #ifdef TEENSYDUINO
#undef max #undef max
#define max(a,b) ((a)>(b)?(a):(b)) #define max(a,b) ((a)>(b)?(a):(b))
@ -63,13 +68,8 @@
// Define center values for future use // Define center values for future use
#define _X_HALF_BED ((X_BED_SIZE) / 2) #define _X_HALF_BED ((X_BED_SIZE) / 2)
#define _Y_HALF_BED ((Y_BED_SIZE) / 2) #define _Y_HALF_BED ((Y_BED_SIZE) / 2)
#if ENABLED(BED_CENTER_AT_0_0) #define X_CENTER TERN(BED_CENTER_AT_0_0, 0, _X_HALF_BED)
#define X_CENTER 0 #define Y_CENTER TERN(BED_CENTER_AT_0_0, 0, _Y_HALF_BED)
#define Y_CENTER 0
#else
#define X_CENTER _X_HALF_BED
#define Y_CENTER _Y_HALF_BED
#endif
// Get the linear boundaries of the bed // Get the linear boundaries of the bed
#define X_MIN_BED (X_CENTER - _X_HALF_BED) #define X_MIN_BED (X_CENTER - _X_HALF_BED)
@ -92,10 +92,18 @@
/** /**
* CoreXY, CoreXZ, and CoreYZ - and their reverse * CoreXY, CoreXZ, and CoreYZ - and their reverse
*/ */
#define CORE_IS_XY EITHER(COREXY, COREYX) #if EITHER(COREXY, COREYX)
#define CORE_IS_XZ EITHER(COREXZ, COREZX) #define CORE_IS_XY 1
#define CORE_IS_YZ EITHER(COREYZ, COREZY) #endif
#define IS_CORE (CORE_IS_XY || CORE_IS_XZ || CORE_IS_YZ) #if EITHER(COREXZ, COREZX)
#define CORE_IS_XZ 1
#endif
#if EITHER(COREYZ, COREZY)
#define CORE_IS_YZ 1
#endif
#if CORE_IS_XY || CORE_IS_XZ || CORE_IS_YZ
#define IS_CORE 1
#endif
#if IS_CORE #if IS_CORE
#if CORE_IS_XY #if CORE_IS_XY
#define CORE_AXIS_1 A_AXIS #define CORE_AXIS_1 A_AXIS
@ -110,11 +118,7 @@
#define CORE_AXIS_1 B_AXIS #define CORE_AXIS_1 B_AXIS
#define CORE_AXIS_2 C_AXIS #define CORE_AXIS_2 C_AXIS
#endif #endif
#if ANY(COREYX, COREZX, COREZY) #define CORESIGN(n) (ANY(COREYX, COREZX, COREZY) ? (-(n)) : (n))
#define CORESIGN(n) (-(n))
#else
#define CORESIGN(n) (n)
#endif
#endif #endif
/** /**
@ -139,33 +143,23 @@
*/ */
#ifdef MANUAL_X_HOME_POS #ifdef MANUAL_X_HOME_POS
#define X_HOME_POS MANUAL_X_HOME_POS #define X_HOME_POS MANUAL_X_HOME_POS
#elif ENABLED(BED_CENTER_AT_0_0)
#if ENABLED(DELTA)
#define X_HOME_POS 0
#else #else
#define X_HOME_POS (X_HOME_DIR < 0 ? X_MIN_POS : X_MAX_POS) #define X_END_POS (X_HOME_DIR < 0 ? X_MIN_POS : X_MAX_POS)
#endif #if ENABLED(BED_CENTER_AT_0_0)
#define X_HOME_POS TERN(DELTA, 0, X_END_POS)
#else #else
#if ENABLED(DELTA) #define X_HOME_POS TERN(DELTA, X_MIN_POS + (X_BED_SIZE) * 0.5, X_END_POS)
#define X_HOME_POS (X_MIN_POS + (X_BED_SIZE) * 0.5)
#else
#define X_HOME_POS (X_HOME_DIR < 0 ? X_MIN_POS : X_MAX_POS)
#endif #endif
#endif #endif
#ifdef MANUAL_Y_HOME_POS #ifdef MANUAL_Y_HOME_POS
#define Y_HOME_POS MANUAL_Y_HOME_POS #define Y_HOME_POS MANUAL_Y_HOME_POS
#elif ENABLED(BED_CENTER_AT_0_0)
#if ENABLED(DELTA)
#define Y_HOME_POS 0
#else #else
#define Y_HOME_POS (Y_HOME_DIR < 0 ? Y_MIN_POS : Y_MAX_POS) #define Y_END_POS (Y_HOME_DIR < 0 ? Y_MIN_POS : Y_MAX_POS)
#endif #if ENABLED(BED_CENTER_AT_0_0)
#define Y_HOME_POS TERN(DELTA, 0, Y_END_POS)
#else #else
#if ENABLED(DELTA) #define Y_HOME_POS TERN(DELTA, Y_MIN_POS + (Y_BED_SIZE) * 0.5, Y_END_POS)
#define Y_HOME_POS (Y_MIN_POS + (Y_BED_SIZE) * 0.5)
#else
#define Y_HOME_POS (Y_HOME_DIR < 0 ? Y_MIN_POS : Y_MAX_POS)
#endif #endif
#endif #endif
@ -268,7 +262,10 @@
#define _LCD_CONTRAST_INIT 17 #define _LCD_CONTRAST_INIT 17
#endif #endif
#define HAS_LCD_CONTRAST defined(_LCD_CONTRAST_INIT) #ifdef _LCD_CONTRAST_INIT
#define HAS_LCD_CONTRAST 1
#endif
#if HAS_LCD_CONTRAST #if HAS_LCD_CONTRAST
#ifndef LCD_CONTRAST_MIN #ifndef LCD_CONTRAST_MIN
#ifdef _LCD_CONTRAST_MIN #ifdef _LCD_CONTRAST_MIN
@ -1291,20 +1288,40 @@
// Trinamic Stepper Drivers // Trinamic Stepper Drivers
#if HAS_TRINAMIC_CONFIG #if HAS_TRINAMIC_CONFIG
#define STEALTHCHOP_ENABLED ANY(STEALTHCHOP_XY, STEALTHCHOP_Z, STEALTHCHOP_E) #if ANY(STEALTHCHOP_XY, STEALTHCHOP_Z, STEALTHCHOP_E)
#define USE_SENSORLESS EITHER(SENSORLESS_HOMING, SENSORLESS_PROBING) #define STEALTHCHOP_ENABLED 1
#endif
#if EITHER(SENSORLESS_HOMING, SENSORLESS_PROBING)
#define USE_SENSORLESS 1
#endif
// Disable Z axis sensorless homing if a probe is used to home the Z axis // Disable Z axis sensorless homing if a probe is used to home the Z axis
#if HOMING_Z_WITH_PROBE #if HOMING_Z_WITH_PROBE
#undef Z_STALL_SENSITIVITY #undef Z_STALL_SENSITIVITY
#endif #endif
#define X_SENSORLESS (AXIS_HAS_STALLGUARD(X) && defined(X_STALL_SENSITIVITY)) #if defined(X_STALL_SENSITIVITY) && AXIS_HAS_STALLGUARD(X)
#define X2_SENSORLESS (AXIS_HAS_STALLGUARD(X2) && defined(X2_STALL_SENSITIVITY)) #define X_SENSORLESS 1
#define Y_SENSORLESS (AXIS_HAS_STALLGUARD(Y) && defined(Y_STALL_SENSITIVITY)) #endif
#define Y2_SENSORLESS (AXIS_HAS_STALLGUARD(Y2) && defined(Y2_STALL_SENSITIVITY)) #if defined(X2_STALL_SENSITIVITY) && AXIS_HAS_STALLGUARD(X2)
#define Z_SENSORLESS (AXIS_HAS_STALLGUARD(Z) && defined(Z_STALL_SENSITIVITY)) #define X2_SENSORLESS 1
#define Z2_SENSORLESS (AXIS_HAS_STALLGUARD(Z2) && defined(Z2_STALL_SENSITIVITY)) #endif
#define Z3_SENSORLESS (AXIS_HAS_STALLGUARD(Z3) && defined(Z3_STALL_SENSITIVITY)) #if defined(Y_STALL_SENSITIVITY) && AXIS_HAS_STALLGUARD(Y)
#define Z4_SENSORLESS (AXIS_HAS_STALLGUARD(Z4) && defined(Z4_STALL_SENSITIVITY)) #define Y_SENSORLESS 1
#endif
#if defined(Y2_STALL_SENSITIVITY) && AXIS_HAS_STALLGUARD(Y2)
#define Y2_SENSORLESS 1
#endif
#if defined(Z_STALL_SENSITIVITY) && AXIS_HAS_STALLGUARD(Z)
#define Z_SENSORLESS 1
#endif
#if defined(Z2_STALL_SENSITIVITY) && AXIS_HAS_STALLGUARD(Z2)
#define Z2_SENSORLESS 1
#endif
#if defined(Z3_STALL_SENSITIVITY) && AXIS_HAS_STALLGUARD(Z3)
#define Z3_SENSORLESS 1
#endif
#if defined(Z4_STALL_SENSITIVITY) && AXIS_HAS_STALLGUARD(Z4)
#define Z4_SENSORLESS 1
#endif
#if ENABLED(SPI_ENDSTOPS) #if ENABLED(SPI_ENDSTOPS)
#define X_SPI_SENSORLESS X_SENSORLESS #define X_SPI_SENSORLESS X_SENSORLESS
#define Y_SPI_SENSORLESS Y_SENSORLESS #define Y_SPI_SENSORLESS Y_SENSORLESS
@ -1388,23 +1405,48 @@
#define HAS_HEATER_BED (PIN_EXISTS(HEATER_BED)) #define HAS_HEATER_BED (PIN_EXISTS(HEATER_BED))
// Shorthand for common combinations // Shorthand for common combinations
#define HAS_HEATED_BED (HAS_TEMP_BED && HAS_HEATER_BED) #if HAS_TEMP_BED && HAS_HEATER_BED
#define BED_OR_CHAMBER (HAS_HEATED_BED || HAS_TEMP_CHAMBER) #define HAS_HEATED_BED 1
#define HAS_TEMP_SENSOR (HAS_TEMP_HOTEND || BED_OR_CHAMBER || HAS_TEMP_PROBE) #endif
#define HAS_HEATED_CHAMBER (HAS_TEMP_CHAMBER && PIN_EXISTS(HEATER_CHAMBER)) #if HAS_HEATED_BED || HAS_TEMP_CHAMBER
#define BED_OR_CHAMBER 1
#endif
#if HAS_TEMP_HOTEND || BED_OR_CHAMBER || HAS_TEMP_PROBE
#define HAS_TEMP_SENSOR 1
#endif
#if HAS_TEMP_CHAMBER && PIN_EXISTS(HEATER_CHAMBER)
#define HAS_HEATED_CHAMBER 1
#endif
// PID heating // PID heating
#if !HAS_HEATED_BED #if !HAS_HEATED_BED
#undef PIDTEMPBED #undef PIDTEMPBED
#endif #endif
#define HAS_PID_HEATING EITHER(PIDTEMP, PIDTEMPBED) #if EITHER(PIDTEMP, PIDTEMPBED)
#define HAS_PID_FOR_BOTH BOTH(PIDTEMP, PIDTEMPBED) #define HAS_PID_HEATING 1
#endif
#if BOTH(PIDTEMP, PIDTEMPBED)
#define HAS_PID_FOR_BOTH 1
#endif
// Thermal protection // Thermal protection
#define HAS_THERMALLY_PROTECTED_BED (HAS_HEATED_BED && ENABLED(THERMAL_PROTECTION_BED)) #if HAS_HEATED_BED && ENABLED(THERMAL_PROTECTION_BED)
#define WATCH_HOTENDS (ENABLED(THERMAL_PROTECTION_HOTENDS) && WATCH_TEMP_PERIOD > 0) #define HAS_THERMALLY_PROTECTED_BED 1
#define WATCH_BED (HAS_THERMALLY_PROTECTED_BED && WATCH_BED_TEMP_PERIOD > 0) #endif
#define WATCH_CHAMBER (HAS_HEATED_CHAMBER && ENABLED(THERMAL_PROTECTION_CHAMBER) && WATCH_CHAMBER_TEMP_PERIOD > 0) #if ENABLED(THERMAL_PROTECTION_HOTENDS) && WATCH_TEMP_PERIOD > 0
#define WATCH_HOTENDS 1
#endif
#if HAS_THERMALLY_PROTECTED_BED && WATCH_BED_TEMP_PERIOD > 0
#define WATCH_BED 1
#endif
#if HAS_HEATED_CHAMBER && ENABLED(THERMAL_PROTECTION_CHAMBER) && WATCH_CHAMBER_TEMP_PERIOD > 0
#define WATCH_CHAMBER 1
#endif
#if (ENABLED(THERMAL_PROTECTION_HOTENDS) || !EXTRUDERS) \
&& (ENABLED(THERMAL_PROTECTION_BED) || !HAS_HEATED_BED) \
&& (ENABLED(THERMAL_PROTECTION_CHAMBER) || !HAS_HEATED_CHAMBER)
#define THERMALLY_SAFE 1
#endif
// Auto fans // Auto fans
#define HAS_AUTO_FAN_0 (HOTENDS > 0 && PIN_EXISTS(E0_AUTO_FAN)) #define HAS_AUTO_FAN_0 (HOTENDS > 0 && PIN_EXISTS(E0_AUTO_FAN))
@ -1455,22 +1497,48 @@
#define HAS_FILAMENT_WIDTH_SENSOR (PIN_EXISTS(FILWIDTH)) #define HAS_FILAMENT_WIDTH_SENSOR (PIN_EXISTS(FILWIDTH))
// User Interface // User Interface
#define HAS_HOME (PIN_EXISTS(HOME)) #if PIN_EXISTS(HOME)
#define HAS_KILL (PIN_EXISTS(KILL)) #define HAS_HOME 1
#define HAS_SUICIDE (PIN_EXISTS(SUICIDE)) #endif
#define HAS_PHOTOGRAPH (PIN_EXISTS(PHOTOGRAPH)) #if PIN_EXISTS(KILL)
#define HAS_BUZZER (PIN_EXISTS(BEEPER) || EITHER(LCD_USE_I2C_BUZZER, PCA9632_BUZZER)) #define HAS_KILL 1
#define USE_BEEPER (HAS_BUZZER && DISABLED(LCD_USE_I2C_BUZZER, PCA9632_BUZZER)) #endif
#define HAS_CASE_LIGHT (PIN_EXISTS(CASE_LIGHT) && ENABLED(CASE_LIGHT_ENABLE)) #if PIN_EXISTS(SUICIDE)
#define HAS_SUICIDE 1
#endif
#if PIN_EXISTS(PHOTOGRAPH)
#define HAS_PHOTOGRAPH 1
#endif
#if PIN_EXISTS(BEEPER) || EITHER(LCD_USE_I2C_BUZZER, PCA9632_BUZZER)
#define HAS_BUZZER 1
#endif
#if HAS_BUZZER && DISABLED(LCD_USE_I2C_BUZZER, PCA9632_BUZZER)
#define USE_BEEPER 1
#endif
#if PIN_EXISTS(CASE_LIGHT) && ENABLED(CASE_LIGHT_ENABLE)
#define HAS_CASE_LIGHT 1
#endif
// Digital control // Digital control
#define HAS_STEPPER_RESET (PIN_EXISTS(STEPPER_RESET)) #if PIN_EXISTS(STEPPER_RESET)
#define HAS_DIGIPOTSS (PIN_EXISTS(DIGIPOTSS)) #define HAS_STEPPER_RESET 1
#define HAS_MOTOR_CURRENT_PWM ANY_PIN(MOTOR_CURRENT_PWM_X, MOTOR_CURRENT_PWM_Y, MOTOR_CURRENT_PWM_XY, MOTOR_CURRENT_PWM_Z, MOTOR_CURRENT_PWM_E) #endif
#if PIN_EXISTS(DIGIPOTSS)
#define HAS_DIGIPOTSS 1
#endif
#if ANY_PIN(MOTOR_CURRENT_PWM_X, MOTOR_CURRENT_PWM_Y, MOTOR_CURRENT_PWM_XY, MOTOR_CURRENT_PWM_Z, MOTOR_CURRENT_PWM_E)
#define HAS_MOTOR_CURRENT_PWM 1
#endif
#define HAS_SOME_Z_MICROSTEPS (HAS_Z_MICROSTEPS || HAS_Z2_MICROSTEPS || HAS_Z3_MICROSTEPS || HAS_Z4_MICROSTEPS) #if HAS_Z_MICROSTEPS || HAS_Z2_MICROSTEPS || HAS_Z3_MICROSTEPS || HAS_Z4_MICROSTEPS
#define HAS_SOME_E_MICROSTEPS (HAS_E0_MICROSTEPS || HAS_E1_MICROSTEPS || HAS_E2_MICROSTEPS || HAS_E3_MICROSTEPS || HAS_E4_MICROSTEPS || HAS_E5_MICROSTEPS || HAS_E6_MICROSTEPS || HAS_E7_MICROSTEPS) #define HAS_SOME_Z_MICROSTEPS 1
#define HAS_MICROSTEPS (HAS_X_MICROSTEPS || HAS_X2_MICROSTEPS || HAS_Y_MICROSTEPS || HAS_Y2_MICROSTEPS || HAS_SOME_Z_MICROSTEPS || HAS_SOME_E_MICROSTEPS) #endif
#if HAS_E0_MICROSTEPS || HAS_E1_MICROSTEPS || HAS_E2_MICROSTEPS || HAS_E3_MICROSTEPS || HAS_E4_MICROSTEPS || HAS_E5_MICROSTEPS || HAS_E6_MICROSTEPS || HAS_E7_MICROSTEPS
#define HAS_SOME_E_MICROSTEPS 1
#endif
#if HAS_X_MICROSTEPS || HAS_X2_MICROSTEPS || HAS_Y_MICROSTEPS || HAS_Y2_MICROSTEPS || HAS_SOME_Z_MICROSTEPS || HAS_SOME_E_MICROSTEPS
#define HAS_MICROSTEPS 1
#endif
#if HAS_MICROSTEPS #if HAS_MICROSTEPS
@ -1764,21 +1832,48 @@
/** /**
* Set granular options based on the specific type of leveling * Set granular options based on the specific type of leveling
*/ */
#define UBL_SEGMENTED BOTH(AUTO_BED_LEVELING_UBL, DELTA)
#define ABL_PLANAR EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_3POINT)
#define ABL_GRID EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR)
#define HAS_ABL_NOT_UBL (ABL_PLANAR || ABL_GRID)
#define HAS_ABL_OR_UBL (HAS_ABL_NOT_UBL || ENABLED(AUTO_BED_LEVELING_UBL))
#define HAS_LEVELING (HAS_ABL_OR_UBL || ENABLED(MESH_BED_LEVELING))
#define HAS_AUTOLEVEL (HAS_ABL_OR_UBL && DISABLED(PROBE_MANUALLY))
#define HAS_MESH ANY(AUTO_BED_LEVELING_BILINEAR, AUTO_BED_LEVELING_UBL, MESH_BED_LEVELING)
#define PLANNER_LEVELING (HAS_LEVELING && DISABLED(AUTO_BED_LEVELING_UBL))
#define HAS_PROBING_PROCEDURE (HAS_ABL_OR_UBL || ENABLED(Z_MIN_PROBE_REPEATABILITY_TEST))
#define HAS_POSITION_MODIFIERS (ENABLED(FWRETRACT) || HAS_LEVELING || ENABLED(SKEW_CORRECTION))
#define NEEDS_THREE_PROBE_POINTS EITHER(AUTO_BED_LEVELING_UBL, AUTO_BED_LEVELING_3POINT)
#if ENABLED(AUTO_BED_LEVELING_UBL) #if ENABLED(AUTO_BED_LEVELING_UBL)
#undef LCD_BED_LEVELING #undef LCD_BED_LEVELING
#if ENABLED(DELTA)
#define UBL_SEGMENTED 1
#endif
#endif
#if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_3POINT)
#define ABL_PLANAR 1
#endif
#if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR)
#define ABL_GRID 1
#endif
#if ANY(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR, AUTO_BED_LEVELING_3POINT)
#define HAS_ABL_NOT_UBL 1
#endif
#if ANY(AUTO_BED_LEVELING_BILINEAR, AUTO_BED_LEVELING_UBL, MESH_BED_LEVELING)
#define HAS_MESH 1
#endif
#if EITHER(AUTO_BED_LEVELING_UBL, AUTO_BED_LEVELING_3POINT)
#define NEEDS_THREE_PROBE_POINTS 1
#endif
#if EITHER(HAS_ABL_NOT_UBL, AUTO_BED_LEVELING_UBL)
#define HAS_ABL_OR_UBL 1
#if DISABLED(PROBE_MANUALLY)
#define HAS_AUTOLEVEL 1
#endif
#endif
#if EITHER(HAS_ABL_OR_UBL, MESH_BED_LEVELING)
#define HAS_LEVELING 1
#if DISABLED(AUTO_BED_LEVELING_UBL)
#define PLANNER_LEVELING 1
#endif
#endif
#if EITHER(HAS_ABL_OR_UBL, Z_MIN_PROBE_REPEATABILITY_TEST)
#define HAS_PROBING_PROCEDURE 1
#endif
#if ANY(FWRETRACT, HAS_LEVELING, SKEW_CORRECTION)
#define HAS_POSITION_MODIFIERS 1
#endif
#if !HAS_LEVELING
#undef RESTORE_LEVELING_AFTER_G28
#endif #endif
/** /**
@ -1905,8 +2000,8 @@
#undef MESH_MAX_Y #undef MESH_MAX_Y
#endif #endif
#if (defined(PROBE_PT_1_X) && defined(PROBE_PT_2_X) && defined(PROBE_PT_3_X) && defined(PROBE_PT_1_Y) && defined(PROBE_PT_2_Y) && defined(PROBE_PT_3_Y)) #if defined(PROBE_PT_1_X) && defined(PROBE_PT_2_X) && defined(PROBE_PT_3_X) && defined(PROBE_PT_1_Y) && defined(PROBE_PT_2_Y) && defined(PROBE_PT_3_Y)
#define HAS_FIXED_3POINT #define HAS_FIXED_3POINT 1
#endif #endif
/** /**
@ -1944,10 +2039,10 @@
* Z_HOMING_HEIGHT / Z_CLEARANCE_BETWEEN_PROBES * Z_HOMING_HEIGHT / Z_CLEARANCE_BETWEEN_PROBES
*/ */
#ifndef Z_HOMING_HEIGHT #ifndef Z_HOMING_HEIGHT
#ifndef Z_CLEARANCE_BETWEEN_PROBES #ifdef Z_CLEARANCE_BETWEEN_PROBES
#define Z_HOMING_HEIGHT 0
#else
#define Z_HOMING_HEIGHT Z_CLEARANCE_BETWEEN_PROBES #define Z_HOMING_HEIGHT Z_CLEARANCE_BETWEEN_PROBES
#else
#define Z_HOMING_HEIGHT 0
#endif #endif
#endif #endif
@ -1975,15 +2070,16 @@
#endif #endif
// Updated G92 behavior shifts the workspace // Updated G92 behavior shifts the workspace
#define HAS_POSITION_SHIFT DISABLED(NO_WORKSPACE_OFFSETS) #if DISABLED(NO_WORKSPACE_OFFSETS)
// The home offset also shifts the coordinate space #define HAS_POSITION_SHIFT 1
#define HAS_HOME_OFFSET (DISABLED(NO_WORKSPACE_OFFSETS) && IS_CARTESIAN) #if IS_CARTESIAN
// The SCARA home offset applies only on G28 #define HAS_HOME_OFFSET 1 // The home offset also shifts the coordinate space
#define HAS_SCARA_OFFSET (DISABLED(NO_WORKSPACE_OFFSETS) && IS_SCARA) #define HAS_WORKSPACE_OFFSET 1 // Cumulative offset to workspace to save some calculation
// Cumulative offset to workspace to save some calculation #define HAS_M206_COMMAND 1 // M206 sets the home offset for Cartesian machines
#define HAS_WORKSPACE_OFFSET (HAS_POSITION_SHIFT && HAS_HOME_OFFSET) #elif IS_SCARA
// M206 sets the home offset for Cartesian machines #define HAS_SCARA_OFFSET 1 // The SCARA home offset applies only on G28
#define HAS_M206_COMMAND (HAS_HOME_OFFSET && !IS_SCARA) #endif
#endif
// LCD timeout to status screen default is 15s // LCD timeout to status screen default is 15s
#ifndef LCD_TIMEOUT_TO_STATUS #ifndef LCD_TIMEOUT_TO_STATUS
@ -2006,11 +2102,7 @@
#endif #endif
// Number of VFAT entries used. Each entry has 13 UTF-16 characters // Number of VFAT entries used. Each entry has 13 UTF-16 characters
#if ENABLED(SCROLL_LONG_FILENAMES) #define MAX_VFAT_ENTRIES TERN(SCROLL_LONG_FILENAMES, 5, 2)
#define MAX_VFAT_ENTRIES (5)
#else
#define MAX_VFAT_ENTRIES (2)
#endif
// Nozzle park for Delta // Nozzle park for Delta
#if BOTH(NOZZLE_PARK_FEATURE, DELTA) #if BOTH(NOZZLE_PARK_FEATURE, DELTA)
@ -2022,9 +2114,8 @@
// on boards where SD card and LCD display share the same SPI bus // on boards where SD card and LCD display share the same SPI bus
// because of a bug in the shared SPI implementation. (See #8122) // because of a bug in the shared SPI implementation. (See #8122)
#if defined(TARGET_LPC1768) && ENABLED(REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER) && (SCK_PIN == LCD_PINS_D4) #if defined(TARGET_LPC1768) && ENABLED(REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER) && (SCK_PIN == LCD_PINS_D4)
#define SDCARD_SORT_ALPHA // Keeps one directory level in RAM. Changing #define SDCARD_SORT_ALPHA // Keep one directory level in RAM. Changing directory levels
// directory levels still glitches the screen, // may still glitch the screen, but LCD updates clean it up.
// but the following LCD update cleans it up.
#undef SDSORT_LIMIT #undef SDSORT_LIMIT
#undef SDSORT_USES_RAM #undef SDSORT_USES_RAM
#undef SDSORT_USES_STACK #undef SDSORT_USES_STACK
@ -2057,19 +2148,15 @@
#ifndef LCD_WIDTH #ifndef LCD_WIDTH
#if HAS_GRAPHICAL_LCD #if HAS_GRAPHICAL_LCD
#define LCD_WIDTH 21 #define LCD_WIDTH 21
#elif ENABLED(ULTIPANEL)
#define LCD_WIDTH 20
#else #else
#define LCD_WIDTH 16 #define LCD_WIDTH TERN(ULTIPANEL, 20, 16)
#endif #endif
#endif #endif
#ifndef LCD_HEIGHT #ifndef LCD_HEIGHT
#if HAS_GRAPHICAL_LCD #if HAS_GRAPHICAL_LCD
#define LCD_HEIGHT 5 #define LCD_HEIGHT 5
#elif ENABLED(ULTIPANEL)
#define LCD_HEIGHT 4
#else #else
#define LCD_HEIGHT 2 #define LCD_HEIGHT TERN(ULTIPANEL, 4, 2)
#endif #endif
#endif #endif
#endif #endif

View File

@ -34,6 +34,37 @@
#error "Marlin requires C++11 support (gcc >= 4.7, Arduino IDE >= 1.6.8). Please upgrade your toolchain." #error "Marlin requires C++11 support (gcc >= 4.7, Arduino IDE >= 1.6.8). Please upgrade your toolchain."
#endif #endif
// Make sure macros aren't borked
#define TEST1
#define TEST2 1
#define TEST3 0
#define TEST4 true
#if ENABLED(TEST0)
#error "ENABLED is borked!"
#endif
#if DISABLED(TEST1)
#error "DISABLED is borked!"
#endif
#if !ENABLED(TEST2)
#error "ENABLED is borked!"
#endif
#if ENABLED(TEST3)
#error "ENABLED is borked!"
#endif
#if DISABLED(TEST4)
#error "DISABLED is borked!"
#endif
#if !ANY(TEST1, TEST2, TEST3, TEST4) || ANY(TEST0, TEST3)
#error "ANY is borked!"
#endif
#if DISABLED(TEST0, TEST1, TEST2, TEST4)
#error "DISABLED is borked!"
#endif
#undef TEST1
#undef TEST2
#undef TEST3
#undef TEST4
/** /**
* We try our best to include sanity checks for all changed configuration * We try our best to include sanity checks for all changed configuration
* directives because users have a tendency to use outdated config files with * directives because users have a tendency to use outdated config files with
@ -1237,7 +1268,7 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
* Require some kind of probe for bed leveling and probe testing * Require some kind of probe for bed leveling and probe testing
*/ */
#if HAS_ABL_NOT_UBL && !PROBE_SELECTED #if HAS_ABL_NOT_UBL && !PROBE_SELECTED
#error "Auto Bed Leveling requires one of these: PROBE_MANUALLY, FIX_MOUNTED_PROBE, NOZZLE_AS_PROBE, BLTOUCH, SOLENOID_PROBE, Z_PROBE_ALLEN_KEY, Z_PROBE_SLED, or a Z Servo." #error "Auto Bed Leveling requires one of these: PROBE_MANUALLY, SENSORLESS_PROBING, BLTOUCH, FIX_MOUNTED_PROBE, NOZZLE_AS_PROBE, TOUCH_MI_PROBE, SOLENOID_PROBE, Z_PROBE_ALLEN_KEY, Z_PROBE_SLED, or a Z Servo."
#endif #endif
#if ENABLED(Z_MIN_PROBE_REPEATABILITY_TEST) #if ENABLED(Z_MIN_PROBE_REPEATABILITY_TEST)

View File

@ -27,10 +27,18 @@
#include "../libs/buzzer.h" #include "../libs/buzzer.h"
#endif #endif
#define HAS_ENCODER_ACTION (HAS_LCD_MENU || ENABLED(ULTIPANEL_FEEDMULTIPLY)) #if HAS_LCD_MENU || ENABLED(ULTIPANEL_FEEDMULTIPLY)
#define HAS_ENCODER_WHEEL ((!HAS_ADC_BUTTONS && ENABLED(NEWPANEL)) || BUTTONS_EXIST(EN1, EN2)) #define HAS_ENCODER_ACTION 1
#define HAS_DIGITAL_BUTTONS (HAS_ENCODER_WHEEL || ANY_BUTTON(ENC, BACK, UP, DWN, LFT, RT)) #endif
#define HAS_SHIFT_ENCODER (!HAS_ADC_BUTTONS && (ENABLED(REPRAPWORLD_KEYPAD) || (HAS_SPI_LCD && DISABLED(NEWPANEL)))) #if (!HAS_ADC_BUTTONS && ENABLED(NEWPANEL)) || BUTTONS_EXIST(EN1, EN2)
#define HAS_ENCODER_WHEEL 1
#endif
#if HAS_ENCODER_WHEEL || ANY_BUTTON(ENC, BACK, UP, DWN, LFT, RT)
#define HAS_DIGITAL_BUTTONS 1
#endif
#if !HAS_ADC_BUTTONS && (ENABLED(REPRAPWORLD_KEYPAD) || (HAS_SPI_LCD && DISABLED(NEWPANEL)))
#define HAS_SHIFT_ENCODER 1
#endif
// I2C buttons must be read in the main thread // I2C buttons must be read in the main thread
#define HAS_SLOW_BUTTONS EITHER(LCD_I2C_VIKI, LCD_I2C_PANELOLU2) #define HAS_SLOW_BUTTONS EITHER(LCD_I2C_VIKI, LCD_I2C_PANELOLU2)

View File

@ -181,11 +181,8 @@ typedef struct SettingsDataStruct {
// //
float mbl_z_offset; // mbl.z_offset float mbl_z_offset; // mbl.z_offset
uint8_t mesh_num_x, mesh_num_y; // GRID_MAX_POINTS_X, GRID_MAX_POINTS_Y uint8_t mesh_num_x, mesh_num_y; // GRID_MAX_POINTS_X, GRID_MAX_POINTS_Y
#if ENABLED(MESH_BED_LEVELING) float mbl_z_values[TERN(MESH_BED_LEVELING, GRID_MAX_POINTS_X, 3)] // mbl.z_values
float mbl_z_values[GRID_MAX_POINTS_X][GRID_MAX_POINTS_Y]; // mbl.z_values [TERN(MESH_BED_LEVELING, GRID_MAX_POINTS_Y, 3)];
#else
float mbl_z_values[3][3];
#endif
// //
// HAS_BED_PROBE // HAS_BED_PROBE
@ -533,11 +530,10 @@ void MarlinSettings::postprocess() {
EEPROM_START(); EEPROM_START();
eeprom_error = false; eeprom_error = false;
#if ENABLED(FLASH_EEPROM_EMULATION)
EEPROM_SKIP(ver); // Flash doesn't allow rewriting without erase // Write or Skip version. (Flash doesn't allow rewrite without erase.)
#else TERN(FLASH_EEPROM_EMULATION, EEPROM_SKIP, EEPROM_WRITE)(ver);
EEPROM_WRITE(ver); // invalidate data first
#endif
EEPROM_SKIP(working_crc); // Skip the checksum slot EEPROM_SKIP(working_crc); // Skip the checksum slot
working_crc = 0; // clear before first "real data" working_crc = 0; // clear before first "real data"
@ -564,12 +560,10 @@ void MarlinSettings::postprocess() {
EEPROM_WRITE(planner_max_jerk); EEPROM_WRITE(planner_max_jerk);
#endif #endif
#if DISABLED(CLASSIC_JERK) #if ENABLED(CLASSIC_JERK)
EEPROM_WRITE(planner.junction_deviation_mm);
#else
dummyf = 0.02f; dummyf = 0.02f;
EEPROM_WRITE(dummyf);
#endif #endif
EEPROM_WRITE(TERN(CLASSIC_JERK, dummyf, planner.junction_deviation_mm));
} }
// //
@ -617,13 +611,7 @@ void MarlinSettings::postprocess() {
// Global Leveling // Global Leveling
// //
{ {
const float zfh = ( const float zfh = TERN(ENABLE_LEVELING_FADE_HEIGHT, planner.z_fade_height, 10.0f);
#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
planner.z_fade_height
#else
10.0
#endif
);
EEPROM_WRITE(zfh); EEPROM_WRITE(zfh);
} }
@ -632,22 +620,24 @@ void MarlinSettings::postprocess() {
// //
{ {
#if ENABLED(MESH_BED_LEVELING) #if ENABLED(MESH_BED_LEVELING)
// Compile time test that sizeof(mbl.z_values) is as expected
static_assert( static_assert(
sizeof(mbl.z_values) == (GRID_MAX_POINTS) * sizeof(mbl.z_values[0][0]), sizeof(mbl.z_values) == (GRID_MAX_POINTS) * sizeof(mbl.z_values[0][0]),
"MBL Z array is the wrong size." "MBL Z array is the wrong size."
); );
const uint8_t mesh_num_x = GRID_MAX_POINTS_X, mesh_num_y = GRID_MAX_POINTS_Y; #else
EEPROM_WRITE(mbl.z_offset);
EEPROM_WRITE(mesh_num_x);
EEPROM_WRITE(mesh_num_y);
EEPROM_WRITE(mbl.z_values);
#else // For disabled MBL write a default mesh
dummyf = 0; dummyf = 0;
const uint8_t mesh_num_x = 3, mesh_num_y = 3; #endif
EEPROM_WRITE(dummyf); // z_offset
const uint8_t mesh_num_x = TERN(MESH_BED_LEVELING, GRID_MAX_POINTS_X, 3),
mesh_num_y = TERN(MESH_BED_LEVELING, GRID_MAX_POINTS_Y, 3);
EEPROM_WRITE(TERN(MESH_BED_LEVELING, mbl.z_offset, dummyf));
EEPROM_WRITE(mesh_num_x); EEPROM_WRITE(mesh_num_x);
EEPROM_WRITE(mesh_num_y); EEPROM_WRITE(mesh_num_y);
#if ENABLED(MESH_BED_LEVELING)
EEPROM_WRITE(mbl.z_values);
#else
for (uint8_t q = mesh_num_x * mesh_num_y; q--;) EEPROM_WRITE(dummyf); for (uint8_t q = mesh_num_x * mesh_num_y; q--;) EEPROM_WRITE(dummyf);
#endif #endif
} }
@ -682,26 +672,25 @@ void MarlinSettings::postprocess() {
// //
{ {
#if ENABLED(AUTO_BED_LEVELING_BILINEAR) #if ENABLED(AUTO_BED_LEVELING_BILINEAR)
// Compile time test that sizeof(z_values) is as expected
static_assert( static_assert(
sizeof(z_values) == (GRID_MAX_POINTS) * sizeof(z_values[0][0]), sizeof(z_values) == (GRID_MAX_POINTS) * sizeof(z_values[0][0]),
"Bilinear Z array is the wrong size." "Bilinear Z array is the wrong size."
); );
const uint8_t grid_max_x = GRID_MAX_POINTS_X, grid_max_y = GRID_MAX_POINTS_Y;
EEPROM_WRITE(grid_max_x); // 1 byte
EEPROM_WRITE(grid_max_y); // 1 byte
EEPROM_WRITE(bilinear_grid_spacing); // 2 ints
EEPROM_WRITE(bilinear_start); // 2 ints
EEPROM_WRITE(z_values); // 9-256 floats
#else #else
// For disabled Bilinear Grid write an empty 3x3 grid
const uint8_t grid_max_x = 3, grid_max_y = 3;
const xy_pos_t bilinear_start{0}, bilinear_grid_spacing{0}; const xy_pos_t bilinear_start{0}, bilinear_grid_spacing{0};
dummyf = 0; #endif
const uint8_t grid_max_x = TERN(AUTO_BED_LEVELING_BILINEAR, GRID_MAX_POINTS_X, 3),
grid_max_y = TERN(AUTO_BED_LEVELING_BILINEAR, GRID_MAX_POINTS_Y, 3);
EEPROM_WRITE(grid_max_x); EEPROM_WRITE(grid_max_x);
EEPROM_WRITE(grid_max_y); EEPROM_WRITE(grid_max_y);
EEPROM_WRITE(bilinear_grid_spacing); EEPROM_WRITE(bilinear_grid_spacing);
EEPROM_WRITE(bilinear_start); EEPROM_WRITE(bilinear_start);
#if ENABLED(AUTO_BED_LEVELING_BILINEAR)
EEPROM_WRITE(z_values); // 9-256 floats
#else
dummyf = 0;
for (uint16_t q = grid_max_x * grid_max_y; q--;) EEPROM_WRITE(dummyf); for (uint16_t q = grid_max_x * grid_max_y; q--;) EEPROM_WRITE(dummyf);
#endif #endif
} }
@ -711,16 +700,10 @@ void MarlinSettings::postprocess() {
// //
{ {
_FIELD_TEST(planner_leveling_active); _FIELD_TEST(planner_leveling_active);
const bool ubl_active = TERN(AUTO_BED_LEVELING_UBL, planner.leveling_active, false);
#if ENABLED(AUTO_BED_LEVELING_UBL) const int8_t storage_slot = TERN(AUTO_BED_LEVELING_UBL, ubl.storage_slot, -1);
EEPROM_WRITE(planner.leveling_active);
EEPROM_WRITE(ubl.storage_slot);
#else
const bool ubl_active = false;
const int8_t storage_slot = -1;
EEPROM_WRITE(ubl_active); EEPROM_WRITE(ubl_active);
EEPROM_WRITE(storage_slot); EEPROM_WRITE(storage_slot);
#endif // AUTO_BED_LEVELING_UBL
} }
// //
@ -728,7 +711,6 @@ void MarlinSettings::postprocess() {
// //
{ {
_FIELD_TEST(servo_angles); _FIELD_TEST(servo_angles);
#if !HAS_SERVO_ANGLES #if !HAS_SERVO_ANGLES
uint16_t servo_angles[EEPROM_NUM_SERVOS][2] = { { 0, 0 } }; uint16_t servo_angles[EEPROM_NUM_SERVOS][2] = { { 0, 0 } };
#endif #endif
@ -753,11 +735,7 @@ void MarlinSettings::postprocess() {
// //
{ {
_FIELD_TEST(bltouch_last_written_mode); _FIELD_TEST(bltouch_last_written_mode);
#if ENABLED(BLTOUCH) const bool bltouch_last_written_mode = TERN(BLTOUCH, bltouch.last_written_mode, false);
const bool &bltouch_last_written_mode = bltouch.last_written_mode;
#else
constexpr bool bltouch_last_written_mode = false;
#endif
EEPROM_WRITE(bltouch_last_written_mode); EEPROM_WRITE(bltouch_last_written_mode);
} }
@ -782,23 +760,9 @@ void MarlinSettings::postprocess() {
// Write dual endstops in X, Y, Z order. Unused = 0.0 // Write dual endstops in X, Y, Z order. Unused = 0.0
dummyf = 0; dummyf = 0;
#if ENABLED(X_DUAL_ENDSTOPS) EEPROM_WRITE(TERN(X_DUAL_ENDSTOPS, endstops.x2_endstop_adj, dummyf)); // 1 float
EEPROM_WRITE(endstops.x2_endstop_adj); // 1 float EEPROM_WRITE(TERN(Y_DUAL_ENDSTOPS, endstops.y2_endstop_adj, dummyf)); // 1 float
#else EEPROM_WRITE(TERN(Z_MULTI_ENDSTOPS, endstops.z2_endstop_adj, dummyf)); // 1 float
EEPROM_WRITE(dummyf);
#endif
#if ENABLED(Y_DUAL_ENDSTOPS)
EEPROM_WRITE(endstops.y2_endstop_adj); // 1 float
#else
EEPROM_WRITE(dummyf);
#endif
#if ENABLED(Z_MULTI_ENDSTOPS)
EEPROM_WRITE(endstops.z2_endstop_adj); // 1 float
#else
EEPROM_WRITE(dummyf);
#endif
#if ENABLED(Z_MULTI_ENDSTOPS) && NUM_Z_STEPPER_DRIVERS >= 3 #if ENABLED(Z_MULTI_ENDSTOPS) && NUM_Z_STEPPER_DRIVERS >= 3
EEPROM_WRITE(endstops.z3_endstop_adj); // 1 float EEPROM_WRITE(endstops.z3_endstop_adj); // 1 float
@ -865,12 +829,10 @@ void MarlinSettings::postprocess() {
} }
_FIELD_TEST(lpq_len); _FIELD_TEST(lpq_len);
#if ENABLED(PID_EXTRUSION_SCALING) #if DISABLED(PID_EXTRUSION_SCALING)
EEPROM_WRITE(thermalManager.lpq_len);
#else
const int16_t lpq_len = 20; const int16_t lpq_len = 20;
EEPROM_WRITE(lpq_len);
#endif #endif
EEPROM_WRITE(TERN(PID_EXTRUSION_SCALING, thermalManager.lpq_len, lpq_len));
} }
// //
@ -911,8 +873,6 @@ void MarlinSettings::postprocess() {
const int16_t lcd_contrast = const int16_t lcd_contrast =
#if HAS_LCD_CONTRAST #if HAS_LCD_CONTRAST
ui.contrast ui.contrast
#elif defined(DEFAULT_LCD_CONTRAST)
DEFAULT_LCD_CONTRAST
#else #else
127 127
#endif #endif
@ -925,14 +885,7 @@ void MarlinSettings::postprocess() {
// //
{ {
_FIELD_TEST(recovery_enabled); _FIELD_TEST(recovery_enabled);
const bool recovery_enabled = TERN(POWER_LOSS_RECOVERY, recovery.enabled, ENABLED(PLR_ENABLED_DEFAULT));
const bool recovery_enabled =
#if ENABLED(POWER_LOSS_RECOVERY)
recovery.enabled
#else
PLR_ENABLED_DEFAULT
#endif
;
EEPROM_WRITE(recovery_enabled); EEPROM_WRITE(recovery_enabled);
} }
@ -941,19 +894,15 @@ void MarlinSettings::postprocess() {
// //
{ {
_FIELD_TEST(fwretract_settings); _FIELD_TEST(fwretract_settings);
#if DISABLED(FWRETRACT)
#if ENABLED(FWRETRACT)
EEPROM_WRITE(fwretract.settings);
#else
const fwretract_settings_t autoretract_defaults = { 3, 45, 0, 0, 0, 13, 0, 8 }; const fwretract_settings_t autoretract_defaults = { 3, 45, 0, 0, 0, 13, 0, 8 };
EEPROM_WRITE(autoretract_defaults);
#endif #endif
#if BOTH(FWRETRACT, FWRETRACT_AUTORETRACT) EEPROM_WRITE(TERN(FWRETRACT, fwretract.settings, autoretract_defaults));
EEPROM_WRITE(fwretract.autoretract_enabled);
#else #if DISABLED(FWRETRACT_AUTORETRACT)
const bool autoretract_enabled = false; const bool autoretract_enabled = false;
EEPROM_WRITE(autoretract_enabled);
#endif #endif
EEPROM_WRITE(TERN(FWRETRACT_AUTORETRACT, fwretract.autoretract_enabled, autoretract_enabled));
} }
// //
@ -1270,12 +1219,10 @@ void MarlinSettings::postprocess() {
_FIELD_TEST(coordinate_system); _FIELD_TEST(coordinate_system);
#if ENABLED(CNC_COORDINATE_SYSTEMS) #if DISABLED(CNC_COORDINATE_SYSTEMS)
EEPROM_WRITE(gcode.coordinate_system);
#else
const xyz_pos_t coordinate_system[MAX_COORDINATE_SYSTEMS] = { { 0 } }; const xyz_pos_t coordinate_system[MAX_COORDINATE_SYSTEMS] = { { 0 } };
EEPROM_WRITE(coordinate_system);
#endif #endif
EEPROM_WRITE(TERN(CNC_COORDINATE_SYSTEMS, gcode.coordinate_system, coordinate_system));
// //
// Skew correction factors // Skew correction factors
@ -1448,11 +1395,7 @@ void MarlinSettings::postprocess() {
for (uint8_t q = 4; q--;) EEPROM_READ(dummyf); for (uint8_t q = 4; q--;) EEPROM_READ(dummyf);
#endif #endif
#if DISABLED(CLASSIC_JERK) EEPROM_READ(TERN(CLASSIC_JERK, dummyf, planner.junction_deviation_mm));
EEPROM_READ(planner.junction_deviation_mm);
#else
EEPROM_READ(dummyf);
#endif
} }
// //
@ -1504,13 +1447,7 @@ void MarlinSettings::postprocess() {
// //
// Global Leveling // Global Leveling
// //
{ EEPROM_READ(TERN(ENABLE_LEVELING_FADE_HEIGHT, new_z_fade_height, dummyf));
#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
EEPROM_READ(new_z_fade_height);
#else
EEPROM_READ(dummyf);
#endif
}
// //
// Mesh (Manual) Bed Leveling // Mesh (Manual) Bed Leveling
@ -1662,21 +1599,10 @@ void MarlinSettings::postprocess() {
_FIELD_TEST(x2_endstop_adj); _FIELD_TEST(x2_endstop_adj);
#if ENABLED(X_DUAL_ENDSTOPS) EEPROM_READ(TERN(X_DUAL_ENDSTOPS, endstops.x2_endstop_adj, dummyf)); // 1 float
EEPROM_READ(endstops.x2_endstop_adj); // 1 float EEPROM_READ(TERN(Y_DUAL_ENDSTOPS, endstops.y2_endstop_adj, dummyf)); // 1 float
#else EEPROM_READ(TERN(Z_MULTI_ENDSTOPS, endstops.z2_endstop_adj, dummyf)); // 1 float
EEPROM_READ(dummyf);
#endif
#if ENABLED(Y_DUAL_ENDSTOPS)
EEPROM_READ(endstops.y2_endstop_adj); // 1 float
#else
EEPROM_READ(dummyf);
#endif
#if ENABLED(Z_MULTI_ENDSTOPS)
EEPROM_READ(endstops.z2_endstop_adj); // 1 float
#else
EEPROM_READ(dummyf);
#endif
#if ENABLED(Z_MULTI_ENDSTOPS) && NUM_Z_STEPPER_DRIVERS >= 3 #if ENABLED(Z_MULTI_ENDSTOPS) && NUM_Z_STEPPER_DRIVERS >= 3
EEPROM_READ(endstops.z3_endstop_adj); // 1 float EEPROM_READ(endstops.z3_endstop_adj); // 1 float
#else #else
@ -2667,7 +2593,7 @@ void MarlinSettings::reset() {
// //
#if ENABLED(POWER_LOSS_RECOVERY) #if ENABLED(POWER_LOSS_RECOVERY)
recovery.enable(PLR_ENABLED_DEFAULT); recovery.enable(ENABLED(PLR_ENABLED_DEFAULT));
#endif #endif
// //

View File

@ -1208,15 +1208,9 @@ feedRate_t get_homing_bump_feedrate(const AxisEnum axis) {
#if ENABLED(SPI_ENDSTOPS) #if ENABLED(SPI_ENDSTOPS)
switch (axis) { switch (axis) {
#if X_SPI_SENSORLESS case X_AXIS: if (ENABLED(X_SPI_SENSORLESS)) endstops.tmc_spi_homing.x = true; break;
case X_AXIS: endstops.tmc_spi_homing.x = true; break; case Y_AXIS: if (ENABLED(Y_SPI_SENSORLESS)) endstops.tmc_spi_homing.y = true; break;
#endif case Z_AXIS: if (ENABLED(Z_SPI_SENSORLESS)) endstops.tmc_spi_homing.z = true; break;
#if Y_SPI_SENSORLESS
case Y_AXIS: endstops.tmc_spi_homing.y = true; break;
#endif
#if Z_SPI_SENSORLESS
case Z_AXIS: endstops.tmc_spi_homing.z = true; break;
#endif
default: break; default: break;
} }
#endif #endif
@ -1280,15 +1274,9 @@ feedRate_t get_homing_bump_feedrate(const AxisEnum axis) {
#if ENABLED(SPI_ENDSTOPS) #if ENABLED(SPI_ENDSTOPS)
switch (axis) { switch (axis) {
#if X_SPI_SENSORLESS case X_AXIS: if (ENABLED(X_SPI_SENSORLESS)) endstops.tmc_spi_homing.x = false; break;
case X_AXIS: endstops.tmc_spi_homing.x = false; break; case Y_AXIS: if (ENABLED(Y_SPI_SENSORLESS)) endstops.tmc_spi_homing.y = false; break;
#endif case Z_AXIS: if (ENABLED(Z_SPI_SENSORLESS)) endstops.tmc_spi_homing.z = false; break;
#if Y_SPI_SENSORLESS
case Y_AXIS: endstops.tmc_spi_homing.y = false; break;
#endif
#if Z_SPI_SENSORLESS
case Z_AXIS: endstops.tmc_spi_homing.z = false; break;
#endif
default: break; default: break;
} }
#endif #endif

View File

@ -375,11 +375,13 @@ void homeaxis(const AxisEnum axis);
FORCE_INLINE int x_home_dir(const uint8_t extruder) { return extruder ? X2_HOME_DIR : X_HOME_DIR; } FORCE_INLINE int x_home_dir(const uint8_t extruder) { return extruder ? X2_HOME_DIR : X_HOME_DIR; }
#elif ENABLED(MULTI_NOZZLE_DUPLICATION) #else
enum DualXMode : char { #if ENABLED(MULTI_NOZZLE_DUPLICATION)
DXC_DUPLICATION_MODE = 2 enum DualXMode : char { DXC_DUPLICATION_MODE = 2 };
}; #endif
FORCE_INLINE int x_home_dir(const uint8_t) { return home_dir(X_AXIS); }
#endif #endif

View File

@ -177,7 +177,7 @@ public:
// Retrieve three points to probe the bed. Any type exposing set(X,Y) may be used. // Retrieve three points to probe the bed. Any type exposing set(X,Y) may be used.
template <typename T> template <typename T>
static inline void get_three_points(T points[3]) { static inline void get_three_points(T points[3]) {
#if ENABLED(HAS_FIXED_3POINT) #if HAS_FIXED_3POINT
points[0].set(PROBE_PT_1_X, PROBE_PT_1_Y); points[0].set(PROBE_PT_1_X, PROBE_PT_1_Y);
points[1].set(PROBE_PT_2_X, PROBE_PT_2_Y); points[1].set(PROBE_PT_2_X, PROBE_PT_2_Y);
points[2].set(PROBE_PT_3_X, PROBE_PT_3_Y); points[2].set(PROBE_PT_3_X, PROBE_PT_3_Y);

View File

@ -276,11 +276,7 @@ private:
#if ENABLED(USB_FLASH_DRIVE_SUPPORT) #if ENABLED(USB_FLASH_DRIVE_SUPPORT)
#define IS_SD_INSERTED() Sd2Card::isInserted() #define IS_SD_INSERTED() Sd2Card::isInserted()
#elif PIN_EXISTS(SD_DETECT) #elif PIN_EXISTS(SD_DETECT)
#if ENABLED(SD_DETECT_INVERTED) #define IS_SD_INSERTED() (READ(SD_DETECT_PIN) != ENABLED(SD_DETECT_INVERTED))
#define IS_SD_INSERTED() READ(SD_DETECT_PIN)
#else
#define IS_SD_INSERTED() !READ(SD_DETECT_PIN)
#endif
#else #else
// No card detect line? Assume the card is inserted. // No card detect line? Assume the card is inserted.
#define IS_SD_INSERTED() true #define IS_SD_INSERTED() true