🧑‍💻 Combined axis strings

This commit is contained in:
Scott Lahteine 2022-05-23 21:59:36 -05:00
parent c4ac695c15
commit 6a2a592c26
8 changed files with 10 additions and 10 deletions

View File

@ -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)
@ -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)

View File

@ -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();
@ -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();

View File

@ -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) {

View File

@ -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());

View File

@ -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))

View File

@ -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?

View File

@ -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)

View File

@ -225,7 +225,7 @@ public:
#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);