mirror of
https://github.com/MarlinFirmware/Marlin.git
synced 2024-11-30 07:17:59 +00:00
🏗️ Extend AXIS_CHAR to include E
Co-Authored-By: DerAndere <26200979+DerAndere1@users.noreply.github.com>
This commit is contained in:
parent
f5daefb09d
commit
8b8defeacc
@ -79,7 +79,7 @@ constexpr uint8_t ui8_to_percent(const uint8_t i) { return (int(i) * 100 + 127)
|
||||
|
||||
// Axis names for G-code parsing, reports, etc.
|
||||
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);
|
||||
#if NUM_AXES <= XYZ
|
||||
#if NUM_AXES <= XYZ && !HAS_EXTRUDERS
|
||||
#define AXIS_CHAR(A) ((char)('X' + A))
|
||||
#define IAXIS_CHAR AXIS_CHAR
|
||||
#else
|
||||
|
@ -49,7 +49,7 @@ void I2CPositionEncoder::init(const uint8_t address, const AxisEnum axis) {
|
||||
|
||||
initialized = true;
|
||||
|
||||
SERIAL_ECHOLNPGM("Setting up encoder on ", AS_CHAR(axis_codes[encoderAxis]), " axis, addr = ", address);
|
||||
SERIAL_ECHOLNPGM("Setting up encoder on ", AS_CHAR(AXIS_CHAR(encoderAxis)), " axis, addr = ", address);
|
||||
|
||||
position = get_position();
|
||||
}
|
||||
@ -67,7 +67,7 @@ void I2CPositionEncoder::update() {
|
||||
/*
|
||||
if (trusted) { //commented out as part of the note below
|
||||
trusted = false;
|
||||
SERIAL_ECHOLNPGM("Fault detected on ", AS_CHAR(axis_codes[encoderAxis]), " axis encoder. Disengaging error correction until module is trusted again.");
|
||||
SERIAL_ECHOLNPGM("Fault detected on ", AS_CHAR(AXIS_CHAR(encoderAxis)), " axis encoder. Disengaging error correction until module is trusted again.");
|
||||
}
|
||||
*/
|
||||
return;
|
||||
@ -92,7 +92,7 @@ void I2CPositionEncoder::update() {
|
||||
if (millis() - lastErrorTime > I2CPE_TIME_TRUSTED) {
|
||||
trusted = true;
|
||||
|
||||
SERIAL_ECHOLNPGM("Untrusted encoder module on ", AS_CHAR(axis_codes[encoderAxis]), " axis has been fault-free for set duration, reinstating error correction.");
|
||||
SERIAL_ECHOLNPGM("Untrusted encoder module on ", AS_CHAR(AXIS_CHAR(encoderAxis)), " axis has been fault-free for set duration, reinstating error correction.");
|
||||
|
||||
//the encoder likely lost its place when the error occurred, so we'll reset and use the printer's
|
||||
//idea of where it the axis is to re-initialize
|
||||
@ -172,7 +172,7 @@ void I2CPositionEncoder::update() {
|
||||
float sumP = 0;
|
||||
LOOP_L_N(i, I2CPE_ERR_PRST_ARRAY_SIZE) sumP += errPrst[i];
|
||||
const int32_t errorP = int32_t(sumP * RECIPROCAL(I2CPE_ERR_PRST_ARRAY_SIZE));
|
||||
SERIAL_CHAR(axis_codes[encoderAxis]);
|
||||
SERIAL_CHAR(AXIS_CHAR(encoderAxis));
|
||||
SERIAL_ECHOLNPGM(" : CORRECT ERR ", errorP * planner.mm_per_step[encoderAxis], "mm");
|
||||
babystep.add_steps(encoderAxis, -LROUND(errorP));
|
||||
errPrstIdx = 0;
|
||||
@ -192,7 +192,7 @@ void I2CPositionEncoder::update() {
|
||||
if (ABS(error) > I2CPE_ERR_CNT_THRESH * planner.settings.axis_steps_per_mm[encoderAxis]) {
|
||||
const millis_t ms = millis();
|
||||
if (ELAPSED(ms, nextErrorCountTime)) {
|
||||
SERIAL_CHAR(axis_codes[encoderAxis]);
|
||||
SERIAL_CHAR(AXIS_CHAR(encoderAxis));
|
||||
SERIAL_ECHOLNPGM(" : LARGE ERR ", error, "; diffSum=", diffSum);
|
||||
errorCount++;
|
||||
nextErrorCountTime = ms + I2CPE_ERR_CNT_DEBOUNCE_MS;
|
||||
@ -212,7 +212,7 @@ void I2CPositionEncoder::set_homed() {
|
||||
homed = trusted = true;
|
||||
|
||||
#ifdef I2CPE_DEBUG
|
||||
SERIAL_CHAR(axis_codes[encoderAxis]);
|
||||
SERIAL_CHAR(AXIS_CHAR(encoderAxis));
|
||||
SERIAL_ECHOLNPGM(" axis encoder homed, offset of ", zeroOffset, " ticks.");
|
||||
#endif
|
||||
}
|
||||
@ -223,7 +223,7 @@ void I2CPositionEncoder::set_unhomed() {
|
||||
homed = trusted = false;
|
||||
|
||||
#ifdef I2CPE_DEBUG
|
||||
SERIAL_CHAR(axis_codes[encoderAxis]);
|
||||
SERIAL_CHAR(AXIS_CHAR(encoderAxis));
|
||||
SERIAL_ECHOLNPGM(" axis encoder unhomed.");
|
||||
#endif
|
||||
}
|
||||
@ -231,7 +231,7 @@ void I2CPositionEncoder::set_unhomed() {
|
||||
bool I2CPositionEncoder::passes_test(const bool report) {
|
||||
if (report) {
|
||||
if (H != I2CPE_MAG_SIG_GOOD) SERIAL_ECHOPGM("Warning. ");
|
||||
SERIAL_CHAR(axis_codes[encoderAxis]);
|
||||
SERIAL_CHAR(AXIS_CHAR(encoderAxis));
|
||||
serial_ternary(H == I2CPE_MAG_SIG_BAD, F(" axis "), F("magnetic strip "), F("encoder "));
|
||||
switch (H) {
|
||||
case I2CPE_MAG_SIG_GOOD:
|
||||
@ -252,7 +252,7 @@ float I2CPositionEncoder::get_axis_error_mm(const bool report) {
|
||||
error = ABS(diff) > 10000 ? 0 : diff; // Huge error is a bad reading
|
||||
|
||||
if (report) {
|
||||
SERIAL_CHAR(axis_codes[encoderAxis]);
|
||||
SERIAL_CHAR(AXIS_CHAR(encoderAxis));
|
||||
SERIAL_ECHOLNPGM(" axis target=", target, "mm; actual=", actual, "mm; err=", error, "mm");
|
||||
}
|
||||
|
||||
@ -262,7 +262,7 @@ float I2CPositionEncoder::get_axis_error_mm(const bool report) {
|
||||
int32_t I2CPositionEncoder::get_axis_error_steps(const bool report) {
|
||||
if (!active) {
|
||||
if (report) {
|
||||
SERIAL_CHAR(axis_codes[encoderAxis]);
|
||||
SERIAL_CHAR(AXIS_CHAR(encoderAxis));
|
||||
SERIAL_ECHOLNPGM(" axis encoder not active!");
|
||||
}
|
||||
return 0;
|
||||
@ -287,7 +287,7 @@ int32_t I2CPositionEncoder::get_axis_error_steps(const bool report) {
|
||||
errorPrev = error;
|
||||
|
||||
if (report) {
|
||||
SERIAL_CHAR(axis_codes[encoderAxis]);
|
||||
SERIAL_CHAR(AXIS_CHAR(encoderAxis));
|
||||
SERIAL_ECHOLNPGM(" axis target=", target, "; actual=", encoderCountInStepperTicksScaled, "; err=", error);
|
||||
}
|
||||
|
||||
@ -657,7 +657,7 @@ void I2CPositionEncodersMgr::report_position(const int8_t idx, const bool units,
|
||||
else {
|
||||
if (noOffset) {
|
||||
const int32_t raw_count = encoders[idx].get_raw_count();
|
||||
SERIAL_CHAR(axis_codes[encoders[idx].get_axis()], ' ');
|
||||
SERIAL_CHAR(AXIS_CHAR(encoders[idx).get_axis()], ' ');
|
||||
|
||||
for (uint8_t j = 31; j > 0; j--)
|
||||
SERIAL_ECHO((bool)(0x00000001 & (raw_count >> j)));
|
||||
@ -712,7 +712,7 @@ void I2CPositionEncodersMgr::change_module_address(const uint8_t oldaddr, const
|
||||
// and enable it (it will likely have failed initialization on power-up, before the address change).
|
||||
const int8_t idx = idx_from_addr(newaddr);
|
||||
if (idx >= 0 && !encoders[idx].get_active()) {
|
||||
SERIAL_CHAR(axis_codes[encoders[idx].get_axis()]);
|
||||
SERIAL_CHAR(AXIS_CHAR(encoders[idx).get_axis()]);
|
||||
SERIAL_ECHOLNPGM(" axis encoder was not detected on printer startup. Trying again.");
|
||||
encoders[idx].set_active(encoders[idx].passes_test(true));
|
||||
}
|
||||
@ -814,7 +814,7 @@ void I2CPositionEncodersMgr::M860() {
|
||||
|
||||
if (I2CPE_idx == 0xFF) {
|
||||
LOOP_LOGICAL_AXES(i) {
|
||||
if (!I2CPE_anyaxis || parser.seen_test(axis_codes[i])) {
|
||||
if (!I2CPE_anyaxis || parser.seen_test(AXIS_CHAR(i))) {
|
||||
const uint8_t idx = idx_from_axis(AxisEnum(i));
|
||||
if ((int8_t)idx >= 0) report_position(idx, hasU, hasO);
|
||||
}
|
||||
@ -841,7 +841,7 @@ void I2CPositionEncodersMgr::M861() {
|
||||
|
||||
if (I2CPE_idx == 0xFF) {
|
||||
LOOP_LOGICAL_AXES(i) {
|
||||
if (!I2CPE_anyaxis || parser.seen(axis_codes[i])) {
|
||||
if (!I2CPE_anyaxis || parser.seen(AXIS_CHAR(i))) {
|
||||
const uint8_t idx = idx_from_axis(AxisEnum(i));
|
||||
if ((int8_t)idx >= 0) report_status(idx);
|
||||
}
|
||||
@ -869,7 +869,7 @@ void I2CPositionEncodersMgr::M862() {
|
||||
|
||||
if (I2CPE_idx == 0xFF) {
|
||||
LOOP_LOGICAL_AXES(i) {
|
||||
if (!I2CPE_anyaxis || parser.seen(axis_codes[i])) {
|
||||
if (!I2CPE_anyaxis || parser.seen(AXIS_CHAR(i))) {
|
||||
const uint8_t idx = idx_from_axis(AxisEnum(i));
|
||||
if ((int8_t)idx >= 0) test_axis(idx);
|
||||
}
|
||||
@ -900,7 +900,7 @@ void I2CPositionEncodersMgr::M863() {
|
||||
|
||||
if (I2CPE_idx == 0xFF) {
|
||||
LOOP_LOGICAL_AXES(i) {
|
||||
if (!I2CPE_anyaxis || parser.seen(axis_codes[i])) {
|
||||
if (!I2CPE_anyaxis || parser.seen(AXIS_CHAR(i))) {
|
||||
const uint8_t idx = idx_from_axis(AxisEnum(i));
|
||||
if ((int8_t)idx >= 0) calibrate_steps_mm(idx, iterations);
|
||||
}
|
||||
@ -976,7 +976,7 @@ void I2CPositionEncodersMgr::M865() {
|
||||
|
||||
if (!I2CPE_addr) {
|
||||
LOOP_LOGICAL_AXES(i) {
|
||||
if (!I2CPE_anyaxis || parser.seen(axis_codes[i])) {
|
||||
if (!I2CPE_anyaxis || parser.seen(AXIS_CHAR(i))) {
|
||||
const uint8_t idx = idx_from_axis(AxisEnum(i));
|
||||
if ((int8_t)idx >= 0) report_module_firmware(encoders[idx].get_address());
|
||||
}
|
||||
@ -1007,7 +1007,7 @@ void I2CPositionEncodersMgr::M866() {
|
||||
|
||||
if (I2CPE_idx == 0xFF) {
|
||||
LOOP_LOGICAL_AXES(i) {
|
||||
if (!I2CPE_anyaxis || parser.seen(axis_codes[i])) {
|
||||
if (!I2CPE_anyaxis || parser.seen(AXIS_CHAR(i))) {
|
||||
const uint8_t idx = idx_from_axis(AxisEnum(i));
|
||||
if ((int8_t)idx >= 0) {
|
||||
if (hasR)
|
||||
@ -1045,7 +1045,7 @@ void I2CPositionEncodersMgr::M867() {
|
||||
|
||||
if (I2CPE_idx == 0xFF) {
|
||||
LOOP_LOGICAL_AXES(i) {
|
||||
if (!I2CPE_anyaxis || parser.seen(axis_codes[i])) {
|
||||
if (!I2CPE_anyaxis || parser.seen(AXIS_CHAR(i))) {
|
||||
const uint8_t idx = idx_from_axis(AxisEnum(i));
|
||||
if ((int8_t)idx >= 0) {
|
||||
const bool ena = onoff == -1 ? !encoders[I2CPE_idx].get_ec_enabled() : !!onoff;
|
||||
@ -1081,7 +1081,7 @@ void I2CPositionEncodersMgr::M868() {
|
||||
|
||||
if (I2CPE_idx == 0xFF) {
|
||||
LOOP_LOGICAL_AXES(i) {
|
||||
if (!I2CPE_anyaxis || parser.seen(axis_codes[i])) {
|
||||
if (!I2CPE_anyaxis || parser.seen(AXIS_CHAR(i))) {
|
||||
const uint8_t idx = idx_from_axis(AxisEnum(i));
|
||||
if ((int8_t)idx >= 0) {
|
||||
if (newThreshold != -9999)
|
||||
@ -1115,7 +1115,7 @@ void I2CPositionEncodersMgr::M869() {
|
||||
|
||||
if (I2CPE_idx == 0xFF) {
|
||||
LOOP_LOGICAL_AXES(i) {
|
||||
if (!I2CPE_anyaxis || parser.seen(axis_codes[i])) {
|
||||
if (!I2CPE_anyaxis || parser.seen(AXIS_CHAR(i))) {
|
||||
const uint8_t idx = idx_from_axis(AxisEnum(i));
|
||||
if ((int8_t)idx >= 0) report_error(idx);
|
||||
}
|
||||
|
@ -261,32 +261,32 @@ class I2CPositionEncodersMgr {
|
||||
|
||||
static void report_error_count(const int8_t idx, const AxisEnum axis) {
|
||||
CHECK_IDX();
|
||||
SERIAL_ECHOLNPGM("Error count on ", AS_CHAR(axis_codes[axis]), " axis is ", encoders[idx].get_error_count());
|
||||
SERIAL_ECHOLNPGM("Error count on ", AS_CHAR(AXIS_CHAR(axis)), " axis is ", encoders[idx].get_error_count());
|
||||
}
|
||||
|
||||
static void reset_error_count(const int8_t idx, const AxisEnum axis) {
|
||||
CHECK_IDX();
|
||||
encoders[idx].set_error_count(0);
|
||||
SERIAL_ECHOLNPGM("Error count on ", AS_CHAR(axis_codes[axis]), " axis has been reset.");
|
||||
SERIAL_ECHOLNPGM("Error count on ", AS_CHAR(AXIS_CHAR(axis)), " axis has been reset.");
|
||||
}
|
||||
|
||||
static void enable_ec(const int8_t idx, const bool enabled, const AxisEnum axis) {
|
||||
CHECK_IDX();
|
||||
encoders[idx].set_ec_enabled(enabled);
|
||||
SERIAL_ECHOPGM("Error correction on ", AS_CHAR(axis_codes[axis]));
|
||||
SERIAL_ECHOPGM("Error correction on ", AS_CHAR(AXIS_CHAR(axis)));
|
||||
SERIAL_ECHO_TERNARY(encoders[idx].get_ec_enabled(), " axis is ", "en", "dis", "abled.\n");
|
||||
}
|
||||
|
||||
static void set_ec_threshold(const int8_t idx, const float newThreshold, const AxisEnum axis) {
|
||||
CHECK_IDX();
|
||||
encoders[idx].set_ec_threshold(newThreshold);
|
||||
SERIAL_ECHOLNPGM("Error correct threshold for ", AS_CHAR(axis_codes[axis]), " axis set to ", newThreshold, "mm.");
|
||||
SERIAL_ECHOLNPGM("Error correct threshold for ", AS_CHAR(AXIS_CHAR(axis)), " axis set to ", newThreshold, "mm.");
|
||||
}
|
||||
|
||||
static void get_ec_threshold(const int8_t idx, const AxisEnum axis) {
|
||||
CHECK_IDX();
|
||||
const float threshold = encoders[idx].get_ec_threshold();
|
||||
SERIAL_ECHOLNPGM("Error correct threshold for ", AS_CHAR(axis_codes[axis]), " axis is ", threshold, "mm.");
|
||||
SERIAL_ECHOLNPGM("Error correct threshold for ", AS_CHAR(AXIS_CHAR(axis)), " axis is ", threshold, "mm.");
|
||||
}
|
||||
|
||||
static int8_t idx_from_axis(const AxisEnum axis) {
|
||||
|
@ -125,7 +125,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));
|
||||
}
|
||||
@ -174,7 +174,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 int8_t index = -1;
|
||||
#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?
|
||||
|
@ -432,7 +432,7 @@ FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const
|
||||
const bool is_inch = parser.using_inch_units();
|
||||
const AxisEnum a = TERN(LCD_SHOW_E_TOTAL, axis == E_AXIS ? X_AXIS : axis, axis);
|
||||
const uint8_t offs = a * (is_inch ? XYZ_SPACING_IN : XYZ_SPACING);
|
||||
lcd_put_wchar((is_inch ? X_LABEL_POS_IN : X_LABEL_POS) + offs, XYZ_BASELINE, axis_codes[axis]);
|
||||
lcd_put_wchar((is_inch ? X_LABEL_POS_IN : X_LABEL_POS) + offs, XYZ_BASELINE, AXIS_CHAR(axis));
|
||||
lcd_moveto((is_inch ? X_VALUE_POS_IN : X_VALUE_POS) + offs, XYZ_BASELINE);
|
||||
|
||||
if (blink)
|
||||
|
@ -70,7 +70,7 @@ void DWIN_String::add(uint8_t *string, const int8_t index, uint8_t *itemString/*
|
||||
else if (ch == '$' && itemString)
|
||||
add(itemString);
|
||||
else if (ch == '@')
|
||||
add_character(axis_codes[index]);
|
||||
add_character(AXIS_CHAR(index));
|
||||
else
|
||||
add_character(ch);
|
||||
}
|
||||
|
@ -75,7 +75,7 @@ lcd_uint_t lcd_put_u8str_ind_P(PGM_P const pstr, const int8_t ind, PGM_P const i
|
||||
n -= lcd_put_u8str_max_P(inStr, n * (MENU_FONT_WIDTH)) / (MENU_FONT_WIDTH);
|
||||
}
|
||||
else if (ch == '@') {
|
||||
lcd_put_wchar(axis_codes[ind]);
|
||||
lcd_put_wchar(AXIS_CHAR(ind));
|
||||
n--;
|
||||
}
|
||||
else {
|
||||
|
@ -831,7 +831,7 @@ void MarlinUI::init() {
|
||||
TERN_(MULTI_E_MANUAL, axis == E_AXIS ? e_index :) active_extruder
|
||||
);
|
||||
|
||||
//SERIAL_ECHOLNPGM("Add planner.move with Axis ", AS_CHAR(axis_codes[axis]), " at FR ", fr_mm_s);
|
||||
//SERIAL_ECHOLNPGM("Add planner.move with Axis ", AS_CHAR(AXIS_CHAR(axis)), " at FR ", fr_mm_s);
|
||||
|
||||
axis = NO_AXIS_ENUM;
|
||||
|
||||
@ -848,7 +848,7 @@ void MarlinUI::init() {
|
||||
TERN_(MULTI_E_MANUAL, if (move_axis == E_AXIS) e_index = eindex);
|
||||
start_time = millis() + (menu_scale < 0.99f ? 0UL : 250UL); // delay for bigger moves
|
||||
axis = move_axis;
|
||||
//SERIAL_ECHOLNPGM("Post Move with Axis ", AS_CHAR(axis_codes[axis]), " soon.");
|
||||
//SERIAL_ECHOLNPGM("Post Move with Axis ", AS_CHAR(AXIS_CHAR(axis)), " soon.");
|
||||
}
|
||||
|
||||
#if ENABLED(AUTO_BED_LEVELING_UBL)
|
||||
|
@ -116,7 +116,7 @@ void TFT_String::add(uint8_t *string, int8_t index, uint8_t *itemString/*=nullpt
|
||||
else if (ch == '$' && itemString)
|
||||
add(itemString);
|
||||
else if (ch == '@')
|
||||
add_character(axis_codes[index]);
|
||||
add_character(AXIS_CHAR(index));
|
||||
else
|
||||
add_character(ch);
|
||||
}
|
||||
|
@ -412,11 +412,11 @@ uint8_t L64XX_Marlin::get_user_input(uint8_t &driver_count, L64XX_axis_t axis_in
|
||||
}
|
||||
|
||||
uint8_t found_displacement = false;
|
||||
LOOP_LOGICAL_AXES(i) if (uint16_t _displacement = parser.intval(axis_codes[i])) {
|
||||
LOOP_LOGICAL_AXES(i) if (uint16_t _displacement = parser.intval(AXIS_CHAR(i))) {
|
||||
found_displacement = true;
|
||||
displacement = _displacement;
|
||||
const uint8_t axis_offset = parser.byteval('J');
|
||||
axis_mon[0][0] = axis_codes[i]; // Axis first character, one of XYZ...E
|
||||
axis_mon[0][0] = AXIS_CHAR(i); // Axis first character, one of XYZ...E
|
||||
const bool single_or_e = axis_offset >= 2 || axis_mon[0][0] == 'E',
|
||||
one_or_more = !single_or_e && axis_offset == 0;
|
||||
uint8_t driver_count_local = 0; // Can't use "driver_count" directly as a subscript because it's passed by reference
|
||||
@ -667,7 +667,7 @@ uint8_t L64XX_Marlin::get_user_input(uint8_t &driver_count, L64XX_axis_t axis_in
|
||||
static constexpr float default_max_feedrate[] = DEFAULT_MAX_FEEDRATE;
|
||||
const uint8_t num_feedrates = COUNT(default_max_feedrate);
|
||||
for (j = 0; j < num_feedrates; j++) {
|
||||
if (axis_codes[j] == axis_mon[0][0]) {
|
||||
if (AXIS_CHAR(j) == axis_mon[0][0]) {
|
||||
final_feedrate = default_max_feedrate[j];
|
||||
break;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user