XYZ_CHAR macro
This commit is contained in:
parent
3473b21710
commit
c4db8e49a7
@ -483,3 +483,4 @@ struct XYZEval {
|
||||
#undef FI
|
||||
|
||||
const xyze_char_t axis_codes { 'X', 'Y', 'Z', 'E' };
|
||||
#define XYZ_CHAR(A) ('X' + char(A))
|
||||
|
@ -139,17 +139,17 @@ void safe_delay(millis_t ms) {
|
||||
#endif
|
||||
|
||||
#if HAS_ABL_OR_UBL
|
||||
SERIAL_ECHOLNPGM("Auto Bed Leveling: "
|
||||
#if ENABLED(AUTO_BED_LEVELING_LINEAR)
|
||||
"LINEAR"
|
||||
#elif ENABLED(AUTO_BED_LEVELING_BILINEAR)
|
||||
"BILINEAR"
|
||||
#elif ENABLED(AUTO_BED_LEVELING_3POINT)
|
||||
"3POINT"
|
||||
#elif ENABLED(AUTO_BED_LEVELING_UBL)
|
||||
"UBL"
|
||||
#endif
|
||||
);
|
||||
SERIAL_ECHOPGM("Auto Bed Leveling: ");
|
||||
#if ENABLED(AUTO_BED_LEVELING_LINEAR)
|
||||
SERIAL_ECHOLNPGM("LINEAR");
|
||||
#elif ENABLED(AUTO_BED_LEVELING_BILINEAR)
|
||||
SERIAL_ECHOLNPGM("BILINEAR");
|
||||
#elif ENABLED(AUTO_BED_LEVELING_3POINT)
|
||||
SERIAL_ECHOLNPGM("3POINT");
|
||||
#elif ENABLED(AUTO_BED_LEVELING_UBL)
|
||||
SERIAL_ECHOLNPGM("UBL");
|
||||
#endif
|
||||
|
||||
if (planner.leveling_active) {
|
||||
SERIAL_ECHOLNPGM(" (enabled)");
|
||||
#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
|
||||
@ -160,7 +160,7 @@ void safe_delay(millis_t ms) {
|
||||
SERIAL_ECHOPGM("ABL Adjustment X");
|
||||
LOOP_XYZ(a) {
|
||||
float v = planner.get_axis_position_mm(AxisEnum(a)) - current_position[a];
|
||||
SERIAL_CHAR(' ', 'X' + char(a));
|
||||
SERIAL_CHAR(' ', XYZ_CHAR(a));
|
||||
if (v > 0) SERIAL_CHAR('+');
|
||||
SERIAL_ECHO(v);
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ void GcodeSuite::M425() {
|
||||
bool noArgs = true;
|
||||
|
||||
LOOP_XYZ(a) {
|
||||
if (parser.seen(axis_codes[a])) {
|
||||
if (parser.seen(XYZ_CHAR(a))) {
|
||||
planner.synchronize();
|
||||
backlash.distance_mm[a] = parser.has_value() ? parser.value_linear_units() : backlash.get_measurement(AxisEnum(a));
|
||||
noArgs = false;
|
||||
@ -75,7 +75,7 @@ void GcodeSuite::M425() {
|
||||
SERIAL_ECHOLNPAIR(" Correction Amount/Fade-out: F", backlash.get_correction(), " (F1.0 = full, F0.0 = none)");
|
||||
SERIAL_ECHOPGM(" Backlash Distance (mm): ");
|
||||
LOOP_XYZ(a) {
|
||||
SERIAL_CHAR(' ', axis_codes[a]);
|
||||
SERIAL_CHAR(' ', XYZ_CHAR(a));
|
||||
SERIAL_ECHO(backlash.distance_mm[a]);
|
||||
SERIAL_EOL();
|
||||
}
|
||||
@ -88,7 +88,7 @@ void GcodeSuite::M425() {
|
||||
SERIAL_ECHOPGM(" Average measured backlash (mm):");
|
||||
if (backlash.has_any_measurement()) {
|
||||
LOOP_XYZ(a) if (backlash.has_measurement(AxisEnum(a))) {
|
||||
SERIAL_CHAR(' ', axis_codes[a]);
|
||||
SERIAL_CHAR(' ', XYZ_CHAR(a));
|
||||
SERIAL_ECHO(backlash.get_measurement(AxisEnum(a)));
|
||||
}
|
||||
}
|
||||
|
@ -40,10 +40,10 @@
|
||||
void GcodeSuite::M666() {
|
||||
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM(">>> M666");
|
||||
LOOP_XYZ(i) {
|
||||
if (parser.seen(axis_codes[i])) {
|
||||
if (parser.seen(XYZ_CHAR(i))) {
|
||||
const float v = parser.value_linear_units();
|
||||
if (v * Z_HOME_DIR <= 0) delta_endstop_adj[i] = v;
|
||||
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("delta_endstop_adj[", axis_codes[i], "] = ", delta_endstop_adj[i]);
|
||||
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("delta_endstop_adj[", XYZ_CHAR(i), "] = ", delta_endstop_adj[i]);
|
||||
}
|
||||
}
|
||||
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("<<< M666");
|
||||
|
@ -138,7 +138,7 @@
|
||||
|
||||
HOTEND_LOOP() {
|
||||
DEBUG_ECHOPAIR_P(SP_T_STR, int(e));
|
||||
LOOP_XYZ(a) DEBUG_ECHOPAIR(" hotend_offset[", int(e), "].", axis_codes[a] | 0x20, "=", hotend_offset[e][a]);
|
||||
LOOP_XYZ(a) DEBUG_ECHOPAIR(" hotend_offset[", int(e), "].", XYZ_CHAR(a) | 0x20, "=", hotend_offset[e][a]);
|
||||
DEBUG_EOL();
|
||||
}
|
||||
DEBUG_EOL();
|
||||
|
@ -56,10 +56,10 @@ void GcodeSuite::G61(void) {
|
||||
|
||||
SERIAL_ECHOPAIR(STR_RESTORING_POS " S", int(slot));
|
||||
LOOP_XYZ(i) {
|
||||
destination[i] = parser.seen(axis_codes[i])
|
||||
destination[i] = parser.seen(XYZ_CHAR(i))
|
||||
? stored_position[slot][i] + parser.value_axis_units((AxisEnum)i)
|
||||
: current_position[i];
|
||||
SERIAL_CHAR(' ', axis_codes[i]);
|
||||
SERIAL_CHAR(' ', XYZ_CHAR(i));
|
||||
SERIAL_ECHO_F(destination[i]);
|
||||
}
|
||||
SERIAL_EOL();
|
||||
|
@ -348,7 +348,7 @@
|
||||
|
||||
bool report = true;
|
||||
const uint8_t index = parser.byteval('I');
|
||||
LOOP_XYZ(i) if (parser.seen(axis_codes[i])) {
|
||||
LOOP_XYZ(i) if (parser.seen(XYZ_CHAR(i))) {
|
||||
const int16_t value = parser.value_int();
|
||||
report = false;
|
||||
switch (i) {
|
||||
|
@ -135,7 +135,7 @@ void GcodeSuite::get_destination_from_command() {
|
||||
|
||||
// Get new XYZ position, whether absolute or relative
|
||||
LOOP_XYZ(i) {
|
||||
if ( (seen[i] = parser.seenval(axis_codes[i])) ) {
|
||||
if ( (seen[i] = parser.seenval(XYZ_CHAR(i))) ) {
|
||||
const float v = parser.value_axis_units((AxisEnum)i);
|
||||
if (skip_move)
|
||||
destination[i] = current_position[i];
|
||||
|
@ -38,7 +38,7 @@
|
||||
*/
|
||||
void GcodeSuite::M206() {
|
||||
LOOP_XYZ(i)
|
||||
if (parser.seen(axis_codes[i]))
|
||||
if (parser.seen(XYZ_CHAR(i)))
|
||||
set_home_offset((AxisEnum)i, parser.value_linear_units());
|
||||
|
||||
#if ENABLED(MORGAN_SCARA)
|
||||
|
@ -45,8 +45,8 @@
|
||||
|
||||
void report_xyz(const xyz_pos_t &pos, const uint8_t precision=3) {
|
||||
char str[12];
|
||||
for (uint8_t a = X_AXIS; a <= Z_AXIS; a++) {
|
||||
SERIAL_CHAR(' ', axis_codes[a], ':');
|
||||
LOOP_XYZ(a) {
|
||||
SERIAL_CHAR(' ', XYZ_CHAR(a), ':');
|
||||
SERIAL_ECHO(dtostrf(pos[a], 1, precision, str));
|
||||
}
|
||||
SERIAL_EOL();
|
||||
|
@ -76,8 +76,8 @@
|
||||
*/
|
||||
void GcodeSuite::M290() {
|
||||
#if ENABLED(BABYSTEP_XY)
|
||||
for (uint8_t a = X_AXIS; a <= Z_AXIS; a++)
|
||||
if (parser.seenval(axis_codes[a]) || (a == Z_AXIS && parser.seenval('S'))) {
|
||||
LOOP_XYZ(a)
|
||||
if (parser.seenval(XYZ_CHAR(a)) || (a == Z_AXIS && parser.seenval('S'))) {
|
||||
const float offs = constrain(parser.value_axis_units((AxisEnum)a), -2, 2);
|
||||
babystep.add_mm((AxisEnum)a, offs);
|
||||
#if ENABLED(BABYSTEP_ZPROBE_OFFSET)
|
||||
|
@ -587,7 +587,7 @@ void restore_feedrate_and_scaling() {
|
||||
#endif
|
||||
|
||||
if (DEBUGGING(LEVELING))
|
||||
SERIAL_ECHOLNPAIR("Axis ", axis_codes[axis], " min:", soft_endstop.min[axis], " max:", soft_endstop.max[axis]);
|
||||
SERIAL_ECHOLNPAIR("Axis ", XYZ_CHAR(axis), " min:", soft_endstop.min[axis], " max:", soft_endstop.max[axis]);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1779,7 +1779,7 @@ void homeaxis(const AxisEnum axis) {
|
||||
#if HAS_WORKSPACE_OFFSET
|
||||
void update_workspace_offset(const AxisEnum axis) {
|
||||
workspace_offset[axis] = home_offset[axis] + position_shift[axis];
|
||||
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("Axis ", axis_codes[axis], " home_offset = ", home_offset[axis], " position_shift = ", position_shift[axis]);
|
||||
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("Axis ", XYZ_CHAR(axis), " home_offset = ", home_offset[axis], " position_shift = ", position_shift[axis]);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user