🏗️ Extend AXIS_CHAR to include E
Co-Authored-By: DerAndere <26200979+DerAndere1@users.noreply.github.com>
This commit is contained in:
committed by
Scott Lahteine
parent
0041de1a8a
commit
d56731cd07
@ -134,7 +134,7 @@ void GcodeSuite::M201() {
|
||||
#endif
|
||||
|
||||
LOOP_LOGICAL_AXES(i) {
|
||||
if (parser.seenval(axis_codes[i])) {
|
||||
if (parser.seenval(AXIS_CHAR(i))) {
|
||||
const uint8_t a = TERN(HAS_EXTRUDERS, (i == E_AXIS ? uint8_t(E_AXIS_N(target_extruder)) : i), i);
|
||||
planner.set_max_acceleration(a, parser.value_axis_units((AxisEnum)a));
|
||||
}
|
||||
@ -183,7 +183,7 @@ void GcodeSuite::M203() {
|
||||
if (target_extruder < 0) return;
|
||||
|
||||
LOOP_LOGICAL_AXES(i)
|
||||
if (parser.seenval(axis_codes[i])) {
|
||||
if (parser.seenval(AXIS_CHAR(i))) {
|
||||
const uint8_t a = TERN(HAS_EXTRUDERS, (i == E_AXIS ? uint8_t(E_AXIS_N(target_extruder)) : i), i);
|
||||
planner.set_max_feedrate(a, parser.value_axis_units((AxisEnum)a));
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ void GcodeSuite::M92() {
|
||||
return M92_report(true, target_extruder);
|
||||
|
||||
LOOP_LOGICAL_AXES(i) {
|
||||
if (parser.seenval(axis_codes[i])) {
|
||||
if (parser.seenval(AXIS_CHAR(i))) {
|
||||
if (TERN1(HAS_EXTRUDERS, i != E_AXIS))
|
||||
planner.settings.axis_steps_per_mm[i] = parser.value_per_axis_units((AxisEnum)i);
|
||||
else {
|
||||
|
@ -75,7 +75,7 @@ void do_enable(const stepper_flags_t to_enable) {
|
||||
LOOP_NUM_AXES(a) {
|
||||
if (TEST(shall_enable, a)) {
|
||||
stepper.enable_axis(AxisEnum(a)); // Mark and enable the requested axis
|
||||
DEBUG_ECHOLNPGM("Enabled ", axis_codes[a], " (", a, ") with overlap ", hex_word(enable_overlap[a]), " ... Enabled: ", hex_word(stepper.axis_enabled.bits));
|
||||
DEBUG_ECHOLNPGM("Enabled ", AXIS_CHAR(a), " (", a, ") with overlap ", hex_word(enable_overlap[a]), " ... Enabled: ", hex_word(stepper.axis_enabled.bits));
|
||||
also_enabled |= enable_overlap[a];
|
||||
}
|
||||
}
|
||||
@ -157,7 +157,7 @@ void try_to_disable(const stepper_flags_t to_disable) {
|
||||
// Attempt to disable all flagged axes
|
||||
LOOP_NUM_AXES(a)
|
||||
if (TEST(to_disable.bits, a)) {
|
||||
DEBUG_ECHOPGM("Try to disable ", axis_codes[a], " (", a, ") with overlap ", hex_word(enable_overlap[a]), " ... ");
|
||||
DEBUG_ECHOPGM("Try to disable ", AXIS_CHAR(a), " (", a, ") with overlap ", hex_word(enable_overlap[a]), " ... ");
|
||||
if (stepper.disable_axis(AxisEnum(a))) { // Mark the requested axis and request to disable
|
||||
DEBUG_ECHOPGM("OK");
|
||||
still_enabled &= ~(_BV(a) | enable_overlap[a]); // If actually disabled, clear one or more tracked bits
|
||||
@ -195,7 +195,7 @@ void try_to_disable(const stepper_flags_t to_disable) {
|
||||
// If any of the requested axes are still enabled, give a warning
|
||||
LOOP_NUM_AXES(a) {
|
||||
if (TEST(still_enabled, a)) {
|
||||
SERIAL_CHAR(axis_codes[a]);
|
||||
SERIAL_CHAR(AXIS_CHAR(a));
|
||||
overlap_warning(stepper.axis_enabled.bits & enable_overlap[a]);
|
||||
}
|
||||
}
|
||||
|
@ -40,21 +40,21 @@ void GcodeSuite::M350() {
|
||||
}
|
||||
|
||||
/**
|
||||
* M351: Toggle MS1 MS2 pins directly with axis codes X Y Z E B
|
||||
* M351: Toggle MS1 MS2 pins directly with axis codes X Y Z . . . E [B]
|
||||
* S# determines MS1, MS2 or MS3, X# sets the pin high/low.
|
||||
*/
|
||||
void GcodeSuite::M351() {
|
||||
if (parser.seenval('S')) switch (parser.value_byte()) {
|
||||
case 1:
|
||||
LOOP_LOGICAL_AXES(i) if (parser.seenval(axis_codes[i])) stepper.microstep_ms(i, parser.value_byte(), -1, -1);
|
||||
LOOP_LOGICAL_AXES(i) if (parser.seenval(AXIS_CHAR(i))) stepper.microstep_ms(i, parser.value_byte(), -1, -1);
|
||||
if (parser.seenval('B')) stepper.microstep_ms(4, parser.value_byte(), -1, -1);
|
||||
break;
|
||||
case 2:
|
||||
LOOP_LOGICAL_AXES(i) if (parser.seenval(axis_codes[i])) stepper.microstep_ms(i, -1, parser.value_byte(), -1);
|
||||
LOOP_LOGICAL_AXES(i) if (parser.seenval(AXIS_CHAR(i))) stepper.microstep_ms(i, -1, parser.value_byte(), -1);
|
||||
if (parser.seenval('B')) stepper.microstep_ms(4, -1, parser.value_byte(), -1);
|
||||
break;
|
||||
case 3:
|
||||
LOOP_LOGICAL_AXES(i) if (parser.seenval(axis_codes[i])) stepper.microstep_ms(i, -1, -1, parser.value_byte());
|
||||
LOOP_LOGICAL_AXES(i) if (parser.seenval(AXIS_CHAR(i))) stepper.microstep_ms(i, -1, -1, parser.value_byte());
|
||||
if (parser.seenval('B')) stepper.microstep_ms(4, -1, -1, parser.value_byte());
|
||||
break;
|
||||
}
|
||||
|
@ -211,7 +211,7 @@ void L64XX_report_current(L64XX &motor, const L64XX_axis_t axis) {
|
||||
* 1 - monitor only X2, Y2, Z2
|
||||
* 2 - monitor only Z3
|
||||
* 3 - monitor only Z4
|
||||
* Xxxx, Yxxx, Zxxx, Exxx - axis to change (optional)
|
||||
* Xxxx, Yxxx, Zxxx, Axxx, Bxxx, Cxxx, Uxxx, Vxxx, Wxxx, Exxx - axis to change (optional)
|
||||
* L6474 - current in mA (4A max)
|
||||
* All others - 0-255
|
||||
*
|
||||
@ -236,7 +236,7 @@ void GcodeSuite::M906() {
|
||||
constexpr int8_t index = -1;
|
||||
#endif
|
||||
|
||||
LOOP_LOGICAL_AXES(i) if (uint16_t value = parser.intval(axis_codes[i])) {
|
||||
LOOP_LOGICAL_AXES(i) if (uint16_t value = parser.intval(AXIS_CHAR(i))) {
|
||||
|
||||
report_current = false;
|
||||
|
||||
|
@ -35,7 +35,7 @@ void GcodeSuite::M122() {
|
||||
xyze_bool_t print_axis = ARRAY_N_1(LOGICAL_AXES, false);
|
||||
|
||||
bool print_all = true;
|
||||
LOOP_LOGICAL_AXES(i) if (parser.seen_test(axis_codes[i])) { print_axis[i] = true; print_all = false; }
|
||||
LOOP_LOGICAL_AXES(i) if (parser.seen_test(AXIS_CHAR(i))) { print_axis[i] = true; print_all = false; }
|
||||
|
||||
if (print_all) LOOP_LOGICAL_AXES(i) print_axis[i] = true;
|
||||
|
||||
|
@ -53,7 +53,7 @@ static void set_stealth_status(const bool enable, const int8_t eindex) {
|
||||
constexpr int8_t index = -1;
|
||||
#endif
|
||||
|
||||
LOOP_LOGICAL_AXES(i) if (parser.seen(axis_codes[i])) {
|
||||
LOOP_LOGICAL_AXES(i) if (parser.seen(AXIS_CHAR(i))) {
|
||||
switch (i) {
|
||||
case X_AXIS:
|
||||
TERN_(X_HAS_STEALTHCHOP, if (index < 0 || index == 0) TMC_SET_STEALTH(X));
|
||||
|
@ -66,7 +66,7 @@ void GcodeSuite::M906() {
|
||||
constexpr int8_t index = -1;
|
||||
#endif
|
||||
|
||||
LOOP_LOGICAL_AXES(i) if (uint16_t value = parser.intval(axis_codes[i])) {
|
||||
LOOP_LOGICAL_AXES(i) if (uint16_t value = parser.intval(AXIS_CHAR(i))) {
|
||||
report = false;
|
||||
switch (i) {
|
||||
#if AXIS_IS_TMC(X) || AXIS_IS_TMC(X2)
|
||||
|
@ -288,7 +288,7 @@
|
||||
#elif AXIS_IS_TMC(X) || AXIS_IS_TMC(Y) || AXIS_IS_TMC(Z)
|
||||
constexpr uint8_t index = 0;
|
||||
#endif
|
||||
LOOP_LOGICAL_AXES(i) if (int32_t value = parser.longval(axis_codes[i])) {
|
||||
LOOP_LOGICAL_AXES(i) if (int32_t value = parser.longval(AXIS_CHAR(i))) {
|
||||
report = false;
|
||||
switch (i) {
|
||||
#if X_HAS_STEALTHCHOP || X2_HAS_STEALTHCHOP
|
||||
|
@ -112,13 +112,13 @@ void GcodeSuite::M919() {
|
||||
int8_t eindex = -1;
|
||||
#endif
|
||||
bool report = true;
|
||||
LOOP_LOGICAL_AXES(i) if (parser.seen_test(axis_codes[i])) {
|
||||
LOOP_LOGICAL_AXES(i) if (parser.seen_test(AXIS_CHAR(i))) {
|
||||
report = false;
|
||||
|
||||
// Get the chopper timing for the specified axis and index
|
||||
switch (i) {
|
||||
default: // A specified axis isn't Trinamic
|
||||
SERIAL_ECHOLNPGM("?Axis ", AS_CHAR(axis_codes[i]), " has no TMC drivers.");
|
||||
SERIAL_ECHOLNPGM("?Axis ", AS_CHAR(AXIS_CHAR(i)), " has no TMC drivers.");
|
||||
break;
|
||||
|
||||
#if AXIS_IS_TMC(X) || AXIS_IS_TMC(X2)
|
||||
|
@ -74,7 +74,7 @@ void GcodeSuite::G92() {
|
||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||
case 9: // G92.9 - Set Current Position directly (like Marlin 1.0)
|
||||
LOOP_LOGICAL_AXES(i) {
|
||||
if (parser.seenval(axis_codes[i])) {
|
||||
if (parser.seenval(AXIS_CHAR(i))) {
|
||||
if (TERN1(HAS_EXTRUDERS, i != E_AXIS))
|
||||
sync_XYZE = true;
|
||||
else {
|
||||
@ -88,7 +88,7 @@ void GcodeSuite::G92() {
|
||||
|
||||
case 0:
|
||||
LOOP_LOGICAL_AXES(i) {
|
||||
if (parser.seenval(axis_codes[i])) {
|
||||
if (parser.seenval(AXIS_CHAR(i))) {
|
||||
const float l = parser.value_axis_units((AxisEnum)i), // Given axis coordinate value, converted to millimeters
|
||||
v = TERN0(HAS_EXTRUDERS, i == E_AXIS) ? l : LOGICAL_TO_NATIVE(l, i), // Axis position in NATIVE space (applying the existing offset)
|
||||
d = v - current_position[i]; // How much is the current axis position altered by?
|
||||
|
Reference in New Issue
Block a user