Add alternative TERN macros

This commit is contained in:
Scott Lahteine
2020-11-07 18:28:29 -06:00
parent dcb0f5dc3b
commit 06bf3ccfb7
15 changed files with 26 additions and 20 deletions

View File

@ -1497,7 +1497,7 @@ void MarlinSettings::postprocess() {
}
DEBUG_ECHO_START();
DEBUG_ECHOLNPAIR("EEPROM version mismatch (EEPROM=", stored_ver, " Marlin=" EEPROM_VERSION ")");
TERN(EEPROM_AUTO_INIT,,ui.eeprom_alert_version());
IF_DISABLED(EEPROM_AUTO_INIT, ui.eeprom_alert_version());
eeprom_error = true;
}
else {
@ -2325,13 +2325,13 @@ void MarlinSettings::postprocess() {
if (eeprom_error) {
DEBUG_ECHO_START();
DEBUG_ECHOLNPAIR("Index: ", int(eeprom_index - (EEPROM_OFFSET)), " Size: ", datasize());
TERN(EEPROM_AUTO_INIT,,ui.eeprom_alert_index());
IF_DISABLED(EEPROM_AUTO_INIT, ui.eeprom_alert_index());
}
else if (working_crc != stored_crc) {
eeprom_error = true;
DEBUG_ERROR_START();
DEBUG_ECHOLNPAIR("EEPROM CRC mismatch - (stored) ", stored_crc, " != ", working_crc, " (calculated)!");
TERN(EEPROM_AUTO_INIT,,ui.eeprom_alert_crc());
IF_DISABLED(EEPROM_AUTO_INIT, ui.eeprom_alert_crc());
}
else if (!validating) {
DEBUG_ECHO_START();

View File

@ -180,7 +180,7 @@ bool Stepper::abort_current_block;
uint32_t Stepper::acceleration_time, Stepper::deceleration_time;
uint8_t Stepper::steps_per_isr;
TERN(ADAPTIVE_STEP_SMOOTHING,,constexpr) uint8_t Stepper::oversampling_factor;
IF_DISABLED(ADAPTIVE_STEP_SMOOTHING, constexpr) uint8_t Stepper::oversampling_factor;
xyze_long_t Stepper::delta_error{0};

View File

@ -268,7 +268,7 @@ const char str_t_thermal_runaway[] PROGMEM = STR_T_THERMAL_RUNAWAY,
int16_t Temperature::maxtemp_raw_BED = HEATER_BED_RAW_HI_TEMP;
#endif
TERN_(WATCH_BED, bed_watch_t Temperature::watch_bed); // = { 0 }
TERN(PIDTEMPBED,, millis_t Temperature::next_bed_check_ms);
IF_DISABLED(PIDTEMPBED, millis_t Temperature::next_bed_check_ms);
#endif // HAS_HEATED_BED
#if HAS_TEMP_CHAMBER

View File

@ -392,7 +392,7 @@ class Temperature {
#if HAS_HEATED_BED
TERN_(WATCH_BED, static bed_watch_t watch_bed);
TERN(PIDTEMPBED,,static millis_t next_bed_check_ms);
IF_DISABLED(PIDTEMPBED, static millis_t next_bed_check_ms);
#ifdef BED_MINTEMP
static int16_t mintemp_raw_BED;
#endif

View File

@ -799,8 +799,8 @@ void tool_change_prime() {
// Park
#if ENABLED(TOOLCHANGE_PARK)
if (ok) {
TERN(TOOLCHANGE_PARK_Y_ONLY,,current_position.x = toolchange_settings.change_point.x);
TERN(TOOLCHANGE_PARK_X_ONLY,,current_position.y = toolchange_settings.change_point.y);
IF_DISABLED(TOOLCHANGE_PARK_Y_ONLY, current_position.x = toolchange_settings.change_point.x);
IF_DISABLED(TOOLCHANGE_PARK_X_ONLY, current_position.y = toolchange_settings.change_point.y);
planner.buffer_line(current_position, MMM_TO_MMS(TOOLCHANGE_PARK_XY_FEEDRATE), active_extruder);
planner.synchronize();
}
@ -998,8 +998,8 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) {
// Toolchange park
#if ENABLED(TOOLCHANGE_PARK) && DISABLED(SWITCHING_NOZZLE)
if (can_move_away && toolchange_settings.enable_park) {
TERN(TOOLCHANGE_PARK_Y_ONLY,,current_position.x = toolchange_settings.change_point.x);
TERN(TOOLCHANGE_PARK_X_ONLY,,current_position.y = toolchange_settings.change_point.y);
IF_DISABLED(TOOLCHANGE_PARK_Y_ONLY, current_position.x = toolchange_settings.change_point.x);
IF_DISABLED(TOOLCHANGE_PARK_X_ONLY, current_position.y = toolchange_settings.change_point.y);
planner.buffer_line(current_position, MMM_TO_MMS(TOOLCHANGE_PARK_XY_FEEDRATE), old_tool);
planner.synchronize();
}