Skip to content

Commit 8b8defe

Browse files
🏗️ Extend AXIS_CHAR to include E
Co-Authored-By: DerAndere <[email protected]>
1 parent f5daefb commit 8b8defe

20 files changed

+57
-57
lines changed

Marlin/src/core/utility.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ constexpr uint8_t ui8_to_percent(const uint8_t i) { return (int(i) * 100 + 127)
7979

8080
// Axis names for G-code parsing, reports, etc.
8181
const xyze_char_t axis_codes LOGICAL_AXIS_ARRAY('E', 'X', 'Y', 'Z', AXIS4_NAME, AXIS5_NAME, AXIS6_NAME, AXIS7_NAME, AXIS8_NAME, AXIS9_NAME);
82-
#if NUM_AXES <= XYZ
82+
#if NUM_AXES <= XYZ && !HAS_EXTRUDERS
8383
#define AXIS_CHAR(A) ((char)('X' + A))
8484
#define IAXIS_CHAR AXIS_CHAR
8585
#else

Marlin/src/feature/encoder_i2c.cpp

+22-22
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ void I2CPositionEncoder::init(const uint8_t address, const AxisEnum axis) {
4949

5050
initialized = true;
5151

52-
SERIAL_ECHOLNPGM("Setting up encoder on ", AS_CHAR(axis_codes[encoderAxis]), " axis, addr = ", address);
52+
SERIAL_ECHOLNPGM("Setting up encoder on ", AS_CHAR(AXIS_CHAR(encoderAxis)), " axis, addr = ", address);
5353

5454
position = get_position();
5555
}
@@ -67,7 +67,7 @@ void I2CPositionEncoder::update() {
6767
/*
6868
if (trusted) { //commented out as part of the note below
6969
trusted = false;
70-
SERIAL_ECHOLNPGM("Fault detected on ", AS_CHAR(axis_codes[encoderAxis]), " axis encoder. Disengaging error correction until module is trusted again.");
70+
SERIAL_ECHOLNPGM("Fault detected on ", AS_CHAR(AXIS_CHAR(encoderAxis)), " axis encoder. Disengaging error correction until module is trusted again.");
7171
}
7272
*/
7373
return;
@@ -92,7 +92,7 @@ void I2CPositionEncoder::update() {
9292
if (millis() - lastErrorTime > I2CPE_TIME_TRUSTED) {
9393
trusted = true;
9494

95-
SERIAL_ECHOLNPGM("Untrusted encoder module on ", AS_CHAR(axis_codes[encoderAxis]), " axis has been fault-free for set duration, reinstating error correction.");
95+
SERIAL_ECHOLNPGM("Untrusted encoder module on ", AS_CHAR(AXIS_CHAR(encoderAxis)), " axis has been fault-free for set duration, reinstating error correction.");
9696

9797
//the encoder likely lost its place when the error occurred, so we'll reset and use the printer's
9898
//idea of where it the axis is to re-initialize
@@ -172,7 +172,7 @@ void I2CPositionEncoder::update() {
172172
float sumP = 0;
173173
LOOP_L_N(i, I2CPE_ERR_PRST_ARRAY_SIZE) sumP += errPrst[i];
174174
const int32_t errorP = int32_t(sumP * RECIPROCAL(I2CPE_ERR_PRST_ARRAY_SIZE));
175-
SERIAL_CHAR(axis_codes[encoderAxis]);
175+
SERIAL_CHAR(AXIS_CHAR(encoderAxis));
176176
SERIAL_ECHOLNPGM(" : CORRECT ERR ", errorP * planner.mm_per_step[encoderAxis], "mm");
177177
babystep.add_steps(encoderAxis, -LROUND(errorP));
178178
errPrstIdx = 0;
@@ -192,7 +192,7 @@ void I2CPositionEncoder::update() {
192192
if (ABS(error) > I2CPE_ERR_CNT_THRESH * planner.settings.axis_steps_per_mm[encoderAxis]) {
193193
const millis_t ms = millis();
194194
if (ELAPSED(ms, nextErrorCountTime)) {
195-
SERIAL_CHAR(axis_codes[encoderAxis]);
195+
SERIAL_CHAR(AXIS_CHAR(encoderAxis));
196196
SERIAL_ECHOLNPGM(" : LARGE ERR ", error, "; diffSum=", diffSum);
197197
errorCount++;
198198
nextErrorCountTime = ms + I2CPE_ERR_CNT_DEBOUNCE_MS;
@@ -212,7 +212,7 @@ void I2CPositionEncoder::set_homed() {
212212
homed = trusted = true;
213213

214214
#ifdef I2CPE_DEBUG
215-
SERIAL_CHAR(axis_codes[encoderAxis]);
215+
SERIAL_CHAR(AXIS_CHAR(encoderAxis));
216216
SERIAL_ECHOLNPGM(" axis encoder homed, offset of ", zeroOffset, " ticks.");
217217
#endif
218218
}
@@ -223,15 +223,15 @@ void I2CPositionEncoder::set_unhomed() {
223223
homed = trusted = false;
224224

225225
#ifdef I2CPE_DEBUG
226-
SERIAL_CHAR(axis_codes[encoderAxis]);
226+
SERIAL_CHAR(AXIS_CHAR(encoderAxis));
227227
SERIAL_ECHOLNPGM(" axis encoder unhomed.");
228228
#endif
229229
}
230230

231231
bool I2CPositionEncoder::passes_test(const bool report) {
232232
if (report) {
233233
if (H != I2CPE_MAG_SIG_GOOD) SERIAL_ECHOPGM("Warning. ");
234-
SERIAL_CHAR(axis_codes[encoderAxis]);
234+
SERIAL_CHAR(AXIS_CHAR(encoderAxis));
235235
serial_ternary(H == I2CPE_MAG_SIG_BAD, F(" axis "), F("magnetic strip "), F("encoder "));
236236
switch (H) {
237237
case I2CPE_MAG_SIG_GOOD:
@@ -252,7 +252,7 @@ float I2CPositionEncoder::get_axis_error_mm(const bool report) {
252252
error = ABS(diff) > 10000 ? 0 : diff; // Huge error is a bad reading
253253

254254
if (report) {
255-
SERIAL_CHAR(axis_codes[encoderAxis]);
255+
SERIAL_CHAR(AXIS_CHAR(encoderAxis));
256256
SERIAL_ECHOLNPGM(" axis target=", target, "mm; actual=", actual, "mm; err=", error, "mm");
257257
}
258258

@@ -262,7 +262,7 @@ float I2CPositionEncoder::get_axis_error_mm(const bool report) {
262262
int32_t I2CPositionEncoder::get_axis_error_steps(const bool report) {
263263
if (!active) {
264264
if (report) {
265-
SERIAL_CHAR(axis_codes[encoderAxis]);
265+
SERIAL_CHAR(AXIS_CHAR(encoderAxis));
266266
SERIAL_ECHOLNPGM(" axis encoder not active!");
267267
}
268268
return 0;
@@ -287,7 +287,7 @@ int32_t I2CPositionEncoder::get_axis_error_steps(const bool report) {
287287
errorPrev = error;
288288

289289
if (report) {
290-
SERIAL_CHAR(axis_codes[encoderAxis]);
290+
SERIAL_CHAR(AXIS_CHAR(encoderAxis));
291291
SERIAL_ECHOLNPGM(" axis target=", target, "; actual=", encoderCountInStepperTicksScaled, "; err=", error);
292292
}
293293

@@ -657,7 +657,7 @@ void I2CPositionEncodersMgr::report_position(const int8_t idx, const bool units,
657657
else {
658658
if (noOffset) {
659659
const int32_t raw_count = encoders[idx].get_raw_count();
660-
SERIAL_CHAR(axis_codes[encoders[idx].get_axis()], ' ');
660+
SERIAL_CHAR(AXIS_CHAR(encoders[idx).get_axis()], ' ');
661661

662662
for (uint8_t j = 31; j > 0; j--)
663663
SERIAL_ECHO((bool)(0x00000001 & (raw_count >> j)));
@@ -712,7 +712,7 @@ void I2CPositionEncodersMgr::change_module_address(const uint8_t oldaddr, const
712712
// and enable it (it will likely have failed initialization on power-up, before the address change).
713713
const int8_t idx = idx_from_addr(newaddr);
714714
if (idx >= 0 && !encoders[idx].get_active()) {
715-
SERIAL_CHAR(axis_codes[encoders[idx].get_axis()]);
715+
SERIAL_CHAR(AXIS_CHAR(encoders[idx).get_axis()]);
716716
SERIAL_ECHOLNPGM(" axis encoder was not detected on printer startup. Trying again.");
717717
encoders[idx].set_active(encoders[idx].passes_test(true));
718718
}
@@ -814,7 +814,7 @@ void I2CPositionEncodersMgr::M860() {
814814

815815
if (I2CPE_idx == 0xFF) {
816816
LOOP_LOGICAL_AXES(i) {
817-
if (!I2CPE_anyaxis || parser.seen_test(axis_codes[i])) {
817+
if (!I2CPE_anyaxis || parser.seen_test(AXIS_CHAR(i))) {
818818
const uint8_t idx = idx_from_axis(AxisEnum(i));
819819
if ((int8_t)idx >= 0) report_position(idx, hasU, hasO);
820820
}
@@ -841,7 +841,7 @@ void I2CPositionEncodersMgr::M861() {
841841

842842
if (I2CPE_idx == 0xFF) {
843843
LOOP_LOGICAL_AXES(i) {
844-
if (!I2CPE_anyaxis || parser.seen(axis_codes[i])) {
844+
if (!I2CPE_anyaxis || parser.seen(AXIS_CHAR(i))) {
845845
const uint8_t idx = idx_from_axis(AxisEnum(i));
846846
if ((int8_t)idx >= 0) report_status(idx);
847847
}
@@ -869,7 +869,7 @@ void I2CPositionEncodersMgr::M862() {
869869

870870
if (I2CPE_idx == 0xFF) {
871871
LOOP_LOGICAL_AXES(i) {
872-
if (!I2CPE_anyaxis || parser.seen(axis_codes[i])) {
872+
if (!I2CPE_anyaxis || parser.seen(AXIS_CHAR(i))) {
873873
const uint8_t idx = idx_from_axis(AxisEnum(i));
874874
if ((int8_t)idx >= 0) test_axis(idx);
875875
}
@@ -900,7 +900,7 @@ void I2CPositionEncodersMgr::M863() {
900900

901901
if (I2CPE_idx == 0xFF) {
902902
LOOP_LOGICAL_AXES(i) {
903-
if (!I2CPE_anyaxis || parser.seen(axis_codes[i])) {
903+
if (!I2CPE_anyaxis || parser.seen(AXIS_CHAR(i))) {
904904
const uint8_t idx = idx_from_axis(AxisEnum(i));
905905
if ((int8_t)idx >= 0) calibrate_steps_mm(idx, iterations);
906906
}
@@ -976,7 +976,7 @@ void I2CPositionEncodersMgr::M865() {
976976

977977
if (!I2CPE_addr) {
978978
LOOP_LOGICAL_AXES(i) {
979-
if (!I2CPE_anyaxis || parser.seen(axis_codes[i])) {
979+
if (!I2CPE_anyaxis || parser.seen(AXIS_CHAR(i))) {
980980
const uint8_t idx = idx_from_axis(AxisEnum(i));
981981
if ((int8_t)idx >= 0) report_module_firmware(encoders[idx].get_address());
982982
}
@@ -1007,7 +1007,7 @@ void I2CPositionEncodersMgr::M866() {
10071007

10081008
if (I2CPE_idx == 0xFF) {
10091009
LOOP_LOGICAL_AXES(i) {
1010-
if (!I2CPE_anyaxis || parser.seen(axis_codes[i])) {
1010+
if (!I2CPE_anyaxis || parser.seen(AXIS_CHAR(i))) {
10111011
const uint8_t idx = idx_from_axis(AxisEnum(i));
10121012
if ((int8_t)idx >= 0) {
10131013
if (hasR)
@@ -1045,7 +1045,7 @@ void I2CPositionEncodersMgr::M867() {
10451045

10461046
if (I2CPE_idx == 0xFF) {
10471047
LOOP_LOGICAL_AXES(i) {
1048-
if (!I2CPE_anyaxis || parser.seen(axis_codes[i])) {
1048+
if (!I2CPE_anyaxis || parser.seen(AXIS_CHAR(i))) {
10491049
const uint8_t idx = idx_from_axis(AxisEnum(i));
10501050
if ((int8_t)idx >= 0) {
10511051
const bool ena = onoff == -1 ? !encoders[I2CPE_idx].get_ec_enabled() : !!onoff;
@@ -1081,7 +1081,7 @@ void I2CPositionEncodersMgr::M868() {
10811081

10821082
if (I2CPE_idx == 0xFF) {
10831083
LOOP_LOGICAL_AXES(i) {
1084-
if (!I2CPE_anyaxis || parser.seen(axis_codes[i])) {
1084+
if (!I2CPE_anyaxis || parser.seen(AXIS_CHAR(i))) {
10851085
const uint8_t idx = idx_from_axis(AxisEnum(i));
10861086
if ((int8_t)idx >= 0) {
10871087
if (newThreshold != -9999)
@@ -1115,7 +1115,7 @@ void I2CPositionEncodersMgr::M869() {
11151115

11161116
if (I2CPE_idx == 0xFF) {
11171117
LOOP_LOGICAL_AXES(i) {
1118-
if (!I2CPE_anyaxis || parser.seen(axis_codes[i])) {
1118+
if (!I2CPE_anyaxis || parser.seen(AXIS_CHAR(i))) {
11191119
const uint8_t idx = idx_from_axis(AxisEnum(i));
11201120
if ((int8_t)idx >= 0) report_error(idx);
11211121
}

Marlin/src/feature/encoder_i2c.h

+5-5
Original file line numberDiff line numberDiff line change
@@ -261,32 +261,32 @@ class I2CPositionEncodersMgr {
261261

262262
static void report_error_count(const int8_t idx, const AxisEnum axis) {
263263
CHECK_IDX();
264-
SERIAL_ECHOLNPGM("Error count on ", AS_CHAR(axis_codes[axis]), " axis is ", encoders[idx].get_error_count());
264+
SERIAL_ECHOLNPGM("Error count on ", AS_CHAR(AXIS_CHAR(axis)), " axis is ", encoders[idx].get_error_count());
265265
}
266266

267267
static void reset_error_count(const int8_t idx, const AxisEnum axis) {
268268
CHECK_IDX();
269269
encoders[idx].set_error_count(0);
270-
SERIAL_ECHOLNPGM("Error count on ", AS_CHAR(axis_codes[axis]), " axis has been reset.");
270+
SERIAL_ECHOLNPGM("Error count on ", AS_CHAR(AXIS_CHAR(axis)), " axis has been reset.");
271271
}
272272

273273
static void enable_ec(const int8_t idx, const bool enabled, const AxisEnum axis) {
274274
CHECK_IDX();
275275
encoders[idx].set_ec_enabled(enabled);
276-
SERIAL_ECHOPGM("Error correction on ", AS_CHAR(axis_codes[axis]));
276+
SERIAL_ECHOPGM("Error correction on ", AS_CHAR(AXIS_CHAR(axis)));
277277
SERIAL_ECHO_TERNARY(encoders[idx].get_ec_enabled(), " axis is ", "en", "dis", "abled.\n");
278278
}
279279

280280
static void set_ec_threshold(const int8_t idx, const float newThreshold, const AxisEnum axis) {
281281
CHECK_IDX();
282282
encoders[idx].set_ec_threshold(newThreshold);
283-
SERIAL_ECHOLNPGM("Error correct threshold for ", AS_CHAR(axis_codes[axis]), " axis set to ", newThreshold, "mm.");
283+
SERIAL_ECHOLNPGM("Error correct threshold for ", AS_CHAR(AXIS_CHAR(axis)), " axis set to ", newThreshold, "mm.");
284284
}
285285

286286
static void get_ec_threshold(const int8_t idx, const AxisEnum axis) {
287287
CHECK_IDX();
288288
const float threshold = encoders[idx].get_ec_threshold();
289-
SERIAL_ECHOLNPGM("Error correct threshold for ", AS_CHAR(axis_codes[axis]), " axis is ", threshold, "mm.");
289+
SERIAL_ECHOLNPGM("Error correct threshold for ", AS_CHAR(AXIS_CHAR(axis)), " axis is ", threshold, "mm.");
290290
}
291291

292292
static int8_t idx_from_axis(const AxisEnum axis) {

Marlin/src/gcode/config/M200-M205.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ void GcodeSuite::M201() {
125125
#endif
126126

127127
LOOP_LOGICAL_AXES(i) {
128-
if (parser.seenval(axis_codes[i])) {
128+
if (parser.seenval(AXIS_CHAR(i))) {
129129
const uint8_t a = TERN(HAS_EXTRUDERS, (i == E_AXIS ? uint8_t(E_AXIS_N(target_extruder)) : i), i);
130130
planner.set_max_acceleration(a, parser.value_axis_units((AxisEnum)a));
131131
}
@@ -174,7 +174,7 @@ void GcodeSuite::M203() {
174174
if (target_extruder < 0) return;
175175

176176
LOOP_LOGICAL_AXES(i)
177-
if (parser.seenval(axis_codes[i])) {
177+
if (parser.seenval(AXIS_CHAR(i))) {
178178
const uint8_t a = TERN(HAS_EXTRUDERS, (i == E_AXIS ? uint8_t(E_AXIS_N(target_extruder)) : i), i);
179179
planner.set_max_feedrate(a, parser.value_axis_units((AxisEnum)a));
180180
}

Marlin/src/gcode/config/M92.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ void GcodeSuite::M92() {
4747
return M92_report(true, target_extruder);
4848

4949
LOOP_LOGICAL_AXES(i) {
50-
if (parser.seenval(axis_codes[i])) {
50+
if (parser.seenval(AXIS_CHAR(i))) {
5151
if (TERN1(HAS_EXTRUDERS, i != E_AXIS))
5252
planner.settings.axis_steps_per_mm[i] = parser.value_per_axis_units((AxisEnum)i);
5353
else {

Marlin/src/gcode/control/M17_M18_M84.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ void do_enable(const stepper_flags_t to_enable) {
7575
LOOP_NUM_AXES(a) {
7676
if (TEST(shall_enable, a)) {
7777
stepper.enable_axis(AxisEnum(a)); // Mark and enable the requested axis
78-
DEBUG_ECHOLNPGM("Enabled ", axis_codes[a], " (", a, ") with overlap ", hex_word(enable_overlap[a]), " ... Enabled: ", hex_word(stepper.axis_enabled.bits));
78+
DEBUG_ECHOLNPGM("Enabled ", AXIS_CHAR(a), " (", a, ") with overlap ", hex_word(enable_overlap[a]), " ... Enabled: ", hex_word(stepper.axis_enabled.bits));
7979
also_enabled |= enable_overlap[a];
8080
}
8181
}
@@ -157,7 +157,7 @@ void try_to_disable(const stepper_flags_t to_disable) {
157157
// Attempt to disable all flagged axes
158158
LOOP_NUM_AXES(a)
159159
if (TEST(to_disable.bits, a)) {
160-
DEBUG_ECHOPGM("Try to disable ", axis_codes[a], " (", a, ") with overlap ", hex_word(enable_overlap[a]), " ... ");
160+
DEBUG_ECHOPGM("Try to disable ", AXIS_CHAR(a), " (", a, ") with overlap ", hex_word(enable_overlap[a]), " ... ");
161161
if (stepper.disable_axis(AxisEnum(a))) { // Mark the requested axis and request to disable
162162
DEBUG_ECHOPGM("OK");
163163
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) {
195195
// If any of the requested axes are still enabled, give a warning
196196
LOOP_NUM_AXES(a) {
197197
if (TEST(still_enabled, a)) {
198-
SERIAL_CHAR(axis_codes[a]);
198+
SERIAL_CHAR(AXIS_CHAR(a));
199199
overlap_warning(stepper.axis_enabled.bits & enable_overlap[a]);
200200
}
201201
}

Marlin/src/gcode/control/M350_M351.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -40,21 +40,21 @@ void GcodeSuite::M350() {
4040
}
4141

4242
/**
43-
* M351: Toggle MS1 MS2 pins directly with axis codes X Y Z E B
43+
* M351: Toggle MS1 MS2 pins directly with axis codes X Y Z . . . E [B]
4444
* S# determines MS1, MS2 or MS3, X# sets the pin high/low.
4545
*/
4646
void GcodeSuite::M351() {
4747
if (parser.seenval('S')) switch (parser.value_byte()) {
4848
case 1:
49-
LOOP_LOGICAL_AXES(i) if (parser.seenval(axis_codes[i])) stepper.microstep_ms(i, parser.value_byte(), -1, -1);
49+
LOOP_LOGICAL_AXES(i) if (parser.seenval(AXIS_CHAR(i))) stepper.microstep_ms(i, parser.value_byte(), -1, -1);
5050
if (parser.seenval('B')) stepper.microstep_ms(4, parser.value_byte(), -1, -1);
5151
break;
5252
case 2:
53-
LOOP_LOGICAL_AXES(i) if (parser.seenval(axis_codes[i])) stepper.microstep_ms(i, -1, parser.value_byte(), -1);
53+
LOOP_LOGICAL_AXES(i) if (parser.seenval(AXIS_CHAR(i))) stepper.microstep_ms(i, -1, parser.value_byte(), -1);
5454
if (parser.seenval('B')) stepper.microstep_ms(4, -1, parser.value_byte(), -1);
5555
break;
5656
case 3:
57-
LOOP_LOGICAL_AXES(i) if (parser.seenval(axis_codes[i])) stepper.microstep_ms(i, -1, -1, parser.value_byte());
57+
LOOP_LOGICAL_AXES(i) if (parser.seenval(AXIS_CHAR(i))) stepper.microstep_ms(i, -1, -1, parser.value_byte());
5858
if (parser.seenval('B')) stepper.microstep_ms(4, -1, -1, parser.value_byte());
5959
break;
6060
}

Marlin/src/gcode/feature/L6470/M906.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ void L64XX_report_current(L64XX &motor, const L64XX_axis_t axis) {
211211
* 1 - monitor only X2, Y2, Z2
212212
* 2 - monitor only Z3
213213
* 3 - monitor only Z4
214-
* Xxxx, Yxxx, Zxxx, Exxx - axis to change (optional)
214+
* Xxxx, Yxxx, Zxxx, Axxx, Bxxx, Cxxx, Uxxx, Vxxx, Wxxx, Exxx - axis to change (optional)
215215
* L6474 - current in mA (4A max)
216216
* All others - 0-255
217217
*
@@ -236,7 +236,7 @@ void GcodeSuite::M906() {
236236
constexpr int8_t index = -1;
237237
#endif
238238

239-
LOOP_LOGICAL_AXES(i) if (uint16_t value = parser.intval(axis_codes[i])) {
239+
LOOP_LOGICAL_AXES(i) if (uint16_t value = parser.intval(AXIS_CHAR(i))) {
240240

241241
report_current = false;
242242

Marlin/src/gcode/feature/trinamic/M122.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ void GcodeSuite::M122() {
3535
xyze_bool_t print_axis = ARRAY_N_1(LOGICAL_AXES, false);
3636

3737
bool print_all = true;
38-
LOOP_LOGICAL_AXES(i) if (parser.seen_test(axis_codes[i])) { print_axis[i] = true; print_all = false; }
38+
LOOP_LOGICAL_AXES(i) if (parser.seen_test(AXIS_CHAR(i))) { print_axis[i] = true; print_all = false; }
3939

4040
if (print_all) LOOP_LOGICAL_AXES(i) print_axis[i] = true;
4141

Marlin/src/gcode/feature/trinamic/M569.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ static void set_stealth_status(const bool enable, const int8_t eindex) {
5353
constexpr int8_t index = -1;
5454
#endif
5555

56-
LOOP_LOGICAL_AXES(i) if (parser.seen(axis_codes[i])) {
56+
LOOP_LOGICAL_AXES(i) if (parser.seen(AXIS_CHAR(i))) {
5757
switch (i) {
5858
case X_AXIS:
5959
TERN_(X_HAS_STEALTHCHOP, if (index < 0 || index == 0) TMC_SET_STEALTH(X));

Marlin/src/gcode/feature/trinamic/M906.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ void GcodeSuite::M906() {
6666
constexpr int8_t index = -1;
6767
#endif
6868

69-
LOOP_LOGICAL_AXES(i) if (uint16_t value = parser.intval(axis_codes[i])) {
69+
LOOP_LOGICAL_AXES(i) if (uint16_t value = parser.intval(AXIS_CHAR(i))) {
7070
report = false;
7171
switch (i) {
7272
#if AXIS_IS_TMC(X) || AXIS_IS_TMC(X2)

Marlin/src/gcode/feature/trinamic/M911-M914.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@
288288
#elif AXIS_IS_TMC(X) || AXIS_IS_TMC(Y) || AXIS_IS_TMC(Z)
289289
constexpr int8_t index = -1;
290290
#endif
291-
LOOP_LOGICAL_AXES(i) if (int32_t value = parser.longval(axis_codes[i])) {
291+
LOOP_LOGICAL_AXES(i) if (int32_t value = parser.longval(AXIS_CHAR(i))) {
292292
report = false;
293293
switch (i) {
294294
#if X_HAS_STEALTHCHOP || X2_HAS_STEALTHCHOP

Marlin/src/gcode/feature/trinamic/M919.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -112,13 +112,13 @@ void GcodeSuite::M919() {
112112
int8_t eindex = -1;
113113
#endif
114114
bool report = true;
115-
LOOP_LOGICAL_AXES(i) if (parser.seen_test(axis_codes[i])) {
115+
LOOP_LOGICAL_AXES(i) if (parser.seen_test(AXIS_CHAR(i))) {
116116
report = false;
117117

118118
// Get the chopper timing for the specified axis and index
119119
switch (i) {
120120
default: // A specified axis isn't Trinamic
121-
SERIAL_ECHOLNPGM("?Axis ", AS_CHAR(axis_codes[i]), " has no TMC drivers.");
121+
SERIAL_ECHOLNPGM("?Axis ", AS_CHAR(AXIS_CHAR(i)), " has no TMC drivers.");
122122
break;
123123

124124
#if AXIS_IS_TMC(X) || AXIS_IS_TMC(X2)

0 commit comments

Comments
 (0)