Fix MIN/MAX function collision with macros

This commit is contained in:
Scott Lahteine
2019-07-05 18:01:21 -05:00
parent b6546ea33a
commit 750a16ad38
63 changed files with 167 additions and 167 deletions

View File

@ -394,10 +394,10 @@ G29_TYPE GcodeSuite::G29() {
if (parser.seen('H')) {
const int16_t size = (int16_t)parser.value_linear_units();
left_probe_bed_position = MAX(X_CENTER - size / 2, MIN_PROBE_X);
right_probe_bed_position = MIN(left_probe_bed_position + size, MAX_PROBE_X);
front_probe_bed_position = MAX(Y_CENTER - size / 2, MIN_PROBE_Y);
back_probe_bed_position = MIN(front_probe_bed_position + size, MAX_PROBE_Y);
left_probe_bed_position = _MAX(X_CENTER - size / 2, MIN_PROBE_X);
right_probe_bed_position = _MIN(left_probe_bed_position + size, MAX_PROBE_X);
front_probe_bed_position = _MAX(Y_CENTER - size / 2, MIN_PROBE_Y);
back_probe_bed_position = _MIN(front_probe_bed_position + size, MAX_PROBE_Y);
}
else {
left_probe_bed_position = parser.seenval('L') ? (int)RAW_X_POSITION(parser.value_linear_units()) : LEFT_PROBE_BED_POSITION;
@ -511,7 +511,7 @@ G29_TYPE GcodeSuite::G29() {
if (verbose_level || seenQ) {
SERIAL_ECHOPGM("Manual G29 ");
if (g29_in_progress) {
SERIAL_ECHOPAIR("point ", MIN(abl_probe_index + 1, abl_points));
SERIAL_ECHOPAIR("point ", _MIN(abl_probe_index + 1, abl_points));
SERIAL_ECHOLNPAIR(" of ", abl_points);
}
else

View File

@ -197,7 +197,7 @@ void GcodeSuite::G29() {
} // switch(state)
if (state == MeshNext) {
SERIAL_ECHOPAIR("MBL G29 point ", MIN(mbl_probe_index, GRID_MAX_POINTS));
SERIAL_ECHOPAIR("MBL G29 point ", _MIN(mbl_probe_index, GRID_MAX_POINTS));
SERIAL_ECHOLNPAIR(" of ", int(GRID_MAX_POINTS));
}

View File

@ -75,7 +75,7 @@
const float mlx = max_length(X_AXIS),
mly = max_length(Y_AXIS),
mlratio = mlx > mly ? mly / mlx : mlx / mly,
fr_mm_s = MIN(homing_feedrate(X_AXIS), homing_feedrate(Y_AXIS)) * SQRT(sq(mlratio) + 1.0);
fr_mm_s = _MIN(homing_feedrate(X_AXIS), homing_feedrate(Y_AXIS)) * SQRT(sq(mlratio) + 1.0);
#if ENABLED(SENSORLESS_HOMING)
sensorless_t stealth_states { false, false, false, false, false, false, false };

View File

@ -610,7 +610,7 @@ void GcodeSuite::G33() {
}
// adjust delta_height and endstops by the max amount
const float z_temp = MAX(delta_endstop_adj[A_AXIS], delta_endstop_adj[B_AXIS], delta_endstop_adj[C_AXIS]);
const float z_temp = _MAX(delta_endstop_adj[A_AXIS], delta_endstop_adj[B_AXIS], delta_endstop_adj[C_AXIS]);
delta_height -= z_temp;
LOOP_XYZ(axis) delta_endstop_adj[axis] -= z_temp;
}

View File

@ -123,7 +123,7 @@ void GcodeSuite::G34() {
float z_probe = Z_BASIC_CLEARANCE + (G34_MAX_GRADE) * 0.01f * (
#if ENABLED(Z_TRIPLE_STEPPER_DRIVERS)
SQRT(MAX(HYPOT2(z_auto_align_xpos[0] - z_auto_align_ypos[0], z_auto_align_xpos[1] - z_auto_align_ypos[1]),
SQRT(_MAX(HYPOT2(z_auto_align_xpos[0] - z_auto_align_ypos[0], z_auto_align_xpos[1] - z_auto_align_ypos[1]),
HYPOT2(z_auto_align_xpos[1] - z_auto_align_ypos[1], z_auto_align_xpos[2] - z_auto_align_ypos[2]),
HYPOT2(z_auto_align_xpos[2] - z_auto_align_ypos[2], z_auto_align_xpos[0] - z_auto_align_ypos[0])))
#else
@ -174,7 +174,7 @@ void GcodeSuite::G34() {
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("> Z", int(zstepper + 1), " measured position is ", z_measured[zstepper]);
// Remember the minimum measurement to calculate the correction later on
z_measured_min = MIN(z_measured_min, z_measured[zstepper]);
z_measured_min = _MIN(z_measured_min, z_measured[zstepper]);
} // for (zstepper)
if (err_break) break;
@ -182,11 +182,11 @@ void GcodeSuite::G34() {
// Adapt the next probe clearance height based on the new measurements.
// Safe_height = lowest distance to bed (= highest measurement) plus highest measured misalignment.
#if ENABLED(Z_TRIPLE_STEPPER_DRIVERS)
z_maxdiff = MAX(ABS(z_measured[0] - z_measured[1]), ABS(z_measured[1] - z_measured[2]), ABS(z_measured[2] - z_measured[0]));
z_probe = Z_BASIC_CLEARANCE + MAX(z_measured[0], z_measured[1], z_measured[2]) + z_maxdiff;
z_maxdiff = _MAX(ABS(z_measured[0] - z_measured[1]), ABS(z_measured[1] - z_measured[2]), ABS(z_measured[2] - z_measured[0]));
z_probe = Z_BASIC_CLEARANCE + _MAX(z_measured[0], z_measured[1], z_measured[2]) + z_maxdiff;
#else
z_maxdiff = ABS(z_measured[0] - z_measured[1]);
z_probe = Z_BASIC_CLEARANCE + MAX(z_measured[0], z_measured[1]) + z_maxdiff;
z_probe = Z_BASIC_CLEARANCE + _MAX(z_measured[0], z_measured[1]) + z_maxdiff;
#endif
SERIAL_ECHOPAIR("\n"
@ -210,7 +210,7 @@ void GcodeSuite::G34() {
z_align_abs = ABS(z_align_move);
// Optimize one iterations correction based on the first measurements
if (z_align_abs > 0.0f) amplification = iteration == 1 ? MIN(last_z_align_move[zstepper] / z_align_abs, 2.0f) : z_auto_align_amplification;
if (z_align_abs > 0.0f) amplification = iteration == 1 ? _MIN(last_z_align_move[zstepper] / z_align_abs, 2.0f) : z_auto_align_amplification;
// Check for less accuracy compared to last move
if (last_z_align_move[zstepper] < z_align_abs - 1.0) {

View File

@ -120,9 +120,9 @@ inline void move_to(
if (a3 != NO_AXIS) destination[a3] = p3;
// Make sure coordinates are within bounds
destination[X_AXIS] = MAX(MIN(destination[X_AXIS], X_MAX_POS), X_MIN_POS);
destination[Y_AXIS] = MAX(MIN(destination[Y_AXIS], Y_MAX_POS), Y_MIN_POS);
destination[Z_AXIS] = MAX(MIN(destination[Z_AXIS], Z_MAX_POS), Z_MIN_POS);
destination[X_AXIS] = _MAX(_MIN(destination[X_AXIS], X_MAX_POS), X_MIN_POS);
destination[Y_AXIS] = _MAX(_MIN(destination[Y_AXIS], Y_MAX_POS), Y_MIN_POS);
destination[Z_AXIS] = _MAX(_MIN(destination[Z_AXIS], Z_MAX_POS), Z_MIN_POS);
// Move to position
do_blocking_move_to(destination, MMM_TO_MMS(CALIBRATION_FEEDRATE_TRAVEL));

View File

@ -127,7 +127,7 @@ void GcodeSuite::M48() {
(int) (0.1250000000 * (DELTA_PRINTABLE_RADIUS)),
(int) (0.3333333333 * (DELTA_PRINTABLE_RADIUS))
#else
(int) 5.0, (int) (0.125 * MIN(X_BED_SIZE, Y_BED_SIZE))
(int) 5.0, (int) (0.125 * _MIN(X_BED_SIZE, Y_BED_SIZE))
#endif
);

View File

@ -92,7 +92,7 @@
case DXC_AUTO_PARK_MODE:
break;
case DXC_DUPLICATION_MODE:
if (parser.seen('X')) duplicate_extruder_x_offset = MAX(parser.value_linear_units(), X2_MIN_POS - x_home_pos(0));
if (parser.seen('X')) duplicate_extruder_x_offset = _MAX(parser.value_linear_units(), X2_MIN_POS - x_home_pos(0));
if (parser.seen('R')) duplicate_extruder_temp_offset = parser.value_celsius_diff();
if (active_extruder != 0) tool_change(0);
break;

View File

@ -97,7 +97,7 @@ void GcodeSuite::M701() {
// Lift Z axis
if (park_point.z > 0)
do_blocking_move_to_z(MIN(current_position[Z_AXIS] + park_point.z, Z_MAX_POS), NOZZLE_PARK_Z_FEEDRATE);
do_blocking_move_to_z(_MIN(current_position[Z_AXIS] + park_point.z, Z_MAX_POS), NOZZLE_PARK_Z_FEEDRATE);
// Load filament
#if ENABLED(PRUSA_MMU2)
@ -116,7 +116,7 @@ void GcodeSuite::M701() {
// Restore Z axis
if (park_point.z > 0)
do_blocking_move_to_z(MAX(current_position[Z_AXIS] - park_point.z, 0), NOZZLE_PARK_Z_FEEDRATE);
do_blocking_move_to_z(_MAX(current_position[Z_AXIS] - park_point.z, 0), NOZZLE_PARK_Z_FEEDRATE);
#if EXTRUDERS > 1 && DISABLED(PRUSA_MMU2)
// Restore toolhead if it was changed
@ -196,7 +196,7 @@ void GcodeSuite::M702() {
// Lift Z axis
if (park_point.z > 0)
do_blocking_move_to_z(MIN(current_position[Z_AXIS] + park_point.z, Z_MAX_POS), NOZZLE_PARK_Z_FEEDRATE);
do_blocking_move_to_z(_MIN(current_position[Z_AXIS] + park_point.z, Z_MAX_POS), NOZZLE_PARK_Z_FEEDRATE);
// Unload filament
#if ENABLED(PRUSA_MMU2)
@ -226,7 +226,7 @@ void GcodeSuite::M702() {
// Restore Z axis
if (park_point.z > 0)
do_blocking_move_to_z(MAX(current_position[Z_AXIS] - park_point.z, 0), NOZZLE_PARK_Z_FEEDRATE);
do_blocking_move_to_z(_MAX(current_position[Z_AXIS] - park_point.z, 0), NOZZLE_PARK_Z_FEEDRATE);
#if EXTRUDERS > 1 && DISABLED(PRUSA_MMU2)
// Restore toolhead if it was changed

View File

@ -41,7 +41,7 @@ void GcodeSuite::M122() {
#if ENABLED(MONITOR_DRIVER_STATUS)
const bool sflag = parser.seen('S'), s0 = sflag && !parser.value_bool();
if (sflag) tmc_set_report_interval(s0 ? 0 : MONITOR_DRIVER_STATUS_INTERVAL_MS);
if (!s0 && parser.seenval('P')) tmc_set_report_interval(MIN(parser.value_ushort(), MONITOR_DRIVER_STATUS_INTERVAL_MS));
if (!s0 && parser.seenval('P')) tmc_set_report_interval(_MIN(parser.value_ushort(), MONITOR_DRIVER_STATUS_INTERVAL_MS));
#endif
if (parser.seen('V'))

View File

@ -32,7 +32,7 @@
#define _ALT_P active_extruder
#define _CNT_P EXTRUDERS
#else
#define _ALT_P MIN(active_extruder, FAN_COUNT - 1)
#define _ALT_P _MIN(active_extruder, FAN_COUNT - 1)
#define _CNT_P FAN_COUNT
#endif