Skip to content

Commit

Permalink
πŸ§‘β€πŸ’» Combined axis strings
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Jun 6, 2022
1 parent c4ac695 commit 6a2a592
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions Marlin/src/core/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ struct IF<true, L, R> { typedef L type; };
#define NUM_AXIS_DEFS(T,V) NUM_AXIS_LIST(T x=V, T y=V, T z=V, T i=V, T j=V, T k=V, T u=V, T v=V, T w=V)
#define MAIN_AXIS_NAMES NUM_AXIS_LIST(X, Y, Z, I, J, K, U, V, W)
#define MAIN_AXIS_MAP(F) MAP(F, MAIN_AXIS_NAMES)
#define STR_AXES_MAIN NUM_AXIS_GANG("X", "Y", "Z", STR_I, STR_J, STR_K, STR_U, STR_V, STR_W)

#define LOGICAL_AXIS_GANG(E,V...) NUM_AXIS_GANG(V) GANG_ITEM_E(E)
#define LOGICAL_AXIS_CODE(E,V...) NUM_AXIS_CODE(V) CODE_ITEM_E(E)
Expand All @@ -59,8 +60,7 @@ struct IF<true, L, R> { typedef L type; };
#define LOGICAL_AXIS_DECL(T,V) LOGICAL_AXIS_LIST(T e=V, T x=V, T y=V, T z=V, T i=V, T j=V, T k=V, T u=V, T v=V, T w=V)
#define LOGICAL_AXIS_NAMES LOGICAL_AXIS_LIST(E, X, Y, Z, I, J, K, U, V, W)
#define LOGICAL_AXIS_MAP(F) MAP(F, LOGICAL_AXIS_NAMES)

#define LOGICAL_AXES_STRING LOGICAL_AXIS_GANG("E", "X", "Y", "Z", STR_I, STR_J, STR_K, STR_U, STR_V, STR_W)
#define STR_AXES_LOGICAL LOGICAL_AXIS_GANG("E", "X", "Y", "Z", STR_I, STR_J, STR_K, STR_U, STR_V, STR_W)

#define XYZ_GANG(V...) GANG_N(PRIMARY_LINEAR_AXES, V)
#define XYZ_CODE(V...) CODE_N(PRIMARY_LINEAR_AXES, V)
Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/gcode/config/M200-M205.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@
* S<percent> : Speed factor percentage.
*/
void GcodeSuite::M201() {
if (!parser.seen("T" LOGICAL_AXES_STRING TERN_(XY_FREQUENCY_LIMIT, "FS")))
if (!parser.seen("T" STR_AXES_LOGICAL TERN_(XY_FREQUENCY_LIMIT, "FS")))
return M201_report();

const int8_t target_extruder = get_target_extruder_from_command();
Expand Down Expand Up @@ -176,7 +176,7 @@ void GcodeSuite::M201_report(const bool forReplay/*=true*/) {
* With multiple extruders use T to specify which one.
*/
void GcodeSuite::M203() {
if (!parser.seen("T" LOGICAL_AXES_STRING))
if (!parser.seen("T" STR_AXES_LOGICAL))
return M203_report();

const int8_t target_extruder = get_target_extruder_from_command();
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/gcode/config/M92.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ void GcodeSuite::M92() {
if (target_extruder < 0) return;

// No arguments? Show M92 report.
if (!parser.seen(LOGICAL_AXES_STRING TERN_(MAGIC_NUMBERS_GCODE, "HL")))
if (!parser.seen(STR_AXES_LOGICAL TERN_(MAGIC_NUMBERS_GCODE, "HL")))
return M92_report(true, target_extruder);

LOOP_LOGICAL_AXES(i) {
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/gcode/feature/digipot/M907-M910.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
void GcodeSuite::M907() {
#if HAS_MOTOR_CURRENT_SPI

if (!parser.seen("BS" LOGICAL_AXES_STRING))
if (!parser.seen("BS" STR_AXES_LOGICAL))
return M907_report();

if (parser.seenval('S')) LOOP_L_N(i, MOTOR_CURRENT_COUNT) stepper.set_digipot_current(i, parser.value_int());
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/gcode/feature/pause/G61.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ void GcodeSuite::G61() {
SYNC_E(stored_position[slot].e);
}
else {
if (parser.seen(NUM_AXIS_GANG("X", "Y", "Z", STR_I, STR_J, STR_K, STR_U, STR_V, STR_W))) {
if (parser.seen(STR_AXES_MAIN)) {
DEBUG_ECHOPGM(STR_RESTORING_POS " S", slot);
LOOP_NUM_AXES(i) {
destination[i] = parser.seenval(AXIS_CHAR(i))
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/gcode/motion/G0_G1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ void GcodeSuite::G0_G1(TERN_(HAS_FAST_MOVES, const bool fast_move/*=false*/)) {
if (MIN_AUTORETRACT <= MAX_AUTORETRACT) {
// When M209 Autoretract is enabled, convert E-only moves to firmware retract/recover moves
if (fwretract.autoretract_enabled && parser.seen_test('E')
&& !parser.seen(NUM_AXIS_GANG("X", "Y", "Z", STR_I, STR_J, STR_K, STR_U, STR_V, STR_W))
&& !parser.seen(STR_AXES_MAIN)
) {
const float echange = destination.e - current_position.e;
// Is this a retract or recover move?
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/gcode/motion/M290.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ void GcodeSuite::M290() {
}
#endif

if (!parser.seen(NUM_AXIS_GANG("X", "Y", "Z", STR_I, STR_J, STR_K, STR_U, STR_V, STR_W)) || parser.seen('R')) {
if (!parser.seen(STR_AXES_MAIN) || parser.seen('R')) {
SERIAL_ECHO_START();

#if ENABLED(BABYSTEP_ZPROBE_OFFSET)
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/gcode/parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ class GCodeParser {
#endif // !FASTER_GCODE_PARSER

// Seen any axis parameter
static bool seen_axis() { return seen(LOGICAL_AXES_STRING); }
static bool seen_axis() { return seen(STR_AXES_LOGICAL); }

#if ENABLED(GCODE_QUOTED_STRINGS)
static char* unescape_string(char* &src);
Expand Down

0 comments on commit 6a2a592

Please sign in to comment.