Skip to content

Commit

Permalink
🔧 Fix ROTATIONAL_AXIS_GANG
Browse files Browse the repository at this point in the history
Co-Authored-By: DerAndere <26200979+DerAndere1@users.noreply.github.com>
  • Loading branch information
thinkyhead and DerAndere1 committed Jan 23, 2024
1 parent 18e65f5 commit 5fea79f
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 20 deletions.
32 changes: 18 additions & 14 deletions Marlin/src/gcode/parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,17 @@ class GCodeParser {
// Bool is true with no value or non-zero
static bool value_bool() { return !has_value() || !!value_byte(); }

static constexpr bool axis_is_rotational(const AxisEnum axis) {
return (false
|| TERN0(AXIS4_ROTATES, axis == I_AXIS)
|| TERN0(AXIS5_ROTATES, axis == J_AXIS)
|| TERN0(AXIS6_ROTATES, axis == K_AXIS)
|| TERN0(AXIS7_ROTATES, axis == U_AXIS)
|| TERN0(AXIS8_ROTATES, axis == V_AXIS)
|| TERN0(AXIS9_ROTATES, axis == W_AXIS)
);
}

// Units modes: Inches, Fahrenheit, Kelvin

#if ENABLED(INCH_MODE_SUPPORT)
Expand All @@ -307,14 +318,7 @@ class GCodeParser {
}

static float axis_unit_factor(const AxisEnum axis) {
if (false
|| TERN0(AXIS4_ROTATES, axis == I_AXIS)
|| TERN0(AXIS5_ROTATES, axis == J_AXIS)
|| TERN0(AXIS6_ROTATES, axis == K_AXIS)
|| TERN0(AXIS7_ROTATES, axis == U_AXIS)
|| TERN0(AXIS8_ROTATES, axis == V_AXIS)
|| TERN0(AXIS9_ROTATES, axis == W_AXIS)
) return 1.0f;
if (axis_is_rotational(axis)) return 1.0f;
#if HAS_EXTRUDERS
if (axis >= E_AXIS && volumetric_enabled) return volumetric_unit_factor;
#endif
Expand All @@ -327,12 +331,12 @@ class GCodeParser {

#else

static float mm_to_linear_unit(const_float_t mm) { return mm; }
static float mm_to_volumetric_unit(const_float_t mm) { return mm; }
static constexpr float mm_to_linear_unit(const_float_t mm) { return mm; }
static constexpr float mm_to_volumetric_unit(const_float_t mm) { return mm; }

static float linear_value_to_mm(const_float_t v) { return v; }
static float axis_value_to_mm(const AxisEnum, const float v) { return v; }
static float per_axis_value(const AxisEnum, const float v) { return v; }
static constexpr float linear_value_to_mm(const_float_t v) { return v; }
static constexpr float axis_value_to_mm(const AxisEnum, const float v) { return v; }
static constexpr float per_axis_value(const AxisEnum, const float v) { return v; }

#endif

Expand Down Expand Up @@ -402,7 +406,7 @@ class GCodeParser {

#else // !TEMPERATURE_UNITS_SUPPORT

static float to_temp_units(int16_t c) { return (float)c; }
static constexpr float to_temp_units(int16_t c) { return (float)c; }

static celsius_t value_celsius() { return value_int(); }
static celsius_t value_celsius_diff() { return value_int(); }
Expand Down
4 changes: 4 additions & 0 deletions Marlin/src/inc/Conditionals_LCD.h
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,10 @@
#define ROTATIONAL_AXES 0
#endif

#if ROTATIONAL_AXES
#define HAS_ROTATIONAL_AXES 1
#endif

/**
* Number of Secondary Linear Axes (e.g., UVW)
* All secondary axes for which AXIS*_ROTATES is not defined.
Expand Down
5 changes: 5 additions & 0 deletions Marlin/src/inc/Conditionals_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -1351,6 +1351,11 @@
#undef MANUAL_MOVE_DISTANCE_IN
#endif

// Clean up if no rotational axes exist
#if !HAS_ROTATIONAL_AXES
#undef MANUAL_MOVE_DISTANCE_DEG
#endif

// Power-Loss Recovery
#if ENABLED(POWER_LOSS_RECOVERY) && defined(PLR_BED_THRESHOLD)
#define HAS_PLR_BED_THRESHOLD 1
Expand Down
6 changes: 0 additions & 6 deletions Marlin/src/inc/Conditionals_post.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,6 @@
#define AXIS9_NAME 'W'
#endif

#if ANY(AXIS4_ROTATES, AXIS5_ROTATES, AXIS6_ROTATES, AXIS7_ROTATES, AXIS8_ROTATES, AXIS9_ROTATES)
#define HAS_ROTATIONAL_AXES 1
#else
#undef MANUAL_MOVE_DISTANCE_DEG
#endif

#if HAS_X_AXIS
#define X_MAX_LENGTH (X_MAX_POS - (X_MIN_POS))
#endif
Expand Down

0 comments on commit 5fea79f

Please sign in to comment.