🔧 Fix ROTATIONAL_AXIS_GANG

Co-Authored-By: DerAndere <26200979+DerAndere1@users.noreply.github.com>
This commit is contained in:
Scott Lahteine 2024-01-23 16:02:33 -06:00
parent 18e65f5eb4
commit 5fea79fd07
4 changed files with 27 additions and 20 deletions

View file

@ -288,6 +288,17 @@ public:
// Bool is true with no value or non-zero // Bool is true with no value or non-zero
static bool value_bool() { return !has_value() || !!value_byte(); } 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 // Units modes: Inches, Fahrenheit, Kelvin
#if ENABLED(INCH_MODE_SUPPORT) #if ENABLED(INCH_MODE_SUPPORT)
@ -307,14 +318,7 @@ public:
} }
static float axis_unit_factor(const AxisEnum axis) { static float axis_unit_factor(const AxisEnum axis) {
if (false if (axis_is_rotational(axis)) return 1.0f;
|| 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 HAS_EXTRUDERS #if HAS_EXTRUDERS
if (axis >= E_AXIS && volumetric_enabled) return volumetric_unit_factor; if (axis >= E_AXIS && volumetric_enabled) return volumetric_unit_factor;
#endif #endif
@ -327,12 +331,12 @@ public:
#else #else
static float mm_to_linear_unit(const_float_t mm) { return mm; } static constexpr 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_volumetric_unit(const_float_t mm) { return mm; }
static float linear_value_to_mm(const_float_t v) { return v; } static constexpr 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 constexpr 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 per_axis_value(const AxisEnum, const float v) { return v; }
#endif #endif
@ -402,7 +406,7 @@ public:
#else // !TEMPERATURE_UNITS_SUPPORT #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() { return value_int(); }
static celsius_t value_celsius_diff() { return value_int(); } static celsius_t value_celsius_diff() { return value_int(); }

View file

@ -507,6 +507,10 @@
#define ROTATIONAL_AXES 0 #define ROTATIONAL_AXES 0
#endif #endif
#if ROTATIONAL_AXES
#define HAS_ROTATIONAL_AXES 1
#endif
/** /**
* Number of Secondary Linear Axes (e.g., UVW) * Number of Secondary Linear Axes (e.g., UVW)
* All secondary axes for which AXIS*_ROTATES is not defined. * All secondary axes for which AXIS*_ROTATES is not defined.

View file

@ -1351,6 +1351,11 @@
#undef MANUAL_MOVE_DISTANCE_IN #undef MANUAL_MOVE_DISTANCE_IN
#endif #endif
// Clean up if no rotational axes exist
#if !HAS_ROTATIONAL_AXES
#undef MANUAL_MOVE_DISTANCE_DEG
#endif
// Power-Loss Recovery // Power-Loss Recovery
#if ENABLED(POWER_LOSS_RECOVERY) && defined(PLR_BED_THRESHOLD) #if ENABLED(POWER_LOSS_RECOVERY) && defined(PLR_BED_THRESHOLD)
#define HAS_PLR_BED_THRESHOLD 1 #define HAS_PLR_BED_THRESHOLD 1

View file

@ -96,12 +96,6 @@
#define AXIS9_NAME 'W' #define AXIS9_NAME 'W'
#endif #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 #if HAS_X_AXIS
#define X_MAX_LENGTH (X_MAX_POS - (X_MIN_POS)) #define X_MAX_LENGTH (X_MAX_POS - (X_MIN_POS))
#endif #endif