Skip to content

Commit 8290012

Browse files
committed
report axes
1 parent 59da651 commit 8290012

File tree

1 file changed

+37
-30
lines changed

1 file changed

+37
-30
lines changed

Marlin/src/gcode/host/M360.cpp

Lines changed: 37 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -39,23 +39,29 @@ static void config_prefix(PGM_P const name, PGM_P const pref=nullptr, const int8
3939
if (ind >= 0) { SERIAL_ECHO(ind); SERIAL_CHAR(':'); }
4040
SERIAL_ECHOPGM_P(name, C(':'));
4141
}
42-
static void config_line(PGM_P const name, const float val, PGM_P const pref=nullptr, const int8_t ind=-1) {
42+
template<typename T>
43+
static void config_line(PGM_P const name, const T val, PGM_P const pref=nullptr, const int8_t ind=-1) {
4344
config_prefix(name, pref, ind);
4445
SERIAL_ECHOLN(val);
4546
}
46-
static void config_line(FSTR_P const name, const float val, FSTR_P const pref=nullptr, const int8_t ind=-1) {
47+
template<typename T>
48+
static void config_line(FSTR_P const name, const T val, FSTR_P const pref=nullptr, const int8_t ind=-1) {
4749
config_line(FTOP(name), val, FTOP(pref), ind);
4850
}
49-
static void config_line(PGM_P const name, const float val, FSTR_P const pref=nullptr, const int8_t ind=-1) {
51+
template<typename T>
52+
static void config_line(PGM_P const name, const T val, FSTR_P const pref=nullptr, const int8_t ind=-1) {
5053
config_line(name, val, FTOP(pref), ind);
5154
}
52-
static void config_line(FSTR_P const name, const float val, PGM_P const pref=nullptr, const int8_t ind=-1) {
55+
template<typename T>
56+
static void config_line(FSTR_P const name, const T val, PGM_P const pref=nullptr, const int8_t ind=-1) {
5357
config_line(FTOP(name), val, pref, ind);
5458
}
55-
static void config_line_e(const int8_t e, PGM_P const name, const float val) {
59+
template<typename T>
60+
static void config_line_e(const int8_t e, PGM_P const name, const T val) {
5661
config_line(name, val, PSTR("Extr."), e + 1);
5762
}
58-
static void config_line_e(const int8_t e, FSTR_P const name, const float val) {
63+
template<typename T>
64+
static void config_line_e(const int8_t e, FSTR_P const name, const T val) {
5965
config_line_e(e, FTOP(name), val);
6066
}
6167

@@ -64,10 +70,6 @@ static void config_line_e(const int8_t e, FSTR_P const name, const float val) {
6470
* in RepRapFirmware-compatible format
6571
*/
6672
void GcodeSuite::M360() {
67-
#if ANY(CLASSIC_JERK, HAS_LINEAR_E_JERK)
68-
PGMSTR(JERK_STR, "Jerk");
69-
#endif
70-
7173
//
7274
// Basics and Enabled items
7375
//
@@ -88,9 +90,8 @@ void GcodeSuite::M360() {
8890
//
8991
// Axis letters, in PROGMEM
9092
//
91-
PGMSTR(X_STR, "X"); PGMSTR(Y_STR, "Y"); PGMSTR(Z_STR, "Z");
92-
PGMSTR(I_STR, STR_I); PGMSTR(J_STR, STR_J); PGMSTR(K_STR, STR_K);
93-
PGMSTR(U_STR, STR_U); PGMSTR(V_STR, STR_V); PGMSTR(W_STR, STR_W);
93+
#define _DEFINE_A_STR(Q) PGMSTR(Q##_STR, STR_##Q);
94+
MAIN_AXIS_MAP(_DEFINE_A_STR);
9495

9596
//
9697
// Homing Directions
@@ -124,17 +125,23 @@ void GcodeSuite::M360() {
124125
config_line(H_DIR_STR, W_HOME_DIR, W_STR);
125126
#endif
126127

128+
#if ANY(CLASSIC_JERK, HAS_LINEAR_E_JERK)
129+
PGMSTR(JERK_STR, "Jerk");
130+
#endif
131+
127132
//
128133
// XYZ Axis Jerk
129134
//
130135
#if ENABLED(CLASSIC_JERK)
131-
if (planner.max_jerk.x == planner.max_jerk.y)
136+
#define _REPORT_JERK(Q), config_line(Q##_STR, planner.max_jerk.Q, JERK_STR);
137+
if (TERN0(HAS_Y_AXIS, planner.max_jerk.x == planner.max_jerk.y))
132138
config_line(F("XY"), planner.max_jerk.x, JERK_STR);
133139
else {
134-
config_line(X_STR, planner.max_jerk.x, JERK_STR);
135-
config_line(Y_STR, planner.max_jerk.y, JERK_STR);
140+
TERN_(HAS_X_AXIS, _REPORT_JERK(X));
141+
TERN_(HAS_Y_AXIS, _REPORT_JERK(Y));
136142
}
137-
config_line(Z_STR, planner.max_jerk.z, JERK_STR);
143+
TERN_(HAS_Z_AXIS, config_line(Z_STR, planner.max_jerk.z, JERK_STR));
144+
SECONDARY_AXIS_MAP(_REPORT_JERK);
138145
#endif
139146

140147
//
@@ -168,36 +175,36 @@ void GcodeSuite::M360() {
168175
const xyz_pos_t wmin = cmin.asLogical(), wmax = cmax.asLogical();
169176

170177
PGMSTR(MIN_STR, "Min");
171-
#define _REPORT_MIN(Q) config_line(MIN_STR, wmin.Q, Q##_STR)
172-
LOGICAL_AXIS_MAP(_REPORT_MIN);
178+
#define _REPORT_MIN(Q) config_line(MIN_STR, wmin.Q, Q##_STR);
179+
MAIN_AXIS_MAP(_REPORT_MIN);
173180

174181
PGMSTR(MAX_STR, "Max");
175-
#define _REPORT_MAX(Q) config_line(MAX_STR, wmax.Q, Q##_STR)
176-
LOGICAL_AXIS_MAP(_REPORT_MAX);
182+
#define _REPORT_MAX(Q) config_line(MAX_STR, wmax.Q, Q##_STR);
183+
MAIN_AXIS_MAP(_REPORT_MAX);
177184

178185
PGMSTR(SIZE_STR, "Size");
179-
#define _REPORT_SIZE(Q) config_line(SIZE_STR, wmax.Q - wmin.Q, Q##_STR)
180-
LOGICAL_AXIS_MAP(_REPORT_SIZE);
186+
#define _REPORT_SIZE(Q) config_line(SIZE_STR, wmax.Q - wmin.Q, Q##_STR);
187+
MAIN_AXIS_MAP(_REPORT_SIZE);
181188

182189
//
183190
// Axis Steps per mm
184191
//
185192
PGMSTR(S_MM_STR, "Steps/mm");
186-
#define _REPORT_S_MM(A) config_line(S_MM_STR, planner.settings.axis_steps_per_mm[_AXIS(A)], A##_STR);
187-
LOGICAL_AXIS_MAP(_REPORT_S_MM);
193+
#define _REPORT_S_MM(Q) config_line(S_MM_STR, planner.settings.axis_steps_per_mm[_AXIS(Q)], Q##_STR);
194+
MAIN_AXIS_MAP(_REPORT_S_MM);
188195

189196
//
190197
// Print and Travel Acceleration
191198
//
192-
#define _ACCEL(A,B) _MIN(planner.settings.max_acceleration_mm_per_s2[A##_AXIS], planner.settings.B)
199+
#define _ACCEL(Q,B) _MIN(planner.settings.max_acceleration_mm_per_s2[Q##_AXIS], planner.settings.B)
193200

194201
PGMSTR(P_ACC_STR, "PrintAccel");
195-
#define _REPORT_P_ACC(A) config_line(P_ACC_STR, _ACCEL(A, acceleration), A##_STR);
196-
LOGICAL_AXIS_MAP(_REPORT_P_ACC);
202+
#define _REPORT_P_ACC(Q) config_line(P_ACC_STR, _ACCEL(Q, acceleration), Q##_STR);
203+
MAIN_AXIS_MAP(_REPORT_P_ACC);
197204

198205
PGMSTR(T_ACC_STR, "TravelAccel");
199-
#define _REPORT_T_ACC(A) config_line(T_ACC_STR, _ACCEL(A, travel_acceleration), A##_STR);
200-
LOGICAL_AXIS_MAP(_REPORT_T_ACC);
206+
#define _REPORT_T_ACC(Q) config_line(T_ACC_STR, _ACCEL(Q, travel_acceleration), Q##_STR);
207+
MAIN_AXIS_MAP(_REPORT_T_ACC);
201208

202209
//
203210
// Printer Type

0 commit comments

Comments
 (0)